/* =====================================================================
   AETHER — Obsidian Intelligence design system
   Tokens → base → layout → components → views → motion
   ===================================================================== */

:root {
  /* Palette */
  --obsidian: #080A10;
  --midnight: #0F1424;
  --graphite: #1A2030;
  --platinum: #DCE2EE;
  --ice: #8DDCFF;
  --cyan: #54F0E8;
  --white: #F5F7FC;
  --amber: #F2B65A;
  --rose: #FF7A8A;

  /* Semantic colour */
  --bg: var(--obsidian);
  --text: var(--white);
  --text-2: rgba(220, 226, 238, .76);
  --text-3: rgba(220, 226, 238, .56);
  --text-4: rgba(220, 226, 238, .36);   /* decorative only (dots, rules) — not for text: 2.8:1 */
  --line: rgba(220, 226, 238, .07);
  --line-2: rgba(220, 226, 238, .12);
  --line-3: rgba(220, 226, 238, .2);
  --surface-0: rgba(12, 16, 28, .55);
  --surface-1: rgba(15, 20, 36, .78);
  --surface-2: rgba(26, 32, 48, .72);
  --surface-3: rgba(36, 44, 64, .8);
  --surface-solid: #0D111D;
  --accent: var(--ice);
  --accent-strong: var(--cyan);
  --accent-wash: rgba(141, 220, 255, .08);
  --accent-line: rgba(141, 220, 255, .28);
  --ok: var(--cyan);
  --warn: var(--amber);
  --danger: var(--rose);
  --focus: 0 0 0 2px var(--obsidian), 0 0 0 4px rgba(141, 220, 255, .7);

  /* Typography */
  --font-sans: "Geist", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --fs-xs: .75rem;
  --fs-sm: .8125rem;
  --fs-md: .9375rem;
  --fs-lg: 1.0625rem;
  --fs-xl: 1.375rem;
  --fs-2xl: clamp(1.75rem, 1.2rem + 1.6vw, 2.5rem);
  --lh-tight: 1.2;
  --lh-body: 1.6;
  --tracking-caps: .14em;

  /* Spacing (4px base) */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px;
  --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px; --sp-16: 64px;

  /* Radii */
  --r-xs: 6px; --r-sm: 9px; --r-md: 12px; --r-lg: 16px; --r-xl: 22px; --r-pill: 999px;

  /* Shadows & surfaces */
  --shadow-1: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 8px 24px -12px rgba(0, 0, 0, .6);
  --shadow-2: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 24px 60px -24px rgba(0, 0, 0, .75);
  --shadow-glow: 0 0 0 1px rgba(141, 220, 255, .18), 0 10px 40px -12px rgba(84, 240, 232, .25);
  --blur: saturate(140%) blur(18px);

  /* Motion */
  --dur-1: 120ms; --dur-2: 200ms; --dur-3: 320ms; --dur-4: 560ms; --dur-5: 900ms;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --ease-std: cubic-bezier(.2, 0, 0, 1);

  /* Layers */
  --z-bg: 0; --z-base: 1; --z-sticky: 10; --z-sidebar: 30; --z-scrim: 29;
  --z-overlay: 50; --z-toast: 60; --z-boot: 100;

  /* Layout */
  --sidebar-w: 256px;
  --sidebar-w-collapsed: 72px;
  --topbar-h: 60px;
  /* Breakpoints (reference): sm 640, md 900, lg 1200, xl 1440 */
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
body::before {               /* atmosphere: deep vignette + faint engineered grid */
  content: "";
  position: fixed; inset: 0; z-index: var(--z-bg); pointer-events: none;
  background:
    radial-gradient(1200px 700px at 58% 28%, rgba(141, 220, 255, .07), transparent 62%),
    radial-gradient(900px 600px at 10% 110%, rgba(84, 240, 232, .04), transparent 60%),
    linear-gradient(180deg, #0A0D16 0%, var(--obsidian) 55%);
}
body::after {
  content: "";
  position: fixed; inset: 0; z-index: var(--z-bg); pointer-events: none;
  background-image:
    linear-gradient(rgba(220, 226, 238, .028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(220, 226, 238, .028) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 70% 60% at 55% 35%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 55% 35%, #000 20%, transparent 75%);
}
/* Accessibility helpers */
.skip-link { position: fixed; left: 12px; top: -60px; z-index: var(--z-boot); padding: 10px 16px; border-radius: var(--r-sm);
  background: var(--white); color: var(--obsidian); font-weight: 600; text-decoration: none; transition: top var(--dur-2) var(--ease-out); }
.skip-link:focus { top: 12px; text-decoration: none; }
main:focus { outline: none; box-shadow: none; }
::selection { background: rgba(141, 220, 255, .28); color: var(--white); }
a { color: var(--ice); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus { outline: none; }
:focus-visible { box-shadow: var(--focus); border-radius: var(--r-sm); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(220, 226, 238, .1); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(220, 226, 238, .18); }
::-webkit-scrollbar-track { background: transparent; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.icon { width: 18px; height: 18px; stroke-width: 1.6; flex: none; }
.icon--sm { width: 15px; height: 15px; }
.mono { font-family: var(--font-mono); font-size: .92em; }
.muted { color: var(--text-3); }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- brand */
.emblem { display: block; flex: none; }
.wordmark { display: block; height: 13px; width: 78px; flex: none; overflow: visible; }

/* ---------------------------------------------------------------- app shell */
.app {
  position: relative; z-index: var(--z-base);
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: 100dvh;
  transition: grid-template-columns var(--dur-3) var(--ease-out);
}
.app[data-sidebar="collapsed"] { grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr); }

/* Sidebar */
.sidebar {
  position: relative; z-index: var(--z-sidebar);
  display: flex; flex-direction: column; min-height: 0;
  background: linear-gradient(180deg, rgba(15, 20, 36, .72), rgba(8, 10, 16, .72));
  border-right: 1px solid var(--line);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.sidebar__brand {
  display: flex; align-items: center; gap: var(--sp-3);
  height: var(--topbar-h); padding: 0 var(--sp-4) 0 var(--sp-5);
  border-bottom: 1px solid var(--line);
}
.sidebar__brand .emblem { width: 30px; height: 30px; }
.sidebar__brand .wordmark { transition: opacity var(--dur-2) var(--ease-std); }
.sidebar__collapse {
  margin-left: auto; display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: var(--r-sm);
  border: 1px solid transparent; background: transparent; color: var(--text-3);
  transition: color var(--dur-1), background var(--dur-1), border-color var(--dur-1);
}
.sidebar__collapse:hover { color: var(--text); background: var(--surface-2); border-color: var(--line); }
.nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: var(--sp-3) var(--sp-3) var(--sp-4); }
.nav__group + .nav__group { margin-top: var(--sp-4); }
.nav__label {
  padding: 0 var(--sp-3) var(--sp-2);
  font-size: .6875rem; letter-spacing: var(--tracking-caps); text-transform: uppercase;
  color: var(--text-3); font-weight: 500; white-space: nowrap;
}
.nav__item {
  position: relative;
  display: flex; align-items: center; gap: var(--sp-3);
  height: 36px; padding: 0 var(--sp-3); margin: 1px 0;
  border-radius: var(--r-sm); color: var(--text-2); font-size: var(--fs-sm); font-weight: 450;
  white-space: nowrap; text-decoration: none !important;
  transition: color var(--dur-1), background var(--dur-1);
}
.nav__item .icon { width: 17px; height: 17px; color: var(--text-3); transition: color var(--dur-1); }
.nav__item:hover { color: var(--text); background: rgba(220, 226, 238, .045); }
.nav__item:hover .icon { color: var(--text-2); }
.nav__item[aria-current="page"] { color: var(--white); background: linear-gradient(90deg, rgba(141, 220, 255, .1), rgba(141, 220, 255, .02)); }
.nav__item[aria-current="page"] .icon { color: var(--ice); }
.nav__item[aria-current="page"]::before {
  content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 2px;
  border-radius: 0 2px 2px 0; background: linear-gradient(var(--ice), var(--cyan));
  box-shadow: 0 0 12px rgba(84, 240, 232, .6);
}
.nav__text { overflow: hidden; text-overflow: ellipsis; }
.nav__tag {
  margin-left: auto; padding: 1px 7px; border-radius: var(--r-pill);
  font-size: .625rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-3); border: 1px solid var(--line-2);
}
.sidebar__foot {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--line);
  font-size: var(--fs-xs); color: var(--text-3); min-height: 52px;
}
.sidebar__foot .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app[data-sidebar="collapsed"] .wordmark,
.app[data-sidebar="collapsed"] .nav__text,
.app[data-sidebar="collapsed"] .nav__tag,
.app[data-sidebar="collapsed"] .nav__label,
.app[data-sidebar="collapsed"] .sidebar__foot .foot-text { opacity: 0; pointer-events: none; width: 0; }
.app[data-sidebar="collapsed"] .nav__label { height: 6px; padding: 0; }
.app[data-sidebar="collapsed"] .sidebar__brand { padding: 0 var(--sp-3) 0 21px; }
.app[data-sidebar="collapsed"] .sidebar__collapse { position: absolute; right: -15px; top: 15px; background: var(--surface-solid); border-color: var(--line-2); }
.app[data-sidebar="collapsed"] .nav__item { justify-content: center; padding: 0; }
.app[data-sidebar="collapsed"] .sidebar__foot { justify-content: center; padding: var(--sp-3) 0; }

.scrim { display: none; }

/* Main column */
.main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  position: relative; z-index: var(--z-sticky);
  display: flex; align-items: center; gap: var(--sp-3);
  height: var(--topbar-h); padding: 0 var(--sp-6); flex: none;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(8, 10, 16, .6), rgba(8, 10, 16, .2));
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.topbar .topbar__menu { display: none; }
.topbar__title { display: flex; flex-direction: column; min-width: 0; }
.topbar__title h1 { margin: 0; font-size: var(--fs-md); font-weight: 560; letter-spacing: -.01em; line-height: 1.2; }
.topbar__title p { margin: 0; font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__spacer { flex: 1; }
.topbar__clock { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-3); letter-spacing: .04em; }

.views { position: relative; flex: 1; min-height: 0; }
.offline-bar { display: flex; align-items: center; gap: var(--sp-3); padding: 8px var(--sp-6); flex: none;
  background: rgba(255, 122, 138, .08); border-bottom: 1px solid rgba(255, 122, 138, .25); font-size: var(--fs-sm); color: var(--text); }
.offline-bar .btn { margin-left: auto; }
.view { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; opacity: 0; visibility: hidden; transform: translateY(6px);
  transition: opacity var(--dur-3) var(--ease-out), transform var(--dur-3) var(--ease-out), visibility 0s linear var(--dur-3); }
.view.is-active { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }

/* ---------------------------------------------------------------- components */
/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  height: 36px; padding: 0 var(--sp-4); border-radius: var(--r-sm);
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text);
  font-size: var(--fs-sm); font-weight: 500; white-space: nowrap;
  transition: background var(--dur-1), border-color var(--dur-1), transform var(--dur-1), color var(--dur-1), box-shadow var(--dur-2);
}
.btn:hover { background: var(--surface-3); border-color: var(--line-3); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn--primary {
  color: #061017; border-color: transparent;
  background: linear-gradient(180deg, #E9F7FF, #A9E4FF);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .6) inset, 0 8px 22px -10px rgba(141, 220, 255, .65);
}
.btn--primary:hover { background: linear-gradient(180deg, #F5FBFF, #BDEBFF); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn--ghost:hover { background: rgba(220, 226, 238, .06); color: var(--text); border-color: transparent; }
.btn--danger { color: var(--rose); border-color: rgba(255, 122, 138, .3); background: rgba(255, 122, 138, .06); }
.btn--danger:hover { background: rgba(255, 122, 138, .12); border-color: rgba(255, 122, 138, .45); }
.btn--sm { height: 30px; padding: 0 var(--sp-3); font-size: var(--fs-xs); }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none;
  border-radius: var(--r-sm); border: 1px solid transparent; background: transparent; color: var(--text-2);
  transition: background var(--dur-1), color var(--dur-1), border-color var(--dur-1), transform var(--dur-1);
}
.icon-btn:hover { background: rgba(220, 226, 238, .06); color: var(--text); }
.icon-btn:active { transform: scale(.94); }
.icon-btn:disabled { opacity: .4; pointer-events: none; }
.icon-btn--sm { width: 28px; height: 28px; }

/* Pills / status */
.pill {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  height: 28px; padding: 0 var(--sp-3); border-radius: var(--r-pill);
  border: 1px solid var(--line-2); background: var(--surface-1);
  font-size: var(--fs-xs); color: var(--text-2); white-space: nowrap;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-4); flex: none; position: relative; }
.dot--ok { background: var(--cyan); box-shadow: 0 0 10px rgba(84, 240, 232, .7); }
.dot--warn { background: var(--amber); box-shadow: 0 0 10px rgba(242, 182, 90, .6); }
.dot--danger { background: var(--rose); box-shadow: 0 0 10px rgba(255, 122, 138, .55); }
.dot--busy::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1px solid currentColor; color: var(--ice); animation: ring-pulse 1.6s var(--ease-out) infinite; }

/* Agent status pill — the canonical, text-first state indicator */
.agent-pill { min-width: 0; }
.agent-pill .agent-pill__label { font-weight: 550; color: var(--text); }
.agent-pill .agent-pill__detail { color: var(--text-3); max-width: 22ch; overflow: hidden; text-overflow: ellipsis; }

/* Panels */
.panel {
  position: relative;
  background: linear-gradient(180deg, rgba(20, 26, 44, .62), rgba(12, 16, 28, .62));
  border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.panel__head { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-4) var(--sp-5) var(--sp-2); }
.panel__title { margin: 0; font-size: var(--fs-xs); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--text-3); font-weight: 550; }
.panel__action { margin-left: auto; }
.panel__body { padding: var(--sp-2) var(--sp-5) var(--sp-5); }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list__item { display: flex; align-items: flex-start; gap: var(--sp-3); padding: 10px 0; border-top: 1px solid var(--line); font-size: var(--fs-sm); }
.list__item:first-child { border-top: 0; }
.list__icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--r-sm); background: rgba(220, 226, 238, .05); color: var(--text-2); flex: none; }
.list__icon .icon { width: 15px; height: 15px; }
.list__main { min-width: 0; flex: 1; }
.list__title { color: var(--text); overflow-wrap: anywhere; }
.list__meta { color: var(--text-3); font-size: var(--fs-xs); margin-top: 2px; overflow-wrap: anywhere; }
.list__side { margin-left: auto; flex: none; }
button.list__item { width: 100%; text-align: left; background: none; border-left: 0; border-right: 0; border-bottom: 0; color: inherit; border-radius: 0; }
button.list__item:hover .list__title { color: var(--ice); }

/* Empty / loading / error states */
.empty { display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-2); padding: var(--sp-4) 0; color: var(--text-3); font-size: var(--fs-sm); }
.empty strong { color: var(--text-2); font-weight: 550; }
.empty--center { align-items: center; text-align: center; padding: var(--sp-10) var(--sp-4); }
.skeleton { height: 12px; border-radius: 6px; background: linear-gradient(90deg, rgba(220,226,238,.05), rgba(220,226,238,.1), rgba(220,226,238,.05)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton + .skeleton { margin-top: 10px; }
.callout { display: flex; gap: var(--sp-3); padding: var(--sp-4); border-radius: var(--r-md); border: 1px solid var(--line-2); background: var(--surface-1); font-size: var(--fs-sm); color: var(--text-2); }
.callout .icon { margin-top: 2px; }
.callout--warn { border-color: rgba(242, 182, 90, .3); background: rgba(242, 182, 90, .06); }
.callout--warn .icon { color: var(--amber); }
.callout--danger { border-color: rgba(255, 122, 138, .3); background: rgba(255, 122, 138, .06); }
.callout--danger .icon { color: var(--rose); }
.callout h3 { margin: 0 0 4px; font-size: var(--fs-sm); color: var(--text); font-weight: 600; }
.callout p { margin: 0; }
.callout code, .md code { font-family: var(--font-mono); font-size: .86em; padding: .1em .4em; border-radius: 5px; background: rgba(220, 226, 238, .07); color: var(--white); }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chip {
  height: 32px; padding: 0 var(--sp-3); border-radius: var(--r-pill);
  border: 1px solid var(--line-2); background: rgba(15, 20, 36, .5); color: var(--text-2);
  font-size: var(--fs-xs); transition: border-color var(--dur-1), color var(--dur-1), background var(--dur-1);
}
.chip:hover { color: var(--text); border-color: var(--accent-line); background: var(--accent-wash); }
.status-tag--warn { color: var(--amber); border-color: rgba(242, 182, 90, .4); }
.status-tag--danger { color: var(--rose); border-color: rgba(255, 122, 138, .4); }
.chip--off { opacity: .55; cursor: default; display: inline-flex; align-items: center; }
.chip--off:hover { color: var(--text-2); border-color: var(--line-2); background: rgba(15, 20, 36, .5); }
.chip[aria-pressed="true"] { color: var(--text); border-color: var(--accent-line); background: var(--accent-wash); }

/* ---------------------------------------------------------------- command surface */
.command {
  position: relative; width: 100%;
  border-radius: var(--r-xl);
  background: linear-gradient(180deg, rgba(26, 32, 48, .78), rgba(15, 20, 36, .82));
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow-2);
  transition: border-color var(--dur-2), box-shadow var(--dur-3) var(--ease-out);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.command::before {           /* hairline highlight along the top edge */
  content: ""; position: absolute; left: 18%; right: 18%; top: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(141, 220, 255, .55), transparent);
  opacity: .5; transition: opacity var(--dur-2);
}
.command:focus-within { border-color: var(--accent-line); box-shadow: var(--shadow-2), var(--shadow-glow); }
.command:focus-within::before { opacity: 1; }
.command__row { display: flex; align-items: flex-end; gap: var(--sp-2); padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-5); }
.command__input {
  flex: 1; min-height: 44px; max-height: 220px; resize: none;
  padding: 11px 0; border: 0; background: transparent; color: var(--text);
  font-size: var(--fs-md); line-height: 1.5;
}
.command__input::placeholder { color: var(--text-3); }
.command__input:focus-visible { box-shadow: none; }
.command__actions { display: flex; align-items: center; gap: var(--sp-1); padding-bottom: 2px; }
.send-btn {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 13px; border: 0;
  color: #061017; background: linear-gradient(180deg, #EAF8FF, #9FE0FF);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .6) inset, 0 6px 18px -8px rgba(141, 220, 255, .8);
  transition: transform var(--dur-1), filter var(--dur-2), opacity var(--dur-2);
}
.send-btn:hover { filter: brightness(1.06); }
.send-btn:active { transform: scale(.95); }
.send-btn:disabled { opacity: .35; filter: grayscale(.6); cursor: default; }
.send-btn[data-mode="stop"] { color: var(--white); background: linear-gradient(180deg, #3A4560, #252D42); box-shadow: 0 0 0 1px var(--line-3) inset; }
.mic-btn[aria-pressed="true"] { color: var(--rose); background: rgba(255, 122, 138, .1); }
.mic-btn[aria-pressed="true"] .icon { animation: breathe 1.2s var(--ease-in-out) infinite; }
.mic-btn[data-unavailable="true"] { color: var(--text-3); opacity: .6; }
.mic-btn { position: relative; }
.mic-btn[aria-pressed="true"]::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; pointer-events: none;
  box-shadow: 0 0 0 calc(1px + var(--level, 0) * 10px) rgba(255, 122, 138, calc(.15 + var(--level, 0) * .5)); transition: box-shadow 60ms linear; }
.speak-btn[aria-pressed="true"] { color: var(--ice); background: var(--accent-wash); }
[data-agent="speaking"] .speak-btn[aria-pressed="true"] .icon { animation: breathe 1.2s var(--ease-in-out) infinite; }
.thread-loading { display: flex; flex-direction: column; gap: 14px; padding-top: var(--sp-6); }
.thread-loading .skeleton { height: 16px; }
.command__hint { display: flex; gap: var(--sp-4); flex-wrap: wrap; padding: 0 var(--sp-5) var(--sp-3); font-size: .6875rem; color: var(--text-3); }
.command__hint kbd { font-family: var(--font-mono); font-size: .6875rem; padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line-2); color: var(--text-3); background: rgba(220,226,238,.03); }

/* ---------------------------------------------------------------- Intelligence Core host */
.core-host { position: relative; display: grid; place-items: center; }
.core-host canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block; outline: none; }
.core-fallback { position: relative; display: grid; place-items: center; width: 100%; height: 100%; pointer-events: none; }
.core-fallback .emblem { width: 38%; max-width: 220px; height: auto; filter: drop-shadow(0 20px 40px rgba(0,0,0,.6)); transition: filter var(--dur-4), opacity var(--dur-4); }
.core-fallback::before {
  content: ""; position: absolute; width: min(46%, 340px); aspect-ratio: 1; border-radius: 50%;
  border: 1px solid rgba(141, 220, 255, .14);
  box-shadow: 0 0 0 28px rgba(141, 220, 255, .025), 0 0 120px 10px rgba(84, 240, 232, .07);
}
.core-host[data-renderer="webgl"] .core-fallback { display: none; }
[data-agent="thinking"] .core-fallback .emblem,
[data-agent="responding"] .core-fallback .emblem { filter: drop-shadow(0 0 28px rgba(84, 240, 232, .35)); }
[data-agent="approval"] .core-fallback::before { border-color: rgba(242, 182, 90, .4); }
[data-agent="speaking"] .core-fallback .emblem, [data-agent="listening"] .core-fallback .emblem { filter: drop-shadow(0 0 26px rgba(141, 220, 255, .35)); }
[data-agent="error"] .core-fallback .emblem,
[data-agent="disconnected"] .core-fallback .emblem { opacity: .45; filter: grayscale(1); }

/* ---------------------------------------------------------------- HOME */
.home {
  display: grid; gap: var(--sp-6);
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-areas: "stage rail" "activity rail";
  align-items: start;
  max-width: 1480px; margin: 0 auto; padding: var(--sp-6) var(--sp-8) var(--sp-10);
}
.home__stage { grid-area: stage; position: relative; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.home__greeting { align-self: stretch; display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; }
.eyebrow { margin: 0 0 6px; font-size: var(--fs-xs); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--text-3); }
.home__greeting h2 { margin: 0; font-size: var(--fs-2xl); font-weight: 400; letter-spacing: -.025em; line-height: var(--lh-tight); color: var(--white); }
.home__greeting h2 em { font-style: normal; background: linear-gradient(90deg, var(--white), var(--ice) 60%, var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.core-host--hero { width: 100%; height: clamp(300px, 46vh, 520px); margin-top: calc(-1 * var(--sp-4)); }
.core-caption { display: flex; align-items: center; gap: var(--sp-3); margin-top: calc(-1 * var(--sp-6)); min-height: 28px; font-size: var(--fs-sm); color: var(--text-2); position: relative; z-index: 2; text-align: center; }
.core-caption strong { color: var(--white); font-weight: 560; letter-spacing: .01em; }
.home__command { width: min(760px, 100%); margin-top: var(--sp-5); }
.home__suggest { width: min(760px, 100%); margin-top: var(--sp-4); }
.home__setup { width: min(760px, 100%); margin-top: var(--sp-4); }
.home__rail { grid-area: rail; display: flex; flex-direction: column; gap: var(--sp-4); position: sticky; top: var(--sp-6); }
.home__activity { grid-area: activity; }
.integration-row { display: flex; align-items: center; gap: var(--sp-3); padding: 8px 0; font-size: var(--fs-sm); border-top: 1px solid var(--line); }
.integration-row:first-child { border-top: 0; }
.integration-row .name { flex: 1; color: var(--text-2); }
.integration-row .state { font-size: var(--fs-xs); color: var(--text-3); }

/* ---------------------------------------------------------------- CONVERSATION */
.convo { display: grid; grid-template-columns: 288px minmax(0, 1fr); height: 100%; }
.convo__list { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: rgba(8, 10, 16, .35); }
.convo__list-head { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-4) var(--sp-4) var(--sp-3) var(--sp-5); }
.convo__list-head h2 { margin: 0; font-size: var(--fs-xs); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--text-3); font-weight: 550; }
.convo__list-head .btn { margin-left: auto; }
.convo__items { flex: 1; overflow-y: auto; padding: 0 var(--sp-3) var(--sp-4); }
.convo-item {
  position: relative; display: block; width: 100%; text-align: left;
  padding: 10px var(--sp-3); margin: 1px 0; border-radius: var(--r-sm);
  border: 1px solid transparent; background: transparent; color: var(--text-2);
  transition: background var(--dur-1), color var(--dur-1);
}
.convo-item:hover { background: rgba(220, 226, 238, .045); color: var(--text); }
.convo-item[aria-current="true"] { background: var(--accent-wash); border-color: rgba(141, 220, 255, .14); color: var(--white); }
.convo-item__title { display: block; font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 26px; }
.convo-item__meta { display: block; font-size: .6875rem; color: var(--text-3); margin-top: 2px; }
.convo-item__del { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); opacity: 0; }
.convo-item:hover .convo-item__del, .convo-item:focus-within .convo-item__del { opacity: 1; }
.convo__main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.convo__head { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-6); border-bottom: 1px solid var(--line); min-height: 72px; }
.convo__head .convo__list-toggle { display: none; }
.core-host--compact { width: 52px; height: 52px; border-radius: 50%; flex: none; }
.core-host--compact .core-fallback .emblem { width: 70%; }
.core-host--compact .core-fallback::before { width: 90%; box-shadow: none; }
.convo__title { min-width: 0; flex: 1; }
.convo__title h2 { margin: 0; font-size: var(--fs-md); font-weight: 560; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo__title p { margin: 0; font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread { flex: 1; overflow-y: auto; padding: var(--sp-8) var(--sp-6) var(--sp-6); scroll-behavior: auto; }
.thread__inner { max-width: 780px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--sp-6); }
.convo__dock { padding: 0 var(--sp-6) var(--sp-5); }
.convo__dock .command { max-width: 780px; margin: 0 auto; }
.jump {
  position: absolute; left: 50%; bottom: 128px; transform: translate(-50%, 8px); opacity: 0; pointer-events: none;
  z-index: 5; transition: opacity var(--dur-2), transform var(--dur-2) var(--ease-out);
}
.jump.is-visible { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }

/* Messages */
.msg { display: flex; gap: var(--sp-3); animation: rise var(--dur-3) var(--ease-out); }
.msg--user { justify-content: flex-end; }
.msg--user .msg__bubble {
  max-width: min(78%, 620px); padding: 10px var(--sp-4); border-radius: 16px 16px 4px 16px;
  background: linear-gradient(180deg, rgba(56, 68, 96, .55), rgba(36, 44, 66, .55));
  border: 1px solid var(--line-2); color: var(--white); white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg__avatar { width: 30px; height: 30px; flex: none; margin-top: 2px; border-radius: 9px; display: grid; place-items: center; background: rgba(220,226,238,.04); border: 1px solid var(--line); }
.msg__avatar .emblem { width: 20px; height: 20px; }
.msg--assistant .msg__main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: var(--sp-3); }
.msg__actions { display: flex; gap: var(--sp-1); opacity: 0; transition: opacity var(--dur-2); }
.msg:hover .msg__actions, .msg:focus-within .msg__actions, .msg__actions.is-shown { opacity: 1; }
@media (hover: none) { .msg__actions, .convo-item__del { opacity: 1; } }
.msg__notice { font-size: var(--fs-xs); color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.msg__notice--warn { color: var(--amber); }
.caret:empty::after, .caret > :last-child:not(.codeblock):not(ul):not(ol)::after, .caret > ul > li:last-child::after, .caret > ol > li:last-child::after { content: ""; display: inline-block; width: 7px; height: 1.05em; margin-left: 3px; vertical-align: -0.15em; border-radius: 2px; background: var(--ice); box-shadow: 0 0 10px rgba(141,220,255,.8); animation: blink 1s steps(2, start) infinite; }
.pending-dots { display: inline-flex; gap: 5px; align-items: center; height: 24px; color: var(--text-3); font-size: var(--fs-sm); }
.pending-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--ice); opacity: .3; animation: dot 1.2s var(--ease-in-out) infinite; }
.pending-dots i:nth-child(2) { animation-delay: .15s; } .pending-dots i:nth-child(3) { animation-delay: .3s; }
.pending-dots span { margin-left: 6px; }

/* Markdown */
.md { color: var(--text); font-size: var(--fs-md); line-height: 1.7; overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md blockquote, .md pre, .md table { margin: 0 0 .85em; }
.md h1, .md h2, .md h3, .md h4 { margin: 1.2em 0 .5em; line-height: 1.3; font-weight: 600; letter-spacing: -.01em; }
.md h1 { font-size: 1.3em; } .md h2 { font-size: 1.15em; } .md h3, .md h4 { font-size: 1em; }
.md ul, .md ol { padding-left: 1.3em; } .md li + li { margin-top: .25em; } .md li::marker { color: var(--text-3); }
.md blockquote { padding: .2em 1em; border-left: 2px solid var(--accent-line); color: var(--text-2); }
.md hr { border: 0; border-top: 1px solid var(--line-2); margin: 1.2em 0; }
.md table { border-collapse: collapse; display: block; overflow-x: auto; font-size: var(--fs-sm); }
.md th, .md td { border: 1px solid var(--line-2); padding: 6px 10px; text-align: left; }
.md th { background: rgba(220,226,238,.04); font-weight: 600; }
.md a { color: var(--ice); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(141,220,255,.4); }
.codeblock { position: relative; margin: 0 0 .85em; border-radius: var(--r-md); border: 1px solid var(--line-2); background: rgba(5, 7, 12, .8); overflow: hidden; }
.codeblock__bar { display: flex; align-items: center; justify-content: space-between; height: 34px; padding: 0 var(--sp-2) 0 var(--sp-4); border-bottom: 1px solid var(--line); font-family: var(--font-mono); font-size: .6875rem; color: var(--text-3); text-transform: lowercase; }
.codeblock pre { margin: 0; padding: var(--sp-4); overflow-x: auto; font-family: var(--font-mono); font-size: .8125rem; line-height: 1.6; }
.codeblock pre code { padding: 0; background: none; font-size: inherit; }

/* Reasoning */
.reasoning { border-left: 1px solid var(--line-2); padding-left: var(--sp-4); }
.reasoning summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--text-3); user-select: none; border-radius: var(--r-xs); }
.reasoning summary::-webkit-details-marker { display: none; }
.reasoning summary:hover { color: var(--text-2); }
.reasoning summary .icon { width: 14px; height: 14px; transition: transform var(--dur-2); }
.reasoning[open] summary .chev { transform: rotate(90deg); }
.reasoning__body { margin-top: var(--sp-2); font-size: var(--fs-sm); color: var(--text-3); white-space: pre-wrap; max-height: 260px; overflow-y: auto; }

/* Tool activity */
.tool {
  border: 1px solid var(--line-2); border-radius: var(--r-md); background: rgba(12, 16, 28, .6);
  font-size: var(--fs-sm); overflow: hidden; transition: border-color var(--dur-2);
}
.tool__head { display: flex; align-items: center; gap: var(--sp-3); width: 100%; padding: 10px var(--sp-4); background: none; border: 0; text-align: left; color: inherit; }
.tool__glyph { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: rgba(141, 220, 255, .08); color: var(--ice); flex: none; }
.tool__glyph .icon { width: 14px; height: 14px; }
.tool__label { color: var(--text); font-weight: 500; }
.tool__args { color: var(--text-3); font-family: var(--font-mono); font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.tool__status { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--text-3); flex: none; }
.tool__result { display: none; margin: 0; padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--line); font-family: var(--font-mono); font-size: .75rem; color: var(--text-2); white-space: pre-wrap; max-height: 240px; overflow: auto; overflow-wrap: anywhere; }
.tool[data-open="true"] .tool__result { display: block; }
.tool__artifacts { display: grid; gap: var(--sp-3); padding: 0 var(--sp-4) var(--sp-4); }
.tool__artifacts:empty { display: none; }
.tool__progress { display: flex; align-items: center; gap: var(--sp-3); padding: 0 var(--sp-4) var(--sp-3); font-size: var(--fs-xs); color: var(--text-3); min-width: 0; }
.tool__progress:empty, .tool__links:empty { display: none; }
.tool__progress-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; font-family: var(--font-mono); }
.tool__bar { flex: none; width: 96px; height: 4px; border-radius: 2px; background: var(--line-2); overflow: hidden; }
.tool__bar i { display: block; height: 100%; background: var(--ice); transition: width .3s var(--ease-out, ease); }
.tool__links { display: flex; gap: var(--sp-2); padding: 0 var(--sp-4) var(--sp-4); }
.artifact { margin: 0; border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--surface-0); padding: var(--sp-3); min-width: 0; }
.artifact__title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px; font-size: var(--fs-sm); color: var(--text); font-weight: 520; margin-bottom: var(--sp-2); }
.artifact__meta { color: var(--text-3); font-weight: 400; font-size: var(--fs-xs); white-space: pre; }
.artifact__csv { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); color: var(--ice); text-decoration: none; padding: 2px 8px; border-radius: 6px; border: 1px solid var(--accent-line); }
.artifact__csv:hover { background: var(--accent-wash); }
.artifact__csv:focus-visible, .artifact__scroll:focus-visible { outline: none; box-shadow: var(--focus); }
.artifact__scroll { max-height: 280px; overflow: auto; }
.artifact__table { width: 100%; border-collapse: collapse; font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.artifact__table th { position: sticky; top: 0; background: var(--surface-solid); color: var(--text-2); font-weight: 500; text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.artifact__table td { padding: 5px 10px; border-bottom: 1px solid var(--line); color: var(--text-2); white-space: nowrap; }
.artifact__table .num { text-align: right; font-family: var(--font-mono); }
.chart__svg { width: 100%; height: auto; display: block; }
.chart__grid { stroke: var(--line-2); stroke-width: 1; }
.chart__axis { stroke: var(--line-3); stroke-width: 1; }
.chart__tick { fill: var(--text-3); font-size: 11px; font-family: var(--font-mono); }
.chart__s0 { fill: var(--ice); stroke: var(--ice); }
.chart__s1 { fill: var(--cyan); stroke: var(--cyan); }
.chart__s2 { fill: var(--amber); stroke: var(--amber); }
.chart__line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart__legend { display: flex; gap: var(--sp-3); font-size: var(--fs-xs); color: var(--text-3); margin-top: var(--sp-2); }
.chart__legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart__key { width: 10px; height: 10px; border-radius: 3px; display: inline-block; stroke: none; }
.tool[data-status="running"] { border-color: rgba(141, 220, 255, .3); }
.tool[data-status="running"] .tool__glyph { animation: breathe 1.4s var(--ease-in-out) infinite; }
.tool[data-status="ok"] .tool__status { color: var(--cyan); }
.tool[data-status="error"] .tool__glyph, .tool[data-status="invalid"] .tool__glyph, .tool[data-status="timeout"] .tool__glyph { background: rgba(255, 122, 138, .1); color: var(--rose); }
.tool[data-status="error"] .tool__status, .tool[data-status="invalid"] .tool__status, .tool[data-status="timeout"] .tool__status { color: var(--rose); }
.tool[data-status="denied"] .tool__status, .tool[data-status="cancelled"] .tool__status { color: var(--amber); }
.tool[data-status="approval"] { border-color: rgba(242, 182, 90, .4); }
.tool[data-status="approval"] .tool__glyph { background: rgba(242, 182, 90, .12); color: var(--amber); }
.spin { animation: spin 1s linear infinite; }

/* Approval gate */
.gate {
  border: 1px solid rgba(242, 182, 90, .38); border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(242, 182, 90, .09), rgba(242, 182, 90, .03));
  padding: var(--sp-4) var(--sp-5); box-shadow: 0 16px 40px -24px rgba(242, 182, 90, .5);
  animation: rise var(--dur-3) var(--ease-out);
}
.gate__head { display: flex; align-items: center; gap: var(--sp-2); color: var(--amber); font-size: var(--fs-xs); letter-spacing: var(--tracking-caps); text-transform: uppercase; font-weight: 600; }
.gate__title { margin: var(--sp-2) 0 var(--sp-1); font-size: var(--fs-md); color: var(--white); font-weight: 560; }
.gate__desc { margin: 0 0 var(--sp-3); font-size: var(--fs-sm); color: var(--text-2); }
.gate__args { margin: 0 0 var(--sp-4); padding: var(--sp-3); border-radius: var(--r-sm); background: rgba(5, 7, 12, .6); border: 1px solid var(--line); font-family: var(--font-mono); font-size: .75rem; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.gate__actions { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.gate__timer { margin-left: auto; font-size: var(--fs-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }
.gate[data-resolved] { opacity: .75; }
.gate[data-resolved] .gate__actions .btn, .gate[data-resolved] .gate__args { display: none; }
.gate[data-resolved] .gate__timer { margin-left: 0; }

/* Error card */
.error-card { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); border: 1px solid rgba(255, 122, 138, .3); background: rgba(255, 122, 138, .06); font-size: var(--fs-sm); }
.error-card .icon { color: var(--rose); margin-top: 2px; }
.error-card__body { flex: 1; min-width: 0; }
.error-card__title { color: var(--white); font-weight: 560; }
.error-card__msg { color: var(--text-2); margin-top: 2px; overflow-wrap: anywhere; }
.error-card .btn { margin-top: var(--sp-3); }

/* Thread empty state */
.thread-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--sp-3); padding: 12vh var(--sp-4) var(--sp-8); color: var(--text-3); }
.thread-empty .emblem { width: 56px; height: 56px; opacity: .9; }
.thread-empty h3 { margin: var(--sp-2) 0 0; font-size: var(--fs-xl); font-weight: 450; color: var(--white); letter-spacing: -.01em; }
.thread-empty p { margin: 0 0 var(--sp-3); max-width: 46ch; font-size: var(--fs-sm); }

/* ---------------------------------------------------------------- MODULE PAGES */
.page { max-width: 1080px; margin: 0 auto; padding: var(--sp-8) var(--sp-8) var(--sp-12); }
.page > :not(.page__head) + * { margin-top: var(--sp-4); }
.page__head { display: flex; align-items: flex-start; gap: var(--sp-4); margin-bottom: var(--sp-6); flex-wrap: wrap; }
.page__icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: var(--r-md); background: linear-gradient(180deg, rgba(141,220,255,.12), rgba(141,220,255,.03)); border: 1px solid rgba(141,220,255,.18); color: var(--ice); flex: none; }
.page__icon .icon { width: 22px; height: 22px; }
.page__titles { flex: 1; min-width: 220px; }
.page__titles h2 { margin: 0; font-size: var(--fs-xl); font-weight: 520; letter-spacing: -.015em; }
.page__titles p { margin: 4px 0 0; color: var(--text-3); font-size: var(--fs-sm); max-width: 70ch; }
.status-tag { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: var(--r-pill); font-size: .6875rem; letter-spacing: .06em; text-transform: uppercase; border: 1px solid var(--line-2); color: var(--text-3); }
.status-tag--on { color: var(--cyan); border-color: rgba(84, 240, 232, .3); background: rgba(84, 240, 232, .05); }
.status-tag--off { color: var(--text-3); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px var(--sp-6); font-size: var(--fs-sm); margin: 0; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; color: var(--text); overflow-wrap: anywhere; min-width: 0; }
.field { display: flex; gap: var(--sp-2); }
.input { flex: 1; min-width: 0; height: 38px; padding: 0 var(--sp-3); border-radius: var(--r-sm); border: 1px solid var(--line-2); background: rgba(5, 7, 12, .5); color: var(--text); font-size: var(--fs-sm); }
.input:focus-visible { border-color: var(--accent-line); box-shadow: 0 0 0 3px rgba(141,220,255,.12); }
.segmented { display: inline-flex; flex-wrap: wrap; max-width: 100%; padding: 3px; border-radius: var(--r-sm); background: rgba(5,7,12,.5); border: 1px solid var(--line-2); }
.segmented button { height: 28px; padding: 0 var(--sp-3); border: 0; border-radius: 6px; background: transparent; color: var(--text-3); font-size: var(--fs-xs); white-space: nowrap; }
.segmented button[aria-pressed="true"] { background: var(--surface-3); color: var(--white); }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--sp-3); }
.tool-card { padding: var(--sp-4); border-radius: var(--r-md); border: 1px solid var(--line); background: rgba(12,16,28,.5); }
.tool-card h4 { margin: 0 0 4px; font-size: var(--fs-sm); font-weight: 560; display: flex; align-items: center; gap: var(--sp-2); }
.tool-card p { margin: 0; font-size: var(--fs-xs); color: var(--text-3); }
.tool-card .mono { color: var(--text-3); font-size: .6875rem; }

/* ---------------------------------------------------------------- overlays */
.toasts { position: fixed; right: var(--sp-5); bottom: var(--sp-5); z-index: var(--z-toast); display: flex; flex-direction: column; gap: var(--sp-2); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: var(--sp-3);
  width: min(380px, calc(100vw - 32px)); padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md); border: 1px solid var(--line-2); background: rgba(15, 20, 36, .94);
  box-shadow: var(--shadow-2); font-size: var(--fs-sm); color: var(--text-2);
  animation: toast-in var(--dur-3) var(--ease-out);
}
.toast.is-leaving { animation: toast-out var(--dur-2) var(--ease-std) forwards; }
.toast strong { color: var(--white); font-weight: 560; display: block; }
.toast .icon { margin-top: 2px; color: var(--ice); }
.toast--warn .icon { color: var(--amber); } .toast--danger .icon { color: var(--rose); }
.toast .icon-btn { margin: -6px -8px -6px auto; }

dialog.modal {
  width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0;
  border-radius: var(--r-lg); border: 1px solid var(--line-2); background: var(--surface-solid); color: var(--text);
  box-shadow: 0 40px 120px -20px rgba(0,0,0,.8);
}
dialog.modal::backdrop { background: rgba(4, 6, 10, .6); backdrop-filter: blur(4px); }
dialog.modal[open] { animation: rise var(--dur-3) var(--ease-out); }
.modal__body { padding: var(--sp-6); }
.modal__body h3 { margin: 0 0 var(--sp-2); font-size: var(--fs-lg); font-weight: 560; }
.modal__body p { margin: 0; color: var(--text-2); font-size: var(--fs-sm); }
.modal__actions { display: flex; justify-content: flex-end; gap: var(--sp-2); padding: 0 var(--sp-6) var(--sp-6); }

/* Boot reveal */
.boot { position: fixed; inset: 0; z-index: var(--z-boot); display: grid; place-items: center; background: var(--obsidian); transition: opacity var(--dur-4) var(--ease-std), visibility 0s linear var(--dur-4); }
.boot.is-done { opacity: 0; visibility: hidden; }
.boot__mark { display: flex; flex-direction: column; align-items: center; gap: var(--sp-6); }
.boot__mark .emblem { width: 92px; height: 92px; }
.boot__mark .wordmark { height: 16px; width: 96px; opacity: 0; animation: fade-up var(--dur-5) var(--ease-out) .55s forwards; }
.boot .draw { stroke-dasharray: 160; stroke-dashoffset: 160; animation: draw 1.1s var(--ease-in-out) forwards; }
.boot .fill-in { opacity: 0; animation: fade var(--dur-4) var(--ease-out) .5s forwards; }
.boot .core-dot { transform-origin: 32px 39px; transform: scale(0); animation: pop var(--dur-4) var(--ease-out) .85s forwards; }

/* ---------------------------------------------------------------- keyframes */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fade { to { opacity: 1; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop { 60% { transform: scale(1.25); } to { transform: scale(1); } }
@keyframes blink { to { visibility: hidden; } }
@keyframes dot { 0%, 100% { opacity: .25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-2px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes ring-pulse { from { transform: scale(.6); opacity: .9; } to { transform: scale(1.8); opacity: 0; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1200px) {
  .home { grid-template-columns: minmax(0, 1fr); grid-template-areas: "stage" "rail" "activity"; padding: var(--sp-5) var(--sp-6) var(--sp-10); }
  .home__rail { position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}
@media (max-width: 900px) {
  :root { --topbar-h: 56px; }
  .app, .app[data-sidebar="collapsed"] { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw);
    transform: translateX(-102%); transition: transform var(--dur-3) var(--ease-out);
    background: rgba(10, 13, 22, .97);
  }
  .app[data-drawer="open"] .sidebar { transform: none; box-shadow: 30px 0 80px rgba(0,0,0,.6); }
  .app[data-sidebar="collapsed"] .wordmark, .app[data-sidebar="collapsed"] .nav__text, .app[data-sidebar="collapsed"] .nav__tag,
  .app[data-sidebar="collapsed"] .nav__label, .app[data-sidebar="collapsed"] .sidebar__foot .foot-text { opacity: 1; width: auto; pointer-events: auto; }
  .app[data-sidebar="collapsed"] .nav__item { justify-content: flex-start; padding: 0 var(--sp-3); }
  .sidebar__collapse { display: none !important; }
  .scrim { display: block; position: fixed; inset: 0; z-index: var(--z-scrim); background: rgba(4, 6, 10, .55); opacity: 0; pointer-events: none; transition: opacity var(--dur-3); }
  .app[data-drawer="open"] .scrim { opacity: 1; pointer-events: auto; }
  .topbar { padding: 0 var(--sp-4); }
  .topbar .topbar__menu { display: inline-grid; margin-left: -6px; }
  .topbar__clock, .conn-pill .conn-label { display: none; }
  .convo { grid-template-columns: minmax(0, 1fr); }
  .convo__list { position: absolute; inset: 0 auto 0 0; width: min(320px, 88vw); z-index: 20; background: rgba(10, 13, 22, .98); transform: translateX(-102%); transition: transform var(--dur-3) var(--ease-out); }
  .convo[data-list="open"] .convo__list { transform: none; box-shadow: 30px 0 80px rgba(0,0,0,.6); }
  .convo__head .convo__list-toggle { display: inline-grid; }
  .convo__head { padding: var(--sp-2) var(--sp-4); min-height: 64px; }
  .thread { padding: var(--sp-5) var(--sp-4) var(--sp-4); }
  .convo__dock { padding: 0 var(--sp-3) max(var(--sp-3), env(safe-area-inset-bottom)); }
  .page { padding: var(--sp-5) var(--sp-4) var(--sp-10); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .jump { bottom: 112px; }
}
@media (max-width: 640px) {
  .home { padding: var(--sp-4) var(--sp-4) var(--sp-8); gap: var(--sp-4); }
  .home__greeting h2 { font-size: 1.6rem; }
  .core-host--hero { height: clamp(220px, 34vh, 300px); }
  .core-caption { margin-top: calc(-1 * var(--sp-3)); flex-wrap: wrap; justify-content: center; }
  .command__row { padding-left: var(--sp-4); }
  .command__hint { display: none; }
  .home__rail { grid-template-columns: minmax(0, 1fr); }
  .agent-pill .agent-pill__detail { display: none; }
  .msg--user .msg__bubble { max-width: 88%; }
  .msg__avatar { display: none; }
  .toasts { left: var(--sp-4); right: var(--sp-4); bottom: var(--sp-4); }
}

/* ---------------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
  .caret *::after, .caret::after { animation: none; }
}
:root[data-motion="reduced"] *, :root[data-motion="reduced"] *::before, :root[data-motion="reduced"] *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
.note-body { flex-basis: 100%; margin: 8px 0 4px 40px; padding: 12px 16px; border-radius: var(--r-md); background: rgba(5, 7, 12, .5); border: 1px solid var(--line); font-size: var(--fs-sm); max-height: 360px; overflow: auto; }
.gate__warning { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 var(--sp-3); padding: 10px 12px; border-radius: var(--r-sm);
  background: rgba(242, 182, 90, .12); border: 1px solid rgba(242, 182, 90, .4); color: var(--white); font-size: var(--fs-sm); }
.gate__warning .icon { color: var(--amber); margin-top: 2px; }
.tool[data-status="integration_error"] .tool__glyph, .tool[data-status="unknown"] .tool__glyph { background: rgba(242, 182, 90, .12); color: var(--amber); }
.tool[data-status="integration_error"] .tool__status, .tool[data-status="unknown"] .tool__status { color: var(--amber); }
.exec-tag--succeeded { color: var(--cyan); border-color: rgba(84, 240, 232, .3); }
.exec-tag--failed { color: var(--rose); border-color: rgba(255, 122, 138, .35); }
.exec-tag--unknown, .exec-tag--denied, .exec-tag--awaiting_approval { color: var(--amber); border-color: rgba(242, 182, 90, .35); }

/* ---- sign-in page ---- */
.login-page { min-height: 100vh; display: grid; place-items: center; background: var(--bg); color: var(--text); font-family: var(--font-sans); padding: 16px; }
.login { position: relative; z-index: 1; width: min(380px, 100%); display: grid; gap: var(--sp-3); padding: var(--sp-6); border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--surface-1); }
.login__emblem { width: 44px; height: 44px; }
.login h1 { margin: 0; font-size: var(--fs-xl); font-weight: 600; }
.login__lead { margin: 0; color: var(--text-2); font-size: var(--fs-sm); }
.login__form { display: grid; gap: var(--sp-2); }
.login__form label { font-size: var(--fs-xs); color: var(--text-3); }
.login__error { margin: 0; color: var(--rose); font-size: var(--fs-sm); }
.login__setup { font-size: var(--fs-sm); color: var(--text-2); }
.login__setup pre { background: rgba(5, 7, 12, .6); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: var(--sp-3); overflow-x: auto; }
