:root {
  --bg: #F7F4EE;
  --surface-1: rgba(255,255,255,0.70);
  --surface-1-solid: #FFFFFF;
  --surface-2: rgba(251,249,244,0.55);
  --surface-hover: rgba(239,235,226,0.85);
  --border: rgba(20,18,14,0.10);
  --border-strong: rgba(20,18,14,0.18);
  --text-primary: #1C1A16;
  --text-secondary: #6B665C;
  --text-muted: #9C9689;
  --accent: #D97757;
  --accent-hover: #C7663F;
  --accent-bg: #FBEAE2;
  --accent-text: #A8471F;
  --accent-rgb: 217,119,87;
  --on-accent: #FFFFFF;
  --success-text: #3B6D11;
  --success-bg: #EAF3DE;
  --warning-text: #854F0B;
  --warning-bg: #FAEEDA;
  --danger-text: #A32D2D;
  --danger-bg: #FCEBEB;
  --shadow-card: 0 1px 2px rgba(20,18,14,0.05), 0 1px 1px rgba(20,18,14,0.03);
  --shadow-lift: 0 14px 32px -12px rgba(20,18,14,0.18), 0 0 0 1px rgba(20,18,14,0.04);
  --shadow-glow: 0 14px 34px -10px rgba(var(--accent-rgb),0.30);
  --blur: 22px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --glass-shine: linear-gradient(135deg, rgba(255,255,255,0.35) 0%, rgba(255,255,255,0.02) 45%, rgba(255,255,255,0) 60%);
}

@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 180ms;
  animation-timing-function: ease-out;
}

::view-transition-old(root) {
  animation-name: corstruct-fade-out;
}

::view-transition-new(root) {
  animation-name: corstruct-fade-in;
}

@keyframes corstruct-fade-out {
  to { opacity: 0.72; }
}

@keyframes corstruct-fade-in {
  from { opacity: 0.72; }
}

html[data-theme="dark"] {
  --bg: #16140F;
  --surface-1: rgba(38,35,29,0.55);
  --surface-1-solid: #221F1A;
  --surface-2: rgba(29,27,23,0.55);
  --surface-hover: rgba(48,44,37,0.75);
  --border: rgba(255,252,246,0.09);
  --border-strong: rgba(255,252,246,0.16);
  --text-primary: #F3EFE7;
  --text-secondary: #ADA79A;
  --text-muted: #7C7668;
  --accent: #E08A67;
  --accent-hover: #E89A7B;
  --accent-bg: #3A2419;
  --accent-text: #F0A583;
  --accent-rgb: 224,138,103;
  --on-accent: #1C1108;
  --success-text: #97C459;
  --success-bg: #1E2A10;
  --warning-text: #EF9F27;
  --warning-bg: #33260A;
  --danger-text: #F09595;
  --danger-bg: #3A1414;
  --shadow-card: 0 1px 2px rgba(0,0,0,0.25);
  --shadow-lift: 0 18px 40px -14px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,252,246,0.05);
  --shadow-glow: 0 16px 38px -10px rgba(var(--accent-rgb),0.35);
  --glass-shine: linear-gradient(135deg, rgba(255,255,255,0.07) 0%, rgba(255,255,255,0.01) 45%, rgba(255,255,255,0) 60%);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  position: relative;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
table { border-collapse: collapse; width: 100%; }

/* Ambient background glow — the "high-end SaaS" light-blob treatment */
body::before, body::after {
  content: "";
  position: fixed;
  width: 620px; height: 620px;
  border-radius: 50%;
  filter: blur(120px);
  z-index: 0;
  pointer-events: none;
  opacity: 0.35;
}
body::before {
  top: -220px; left: -160px;
  background: radial-gradient(circle, rgba(var(--accent-rgb),0.55) 0%, rgba(var(--accent-rgb),0) 70%);
}
body::after {
  bottom: -260px; right: -180px;
  width: 560px; height: 560px;
  background: radial-gradient(circle, rgba(var(--accent-rgb),0.30) 0%, rgba(var(--accent-rgb),0) 70%);
  opacity: 0.28;
}

.shell { display: grid; grid-template-columns: 224px 1fr; min-height: 100vh; position: relative; z-index: 1; }

/* Sidebar — glass panel */
.sidebar {
  background: var(--surface-1);
  backdrop-filter: blur(var(--blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display:flex; align-items:center; gap:10px; padding: 4px 8px 22px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(150deg, var(--accent) 0%, var(--accent-hover) 100%);
  display:flex; align-items:center; justify-content:center;
  flex-shrink:0;
  box-shadow: 0 4px 12px -2px rgba(var(--accent-rgb),0.55);
}
.brand-mark i.ti {
  width: 15px; height: 15px;
  background-color: #fff;
  color: transparent;
}
.brand-name { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }

.nav { display:flex; flex-direction:column; gap: 2px; }
.nav-item {
  display:flex; align-items:center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 13.5px; font-weight: 500;
  transition: background .15s ease, color .15s ease, transform .15s ease;
  cursor: pointer;
}
.nav-item i { font-size: 17px; flex-shrink:0; }
.nav-item:hover { background: var(--surface-hover); color: var(--text-primary); transform: translateX(2px); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(var(--accent-rgb),0.20), rgba(var(--accent-rgb),0.08));
  color: var(--accent-text);
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb),0.25);
}

.sidebar-footer { margin-top: auto; display:flex; flex-direction:column; gap: 10px; }

.theme-toggle {
  display:flex; border:1px solid var(--border); border-radius: var(--radius-sm);
  overflow:hidden; padding: 2px;
  background: var(--surface-2);
}
.theme-toggle button {
  flex:1; border:none; background:transparent; color: var(--text-secondary);
  font-size: 12.5px; font-weight: 500; padding: 6px 0; border-radius: 6px;
  display:flex; align-items:center; justify-content:center; gap:6px;
  transition: background .15s ease, color .15s ease;
}
.theme-toggle button.active { background: var(--accent); color: var(--on-accent); box-shadow: 0 3px 10px -2px rgba(var(--accent-rgb),0.5); }

.user-chip {
  display:flex; align-items:center; gap: 8px;
  padding: 8px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-2); min-width: 0;
}
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-bg); color: var(--accent-text);
  display:flex; align-items:center; justify-content:center;
  font-size: 12px; font-weight: 600; flex-shrink: 0;
}
.user-chip .who { min-width: 0; }
.user-chip .who p { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .name { font-size: 12.5px; font-weight: 600; }
.user-chip .role { font-size: 11px; color: var(--text-muted); }
.signout { margin-left: auto; color: var(--text-muted); font-size: 15px; flex-shrink:0; }

/* Main */
.main { padding: 22px 32px 48px; max-width: 1180px; position: relative; z-index: 1; }

.topbar { display:flex; align-items:center; gap: 12px; margin-bottom: 20px; }
.ask-bar {
  flex: 1; display:flex; align-items:center; gap: 8px;
  border: 1px solid var(--border); background: var(--surface-1);
  backdrop-filter: blur(var(--blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
  border-radius: var(--radius-sm); padding: 0 14px; height: 40px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.ask-bar:focus-within { border-color: rgba(var(--accent-rgb),0.5); box-shadow: 0 0 0 3px rgba(var(--accent-rgb),0.12); }
.ask-bar i { color: var(--text-muted); font-size: 16px; }
.ask-bar input {
  border: none; background: transparent; outline: none; flex: 1;
  color: var(--text-primary); font-size: 13.5px; height: 100%;
}
.ask-bar input::placeholder { color: var(--text-muted); }
.ask-btn {
  background: linear-gradient(150deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: var(--on-accent); border: none;
  border-radius: var(--radius-sm); padding: 0 18px; height: 40px;
  font-size: 13.5px; font-weight: 600;
  box-shadow: 0 6px 16px -4px rgba(var(--accent-rgb),0.55);
  transition: transform .15s ease, box-shadow .15s ease;
}
.ask-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 20px -4px rgba(var(--accent-rgb),0.65); }
.icon-btn {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-1);
  backdrop-filter: blur(var(--blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
  display:flex; align-items:center; justify-content:center;
  color: var(--text-secondary); font-size: 17px; flex-shrink: 0;
  transition: background .15s ease, transform .15s ease;
}
.icon-btn:hover { background: var(--surface-hover); transform: translateY(-1px); }
.icon-btn svg { width: 18px; height: 18px; display: block; stroke: currentColor; fill: none; }

/* Icons without a webfont — Tabler CDN often fails locally */
i.ti {
  font-family: inherit !important;
  font-style: normal;
  line-height: 0;
  width: 17px; height: 17px;
  display: inline-block; flex-shrink: 0; vertical-align: -3px;
  background-color: currentColor;
  -webkit-mask: var(--ico) center / contain no-repeat;
  mask: var(--ico) center / contain no-repeat;
}
i.ti::before, i.ti::after { content: none !important; }
.icon-btn i.ti { width: 18px; height: 18px; }
.nav-item i.ti { width: 17px; height: 17px; }
.ask-bar i.ti { width: 16px; height: 16px; }

.ti-layout-dashboard { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='7' height='9' rx='1'/%3E%3Crect x='14' y='3' width='7' height='5' rx='1'/%3E%3Crect x='14' y='12' width='7' height='9' rx='1'/%3E%3Crect x='3' y='16' width='7' height='5' rx='1'/%3E%3C/svg%3E"); }
.ti-bell { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8a6 6 0 1 1 12 0c0 7 3 9 3 9H3s3-2 3-9'/%3E%3Cpath d='M10 21a2 2 0 0 0 4 0'/%3E%3C/svg%3E"); }
.ti-mail-forward { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M13 19H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6'/%3E%3Cpath d='m3 7 9 6 9-6'/%3E%3Cpath d='M15 19h6'/%3E%3Cpath d='m18 16 3 3-3 3'/%3E%3C/svg%3E"); }
.ti-folder { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/%3E%3C/svg%3E"); }
.ti-users { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8' r='3'/%3E%3Cpath d='M3 19a6 6 0 0 1 12 0'/%3E%3Ccircle cx='17' cy='9' r='2.5'/%3E%3Cpath d='M21 19a5 5 0 0 0-4-4.9'/%3E%3C/svg%3E"); }
.ti-list-check { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 6 2 2 4-4'/%3E%3Cpath d='M4 6h.01M4 12h.01M4 18h.01'/%3E%3Cpath d='M9 12h11M9 18h11'/%3E%3C/svg%3E"); }
.ti-receipt { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 4h14v16l-2-1-2 1-2-1-2 1-2-1-2 1z'/%3E%3Cpath d='M9 8h6M9 12h6M9 16h4'/%3E%3C/svg%3E"); }
.ti-plug { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 7v4M15 7v4M8 11h8v2a4 4 0 0 1-8 0z'/%3E%3Cpath d='M12 17v4M8 4v3M16 4v3'/%3E%3C/svg%3E"); }
.ti-sun { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 3v2M12 19v2M5 12H3M21 12h-2M6.2 6.2l1.4 1.4M16.4 16.4l1.4 1.4M6.2 17.8l1.4-1.4M16.4 7.6l1.4-1.4'/%3E%3C/svg%3E"); }
.ti-moon { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 14.5A8.5 8.5 0 1 1 9.5 3 7 7 0 0 0 21 14.5z'/%3E%3C/svg%3E"); }
.ti-logout { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2v-2'/%3E%3Cpath d='M9 12h12'/%3E%3Cpath d='m17 9 4 3-4 3'/%3E%3C/svg%3E"); }
.ti-sparkles { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3l1.5 4.5L18 9l-4.5 1.5L12 15l-1.5-4.5L6 9l4.5-1.5z'/%3E%3Cpath d='M18 14l.8 2.2L21 17l-2.2.8L18 20l-.8-2.2L15 17l2.2-.8z'/%3E%3C/svg%3E"); }
.ti-layout-sidebar-right { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='16' rx='2'/%3E%3Cpath d='M15 4v16'/%3E%3C/svg%3E"); }
.ti-plus { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E"); }
.ti-calendar { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='5' width='16' height='15' rx='2'/%3E%3Cpath d='M8 3v4M16 3v4M4 10h16'/%3E%3C/svg%3E"); }
.ti-clock { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3Cpath d='M12 8v5l3 2'/%3E%3C/svg%3E"); }
.ti-timeline { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v16'/%3E%3Ccircle cx='12' cy='6' r='2'/%3E%3Ccircle cx='12' cy='12' r='2'/%3E%3Ccircle cx='12' cy='18' r='2'/%3E%3C/svg%3E"); }
.ti-file-text { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 3v5h5M9 13h6M9 17h4'/%3E%3C/svg%3E"); }
.ti-microphone { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='3' width='6' height='11' rx='3'/%3E%3Cpath d='M5 11a7 7 0 0 0 14 0M12 18v3'/%3E%3C/svg%3E"); }
.ti-x { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E"); }
.ti-check { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5L20 7'/%3E%3C/svg%3E"); }
.ti-file { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 3v5h5'/%3E%3C/svg%3E"); }
.ti-user { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='3.5'/%3E%3Cpath d='M5 19a7 7 0 0 1 14 0'/%3E%3C/svg%3E"); }
.ti-user-minus { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8' r='3'/%3E%3Cpath d='M3 19a6 6 0 0 1 12 0M16 12h6'/%3E%3C/svg%3E"); }
.ti-eye { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s4-7 10-7 10 7 10 7-4 7-10 7S2 12 2 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E"); }
.ti-eye-off { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 3l18 18M10.6 10.6A3 3 0 0 0 13.4 13.4M6.1 6.1C4 7.6 2.5 10 2 12c.5 2 4 7 10 7 1.8 0 3.4-.5 4.8-1.2M9.9 5.1C10.6 5 11.3 5 12 5c6 0 9.5 5 10 7-.2.8-1 2.2-2.3 3.6'/%3E%3C/svg%3E"); }
.ti-arrows-horizontal { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 12H3M21 12h-4M7 12 4 9M7 12l-3 3M17 12l3-3M17 12l3 3'/%3E%3C/svg%3E"); }
.ti-building-skyscraper { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M4 21V8l8-5 8 5v13H4zm2-2h2v-2H6v2zm0-4h2v-2H6v2zm4 4h2v-2h-2v2zm0-4h2v-2h-2v2zm4 4h2v-2h-2v2zm0-4h2v-2h-2v2z'/%3E%3C/svg%3E"); }
.ti-bulb { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M9 21h6v-1H9v1zm3-19a6 6 0 0 0-4 10.7V16h8v-3.3A6 6 0 0 0 12 2zm0 2a4 4 0 0 1 3.6 5.7L15 11.5V14H9v-2.5l.4-1.8A4 4 0 0 1 12 4z'/%3E%3C/svg%3E"); }

/* Page header — glass with a diagonal sheen */
.page-header {
  position: relative;
  background: linear-gradient(135deg, rgba(var(--accent-rgb),0.16), rgba(var(--accent-rgb),0.05));
  border: 1px solid rgba(var(--accent-rgb),0.16);
  backdrop-filter: blur(var(--blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  overflow: hidden;
}
.page-header::before {
  content: "";
  position: absolute; inset: 0;
  background: var(--glass-shine);
  pointer-events: none;
}
.page-header h1 { margin: 0 0 6px; font-size: 22px; font-weight: 600; color: var(--text-primary); letter-spacing: -0.01em; position: relative; }
.page-header p { margin: 0; font-size: 13.5px; color: var(--text-secondary); max-width: 560px; position: relative; }
.page-header-action { flex-shrink: 0; position: relative; }

.btn-primary {
  background: linear-gradient(150deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: var(--on-accent); border: none;
  border-radius: var(--radius-sm); padding: 0 16px; height: 38px;
  font-size: 13.5px; font-weight: 600; display:flex; align-items:center; gap: 6px;
  box-shadow: 0 6px 16px -4px rgba(var(--accent-rgb),0.5);
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 20px -4px rgba(var(--accent-rgb),0.6); }
.btn-secondary {
  background: var(--surface-1); color: var(--text-primary); border: 1px solid var(--border-strong);
  backdrop-filter: blur(var(--blur));
  border-radius: var(--radius-sm); padding: 0 16px; height: 38px;
  font-size: 13.5px; font-weight: 600; display:flex; align-items:center; gap: 6px;
  transition: background .15s ease, transform .15s ease;
}
.btn-secondary:hover { background: var(--surface-hover); transform: translateY(-1px); }

/* Stat cards */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.stat-card {
  position: relative;
  background: var(--surface-1);
  backdrop-filter: blur(var(--blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
  border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 16px 16px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.stat-card::before { content:""; position:absolute; inset:0; background: var(--glass-shine); pointer-events:none; }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); border-color: var(--border-strong); }
.stat-top { display:flex; align-items:center; justify-content:space-between; margin-bottom: 10px; position: relative; }
.stat-top i { font-size: 17px; color: var(--accent-text); }
.stat-tag { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 20px; }
.stat-tag.ok { color: var(--success-text); background: var(--success-bg); }
.stat-tag.warn { color: var(--warning-text); background: var(--warning-bg); }
.stat-tag.neutral { color: var(--text-muted); background: var(--surface-2); }
.stat-value { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; margin: 0; position: relative; }
.stat-label { font-size: 12.5px; color: var(--text-muted); margin: 2px 0 0; position: relative; }

.section-head { display:flex; align-items:baseline; justify-content:space-between; margin-bottom: 12px; }
.section-head h2 { font-size: 16px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.section-head .sub { font-size: 12.5px; color: var(--text-muted); margin: 2px 0 0; }
.section-link { font-size: 12.5px; color: var(--accent-text); font-weight: 600; transition: color .15s ease; }
.section-link:hover { color: var(--accent-hover); }

/* Full-size project cards — clickable */
.projects-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-bottom: 28px; }
.project-card {
  display: block;
  position: relative;
  background: var(--surface-1);
  backdrop-filter: blur(var(--blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform .2s cubic-bezier(.2,.8,.2,1), box-shadow .2s ease, border-color .2s ease;
}
.project-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-glow); border-color: rgba(var(--accent-rgb),0.35); }
.project-cover { height: 92px; padding: 16px 18px; display:flex; flex-direction:column; justify-content:flex-end; position: relative; overflow: hidden; }
.project-cover::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.28) 0%, rgba(255,255,255,0) 55%);
}
.project-cover.a { background: linear-gradient(135deg, #E6926F 0%, #C7663F 100%); }
.project-cover.b { background: linear-gradient(135deg, #C3BCAC 0%, #8A8474 100%); }
.project-cover .status-pill {
  position: absolute; top: 14px; right: 16px; z-index: 1;
  font-size: 11px; font-weight: 600; color: #fff;
  background: rgba(0,0,0,0.25); backdrop-filter: blur(6px);
  padding: 3px 10px; border-radius: 20px;
}
.project-cover h3 { margin: 0; color: #fff; font-size: 17px; font-weight: 650; letter-spacing: -0.01em; position: relative; z-index: 1; text-shadow: 0 1px 8px rgba(0,0,0,0.15); }

.project-body { padding: 16px 18px 18px; position: relative; }
.project-meta-row { display:flex; align-items:center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.project-meta { display:flex; align-items:center; gap: 6px; font-size: 12px; color: var(--text-secondary); }
.project-meta i { font-size: 14px; color: var(--text-muted); }

.progress-track { height: 6px; border-radius: 20px; background: var(--surface-2); overflow: hidden; margin-bottom: 6px; }
.progress-fill { height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--accent), var(--accent-hover)); box-shadow: 0 0 8px rgba(var(--accent-rgb),0.5); }
.progress-label { display:flex; justify-content:space-between; font-size: 11.5px; color: var(--text-muted); margin-bottom: 14px; }

.project-footer { display:flex; align-items:center; justify-content:space-between; }
.avatar-stack { display:flex; }
.avatar-stack .avatar { width: 24px; height: 24px; font-size: 10.5px; border: 2px solid var(--surface-1-solid); margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }
.file-count { display:flex; align-items:center; gap: 5px; font-size: 12px; color: var(--text-secondary); }
.file-count i { font-size: 15px; color: var(--text-muted); }
.card-arrow {
  position: absolute; bottom: 16px; right: 18px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent-bg); color: var(--accent-text);
  display:flex; align-items:center; justify-content:center;
  font-size: 13px; opacity: 0; transform: translateX(-4px);
  transition: opacity .18s ease, transform .18s ease;
}
.project-card:hover .card-arrow { opacity: 1; transform: translateX(0); }

/* New project bar (Projects page) */
.new-project-bar { display:flex; gap: 10px; margin-bottom: 20px; }
.new-project-bar input {
  flex: 1; height: 40px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-1); backdrop-filter: blur(var(--blur));
  padding: 0 14px; font-size: 13.5px; color: var(--text-primary); outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.new-project-bar input:focus { border-color: rgba(var(--accent-rgb),0.5); box-shadow: 0 0 0 3px rgba(var(--accent-rgb),0.12); }
.new-project-bar input::placeholder { color: var(--text-muted); }

/* AI reminders / to-dos card (Overview) */
.reminders-card {
  position: relative;
  background: var(--surface-1);
  backdrop-filter: blur(var(--blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px 20px; margin-bottom: 28px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.reminders-card::before { content:""; position:absolute; inset:0; background: var(--glass-shine); pointer-events:none; }
.reminders-head { display:flex; align-items:center; justify-content:space-between; margin-bottom: 14px; position: relative; }
.reminders-title { display:flex; align-items:center; gap: 8px; }
.reminders-title i { font-size: 17px; color: var(--accent-text); }
.reminders-title h2 { margin: 0; }
.ai-badge {
  display:flex; align-items:center; gap: 5px; font-size: 11px; font-weight: 600;
  color: var(--accent-text); background: var(--accent-bg); padding: 3px 9px; border-radius: 20px;
}
.ai-badge i { font-size: 12px; }

.reminder-list { display:flex; flex-direction:column; gap: 2px; position: relative; }
.reminder-row { display:flex; align-items:flex-start; gap: 12px; padding: 11px 8px; border-radius: var(--radius-sm); border-bottom: 1px solid var(--border); cursor: pointer; transition: background .15s ease, transform .15s ease; }
.reminder-row:last-child { border-bottom: none; }
.reminder-row:hover { background: var(--surface-hover); transform: translateX(2px); }
.checkbox { width: 17px; height: 17px; border-radius: 5px; border: 1.5px solid var(--border-strong); margin-top: 2px; flex-shrink: 0; transition: border-color .15s ease, background .15s ease; }
.reminder-row:hover .checkbox { border-color: var(--accent); }
.reminder-body { flex: 1; min-width: 0; }
.reminder-body p.title { margin: 0; font-size: 13.5px; font-weight: 500; }
.reminder-body p.meta { margin: 3px 0 0; font-size: 12px; color: var(--text-muted); }
.reminder-tags { display:flex; gap: 6px; flex-shrink: 0; align-items:center; flex-wrap: wrap; justify-content: flex-end; }
.tag { font-size: 10.5px; font-weight: 600; padding: 3px 8px; border-radius: 20px; white-space: nowrap; }
.tag.overdue { color: var(--danger-text); background: var(--danger-bg); }
.tag.today { color: var(--warning-text); background: var(--warning-bg); }
.tag.ai { color: var(--accent-text); background: var(--accent-bg); display:flex; align-items:center; gap:4px; }
.tag.ai i { font-size: 10px; }

/* Kanban-style columns (Reminders page) */
.board-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.board-col {
  background: var(--surface-1);
  backdrop-filter: blur(var(--blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
  border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 14px; min-height: 200px;
  transition: border-color .15s ease;
}
.board-col:hover { border-color: var(--border-strong); }
.board-col-head { margin-bottom: 4px; }
.board-col-head .name { font-size: 13.5px; font-weight: 600; margin: 0; }
.board-col-head .desc { font-size: 11.5px; color: var(--text-muted); margin: 2px 0 12px; }
.board-empty {
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  text-align:center; padding: 30px 8px; gap: 6px; color: var(--text-muted);
}
.board-empty i { font-size: 20px; }
.board-empty span { font-size: 12px; }
.board-task {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; margin-bottom: 8px; cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.board-task:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); border-color: rgba(var(--accent-rgb),0.3); }
.board-task p { margin: 0; font-size: 12.5px; font-weight: 500; }
.board-task .proj { margin-top: 4px; font-size: 11px; color: var(--text-muted); }

/* Generic list card (Team) */
.list-card {
  position: relative;
  background: var(--surface-1);
  backdrop-filter: blur(var(--blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px 18px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.list-card::before { content:""; position:absolute; inset:0; background: var(--glass-shine); pointer-events:none; }
.list-row { position: relative; display:flex; align-items:center; gap: 12px; padding: 12px 6px; border-bottom: 1px solid var(--border); border-radius: var(--radius-sm); transition: background .15s ease; cursor: pointer; }
.list-row:hover { background: var(--surface-hover); }
.list-row:last-child { border-bottom: none; }
.list-row .who p { margin: 0; }
.list-row .name { font-size: 13.5px; font-weight: 600; }
.list-row .role { font-size: 12px; color: var(--text-muted); }
.list-row .grow { flex: 1; }
.finance-tag { font-size: 10.5px; font-weight: 600; color: var(--text-muted); letter-spacing: 0.02em; text-transform: uppercase; margin-right: 12px; }
.visibility { display:flex; align-items:center; gap: 6px; font-size: 12px; font-weight: 500; }
.visibility.visible { color: var(--success-text); }
.visibility.hidden { color: var(--text-muted); }
.visibility i { font-size: 15px; }

.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; align-items: start; }

.member-card {
  position: relative;
  padding: 14px 6px 16px;
  border-bottom: 1px solid var(--border);
}
.member-card:last-child { border-bottom: none; padding-bottom: 6px; }
.member-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.member-top .grow { min-width: 0; }
.member-actions { display: flex; gap: 6px; flex-shrink: 0; }
.btn-danger {
  background: var(--danger-bg); color: var(--danger-text);
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 0 12px; height: 32px; font-size: 12px; font-weight: 600;
  display: flex; align-items: center; gap: 5px;
}
.btn-danger:hover { filter: brightness(0.97); }
.app-access-label {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.03em; margin: 0 0 8px;
}
.app-toggles { display: flex; flex-wrap: wrap; gap: 6px; }
.app-toggle {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text-secondary); border-radius: 20px;
  padding: 5px 10px 5px 6px; font-size: 11.5px; font-weight: 600;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.app-toggle:hover { border-color: var(--border-strong); }
.app-toggle.on {
  background: var(--accent-bg); color: var(--accent-text);
  border-color: rgba(var(--accent-rgb),0.35);
}
.app-toggle.locked { cursor: default; opacity: 0.9; }
.app-toggle .avatar { width: 20px; height: 20px; font-size: 10px; }
.app-ico {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: block;
  overflow: hidden;
  border-radius: 4px;
}
.assign-actions { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.assign-dot { color: var(--text-muted); font-size: 12px; }
.list-row { cursor: default; }

.form-card {
  position: relative;
  background: var(--surface-1);
  backdrop-filter: blur(var(--blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
  border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px;
  box-shadow: var(--shadow-card); overflow: hidden;
}
.form-card::before { content:""; position:absolute; inset:0; background: var(--glass-shine); pointer-events:none; }
.form-card h2 { margin: 0 0 4px; position: relative; }
.form-card .hint { font-size: 12.5px; color: var(--text-muted); margin: 0 0 16px; position: relative; }
.field { margin-bottom: 14px; position: relative; }
.field label { display:block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.field input {
  width: 100%; height: 38px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-2); padding: 0 12px; font-size: 13.5px; color: var(--text-primary); outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input::placeholder { color: var(--text-muted); }
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb),0.15); }

/* Tasks page */
.task-filters { display:flex; gap: 8px; margin-bottom: 16px; }
.filter-pill {
  font-size: 12.5px; font-weight: 600; padding: 6px 13px; border-radius: 20px;
  border: 1px solid var(--border); color: var(--text-secondary); background: var(--surface-1);
  cursor: pointer; transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.filter-pill:hover { background: var(--surface-hover); }
.filter-pill.active { background: linear-gradient(150deg, var(--accent), var(--accent-hover)); color: var(--on-accent); border-color: transparent; box-shadow: 0 4px 12px -3px rgba(var(--accent-rgb),0.5); }

.task-row {
  display:flex; align-items:center; gap: 12px;
  background: var(--surface-1);
  backdrop-filter: blur(var(--blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 13px 16px; margin-bottom: 8px;
  cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.task-row:hover { transform: translateY(-2px) translateX(2px); box-shadow: var(--shadow-lift); border-color: var(--border-strong); }
.task-row .title { font-size: 13.5px; font-weight: 500; margin: 0; }
.task-row .sub { font-size: 12px; color: var(--text-muted); margin: 3px 0 0; }
.priority-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.priority-dot.high { background: #E24B4A; box-shadow: 0 0 8px rgba(226,75,74,0.6); }
.priority-dot.med { background: #EF9F27; box-shadow: 0 0 8px rgba(239,159,39,0.5); }
.priority-dot.low { background: #85B7EB; box-shadow: 0 0 8px rgba(133,183,235,0.5); }
.status-badge { font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 20px; white-space: nowrap; }
.status-badge.done { color: var(--success-text); background: var(--success-bg); }
.status-badge.progress { color: var(--accent-text); background: var(--accent-bg); }
.status-badge.todo { color: var(--text-muted); background: var(--surface-2); }

/* Invoices page */
.invoice-table {
  background: var(--surface-1);
  backdrop-filter: blur(var(--blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
  border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-card);
}
.invoice-table th {
  text-align: left; font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.03em; padding: 12px 18px; border-bottom: 1px solid var(--border);
}
.invoice-table td { padding: 14px 18px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.invoice-table tr:last-child td { border-bottom: none; }
.invoice-table tbody tr { cursor: pointer; transition: background .15s ease; }
.invoice-table tbody tr:hover td { background: var(--surface-hover); }
.pay-status { font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 20px; white-space: nowrap; }
.pay-status.paid { color: var(--success-text); background: var(--success-bg); }
.pay-status.pending { color: var(--warning-text); background: var(--warning-bg); }
.pay-status.overdue { color: var(--danger-text); background: var(--danger-bg); }

/* Integrations page */
.integration-card {
  position: relative;
  background: var(--surface-1);
  backdrop-filter: blur(var(--blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; max-width: 340px; box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.integration-card::before { content:""; position:absolute; inset:0; background: var(--glass-shine); pointer-events:none; }
.integration-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); border-color: var(--border-strong); }
.integration-top { display:flex; align-items:center; justify-content:space-between; margin-bottom: 14px; position: relative; }
.integration-logo {
  width: 42px; height: 42px; border-radius: 11px; display:flex; align-items:center; justify-content:center;
  background: var(--surface-1-solid); box-shadow: var(--shadow-card); overflow: hidden;
}
.conn-status { font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 20px; }
.conn-status.off { color: var(--text-muted); background: var(--surface-2); }
.conn-status.on { color: var(--success-text); background: var(--success-bg); }
.integration-card h3 { margin: 0 0 6px; font-size: 15px; position: relative; }
.integration-card p { margin: 0 0 16px; font-size: 12.5px; color: var(--text-secondary); position: relative; }
.integration-card .btn-primary,
.integration-card .btn-secondary { position: relative; }

.integration-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 340px)); gap: 14px; }
.integration-card.clickable { cursor: pointer; }
.qb-mark { width: 28px; height: 28px; display: block; }

.project-sections {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.project-section {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; padding: 8px 6px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2);
  font-size: 11px; font-weight: 600; color: var(--text-secondary);
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}
.project-section i { font-size: 15px; color: var(--accent-text); }
.project-section:hover {
  background: var(--accent-bg); color: var(--accent-text);
  border-color: rgba(var(--accent-rgb),0.28); transform: translateY(-1px);
}

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tab {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; padding: 7px 13px; border-radius: 20px;
  border: 1px solid var(--border); color: var(--text-secondary); background: var(--surface-1);
  cursor: pointer; transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.tab:hover { background: var(--surface-hover); }
.tab.active {
  background: linear-gradient(150deg, var(--accent), var(--accent-hover));
  color: var(--on-accent); border-color: transparent;
  box-shadow: 0 4px 12px -3px rgba(var(--accent-rgb),0.5);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.panel-card {
  position: relative;
  background: var(--surface-1);
  backdrop-filter: blur(var(--blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px 20px; box-shadow: var(--shadow-card); overflow: hidden;
}
.panel-card::before { content:""; position:absolute; inset:0; background: var(--glass-shine); pointer-events:none; }
.panel-card h3 { margin: 0 0 8px; font-size: 15px; position: relative; }
.panel-card p { margin: 0; font-size: 13px; color: var(--text-secondary); position: relative; line-height: 1.5; }

.timeline { position: relative; padding-left: 18px; }
.timeline::before {
  content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px;
  width: 2px; background: var(--border-strong);
}
.timeline-item { position: relative; padding: 0 0 16px 12px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: ""; position: absolute; left: -16px; top: 5px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb),0.18);
}
.timeline-item .when { font-size: 11.5px; color: var(--text-muted); margin: 0 0 3px; }
.timeline-item .what { font-size: 13.5px; font-weight: 500; margin: 0; color: var(--text-primary); }

.doc-row {
  position: relative; display: flex; align-items: center; gap: 10px;
  padding: 10px 4px; border-bottom: 1px solid var(--border);
}
.doc-row:last-child { border-bottom: none; }
.doc-icon {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  background: var(--accent-bg); color: var(--accent-text);
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}

.reminder-split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.reminders-card.full { margin-bottom: 0; }
.tag.personal { color: var(--text-secondary); background: var(--surface-2); }

.followup-list { display: flex; flex-direction: column; gap: 12px; }
.followup-card {
  position: relative;
  background: var(--surface-1);
  backdrop-filter: blur(var(--blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px 20px; box-shadow: var(--shadow-card); overflow: hidden;
}
.followup-card::before { content:""; position:absolute; inset:0; background: var(--glass-shine); pointer-events:none; }
.followup-card.approved { border-color: rgba(59,109,17,0.35); }
.followup-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; position: relative; }
.followup-to { font-size: 14px; font-weight: 600; margin: 0 0 3px; }
.followup-meta { font-size: 12px; color: var(--text-muted); margin: 0; }
.draft-box {
  position: relative;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 12px 14px; margin: 12px 0 14px;
  font-size: 13.5px; color: var(--text-primary); line-height: 1.55; white-space: pre-wrap;
}
.followup-actions { display: flex; gap: 8px; position: relative; flex-wrap: wrap; }
.btn-approve {
  background: linear-gradient(150deg, #4A8A1A, #3B6D11);
  color: #fff; border: none; border-radius: var(--radius-sm);
  padding: 0 14px; height: 36px; font-size: 13px; font-weight: 600;
  display: flex; align-items: center; gap: 6px;
  box-shadow: 0 6px 14px -4px rgba(59,109,17,0.45);
}
html[data-theme="dark"] .btn-approve {
  background: linear-gradient(150deg, #6BA83A, #4E8624);
  color: #102006;
}
.btn-approve:hover { transform: translateY(-1px); }
.followup-card.approved .btn-approve { opacity: 0.55; pointer-events: none; }

.modal-backdrop {
  display: none; position: fixed; inset: 0; z-index: 40;
  background: rgba(12,10,8,0.52);
  align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow: auto;
}
.modal-backdrop.open { display: flex; }
.modal {
  width: min(640px, 100%);
  background: var(--surface-1-solid);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift);
  padding: 22px 24px 24px;
  margin-bottom: 40px;
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.modal-head h2 { margin: 0 0 4px; font-size: 18px; }
.modal-head p { margin: 0; font-size: 13px; color: var(--text-muted); }
.modal-close {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-secondary); font-size: 16px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field select, .field textarea {
  width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-2); padding: 8px 12px; font-size: 13.5px;
  color: var(--text-primary); outline: none; font-family: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field select { height: 38px; }
.field textarea { min-height: 72px; resize: vertical; }
.field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb),0.15); }
.contact-block {
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 12px; margin-bottom: 10px; background: var(--surface-2);
}
.contact-block-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.contact-block-head span { font-size: 12.5px; font-weight: 600; }
.link-btn {
  border: none; background: none; color: var(--accent-text);
  font-size: 12.5px; font-weight: 600; padding: 0; display: inline-flex; align-items: center; gap: 4px;
}
.link-btn.danger { color: var(--danger-text); }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 500; padding: 4px 8px;
  border-radius: 20px; background: var(--accent-bg); color: var(--accent-text);
}
.chip button { border: none; background: none; color: inherit; padding: 0; font-size: 13px; line-height: 1; }
.add-inline { display: flex; gap: 8px; }
.add-inline input { flex: 1; height: 34px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-1); padding: 0 10px; font-size: 13px; color: var(--text-primary); outline: none; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.checkbox.checked { background: var(--accent); border-color: var(--accent); }
.checkbox.checked::after { content: ""; display: block; width: 9px; height: 5px; border-left: 2px solid var(--on-accent); border-bottom: 2px solid var(--on-accent); transform: rotate(-45deg) translate(3px, 1px); }

.icon-btn.on {
  background: var(--accent-bg); color: var(--accent-text);
  border-color: rgba(var(--accent-rgb),0.35);
}

/* AI chat drawer */
.chat-scrim {
  display: none; position: fixed; inset: 0; z-index: 50;
  background: rgba(12,10,8,0.38);
}
.chat-scrim.open { display: block; }
.chat-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 51;
  width: 420px; max-width: calc(100vw - 24px); min-width: 320px;
  background: var(--surface-1-solid);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lift);
  display: none;
  flex-direction: column;
}
.chat-drawer.open { display: flex; }
.chat-drawer.wide { width: min(880px, calc(100vw - 24px)); }
.chat-resize {
  position: absolute; left: 0; top: 0; bottom: 0; width: 8px;
  cursor: ew-resize; z-index: 4;
}
.chat-resize:hover, .chat-drawer.resizing .chat-resize {
  background: rgba(var(--accent-rgb),0.35);
}
.chat-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 16px 16px 12px; border-bottom: 1px solid var(--border);
}
.chat-brand { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.chat-brand .brand-mark { margin-top: 1px; }
.chat-head-actions { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }
.chat-head-actions .icon-btn { width: 32px; height: 32px; }
.chat-head h2 { margin: 0 0 4px; font-size: 16px; }
.chat-head p { margin: 0; font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.chat-context {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.chat-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.chat-main { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
#chatThreads { flex: 1; min-height: 0; overflow: auto; }
.chat-history-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: 230px;
  background: var(--surface-1-solid);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lift);
  transform: translateX(100%);
  transition: transform .22s ease;
  z-index: 3;
  display: flex; flex-direction: column; gap: 6px;
  padding: 12px 10px;
}
.chat-drawer.history-open .chat-history-panel { transform: translateX(0); }
.chat-history-label {
  font-size: 10.5px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.04em; padding: 0 4px 4px;
}
.chat-thread {
  display: none; flex-direction: column; gap: 12px;
  padding: 16px;
}
.chat-thread.active { display: flex; }
.chat-bubble {
  max-width: 92%; padding: 10px 12px; border-radius: 12px;
  font-size: 13px; line-height: 1.45;
}
.chat-bubble.user {
  margin-left: auto; background: linear-gradient(150deg, var(--accent), var(--accent-hover));
  color: var(--on-accent);
}
.chat-bubble.ai {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-primary);
}
.chat-bubble .who { font-size: 10.5px; font-weight: 600; margin-bottom: 4px; opacity: 0.75; }
.chat-hist-item {
  display: flex; align-items: center; gap: 6px;
  width: 100%; text-align: left; border: 1px solid transparent;
  background: transparent; color: var(--text-secondary);
  border-radius: var(--radius-sm); padding: 8px 8px; font-size: 12px; font-weight: 500;
}
.chat-hist-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-hist-item:hover { background: var(--surface-hover); color: var(--text-primary); }
.chat-hist-item.active {
  background: var(--surface-2); border-color: var(--border);
  color: var(--text-primary); box-shadow: var(--shadow-card);
}
.chat-hist-del {
  width: 22px; height: 22px; border: none; background: transparent;
  color: var(--text-muted); border-radius: 6px; display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.chat-hist-del:hover { background: var(--danger-bg); color: var(--danger-text); }
.chat-compose {
  display: flex; gap: 8px; padding: 12px 16px 16px; border-top: 1px solid var(--border);
}
.chat-compose input {
  flex: 1; height: 40px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-2); padding: 0 12px; font-size: 13.5px; color: var(--text-primary); outline: none;
}
.chat-compose input:focus { border-color: rgba(var(--accent-rgb),0.5); box-shadow: 0 0 0 3px rgba(var(--accent-rgb),0.12); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display:none; }
  .stats, .projects-grid, .board-grid, .reminder-split, .integration-grid, .field-row { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .project-sections { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  html, body { overflow-x: clip; }
  .main { padding: 16px 14px 32px; }
  .topbar, .page-header { flex-wrap: wrap; }
  .project-sections { grid-template-columns: 1fr; }
}