/* ============================================================================
   EION frontend — app shell styling
   Aesthetic: honest "calm product UI" (ChatGPT-adjacent). Native CSS, no build.
   Theming: CSS custom properties swapped by [data-theme]. One theme locks at a
   time (Page Theme Lock). Three themes: light (milk white), dark, navy+gold.
   Shape rule: inputs 8px, panels/buttons 12px, big surfaces 18px, pills 999px.
   Motion: calm chrome; cinematic only inside the boot + Live/Jarvis moments.
   Zero em-dashes anywhere in visible copy.
   ============================================================================ */

/* ---------- design tokens (defaults = light / milk white) ---------- */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;

  --r-xs: 6px; --r-sm: 8px; --r-md: 12px; --r-lg: 18px; --r-pill: 999px;
  --ease: cubic-bezier(.16,1,.3,1);
  --shadow-1: 0 1px 2px rgba(16,20,28,.05), 0 1px 3px rgba(16,20,28,.06);
  --shadow-2: 0 8px 24px rgba(16,20,28,.10);
  --shadow-pop: 0 12px 40px rgba(16,20,28,.16);
  --side-w: 280px;
}

/* LIGHT — milk white, near-black ink, single nautical-blue accent */
[data-theme="light"] {
  --bg: #fdfdfa;
  --bg-sub: #f8f7f2;
  --surface: #fdfdfa;
  --surface-2: #f3f2ec;
  --surface-3: #e9e8e0;
  --line: #e8e7e0;
  --line-strong: #d8d6cc;
  --ink: #14171c;
  --ink-2: #565d68;
  --ink-3: #8b929c;
  --accent: #1f6feb;
  --accent-ink: #ffffff;
  --accent-weak: rgba(31,111,235,.10);
  --danger: #c0392b;
  --live: #17a673;
  --logo: #14171c;
  --scrim: rgba(20,24,30,.32);
  --grid: rgba(20,24,30,.05);
  color-scheme: light;
}

/* DARK — off-black depth, same blue brightened */
[data-theme="dark"] {
  --bg: #0c0e12;
  --bg-sub: #101319;
  --surface: #141821;
  --surface-2: #1b2029;
  --surface-3: #232935;
  --line: #262c37;
  --line-strong: #333b48;
  --ink: #eef1f6;
  --ink-2: #a4adba;
  --ink-3: #6f7987;
  --accent: #4f8dff;
  --accent-ink: #06080c;
  --accent-weak: rgba(79,141,255,.14);
  --danger: #ff6b5e;
  --live: #2fd39a;
  --logo: #eef1f6;
  --scrim: rgba(0,0,0,.6);
  --grid: rgba(255,255,255,.04);
  color-scheme: dark;
}

/* NAVY + GOLD — deep navy, gold accent (accent locked to gold across the theme) */
[data-theme="navy"] {
  --bg: #0a1428;
  --bg-sub: #0d1930;
  --surface: #10203f;
  --surface-2: #16294d;
  --surface-3: #1d345e;
  --line: #1f3a68;
  --line-strong: #2b4a80;
  --ink: #f4f1e6;
  --ink-2: #b8c2d6;
  --ink-3: #7f8da8;
  --accent: #d9b25a;
  --accent-ink: #0a1428;
  --accent-weak: rgba(217,178,90,.14);
  --danger: #ef8f6a;
  --live: #d9b25a;
  --logo: #d9b25a;
  --scrim: rgba(3,8,18,.62);
  --grid: rgba(217,178,90,.06);
  color-scheme: dark;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
::selection { background: var(--accent-weak); }

/* ---------- shared logo (steering helm, currentColor) ---------- */
.logo { display: inline-flex; color: var(--logo); width: 30px; height: 30px; }
.logo svg { width: 100%; height: 100%; display: block; }
.logo--sm { width: 34px; height: 34px; }
.logo--brand { width: 28px; height: 28px; }
.logo--xl { width: 64px; height: 64px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--r-md);
  font-weight: 560; font-size: 14px; letter-spacing: -.01em;
  transition: background .18s var(--ease), transform .12s var(--ease), border-color .18s;
  border: 1px solid transparent;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { filter: brightness(1.06); }
.btn--ghost { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { background: var(--surface-3); }
.btn--block { width: 100%; }
.btn--new {
  flex: 1; height: 40px; background: var(--surface-2); border: 1px solid var(--line);
  color: var(--ink); justify-content: flex-start; padding: 0 12px; border-radius: var(--r-md);
}
.btn--new:hover { background: var(--surface-3); }

.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px;
  border-radius: var(--r-pill); color: var(--ink-2);
  transition: background .16s var(--ease), color .16s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn i { font-size: 20px; }

/* ============================================================
   BOOT / EI WELCOME
   ============================================================ */
.boot {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: radial-gradient(120% 120% at 50% 40%, var(--bg-sub), var(--bg));
  transition: opacity .6s var(--ease), visibility .6s;
}
.boot.is-gone { opacity: 0; visibility: hidden; pointer-events: none; }
.boot__canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.boot__center { position: relative; text-align: center; display: grid; gap: 14px; justify-items: center; }
.boot__mark { color: var(--logo); width: 88px; height: 88px; animation: rise .8s var(--ease) both; }
.boot__mark svg { width: 100%; height: 100%; }
.boot__word { font-size: 44px; font-weight: 700; letter-spacing: -.03em; animation: rise .8s .08s var(--ease) both; }
.boot__ei { color: var(--accent); position: relative; }
.boot__ei::after {
  content: ""; position: absolute; left: -6px; right: -6px; bottom: -4px; height: 3px;
  background: var(--accent); border-radius: 3px; transform: scaleX(0); transform-origin: left;
  animation: underline 1s .5s var(--ease) forwards;
}
.boot__on { color: var(--ink); }
.boot__tag { margin: 0; color: var(--ink-2); font-size: 14px; letter-spacing: .01em; animation: rise .8s .16s var(--ease) both; }
.boot__bar { width: 180px; height: 3px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.boot__bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s linear; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes underline { to { transform: scaleX(1); } }

/* ============================================================
   AUTH
   ============================================================ */
.scrim {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center;
  background: var(--scrim); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  padding: 20px; animation: fade .2s var(--ease);
}
.scrim--right { place-items: stretch; justify-content: flex-end; }
@keyframes fade { from { opacity: 0; } }

.auth {
  position: relative; width: 100%; max-width: 420px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-lg); padding: 30px 30px 24px;
  box-shadow: var(--shadow-pop); animation: pop .28s var(--ease); max-height: 92vh; overflow: auto;
}
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.auth__close { position: absolute; top: 12px; right: 12px; }
.auth__brand { display: flex; justify-content: center; margin-bottom: 8px; }
.auth__title { margin: 4px 0 4px; font-size: 24px; letter-spacing: -.02em; text-align: center; }
.auth__sub { margin: 0 0 18px; color: var(--ink-2); text-align: center; font-size: 14px; }

.seg { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: var(--r-md); margin-bottom: 18px; }
.seg__opt { flex: 1; height: 34px; border-radius: var(--r-sm); color: var(--ink-2); font-weight: 540; transition: .16s var(--ease); }
.seg__opt.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

.auth__providers { display: grid; gap: 8px; }
.prov {
  display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface);
  color: var(--ink); font-weight: 520; transition: background .16s var(--ease), border-color .16s;
}
.prov:hover { background: var(--surface-2); border-color: var(--line-strong); }
.prov i { font-size: 20px; color: var(--ink-2); }

.auth__or { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: 12px; margin: 18px 0; }
.auth__or::before, .auth__or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field__label { font-size: 13px; font-weight: 540; color: var(--ink-2); }
.field__input {
  height: 44px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface); transition: border-color .16s, box-shadow .16s;
}
.field__input::placeholder { color: var(--ink-3); }
.field__input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.field__hint { font-size: 12px; color: var(--ink-3); }
.field__error { font-size: 12px; color: var(--danger); }
.auth__fineprint { margin: 14px 0 0; text-align: center; font-size: 12.5px; color: var(--ink-3); }

/* ============================================================
   APP SHELL
   ============================================================ */
.app { display: grid; grid-template-columns: var(--side-w) 1fr; height: 100dvh; overflow: hidden; }
.app.side-collapsed { grid-template-columns: 0 1fr; }

/* ---------- sidebar ---------- */
.side {
  display: flex; flex-direction: column; min-width: 0;
  background: var(--bg-sub); border-right: 1px solid var(--line); height: 100dvh;
  transition: transform .26s var(--ease);
}
.app.side-collapsed .side { transform: translateX(-100%); }
.side__top { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px; }
.side__collapse { flex: none; }

.side__search {
  position: relative; display: flex; align-items: center; gap: 8px; margin: 4px 12px 8px;
  padding: 0 10px; height: 38px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.side__search i { color: var(--ink-3); font-size: 17px; }
.side__search input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: none; }
.side__search input::placeholder { color: var(--ink-3); }
.side__search kbd {
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-3);
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; background: var(--surface-2);
}

.side__scroll { flex: 1; overflow-y: auto; padding: 4px 8px 8px; scrollbar-width: thin; }
.nav-group { margin-bottom: 14px; }
.nav-group__title {
  display: flex; align-items: center; justify-content: space-between;
  margin: 8px 8px 4px; font-size: 11.5px; font-weight: 640; letter-spacing: .04em;
  text-transform: uppercase; color: var(--ink-3);
}
.nav-group__add { width: 24px; height: 24px; }
.nav-group__add i { font-size: 14px; }

.nav-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--ink-2); font-size: 14px; font-weight: 500; cursor: pointer; transition: background .14s var(--ease), color .14s;
  width: 100%; text-align: left; min-width: 0;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.is-active { background: var(--accent-weak); color: var(--ink); }
.nav-item i { font-size: 18px; flex: none; color: var(--ink-3); }
.nav-item.is-active i { color: var(--accent); }
.nav-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item__badge { margin-left: auto; font-size: 11px; color: var(--ink-3); font-family: var(--font-mono); }

/* jarvis tab */
.jarvis-tab {
  display: flex; align-items: center; gap: 12px; margin: 8px 12px; padding: 10px 12px;
  border-radius: var(--r-md); border: 1px solid var(--line);
  background: linear-gradient(135deg, var(--accent-weak), transparent 70%), var(--surface);
  text-align: left; transition: border-color .18s var(--ease), transform .12s var(--ease);
}
.jarvis-tab:hover { border-color: var(--accent); transform: translateY(-1px); }
.jarvis-tab:active { transform: translateY(0); }
.jarvis-tab__orb { position: relative; width: 30px; height: 30px; flex: none; display: grid; place-items: center; }
.jarvis-tab__core { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.jarvis-tab__ring {
  position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--accent);
  opacity: .5; animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse { 0% { transform: scale(.6); opacity: .7; } 100% { transform: scale(1.15); opacity: 0; } }
.jarvis-tab__body { display: grid; min-width: 0; }
.jarvis-tab__name { font-weight: 620; font-size: 13.5px; letter-spacing: -.01em; }
.jarvis-tab__hint { font-size: 11.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jarvis-tab__wave { margin-left: auto; color: var(--accent); font-size: 18px; }

/* budget meter */
.budget { margin: 0 12px 12px; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.budget__head { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }
.budget__head span:last-child { font-family: var(--font-mono); color: var(--ink); }
.budget__bar { height: 6px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.budget__bar span { display: block; height: 100%; width: 70%; background: var(--live); transition: width .4s var(--ease), background .3s; border-radius: inherit; }
.budget.is-low .budget__bar span { background: var(--danger); }

/* reduced-motion: stop perpetual pulses */
@media (prefers-reduced-motion: reduce) {
  .jarvis-tab__ring { animation: none; }
  * { scroll-behavior: auto !important; }
}

/* ---------- main ---------- */
.main { display: flex; flex-direction: column; min-width: 0; height: 100dvh; background: var(--bg); }

.topbar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  height: 60px; padding: 0 14px; border-bottom: 1px solid var(--line); background: var(--bg);
}
.topbar__left { display: flex; align-items: center; gap: 10px; }
.wordmark { font-weight: 700; letter-spacing: -.02em; font-size: 17px; }
.topbar__center { display: flex; justify-content: center; }
.topbar__right { display: flex; align-items: center; gap: 2px; justify-content: flex-end; }

.model-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px;
  border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line);
  font-weight: 560; font-size: 13.5px; transition: background .16s var(--ease);
}
.model-pill:hover { background: var(--surface-3); }
.model-pill i { color: var(--ink-3); font-size: 14px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.dot--live { background: var(--live); box-shadow: 0 0 0 3px var(--accent-weak); }

.profile { margin-left: 4px; }
.profile__avatar {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-pill);
  background: var(--accent); color: var(--accent-ink); font-weight: 680; font-size: 14px; flex: none;
}

/* ---------- intelligence badge (topbar, futuristic "processing" indicator) ---------- */
.intel {
  position: relative; display: flex; align-items: center; gap: 6px; height: 22px; margin-left: 6px; flex: none;
}
.intel__ring {
  position: relative; display: grid; place-items: center; width: 22px; height: 22px; flex: none; border-radius: 50%;
  border: 1.5px solid var(--accent); border-top-color: transparent; border-left-color: transparent;
  opacity: .55;
}
.intel__core {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 6px var(--accent), 0 0 14px var(--accent-weak);
  transition: background .2s, box-shadow .2s;
}
.intel__word {
  font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--accent);
  animation: intel-word-blink 2.2s ease-in-out infinite;
}
.intel.is-busy .intel__ring { animation: intel-spin 900ms linear infinite; opacity: 1; }
.intel.is-busy .intel__core { animation: intel-pulse 900ms ease-in-out infinite; background: var(--live); }
.intel.is-busy .intel__word { color: var(--live); animation: intel-word-blink 700ms ease-in-out infinite; }
@keyframes intel-spin { to { transform: rotate(360deg); } }
@keyframes intel-pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.6); opacity: .5; } }
@keyframes intel-word-blink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.icon-btn--live { color: var(--accent); }
.icon-btn--live i { text-shadow: 0 0 10px var(--accent-weak); }

/* ---------- sidebar bottom-left: account + settings ---------- */
.side__foot { margin: 4px 12px 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.side__account {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line); transition: background .16s var(--ease), border-color .16s;
}
.side__account:hover { background: var(--surface-2); border-color: var(--line-strong); }
.side__account-body { display: grid; min-width: 0; flex: 1; text-align: left; }
.side__account-name { font-size: 13.5px; font-weight: 620; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side__account-role { font-size: 11.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side__account-gear { font-size: 17px; color: var(--ink-3); flex: none; }
.side__account:hover .side__account-gear { color: var(--ink); }

/* ---------- stream ---------- */
.stream { flex: 1; overflow-y: auto; scroll-behavior: smooth; }
.stream__inner { max-width: 780px; margin: 0 auto; padding: 24px 20px 40px; display: grid; gap: 22px; }

.msg { display: flex; animation: rise .4s var(--ease) both; }
.msg--user { justify-content: flex-end; }
.msg__body { min-width: 0; flex: 1; }
.msg__body--user { flex: none; max-width: 80%; background: var(--surface-2); border-radius: 20px; padding: 10px 16px; }
.msg__text { font-size: 15px; line-height: 1.62; color: var(--ink); white-space: pre-wrap; word-wrap: break-word; }
.msg__text code { font-family: var(--font-mono); font-size: 13px; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.msg--eion .msg__text { color: var(--ink); }
.msg__speak {
  margin-top: 6px; width: 30px; height: 30px; color: var(--ink-3);
  opacity: 0; transition: opacity .14s var(--ease), color .14s;
}
.msg--eion:hover .msg__speak, .msg__speak.is-active { opacity: 1; }
.msg__speak.is-active { color: var(--accent); }
.msg__speak i { font-size: 17px; }
.typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .18s; }
.typing span:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 0%,60%,100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }

/* welcome */
.welcome { max-width: 760px; margin: 0 auto; padding: 6vh 20px 30px; text-align: center; display: grid; justify-items: center; gap: 12px; }
.welcome__logo { animation: rise .6s var(--ease) both; }

/* ---------- post-login animated EI mark ---------- */
.ei-mark {
  position: relative; width: 120px; height: 120px; display: grid; place-items: center;
  margin-bottom: 4px; animation: rise .7s var(--ease) both;
}
.ei-mark__ring {
  position: absolute; border-radius: 50%; border: 1px solid var(--accent); opacity: .35;
}
.ei-mark__ring--1 { inset: 8px; animation: ei-spin 7s linear infinite; }
.ei-mark__ring--2 { inset: 0; border-style: dashed; opacity: .22; animation: ei-spin 14s linear infinite reverse; }
@keyframes ei-spin { to { transform: rotate(360deg); } }
.ei-mark__glow {
  position: absolute; inset: 22px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-weak), transparent 70%);
  animation: ei-breathe 3.2s ease-in-out infinite;
}
@keyframes ei-breathe { 0%, 100% { opacity: .6; transform: scale(.94); } 50% { opacity: 1; transform: scale(1.06); } }
.ei-mark__word { position: relative; font-size: 30px; font-weight: 720; letter-spacing: -.02em; }
.ei-mark__ei { color: var(--accent); text-shadow: 0 0 18px var(--accent-weak); }
.ei-mark__on { color: var(--ink); }
.ei-mark__tag {
  margin: 0 0 6px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 620; animation: rise .7s .08s var(--ease) both;
}
@media (prefers-reduced-motion: reduce) {
  .ei-mark__ring--1, .ei-mark__ring--2, .ei-mark__glow { animation: none; }
}
.welcome__title { margin: 6px 0 0; font-size: 30px; letter-spacing: -.03em; font-weight: 680; }
.welcome__title span { color: var(--accent); }
.welcome__sub { margin: 0; color: var(--ink-2); font-size: 15px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 8px; }
.chip {
  padding: 8px 14px; border-radius: var(--r-pill); border: 1px solid var(--line);
  background: var(--surface); font-size: 13.5px; color: var(--ink-2); transition: .16s var(--ease);
}
.chip:hover { border-color: var(--accent); color: var(--ink); transform: translateY(-1px); }

.cap-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; margin-top: 18px; width: 100%; text-align: left; }
@media (min-width: 720px) { .cap-grid { grid-template-columns: repeat(4, minmax(0,1fr)); } }
.cap {
  padding: 14px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface);
  display: grid; gap: 6px; transition: .18s var(--ease); align-content: start;
}
.cap:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: var(--shadow-1); }
.cap i { font-size: 22px; color: var(--accent); }
.cap__t { font-weight: 620; font-size: 14px; }
.cap__d { font-size: 12.5px; color: var(--ink-3); line-height: 1.45; }

/* ---------- composer ---------- */
.composer-wrap { padding: 6px 16px 12px; }
.composer {
  position: relative; max-width: 780px; margin: 0 auto; background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-1);
  transition: border-color .16s, box-shadow .16s;
}
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.composer__row { display: flex; align-items: flex-end; gap: 6px; padding: 8px 8px 8px 6px; }
.composer__input {
  flex: 1; min-width: 0; border: 0; outline: none; background: none; resize: none;
  max-height: 200px; padding: 8px 4px; font-size: 15px; line-height: 1.5;
}
.composer__input::placeholder { color: var(--ink-3); }
.composer__plus, .composer__mic { flex: none; align-self: flex-end; margin-bottom: 1px; }
.composer__send {
  flex: none; align-self: flex-end; width: 38px; height: 38px; border-radius: var(--r-pill);
  background: var(--accent); color: var(--accent-ink); display: grid; place-items: center;
  transition: transform .12s var(--ease), filter .16s, opacity .16s;
}
.composer__send:hover { filter: brightness(1.08); }
.composer__send:active { transform: scale(.94); }
.composer__send:disabled { opacity: .4; cursor: not-allowed; }
.composer__send i { font-size: 19px; }
.composer__foot { max-width: 780px; margin: 8px auto 0; text-align: center; font-size: 12px; color: var(--ink-3); }

.plusmenu {
  position: absolute; bottom: calc(100% + 8px); left: 4px; min-width: 220px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-pop); padding: 6px; z-index: 20; animation: pop .18s var(--ease);
}
.plusmenu__item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px;
  border-radius: var(--r-sm); font-size: 14px; color: var(--ink); transition: background .14s;
}
.plusmenu__item:hover { background: var(--surface-2); }
.plusmenu__item i { font-size: 18px; color: var(--ink-2); }

/* ============================================================
   LIVE / JARVIS OVERLAY
   ============================================================ */
.live { position: fixed; inset: 0; z-index: 90; background: #05070d; color: #eaf2ff; overflow: hidden; animation: fade .3s var(--ease); }
.live__canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.live__scan { position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(120,180,255,.035) 0 1px, transparent 1px 3px); mix-blend-mode: screen; }
.live__close { position: absolute; top: 18px; right: 18px; color: #9fb6d6; z-index: 3; }
.live__close:hover { background: rgba(255,255,255,.08); color: #fff; }
.live__hud { position: absolute; top: 22px; left: 24px; z-index: 3; }
.live__title { font-weight: 720; letter-spacing: .14em; font-size: 14px; }
.live__title span { color: #d9b25a; }
.live__status { font-family: var(--font-mono); font-size: 12px; color: #7fa7d6; margin-top: 4px; letter-spacing: .08em; }
.live__caption {
  position: absolute; left: 0; right: 0; bottom: 128px; text-align: center; z-index: 3;
  font-size: 22px; font-weight: 560; letter-spacing: -.01em; padding: 0 10vw; line-height: 1.4;
  text-shadow: 0 2px 30px rgba(30,90,190,.5);
}
.live__controls { position: absolute; left: 0; right: 0; bottom: 44px; z-index: 3; display: flex; gap: 12px; justify-content: center; }
.live__btn {
  display: inline-flex; align-items: center; gap: 10px; height: 52px; padding: 0 26px;
  border-radius: var(--r-pill); background: rgba(120,170,255,.14); border: 1px solid rgba(150,190,255,.32);
  color: #eaf2ff; font-weight: 580; backdrop-filter: blur(10px); transition: transform .12s var(--ease), background .16s;
}
.live__btn:hover { background: rgba(120,170,255,.24); }
.live__btn:active { transform: scale(.97); }
.live__btn i { font-size: 22px; }
.live__btn--ghost { background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.14); }
.live__btn.is-rec { background: rgba(217,90,90,.24); border-color: rgba(255,120,120,.5); }

/* ============================================================
   SETTINGS DRAWER + SHEET
   ============================================================ */
.drawer {
  width: min(440px, 100vw); height: 100dvh; background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: var(--shadow-pop); display: flex; flex-direction: column; animation: slideIn .28s var(--ease);
}
@keyframes slideIn { from { transform: translateX(24px); opacity: 0; } }
.drawer__head, .sheet__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.drawer__head h2, .sheet__head h2 { margin: 0; font-size: 18px; letter-spacing: -.01em; }
.drawer__body { flex: 1; overflow-y: auto; padding: 18px; display: grid; gap: 24px; }

.set { display: grid; gap: 10px; }
.set__h { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; font-weight: 640; letter-spacing: .03em; text-transform: uppercase; color: var(--ink-3); }
.set__h i { font-size: 16px; color: var(--accent); }
.set__p { margin: 0; font-size: 13px; color: var(--ink-2); }
.set__p--muted { color: var(--ink-3); font-size: 12px; font-family: var(--font-mono); }
.set__row { display: flex; align-items: center; justify-content: space-between; font-size: 14px; color: var(--ink-2); }
.set__row strong { color: var(--ink); font-weight: 580; }
.set--admin { padding: 14px; border: 1px solid var(--accent); border-radius: var(--r-md); background: var(--accent-weak); }

.badge { margin-left: auto; font-size: 11px; font-weight: 620; color: var(--accent); background: var(--surface); border: 1px solid var(--accent); border-radius: var(--r-pill); padding: 2px 8px; text-transform: none; letter-spacing: 0; }

.themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.theme-card { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); transition: .16s var(--ease); }
.theme-card:hover { border-color: var(--line-strong); }
.theme-card.is-active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-weak); }
.theme-card__name { font-size: 12.5px; font-weight: 540; }
.theme-swatch { height: 46px; border-radius: var(--r-sm); border: 1px solid var(--line); }
.theme-swatch--light { background: linear-gradient(135deg, #fdfdfa 60%, #1f6feb 60%); }
.theme-swatch--dark { background: linear-gradient(135deg, #141821 60%, #4f8dff 60%); }
.theme-swatch--navy { background: linear-gradient(135deg, #10203f 60%, #d9b25a 60%); }

.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track { width: 44px; height: 26px; border-radius: var(--r-pill); background: var(--surface-3); position: relative; transition: background .18s var(--ease); flex: none; }
.switch__thumb { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-1); transition: transform .18s var(--ease); }
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track .switch__thumb { transform: translateX(18px); }
.switch__label { font-size: 14px; color: var(--ink); }
.switch input:focus-visible + .switch__track { box-shadow: 0 0 0 3px var(--accent-weak); }

.api-links { display: grid; gap: 8px; }
.api-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); transition: .16s var(--ease); }
.api-link:hover { background: var(--surface-2); }
.api-link i { font-size: 20px; color: var(--ink-2); }
.api-link__body { display: grid; }
.api-link__t { font-weight: 560; font-size: 14px; }
.api-link__d { font-size: 12px; color: var(--ink-3); }
.api-link__state { margin-left: auto; font-size: 11px; font-family: var(--font-mono); padding: 2px 8px; border-radius: var(--r-pill); }
.api-link__state.ok { color: var(--live); background: var(--accent-weak); }
.api-link__state.off { color: var(--ink-3); background: var(--surface-2); }

.vault { display: grid; gap: 8px; }
.vault__row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.vault__name { font-size: 13px; font-weight: 560; min-width: 120px; }
.vault__key { flex: 1; font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vault__reveal, .vault__copy { color: var(--ink-3); }
.vault__reveal:hover, .vault__copy:hover { color: var(--accent); }

/* sheet (tools / notebooklm) */
.sheet { width: 100%; max-width: 560px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); max-height: 86vh; display: flex; flex-direction: column; animation: pop .24s var(--ease); }
.sheet__body { padding: 18px; overflow-y: auto; display: grid; gap: 12px; }
.tool-card { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); transition: .16s var(--ease); text-align: left; width: 100%; }
.tool-card:hover { border-color: var(--line-strong); background: var(--surface-2); }
.tool-card__icon { width: 40px; height: 40px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--accent-weak); color: var(--accent); font-size: 20px; flex: none; }
.tool-card__body { display: grid; gap: 2px; min-width: 0; }
.tool-card__t { font-weight: 600; font-size: 14.5px; }
.tool-card__d { font-size: 12.5px; color: var(--ink-3); }
.tool-card__t small { margin-left: 8px; font-weight: 500; color: var(--accent); font-size: 11px; }

/* ============================================================
   TOASTS
   ============================================================ */
.toasts { position: fixed; top: 18px; right: 18px; z-index: 120; display: grid; gap: 10px; width: min(360px, calc(100vw - 36px)); }
.toast {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; background: var(--surface);
  border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--r-md);
  box-shadow: var(--shadow-pop); animation: toastIn .3s var(--ease);
}
.toast.is-warn { border-left-color: var(--danger); }
.toast.is-out { animation: toastOut .3s var(--ease) forwards; }
.toast i { font-size: 20px; color: var(--accent); margin-top: 1px; }
.toast.is-warn i { color: var(--danger); }
.toast__body { flex: 1; min-width: 0; }
.toast__t { font-weight: 620; font-size: 13.5px; }
.toast__d { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.toast__x { color: var(--ink-3); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }

/* ============================================================
   RESPONSIVE
   ============================================================ */
.only-mobile { display: none; }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 40; width: 86vw; max-width: var(--side-w); box-shadow: var(--shadow-pop); transform: translateX(-100%); }
  .app.side-open .side { transform: translateX(0); }
  .only-mobile { display: inline-grid; }
  .topbar { grid-template-columns: auto 1fr auto; }
  .topbar__center { display: none; }
  .cap-grid { grid-template-columns: 1fr; }
  .welcome__title { font-size: 24px; }
}

/* scrollbars */
.side__scroll::-webkit-scrollbar, .stream::-webkit-scrollbar, .drawer__body::-webkit-scrollbar { width: 10px; }
.side__scroll::-webkit-scrollbar-thumb, .stream::-webkit-scrollbar-thumb, .drawer__body::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
