/* ============================================================================
   Ember Live — Interpreter Console
   Design system: warm near-black canvas, 4-step surface stack, ember as a
   scarcity accent, and a source-warm / translation-cool color grammar.
   ============================================================================ */

:root {
  /* Surfaces (each step ~+5-8% luminance; elevation is luminance, not shadow) */
  --canvas:     #0B0C0E;
  --surface-1:  #121317;   /* rail, topbar */
  --surface-2:  #181A1F;   /* cards, stream, segments */
  --surface-3:  #21242B;   /* inputs, hover, menus */
  --surface-4:  #2A2E37;   /* pressed / raised chips */

  --hairline:        rgba(255,255,255,.06);
  --hairline-strong: rgba(255,255,255,.10);
  --row-line:        rgba(255,255,255,.04);

  /* Text as opacity of one off-white */
  --text:    #ECEDF1;
  --text-2:  rgba(236,237,241,.64);
  --text-3:  rgba(236,237,241,.40);
  --text-4:  rgba(236,237,241,.26);

  /* Accent — ember, used sparingly (<5% of pixels) */
  --ember:      #FF8A4C;
  --ember-hi:   #FFB07A;
  --ember-glow: rgba(255,138,76,.14);

  /* Cool counterpoint — translated content */
  --stream:      #66D0E8;
  --stream-glow: rgba(102,208,232,.12);

  --verified: #4FC98D;
  --warn:     #E7B84E;
  --danger:   #F0596B;

  /* Radius discipline */
  --r-ctl:   8px;
  --r-card:  12px;
  --r-modal: 16px;

  /* Two shadow tiers only */
  --sh-rest:  0 1px 2px rgba(0,0,0,.4);
  --sh-float: 0 14px 40px -12px rgba(0,0,0,.7), 0 2px 8px rgba(0,0,0,.4);

  /* Motion */
  --ease: cubic-bezier(.2,.8,.2,1);
  --dur-fast: 90ms;
  --dur: 180ms;

  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-ui: "Inter", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --rail-w: 60px;
  --copilot-w: 360px;
  --topbar-h: 56px;
}

/* Per-language hue (chips, translation tags, spines) */
[data-lang="en"]{--lh:#66D0E8} [data-lang="zh"]{--lh:#F0A35C}
[data-lang="nl"]{--lh:#7FD48C} [data-lang="pt"]{--lh:#8FB8FF}
[data-lang="ja"]{--lh:#C4A0F5} [data-lang="de"]{--lh:#E7B84E}
[data-lang="fr"]{--lh:#6EA8FF} [data-lang="es"]{--lh:#F2879F}
[data-lang="ru"]{--lh:#5FC8DE} [data-lang="ko"]{--lh:#5AD1B4}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  font-feature-settings: "cv05" 1, "ss01" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
h1,h2,h3 { margin: 0; font-weight: 600; }
button { font-family: inherit; cursor: pointer; color: inherit; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

::selection { background: var(--ember-glow); color: var(--ember-hi); }

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.16); background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--canvas), 0 0 0 4px rgba(255,138,76,.5);
  border-radius: var(--r-ctl);
}

/* ============================== APP SHELL ============================== */
.app {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0,1fr) var(--copilot-w);
  height: 100vh;
  height: 100dvh;
}

/* ============================== LEFT RAIL ============================== */
.rail {
  grid-column: 1;
  background: var(--surface-1);
  border-right: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 8px;
}
.rail-brand {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: linear-gradient(160deg, #2a1a12, #17130f);
  border: 1px solid rgba(255,138,76,.28);
  box-shadow: 0 0 18px -4px var(--ember-glow), var(--sh-rest);
  color: var(--ember);
  text-decoration: none;
  margin-bottom: 8px;
}
.rail-flame { width: 22px; height: 22px; filter: drop-shadow(0 0 6px rgba(255,138,76,.5)); }
.rail-nav { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.rail-foot { display: flex; flex-direction: column; gap: 6px; }
.rail-btn {
  position: relative;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 10px;
  color: var(--text-3);
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.rail-btn svg { width: 20px; height: 20px; }
.rail-btn:hover { color: var(--text); background: var(--surface-3); }
.rail-btn.is-active { color: var(--ember); background: var(--ember-glow); border-color: rgba(255,138,76,.20); }
.rail-tip {
  position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%) scale(.96);
  background: var(--surface-3); color: var(--text);
  border: 1px solid var(--hairline-strong);
  padding: 4px 9px; border-radius: 7px; font-size: 12px; white-space: nowrap;
  box-shadow: var(--sh-float);
  opacity: 0; pointer-events: none; transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
  z-index: 60;
}
.rail-btn:hover .rail-tip { opacity: 1; transform: translateY(-50%) scale(1); }

/* ============================== WORKSPACE ============================== */
.workspace { grid-column: 2; display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.topbar {
  height: var(--topbar-h); flex: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--hairline);
  background: linear-gradient(180deg, var(--surface-1), var(--canvas));
}
.topbar-lead { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.wordmark {
  font-family: var(--font-display);
  font-size: 18px; font-weight: 600; letter-spacing: -.01em;
  background: linear-gradient(92deg, var(--ember-hi), var(--ember));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  white-space: nowrap;
}
.wordmark-sub { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar-trail { display: flex; align-items: center; gap: 14px; }
.hud { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--text-3); }
.hud-item { display: inline-flex; align-items: center; gap: 5px; }
.hud-num { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 600; }
.hud-mono { font-family: var(--font-mono); letter-spacing: -.02em; }
.hud-div { width: 1px; height: 14px; background: var(--hairline-strong); }
.latency-hud {
  font-family: var(--font-mono); font-size: 11px; color: var(--text-2);
  padding: 2px 7px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--hairline);
  font-variant-numeric: tabular-nums;
}
.latency-hud.fast { color: var(--verified); }
.latency-hud.slow { color: var(--warn); }
.latency-hud.critical { color: var(--danger); }

.conn {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--text-2);
  padding: 5px 11px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--hairline);
}
.conn-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); box-shadow: 0 0 0 3px rgba(255,255,255,.04); }

/* ============================== STAGE ============================== */
.stage { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 16px; gap: 14px; }

/* Toolbar */
.toolbar {
  flex: none;
  display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap;
  padding: 12px 14px;
  background: var(--surface-2); border: 1px solid var(--hairline);
  border-radius: var(--r-card);
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field-grow { flex: 1; min-width: 200px; }
.field > label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.select-wrap { position: relative; }
.select-wrap::after {
  content: ""; position: absolute; right: 12px; top: 50%; width: 8px; height: 8px;
  border-right: 1.5px solid var(--text-3); border-bottom: 1.5px solid var(--text-3);
  transform: translateY(-65%) rotate(45deg); pointer-events: none;
}
select {
  appearance: none; -webkit-appearance: none;
  background: var(--surface-3); color: var(--text);
  border: 1px solid var(--hairline); border-radius: var(--r-ctl);
  padding: 9px 34px 9px 12px; font-size: 13px; font-weight: 500; min-width: 148px;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
select:hover { border-color: var(--hairline-strong); }

.toggle {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 14px;
  background: var(--surface-3); color: var(--text-2);
  border: 1px solid var(--hairline); border-radius: var(--r-ctl);
  font-size: 13px; font-weight: 500;
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.toggle .toggle-ico { width: 16px; height: 16px; opacity: .8; }
.toggle:hover { border-color: var(--hairline-strong); color: var(--text); }
.toggle.on {
  color: var(--verified); border-color: rgba(79,201,141,.35);
  background: rgba(79,201,141,.10);
}
.toggle.on .toggle-ico { opacity: 1; }

/* Language chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  --lh: var(--stream);
  display: inline-flex; align-items: center; height: 34px; padding: 0 14px;
  border-radius: 999px; font-size: 13px; font-weight: 500;
  background: var(--surface-3); color: var(--text-2);
  border: 1px solid var(--hairline);
  user-select: none;
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.chip:hover { border-color: var(--hairline-strong); color: var(--text); transform: translateY(-1px); }
.chip.on {
  color: var(--lh);
  border-color: color-mix(in srgb, var(--lh) 45%, transparent);
  background: color-mix(in srgb, var(--lh) 12%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--lh) 20%, transparent);
}

/* ============================== STREAM ============================== */
.stream {
  flex: 1; min-height: 0; overflow-y: auto;
  border-radius: var(--r-card);
  padding: 8px 4px 8px 8px;
  scroll-behavior: smooth;
  position: relative;
}
.stream[data-view-mode="split"], .stream[data-view-mode="grid"] {
  display: grid; gap: 12px; align-content: start;
}
.stream[data-view-mode="split"] { grid-template-columns: repeat(2, minmax(0,1fr)); }
.stream[data-view-mode="grid"] { grid-template-columns: repeat(2, minmax(0,1fr)); }

/* Empty state */
.empty { height: 100%; min-height: 320px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; }
.empty-orb {
  width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center;
  color: var(--stream);
  background: radial-gradient(circle at 50% 40%, var(--stream-glow), transparent 70%);
  border: 1px solid var(--hairline);
  margin-bottom: 20px;
  animation: breathe 4s var(--ease) infinite;
}
.empty-orb svg { width: 30px; height: 30px; opacity: .9; }
.empty-title { font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--text); margin: 0 0 8px; }
.empty-sub { font-size: 13.5px; color: var(--text-3); max-width: 380px; margin: 0; line-height: 1.6; }
@keyframes breathe { 0%,100%{ transform: scale(1); opacity: .9 } 50%{ transform: scale(1.05); opacity: 1 } }

/* Segment */
.seg {
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  padding: 14px 16px;
  margin-bottom: 12px;
  animation: settle 200ms var(--ease) both;
}
.stream[data-view-mode="split"] .seg, .stream[data-view-mode="grid"] .seg { margin-bottom: 0; }
@keyframes settle { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.seg-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.avatar {
  --sc: var(--stream);
  width: 26px; height: 26px; flex: none; border-radius: 8px;
  display: grid; place-items: center;
  font-size: 10.5px; font-weight: 700; letter-spacing: .02em;
  color: var(--sc);
  background: color-mix(in srgb, var(--sc) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--sc) 35%, transparent);
  font-family: var(--font-mono);
}
.seg-speaker { font-weight: 600; font-size: 13.5px; color: var(--text); }
.seg-lang {
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-3); padding: 2px 6px; border-radius: 5px;
  background: var(--surface-3); border: 1px solid var(--hairline);
}
.seg-time { margin-left: auto; font-size: 11px; color: var(--text-4); }
.seg-source { font-size: 15px; line-height: 1.55; color: var(--text); }
.seg-source a { color: var(--stream); text-decoration: none; border-bottom: 1px dashed color-mix(in srgb, var(--stream) 50%, transparent); cursor: pointer; }
.seg-source a:hover { border-bottom-style: solid; }

.seg-trans { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--hairline); display: flex; flex-direction: column; gap: 7px; }
.trow { --lh: var(--stream); display: grid; grid-template-columns: 52px 1fr auto; align-items: start; gap: 10px; padding-left: 10px; position: relative; }
.trow::before { content: ""; position: absolute; left: 0; top: 2px; bottom: 2px; width: 2px; border-radius: 2px; background: var(--lh); opacity: .8; }
.trow-tag { font-size: 11px; font-weight: 600; color: var(--lh); padding-top: 1px; font-family: var(--font-mono); }
.trow-text { font-size: 14px; line-height: 1.5; color: var(--stream); }
.trow-text .ph { color: var(--text-4); }
.trow-conf { width: 7px; height: 7px; border-radius: 50%; margin-top: 6px; background: var(--text-4); }
.trow-conf[data-level="high"]{ background: var(--verified); }
.trow-conf[data-level="medium"]{ background: var(--warn); }
.trow-conf[data-level="low"]{ background: var(--danger); }
.trow-conf[data-level="very-low"]{ background: #8b1f2c; }

/* Detected-value chips + number-preservation warning */
.seg-entities { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.echip { font-family: var(--font-mono); font-size: 11px; padding: 2px 7px; border-radius: 6px; background: var(--surface-3); border: 1px solid var(--hairline); color: var(--text-2); }
.echip[data-t="money"] { color: var(--verified); border-color: color-mix(in srgb, var(--verified) 35%, transparent); }
.echip[data-t="pct"] { color: var(--stream); border-color: color-mix(in srgb, var(--stream) 35%, transparent); }
.echip[data-t="time"], .echip[data-t="date"] { color: var(--text); }
.trow-meta { display: flex; align-items: center; gap: 7px; margin-top: 5px; }
.trow-meta .trow-conf { margin-top: 0; }
.trow-warn { width: 16px; height: 16px; flex: none; display: grid; place-items: center; font-size: 11px; font-weight: 800; line-height: 1; color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); border-radius: 5px; cursor: help; }

/* Round-trip meaning check */
.trow-check { width: 18px; height: 18px; flex: none; display: grid; place-items: center; padding: 0; border: none; background: transparent; color: var(--text-4); border-radius: 4px; opacity: 0; transition: opacity var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
.trow-check svg { width: 13px; height: 13px; }
.trow:hover .trow-check { opacity: 1; color: var(--text-3); }
.trow-check:hover { color: var(--stream); }
.trow-drift { margin: 0 0 6px 62px; padding: 8px 11px; background: var(--surface-3); border: 1px solid var(--hairline); border-radius: 8px; font-size: 12.5px; animation: settle 160ms var(--ease); }
.drift-load { color: var(--text-3); }
.drift-head { margin-bottom: 5px; }
.drift-badge { font-size: 9.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 2px 7px; border-radius: 5px; }
.drift-badge[data-d="none"] { color: var(--verified); background: color-mix(in srgb, var(--verified) 15%, transparent); }
.drift-badge[data-d="minor"] { color: var(--warn); background: color-mix(in srgb, var(--warn) 15%, transparent); }
.drift-badge[data-d="major"] { color: var(--danger); background: color-mix(in srgb, var(--danger) 15%, transparent); }
.drift-back { color: var(--text-2); line-height: 1.5; }
.drift-arrow { color: var(--text-4); margin-right: 4px; }
.drift-note { margin-top: 4px; color: var(--text-3); font-style: italic; }

/* Streaming caret */
.caret { display: inline-block; width: 2px; height: 1em; margin-left: 1px; vertical-align: text-bottom; background: var(--ember); animation: blink 1s steps(2,start) infinite; border-radius: 1px; }
@keyframes blink { 50% { opacity: 0; } }

/* Copy button */
.seg-copy {
  position: absolute; top: 10px; right: 10px;
  width: 28px; height: 28px; display: grid; place-items: center;
  background: var(--surface-3); border: 1px solid var(--hairline); border-radius: 7px;
  color: var(--text-3); opacity: 0; transition: opacity var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.seg-copy svg { width: 15px; height: 15px; }
.seg:hover .seg-copy { opacity: 1; }
.seg-copy:hover { color: var(--text); }
.seg-copy.copied { color: var(--verified); border-color: rgba(79,201,141,.4); opacity: 1; }

/* Parallel language panes (split / grid) */
.lang-pane { background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--r-card); overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.lang-pane-header { --lh: var(--stream); display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--hairline); background: color-mix(in srgb, var(--lh) 8%, var(--surface-2)); }
.lang-pane-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.lang-pane-flag { font-size: 15px; }
.lang-pane-count { font-size: 11px; color: var(--text-3); font-family: var(--font-mono); }
.lang-pane-segment { padding: 10px 14px; border-bottom: 1px solid var(--row-line); position: relative; transition: background var(--dur-fast) var(--ease); }
.lang-pane-segment:hover { background: var(--surface-3); }
.lang-pane-segment-time { font-size: 10.5px; color: var(--text-4); font-family: var(--font-mono); margin-bottom: 3px; }
.lang-pane-segment-text { font-size: 13.5px; color: var(--stream); line-height: 1.5; }
/* Source-on-hover: bilingual participants sanity-check the machine's output in one glance. */
.lang-pane-segment-src { display: none; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--hairline); font-size: 12.5px; color: var(--text); line-height: 1.45; }
.lang-pane-segment:hover .lang-pane-segment-src { display: block; }

/* ============================== DOCK ============================== */
.dock { flex: none; }
.interim {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; margin-bottom: 10px;
  background: var(--ember-glow); border: 1px solid rgba(255,138,76,.25); border-radius: var(--r-ctl);
  color: var(--ember-hi); font-size: 13px;
}
.interim.hidden { display: none; }
.interim-wave { display: inline-flex; align-items: center; gap: 3px; height: 16px; }
.interim-wave i { width: 3px; height: 6px; background: var(--ember); border-radius: 2px; animation: eq 900ms var(--ease) infinite; }
.interim-wave i:nth-child(2){ animation-delay: .15s } .interim-wave i:nth-child(3){ animation-delay: .3s } .interim-wave i:nth-child(4){ animation-delay: .45s }
@keyframes eq { 0%,100%{ height: 5px } 50%{ height: 15px } }
.interim-text { color: var(--ember-hi); }

.dock-main { display: flex; align-items: center; gap: 12px; }
.mic {
  flex: none; display: inline-flex; align-items: center; gap: 9px; height: 46px; padding: 0 18px;
  border-radius: var(--r-ctl); font-size: 14px; font-weight: 600;
  color: var(--text); background: var(--surface-3); border: 1px solid var(--hairline-strong);
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.mic .mic-ico { width: 18px; height: 18px; }
.mic:hover { border-color: rgba(255,138,76,.4); color: var(--ember-hi); }
.mic.live {
  background: linear-gradient(180deg, #ff9457, var(--ember)); color: #1b0e07; border-color: transparent;
  box-shadow: 0 0 0 4px var(--ember-glow), 0 8px 20px -8px rgba(255,138,76,.6);
}
.mic.live .mic-ico { display: none; }
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: #1b0e07; margin-right: 3px; animation: pulse 1.1s var(--ease) infinite; display: inline-block; }
@keyframes pulse { 0%,100%{ transform: scale(1); opacity: 1 } 50%{ transform: scale(.65); opacity: .5 } }
.cn { opacity: .75; font-weight: 500; }

.composer { flex: 1; display: flex; align-items: center; gap: 8px; background: var(--surface-3); border: 1px solid var(--hairline); border-radius: var(--r-ctl); padding: 5px 6px 5px 14px; transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease); }
.composer:focus-within { border-color: rgba(255,138,76,.4); box-shadow: 0 0 0 3px var(--ember-glow); }
.composer input { flex: 1; background: transparent; border: none; outline: none; color: var(--text); font-size: 14px; font-family: inherit; min-width: 0; }
.composer input::placeholder { color: var(--text-4); }
.btn-send { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border: none; border-radius: 7px; background: var(--ember); color: #1b0e07; transition: transform var(--dur-fast) var(--ease), filter var(--dur-fast) var(--ease); }
.btn-send svg { width: 18px; height: 18px; }
.btn-send:hover { filter: brightness(1.08); transform: translateY(-1px); }

.dock-tools { display: flex; align-items: center; gap: 6px; }
.tool { display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 13px; background: transparent; border: 1px solid var(--hairline); border-radius: var(--r-ctl); color: var(--text-2); font-size: 13px; font-weight: 500; transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease); }
.tool svg { width: 16px; height: 16px; }
.tool:hover { color: var(--text); border-color: var(--hairline-strong); background: var(--surface-3); }
.tool-ghost { padding: 0 11px; }

/* ============================== COPILOT ============================== */
.copilot { grid-column: 3; background: var(--surface-1); border-left: 1px solid var(--hairline); overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.copilot-head { padding: 4px 2px 6px; }
.copilot-head h2 { font-family: var(--font-display); font-size: 15px; font-weight: 600; letter-spacing: .02em; }
.copilot-sub { font-size: 11.5px; color: var(--text-3); }

.card { background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--r-card); box-shadow: var(--sh-rest); overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 9px; padding: 11px 14px; border-bottom: 1px solid var(--hairline); }
.card-ico { width: 16px; height: 16px; color: var(--text-3); flex: none; }
.card-ico-warn { color: var(--warn); }
.card-head h3 { font-size: 12.5px; font-weight: 600; letter-spacing: .02em; color: var(--text); }
.card-body { padding: 12px 14px; font-size: 13px; color: var(--text-2); line-height: 1.55; }
.card-empty { color: var(--text-4); font-size: 12.5px; margin: 0; }

/* Ask the meeting (grounded retrieval) */
.ask-form { display: flex; gap: 6px; }
.ask-form input { flex: 1; min-width: 0; background: var(--surface-3); border: 1px solid var(--hairline); border-radius: var(--r-ctl); padding: 8px 11px; font-size: 13px; color: var(--text); font-family: inherit; }
.ask-form input::placeholder { color: var(--text-4); }
.ask-form input:focus { outline: none; border-color: rgba(255,138,76,.4); box-shadow: 0 0 0 3px var(--ember-glow); }
.ask-send { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border: none; border-radius: 7px; background: var(--ember); color: #1b0e07; transition: filter var(--dur-fast) var(--ease); }
.ask-send svg { width: 15px; height: 15px; }
.ask-send:hover { filter: brightness(1.08); }
.ask-answer:empty { display: none; }
.ask-answer { margin-top: 11px; font-size: 13px; color: var(--text-2); line-height: 1.55; }
.ask-q { font-size: 12px; color: var(--text-3); font-style: italic; margin-bottom: 7px; padding-left: 9px; border-left: 2px solid var(--hairline-strong); }
.ask-loading, .ask-empty { color: var(--text-3); font-size: 12.5px; margin: 0; }

/* Copilot content formatting */
.cop-list { display: flex; flex-direction: column; gap: 7px; margin: 0; padding: 0; list-style: none; }
.cop-li { position: relative; padding-left: 15px; color: var(--text-2); }
.cop-li::before { content: ""; position: absolute; left: 2px; top: 8px; width: 4px; height: 4px; border-radius: 50%; background: var(--ember); opacity: .7; }
.cop-p { margin: 0 0 6px; color: var(--text-2); }
.cop-p:last-child { margin-bottom: 0; }

/* Speakers */
.spk-row { display: flex; align-items: center; gap: 9px; padding: 5px 0; }
.spk-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.spk-name { font-size: 13px; color: var(--text); }
.spk-id { font-size: 11px; color: var(--text-4); font-family: var(--font-mono); }
.spk-lang { margin-left: auto; font-size: 10px; font-weight: 600; text-transform: uppercase; color: var(--stream); background: var(--stream-glow); border: 1px solid color-mix(in srgb, var(--stream) 30%, transparent); padding: 2px 6px; border-radius: 5px; }

/* Action items */
.act-list { display: flex; flex-direction: column; gap: 10px; }
.act { display: flex; align-items: flex-start; gap: 9px; }
.act input[type="checkbox"] { margin-top: 2px; width: 15px; height: 15px; accent-color: var(--ember); cursor: pointer; flex: none; }
.act-body { flex: 1; min-width: 0; }
.act-text { font-size: 13px; color: var(--text); margin-bottom: 3px; }
.act.done .act-text { text-decoration: line-through; color: var(--text-4); }
.act-meta { display: flex; gap: 12px; font-size: 11px; color: var(--text-3); font-family: var(--font-mono); }

/* Decisions & open-questions ledger */
.dec-group { margin-bottom: 12px; }
.dec-group:last-child { margin-bottom: 0; }
.dec-label { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-4); margin-bottom: 6px; }
.dec-list { display: flex; flex-direction: column; gap: 8px; }
.dec-item { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; }
.dec-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 6px; flex: none; }
.dec-yes .dec-dot { background: var(--verified); }
.dec-open .dec-dot { background: var(--warn); }
.dec-text { color: var(--text); line-height: 1.45; }
.dec-who { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* Terminology */
.term-list { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto; }
.term { padding: 8px 10px; background: var(--surface-3); border: 1px solid var(--hairline); border-radius: var(--r-ctl); }
.term-src { font-weight: 600; color: var(--stream); font-size: 13px; margin-bottom: 3px; }
.term-trans { font-size: 12px; color: var(--text-2); }
.term-meta { font-size: 10.5px; color: var(--text-4); margin-top: 3px; font-family: var(--font-mono); }

/* ============================== TOASTS ============================== */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 9000; max-width: 340px; }
.toast {
  padding: 10px 14px; border-radius: var(--r-ctl);
  background: var(--surface-3); color: var(--text);
  border: 1px solid var(--hairline-strong);
  box-shadow: var(--sh-float); font-size: 13px;
  animation: toast-in 220ms var(--ease) both;
}
.toast.success { border-color: rgba(79,201,141,.4); }
.toast.warn { border-color: rgba(231,184,78,.4); }
.toast.error { border-color: rgba(240,89,107,.45); }
@keyframes toast-in { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }

/* ============================== ACCESS GATE ============================== */
.gate { position: fixed; inset: 0; z-index: 10002; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 30%, #14100c, var(--canvas) 70%); }
.gate-card { width: 100%; max-width: 380px; text-align: center; background: var(--surface-2); border: 1px solid var(--hairline-strong); border-radius: var(--r-modal); box-shadow: var(--sh-float); padding: 36px 32px; animation: settle 240ms var(--ease); }
.gate-flame { width: 56px; height: 56px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 15px; color: var(--ember); background: linear-gradient(160deg, #2a1a12, #17130f); border: 1px solid rgba(255,138,76,.3); box-shadow: 0 0 24px -6px var(--ember-glow); }
.gate-flame svg { width: 28px; height: 28px; filter: drop-shadow(0 0 6px rgba(255,138,76,.5)); }
.gate-title { font-family: var(--font-display); font-size: 22px; font-weight: 600; margin-bottom: 6px; background: linear-gradient(92deg, var(--ember-hi), var(--ember)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.gate-sub { font-size: 13.5px; color: var(--text-3); margin-bottom: 22px; }
.gate-form { display: flex; gap: 8px; }
.gate-form input { flex: 1; min-width: 0; background: var(--surface-3); border: 1px solid var(--hairline); border-radius: var(--r-ctl); padding: 11px 14px; font-size: 14px; color: var(--text); font-family: inherit; }
.gate-form input:focus { outline: none; border-color: rgba(255,138,76,.5); box-shadow: 0 0 0 3px var(--ember-glow); }
.gate-form button { padding: 0 18px; border: none; border-radius: var(--r-ctl); background: var(--ember); color: #1b0e07; font-weight: 600; font-size: 14px; }
.gate-form button:disabled { opacity: .6; cursor: default; }
.gate-err { min-height: 18px; margin-top: 12px; font-size: 12.5px; color: var(--danger); }

/* ============================== MODALS ============================== */
.modal { position: fixed; inset: 0; background: rgba(6,7,9,.72); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 10000; padding: 24px; animation: fade 160ms var(--ease); }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal-card { background: var(--surface-2); border: 1px solid var(--hairline-strong); border-radius: var(--r-modal); box-shadow: var(--sh-float); max-width: 620px; width: 100%; max-height: 82vh; overflow-y: auto; padding: 24px; animation: settle 200ms var(--ease); }
.modal-title { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 17px; margin-bottom: 16px; }
.modal-title svg { width: 20px; height: 20px; color: var(--ember); }
.modal-body { font-size: 14px; line-height: 1.65; color: var(--text-2); }
.modal-close { margin-top: 20px; padding: 9px 18px; background: var(--ember); color: #1b0e07; border: none; border-radius: var(--r-ctl); font-weight: 600; }

.sheet { min-width: 320px; }
.sheet-opt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; margin-bottom: 8px; background: var(--surface-3); border: 1px solid var(--hairline); border-radius: var(--r-ctl); color: var(--text); text-align: left; font-size: 13.5px; transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease); }
.sheet-opt svg { width: 18px; height: 18px; color: var(--text-3); flex: none; }
.sheet-opt:hover { border-color: rgba(255,138,76,.35); background: var(--surface-4); }
.sheet-opt small { color: var(--text-4); margin-left: auto; }
.sheet-cancel { width: 100%; padding: 9px; background: transparent; border: none; color: var(--text-3); font-size: 13px; margin-top: 4px; }

/* Keyboard shortcuts overlay */
.shortcuts-overlay { position: fixed; inset: 0; background: rgba(6,7,9,.72); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 10001; padding: 24px; animation: fade 160ms var(--ease); }
.shortcuts-panel { background: var(--surface-2); border: 1px solid var(--hairline-strong); border-radius: var(--r-modal); box-shadow: var(--sh-float); padding: 24px; min-width: 340px; animation: settle 200ms var(--ease); }
.shortcuts-title { font-family: var(--font-display); font-size: 16px; margin-bottom: 16px; }
.shortcut-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--row-line); font-size: 13px; color: var(--text-2); }
.shortcut-row:last-child { border-bottom: none; }
.shortcut-keys { display: flex; gap: 5px; }
.shortcut-key { font-family: var(--font-mono); font-size: 11px; padding: 3px 8px; background: var(--surface-3); border: 1px solid var(--hairline-strong); border-radius: 6px; color: var(--text); }

/* Scroll-lock indicator */
.scroll-lock-indicator { position: fixed; bottom: 120px; left: 50%; transform: translateX(-50%); background: var(--surface-3); border: 1px solid var(--hairline-strong); color: var(--text-2); padding: 7px 14px; border-radius: 999px; font-size: 12px; box-shadow: var(--sh-float); z-index: 500; cursor: pointer; }
.scroll-lock-indicator.hidden { display: none; }

/* Neutralize legacy slop effects (kept as no-ops for safety) */
.particle { display: none !important; }
.confidence-wave { display: none !important; }

/* ============================== RESPONSIVE ============================== */
@media (max-width: 1080px) {
  .app { grid-template-columns: var(--rail-w) 1fr; }
  .copilot { position: fixed; top: 0; right: 0; width: min(360px, 88vw); height: 100vh; z-index: 200; transform: translateX(100%); transition: transform var(--dur) var(--ease); box-shadow: var(--sh-float); }
  .app.copilot-open .copilot { transform: none; }
}
@media (max-width: 640px) {
  :root { --rail-w: 52px; --topbar-h: 52px; }
  .app { grid-template-columns: var(--rail-w) 1fr; }
  .stage { padding: 12px; gap: 10px; }
  .wordmark-sub { display: none; }
  .topbar { padding: 0 12px; gap: 8px; }
  .hud { display: none; }
  .conn { padding: 5px 9px; }
  .toolbar { padding: 10px; gap: 10px; }
  .field-grow { flex-basis: 100%; }
  .dock-main { flex-wrap: wrap; }
  .composer { order: 3; flex-basis: 100%; }
  .dock-tools { margin-left: auto; }
  .tool span { display: none; }
  .trow { grid-template-columns: 44px 1fr auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .caret { animation: none; opacity: 1; }
}
