/* Marea Seafood Intelligence Workspace — visual redesign, 2026-09-13,
 * repainted to a premium black/white/blue palette, 2026-09-14 (per Vengat's
 * conference-floor feedback: the previous ocean teal/coral scheme read as
 * generic "seafood" branding that blends into a seafood-industry conference
 * environment instead of standing apart from it).
 *
 * Token NAMES are unchanged from the original teal/coral palette
 * (--seafoam*, --coral*) even though neither now holds a seafoam-green or
 * coral-orange value — every component rule below already reads these
 * custom properties, so repainting the values in one place re-themes the
 * entire app without touching a single consuming rule. Read them as their
 * new roles: --seafoam* = the single restrained BLUE accent (primary/
 * active/engaged), --coral* = a muted slate-blue secondary (processing/
 * caution/lower emphasis) — same semantic split as before, same hue family
 * now (no second color family), just no longer green vs. orange.
 *
 * Contrast-checked (WCAG relative-luminance/contrast-ratio script): every
 * text-role token pairing below is >=4.5:1 against every background token
 * it's actually used on, in both themes.
 */
:root {
  --bg-void: #0A0A0D;
  --bg-deep: #0F1013;
  --bg-surface: #17181C;
  --bg-elevated: #1E2024;
  --bg-elevated-hover: #262830;

  --border-subtle: rgba(255,255,255,0.08);
  --border: rgba(255,255,255,0.14);
  --border-strong: rgba(255,255,255,0.26);

  --text-primary: #F5F6F8;
  --text-secondary: #B7BBC4;
  --text-tertiary: #7D818C;

  /* primary accent — restrained, premium blue */
  --seafoam: #5B8DEF;
  --seafoam-strong: #8FB0F5;
  --seafoam-dim: rgba(91,141,239,0.16);

  /* secondary accent — muted slate-blue, same hue family, lower emphasis */
  --coral: #7C8AA6;
  --coral-strong: #9DA9C2;
  --coral-dim: rgba(124,138,166,0.16);

  --danger: #E5624A;
  --danger-bg: rgba(229,98,74,0.12);
  --danger-text: #FFD7CF;

  --focus: #5B8DEF;

  /* Resting ("calm") color for the voice-tides visual — a paler, quieter
     blue than --seafoam. Illuminated tides (listening/answering) reuse
     --seafoam/--seafoam-strong directly rather than a separate token, so
     there's still only one accent hue in the whole app, just two
     intensities of it. */
  --tide-calm: #4C6899;

  /* Translucent "glass" surfaces (caption panel / evidence dock) — kept as
     their own tokens rather than derived from --bg-surface/--bg-deep at
     render time, since these are the literal historical rgba() values
     (bg-surface/bg-deep with an alpha channel) and giving them names makes
     that relationship explicit instead of accidental. */
  --glass-panel: rgba(23,24,28,0.6);
  --glass-dock: rgba(15,16,19,0.66);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;

  --font-display: 'Fraunces', serif;
  --font-ui: 'Archivo', sans-serif;
  /* Used ONLY for the Voice Assistant's spoken-conversation text
     (.caption-text, 2026-09-15) — a request specifically scoped to that
     transcript, not a whole-app typography change. Everything else keeps
     --font-display/--font-ui exactly as before. */
  --font-transcript: 'Inter', var(--font-ui);
}

/* ---- light theme --------------------------------------------------------
 * Same token names as the dark palette above (bare :root) — every existing
 * component already reads these custom properties, so this block is the
 * ENTIRE light theme: no component below needs its own light-mode override.
 * Clean white/off-white base, near-black typography, blue interactive
 * elements — WCAG-checked against every background token each text-role
 * token is actually used on (relative-luminance/contrast-ratio script,
 * all >=4.5:1).
 */
:root[data-theme="light"] {
  --bg-void: #FAFAFB;
  --bg-deep: #F4F5F7;
  --bg-surface: #FFFFFF;
  --bg-elevated: #FFFFFF;
  --bg-elevated-hover: #EEF1F5;

  --border-subtle: rgba(10,10,20,0.08);
  --border: rgba(10,10,20,0.14);
  --border-strong: rgba(10,10,20,0.26);

  --text-primary: #0A0A0D;
  --text-secondary: #43454C;
  --text-tertiary: #6B6E76;

  --seafoam: #1D4ED8;
  --seafoam-strong: #1739A6;
  --seafoam-dim: rgba(29,78,216,0.10);

  --coral: #4B5568;
  --coral-strong: #38404F;
  --coral-dim: rgba(75,85,104,0.10);

  --danger: #C7402B;
  --danger-bg: rgba(199,64,43,0.08);
  --danger-text: #7A2617;

  --focus: #1D4ED8;

  --tide-calm: #4C89F2;

  --glass-panel: rgba(255,255,255,0.78);
  --glass-dock: rgba(244,245,247,0.82);
}

* { box-sizing: border-box; }

/* An element's `hidden` attribute must always actually hide it, even when
   a more specific class on the same element also sets `display` (sidebar
   view-panels, the voice-assistant main view) — without this, the cascade
   would let e.g. `.app-main{display:flex}` win over the UA default
   `[hidden]{display:none}` and the element would stay visible. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-void);
  color: var(--text-primary);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  height: 100%;
}

body { overflow: hidden; }

button {
  font-family: inherit;
  cursor: pointer;
}
button:disabled { cursor: not-allowed; }

/* ---- accessibility baseline ------------------------------------------- */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

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

/* ---- app shell ---------------------------------------------------------- */
.app {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: row;
  position: relative;
  background:
    radial-gradient(120% 90% at 12% -10%, rgba(91,141,239,0.07), transparent 45%),
    radial-gradient(90% 70% at 100% 110%, rgba(91,141,239,0.04), transparent 50%),
    var(--bg-void);
  overflow: hidden;
}

/* ---- sidebar -------------------------------------------------------------
 * Collapsed to an icon-only rail by default (persisted via localStorage) so
 * the Voice Assistant keeps the lion's share of the screen — Conversations/
 * Knowledge Base/Settings are enhancements around it, not equal-billing
 * navigation. The hamburger in the header expands it to show labels too.
 */
.sidebar {
  flex: none;
  width: 72px;
  display: flex;
  flex-direction: column;
  background: var(--bg-deep);
  border-right: 1px solid var(--border-subtle);
  padding: 18px 0;
  gap: 2px;
  overflow: hidden;
  /* 0.4s everywhere in this rule (matches .app-header/.evidence-dock/the
     rest of the presentation-mode transition below) so the sidebar collapse,
     header collapse, and evidence-dock collapse all finish in the same
     beat — mismatched durations across the three is what made entering
     presentation mode read as several small jumps instead of one smooth
     transform, even though each piece was individually animated. */
  transition: width 0.4s ease, opacity 0.4s ease, padding 0.4s ease, border-color 0.4s ease;
  z-index: 6;
}
.sidebar.expanded { width: 216px; }

/* IdeaBoxAI brand mark — 2026-09-14: both PNGs below were regenerated from
 * the reference "IdeaBoxAI" logo image the user supplied (gradient
 * interlocking-hexagon icon + wordmark). The earlier two phases' assets were
 * cropped from a DIFFERENT, older source JPEG that only read "IdeaBox" (no
 * "AI", a plain solid-color icon) — that was the actual root cause of the
 * "logo looks wrong/cut off" reports, not a CSS clipping bug (the CSS here
 * was already correct, object-fit:contain, verified pixel-for-pixel complete
 * in a real browser in the prior round — it was rendering the wrong asset
 * completely). The reference image was a flat, opaque screenshot-style PNG
 * (light-lavender rounded-card background baked in, not a transparent
 * source), so both files here are re-extracted via chroma-key/alpha
 * un-blending against that background rather than a plain crop; the icon and
 * text regions were keyed separately because the icon's blue is much closer
 * to the lavender background in raw distance than the near-black text is, so
 * a single global threshold under-saturated the icon. See the "Known
 * limitation" note in the build summary re: the source image's native
 * resolution (145x40px) — these are upscaled 4x with Lanczos resampling
 * before being placed here, which smooths edges but cannot add detail a
 * higher-resolution source would have.
 * ideabox-logo-icon.png is just the hexagon mark, and ideabox-logo-mark.png
 * is the hexagon + "IdeaBoxAI" wordmark. We show the icon-only mark on the
 * collapsed rail and the full wordmark once expanded, rather than showing
 * one asset scaled to both sizes, because testing showed the full wordmark
 * scaled down to the ~40px collapsed rail becomes illegible at that width no
 * matter the resampling quality, while the icon alone reads cleanly small.
 * This is the same icon-vs-full-lockup split most product brands use for
 * compact UI chrome, not a crop that mutilates the supplied artwork.
 * The wordmark is dark-on-transparent with no dark-theme variant; rather
 * than recolor the asset itself — which the brief explicitly asks us not to
 * do — it sits on a small white "badge" plinth so it stays legible against
 * the dark theme's near-black sidebar; in the light theme the badge is
 * nearly invisible against the already-white sidebar, so it reads as just
 * the logo either way. */
.sidebar-brand {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  padding: 0 10px;
}
.sidebar-brand-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 40px;
  min-width: 0; /* let a flex child image shrink/contain instead of forcing overflow */
  padding: 8px;
  border-radius: var(--radius-sm);
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  overflow: hidden; /* belt-and-suspenders: never let the mark visually spill its badge */
  transition: max-width 0.2s ease, padding 0.2s ease;
}
/* object-fit: contain (with an explicit box on both axes) rather than the
 * previous width:100%/height:auto pairing — functionally equivalent for an
 * unconstrained aspect ratio, but robust against any future rule that ends
 * up constraining both dimensions at once (that's the one combination
 * where a plain height:auto stops protecting you and the image can be
 * stretched or cropped to fill the box; contain never crops or stretches). */
.sidebar-brand-logo {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  min-width: 0;
}
.sidebar-brand-logo-icon { width: auto; height: 26px; }
.sidebar-brand-logo-full { display: none; width: 100%; height: auto; }
.sidebar.expanded .sidebar-brand { justify-content: flex-start; padding: 0 22px; }
.sidebar.expanded .sidebar-brand-badge { max-width: 168px; padding: 8px 12px; }
.sidebar.expanded .sidebar-brand-logo-icon { display: none; }
.sidebar.expanded .sidebar-brand-logo-full { display: block; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: none;
  border: none;
  border-right: 2px solid transparent;
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 12px 0;
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease;
}
.sidebar.expanded .sidebar-item { justify-content: flex-start; padding: 12px 24px; }
.sidebar-item:hover { color: var(--text-primary); background: rgba(91,141,239,0.08); }
.sidebar-item.active { color: var(--seafoam); background: var(--seafoam-dim); border-right-color: var(--seafoam); }
.sidebar-item-icon { width: 20px; height: 20px; flex: none; }
.sidebar-item-icon svg { width: 100%; height: 100%; }
.sidebar-item-label { display: none; }
.sidebar.expanded .sidebar-item-label { display: inline; }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 5;
}
.sidebar-backdrop.show { display: block; }

.app-shell {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.app-header {
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 32px;
  border-bottom: 1px solid var(--border-subtle);
  z-index: 3;
  max-height: 90px;
  overflow: hidden;
  transition: max-height 0.4s ease, padding 0.4s ease, opacity 0.4s ease, border-color 0.4s ease;
}
.app-header .brand { margin-right: auto; }
.sidebar-toggle-btn { padding: 9px; flex: none; }

.brand { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.brand-mark { font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--text-primary); letter-spacing: -0.005em; white-space: nowrap; }
.brand-sub { font-size: 11.5px; color: var(--text-tertiary); letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.header-controls { display: flex; align-items: center; gap: 10px; flex: none; }

.state-pill {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-tertiary);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: border-color 0.4s ease, color 0.4s ease;
  white-space: nowrap;
}
.state-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-tertiary); transition: background 0.4s ease, box-shadow 0.4s ease; }
.state-pill.listening { border-color: rgba(91,141,239,0.45); color: var(--seafoam); }
.state-pill.listening .dot { background: var(--seafoam); box-shadow: 0 0 10px var(--seafoam); }
.state-pill.thinking { border-color: rgba(124,138,166,0.4); color: var(--coral); }
.state-pill.thinking .dot { background: var(--coral); }
.state-pill.answering { border-color: rgba(91,141,239,0.55); color: var(--seafoam-strong); }
.state-pill.answering .dot { background: var(--coral); box-shadow: 0 0 10px var(--coral); }
.state-pill.connecting { border-color: var(--border-strong); color: var(--text-secondary); }
.state-pill.error { border-color: rgba(229,98,74,0.5); color: var(--danger); }
.state-pill.error .dot { background: var(--danger); }

.icon-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
  background: rgba(0,0,0,0.15);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 7px 14px 7px 10px;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.icon-btn:hover { color: var(--text-primary); border-color: var(--seafoam); background: rgba(91,141,239,0.08); }
.icon-btn-icon { display: inline-flex; width: 16px; height: 16px; }
.icon-btn-icon svg { width: 100%; height: 100%; }
.icon-mic-off { display: none; }
.icon-btn.muted { color: var(--coral-strong); border-color: rgba(124,138,166,0.5); }
.icon-btn.muted .icon-mic-on { display: none; }
.icon-btn.muted .icon-mic-off { display: inline-flex; }

/* ---- main layout: voice stage + evidence dock -------------------------- */
.app-main {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: stretch;
}

.voice-stage {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: 24px 40px;
  /* Entering presentation mode changes this rule's own padding/gap (see
     .app.presentation-mode .voice-stage below) — without a transition here
     those snapped instantly even while the sidebar/header/dock around it
     were animating, which is part of what made the whole switch read as a
     jump rather than one smooth move. */
  transition: padding 0.4s ease, gap 0.4s ease;
  position: relative;
  overflow-y: auto;
}

/* ---- orb ---------------------------------------------------------------- */
.orb-wrap {
  position: relative;
  /* 2026-09-15: widened from a 200x200 square into a wide strip so the tide
     lines drawn inside (see .voice-canvas / drawTides in app.js) actually
     reach toward both edges of the stage instead of being squeezed into a
     small square — same click/tap/keydown target as before, just a wider
     one, which if anything makes it an easier target, not a smaller one. */
  width: min(560px, 82vw);
  height: 170px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

/* ---- voice visualization: "tides" ----------------------------------------
 * (2026-09-14, second pass, per direct feedback) Replaces the flat-line-
 * plus-circle-and-ripples design with a single unified visual used for
 * every state: a small stack of translucent wave lines — like tide lines
 * on a nautical chart — calm and pale blue at rest, and "illuminated" to a
 * deeper, richer blue while Marea is actually listening to you or actually
 * speaking back. Nothing morphs into a different shape between states
 * anymore; only the color, brightness, and how energetically the same
 * tide lines move changes.
 *
 * #orb / .orb-wrap keeps its original size, position, and tap-to-start
 * click/keydown handlers from app.js completely unchanged — only what's
 * drawn INSIDE it (on the <canvas>) is new. app.js redraws it every
 * animation frame: a calm near-flat tide at idle, the REAL microphone
 * waveform (Web Audio AnalyserNode time-domain data) shaping the tides
 * while listening, a slower/lower-amplitude synthetic wave while thinking,
 * and Marea's own REAL output-audio amplitude shaping the tides while she's
 * speaking — same analyser technique as before, tapped off the existing
 * mic stream / remote <audio> element, no change to the WebRTC/session
 * code that creates them.
 */
.voice-line {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.voice-canvas { width: 100%; height: 100%; display: block; }

.orb-hint { font-size: 12.5px; color: var(--text-tertiary); text-align: center; letter-spacing: 0.01em; transition: font-size 0.4s ease; }

/* Live wake-word diagnostic line — deliberately visible on the main screen
 * (not just DevTools console) so "did it hear me, and as what?" is
 * answerable by looking at the page itself while testing, without needing
 * to open Settings or the console. Small and muted so it reads as a status
 * line, not a UI element competing with the hint above it. */
.wake-debug-line {
  margin-top: 4px;
  font-size: 11px;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  color: var(--text-tertiary);
  text-align: center;
  letter-spacing: 0;
  max-width: 90vw;
  overflow-wrap: break-word;
}
.wake-debug-line.is-match { color: var(--seafoam-strong, var(--seafoam)); font-weight: 600; }
.wake-debug-line.is-error { color: var(--danger); }

/* ---- transcript / captions ---------------------------------------------- */
.error-banner {
  width: min(680px, 100%);
  background: var(--danger-bg);
  border: 1px solid rgba(229,98,74,0.4);
  color: var(--danger-text);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 12px;
  line-height: 1.5;
  display: none;
  align-items: flex-start;
  gap: 10px;
}
.error-banner.show { display: flex; }
.error-banner-icon { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--danger); }

.caption-panel {
  width: min(680px, 100%);
  min-height: 110px;
  background: var(--glass-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  backdrop-filter: blur(6px);
  transition: border-color 0.4s ease, width 0.4s ease;
}
.caption-role { font-size: 10.5px; color: var(--text-tertiary); margin-bottom: 8px; letter-spacing: 0.04em; text-transform: uppercase; font-weight: 600; }
.caption-role.you { color: var(--seafoam); }
.caption-role.sme { color: var(--coral); }
/* 2026-09-15: switched from --font-display (Fraunces, a serif display face)
   to Inter at a smaller size, scoped to just this element per explicit
   request — the spoken-conversation text specifically read as too large/
   too "editorial" next to the rest of the UI's sans-serif chrome. */
.caption-text { font-family: var(--font-transcript); font-size: 15px; line-height: 1.6; color: var(--text-primary); font-weight: 400; letter-spacing: -0.001em; transition: font-size 0.4s ease; }
.caption-text .cite { color: var(--coral); font-size: 12.5px; font-family: var(--font-ui); vertical-align: super; }
.caption-empty { color: var(--text-tertiary); font-family: var(--font-ui); font-size: 13px; }

.followups { display: flex; width: min(680px, 100%); gap: 10px; flex-wrap: wrap; justify-content: center; opacity: 0; max-height: 0; overflow: hidden; transition: opacity 0.4s ease, width 0.4s ease; }
.followups.show { opacity: 1; max-height: 60px; }
.followup-chip { font-family: var(--font-ui); font-size: 12px; color: var(--text-primary); background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 100px; padding: 9px 18px; transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease; }
.followup-chip:hover { border-color: var(--coral); background: var(--bg-elevated-hover); transform: translateY(-1px); }
.followup-chip:active { transform: translateY(0); }

/* ---- evidence dock ------------------------------------------------------- */
.evidence-dock {
  flex: none;
  width: 360px;
  border-left: 1px solid var(--border-subtle);
  background: var(--glass-dock);
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  transition: width 0.4s ease, padding 0.4s ease, opacity 0.4s ease, border-color 0.4s ease;
}
.evidence-head { display: flex; align-items: center; gap: 10px; }
.evidence-head-icon { width: 18px; height: 18px; color: var(--seafoam); flex: none; }
.evidence-head h2 { margin: 0; font-family: var(--font-ui); font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-secondary); }
.evidence-empty { margin: 0; font-size: 12.5px; line-height: 1.6; color: var(--text-tertiary); }

.evidence-list { display: flex; flex-direction: column; gap: 10px; }
.source-item {
  border: 1px solid var(--border);
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  animation: source-in 0.3s ease both;
}
@keyframes source-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.source-item-icon { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.source-item.is-grounded .source-item-icon { color: var(--seafoam); }
.source-item.is-caution .source-item-icon { color: var(--coral); }
.source-item.is-unavailable .source-item-icon { color: var(--text-tertiary); }
.source-item-body { min-width: 0; }
/* Requirement #4 (Vengat feedback): the quoted phrase in the new
   research-paper-style reference — "<quote>" above the Author, Title
   (p. N) line rendered by .source-doc/.source-page below. */
.source-quote { display: block; font-size: 12.5px; font-style: italic; color: var(--text-primary); line-height: 1.5; margin-bottom: 4px; word-break: break-word; }
.source-doc { font-size: 12px; font-weight: 600; color: var(--text-primary); line-height: 1.4; word-break: break-word; }
.source-page { display: inline-block; margin-left: 6px; font-size: 10.5px; font-weight: 600; color: var(--seafoam); background: var(--seafoam-dim); border-radius: 100px; padding: 1px 8px; vertical-align: middle; }
.source-subject { font-size: 11px; color: var(--text-tertiary); margin-top: 4px; line-height: 1.5; }
.source-note { font-size: 11px; color: var(--text-tertiary); margin-top: 4px; line-height: 1.5; font-style: italic; }

/* ---- presentation mode --------------------------------------------------
 * A conference/keynote-demo mode: the left sidebar, the top header, and the
 * right evidence dock all collapse away (smoothly, not a hard cut) so the
 * voice tides become the entire viewport. Toggled by adding/removing the
 * `presentation-mode` class on #app (see app.js) — every rule below is
 * scoped under that one class so nothing here can leak into normal use, and
 * every element it touches already has its own transition (added above)
 * so this reads as a deliberate collapse/expand, not a flash.
 *
 * The voice states/visualization themselves are completely untouched here —
 * only their size and surrounding chrome change, per the brief's explicit
 * "preserve the existing voice visualization behavior."
 */
.app.presentation-mode .sidebar {
  width: 0;
  padding-left: 0;
  padding-right: 0;
  opacity: 0;
  border-color: transparent;
  pointer-events: none;
}
.app.presentation-mode .sidebar-backdrop { display: none; }
.app.presentation-mode .app-header {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  border-color: transparent;
  pointer-events: none;
}
.app.presentation-mode .evidence-dock {
  width: 0;
  padding-left: 0;
  padding-right: 0;
  opacity: 0;
  border-color: transparent;
  overflow: hidden;
  pointer-events: none;
}

/* The stage itself gets full-viewport breathing room and a larger, more
 * "keynote" scale — clamp()'d to vmin so it scales gracefully from a laptop
 * preview up to an actual conference-room projector resolution without
 * needing separate breakpoints. */
.app.presentation-mode .voice-stage { padding: 6vh 6vw; gap: 4vh; }
.app.presentation-mode .orb-wrap {
  width: clamp(340px, 62vmin, 820px);
  height: clamp(150px, 20vmin, 260px);
  transition: width 0.4s ease, height 0.4s ease;
}
.app.presentation-mode .orb-hint { font-size: clamp(14px, 1.3vmin, 18px); }
.app.presentation-mode .caption-panel { width: min(860px, 88vw); }
.app.presentation-mode .caption-text { font-size: clamp(19px, 2vmin, 26px); }
.app.presentation-mode .followups { width: min(860px, 88vw); }

/* Exit control — a small, unobtrusive floating pill, top-right. Present in
 * the DOM at all times but only shown while presentation mode is active. */
.present-exit-btn {
  display: none;
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 50;
  align-items: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 9px 16px 9px 12px;
  opacity: 0.55;
  transition: opacity 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.present-exit-btn svg { width: 15px; height: 15px; flex: none; }
.present-exit-btn:hover,
.present-exit-btn:focus-visible { opacity: 1; border-color: var(--seafoam); color: var(--text-primary); }
.present-exit-kbd {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-tertiary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
}
.app.presentation-mode .present-exit-btn { display: flex; }

@media (max-width: 640px) {
  .present-exit-btn span:not(.present-exit-kbd) { display: none; }
  .present-exit-btn { padding: 9px; }
  .app.presentation-mode .voice-stage { padding: 8vh 5vw; }
}

/* ---- workspaces: analytics / document / about -------------------------- */
.workspace {
  position: absolute; inset: 0;
  /* Fully opaque, not translucent — these are dedicated full-screen
     workspace views, not a hint-of-background popup. A near-opaque
     (e.g. 0.98) background still lets bright content behind it ghost
     through faintly; opaque-stop gradient avoids that entirely while
     keeping the subtle depth. Built from theme tokens (both --bg-deep and
     --bg-void are solid hex in both themes, so this stays just as opaque
     as the literal hex pair it replaces) so it re-themes correctly in
     Light mode instead of always rendering the dark gradient. */
  background: linear-gradient(180deg, var(--bg-deep), var(--bg-void));
  display: flex; flex-direction: column;
  opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(10px);
  /* visibility flips to hidden only once the fade-out finishes, so a
     "closed" workspace is never composited (and can never ghost behind
     whichever workspace opens next) once at rest. */
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0s linear 0.35s;
  z-index: 5;
}
.workspace.show {
  opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(0);
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0s linear 0s;
}

.workspace-head {
  flex: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 36px;
  border-bottom: 1px solid var(--border-subtle);
}
.workspace-head-title { display: flex; align-items: center; gap: 14px; min-width: 0; }
.workspace-head-icon {
  flex: none; width: 42px; height: 42px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--seafoam);
}
.workspace-head-icon svg { width: 20px; height: 20px; }
.workspace-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-tertiary); margin-bottom: 3px; }
.workspace-title { font-family: var(--font-display); font-size: 19px; font-weight: 500; margin: 0; color: var(--text-primary); letter-spacing: -0.008em; }
.workspace-close {
  display: flex; align-items: center; gap: 7px;
  font-size: 11.5px; font-weight: 500; color: var(--text-tertiary);
  background: none; border: 1px solid var(--border); border-radius: 100px;
  padding: 8px 16px;
}
.workspace-close svg { width: 14px; height: 14px; }
.workspace-close:hover { color: var(--text-primary); border-color: var(--coral); }

.workspace-body { flex: 1; min-height: 0; overflow-y: auto; padding: 28px 36px 36px; display: flex; flex-direction: column; align-items: center; }
.workspace-sub { font-size: 12.5px; color: var(--text-secondary); margin-bottom: 22px; line-height: 1.55; max-width: 640px; text-align: center; }

/* analytics workspace */
.chart-canvas {
  width: min(760px, 100%);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  display: flex; align-items: center; justify-content: center;
  min-height: 340px;
  position: relative;
}
.chart-caption { text-align: center; font-size: 11.5px; color: var(--text-tertiary); margin-top: 14px; max-width: 640px; }

.chart-badge {
  position: absolute; top: 16px; left: 16px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-tertiary); background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 100px; padding: 4px 11px;
}

.chart-empty {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  color: var(--text-tertiary); font-size: 13px; max-width: 440px; text-align: center;
  padding: 20px;
}
.chart-empty svg { width: 30px; height: 30px; color: var(--text-tertiary); opacity: 0.8; }

/* document workspace */
.report-page {
  width: min(680px, 100%);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 34px 38px;
}
.report-kicker { font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--coral); margin-bottom: 12px; }
.report-title { font-family: var(--font-display); font-size: 20px; font-weight: 500; margin: 0 0 16px; color: var(--text-primary); letter-spacing: -0.008em; }
.report-body { font-size: 14px; line-height: 1.7; color: var(--text-secondary); margin-bottom: 20px; white-space: pre-wrap; }
.report-body .cite { color: var(--coral); font-weight: 600; }
.report-refs { border-top: 1px solid var(--border); padding-top: 16px; font-size: 12px; color: var(--text-tertiary); line-height: 1.8; }

.report-action-bar { width: min(680px, 100%); display: flex; gap: 12px; margin-top: 20px; }
.export-btn {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  font-size: 12.5px; font-weight: 600; padding: 12px 18px;
  border-radius: var(--radius-md); border: 1px solid var(--border);
  background: var(--bg-elevated); color: var(--text-primary);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}
.export-btn .btn-icon { width: 17px; height: 17px; color: var(--seafoam); flex: none; }
.export-btn:hover:not(:disabled) { border-color: var(--seafoam); background: var(--bg-elevated-hover); transform: translateY(-1px); }
.export-btn:active:not(:disabled) { transform: translateY(0); }
.export-btn:disabled { color: var(--text-tertiary); background: var(--bg-surface); cursor: not-allowed; }
.export-btn:disabled .btn-icon { color: var(--text-tertiary); }

.report-action-bar + .error-banner { width: min(680px, 100%); margin-top: 14px; }

/* about */
.about-card { width: min(640px, 100%); }
.about-card p { font-size: 13px; line-height: 1.7; color: var(--text-secondary); margin: 0 0 14px; }
.about-card .about-heading { font-family: var(--font-display); font-size: 18px; color: var(--text-primary); margin-bottom: 16px; letter-spacing: -0.005em; }
.about-card .about-subhead { font-family: var(--font-ui); font-weight: 700; font-size: 12px; letter-spacing: 0.03em; text-transform: uppercase; color: var(--coral); margin-top: 22px; margin-bottom: 10px; }

/* ---- views: Conversations / Knowledge Base / Settings --------------------
 * Inline panels (not full-screen overlays like the chart/report/about
 * workspaces above) — they replace the voice-stage+evidence-dock content
 * area while a sidebar item other than Voice Assistant is active, switched
 * instantly via the `hidden` attribute (see app.js's switchView) rather
 * than the workspace overlays' fade, since these are peer navigation
 * destinations, not a modal takeover.
 */
.view-panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 32px 40px 40px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}
.view-head { max-width: 720px; }
.view-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-tertiary); margin-bottom: 7px; }
.view-title { font-family: var(--font-display); font-size: 22px; font-weight: 500; margin: 0 0 10px; color: var(--text-primary); letter-spacing: -0.01em; }
.view-desc { font-size: 13px; line-height: 1.6; color: var(--text-secondary); margin: 0; }
.view-empty { font-size: 12.5px; color: var(--text-tertiary); line-height: 1.6; }

/* Conversations */
.conversations-layout { flex: 1; min-height: 0; display: flex; gap: 20px; }
.conversations-list { flex: 1; min-width: 0; max-width: 520px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.conversation-row {
  display: flex; flex-direction: column; gap: 4px;
  text-align: left; width: 100%;
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 14px 16px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.conversation-row:hover { border-color: var(--seafoam); background: var(--bg-elevated-hover); }
.conversation-row-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.conversation-row-meta { font-size: 11.5px; color: var(--text-tertiary); display: flex; gap: 10px; }
.conversation-row-delete {
  align-self: flex-end; margin-top: 2px;
  font-size: 11px; color: var(--text-tertiary); background: none; border: none; padding: 2px 4px;
}
.conversation-row-delete:hover { color: var(--danger); }

.conversation-detail { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.conversation-back { display: flex; align-items: center; gap: 8px; align-self: flex-start; font-size: 12px; color: var(--text-tertiary); background: none; border: 1px solid var(--border); border-radius: 100px; padding: 7px 14px; }
.conversation-back:hover { color: var(--text-primary); border-color: var(--seafoam); }
.conversation-back svg { width: 14px; height: 14px; }
.conversation-detail-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.conversation-detail-head h2 { font-family: var(--font-display); font-size: 17px; font-weight: 500; margin: 0; color: var(--text-primary); letter-spacing: -0.005em; }
.conversation-detail-date { font-size: 12px; color: var(--text-tertiary); }
.conversation-transcript { display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.transcript-line { max-width: 640px; border-radius: var(--radius-md); padding: 12px 16px; font-size: 13px; line-height: 1.6; }
.transcript-line.role-user { align-self: flex-end; background: var(--seafoam-dim); color: var(--text-primary); }
.transcript-line.role-marea { align-self: flex-start; background: var(--bg-surface); border: 1px solid var(--border); color: var(--text-primary); }
.transcript-line-role { display: block; font-size: 10px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-tertiary); margin-bottom: 4px; }

/* Knowledge Base */
.kb-card {
  display: flex; align-items: flex-start; gap: 16px;
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px 24px; max-width: 720px;
}
.kb-card-icon {
  flex: none; width: 40px; height: 40px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-elevated); border: 1px solid var(--border); color: var(--seafoam);
}
.kb-card-icon svg { width: 19px; height: 19px; }
.kb-card-body { flex: 1; min-width: 0; }
.kb-card-title { font-size: 13.5px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.kb-card-sub { font-size: 12px; color: var(--text-tertiary); line-height: 1.55; }
.kb-card-badge {
  flex: none; align-self: center;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  border-radius: 100px; padding: 5px 12px;
}
.kb-card-badge.is-grounded { color: var(--seafoam); background: var(--seafoam-dim); }

.kb-upload-form { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.kb-upload-form input[type="file"] { font-size: 12px; color: var(--text-secondary); max-width: 100%; }
.kb-upload-btn { flex: none; padding: 9px 18px; font-size: 12px; }
.kb-upload-status { margin-top: 10px; font-size: 12px; line-height: 1.5; }
.kb-upload-status.is-error { color: var(--danger); }
.kb-upload-status.is-success { color: var(--seafoam); }
.kb-upload-status.is-pending { color: var(--text-tertiary); }

.kb-documents { max-width: 720px; }
.kb-documents-head { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-tertiary); margin-bottom: 10px; }
.kb-documents-list { display: flex; flex-direction: column; gap: 8px; }
.kb-document-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 12px 16px;
}
.kb-document-info { flex: 1; min-width: 0; }
.kb-document-name { font-size: 12.5px; font-weight: 600; color: var(--text-primary); word-break: break-word; }
.kb-document-meta { font-size: 11.5px; color: var(--text-tertiary); margin-top: 2px; }
.kb-document-delete { flex: none; font-size: 11.5px; color: var(--text-tertiary); background: none; border: 1px solid var(--border); border-radius: 100px; padding: 6px 12px; }
.kb-document-delete:hover { color: var(--danger); border-color: var(--danger); }

/* Settings */
.settings-card {
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 24px 28px; max-width: 520px;
}
.settings-card-title { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.settings-card-sub { font-size: 12px; color: var(--text-tertiary); line-height: 1.55; margin-bottom: 16px; }
.theme-toggle { display: flex; gap: 8px; }
.theme-option {
  flex: 1; font-size: 12px; font-weight: 600; color: var(--text-secondary);
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 100px; padding: 9px 0;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.theme-option:hover { border-color: var(--seafoam); color: var(--text-primary); }
.theme-option.active { color: var(--seafoam); border-color: var(--seafoam); background: var(--seafoam-dim); }
.voice-select {
  width: 100%; font-family: var(--font-ui); font-size: 12.5px; color: var(--text-primary);
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.voice-select:disabled { color: var(--text-tertiary); cursor: not-allowed; }
.settings-note { margin-top: 10px; font-size: 12px; color: var(--seafoam); min-height: 1.4em; }
.settings-note.is-error { color: var(--danger); }

/* Wake-word toggle switch (Settings — Voice activation) */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  position: relative; flex: none; width: 40px; height: 22px; border-radius: 100px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  transition: background 0.2s ease, border-color 0.2s ease;
}
.switch-track::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--text-tertiary); transition: transform 0.2s ease, background 0.2s ease;
}
.switch input:checked + .switch-track { background: var(--seafoam-dim); border-color: var(--seafoam); }
.switch input:checked + .switch-track::after { transform: translateX(18px); background: var(--seafoam); }
.switch input:disabled + .switch-track { opacity: 0.5; cursor: not-allowed; }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--focus); outline-offset: 3px; }
.switch-label { font-size: 12.5px; color: var(--text-primary); font-weight: 500; }

/* ---- responsive: tablet & mobile ---------------------------------------- */
@media (max-width: 1023px) {
  .app-main { flex-direction: column; overflow-y: auto; }
  .voice-stage { padding: 20px 24px; flex: none; }
  .evidence-dock { width: auto; border-left: none; border-top: 1px solid var(--border-subtle); }
  .app-shell { overflow-y: auto; }
  body { overflow: auto; }
  .conversations-layout { flex-direction: column; }
  .conversations-list { max-width: none; }
}

/* Below this width the sidebar becomes an off-canvas drawer (toggled fully
   open/closed by the hamburger) instead of a persistent icon rail — a
   72px-wide always-on rail eats too much of a phone screen's width from
   the Voice Assistant, which must stay the dominant experience. */
@media (max-width: 768px) {
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; height: 100dvh; width: 232px;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 24px 0 48px rgba(0,0,0,0.35);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar .sidebar-item-label { display: inline; }
  .sidebar .sidebar-item { justify-content: flex-start; padding: 12px 22px; }
  /* The mobile drawer is always shown at its full 232px width — regardless
     of the persisted "expanded" preference — so the brand mark should match
     the expanded (left-aligned, larger, full-wordmark) sizing rather than
     the icon-only rail one. */
  .sidebar .sidebar-brand { justify-content: flex-start; padding: 0 22px; }
  .sidebar .sidebar-brand-badge { max-width: 168px; padding: 8px 12px; }
  .sidebar .sidebar-brand-logo-icon { display: none; }
  .sidebar .sidebar-brand-logo-full { display: block; }
}

@media (max-width: 640px) {
  .app-header { padding: 14px 16px; }
  .brand-sub { display: none; }
  .icon-btn-label { display: none; }
  .icon-btn { padding: 9px; }
  .header-controls { gap: 8px; }
  .orb-wrap { width: min(320px, 90vw); height: 130px; }
  .caption-text { font-size: 16.5px; }
  .workspace-head { padding: 16px 18px; }
  .workspace-body { padding: 20px 18px 28px; }
  .workspace-head-icon { width: 36px; height: 36px; }
  .workspace-title { font-size: 17px; }
  .report-page { padding: 24px 22px; }
  .chart-canvas { padding: 18px; min-height: 280px; }
  .report-action-bar { flex-direction: column; }
  .workspace-close span { display: none; }
  .view-panel { padding: 20px 18px 28px; }
  .view-title { font-size: 19px; }
  .kb-card { flex-direction: column; }
  .kb-card-badge { align-self: flex-start; }
  .settings-card { max-width: none; }
  .theme-toggle { flex-direction: column; }
}
