/* ============================================================
   TeamWeaver demo — design system v0.1 (Linear-inspired)
   Single source of truth for tokens + components + app shell.
   ============================================================ */
:root {
  --bg-base:      #08090A;
  --bg-subtle:    #0F1011;
  --bg-panel:     #141516;
  --bg-raised:    #191A1C;
  --bg-overlay:   #1F2023;
  --bg-hover:     rgba(255,255,255,0.04);
  --bg-active:    rgba(255,255,255,0.07);

  --border-subtle:  rgba(255,255,255,0.06);
  --border-default: rgba(255,255,255,0.10);
  --border-strong:  rgba(255,255,255,0.16);

  --text-primary:   #FAFBFC;
  --text-secondary: #A2A8B3;
  --text-tertiary:  #7E848F;
  --text-disabled:  #565B63;

  --accent:         #5E6AD2;
  --accent-hover:   #6E79D6;
  --accent-active:  #575FC6;
  --accent-tint:    rgba(94,106,210,0.12);
  --accent-text:    #B9BFF5;

  --success:        #4CB782;
  --warning:        #F2994A;
  --danger:         #EB5757;
  --success-tint:   rgba(76,183,130,0.12);
  --warning-tint:   rgba(242,153,74,0.12);
  --danger-tint:    rgba(235,87,87,0.12);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.1875rem;
  --text-xl:   1.5rem;
  --text-2xl:  2.25rem;
  --text-3xl:  3.5rem;

  --radius-sm: 4px; --radius-md: 6px; --radius-lg: 8px; --radius-xl: 12px; --radius-full: 9999px;

  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-10: 40px;
  --space-12: 48px; --space-16: 64px; --space-24: 96px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 100ms; --duration-base: 160ms; --duration-slow: 240ms;

  --shadow-raised: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-overlay: 0 8px 32px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.06);
  --header-veil: rgba(8,9,10,0.85);

  --sidebar-w: 252px;
}

/* ============================================================
   THEMES — toggled via <html data-theme="…"> (see Settings)
   ============================================================ */
[data-theme="graphite"] {
  --bg-base: #111316; --bg-subtle: #171A1E; --bg-panel: #1D2126;
  --bg-raised: #242930; --bg-overlay: #2B313A;
  --header-veil: rgba(17,19,22,0.85);
}
[data-theme="daylight"] {
  --bg-base: #F7F7F5; --bg-subtle: #EFEFEC; --bg-panel: #FFFFFF;
  --bg-raised: #FFFFFF; --bg-overlay: #FFFFFF;
  --bg-hover: rgba(0,0,0,0.045); --bg-active: rgba(0,0,0,0.08);
  --border-subtle: rgba(0,0,0,0.08); --border-default: rgba(0,0,0,0.13);
  --border-strong: rgba(0,0,0,0.22);
  --text-primary: #171A1F; --text-secondary: #444A54;
  --text-tertiary: #5F656F; --text-disabled: #9CA1A9;
  --accent-text: #4550BE; --accent-tint: rgba(94,106,210,0.10);
  --success: #1F8757; --warning: #A9601A; --danger: #C93A34;
  --shadow-raised: 0 4px 12px rgba(20,22,30,0.10);
  --shadow-overlay: 0 8px 32px rgba(20,22,30,0.16), 0 0 0 1px rgba(0,0,0,0.06);
  --header-veil: rgba(247,247,245,0.88);
}
[data-theme="sandstone"] {
  --bg-base: #F6F1E7; --bg-subtle: #EFE8DA; --bg-panel: #FDFAF3;
  --bg-raised: #FDFAF3; --bg-overlay: #FFFDF8;
  --bg-hover: rgba(60,45,20,0.05); --bg-active: rgba(60,45,20,0.09);
  --border-subtle: rgba(60,45,20,0.10); --border-default: rgba(60,45,20,0.15);
  --border-strong: rgba(60,45,20,0.25);
  --text-primary: #241F16; --text-secondary: #51493B;
  --text-tertiary: #6C6455; --text-disabled: #A29A8B;
  --accent-text: #4550BE; --accent-tint: rgba(94,106,210,0.10);
  --success: #1F8757; --warning: #A9601A; --danger: #C93A34;
  --shadow-raised: 0 4px 12px rgba(60,45,20,0.10);
  --shadow-overlay: 0 8px 32px rgba(60,45,20,0.16), 0 0 0 1px rgba(60,45,20,0.07);
  --header-veil: rgba(246,241,231,0.88);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-secondary);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv05' 1, 'cv08' 1, 'ss01' 1;
}
h1, h2, h3, h4 {
  color: var(--text-primary);
  font-weight: 538;
  letter-spacing: -0.022em;
  line-height: 1.2;
}
a { color: var(--accent-text); text-decoration: none; }
::selection { background: var(--accent-tint); color: var(--accent-text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm); }

/* ============================================================
   SHARED COMPONENTS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-sans); font-size: var(--text-sm); font-weight: 510;
  letter-spacing: -0.005em;
  padding: 0 14px; height: 32px;
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out),
              transform var(--duration-fast) var(--ease-out);
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,0.12); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-raised); color: var(--text-primary); border-color: var(--border-default); }
.btn-secondary:hover { background: var(--bg-overlay); border-color: var(--border-strong); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-danger { background: var(--danger-tint); color: var(--danger); border-color: rgba(235,87,87,0.25); }
.btn-danger:hover { background: rgba(235,87,87,0.2); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-sm { height: 26px; padding: 0 10px; font-size: var(--text-xs); border-radius: var(--radius-md); }
.btn-lg { height: 40px; padding: 0 20px; font-size: var(--text-base); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field .input { width: 100%; }
.field label { font-size: var(--text-xs); font-weight: 510; color: var(--text-secondary); letter-spacing: 0.01em; }
.input {
  font-family: var(--font-sans); font-size: var(--text-sm);
  color: var(--text-primary);
  background: var(--bg-base);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  height: 32px; padding: 0 10px;
  transition: border-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out);
}
.input::placeholder { color: var(--text-tertiary); }
.input:hover { border-color: var(--border-strong); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--text-xs); font-weight: 510;
  padding: 2px 8px; border-radius: var(--radius-full);
  border: 1px solid; white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge-neutral { color: var(--text-secondary); border-color: var(--border-default); background: var(--bg-hover); }
.badge-accent  { color: var(--accent-text); border-color: rgba(94,106,210,0.3); background: var(--accent-tint); }
.badge-success { color: var(--success); border-color: rgba(76,183,130,0.3); background: var(--success-tint); }
.badge-warning { color: var(--warning); border-color: rgba(242,153,74,0.3); background: var(--warning-tint); }
.badge-danger  { color: var(--danger); border-color: rgba(235,87,87,0.3); background: var(--danger-tint); }
.badge-pink    { color: #E084A8; border-color: rgba(212,83,126,0.35); background: rgba(212,83,126,0.12); }
[data-theme="daylight"] .badge-pink, [data-theme="sandstone"] .badge-pink { color: #A93A64; }
.badge-plain   { color: var(--text-primary); border-color: var(--border-strong); background: transparent; }

/* Categorical palette — teams get their own hues; green/orange/red stay semantic */
.badge-cat-indigo { color: #A7AEF0; border-color: rgba(94,106,210,0.35);  background: rgba(94,106,210,0.12); }
.badge-cat-teal   { color: #7BD4C3; border-color: rgba(69,184,165,0.35);  background: rgba(69,184,165,0.12); }
.badge-cat-purple { color: #C5AEF2; border-color: rgba(167,139,232,0.35); background: rgba(167,139,232,0.12); }
.badge-cat-amber  { color: #E5BE85; border-color: rgba(217,160,84,0.35);  background: rgba(217,160,84,0.12); }
.badge-cat-rose   { color: #E894B4; border-color: rgba(212,83,126,0.35);  background: rgba(212,83,126,0.12); }
.badge-cat-slate  { color: #AEBACB; border-color: rgba(147,160,180,0.35); background: rgba(147,160,180,0.12); }
[data-theme="daylight"] .badge-cat-indigo, [data-theme="sandstone"] .badge-cat-indigo { color: #4550BE; }
[data-theme="daylight"] .badge-cat-teal,   [data-theme="sandstone"] .badge-cat-teal   { color: #1D7A6A; }
[data-theme="daylight"] .badge-cat-purple, [data-theme="sandstone"] .badge-cat-purple { color: #6B4FC0; }
[data-theme="daylight"] .badge-cat-amber,  [data-theme="sandstone"] .badge-cat-amber  { color: #9A6420; }
[data-theme="daylight"] .badge-cat-rose,   [data-theme="sandstone"] .badge-cat-rose   { color: #A93A64; }
[data-theme="daylight"] .badge-cat-slate,  [data-theme="sandstone"] .badge-cat-slate  { color: #4E5B6B; }

/* View-as mode: admin-only elements hide for non-coordinators */
body[data-viewas]:not([data-viewas="coordinator"]) [data-admin] { display: none !important; }
.viewas-banner {
  display: none; position: sticky; top: 0; z-index: 90;
  padding: 8px 16px; text-align: center;
  font-size: var(--text-sm); font-weight: 510;
  color: var(--warning); background: var(--warning-tint);
  border-bottom: 1px solid rgba(242,153,74,0.3);
}
body[data-viewas]:not([data-viewas="coordinator"]) .viewas-banner { display: block; }

/* Floating action button (mobile) */
.fab {
  display: none; position: fixed; right: 18px; bottom: 92px; z-index: 140;
  width: 52px; height: 52px; border-radius: var(--radius-full);
  background: var(--accent); color: #fff; border: none;
  font-size: 24px; line-height: 1; cursor: pointer;
  box-shadow: 0 6px 20px rgba(94,106,210,0.45);
}
@media (max-width: 860px) { .fab { display: block; } }

.kbd {
  font-family: var(--font-mono); font-size: var(--text-xs);
  color: var(--text-secondary);
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  border-bottom-width: 2px;
  border-radius: var(--radius-sm);
  padding: 1px 6px;
}

.card {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  transition: border-color var(--duration-base) var(--ease-out), background var(--duration-base) var(--ease-out);
}
.card.clickable { cursor: pointer; }
.card.clickable:hover { border-color: var(--border-default); background: var(--bg-raised); }
.card-title { font-size: var(--text-sm); font-weight: 510; color: var(--text-primary); letter-spacing: -0.01em; display: flex; align-items: center; justify-content: space-between; gap: 8px; row-gap: 4px; margin-bottom: 6px; flex-wrap: wrap; }
.card p { font-size: var(--text-sm); }
.card-meta { display: flex; gap: var(--space-2); margin-top: var(--space-4); align-items: center; flex-wrap: wrap; }
.card-id { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-tertiary); }

.avatar {
  width: 26px; height: 26px; border-radius: var(--radius-full);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 510; color: var(--text-primary);
  background: var(--bg-overlay); border: 1px solid var(--border-default);
  flex-shrink: 0; letter-spacing: 0;
}
.avatar-lg { width: 40px; height: 40px; font-size: var(--text-sm); }
.avatar-accent { background: var(--accent-tint); color: var(--accent-text); border-color: rgba(94,106,210,0.3); }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th {
  text-align: left; font-size: var(--text-xs); font-weight: 510;
  color: var(--text-tertiary); letter-spacing: 0.04em; text-transform: uppercase;
  padding: 10px 14px; border-bottom: 1px solid var(--border-subtle);
}
.table td { padding: 13px 14px; border-bottom: 1px solid var(--border-subtle); color: var(--text-secondary); }
.table td:first-child { color: var(--text-primary); }
.table tbody tr { cursor: pointer; transition: background var(--duration-fast) var(--ease-out); }
.table tbody tr:hover { background: var(--bg-hover); }
.row-name { display: flex; align-items: center; gap: 10px; font-weight: 460; }

/* Tabs & segmented controls */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border-subtle); margin-bottom: var(--space-5); }
.tab {
  font-size: var(--text-sm); font-weight: 460; color: var(--text-secondary);
  padding: 10px 14px; border: none; background: none; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color var(--duration-fast) var(--ease-out);
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--text-primary); border-bottom-color: var(--accent); }
.tab .count { font-size: var(--text-xs); color: var(--text-tertiary); margin-left: 5px; font-family: var(--font-mono); }

.segmented {
  display: inline-flex; background: var(--bg-subtle);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 2px; gap: 2px;
}
.segmented button {
  font-family: var(--font-sans); font-size: var(--text-xs); font-weight: 510; color: var(--text-secondary);
  background: none; border: none; border-radius: var(--radius-md);
  padding: 4px 10px; cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}
.segmented button:hover { color: var(--text-primary); }
.segmented button.active { background: var(--bg-overlay); color: var(--text-primary); }

/* ============================================================
   APP SHELL
   ============================================================ */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--bg-subtle);
  border-right: 1px solid var(--border-subtle);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 1px;
  padding: 20px 16px 10px;
}
.sidebar-logo svg { width: 50px; height: 45px; flex-shrink: 0; }
.sidebar-logo .logo-word {
  font-size: 21px; font-weight: 538; letter-spacing: -0.022em;
  color: var(--text-primary);
}
.ws-wrap { position: relative; margin: 8px; }
.ws-switch {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px;
  background: none; border: none; border-radius: var(--radius-lg);
  cursor: pointer; text-align: left; font-family: var(--font-sans);
  transition: background var(--duration-fast) var(--ease-out);
}
.ws-switch:hover { background: var(--bg-hover); }
.ws-mark {
  width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0;
  background: linear-gradient(135deg, #6E79D6 0%, #5E6AD2 50%, #3D4699 100%);
  box-shadow: 0 0 10px rgba(94,106,210,0.3);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11px; font-weight: 600;
}
.ws-name { font-size: var(--text-sm); font-weight: 510; color: var(--text-primary); letter-spacing: -0.01em; line-height: 1.2; }
.ws-org { font-size: var(--text-xs); color: var(--text-tertiary); line-height: 1.3; }
.ws-caret { margin-left: auto; color: var(--text-tertiary); font-size: 10px; }

.ws-menu {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 300;
  width: 248px; background: var(--bg-overlay);
  border: 1px solid var(--border-default); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-overlay); padding: 6px;
  display: none;
}
.ws-menu.open { display: block; animation: pop var(--duration-base) var(--ease-out); }
.ws-menu .ws-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: none; background: none; border-radius: var(--radius-md);
  cursor: pointer; text-align: left; font-family: var(--font-sans);
}
.ws-menu .ws-item:hover { background: var(--bg-hover); }
.ws-menu .ws-item.disabled { opacity: 0.5; cursor: not-allowed; }
.ws-menu .ws-label { font-size: var(--text-xs); color: var(--text-tertiary); padding: 6px 10px 2px; letter-spacing: 0.05em; text-transform: uppercase; }
.ws-menu hr { border: none; border-top: 1px solid var(--border-subtle); margin: 6px 4px; }

.nav-section { padding: var(--space-2) var(--space-2); }
.nav-label { font-size: var(--text-xs); color: var(--text-tertiary); padding: 10px 12px 4px; letter-spacing: 0.05em; text-transform: uppercase; font-weight: 510; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: var(--radius-md);
  font-size: var(--text-sm); font-weight: 460; color: var(--text-secondary);
  text-decoration: none;
  transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--bg-active); color: var(--text-primary); }
.nav-item .nav-icon { width: 16px; text-align: center; opacity: 0.85; font-size: var(--text-sm); }
.nav-item .nav-badge { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--text-tertiary); background: var(--bg-hover); border-radius: var(--radius-full); padding: 0 6px; }

.sidebar-footer { margin-top: auto; padding: var(--space-3); border-top: 1px solid var(--border-subtle); }
.search-hint {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: var(--bg-base); border: 1px solid var(--border-default);
  border-radius: var(--radius-lg); padding: 6px 10px; cursor: pointer;
  font-family: var(--font-sans); font-size: var(--text-sm); color: var(--text-tertiary);
  transition: border-color var(--duration-fast) var(--ease-out);
  margin: 4px 8px 0; width: calc(100% - 16px);
}
.search-hint:hover { border-color: var(--border-strong); color: var(--text-secondary); }
.search-hint .kbd { margin-left: auto; }
.user-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; transition: background var(--duration-fast) var(--ease-out); }
.user-row:hover, .user-row.active { background: var(--bg-hover); }
.user-row .u-name { font-size: var(--text-sm); font-weight: 460; color: var(--text-primary); line-height: 1.2; }
.user-row .u-role { font-size: var(--text-xs); color: var(--text-tertiary); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.page-header {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  padding: var(--space-5) var(--space-10);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky; top: 0; z-index: 40;
  background: var(--header-veil);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  min-height: 64px;
}
.page-header h1 { font-size: var(--text-lg); letter-spacing: -0.015em; }
.page-header .sub { font-size: var(--text-xs); color: var(--text-tertiary); margin-top: 1px; }
.header-actions { display: flex; gap: var(--space-2); align-items: center; }
.content { padding: var(--space-8) var(--space-10) var(--space-16); max-width: 1200px; width: 100%; }

.section-title { font-size: var(--text-sm); font-weight: 510; color: var(--text-primary); letter-spacing: -0.01em; margin: var(--space-8) 0 var(--space-3); display: flex; align-items: center; justify-content: space-between; }
.section-title:first-child { margin-top: 0; }
.grid { display: grid; gap: var(--space-4); }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.empty { color: var(--text-tertiary); font-size: var(--text-sm); padding: var(--space-6); text-align: center; border: 1px dashed var(--border-default); border-radius: var(--radius-xl); }

/* ============================================================
   DETAIL PANELS (right-side stack)
   ============================================================ */
.panel-scrim {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.35);
  opacity: 0; pointer-events: none;
  transition: opacity var(--duration-slow) var(--ease-out);
}
.panel-scrim.open { opacity: 1; pointer-events: auto; }
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 210;
  width: min(480px, 92vw);
  background: var(--bg-raised);
  border-left: 1px solid var(--border-default);
  box-shadow: var(--shadow-overlay);
  transform: translateX(102%);
  transition: transform var(--duration-slow) var(--ease-out);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.panel.open { transform: translateX(0); }
.panel-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.panel-crumbs { display: flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--text-tertiary); min-width: 0; overflow: hidden; }
.panel-crumbs button { background: none; border: none; color: var(--text-tertiary); font-family: var(--font-sans); font-size: var(--text-xs); cursor: pointer; padding: 2px 4px; border-radius: var(--radius-sm); white-space: nowrap; }
.panel-crumbs button:hover { color: var(--text-primary); background: var(--bg-hover); }
.panel-crumbs .sep { opacity: 0.5; }
.panel-crumbs .current { color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-close { margin-left: auto; background: none; border: none; color: var(--text-tertiary); cursor: pointer; font-size: var(--text-base); padding: 4px 8px; border-radius: var(--radius-md); }
.panel-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.panel-body { overflow-y: auto; padding: var(--space-6) var(--space-6) var(--space-12); flex: 1; }
.panel-title-row { display: flex; align-items: center; gap: 12px; margin-bottom: var(--space-2); }
.panel-body h2 { font-size: var(--text-xl); letter-spacing: -0.02em; }
.panel-sub { font-size: var(--text-sm); color: var(--text-tertiary); margin-bottom: var(--space-4); }
.panel-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: var(--space-5); }
.prop-list { display: grid; grid-template-columns: 130px 1fr; row-gap: 8px; column-gap: 12px; font-size: var(--text-sm); margin-bottom: var(--space-5); }
.prop-list dt { color: var(--text-tertiary); font-size: var(--text-xs); font-weight: 510; padding-top: 2px; letter-spacing: 0.02em; }
.prop-list dd { color: var(--text-secondary); }
.prop-list dd .linklike { color: var(--accent-text); cursor: pointer; }
.prop-list dd .linklike:hover { text-decoration: underline; }
.panel-section { margin-top: var(--space-6); }
.panel-section h3 { font-size: var(--text-sm); font-weight: 510; letter-spacing: -0.01em; margin-bottom: var(--space-3); color: var(--text-primary); }
.mini-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px; border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
  margin-bottom: 8px; cursor: pointer; font-size: var(--text-sm);
  transition: background var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out);
  background: var(--bg-panel);
}
.mini-row:hover { background: var(--bg-overlay); border-color: var(--border-default); }
.mini-row .mr-title { color: var(--text-primary); font-weight: 460; }
.mini-row .mr-sub { font-size: var(--text-xs); color: var(--text-tertiary); }
.mini-row .mr-end { margin-left: auto; display: flex; align-items: center; justify-content: flex-end; gap: 6px; row-gap: 4px; flex-wrap: wrap; flex-shrink: 1; min-width: 0; }

/* Score bars (formation suggestions) */
.score-row { display: grid; grid-template-columns: 130px 1fr 40px; align-items: center; gap: 10px; margin-bottom: 8px; font-size: var(--text-xs); }
.score-row .sr-label { color: var(--text-secondary); }
.score-track { height: 4px; background: var(--bg-hover); border-radius: var(--radius-full); overflow: hidden; }
.score-fill { height: 100%; background: var(--accent); border-radius: var(--radius-full); }
.score-row .sr-val { font-family: var(--font-mono); color: var(--text-tertiary); text-align: right; }

/* Checklist */
.check-row { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-md); font-size: var(--text-sm); cursor: pointer; }
.check-row:hover { background: var(--bg-hover); }
.check-box {
  width: 15px; height: 15px; border-radius: var(--radius-sm); flex-shrink: 0;
  border: 1px solid var(--border-strong); display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; color: #fff; transition: background var(--duration-fast) var(--ease-out);
}
.check-row.done .check-box { background: var(--accent); border-color: var(--accent); }
.check-row.done .check-label { text-decoration: line-through; color: var(--text-tertiary); }
.check-row .check-meta { margin-left: auto; font-size: var(--text-xs); color: var(--text-tertiary); font-family: var(--font-mono); }

/* ============================================================
   COMMAND PALETTE
   ============================================================ */
.palette-wrap {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(0,0,0,0.45);
  display: none; align-items: flex-start; justify-content: center;
  padding-top: 14vh;
}
.palette-wrap.open { display: flex; }
.palette {
  width: min(600px, 92vw);
  background: var(--bg-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-overlay);
  overflow: hidden;
  animation: pop var(--duration-base) var(--ease-out);
}
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(0.99); } to { opacity: 1; transform: none; } }
.palette input {
  width: 100%; background: none; border: none; outline: none;
  font-family: var(--font-sans); font-size: var(--text-base); color: var(--text-primary);
  padding: 14px 16px; border-bottom: 1px solid var(--border-subtle);
}
.palette input::placeholder { color: var(--text-tertiary); }
.palette-results { max-height: 320px; overflow-y: auto; padding: 6px; }
.palette-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-md); cursor: pointer;
  font-size: var(--text-sm); color: var(--text-secondary);
}
.palette-item .pi-type { margin-left: auto; font-size: var(--text-xs); color: var(--text-tertiary); font-family: var(--font-mono); }
.palette-item.selected, .palette-item:hover { background: var(--bg-active); color: var(--text-primary); }
.palette-empty { padding: var(--space-6); text-align: center; color: var(--text-tertiary); font-size: var(--text-sm); }
.palette-foot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--border-subtle); font-size: var(--text-xs); color: var(--text-tertiary); }

/* ============================================================
   TOASTS
   ============================================================ */
.toast-zone { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 500; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-overlay); border: 1px solid var(--border-default);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-raised);
  padding: 9px 14px; font-size: var(--text-sm); color: var(--text-primary);
  animation: toast-in var(--duration-slow) var(--ease-out);
}
.toast .t-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.toast.warn .t-dot { background: var(--warning); }
.toast.info .t-dot { background: var(--accent); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.toast.out { opacity: 0; transform: translateY(8px); transition: all var(--duration-slow) var(--ease-out); }

/* ============================================================
   CALENDAR & SCHEDULE GRIDS
   ============================================================ */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--border-subtle); border-radius: var(--radius-xl); overflow: hidden; background: var(--bg-subtle); }
.cal-head { background: var(--bg-panel); padding: 8px 10px; font-size: var(--text-xs); font-weight: 510; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--border-subtle); }
.cal-cell { min-height: 112px; border-right: 1px solid var(--border-subtle); border-bottom: 1px solid var(--border-subtle); padding: 6px; background: var(--bg-base); }
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell.dim { opacity: 0.45; }
.cal-cell.today { background: rgba(94,106,210,0.05); }
.cal-date { font-size: var(--text-xs); color: var(--text-tertiary); font-family: var(--font-mono); margin-bottom: 4px; display: flex; justify-content: space-between; }
.cal-date .today-pill { color: var(--accent-text); background: var(--accent-tint); border-radius: var(--radius-full); padding: 0 6px; }
.cal-ev {
  display: block; width: 100%; text-align: left; font-family: var(--font-sans);
  font-size: var(--text-xs); font-weight: 460; color: var(--text-secondary);
  background: var(--bg-panel); border: 1px solid var(--border-subtle);
  border-left: 2px solid var(--accent); border-radius: var(--radius-sm);
  padding: 2px 6px; margin-bottom: 3px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background var(--duration-fast) var(--ease-out);
}
.cal-ev:hover { background: var(--bg-overlay); color: var(--text-primary); }
.cal-ev.ev-training { border-left-color: var(--success); }
.cal-ev.ev-outreach { border-left-color: var(--warning); }
.cal-ev.ev-special { border-left-color: #D4537E; }

.week-grid { display: grid; grid-template-columns: 92px repeat(7, 1fr); border: 1px solid var(--border-subtle); border-radius: var(--radius-xl); overflow: hidden; background: var(--bg-subtle); font-size: var(--text-xs); }
.wg-corner, .wg-day { background: var(--bg-panel); padding: 10px 14px; font-size: var(--text-xs); font-weight: 510; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--border-subtle); border-right: 1px solid var(--border-subtle); }
.wg-day.today { color: var(--accent-text); }
.wg-time { background: var(--bg-panel); padding: 10px 14px; font-size: var(--text-xs); color: var(--text-tertiary); font-family: var(--font-mono); border-bottom: 1px solid var(--border-subtle); border-right: 1px solid var(--border-subtle); }
.wg-cell { background: var(--bg-base); border-bottom: 1px solid var(--border-subtle); border-right: 1px solid var(--border-subtle); padding: 6px; min-height: 48px; }
.wg-cell:nth-child(9n) { border-right: none; }
.wg-block {
  display: block; width: 100%; text-align: left; font-family: var(--font-sans);
  background: var(--accent-tint); border: 1px solid rgba(94,106,210,0.25);
  color: var(--accent-text); border-radius: var(--radius-md);
  font-size: var(--text-xs); font-weight: 510; padding: 5px 9px; margin-bottom: 4px; cursor: pointer; line-height: 1.45;
  transition: border-color var(--duration-fast) var(--ease-out);
}
.wg-block:hover { border-color: var(--accent); }
.wg-block.g { background: var(--success-tint); border-color: rgba(76,183,130,0.25); color: var(--success); }
.wg-block.o { background: var(--warning-tint); border-color: rgba(242,153,74,0.25); color: var(--warning); }
.wg-block.n { background: var(--bg-panel); border-color: var(--border-default); color: var(--text-secondary); }

/* ============================================================
   NOTIFICATION MATRIX
   ============================================================ */
.matrix { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.matrix th { font-size: var(--text-xs); font-weight: 510; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.04em; padding: 8px 10px; text-align: center; border-bottom: 1px solid var(--border-subtle); }
.matrix th:first-child { text-align: left; }
.matrix td { padding: 9px 10px; border-bottom: 1px solid var(--border-subtle); text-align: center; }
.matrix td:first-child { text-align: left; color: var(--text-primary); font-weight: 460; }
.matrix .cat-desc { display: block; font-size: var(--text-xs); color: var(--text-tertiary); font-weight: 400; }
.toggle {
  width: 30px; height: 18px; border-radius: var(--radius-full);
  background: var(--bg-overlay); border: 1px solid var(--border-default);
  position: relative; cursor: pointer; display: inline-block;
  transition: background var(--duration-fast) var(--ease-out);
}
.toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--text-tertiary);
  transition: transform var(--duration-fast) var(--ease-out), background var(--duration-fast) var(--ease-out);
}
.toggle.on { background: var(--accent); border-color: var(--accent); }
.toggle.on::after { transform: translateX(12px); background: #fff; }

/* ============================================================
   DOC TREE & DOC VIEW
   ============================================================ */
.doc-layout { display: grid; grid-template-columns: 260px 1fr; gap: var(--space-6); align-items: start; }
@media (max-width: 900px) { .doc-layout { grid-template-columns: 1fr; } }
.doc-tree { border: 1px solid var(--border-subtle); border-radius: var(--radius-xl); background: var(--bg-subtle); padding: var(--space-3); position: sticky; top: 76px; }
.tree-folder { font-size: var(--text-xs); font-weight: 510; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.05em; padding: 10px 8px 4px; }
.tree-doc {
  display: flex; align-items: center; gap: 8px; width: 100%;
  font-family: var(--font-sans); font-size: var(--text-sm); color: var(--text-secondary);
  background: none; border: none; border-radius: var(--radius-md);
  padding: 5px 8px; cursor: pointer; text-align: left;
}
.tree-doc:hover { background: var(--bg-hover); color: var(--text-primary); }
.tree-doc.active { background: var(--bg-active); color: var(--text-primary); }
.doc-view { border: 1px solid var(--border-subtle); border-radius: var(--radius-xl); background: var(--bg-panel); padding: var(--space-8); min-height: 400px; }
.doc-view h2 { font-size: var(--text-xl); margin-bottom: var(--space-1); }
.doc-view .doc-meta { display: flex; gap: 10px; align-items: center; font-size: var(--text-xs); color: var(--text-tertiary); margin-bottom: var(--space-6); flex-wrap: wrap; }
.doc-view h3 { font-size: var(--text-base); margin: var(--space-6) 0 var(--space-2); }
.doc-view p, .doc-view li { font-size: var(--text-sm); color: var(--text-secondary); }
.doc-view ul { padding-left: 20px; margin: var(--space-2) 0; }
.doc-view .callout { border: 1px solid rgba(242,153,74,0.3); background: var(--warning-tint); border-radius: var(--radius-lg); padding: var(--space-3) var(--space-4); margin: var(--space-4) 0; font-size: var(--text-sm); color: var(--warning); }

/* ============================================================
   MARKETING PAGES
   ============================================================ */
.mk-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(8,9,10,0.8);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}
.mk-container { max-width: 1024px; margin: 0 auto; padding: 0 var(--space-6); }
.mk-header .mk-container { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.mk-logo { display: flex; align-items: center; gap: 10px; color: var(--text-primary); font-weight: 538; font-size: var(--text-sm); letter-spacing: -0.01em; text-decoration: none; }
.mk-nav { display: flex; gap: var(--space-1); align-items: center; }
.mk-nav a {
  color: var(--text-secondary); text-decoration: none;
  font-size: var(--text-sm); font-weight: 460;
  padding: 6px 10px; border-radius: var(--radius-md);
  transition: color var(--duration-fast) var(--ease-out), background var(--duration-fast) var(--ease-out);
}
.mk-nav a:hover { color: var(--text-primary); background: var(--bg-hover); }
.mk-hero { padding: var(--space-24) 0 var(--space-16); position: relative; overflow: hidden; }
.mk-hero::before {
  content: ''; position: absolute; inset: -40% -20% auto; height: 480px;
  background: radial-gradient(ellipse at 50% 0%, rgba(94,106,210,0.14), transparent 65%);
  pointer-events: none;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: var(--text-xs); font-weight: 510;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--accent-text); background: var(--accent-tint);
  border: 1px solid rgba(94,106,210,0.25);
  padding: 4px 10px; border-radius: var(--radius-full);
  margin-bottom: var(--space-5);
}
.mk-hero h1 {
  font-size: clamp(2.25rem, 5vw, var(--text-3xl));
  font-weight: 538; letter-spacing: -0.035em; line-height: 1.06;
  max-width: 17ch;
  background: linear-gradient(180deg, #FFFFFF 0%, #B3B6BD 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: var(--space-5);
}
.mk-hero p { font-size: var(--text-lg); max-width: 54ch; font-weight: 410; margin-bottom: var(--space-8); }
.mk-hero-actions { display: flex; gap: var(--space-3); align-items: center; }
.mk-section { padding: var(--space-16) 0; border-top: 1px solid var(--border-subtle); }
.mk-section-label { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-tertiary); letter-spacing: 0.06em; margin-bottom: var(--space-2); }
.mk-section h2 { font-size: var(--text-xl); margin-bottom: var(--space-2); }
.mk-intro { max-width: 62ch; margin-bottom: var(--space-8); font-size: var(--text-sm); }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--space-4); }
.feature {
  background: var(--bg-panel); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl); padding: var(--space-5);
}
.feature .f-icon { font-size: var(--text-lg); margin-bottom: var(--space-3); display: block; }
.feature h3 { font-size: var(--text-sm); margin-bottom: var(--space-2); letter-spacing: -0.01em; }
.feature p { font-size: var(--text-sm); }
.price-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-4); align-items: stretch; }
.price {
  background: var(--bg-panel); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl); padding: var(--space-6);
  display: flex; flex-direction: column; gap: var(--space-2);
}
.price.hot { border-color: rgba(94,106,210,0.4); background: linear-gradient(180deg, rgba(94,106,210,0.06), var(--bg-panel) 40%); }
.price h3 { font-size: var(--text-sm); }
.price .p-amount { font-size: var(--text-2xl); font-weight: 538; letter-spacing: -0.03em; color: var(--text-primary); }
.price .p-amount span { font-size: var(--text-sm); font-weight: 400; color: var(--text-tertiary); letter-spacing: 0; }
.price ul { list-style: none; margin: var(--space-3) 0 var(--space-5); display: flex; flex-direction: column; gap: 8px; }
.price li { font-size: var(--text-sm); display: flex; gap: 8px; align-items: baseline; }
.price li::before { content: '✓'; color: var(--success); font-size: var(--text-xs); }
.price .btn { margin-top: auto; justify-content: center; }
.mk-footer { border-top: 1px solid var(--border-subtle); padding: var(--space-8) 0; font-size: var(--text-xs); color: var(--text-tertiary); }
.mk-footer .mk-container { display: flex; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: var(--space-6); position: relative; overflow: hidden; }
.login-wrap::before {
  content: ''; position: absolute; inset: -30% -20% auto; height: 480px;
  background: radial-gradient(ellipse at 50% 0%, rgba(94,106,210,0.12), transparent 65%);
  pointer-events: none;
}
.login-card {
  width: min(400px, 100%);
  background: var(--bg-panel); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl); padding: var(--space-8);
  box-shadow: var(--shadow-raised); position: relative;
}
.login-card h1 { font-size: var(--text-lg); margin: var(--space-4) 0 var(--space-1); }
.login-card .login-sub { font-size: var(--text-sm); color: var(--text-tertiary); margin-bottom: var(--space-6); }
.login-card .field { margin-bottom: var(--space-4); }
.demo-note {
  display: flex; gap: 8px; align-items: baseline;
  font-size: var(--text-xs); color: var(--accent-text);
  background: var(--accent-tint); border: 1px solid rgba(94,106,210,0.25);
  border-radius: var(--radius-lg); padding: 8px 12px; margin-bottom: var(--space-5);
}

/* ============================================================
   CHAT (Stream-class SDK, skinned to our tokens)
   ============================================================ */
.chat-layout {
  display: grid; grid-template-columns: 270px 1fr;
  border: 1px solid var(--border-subtle); border-radius: var(--radius-xl);
  overflow: hidden; background: var(--bg-subtle);
  height: calc(100vh - 180px); min-height: 480px;
}
.chat-list { border-right: 1px solid var(--border-subtle); overflow-y: auto; padding: var(--space-3); }
.chat-list .nav-label { padding: 10px 10px 4px; }
.chat-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  font-family: var(--font-sans); font-size: var(--text-sm); color: var(--text-secondary);
  background: none; border: none; border-radius: var(--radius-md);
  padding: 7px 10px; cursor: pointer; text-align: left;
}
.chat-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.chat-item.active { background: var(--bg-active); color: var(--text-primary); }
.chat-item .hash { color: var(--text-tertiary); font-family: var(--font-mono); }
.chat-item .unread { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: #fff; background: var(--accent); border-radius: var(--radius-full); padding: 1px 7px; }
.chat-thread { display: flex; flex-direction: column; background: var(--bg-base); min-width: 0; }
.chat-thread-head { display: flex; align-items: center; gap: 10px; padding: 13px 18px; border-bottom: 1px solid var(--border-subtle); }
.chat-thread-head .ct-name { font-weight: 510; color: var(--text-primary); font-size: var(--text-sm); }
.chat-msgs { flex: 1; overflow-y: auto; padding: var(--space-5) var(--space-5) var(--space-3); }
.chat-msg { display: flex; gap: 11px; margin-bottom: 16px; }
.chat-msg .cm-body { min-width: 0; }
.chat-msg .cm-head { font-size: var(--text-xs); color: var(--text-tertiary); margin-bottom: 2px; }
.chat-msg .cm-head strong { color: var(--text-primary); font-weight: 510; font-size: var(--text-sm); margin-right: 6px; }
.chat-msg .cm-text { font-size: var(--text-sm); color: var(--text-secondary); }
.chat-msg.mine .cm-text { background: var(--accent-tint); border: 1px solid rgba(94,106,210,0.25); border-radius: var(--radius-lg); padding: 7px 11px; color: var(--text-primary); }
.chat-composer { display: flex; gap: 9px; padding: var(--space-3) var(--space-4) var(--space-4); border-top: 1px solid var(--border-subtle); }
.chat-composer .input { flex: 1; height: 38px; }

/* ============================================================
   BUILDERS / DRAG / POPOVER / PROFILE
   ============================================================ */
.builder-layout { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,380px); gap: var(--space-6); align-items: start; }
@media (max-width: 1000px) { .builder-layout { grid-template-columns: 1fr; } }
.builder-layout > * { min-width: 0; }
.builder-preview { position: sticky; top: 84px; }
.card { min-width: 0; }
.card, .mini-row, .field-row { overflow-wrap: break-word; }
.mini-row > div:not(.avatar):not(.mr-end) { min-width: 0; flex: 1; }
.field-row > span, .field-row > div { min-width: 0; }
.field-row .input { min-width: 0; }
.prop-list dd { min-width: 0; overflow-wrap: break-word; }
select.input { max-width: 100%; text-overflow: ellipsis; }
.check-row .check-label { flex: 1; min-width: 0; }
.check-row .check-meta { flex-shrink: 0; }
.field-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px; border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
  margin-bottom: 8px; background: var(--bg-panel); font-size: var(--text-sm);
}
.field-row .fr-type { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-tertiary); margin-left: auto; }
.field-row .fr-grip { color: var(--text-tertiary); cursor: grab; }

.drag-list .drag-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px; border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
  margin-bottom: 8px; background: var(--bg-panel); font-size: var(--text-sm);
  cursor: grab; color: var(--text-secondary); user-select: none;
}
.drag-list .drag-item .rank { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--accent-text); width: 20px; }
.drag-list .drag-item.dragging { opacity: 0.4; border-style: dashed; }

.menu-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 300;
  width: 260px; background: var(--bg-overlay);
  border: 1px solid var(--border-default); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-overlay); padding: 10px;
  display: none; text-align: left;
}
.menu-pop.open { display: block; animation: pop var(--duration-base) var(--ease-out); }
.menu-pop .mp-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 8px; border-radius: var(--radius-md); font-size: var(--text-sm); color: var(--text-secondary); }
.menu-pop .mp-row:hover { background: var(--bg-hover); }

.task-group-title { font-size: var(--text-xs); font-weight: 510; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.05em; margin: 18px 0 8px; display: flex; align-items: center; gap: 8px; }
.task-group-title:first-child { margin-top: 0; }

/* ============================================================
   WYSIWYG DOC EDITOR (display-grade)
   ============================================================ */
.wys-toolbar {
  display: flex; align-items: center; gap: 3px; flex-wrap: wrap;
  padding: 8px; border: 1px solid var(--border-default);
  border-bottom: none; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--bg-raised); position: sticky; top: 64px; z-index: 30;
}
.wys-btn {
  font-family: var(--font-sans); font-size: var(--text-sm); font-weight: 510;
  color: var(--text-secondary); background: none; border: none;
  border-radius: var(--radius-md); min-width: 30px; height: 30px; padding: 0 8px;
  cursor: pointer; transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}
.wys-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.wys-btn.on { background: var(--accent-tint); color: var(--accent-text); }
.wys-sep { width: 1px; height: 18px; background: var(--border-default); margin: 0 5px; }
.wys-select {
  font-family: var(--font-sans); font-size: var(--text-xs); color: var(--text-secondary);
  background: var(--bg-base); border: 1px solid var(--border-default);
  border-radius: var(--radius-md); height: 30px; padding: 0 6px;
}
.wys-area {
  min-height: 380px; background: var(--bg-panel);
  border: 1px solid var(--border-default);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  padding: var(--space-8); outline: none;
  color: var(--text-secondary); font-size: var(--text-base); line-height: 1.7;
}
.wys-area:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.wys-area h1, .wys-area h2, .wys-area h3 { margin: 0.8em 0 0.3em; }
.wys-area ul, .wys-area ol { padding-left: 22px; margin: 0.4em 0; }
.wys-area blockquote { border-left: 3px solid var(--accent); padding-left: 14px; color: var(--text-tertiary); margin: 0.6em 0; }
.wys-title {
  width: 100%; font-family: var(--font-sans); font-size: var(--text-xl); font-weight: 538;
  letter-spacing: -0.02em; color: var(--text-primary);
  background: none; border: none; outline: none; padding: 4px 0 14px;
}
.wys-title::placeholder { color: var(--text-disabled); }
.editor-chip { display: inline-flex; align-items: center; gap: 6px; }

/* ============================================================
   TEAM MAKER
   ============================================================ */
.tm-layout { display: grid; grid-template-columns: 320px minmax(0,1fr); gap: var(--space-6); align-items: start; }
@media (max-width: 1100px) { .tm-layout { grid-template-columns: 1fr; } }
.tm-settings { position: sticky; top: 84px; display: flex; flex-direction: column; gap: var(--space-4); }
.tm-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: var(--space-4); }
.tm-col {
  background: var(--bg-panel); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl); padding: var(--space-3);
  min-height: 220px; transition: border-color var(--duration-fast) var(--ease-out);
}
.tm-col.dropover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.tm-col.violation { border-color: rgba(235,87,87,0.5); }
.tm-col-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 4px 10px; }
.tm-col-head .tm-name { font-weight: 538; color: var(--text-primary); font-size: var(--text-sm); letter-spacing: -0.01em; }
.tm-chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-raised); border: 1px solid var(--border-default);
  border-radius: var(--radius-lg); padding: 6px 9px; margin-bottom: 6px;
  font-size: var(--text-sm); color: var(--text-secondary); cursor: grab; user-select: none;
}
.tm-chip .avatar { width: 22px; height: 22px; font-size: 9px; }
.tm-chip.leader { border-color: rgba(94,106,210,0.45); background: var(--accent-tint); color: var(--text-primary); cursor: default; }
.tm-chip.dragging { opacity: 0.4; border-style: dashed; }
.tm-chip.repeat { outline: 2px dotted var(--warning); outline-offset: 1px; }
.tm-chip.focused { outline: 2px solid var(--accent); outline-offset: 1px; }
.tm-chip .tm-meta { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--text-tertiary); white-space: nowrap; }
.tm-chip.tm-pinned { border: 1px dashed rgba(94,106,210,0.6); background: var(--accent-tint); color: var(--text-primary); }
.tm-merge {
  margin-left: 6px; flex-shrink: 0; width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px; background: var(--accent); color: #fff; font-size: 13px;
  cursor: copy; box-shadow: 0 0 0 3px var(--accent-tint);
}
.tm-balance { display: flex; gap: 5px; flex-wrap: wrap; padding-top: 8px; border-top: 1px solid var(--border-subtle); margin-top: 6px; }
.tm-balance .badge { font-size: 10px; padding: 1px 7px; }
.tm-pool { border-style: dashed; background: var(--bg-subtle); min-height: 80px; }
.tm-hist { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--space-3); }
.tm-hist-night { background: var(--bg-subtle); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: var(--space-3); }
.tm-hist-night h4 { font-size: var(--text-xs); color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; font-weight: 510; }
.tm-hist-team { margin-bottom: 8px; font-size: var(--text-xs); }
.tm-hist-team .th-name { color: var(--text-primary); font-weight: 510; }
.tm-hist-team .th-members { color: var(--text-tertiary); line-height: 1.5; }
.tm-hist-team .th-members .hl { color: var(--warning); font-weight: 510; }
.tm-overlay {
  position: fixed; inset: 0; z-index: 400; background: rgba(0,0,0,0.45);
  display: none; align-items: flex-start; justify-content: center; padding: 10vh 16px 0;
}
.tm-overlay.open { display: flex; }
.tm-overlay .tm-sheet {
  width: min(560px, 100%); max-height: 76vh; overflow-y: auto;
  background: var(--bg-overlay); border: 1px solid var(--border-default);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-overlay); padding: var(--space-6);
  animation: pop var(--duration-base) var(--ease-out);
}

/* ============================================================
   MOBILE — bottom app toolbar, no page header, swipeable bars
   ============================================================ */
.mobile-bar { display: none; }
@media (max-width: 860px) {
  .sidebar { display: none; }
  .page-header { display: none; }
  .content { padding: var(--space-4) var(--space-4) 108px; }
  .mobile-bar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 150;
    background: var(--header-veil);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--border-default);
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity; scrollbar-width: none;
    gap: 2px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  }
  .mobile-bar::-webkit-scrollbar { display: none; }
  .mobile-item {
    scroll-snap-align: center; flex-shrink: 0; position: relative;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    min-width: 66px; padding: 7px 9px; border-radius: var(--radius-lg);
    color: var(--text-tertiary); text-decoration: none;
    font-size: 11px; font-weight: 510; letter-spacing: -0.005em;
    transition: color var(--duration-fast) var(--ease-out), background var(--duration-fast) var(--ease-out);
  }
  .mobile-item.active { color: var(--accent-text); background: var(--accent-tint); }
  .mobile-item .mb-icon svg { width: 20px; height: 20px; }
  .mb-badge {
    position: absolute; top: 3px; right: 10px;
    background: var(--accent); color: #fff;
    font-family: var(--font-mono); font-size: 9px;
    border-radius: var(--radius-full); padding: 0 5px; line-height: 14px;
  }
  /* page tabs & segmented controls become sticky, swipeable secondary toolbars */
  .tabs, .content > .segmented {
    position: sticky; top: 0; z-index: 60;
    background: var(--header-veil);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    overflow-x: auto; flex-wrap: nowrap; white-space: nowrap;
    scrollbar-width: none; margin-left: calc(-1 * var(--space-4)); margin-right: calc(-1 * var(--space-4));
    padding-left: var(--space-4); padding-right: var(--space-4);
  }
  .tabs::-webkit-scrollbar, .content > .segmented::-webkit-scrollbar { display: none; }
  .tab, .segmented button { flex-shrink: 0; }
  .panel { width: 100vw; }
  .chat-layout { grid-template-columns: 1fr; height: calc(100vh - 200px); }
  .chat-list { display: none; }
  .tm-layout, .builder-layout, .doc-layout { grid-template-columns: 1fr; }
  .tm-settings, .builder-preview, .doc-tree { position: static; }
}

/* Marketing hamburger */
.mk-burger { display: none; background: none; border: 1px solid var(--border-default); border-radius: var(--radius-md); color: var(--text-primary); font-size: 20px; width: 40px; height: 36px; cursor: pointer; }
@media (max-width: 860px) {
  .mk-nav { display: none; }
  .mk-burger { display: block; }
  .mk-nav.open {
    display: flex; flex-direction: column; align-items: stretch;
    position: absolute; top: 60px; right: var(--space-4); z-index: 200;
    background: var(--bg-overlay); border: 1px solid var(--border-default);
    border-radius: var(--radius-xl); box-shadow: var(--shadow-overlay);
    padding: 10px; gap: 4px; min-width: 220px;
  }
  .mk-nav.open a { padding: 10px 12px; }
  .mk-header .mk-container { position: relative; }
}
