:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --panel: #12161b;
  --panel-2: #191f26;
  --line: #29323c;
  --muted: #8b98a5;
  --text: #f6f7f8;
  --lime: #d7ff55;
  --orange: #ff784b;
  --cyan: #62d9ff;
  --green: #55e69d;
  --red: #ff5f68;
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.shell { min-height: 100vh; padding: 22px 24px 90px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; color: #0a0d09; background: var(--lime); border-radius: 12px; font-weight: 900; }
.brand h1 { font-size: 18px; margin: 0; letter-spacing: -.02em; }
.brand p { color: var(--muted); font-size: 12px; margin: 3px 0 0; }
.status-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.pill { border: 1px solid var(--line); padding: 7px 10px; border-radius: 999px; color: var(--muted); font-size: 12px; background: rgba(255,255,255,.02); }
.pill.live { color: var(--green); border-color: rgba(85,230,157,.35); }

.controls { background: #11151a; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; display: grid; gap: 14px; }
.controls-main { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.file-label { flex: 1 1 280px; min-height: 46px; border: 1px dashed #3b4652; border-radius: 12px; display: flex; align-items: center; gap: 10px; padding: 0 14px; color: var(--muted); overflow: hidden; }
.file-label input { display: none; }
.file-label strong { color: var(--text); white-space: nowrap; }
.file-label span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn { border: 0; border-radius: 12px; padding: 12px 16px; color: var(--text); background: var(--panel-2); font-weight: 700; }
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: var(--lime); color: #10130b; }
.btn.danger { background: #321b20; color: #ffadb1; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.settings-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.settings-title strong { font-size: 13px; }
.settings-title span { color: var(--muted); font-size: 11px; }
.settings { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(220px, .8fr) repeat(3, minmax(120px, .45fr)); gap: 10px; }
.settings-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.settings-actions span { color: var(--green); font-size: 12px; }
.field { display: grid; gap: 6px; }
.field label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.field input, .field select, .field textarea { width: 100%; color: var(--text); background: #0d1115; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; outline: none; }
.field input:focus, .field textarea:focus { border-color: var(--lime); }
.audio { width: 100%; height: 36px; }

.workspace { display: grid; gap: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.panel-head { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel-head h2 { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.panel-body { padding: 16px; }
.empty { min-height: 160px; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 28px; }
.empty b { display: block; color: var(--text); margin-bottom: 6px; }

.metric-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.metric { background: var(--panel-2); padding: 12px; border-radius: 12px; }
.metric span { display: block; font-size: 11px; color: var(--muted); margin-bottom: 7px; }
.metric strong { font-size: 22px; letter-spacing: -.04em; }
.metric small { color: var(--muted); margin-left: 4px; }
.progress { height: 5px; background: #202832; border-radius: 99px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--lime); transition: width .25s linear; }

.timeline { display: grid; gap: 10px; max-height: 620px; overflow: auto; }
.event { display: grid; grid-template-columns: 58px 10px 1fr; gap: 9px; align-items: start; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.05); }
.event:last-child { border-bottom: 0; }
.time { font: 700 12px ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--muted); padding-top: 2px; }
.dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; background: var(--cyan); box-shadow: 0 0 0 4px rgba(98,217,255,.09); }
.event.hint .dot { background: var(--lime); box-shadow: 0 0 0 4px rgba(215,255,85,.1); }
.event.risk .dot { background: var(--red); box-shadow: 0 0 0 4px rgba(255,95,104,.1); }
.event.processed { opacity: .58; }
.event.processed .dot { background: var(--muted); }
.event p { margin: 0; line-height: 1.45; font-size: 13px; }
.event .speaker { font-weight: 800; margin-right: 5px; }
.event .meta { margin-top: 7px; color: var(--muted); font-size: 11px; }

.hero-hint { padding: 24px; min-height: 280px; display: flex; flex-direction: column; justify-content: space-between; background: radial-gradient(circle at 90% 0%, rgba(215,255,85,.09), transparent 36%), var(--panel); }
.hint-kicker { display: flex; align-items: center; gap: 8px; color: var(--lime); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.hint-text { font-size: clamp(24px, 3vw, 44px); letter-spacing: -.045em; line-height: 1.06; margin: 24px 0; max-width: 850px; }
.hint-reason { color: #b8c1c9; line-height: 1.55; max-width: 780px; }
.source-card { margin-top: 18px; background: rgba(0,0,0,.22); border-left: 3px solid var(--lime); border-radius: 8px; padding: 12px 14px; color: var(--muted); font-size: 12px; }
.source-card strong { color: var(--text); display: block; margin-bottom: 4px; }

.latency-stack { display: grid; gap: 8px; }
.latency-row { display: grid; grid-template-columns: 90px 1fr 64px; gap: 8px; align-items: center; font-size: 12px; }
.latency-row span { color: var(--muted); }
.latency-bar { height: 8px; border-radius: 99px; background: #212933; overflow: hidden; }
.latency-bar i { height: 100%; display: block; background: var(--cyan); border-radius: inherit; }
.latency-row strong { text-align: right; }

/* A: dense three-column control room */
.variant-a .workspace { grid-template-columns: minmax(250px, .8fr) minmax(420px, 1.7fr) minmax(230px, .7fr); align-items: start; }

/* B: timeline is the product; recommendations sit directly on it */
.variant-b { background: linear-gradient(180deg, #0d1014, #080a0d); }
.variant-b .workspace { grid-template-columns: minmax(0, 1fr) 320px; max-width: 1400px; margin: 0 auto; }
.variant-b .timeline { max-height: none; }
.variant-b .event { grid-template-columns: 74px 14px minmax(0,1fr); padding: 18px 10px; }
.variant-b .event.hint { background: rgba(215,255,85,.04); border: 1px solid rgba(215,255,85,.16); border-radius: 14px; padding: 16px; }
.variant-b .event p { font-size: 15px; }
.variant-b .hero-hint { min-height: 220px; }

/* C: transcript-first analyst workbench */
.variant-c { background: #ebe9e2; color: #171813; --panel: #f8f7f2; --panel-2: #eeece5; --line: #d3d0c6; --muted: #6e7069; --text: #171813; }
.variant-c .controls, .variant-c .field input, .variant-c .field select { background: #f8f7f2; }
.variant-c .workspace { grid-template-columns: minmax(380px, 1.3fr) minmax(360px, 1fr); max-width: 1500px; margin: 0 auto; }
.variant-c .hero-hint { background: #181b17; color: white; }
.variant-c .hint-reason, .variant-c .source-card { color: #bfc6bc; }
.variant-c .source-card strong { color: white; }
.variant-c .event { border-color: #dedbd2; }
.variant-c .pill { background: rgba(255,255,255,.5); }

.error { color: #ff9ca2; background: rgba(255,95,104,.08); border: 1px solid rgba(255,95,104,.25); padding: 10px 12px; border-radius: 10px; font-size: 12px; }
.debug { margin-top: 16px; }
.debug summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.debug pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 11px; color: var(--muted); background: #090c0f; padding: 14px; border-radius: 12px; max-height: 260px; overflow: auto; }
.variant-switcher { position: fixed; z-index: 50; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; padding: 7px; color: white; background: #050607; border: 1px solid #3a4148; border-radius: 999px; box-shadow: 0 12px 45px rgba(0,0,0,.45); }
.variant-switcher button { width: 36px; height: 36px; border-radius: 50%; border: 0; color: white; background: #20252b; }
.variant-switcher span { min-width: 170px; text-align: center; font-size: 12px; font-weight: 800; }

@media (max-width: 1100px) {
  .variant-a .workspace, .variant-b .workspace, .variant-c .workspace { grid-template-columns: 1fr; }
  .settings { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 680px) {
  .shell { padding: 14px 12px 86px; }
  .topbar { align-items: flex-start; }
  .status-row { display: none; }
  .settings { grid-template-columns: 1fr; }
  .hint-text { font-size: 28px; }
}
