/* ============================================================
   MAE CORTEX — 2026 Project Intelligence
   Palette (4 brand colors + neutrals):
     • Champagne #E8C68A — Ash Leila
     • Aurora    #9B7BFF — Marketix
     • Mint      #6FCE9E — B2B Suite / positive
     • Coral     #EE7B7B — alert / negative
   ============================================================ */

:root {
  --bg: #07070A;
  --bg-2: #0B0B10;
  --surface: rgba(255,255,255,0.035);
  --surface-2: rgba(255,255,255,0.06);
  --hairline: rgba(255,255,255,0.07);
  --hairline-2: rgba(255,255,255,0.12);

  --text: #F5F5F7;
  --text-2: rgba(245,245,247,0.62);
  --text-3: rgba(245,245,247,0.55); /* WCAG AA: 4.6:1 on --bg (was 0.38 → 3.4:1) */
  --text-4: rgba(245,245,247,0.18);

  --champagne: #E8C68A;
  --aurora:    #9B7BFF;
  --mint:      #6FCE9E;
  --coral:     #EE7B7B;

  --ease-spring: cubic-bezier(0.34, 1.36, 0.4, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-xl: 28px;

  --sans: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --serif: 'Instrument Serif', 'Times New Roman', serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body, #root {
  height: 100%;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

button { font-family: inherit; color: inherit; }
input { font-family: inherit; }

/* ---------- Background ambient ---------- */
.bg-ambient {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(900px 600px at 18% 110%, rgba(155,123,255,0.14), transparent 60%),
    radial-gradient(900px 600px at 85% 110%, rgba(232,198,138,0.11), transparent 60%),
    radial-gradient(700px 500px at 95% -10%, rgba(232,198,138,0.06), transparent 60%),
    radial-gradient(1200px 700px at 50% 50%, rgba(255,255,255,0.015), transparent 70%);
}
.bg-grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0.35;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.06 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ---------- Starfield (drifting background) ---------- */
.starfield {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none;
  overflow: hidden;
  contain: strict;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 92%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 92%);
}
.stars-layer {
  position: absolute;
  top: 0; left: 0;
  width: 1px; height: 1px;
  border-radius: 999px;
  background: transparent;
  will-change: transform, opacity;
}
.stars-far {
  animation:
    stardriftFar 240s ease-in-out infinite alternate,
    twinkleFar 5.5s ease-in-out infinite alternate;
}
.stars-mid {
  animation:
    stardriftMid 180s ease-in-out infinite alternate,
    twinkleMid 4s ease-in-out infinite alternate;
}
.stars-near {
  animation:
    stardriftNear 120s ease-in-out infinite alternate,
    twinkleNear 3.2s ease-in-out infinite alternate;
}
@keyframes stardriftFar  { 0% { transform: translate(0,0); } 100% { transform: translate(-50px, 24px); } }
@keyframes stardriftMid  { 0% { transform: translate(0,0); } 100% { transform: translate(70px, -38px); } }
@keyframes stardriftNear { 0% { transform: translate(0,0); } 100% { transform: translate(-110px, 50px); } }
@keyframes twinkleFar    { 0% { opacity: 0.45; } 100% { opacity: 0.85; } }
@keyframes twinkleMid    { 0% { opacity: 0.55; } 100% { opacity: 0.95; } }
@keyframes twinkleNear   { 0% { opacity: 0.7;  } 100% { opacity: 1; } }

/* Hide starfield in light mode */
body:has(.app[data-mood="light"]) .starfield { opacity: 0.18; mix-blend-mode: multiply; }
body:has(.app[data-mood="light"]) .stars-layer { filter: invert(1); }

/* Faster twinkle if pulse=live */
.app[data-pulse="live"] ~ .starfield .stars-near { animation-duration: 100s, 1.6s; }
.app[data-pulse="live"] ~ .starfield .stars-mid { animation-duration: 140s, 2.2s; }
body:has(.app[data-pulse="live"]) .stars-near { animation-duration: 100s, 1.6s; }
body:has(.app[data-pulse="live"]) .stars-mid { animation-duration: 140s, 2.2s; }

/* ---------- Layout ---------- */
.app {
  position: relative; z-index: 2;
  display: grid;
  grid-template-columns: 232px 1fr;
  grid-template-rows: 64px 1fr;
  height: 100vh;
  width: 100vw;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 232px 1fr auto;
  align-items: center;
  border-bottom: 1px solid var(--hairline);
  background: rgba(7,7,10,0.7);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  position: relative; z-index: 50;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  padding-left: 22px;
  height: 100%;
  border-right: 1px solid var(--hairline);
}
.brand-mark {
  width: 26px; height: 26px; position: relative;
}
.brand-name {
  font-size: 13px;
  letter-spacing: 0.22em;
  font-weight: 600;
  text-transform: uppercase;
}
.brand-name b { font-weight: 800; }
.brand-name span { color: var(--text-3); font-weight: 500; letter-spacing: 0.22em; }

.topbar-center {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 0 24px;
}
.search {
  flex: 1; max-width: 520px;
  height: 36px;
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,0.035);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 0 14px;
  transition: border-color .2s, background .2s;
}
.search:focus-within { border-color: var(--hairline-2); background: rgba(255,255,255,0.06); }
.search input {
  flex: 1; background: transparent; border: 0; outline: 0; color: var(--text);
  font-size: 13px; letter-spacing: 0.005em;
}
.search input::placeholder { color: var(--text-3); }
.kbd {
  font-family: var(--mono); font-size: 10px;
  color: var(--text-3);
  border: 1px solid var(--hairline);
  border-radius: 5px; padding: 1px 5px;
}
.topbar-right {
  display: flex; align-items: center; gap: 8px; padding: 0 22px;
}
.icon-btn {
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent; border-radius: 10px;
  cursor: pointer; color: var(--text-2); transition: color .2s, background .2s, border-color .2s;
}
.icon-btn:hover { color: var(--text); background: rgba(255,255,255,0.04); border-color: var(--hairline); }
.dot-online { width: 6px; height: 6px; border-radius: 999px; background: var(--mint); box-shadow: 0 0 8px var(--mint); }
.avatar {
  width: 30px; height: 30px; border-radius: 999px;
  background: linear-gradient(135deg, #2A2230 0%, #1B1820 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; letter-spacing: 0.05em;
  border: 1px solid var(--hairline-2);
  color: var(--text);
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  border-right: 1px solid var(--hairline);
  background: rgba(7,7,10,0.55);
  backdrop-filter: blur(20px);
  display: flex; flex-direction: column;
  padding: 12px 0 10px;
  overflow: hidden;
  z-index: 10;
}
.sidebar-scroll {
  flex: 1; min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;        /* Firefox */
  -ms-overflow-style: none;     /* IE/Edge legacy */
}
.sidebar-scroll::-webkit-scrollbar { width: 0; height: 0; display: none; } /* WebKit */
.side-section {
  padding: 6px 16px 4px;
}
.side-label {
  font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-3); font-weight: 600;
  padding: 10px 16px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 7px 13px;
  margin: 1px 10px;
  border-radius: 9px;
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
  transition: color .2s, background .2s;
  position: relative;
  font-weight: 500;
  letter-spacing: 0.01em;
  overflow: hidden;
}
.nav-item::after {
  content: '';
  position: absolute;
  right: 0; top: 6px; bottom: 6px;
  width: 28px;
  border-radius: 10px;
  background: linear-gradient(to left, rgba(94,158,255,0.55), rgba(94,158,255,0.18) 50%, rgba(94,158,255,0));
  opacity: 0;
  transition: opacity 280ms cubic-bezier(0.22,1,0.36,1), width 320ms cubic-bezier(0.22,1,0.36,1);
  pointer-events: none;
  filter: blur(0.5px);
  z-index: 0;
}
.nav-item > * { position: relative; z-index: 1; }
.nav-item:hover::after { opacity: 1; width: 36px; }
.nav-item:hover { background: rgba(94,158,255,0.06); color: var(--text); }
.nav-item.active {
  background: rgba(255,255,255,0.05);
  color: var(--text);
}
.nav-item.active::before {
  content: '';
  position: absolute; left: -10px; top: 8px; bottom: 8px;
  width: 2px; border-radius: 2px;
  background: var(--text);
}
.nav-item .badge {
  margin-left: auto;
  font-size: 10px;
  font-family: var(--mono);
  color: var(--text-3);
  position: relative;
  z-index: 2;
}

.proj-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 13px;
  margin: 1px 10px;
  border-radius: 9px;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  transition: color .2s, background .2s;
  position: relative;
  overflow: hidden;
}
.proj-pill::after {
  content: '';
  position: absolute;
  right: 0; top: 5px; bottom: 5px;
  width: 26px;
  border-radius: 10px;
  background: linear-gradient(to left, rgba(94,158,255,0.55), rgba(94,158,255,0.18) 50%, rgba(94,158,255,0));
  opacity: 0;
  transition: opacity 280ms cubic-bezier(0.22,1,0.36,1), width 320ms cubic-bezier(0.22,1,0.36,1);
  pointer-events: none;
  z-index: 0;
}
.proj-pill > * { position: relative; z-index: 1; }
.proj-pill:hover::after { opacity: 1; width: 32px; }
.proj-pill:hover { background: rgba(94,158,255,0.06); color: var(--text); }
.proj-pill .swatch {
  width: 8px; height: 8px; border-radius: 2px;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}
.proj-pill .swatch.s-circle { border-radius: 999px; }
.proj-pill .meta {
  margin-left: auto;
  font-size: 10px; font-family: var(--mono); color: var(--text-3);
  position: relative;
  z-index: 2;
}

.side-footer {
  margin-top: auto;
  padding: 12px 16px;
  border-top: 1px solid var(--hairline);
  font-size: 11px;
  color: var(--text-3);
  display: flex; align-items: center; gap: 10px;
}
.side-footer .v {
  font-family: var(--mono);
  letter-spacing: 0.04em;
}

/* ============================================================
   CONTENT / VIEWPORT
   ============================================================ */
.content {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* CANVAS HEADER */
.canvas-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 22px 32px 18px;
  border-bottom: 1px solid var(--hairline);
}
.crumbs {
  font-size: 11px; color: var(--text-3); letter-spacing: 0.12em; text-transform: uppercase;
  font-weight: 600;
}
.crumbs b { color: var(--text-2); font-weight: 600; }
.title-row { display: flex; align-items: baseline; gap: 14px; margin-top: 6px; }
.h-title {
  font-family: var(--serif);
  font-size: 32px; line-height: 1;
  letter-spacing: -0.015em;
  font-weight: 400;
}
.h-title em { font-style: italic; color: var(--text-2); }
.h-sub {
  font-size: 12px; color: var(--text-3);
  letter-spacing: 0.02em;
}
.canvas-tools {
  display: flex; align-items: center; gap: 10px;
}
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 30px; padding: 0 12px;
  border: 1px solid var(--hairline);
  background: rgba(255,255,255,0.025);
  border-radius: 999px;
  font-size: 11.5px;
  color: var(--text-2);
  cursor: pointer;
  transition: color .2s, background .2s, border-color .2s;
}
.chip:hover { color: var(--text); border-color: var(--hairline-2); }
.chip.active { color: var(--text); background: rgba(255,255,255,0.07); border-color: var(--hairline-2); }
.chip .swatch { width: 6px; height: 6px; border-radius: 999px; }

/* ============================================================
   CORTEX CANVAS
   ============================================================ */
.cortex-wrap {
  position: relative;
  flex: 1;
  overflow: hidden;
  cursor: grab;
}
.cortex-wrap.is-dragging { cursor: grabbing; }
.cortex-wrap.is-dragging .cortex-node { cursor: grabbing; }
.cortex-svg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  user-select: none;
}
.cortex-bg-rings {
  position: absolute;
  left: 50%; top: 50%;
  width: 2400px; height: 2400px;
  margin-left: -1200px; margin-top: -1200px;
  pointer-events: none;
  transform-origin: center center;
  background-image:
    radial-gradient(circle at 50% 50%, rgba(255,255,255,0.04) 0%, transparent 1px),
    radial-gradient(circle at 50% 50%, transparent 119px, rgba(255,255,255,0.05) 120px, transparent 121px),
    radial-gradient(circle at 50% 50%, transparent 239px, rgba(255,255,255,0.04) 240px, transparent 241px),
    radial-gradient(circle at 50% 50%, transparent 379px, rgba(255,255,255,0.03) 380px, transparent 381px),
    radial-gradient(circle at 50% 50%, transparent 519px, rgba(255,255,255,0.025) 520px, transparent 521px),
    radial-gradient(circle at 50% 50%, transparent 699px, rgba(255,255,255,0.018) 700px, transparent 701px),
    radial-gradient(circle at 50% 50%, transparent 879px, rgba(255,255,255,0.014) 880px, transparent 881px),
    radial-gradient(circle at 50% 50%, transparent 1079px, rgba(255,255,255,0.01) 1080px, transparent 1081px);
  mask-image: radial-gradient(circle at 50% 50%, black 0%, black 38%, transparent 75%);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, black 0%, black 38%, transparent 75%);
}
.cortex-axes {
  position: absolute; inset: 0;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-4);
  letter-spacing: 0.15em;
  pointer-events: none;
}
.cortex-axes span { position: absolute; }

.node-label {
  font-family: var(--sans);
  fill: var(--text);
  font-weight: 500;
  font-size: 11.5px;
  letter-spacing: 0.005em;
}
.node-meta {
  font-family: var(--mono);
  fill: var(--text-3);
  font-size: 9.5px;
  letter-spacing: 0.06em;
}

/* HUD overlay */
.hud {
  position: absolute;
  left: 24px; bottom: 24px;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
  z-index: 4;
}
.hud-row {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.hud-row .v { color: var(--text); font-weight: 600; }
.hud-pulse {
  width: 6px; height: 6px; border-radius: 999px;
  background: var(--mint);
  box-shadow: 0 0 0 0 var(--mint);
  animation: hud-pulse 2s ease-out infinite;
}
@keyframes hud-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(111,206,158,0.6); }
  100% { box-shadow: 0 0 0 10px rgba(111,206,158,0); }
}

.zoom-cluster {
  position: absolute;
  right: 24px; bottom: 24px;
  display: flex; flex-direction: column; gap: 1px;
  background: rgba(7,7,10,0.6);
  backdrop-filter: blur(20px);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  overflow: hidden;
  z-index: 4;
}
.zoom-cluster button {
  width: 32px; height: 32px;
  background: transparent;
  border: 0;
  color: var(--text-2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.zoom-cluster button:hover { background: rgba(255,255,255,0.05); color: var(--text); }

.legend {
  position: absolute;
  top: 22px; right: 32px;
  display: flex; gap: 18px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  z-index: 4;
  pointer-events: none;
}
.legend .item { display: flex; align-items: center; gap: 6px; }
.legend .dot { width: 7px; height: 7px; border-radius: 999px; }

/* ============================================================
   DETAIL PANEL (right slide-in)
   ============================================================ */
.detail-panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 460px;
  background: rgba(8, 8, 12, 0.78);
  backdrop-filter: blur(36px) saturate(140%);
  -webkit-backdrop-filter: blur(36px) saturate(140%);
  border-left: 1px solid var(--hairline-2);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  opacity: 0;
  transition: transform 600ms var(--ease-out), opacity 320ms var(--ease-soft);
  z-index: 30;
  box-shadow: -60px 0 120px rgba(0,0,0,0.55);
}
.detail-panel.open {
  transform: translateX(0);
  opacity: 1;
}
.detail-head {
  padding: 26px 28px 18px;
  border-bottom: 1px solid var(--hairline);
}
.detail-head .close {
  position: absolute; top: 18px; right: 18px;
  width: 30px; height: 30px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--hairline);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  cursor: pointer;
}
.detail-head .close:hover { color: var(--text); background: rgba(255,255,255,0.08); }
.detail-eyebrow {
  font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase;
  font-weight: 700;
}
.detail-name {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 38px;
  line-height: 1;
  letter-spacing: -0.02em;
  margin: 10px 0 4px;
}
.detail-name em { font-style: italic; color: var(--text-2); }
.detail-sub {
  font-size: 12.5px; color: var(--text-3);
  letter-spacing: 0.005em;
  margin-bottom: 18px;
}
.detail-actions { display: flex; gap: 8px; }
.btn {
  height: 32px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 12px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer;
  border: 1px solid var(--hairline);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  transition: background .2s, border-color .2s;
}
.btn:hover { background: rgba(255,255,255,0.07); }
.btn.primary {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.btn.primary:hover { background: #fff; }

.detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px 30px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.detail-body::-webkit-scrollbar { width: 6px; }
.detail-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 999px; }

.bento {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 22px;
}
.bento .span-2 { grid-column: span 2; }
.tile {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 16px 16px 14px;
  overflow: hidden;
}
.tile .label {
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-3);
  font-weight: 600;
}
.tile .value {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 34px;
  line-height: 1;
  letter-spacing: -0.02em;
  margin-top: 10px;
}
.tile .delta {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px;
  font-family: var(--mono);
  margin-top: 8px;
}
.tile.up .delta { color: var(--mint); }
.tile.down .delta { color: var(--coral); }
.tile .corner-glow {
  position: absolute; right: -40px; bottom: -40px;
  width: 120px; height: 120px; border-radius: 999px;
  filter: blur(40px);
  opacity: 0.35;
}

.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 4px 2px 12px;
}
.section-title {
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-2);
  font-weight: 600;
}
.section-link {
  font-size: 11px; color: var(--text-3); letter-spacing: 0.04em;
  display: inline-flex; align-items: center; gap: 4px;
}

.timeline {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 16px 18px 12px;
  margin-bottom: 22px;
}
.timeline .axis {
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 9.5px; color: var(--text-3);
  margin-top: 8px;
  letter-spacing: 0.05em;
}
.timeline-chart { position: relative; height: 100px; }

.workstreams {
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 22px;
}
.ws-row {
  display: grid;
  grid-template-columns: 16px 1fr 70px 60px;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  font-size: 12.5px;
}
.ws-row .ws-dot { width: 8px; height: 8px; border-radius: 999px; }
.ws-row .ws-name { color: var(--text); font-weight: 500; }
.ws-row .ws-bar {
  height: 4px; border-radius: 999px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
}
.ws-row .ws-bar > div {
  height: 100%; border-radius: 999px;
  transform-origin: left center;
  animation: barIn 700ms var(--ease-out) both;
}
@keyframes barIn { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.ws-row .ws-pct {
  font-family: var(--mono); font-size: 10.5px; color: var(--text-3);
  text-align: right;
}

/* ============================================================
   TOPICS PICKER — project view intermediate step before workstream
   ============================================================ */
.topics-grid {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 22px;
}
.topic-card {
  display: grid;
  grid-template-columns: 12px 1fr auto 14px;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-left: 2px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: background 180ms var(--ease-out), border-color 180ms var(--ease-out), transform 200ms var(--ease-out);
  animation: slideIn 480ms var(--ease-out) both;
}
.topic-card:hover {
  background: rgba(255,255,255,0.04);
  border-left-color: var(--topic-accent, var(--text));
  transform: translateX(2px);
}
.topic-card:focus-visible {
  outline: none;
  border-left-color: var(--topic-accent, var(--text));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--topic-accent, white) 35%, transparent);
}
.topic-card .topic-dot {
  width: 8px; height: 8px; border-radius: 999px;
  box-shadow: 0 0 10px 0 var(--topic-accent, transparent);
}
.topic-card .topic-body {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.topic-card .topic-label {
  font-size: 13px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topic-card .topic-meta {
  font-family: var(--mono); font-size: 10px; color: var(--text-3);
  letter-spacing: 0.04em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topic-card .topic-score {
  font-family: var(--mono); font-size: 11px; color: var(--text-2);
  padding: 3px 8px;
  background: rgba(255,255,255,0.04);
  border-radius: 999px;
}
.topic-card .topic-chev {
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-3);
  opacity: 0.55;
  transition: transform 200ms var(--ease-out), opacity 200ms var(--ease-out), color 200ms var(--ease-out);
}
.topic-card:hover .topic-chev {
  transform: translateX(3px);
  opacity: 1;
  color: var(--topic-accent, var(--text));
}
.app[data-mood="light"] .topic-card {
  background: rgba(255,253,249,0.4);
}
.app[data-mood="light"] .topic-card:hover {
  background: rgba(0,0,0,0.03);
}
.app[data-mood="light"] .topic-card .topic-score {
  background: rgba(0,0,0,0.04);
}
.app[data-voice="brutalist"] .topic-card {
  border-radius: 4px;
}

/* ============================================================
   LIVE STREAM
   ============================================================ */
.stream {
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 6px 0 6px;
  overflow: hidden;
  position: relative;
}
.stream-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px 8px;
}
.stream-head .l { display: flex; align-items: center; gap: 8px; font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-2); font-weight: 600; }
.stream-head .live-dot {
  width: 6px; height: 6px; border-radius: 999px; background: var(--coral);
  box-shadow: 0 0 0 0 rgba(238,123,123,0.6);
  animation: live-pulse 1.6s ease-out infinite;
}
@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(238,123,123,0.7); }
  100% { box-shadow: 0 0 0 10px rgba(238,123,123,0); }
}
.stream-head .rate {
  font-family: var(--mono); font-size: 10px; color: var(--text-3);
  letter-spacing: 0.06em;
}

.stream-list {
  position: relative;
  height: 260px;
  overflow: hidden;
  mask-image: linear-gradient(to bottom, black 0%, black 82%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 0%, black 82%, transparent 100%);
}
.tx {
  position: absolute;
  left: 14px; right: 14px;
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  transition: top 540ms var(--ease-out), opacity 540ms var(--ease-out);
}
.tx-glyph {
  width: 30px; height: 30px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 11px;
  font-weight: 600;
}
.tx-body { min-width: 0; }
.tx-text {
  font-size: 12.5px; color: var(--text);
  font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tx-meta {
  font-family: var(--mono); font-size: 9.5px; color: var(--text-3);
  letter-spacing: 0.04em;
  margin-top: 3px;
  display: flex; gap: 6px;
}
.tx-val {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.tx-val.up   { color: var(--mint); }
.tx-val.down { color: var(--coral); }
.tx-val.flat { color: var(--text-2); }

/* slide-in animation when added */
@keyframes tx-enter {
  0%   { opacity: 0; transform: translateX(20px) scale(0.97); filter: blur(4px); }
  60%  { opacity: 1; filter: blur(0); }
  100% { opacity: 1; transform: translateX(0) scale(1); filter: blur(0); }
}
.tx.enter { animation: tx-enter 540ms var(--ease-out) both; }
.tx.exit  { opacity: 0; transform: translateY(-10px); filter: blur(3px); }

/* ============================================================
   VIEWS (other tabs)
   ============================================================ */
.view-pad {
  flex: 1; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain;     /* keep wheel inside the pad */
  -webkit-overflow-scrolling: touch;
  padding: 22px 32px 40px;
  /* Hidden scroll: mouse wheel works, no visible bar */
  scrollbar-width: none;        /* Firefox */
  -ms-overflow-style: none;     /* IE/Edge legacy */
}
.view-pad::-webkit-scrollbar { width: 0; height: 0; display: none; } /* WebKit */
/* Any inner scroll containers should also hide their bar by default */
.view-pad *::-webkit-scrollbar { width: 0; height: 0; display: none; }
.view-pad * { scrollbar-width: none; -ms-overflow-style: none; }

.row-grid-3 {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
  margin-bottom: 22px;
}
.row-grid-4 {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  margin-bottom: 22px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.card-eyebrow {
  font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-3); font-weight: 600;
}
.card-big {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 44px;
  line-height: 1;
  letter-spacing: -0.02em;
  margin: 16px 0 6px;
}

/* Projects view */
.project-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl);
  padding: 24px 26px;
  position: relative;
  overflow: hidden;
  display: flex; flex-direction: column; gap: 14px;
  min-height: 240px;
  transition: border-color .25s, transform .35s var(--ease-out), background .25s;
  cursor: pointer;
}
.project-card:hover {
  border-color: var(--hairline-2);
  background: rgba(255,255,255,0.05);
  transform: translateY(-2px);
}
.project-card .accent-glow {
  position: absolute; top: -40px; right: -40px;
  width: 140px; height: 140px; border-radius: 999px;
  filter: blur(50px);
  opacity: 0.45;
}
.project-card .acc-strip {
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
}
.project-card .pname {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 30px;
  letter-spacing: -0.015em;
  line-height: 1;
  margin-top: 4px;
}
.project-card .pname em { font-style: italic; color: var(--text-2); }
.project-card .pdesc {
  font-size: 12.5px; color: var(--text-3); line-height: 1.5;
  max-width: 90%;
}
.project-card .ptags {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.tag {
  font-family: var(--mono); font-size: 9.5px;
  padding: 3px 7px; border-radius: 5px;
  color: var(--text-3);
  border: 1px solid var(--hairline);
  background: rgba(255,255,255,0.02);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.project-card .pfoot {
  margin-top: auto;
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--mono); font-size: 10px; color: var(--text-3);
  letter-spacing: 0.05em;
}
.project-card .pfoot .v { color: var(--text); font-weight: 600; }

/* Pipeline */
.kanban {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
}
.col {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
  min-height: 460px;
}
.col-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-2); font-weight: 600;
  padding: 0 4px 8px;
  border-bottom: 1px solid var(--hairline);
}
.col-head .count {
  margin-left: auto;
  font-family: var(--mono); font-size: 10px; color: var(--text-3);
}
.task {
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 12px 14px;
  cursor: grab;
  transition: background .2s, border-color .2s, transform .25s;
}
.task:hover { background: rgba(255,255,255,0.06); border-color: var(--hairline-2); }
.task .t-head { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 9.5px; color: var(--text-3); letter-spacing: 0.06em; text-transform: uppercase; }
.task .t-head .dot { width: 6px; height: 6px; border-radius: 999px; }
.task .t-title { font-size: 13px; font-weight: 500; margin-top: 6px; }
.task .t-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; font-family: var(--mono); font-size: 9.5px; color: var(--text-3); }
.assignees { display: flex; }
.assignees .av {
  width: 18px; height: 18px; border-radius: 999px;
  background: #1d1c22; border: 1px solid #0b0b10;
  margin-left: -5px;
  display: flex; align-items: center; justify-content: center;
  font-size: 8px; font-weight: 700;
}
.assignees .av:first-child { margin-left: 0; }

/* Analytics view */
.big-chart {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl);
  padding: 22px 22px 14px;
  margin-bottom: 16px;
  height: 320px;
  position: relative;
}
.big-chart .axis-y {
  position: absolute; left: 16px; top: 60px; bottom: 30px;
  display: flex; flex-direction: column; justify-content: space-between;
  font-family: var(--mono); font-size: 9.5px; color: var(--text-3);
  letter-spacing: 0.04em;
}

/* Team */
.team-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
.member {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 18px;
  display: flex; gap: 14px; align-items: flex-start;
}
.member .photo {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, #2a2630 0%, #18181f 100%);
  border: 1px solid var(--hairline);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; letter-spacing: 0.03em;
}
.member .m-name { font-size: 13px; font-weight: 600; }
.member .m-role { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.member .m-stats {
  display: flex; gap: 14px; margin-top: 8px;
  font-family: var(--mono); font-size: 10px; color: var(--text-3);
}
.member .m-stats b { color: var(--text); font-weight: 600; }

/* Slide-in fade utilities for view transitions */
.view-enter {
  animation: viewIn 480ms var(--ease-out) both;
}
@keyframes viewIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Tooltip on hover for nodes */
.node-tip {
  position: absolute;
  pointer-events: none;
  background: rgba(10,10,14,0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--hairline-2);
  border-radius: 14px;
  padding: 12px 14px;
  min-width: 200px;
  z-index: 20;
  box-shadow: 0 24px 48px rgba(0,0,0,0.5);
  animation: tip-in 220ms var(--ease-out) both;
}
@keyframes tip-in {
  from { opacity: 0; transform: translateY(6px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.node-tip .nt-eyebrow {
  font-size: 9.5px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--text-3); font-weight: 600;
  display: flex; align-items: center; gap: 6px;
}
.node-tip .nt-eyebrow .dot { width: 6px; height: 6px; border-radius: 999px; }
.node-tip .nt-name {
  font-family: var(--serif);
  font-size: 18px; font-weight: 400; line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 8px 0 6px;
}
.node-tip .nt-stat { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 10px; color: var(--text-3); letter-spacing: 0.04em; }
.node-tip .nt-stat b { color: var(--text); font-weight: 600; }

/* Helpers */
.fade-in { animation: fadeIn 400ms var(--ease-out) both; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.slide-in {
  animation: slideIn 480ms var(--ease-out) both;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(10px); filter: blur(6px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

/* ============================================================
   CONSTELLATION VIEW — branch-focused live network
   ============================================================ */
.cortex-wrap.is-leaving {
  transform: scale(1.22);
  filter: blur(28px);
  opacity: 0;
  pointer-events: none;
  transition: transform 900ms var(--ease-out), filter 700ms var(--ease-out), opacity 600ms var(--ease-out);
}

.constellation {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  z-index: 20;
  overflow: hidden;
  animation: cnStageIn 600ms var(--ease-out) both;
}
.constellation.is-leaving {
  animation: cnStageOut 380ms var(--ease-soft) forwards;
}
@keyframes cnStageIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes cnStageOut { to { opacity: 0; filter: blur(14px); transform: scale(0.97); } }

.cn-halo {
  position: absolute;
  left: 50%; top: 50%;
  width: 1000px; height: 1000px;
  margin-left: -500px; margin-top: -500px;
  border-radius: 999px;
  filter: blur(180px);
  opacity: 0;
  pointer-events: none;
  animation: cnHaloIn 1400ms var(--ease-out) 100ms forwards;
}
@keyframes cnHaloIn {
  from { opacity: 0; transform: scale(0.5); }
  to   { opacity: 0.16; transform: scale(1); }
}

/* === Top bar === */
.cn-top {
  position: relative; z-index: 4;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 18px 32px 14px;
  border-bottom: 1px solid var(--hairline);
  animation: cnSlideDown 600ms var(--ease-out) 200ms both;
}
@keyframes cnSlideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cn-back {
  justify-self: start;
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 14px 0 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  color: var(--text-2);
  font-size: 12px;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
  font-family: var(--sans);
}
.cn-back:hover { background: rgba(255,255,255,0.08); color: var(--text); border-color: var(--hairline-2); }
.cn-eyebrow {
  justify-self: center;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 10px; letter-spacing: 0.24em; text-transform: uppercase;
  font-weight: 700;
}
.cn-eyebrow .dot { width: 6px; height: 6px; border-radius: 999px; box-shadow: 0 0 8px currentColor; }
.cn-tools { justify-self: end; display: flex; gap: 8px; }

/* === Corner stats === */
.cn-corner {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  animation: cnCornerIn 700ms var(--ease-out) 1700ms both;
}
@keyframes cnCornerIn {
  from { opacity: 0; transform: translate(0, 6px); filter: blur(6px); }
  to { opacity: 1; transform: translate(0, 0); filter: blur(0); }
}
.cn-corner-tl { left: 32px; top: 80px; }
.cn-corner-tr { right: 32px; top: 80px; text-align: right; }
.cn-corner-bl { left: 32px; bottom: 60px; }
.cn-corner-br { right: 32px; bottom: 60px; text-align: right; }
.cn-corner-label {
  font-family: var(--mono); font-size: 9px;
  color: var(--text-3); letter-spacing: 0.18em; text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 4px;
}
.cn-corner-val {
  font-size: 11px;
  color: var(--text); font-weight: 600;
  letter-spacing: 0.08em;
  display: inline-flex; align-items: center; gap: 6px;
}
.cn-live-dot {
  width: 6px; height: 6px; border-radius: 999px;
  display: inline-block;
  box-shadow: 0 0 6px currentColor;
  animation: cnDotPulse 1.6s ease-in-out infinite;
}
@keyframes cnDotPulse {
  0%, 100% { opacity: 0.6; }
  50%      { opacity: 1; }
}
.mono { font-family: var(--mono); }

/* === Stage === */
.cn-stage {
  position: relative;
  flex: 1;
  min-height: 0;
}
.cn-svg {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
}

/* === SVG text classes === */
.cn-hero-kind {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4em;
}
.cn-hero-name {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 46px;
  letter-spacing: -0.018em;
  fill: var(--text);
}
.cn-hero-meta {
  font-family: var(--mono);
  font-size: 11px;
  fill: var(--text-3);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
}
.cn-hero-stat {
  font-family: var(--mono);
  font-size: 10px;
  fill: var(--text-2);
  letter-spacing: 0.22em;
  font-weight: 600;
}

.cn-sn-num {
  font-family: var(--mono);
  font-size: 9px;
  fill: var(--text-4);
  letter-spacing: 0.18em;
  font-weight: 600;
}
.cn-sn-label {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 400;
  fill: var(--text);
  letter-spacing: -0.01em;
}
.cn-sn-meta {
  font-family: var(--mono);
  font-size: 9.5px;
  fill: var(--text-3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
}

/* === Bottom === */
.cn-bottom {
  position: relative; z-index: 3;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 12px 32px 18px;
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  animation: cnSlideDown 600ms var(--ease-out) 1700ms both;
}
.cn-bottom-l { justify-self: start; }
.cn-bottom-c { justify-self: center; display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-weight: 600; font-family: var(--sans); letter-spacing: 0.06em; text-transform: none; font-size: 12px; }
.cn-bottom-c .dot { width: 6px; height: 6px; border-radius: 999px; box-shadow: 0 0 8px currentColor; }
.cn-bottom-r { justify-self: end; }

/* === Animations === */
@keyframes cnFadeIn      { from { opacity: 0; } to { opacity: 1; } }
@keyframes cnPathDraw    { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes cnSubPop      {
  0%   { opacity: 0; transform: scale(0.2); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes cnLabelIn     {
  0%   { opacity: 0; transform: translateX(0); filter: blur(4px); }
  100% { opacity: 1; transform: translateX(0); filter: blur(0); }
}
@keyframes cnRingIn      {
  from { opacity: 0; transform: scale(0.6); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes cnRingPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}
@keyframes cnHeroPop     {
  0%   { opacity: 0; transform: scale(0); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes cnTextIn      {
  0%   { opacity: 0; transform: translateY(8px); filter: blur(6px); }
  100% { opacity: 1; transform: translateY(0); filter: blur(0); }
}
@keyframes cnScanBeam {
  0%   { transform: translateX(-2%); opacity: 0; }
  10%  { opacity: 0.9; }
  90%  { opacity: 0.9; }
  100% { transform: translateX(102%); opacity: 0; }
}

/* SVG groups need transform-box for keyframe transforms to work on them
   when also positioned by their parent <g transform> */
.cn-svg g[style*="cnHeroPop"],
.cn-svg g[style*="cnSubPop"],
.cn-svg g[style*="cnRingIn"] {
  transform-box: fill-box;
  transform-origin: center;
}

/* Voice variants */
.app[data-voice="modernist"] .cn-hero-name { font-family: var(--sans); font-weight: 300; letter-spacing: -0.035em; }
.app[data-voice="modernist"] .cn-sn-label  { font-family: var(--sans); font-weight: 400; letter-spacing: -0.01em; font-size: 14px; }

.app[data-voice="brutalist"] .cn-hero-name { font-family: var(--mono); font-weight: 500; text-transform: uppercase; letter-spacing: -0.005em; font-size: 32px; }
.app[data-voice="brutalist"] .cn-sn-label  { font-family: var(--mono); font-weight: 500; text-transform: uppercase; letter-spacing: 0; font-size: 12px; }
.app[data-voice="brutalist"] .cn-back { border-radius: 4px; }


/* ============================================================
   TWEAKS — Mood (palette + surface), Voice (type), Pulse (motion)
   ============================================================ */

/* --- MOOD: Light (Apple-style luxury daylight) -------------- */
.app[data-mood="light"] {
  --bg: #F2EFE9;
  --bg-2: #EAE5DC;
  --surface: rgba(20,18,15,0.035);
  --surface-2: rgba(20,18,15,0.07);
  --hairline: rgba(20,18,15,0.09);
  --hairline-2: rgba(20,18,15,0.16);
  --text: #181613;
  --text-2: rgba(24,22,19,0.66);
  --text-3: rgba(24,22,19,0.42);
  --text-4: rgba(24,22,19,0.20);
}
body:has(.app[data-mood="light"]) { background: #F2EFE9; }
body:has(.app[data-mood="light"]) .bg-ambient {
  background:
    radial-gradient(900px 600px at 18% 110%, rgba(155,123,255,0.07), transparent 60%),
    radial-gradient(700px 500px at 95% -10%, rgba(232,198,138,0.22), transparent 60%),
    radial-gradient(1200px 700px at 50% 50%, rgba(0,0,0,0.012), transparent 70%);
}
body:has(.app[data-mood="light"]) .bg-grain { opacity: 0.12; mix-blend-mode: multiply; }

.app[data-mood="light"] .topbar { background: rgba(242,239,233,0.82); border-bottom-color: rgba(0,0,0,0.07); }
.app[data-mood="light"] .sidebar { background: rgba(242,239,233,0.6); border-right-color: rgba(0,0,0,0.07); }
.app[data-mood="light"] .detail-panel { background: rgba(246,243,237,0.86); border-left-color: rgba(0,0,0,0.10); box-shadow: -40px 0 80px rgba(60,40,20,0.10); }
.app[data-mood="light"] .stream-list .tx { background: rgba(24,22,19,0.025); border-color: rgba(0,0,0,0.07); }
.app[data-mood="light"] .stream { background: rgba(24,22,19,0.02); border-color: rgba(0,0,0,0.07); }
.app[data-mood="light"] .avatar { background: linear-gradient(135deg, #E0D9CB 0%, #B8AE9A 100%); color: #181613; border-color: rgba(0,0,0,0.12); }
.app[data-mood="light"] .node-label { fill: var(--text); font-weight: 600; }
.app[data-mood="light"] .node-meta  { fill: var(--text-3); }
.app[data-mood="light"] .btn.primary { background: #181613; color: #F2EFE9; border-color: #181613; }

/* Cortex rings darker on light */
.app[data-mood="light"] .cortex-bg-rings {
  background-image:
    radial-gradient(circle at 50% 50%, rgba(20,18,15,0.06) 0%, transparent 1px),
    radial-gradient(circle at 50% 50%, transparent 119px, rgba(20,18,15,0.08) 120px, transparent 121px),
    radial-gradient(circle at 50% 50%, transparent 239px, rgba(20,18,15,0.06) 240px, transparent 241px),
    radial-gradient(circle at 50% 50%, transparent 379px, rgba(20,18,15,0.045) 380px, transparent 381px),
    radial-gradient(circle at 50% 50%, transparent 519px, rgba(20,18,15,0.035) 520px, transparent 521px),
    radial-gradient(circle at 50% 50%, transparent 699px, rgba(20,18,15,0.025) 700px, transparent 701px),
    radial-gradient(circle at 50% 50%, transparent 879px, rgba(20,18,15,0.018) 880px, transparent 881px),
    radial-gradient(circle at 50% 50%, transparent 1079px, rgba(20,18,15,0.013) 1080px, transparent 1081px);
}

/* Tone down node glows: replace neon drop-shadow with subtle shadow */
.app[data-mood="light"] .cortex-node circle {
  filter: drop-shadow(0 2px 4px rgba(20,18,15,0.12)) !important;
}
.app[data-mood="light"] .cortex-node g.node-motion > circle:nth-of-type(1),
.app[data-mood="light"] .cortex-node g.node-motion > circle:nth-of-type(2) {
  /* Halo blurs — keep but subtle */
  filter: blur(18px) !important;
  opacity: 0.4 !important;
}
.app[data-mood="light"] .legend .dot,
.app[data-mood="light"] .proj-pill .swatch { box-shadow: none !important; }

/* Hover tooltip on light */
.app[data-mood="light"] .node-tip { background: rgba(246,243,237,0.92); color: var(--text); box-shadow: 0 20px 40px rgba(60,40,20,0.15); }
.app[data-mood="light"] .node-tip .nt-name { color: var(--text); }

/* Detail panel + tiles on light */
.app[data-mood="light"] .tile,
.app[data-mood="light"] .card,
.app[data-mood="light"] .project-card,
.app[data-mood="light"] .col,
.app[data-mood="light"] .task,
.app[data-mood="light"] .ws-row,
.app[data-mood="light"] .member,
.app[data-mood="light"] .timeline,
.app[data-mood="light"] .big-chart {
  background: rgba(255,253,249,0.7);
  border-color: rgba(0,0,0,0.07);
  box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset;
}
.app[data-mood="light"] .corner-glow,
.app[data-mood="light"] .accent-glow { opacity: 0.25 !important; }
.app[data-mood="light"] .tag { background: rgba(24,22,19,0.03); border-color: rgba(0,0,0,0.08); color: rgba(24,22,19,0.55); }
.app[data-mood="light"] .ws-bar { background: rgba(0,0,0,0.06); }
.app[data-mood="light"] .nav-item.active { background: rgba(24,22,19,0.06); }
.app[data-mood="light"] .nav-item.active::before { background: var(--text); }
.app[data-mood="light"] .chip { background: rgba(255,253,249,0.5); border-color: rgba(0,0,0,0.08); }
.app[data-mood="light"] .chip.active { background: rgba(24,22,19,0.06); border-color: rgba(0,0,0,0.16); }
.app[data-mood="light"] .search { background: rgba(255,253,249,0.6); border-color: rgba(0,0,0,0.09); }
.app[data-mood="light"] .icon-btn:hover { background: rgba(24,22,19,0.05); border-color: rgba(0,0,0,0.08); }
.app[data-mood="light"] .kbd { border-color: rgba(0,0,0,0.12); color: rgba(24,22,19,0.5); }
.app[data-mood="light"] .zoom-cluster { background: rgba(246,243,237,0.78); border-color: rgba(0,0,0,0.10); }
.app[data-mood="light"] .zoom-cluster button { color: rgba(24,22,19,0.6); }
.app[data-mood="light"] .zoom-cluster button:hover { background: rgba(24,22,19,0.05); color: var(--text); }
.app[data-mood="light"] .av { background: #EDE7DA; border-color: #F2EFE9; }
.app[data-mood="light"] .photo { background: linear-gradient(135deg, #EDE7DA 0%, #D8CFB9 100%) !important; }

/* HUD readability */
.app[data-mood="light"] .hud-row { color: rgba(24,22,19,0.45); }
.app[data-mood="light"] .hud-row .v { color: var(--text); }
.app[data-mood="light"] .legend { color: rgba(24,22,19,0.5); }
.app[data-mood="light"] .crumbs { color: rgba(24,22,19,0.45); }
.app[data-mood="light"] .crumbs b { color: rgba(24,22,19,0.7); }

/* --- MOOD: Nocturne (deep cool jewel-tone) ------------------ */
.app[data-mood="nocturne"] {
  --bg: #050816;
  --bg-2: #0A0F26;
  --surface: rgba(180,200,255,0.04);
  --surface-2: rgba(180,200,255,0.07);
  --hairline: rgba(180,200,255,0.08);
  --hairline-2: rgba(180,200,255,0.16);
  --text: #ECEEFF;
  --text-2: rgba(236,238,255,0.62);
  --text-3: rgba(236,238,255,0.4);
  --text-4: rgba(236,238,255,0.2);
}
body:has(.app[data-mood="nocturne"]) { background: #050816; }
body:has(.app[data-mood="nocturne"]) .bg-ambient {
  background:
    radial-gradient(900px 700px at 18% 110%, rgba(123,148,255,0.20), transparent 60%),
    radial-gradient(900px 700px at 85% 110%, rgba(232,198,138,0.12), transparent 60%),
    radial-gradient(700px 500px at 95% -10%, rgba(232,198,138,0.06), transparent 60%),
    radial-gradient(1200px 700px at 50% 50%, rgba(155,123,255,0.06), transparent 70%);
}
.app[data-mood="nocturne"] .topbar { background: rgba(5,8,22,0.78); }
.app[data-mood="nocturne"] .sidebar { background: rgba(5,8,22,0.6); }
.app[data-mood="nocturne"] .detail-panel { background: rgba(5,8,22,0.84); }

/* --- VOICE: Modernist (clean sans, low contrast weights) ---- */
/* Catch-all: any inline Instrument Serif gets remapped */
.app[data-voice="modernist"] [style*="Instrument Serif"] {
  font-family: var(--sans) !important;
  font-weight: 300 !important;
  letter-spacing: -0.025em !important;
}
.app[data-voice="modernist"] [style*="Instrument Serif"] em {
  font-style: normal !important;
  font-weight: 300 !important;
  color: var(--text-3) !important;
}
.app[data-voice="modernist"] .h-title,
.app[data-voice="modernist"] .pname,
.app[data-voice="modernist"] .detail-name,
.app[data-voice="modernist"] .card-big,
.app[data-voice="modernist"] .tile .value {
  font-family: var(--sans);
  font-weight: 300;
  letter-spacing: -0.025em;
}
.app[data-voice="modernist"] .h-title em,
.app[data-voice="modernist"] .pname em,
.app[data-voice="modernist"] .detail-name em {
  font-style: normal;
  font-weight: 300;
  color: var(--text-3);
}
.app[data-voice="modernist"] .h-title { font-size: 36px; letter-spacing: -0.035em; }
.app[data-voice="modernist"] .detail-name { font-size: 40px; letter-spacing: -0.03em; }
.app[data-voice="modernist"] .pname { font-size: 28px; letter-spacing: -0.025em; }

/* --- VOICE: Brutalist (mono uppercase headlines) ------------ */
/* Catch-all: inline Instrument Serif remapped to mono uppercase */
.app[data-voice="brutalist"] [style*="Instrument Serif"] {
  font-family: var(--mono) !important;
  font-weight: 500 !important;
  text-transform: uppercase !important;
  letter-spacing: -0.005em !important;
}
.app[data-voice="brutalist"] [style*="Instrument Serif"] em {
  font-style: normal !important;
  color: var(--text-3) !important;
}
.app[data-voice="brutalist"] .h-title,
.app[data-voice="brutalist"] .pname,
.app[data-voice="brutalist"] .detail-name,
.app[data-voice="brutalist"] .card-big,
.app[data-voice="brutalist"] .tile .value {
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}
.app[data-voice="brutalist"] .h-title em,
.app[data-voice="brutalist"] .pname em,
.app[data-voice="brutalist"] .detail-name em {
  font-style: normal;
  color: var(--text-3);
  font-weight: 400;
}
.app[data-voice="brutalist"] .h-title { font-size: 28px; letter-spacing: -0.02em; line-height: 1.05; }
.app[data-voice="brutalist"] .detail-name { font-size: 30px; letter-spacing: -0.02em; line-height: 1.05; }
.app[data-voice="brutalist"] .pname { font-size: 22px; letter-spacing: -0.01em; line-height: 1.1; }
.app[data-voice="brutalist"] .tile .value { font-size: 28px; letter-spacing: 0; }
.app[data-voice="brutalist"] .card-big { font-size: 36px; }
/* sharpen corners for brutalist */
.app[data-voice="brutalist"] .card,
.app[data-voice="brutalist"] .tile,
.app[data-voice="brutalist"] .project-card,
.app[data-voice="brutalist"] .col,
.app[data-voice="brutalist"] .task,
.app[data-voice="brutalist"] .stream,
.app[data-voice="brutalist"] .timeline,
.app[data-voice="brutalist"] .big-chart,
.app[data-voice="brutalist"] .member,
.app[data-voice="brutalist"] .ws-row {
  border-radius: 4px;
}
.app[data-voice="brutalist"] .chip { border-radius: 4px; }
.app[data-voice="brutalist"] .btn { border-radius: 4px; }
.app[data-voice="brutalist"] .search { border-radius: 4px; }
.app[data-voice="brutalist"] .nav-item { border-radius: 4px; }
.app[data-voice="brutalist"] .proj-pill { border-radius: 4px; }

/* --- PULSE: Reactive (springier, snappier) ------------------ */
.app[data-pulse="reactive"] {
  --ease-out: cubic-bezier(0.2, 1.4, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.7, 0.5, 1);
}
.app[data-pulse="reactive"] .nav-item,
.app[data-pulse="reactive"] .chip,
.app[data-pulse="reactive"] .icon-btn,
.app[data-pulse="reactive"] .project-card,
.app[data-pulse="reactive"] .task,
.app[data-pulse="reactive"] .btn {
  transition: all 240ms cubic-bezier(0.34, 1.7, 0.5, 1);
}
.app[data-pulse="reactive"] .project-card:hover { transform: translateY(-4px) scale(1.005); }
.app[data-pulse="reactive"] .nav-item:hover { transform: translateX(2px); }
.app[data-pulse="reactive"] .chip:hover { transform: translateY(-1px); }

/* --- PULSE: Live (continuous breathing + node orbit drift) - */
@keyframes breathe-glow {
  0%, 100% { filter: brightness(1); }
  50%      { filter: brightness(1.12); }
}
@keyframes node-drift {
  0%, 100% { transform: translate(0px, 0px); }
  25%      { transform: translate(2.2px, -1.6px); }
  50%      { transform: translate(-1.4px, 2.1px); }
  75%      { transform: translate(-2px, -1.2px); }
}
@keyframes halo-pulse {
  0%, 100% { opacity: 0.6; }
  50%      { opacity: 1; }
}
.app[data-pulse="live"] .cortex-node .node-motion {
  animation: node-drift 7s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
.app[data-pulse="live"] .cortex-node:nth-child(2n) .node-motion { animation-duration: 9s; animation-direction: reverse; }
.app[data-pulse="live"] .cortex-node:nth-child(3n) .node-motion { animation-duration: 11s; animation-delay: -2s; }
.app[data-pulse="live"] .cortex-node:nth-child(5n) .node-motion { animation-duration: 8.4s; animation-delay: -4s; }
.app[data-pulse="live"] .accent-glow,
.app[data-pulse="live"] .corner-glow {
  animation: breathe-glow 4.5s ease-in-out infinite;
}
.app[data-pulse="live"] .hud-pulse,
.app[data-pulse="live"] .live-dot { animation-duration: 1s; }
.app[data-pulse="live"] .dot-online {
  animation: breathe-glow 2.4s ease-in-out infinite;
}

/* ============================================================
   NEW · v2026.2 — Modals, Forms, Toasts, Auth, Glass primitives
   ============================================================ */

/* ---------- Modal overlay + card ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  background: rgba(3, 3, 6, 0.62);
  backdrop-filter: blur(8px) saturate(120%);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  animation: modalBackdropIn 180ms var(--ease-soft) both;
}
@keyframes modalBackdropIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.modal-card {
  position: relative;
  max-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  background: rgba(13, 13, 17, 0.86);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-xl);
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.55),
    0 2px 0 rgba(255, 255, 255, 0.04) inset;
  overflow: hidden;
  animation: modalCardIn 280ms var(--ease-out) both;
}
@keyframes modalCardIn {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}
.modal-head {
  position: relative;
  padding: 26px 30px 18px;
  border-bottom: 1px solid var(--hairline);
}
.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 30px; height: 30px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--hairline);
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s, transform .2s var(--ease-out);
}
.modal-close:hover  { background: rgba(255, 255, 255, 0.09); color: var(--text); border-color: var(--hairline-2); transform: rotate(90deg); }
.modal-close:focus-visible {
  outline: 2px solid var(--hairline-2);
  outline-offset: 2px;
}
.modal-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 700;
}
.modal-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 10px 0 6px;
}
.modal-title em { font-style: italic; color: var(--text-2); }
.modal-sub {
  font-size: 12.5px;
  color: var(--text-2);
  letter-spacing: 0.005em;
  max-width: 92%;
}
.modal-body {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}
.modal-body::-webkit-scrollbar { width: 6px; }
.modal-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 999px; }
.modal-body.is-padded { padding: 22px 30px 24px; }
.modal-foot {
  padding: 16px 30px 22px;
  border-top: 1px solid var(--hairline);
  display: flex;
  gap: 10px;
  background: rgba(255, 255, 255, 0.014);
}
.modal-foot.align-end       { justify-content: flex-end; }
.modal-foot.align-between   { justify-content: space-between; }
.modal-foot.align-start     { justify-content: flex-start; }
.modal-actions {
  display: inline-flex;
  gap: 10px;
  margin-left: auto;
}

/* ---------- Field wrapper ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}
.field-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.field-required { color: var(--coral); font-family: var(--mono); }
.field-control { display: flex; min-width: 0; }
.field-hint {
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.01em;
}
.field-error {
  font-size: 11px;
  color: var(--coral);
  letter-spacing: 0.01em;
  font-family: var(--mono);
}
.field.has-error .field-input,
.field.has-error .tag-input-wrap,
.field.has-error .member-picker-trigger,
.field.has-error .number-stepper {
  border-color: rgba(238, 123, 123, 0.55) !important;
  background: rgba(238, 123, 123, 0.04);
}

/* ---------- Input / Textarea / Select ---------- */
.field-input {
  width: 100%;
  min-height: 40px;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--hairline);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13.5px;
  letter-spacing: 0.005em;
  outline: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.field-input::placeholder { color: var(--text-3); }
.field-input:hover { border-color: var(--hairline-2); }
.field-input:focus,
.field-input:focus-visible {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.045);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 0 0 3px rgba(255, 255, 255, 0.04);
}
.field-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.field-textarea {
  min-height: 96px;
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.45;
}

/* Select */
.field-select-wrap {
  position: relative;
  width: 100%;
}
.field-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 38px;
  cursor: pointer;
}
.field-select option {
  background: #0E0E14;
  color: var(--text);
}
.field-select-arrow {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-3);
  display: inline-flex;
}

/* Date / Time */
.field-date, .field-time {
  font-family: var(--mono);
  letter-spacing: 0.04em;
}
.field-date::-webkit-calendar-picker-indicator,
.field-time::-webkit-calendar-picker-indicator {
  filter: invert(0.65);
  cursor: pointer;
  opacity: 0.7;
  transition: opacity .2s;
}
.field-date::-webkit-calendar-picker-indicator:hover,
.field-time::-webkit-calendar-picker-indicator:hover { opacity: 1; }

/* ---------- Swatch picker ---------- */
.swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 4px 0;
}
.swatch-dot {
  width: 28px; height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  cursor: pointer;
  position: relative;
  transition: transform .2s var(--ease-out), box-shadow .2s var(--ease-out);
  padding: 0;
}
.swatch-dot:hover { transform: scale(1.08); }
.swatch-dot:focus-visible { outline: 0; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px rgba(255,255,255,0.4); }
.swatch-dot.is-selected { transform: scale(1.08); }

/* ---------- Tag input ---------- */
.tag-input-wrap {
  width: 100%;
  min-height: 40px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--hairline);
  transition: border-color .2s, background .2s;
}
.tag-input-wrap:focus-within {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.045);
}
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 4px 0 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.tag-chip-x {
  width: 16px; height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  border-radius: 5px;
  color: var(--text-3);
  cursor: pointer;
}
.tag-chip-x:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); }
.tag-chip-x svg { width: 10px; height: 10px; }
.tag-input-input {
  flex: 1;
  min-width: 80px;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
}
.tag-input-input::placeholder { color: var(--text-3); }

/* ---------- Member picker ---------- */
.member-picker {
  position: relative;
  width: 100%;
}
.member-picker-trigger {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 36px 6px 10px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--hairline);
  cursor: pointer;
  text-align: left;
  color: var(--text);
  position: relative;
  transition: border-color .2s, background .2s;
}
.member-picker-trigger:hover { border-color: var(--hairline-2); }
.member-picker-trigger.is-open {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.045);
}
.member-picker-placeholder {
  color: var(--text-3);
  font-size: 13px;
  padding: 0 4px;
}
.member-picker-caret {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  display: inline-flex;
  transition: transform .2s var(--ease-out);
}
.member-picker-trigger.is-open .member-picker-caret { transform: translateY(-50%) rotate(180deg); }
.member-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 4px 0 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text);
}
.member-chip-av {
  width: 18px; height: 18px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
  border: 1px solid var(--hairline);
}
.member-chip-name {
  font-size: 11.5px;
  letter-spacing: 0.005em;
  padding-right: 2px;
}
.member-chip-x {
  width: 16px; height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  border-radius: 999px;
  color: var(--text-3);
  cursor: pointer;
}
.member-chip-x:hover { color: var(--text); background: rgba(255, 255, 255, 0.1); }
.member-chip-x svg { width: 10px; height: 10px; }

.member-picker-pop {
  position: absolute;
  z-index: 220;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: rgba(13, 13, 17, 0.92);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  border: 1px solid var(--hairline-2);
  border-radius: var(--r-md);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  animation: popIn 200ms var(--ease-out) both;
}
@keyframes popIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.member-picker-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--hairline);
}
.member-picker-search input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font-size: 13px;
  font-family: var(--sans);
}
.member-picker-search input::placeholder { color: var(--text-3); }
.member-picker-list {
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}
.member-picker-list::-webkit-scrollbar { width: 6px; }
.member-picker-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 999px; }
.member-picker-empty {
  padding: 18px 12px;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  font-family: var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.member-picker-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background .15s, border-color .15s;
}
.member-picker-row:hover  { background: rgba(255, 255, 255, 0.05); border-color: var(--hairline); }
.member-picker-row.is-checked { background: rgba(255, 255, 255, 0.04); border-color: var(--hairline-2); }
.member-picker-row-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.member-picker-row-name { font-size: 13px; font-weight: 500; }
.member-picker-row-role {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--text-3);
  text-transform: uppercase;
}
.member-picker-check {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1px solid var(--hairline-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--bg);
  background: transparent;
  transition: background .15s, color .15s;
}
.member-picker-check.is-on {
  background: var(--mint);
  border-color: var(--mint);
  color: #07070A;
}
.member-picker-check svg { width: 11px; height: 11px; }

/* ---------- Number stepper ---------- */
.number-stepper {
  display: inline-flex;
  align-items: center;
  height: 40px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--hairline);
  overflow: hidden;
  transition: border-color .2s, background .2s;
}
.number-stepper:focus-within {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.045);
}
.number-stepper-btn {
  width: 36px; height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  color: var(--text-2);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.number-stepper-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.number-stepper-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.number-stepper-input {
  width: 64px;
  height: 100%;
  text-align: center;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  -moz-appearance: textfield;
}
.number-stepper-input::-webkit-outer-spin-button,
.number-stepper-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.number-stepper-suffix {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
  padding-right: 10px;
  letter-spacing: 0.05em;
}

/* ---------- Toast ---------- */
.toast-host {
  position: fixed;
  top: 84px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 360px;
}
.toast {
  pointer-events: auto;
  display: grid;
  grid-template-columns: 16px 1fr 22px;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 16px;
  background: rgba(13, 13, 17, 0.86);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 2px solid var(--toast-accent, var(--champagne));
  border-radius: var(--r-md);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.45);
  animation: toastIn 320ms var(--ease-out) both;
  min-width: 240px;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(24px) scale(0.98); filter: blur(4px); }
  to   { opacity: 1; transform: translateX(0) scale(1); filter: blur(0); }
}
.toast-dot {
  width: 8px; height: 8px;
  border-radius: 999px;
  box-shadow: 0 0 10px currentColor;
}
.toast-msg {
  font-size: 13px;
  color: var(--text);
  letter-spacing: 0.005em;
  line-height: 1.4;
}
.toast-x {
  width: 22px; height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--text-3);
  border-radius: 6px;
  cursor: pointer;
}
.toast-x:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); }
.toast-x svg { width: 11px; height: 11px; }

/* ---------- Auth screen ---------- */
.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
.auth-card {
  width: 100%;
  max-width: 440px;
  padding: 32px 34px 28px;
  background: rgba(13, 13, 17, 0.86);
  backdrop-filter: blur(36px) saturate(140%);
  -webkit-backdrop-filter: blur(36px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-xl);
  box-shadow:
    0 32px 80px rgba(0, 0, 0, 0.55),
    0 2px 0 rgba(255, 255, 255, 0.04) inset;
  animation: authCardIn 480ms var(--ease-out) both;
}
@keyframes authCardIn {
  from { opacity: 0; transform: translateY(28px) scale(0.98); filter: blur(8px); }
  to   { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}
.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 26px;
}
.auth-wordmark {
  font-size: 19px;
  letter-spacing: 0.16em;
  font-weight: 600;
  text-transform: uppercase;
  margin-top: 4px;
}
.auth-wm-mae { font-weight: 800; color: var(--text); }
.auth-wm-cortex {
  font-family: var(--serif);
  font-style: italic;
  text-transform: none;
  letter-spacing: -0.01em;
  font-weight: 400;
  font-size: 22px;
  color: var(--text);
}
.auth-tagline {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 600;
}

.auth-toggle {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 3px;
  margin-bottom: 24px;
}
.auth-toggle-btn {
  position: relative;
  z-index: 2;
  height: 32px;
  background: transparent;
  border: 0;
  border-radius: 999px;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: color .25s var(--ease-out);
}
.auth-toggle-btn.is-active { color: var(--bg); }
.auth-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(50% - 3px);
  height: calc(100% - 6px);
  border-radius: 999px;
  background: var(--text);
  transition: transform 320ms var(--ease-spring);
  z-index: 1;
}

.auth-heading {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.auth-heading em { font-style: italic; color: var(--text-2); }
.auth-sub {
  font-size: 12.5px;
  color: var(--text-3);
  margin-bottom: 18px;
  letter-spacing: 0.005em;
}
.auth-founder-hint {
  background: rgba(155, 123, 255, 0.08);
  border: 1px solid rgba(155, 123, 255, 0.22);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-size: 11.5px;
  color: var(--text-2);
  margin-bottom: 18px;
  line-height: 1.5;
}
.auth-founder-hint b { color: var(--aurora); font-weight: 700; }

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-error {
  background: rgba(238, 123, 123, 0.08);
  border: 1px solid rgba(238, 123, 123, 0.24);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-size: 12px;
  color: var(--coral);
  font-family: var(--mono);
  letter-spacing: 0.01em;
}
.auth-submit {
  margin-top: 6px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--text);
  color: var(--bg);
  border: 1px solid var(--text);
  border-radius: var(--r-sm);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background .25s, border-color .25s, transform .2s var(--ease-out), color .25s;
}
.auth-submit:hover:not(:disabled) {
  background: var(--mint);
  border-color: var(--mint);
  color: #07070A;
}
.auth-submit:focus-visible { outline: 0; box-shadow: 0 0 0 3px rgba(111, 206, 158, 0.35); }
.auth-submit:disabled, .auth-submit.is-busy { cursor: not-allowed; opacity: 0.85; }
.auth-submit-arrow {
  display: inline-flex;
  transition: transform .25s var(--ease-out);
}
.auth-submit:hover:not(:disabled) .auth-submit-arrow { transform: translateX(3px); }
.auth-spinner {
  width: 14px; height: 14px;
  border-radius: 999px;
  border: 2px solid rgba(0, 0, 0, 0.18);
  border-top-color: rgba(0, 0, 0, 0.8);
  animation: authSpin 700ms linear infinite;
}
@keyframes authSpin { to { transform: rotate(360deg); } }

.auth-foot {
  margin-top: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
}
.auth-link {
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--hairline-2);
  text-underline-offset: 3px;
  cursor: pointer;
  font-family: inherit;
}
.auth-link:hover { color: var(--mint); text-decoration-color: var(--mint); }

/* ---------- Btn variants used in modals ---------- */
.btn.ghost {
  background: transparent;
  border-color: var(--hairline);
  color: var(--text-2);
}
.btn.ghost:hover { background: rgba(255,255,255,0.04); color: var(--text); border-color: var(--hairline-2); }
.btn.danger {
  background: rgba(238, 123, 123, 0.1);
  border-color: rgba(238, 123, 123, 0.35);
  color: var(--coral);
}
.btn.danger:hover { background: rgba(238, 123, 123, 0.18); color: #fff; border-color: var(--coral); }
.btn.accent {
  background: var(--mint);
  border-color: var(--mint);
  color: #07070A;
}
.btn.accent:hover { background: #82d8af; border-color: #82d8af; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Light-mood overrides for new primitives ---------- */
.app[data-mood="light"] ~ .modal-overlay,
body:has(.app[data-mood="light"]) .modal-overlay {
  background: rgba(35, 30, 22, 0.32);
}
body:has(.app[data-mood="light"]) .modal-card {
  background: rgba(246, 243, 237, 0.92);
  border-color: rgba(0, 0, 0, 0.10);
  box-shadow: 0 24px 64px rgba(60, 40, 20, 0.18), 0 1px 0 rgba(255,255,255,0.5) inset;
}
body:has(.app[data-mood="light"]) .field-input,
body:has(.app[data-mood="light"]) .tag-input-wrap,
body:has(.app[data-mood="light"]) .member-picker-trigger,
body:has(.app[data-mood="light"]) .number-stepper {
  background: rgba(255, 253, 249, 0.75);
  border-color: rgba(0, 0, 0, 0.09);
}
body:has(.app[data-mood="light"]) .field-input:focus,
body:has(.app[data-mood="light"]) .tag-input-wrap:focus-within,
body:has(.app[data-mood="light"]) .member-picker-trigger.is-open,
body:has(.app[data-mood="light"]) .number-stepper:focus-within {
  border-color: rgba(0, 0, 0, 0.32);
  background: rgba(255, 253, 249, 0.95);
}
body:has(.app[data-mood="light"]) .field-select option {
  background: #F2EFE9;
  color: var(--text);
}
body:has(.app[data-mood="light"]) .member-picker-pop {
  background: rgba(246, 243, 237, 0.95);
  border-color: rgba(0, 0, 0, 0.12);
}
body:has(.app[data-mood="light"]) .toast {
  background: rgba(246, 243, 237, 0.94);
  border-color: rgba(0, 0, 0, 0.08);
}
body:has(.app[data-mood="light"]) .auth-card {
  background: rgba(246, 243, 237, 0.94);
  border-color: rgba(0, 0, 0, 0.10);
  box-shadow: 0 32px 80px rgba(60, 40, 20, 0.18), 0 1px 0 rgba(255,255,255,0.6) inset;
}
body:has(.app[data-mood="light"]) .auth-submit {
  background: #181613; color: #F2EFE9; border-color: #181613;
}
body:has(.app[data-mood="light"]) .auth-submit:hover:not(:disabled) {
  background: var(--mint); color: #181613; border-color: var(--mint);
}

/* ---------- Brutalist sharpens corners ---------- */
.app[data-voice="brutalist"] .modal-card,
.app[data-voice="brutalist"] .field-input,
.app[data-voice="brutalist"] .tag-input-wrap,
.app[data-voice="brutalist"] .member-picker-trigger,
.app[data-voice="brutalist"] .member-picker-pop,
.app[data-voice="brutalist"] .number-stepper,
.app[data-voice="brutalist"] .toast,
.app[data-voice="brutalist"] .auth-card {
  border-radius: 4px;
}
.app[data-voice="brutalist"] .modal-title,
.app[data-voice="brutalist"] .auth-heading {
  font-family: var(--mono);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0;
}



/* ============================================================
   v2026.3 — CRUD card affordances (3-dot menu, action overlay)
   ============================================================ */
.card-dotbtn {
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-3);
  cursor: pointer;
  transition: color .2s, background .2s, border-color .2s, transform .2s var(--ease-out);
}
.card-dotbtn:hover {
  color: var(--text);
  background: rgba(255,255,255,0.06);
  border-color: var(--hairline);
}
.card-dotbtn:focus-visible {
  outline: none;
  border-color: var(--hairline-2);
  background: rgba(255,255,255,0.08);
}

.proj-menu-item {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 12.5px;
  font-family: var(--sans);
  text-align: left;
  cursor: pointer;
  transition: background .18s, color .18s;
}
.proj-menu-item:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text);
}
.proj-menu-item.is-danger { color: var(--coral); }
.proj-menu-item.is-danger:hover {
  background: rgba(238,123,123,0.10);
  color: var(--coral);
}
.proj-menu-item svg { flex-shrink: 0; }

@keyframes menuPop {
  from { opacity: 0; transform: translateY(-6px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============================================================
   v2026.4 — RESPONSIVE LAYOUT + SCROLL FIX
   Goal: site works on any viewport (1280→1920+, tablet, phone),
   and content never gets clipped off-screen.
   ============================================================ */

/* Desktop: lock the app-shell, let inner views handle scroll. */
html, body, #root {
  overflow: hidden;
  height: 100%;
  min-height: 100%;
}

/* Critical flex-overflow fix: without `min-height: 0` on the flex
   parent, the view-pad child can outgrow its parent and clip content. */
.app {
  min-height: 0;
}
.content {
  min-height: 0;
  min-width: 0;
}
.view-pad {
  /* min-height: 0 so the flex child can shrink and scroll within its
     grid/flex cell; overflow-y already declared above (line ~790). */
  min-height: 0;
  overflow-y: auto;
}

/* Ensure the modal is always reachable on tall content */
.modal-overlay {
  overflow-y: auto;
  align-items: flex-start;
  padding-top: 48px;
  padding-bottom: 48px;
}
.modal-card { max-height: calc(100vh - 96px); }

/* ─── Below 1100px: release the body-scroll trap so content cards
       can extend past the viewport without being clipped. The app
       grid switches to height: auto and the document handles scrolling. */
@media (max-width: 1100px) {
  html, body, #root {
    overflow-y: auto;
    overflow-x: hidden;
    height: auto;
    min-height: 100%;
  }
  .app {
    height: auto;
    min-height: 100vh;
  }
  .content {
    overflow: visible;
  }
  .view-pad {
    overflow-y: visible;
    min-height: 0;
  }
  /* Cortex needs a real height when the parent goes auto. */
  .cortex-wrap {
    min-height: 70vh;
  }
}

/* ─── Wide tablets / small laptops (≤ 1180px) ────────────────── */
@media (max-width: 1180px) {
  .app, .topbar { grid-template-columns: 212px 1fr auto; }
  .app { grid-template-columns: 212px 1fr; }
  .brand { padding-left: 16px; }
  .canvas-head { padding: 20px 24px 16px; }
  .view-pad { padding: 20px 24px 36px; }
  .row-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .row-grid-3 { grid-template-columns: repeat(2, 1fr); }
  .kanban    { grid-template-columns: repeat(2, 1fr); }
  .team-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .h-title   { font-size: 28px; }
}

/* ─── Tablets / narrow laptops (≤ 960px) ──────────────────────── */
@media (max-width: 960px) {
  .app          { grid-template-columns: 64px 1fr; }
  .topbar       { grid-template-columns: 64px 1fr auto; }
  .brand        { padding-left: 14px; }
  .brand-name   { display: none; }
  .sidebar .side-label,
  .sidebar .badge,
  .sidebar .proj-pill .meta,
  .sidebar .proj-pill > span:not(.swatch),
  .sidebar .nav-item > span:not(:first-child),
  .sidebar .side-footer > span:not(.dot-online) { display: none; }
  .sidebar { padding: 12px 8px; align-items: center; }
  .sidebar .nav-item,
  .sidebar .proj-pill { justify-content: center; padding: 10px; }
  .topbar-center .search { max-width: 360px; }
  .topbar-center .search input { font-size: 12px; }
  .topbar-center .kbd { display: none; }
  .canvas-head { padding: 16px 20px 12px; flex-direction: column; align-items: flex-start; gap: 12px; }
  .canvas-tools { flex-wrap: wrap; }
  .view-pad { padding: 16px 20px 32px; }
  .h-title { font-size: 24px; }
  .detail-panel { width: min(420px, 92vw); }
}

/* ─── Phones (≤ 640px) ────────────────────────────────────────── */
@media (max-width: 640px) {
  .app          { grid-template-columns: 1fr; grid-template-rows: 64px 56px 1fr; }
  .topbar       { grid-template-columns: 1fr auto; }
  .sidebar {
    grid-column: 1; grid-row: 2;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--hairline);
    padding: 8px 12px;
  }
  .sidebar .side-label,
  .sidebar .proj-pill,
  .sidebar .side-footer { display: none; }
  .sidebar .nav-item { padding: 8px 10px; flex-shrink: 0; }
  .content { grid-column: 1; grid-row: 3; }
  .row-grid-4, .row-grid-3, .kanban, .team-grid,
  .content .view-pad > div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  .topbar-right { padding: 0 12px; gap: 4px; }
  .topbar-center { padding: 0 8px; }
  .topbar-center .search { height: 32px; padding: 0 10px; }
  .topbar-center .search input { font-size: 12px; }
  .modal-card { width: 96vw !important; max-width: 96vw !important; }
  .modal-head, .modal-body.is-padded, .modal-foot { padding-left: 18px; padding-right: 18px; }
  .h-title { font-size: 22px; }
  .canvas-head { padding: 12px 16px 10px; }
  .view-pad { padding: 14px 16px 28px; }
  .modal-overlay { padding: 16px 10px; }
}

/* Make any 2-col grid in view-pad responsive on narrow screens */
@media (max-width: 880px) {
  .view-pad > div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* Calendar / messages — let their inner layouts go column on narrow */
@media (max-width: 1080px) {
  .msg-shell { grid-template-columns: 220px 1fr !important; }
}
@media (max-width: 760px) {
  .msg-shell { grid-template-columns: 1fr !important; }
  .msg-rail  { display: none; }
}

/* Scrollbar polish — global */
.modal-body::-webkit-scrollbar,
.view-pad::-webkit-scrollbar,
.detail-body::-webkit-scrollbar,
.modal-overlay::-webkit-scrollbar,
.workstreams::-webkit-scrollbar {
  width: 6px; height: 6px;
}
.modal-overlay::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.10); border-radius: 999px; }
