/* Kapture transcription demo.
   Tokens come from the Kapture web app: DM Sans, the raspberry highlight, violet secondary,
   10px radius, light and dark themes. The console layout (top bar, telemetry strip, three columns) is unchanged. */

:root,
:root[data-theme="light"] {
  --page:        #f9f9f9;
  --surface:     #ffffff;
  --surface-2:   #f4f5f8;
  --ink:         #343b4f;
  --ink-soft:    #757b8d;
  --ink-faint:   #a3a9b8;
  --line:        #e0e3ed;
  --line-strong: #c9cfe0;

  --brand:       #c23469;                      /* highlight */
  --brand-text:  #c23469;
  --brand-tint:  rgba(194, 52, 105, 0.12);
  --brand-line:  rgba(194, 52, 105, 0.45);
  --violet:      #9333ea;                      /* highlight-secondary */
  --violet-text: #7e22ce;
  --violet-tint: rgba(147, 51, 234, 0.10);
  --violet-line: rgba(147, 51, 234, 0.40);
  --meter-1:     #b08fff;
  --amber:       #b45309;
  --amber-tint:  rgba(245, 158, 11, 0.14);
  --amber-line:  rgba(180, 83, 9, 0.40);
  --danger:      #dc2626;
  --danger-tint: rgba(220, 38, 38, 0.09);
  --ok:          #15803d;
  --ok-tint:     rgba(21, 128, 61, 0.10);

  --shadow-card: 0 1px 2px rgba(52, 59, 79, 0.06), 0 8px 24px -12px rgba(52, 59, 79, 0.18);
  --glass:       rgba(255, 255, 255, 0.78);
  --glass-line:  rgba(194, 52, 105, 0.50);
  --auth-bg:     url("/static/img/auth-light.jpg");
  --radius:      10px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --page:        #1d1c1c;
  --surface:     #25272c;
  --surface-2:   #2d3037;
  --ink:         #fafafa;
  --ink-soft:    #aeb9e1;
  --ink-faint:   #7b86a6;
  --line:        rgba(134, 146, 166, 0.28);
  --line-strong: rgba(134, 146, 166, 0.5);

  --brand:       #c23469;
  --brand-text:  #f06c9b;
  --brand-tint:  rgba(194, 52, 105, 0.26);
  --brand-line:  rgba(240, 108, 155, 0.55);
  --violet:      #b08fff;
  --violet-text: #c4adff;
  --violet-tint: rgba(176, 143, 255, 0.16);
  --violet-line: rgba(176, 143, 255, 0.5);
  --meter-1:     #b08fff;
  --amber:       #fbbf24;
  --amber-tint:  rgba(251, 191, 36, 0.14);
  --amber-line:  rgba(251, 191, 36, 0.45);
  --danger:      #ff8a80;
  --danger-tint: rgba(255, 138, 128, 0.12);
  --ok:          #5fd49a;
  --ok-tint:     rgba(95, 212, 154, 0.12);

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px -12px rgba(0, 0, 0, 0.6);
  --glass:       rgba(29, 28, 28, 0.74);
  --glass-line:  rgba(240, 108, 155, 0.45);
  --auth-bg:     url("/static/img/auth-dark.jpg");
  color-scheme: dark;
}

:root {
  --font:    "DM Sans", Roboto, Arial, sans-serif;
  --console: "Courier New", ui-monospace, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
*::selection { background: var(--brand); color: #fff; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
body { display: flex; flex-direction: column; }
button, input, select, textarea { font-family: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }

.icon { width: 1.15em; height: 1.15em; flex: 0 0 auto; }

/* ─── Top bar ──────────────────────────────────────────────────────── */
.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 24px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: relative;
}
.topbar::after {            /* the app's violet-to-raspberry gradient, as a hairline */
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(to right, var(--violet), var(--brand));
  opacity: 0.55;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logo { width: 40px; height: 40px; flex: 0 0 auto; }
.brand-stack { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.brand-name { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.brand-sub { font-size: 12px; color: var(--ink-soft); }

.meta-row { display: flex; align-items: center; gap: 28px; min-width: 0; padding-left: 24px; border-left: 1px solid var(--line); }
.meta-block { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.meta-key { font-size: 11px; color: var(--ink-soft); }
.meta-val { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#health[data-state="ready"] .meta-val { color: var(--ok); }
#health[data-state="warming"] .meta-val { color: var(--amber); }
#health[data-state="down"] .meta-val { color: var(--danger); }

.state-pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; min-width: 132px; padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 13px; font-weight: 600; color: var(--ink-soft);
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.state-pill .state-bar { display: none; }
.state-pill .state-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-faint); }
.state-pill .state-label { flex: 1; text-align: center; }
.state-pill[data-state="ready"] { color: var(--violet-text); border-color: var(--violet-line); background: var(--violet-tint); }
.state-pill[data-state="ready"] .state-dot { background: var(--violet); }
.state-pill[data-state="decoding"], .state-pill[data-state="connecting"], .state-pill[data-state="finishing"] { color: var(--amber); border-color: var(--amber-line); background: var(--amber-tint); }
.state-pill[data-state="decoding"] .state-dot, .state-pill[data-state="connecting"] .state-dot, .state-pill[data-state="finishing"] .state-dot { background: var(--amber); animation: pulse 1s ease-in-out infinite; }
.state-pill[data-state="live"] { color: var(--brand-text); border-color: var(--brand-line); background: var(--brand-tint); }
.state-pill[data-state="live"] .state-dot { background: var(--brand); animation: pulse 0.7s ease-in-out infinite; }
.state-pill[data-state="done"] { color: var(--ok); border-color: var(--ok); background: var(--ok-tint); }
.state-pill[data-state="done"] .state-dot { background: var(--ok); }
.state-pill[data-state="error"] { color: var(--danger); border-color: var(--danger); background: var(--danger-tint); }
.state-pill[data-state="error"] .state-dot { background: var(--danger); }
@keyframes pulse { 50% { opacity: 0.4; transform: scale(0.8); } }

.controls { display: flex; gap: 8px; align-items: center; }
.controls form { margin: 0; }

/* ─── Buttons (the app's pattern: tinted outline that fills on hover) ─ */
.btn {
  appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.06s ease;
}
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.primary { border-color: var(--brand); background: var(--brand-tint); color: var(--brand-text); }
.btn.primary:hover:not(:disabled) { background: var(--brand); color: #fff; }
.btn.danger { border-color: var(--danger); background: var(--danger-tint); color: var(--danger); }
.btn.danger:hover:not(:disabled) { background: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-soft); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.icon-btn { width: 36px; padding: 0; }

/* ─── Telemetry strip ──────────────────────────────────────────────── */
.telemetry {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 24px;
  align-items: stretch;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.tele-group { display: flex; gap: 12px; align-items: center; }
.tele-group.meters { flex-direction: column; gap: 8px; align-items: stretch; justify-content: center; min-width: 0; }
.tele-group.vad-stack { gap: 8px; padding-left: 20px; border-left: 1px solid var(--line); flex-wrap: wrap; }
.tele-group.latency { padding-left: 20px; border-left: 1px solid var(--line); display: grid; grid-template-columns: repeat(3, auto); gap: 8px; }

.meter-row { display: grid; grid-template-columns: 72px 1fr 40px; align-items: center; gap: 12px; }
.meter-label { font-size: 12px; font-weight: 500; color: var(--ink-soft); }
.meter { display: flex; gap: 3px; height: 12px; align-items: stretch; }
.meter .seg { flex: 1; background: var(--surface-2); border-radius: 3px; transition: background 0.05s linear; }
#meter-0 .seg.lit-green { background: var(--brand); }
#meter-1 .seg.lit-green { background: var(--meter-1); }
.meter .seg.lit-amber { background: #f59e0b; }
.meter .seg.lit-red { background: #ef4444; }
.meter-readout { text-align: right; font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.vad-indicator {
  display: inline-flex; align-items: center; gap: 8px;
  height: 30px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface-2);
  font-size: 12px; font-weight: 500; color: var(--ink-soft);
  transition: all 0.2s ease;
}
.vad-indicator .vad-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-faint); }
.vad-indicator[data-active="true"] { color: var(--brand-text); border-color: var(--brand-line); background: var(--brand-tint); }
.vad-indicator[data-active="true"] .vad-dot { background: var(--brand); animation: pulse 0.6s ease-in-out infinite; }
.vad-indicator[data-role="customer"][data-active="true"], .vad-indicator[data-role="you"][data-active="true"] { color: var(--violet-text); border-color: var(--violet-line); background: var(--violet-tint); }
.vad-indicator[data-role="customer"][data-active="true"] .vad-dot, .vad-indicator[data-role="you"][data-active="true"] .vad-dot { background: var(--violet); }

.turn-tag { display: inline-flex; align-items: baseline; gap: 6px; padding: 4px 0; }
.tag-key { font-size: 12px; color: var(--ink-soft); }
.tag-val { font-size: 13px; font-weight: 600; }

.lat-cell {
  display: flex; flex-direction: column;
  min-width: 96px; padding: 8px 14px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface);
}
.lat-key { font-size: 12px; color: var(--ink-soft); }
.lat-val { font-size: 22px; font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.lat-unit { font-size: 11px; color: var(--ink-faint); }
.lat-cell.highlight { border-color: var(--brand-line); background: var(--brand-tint); }
.lat-cell.highlight .lat-val { color: var(--brand-text); }
.lat-cell.flash { animation: lat-flash 0.7s ease-out; }
@keyframes lat-flash { 0% { box-shadow: 0 0 0 3px var(--brand-line); } 100% { box-shadow: 0 0 0 0 transparent; } }

/* ─── Workspace ────────────────────────────────────────────────────── */
.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 320px 1fr 380px;
  gap: 1px;
  background: var(--line);
  min-height: 0;
}
.col { display: flex; flex-direction: column; background: var(--page); min-height: 0; min-width: 0; }
.col-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  flex: 0 0 auto;
}
.col-head h2 { margin: 0; font-size: 15px; font-weight: 700; }
.col-corner { display: none; }
.col-tag { font-size: 12px; color: var(--ink-soft); padding: 2px 10px; border-radius: 999px; background: var(--surface-2); }
.col-controls { display: flex; gap: 8px; align-items: center; }
.micro-btn {
  appearance: none;
  height: 28px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--surface); color: var(--ink-soft);
  font-size: 12px; font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.micro-btn:hover:not(:disabled) { color: var(--ink); background: var(--surface-2); }
.micro-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* source column */
.config-body { flex: 1 1 0; min-height: 0; overflow-y: auto; padding: 16px 20px 32px; display: flex; flex-direction: column; gap: 14px; scrollbar-gutter: stable; }
.source-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.source-tabs .micro-btn { height: 34px; border-color: transparent; background: transparent; font-size: 13px; }
.source-tabs .micro-btn[aria-selected="true"] { background: var(--surface); color: var(--brand-text); border-color: var(--brand-line); font-weight: 600; box-shadow: 0 1px 2px rgba(52, 59, 79, 0.08); }

.form-row { display: grid; gap: 8px; }
.form-row label { display: grid; grid-template-columns: 72px 1fr; align-items: center; gap: 10px; }
.form-key { font-size: 13px; color: var(--ink-soft); }
select, .field input {
  appearance: none;
  width: 100%; height: 36px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface); color: var(--ink);
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%), linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%); background-position: calc(100% - 17px) 15px, calc(100% - 12px) 15px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
select:focus, .field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
select:disabled { opacity: 0.55; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel summary { list-style: none; cursor: pointer; padding: 12px 16px; display: flex; align-items: baseline; gap: 10px; user-select: none; }
.panel summary::-webkit-details-marker { display: none; }
.panel summary::after { content: ""; margin-left: auto; align-self: center; width: 7px; height: 7px; border-right: 2px solid var(--ink-soft); border-bottom: 2px solid var(--ink-soft); transform: rotate(-45deg); transition: transform 0.15s ease; }
.panel[open] summary::after { transform: rotate(45deg); }
.pnl-tag { font-size: 14px; font-weight: 700; }
.pnl-hint { font-size: 12px; color: var(--ink-soft); }
.panel-body { border-top: 1px solid var(--line); padding: 14px 16px 16px; display: grid; gap: 12px; }
.panel-note { margin: 0; color: var(--ink-soft); font-size: 13px; line-height: 1.55; }

.dropzone {
  display: grid; gap: 4px; position: relative; cursor: pointer;
  padding: 18px 14px; text-align: center; justify-items: center;
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius);
  background: var(--surface-2);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone:hover, .dropzone.dragging { border-color: var(--brand); background: var(--brand-tint); }
.dropzone:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone .icon { width: 22px; height: 22px; color: var(--brand-text); }
.drop-main { font-size: 14px; font-weight: 600; }
.drop-hint { font-size: 12px; color: var(--ink-soft); }

.file-summary { display: grid; gap: 6px; }
.file-name { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.file-facts { display: flex; flex-wrap: wrap; gap: 6px; }
.fact { padding: 2px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-soft); font-size: 12px; }

.progress { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.progress .bar { height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.progress .bar span { display: block; height: 100%; background: linear-gradient(to right, var(--violet), var(--brand)); transform: scaleX(0); transform-origin: left; }
.progress-clock { font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.chan-map { display: grid; gap: 8px; }
.chan-row { display: grid; grid-template-columns: 40px 1fr; align-items: center; gap: 10px; }
.chan-key { font-size: 12px; color: var(--ink-soft); }
.chan-val { font-size: 13px; font-weight: 700; }
.chan-val[data-role="agent"] { color: var(--brand-text); }
.chan-val[data-role="customer"] { color: var(--violet-text); }
.chan-map .micro-btn { justify-self: start; }
.export-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.export-row .micro-btn { height: 32px; }

.status-block { display: grid; gap: 8px; }
.status, .notice { margin: 0; font-size: 13px; line-height: 1.5; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }
.status:empty, .notice:empty { display: none; }
.status[data-tone="error"] { color: var(--danger); border-color: var(--danger); background: var(--danger-tint); }
.notice { color: var(--amber); border-color: var(--amber-line); background: var(--amber-tint); }

/* transcript column */
.dialog-scroll { flex: 1; overflow-y: auto; padding: 18px 24px 32px; scrollbar-gutter: stable; }
.dialog-log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.dialog-empty { margin: 0; padding: 56px 0; text-align: center; color: var(--ink-soft); font-size: 14px; }
.empty-mark { color: var(--brand); margin-right: 8px; }
kbd { padding: 1px 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--brand-text); font: 600 12px var(--font); }

.dialog-card {
  display: grid; grid-template-columns: 56px 84px 1fr; gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  animation: card-in 0.25s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
@keyframes card-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.dlg-time { padding-top: 3px; font-size: 12px; color: var(--ink-soft); text-align: right; font-variant-numeric: tabular-nums; }
.dlg-role { align-self: start; display: inline-flex; align-items: center; justify-content: center; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.dlg-card-agent .dlg-role { color: var(--brand-text); background: var(--brand-tint); }
.dlg-card-customer .dlg-role, .dlg-card-you .dlg-role { color: var(--violet-text); background: var(--violet-tint); }
.dlg-card-speaker .dlg-role { color: var(--ink-soft); background: var(--surface-2); }
.dlg-body { min-width: 0; font-size: 15px; line-height: 1.55; }
.dlg-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; font-size: 12px; }
.dlg-meta-tag { padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.dlg-meta-tag[data-v="lat-fast"] { color: var(--ok); background: var(--ok-tint); }
.dlg-meta-tag[data-v="lat-ok"] { color: var(--amber); background: var(--amber-tint); }
.dlg-meta-tag[data-v="lat-slow"] { color: var(--danger); background: var(--danger-tint); }

.speaking-row { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 14px; min-height: 40px; }
.speaking-chip { display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--brand-line); background: var(--brand-tint); color: var(--brand-text); font-size: 12px; font-weight: 600; }
.speaking-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 0.6s ease-in-out infinite; }
.speaking-chip[data-role="customer"], .speaking-chip[data-role="you"] { border-color: var(--violet-line); background: var(--violet-tint); color: var(--violet-text); }

/* event log: the app's "console" face */
.event-scroll { flex: 1; overflow-y: auto; padding: 4px 0 24px; background: var(--surface); }
.event-log { list-style: none; margin: 0; padding: 0; font: 12px/1.45 var(--console); }
.event-row { display: grid; grid-template-columns: 82px 128px 1fr; gap: 10px; padding: 4px 20px; border-bottom: 1px solid var(--line); animation: row-in 0.18s ease-out both; }
@keyframes row-in { from { opacity: 0; transform: translateX(-4px); } to { opacity: 1; transform: none; } }
.event-row:hover { background: var(--surface-2); }
.evt-time { color: var(--ink-faint); white-space: pre; }
.evt-name { color: var(--ink-soft); font-weight: 700; }
.evt-body { color: var(--ink); white-space: pre-wrap; word-break: break-word; }
.evt-row-info .evt-name { color: var(--violet-text); }
.evt-row-good .evt-name { color: var(--ok); }
.evt-row-warn .evt-name { color: var(--amber); }
.evt-row-bad .evt-name { color: var(--danger); }
.evt-row-bad { background: var(--danger-tint); }

*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }

/* ─── Sign-in ──────────────────────────────────────────────────────── */
.login-body { background: var(--page) var(--auth-bg) center / cover no-repeat fixed; }
.login-shell {
  flex: 1; overflow-y: auto;
  display: grid;
  grid-template-columns: minmax(0, 400px) minmax(0, 520px);
  gap: clamp(28px, 5vw, 72px);
  align-items: center; justify-content: center;
  padding: 32px 24px;
}
.login-panel, .login-preview {
  border: 3px solid var(--glass-line);
  border-radius: 16px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.18);
}
.login-panel { padding: 28px 26px 22px; }
.login-panel .brand { flex-direction: column; align-items: flex-start; gap: 14px; margin-bottom: 22px; }
.login-panel .brand-logo { width: 56px; height: 56px; }
.login-panel .brand-name { font-size: 24px; line-height: 1.2; }
.login-panel .brand-sub { font-size: 14px; }
.login-panel form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; font-size: 13px; font-weight: 500; }
.field input { height: 42px; font-size: 15px; background: var(--surface); }
.form-error { margin: 0; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--danger); background: var(--danger-tint); color: var(--danger); font-size: 13px; }
.form-error:empty { display: none; }
.login-panel .btn.primary { height: 42px; width: 100%; font-size: 15px; font-weight: 600; }
.login-note { margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 13px; }
.login-preview { padding: 6px 0 16px; overflow: hidden; }
.login-preview .col-head { background: transparent; border-bottom: 1px solid var(--line); }
.login-preview .dialog-log { padding: 16px 16px 0; }
.login-preview .dialog-card { box-shadow: none; background: var(--surface); }
.login-preview .dialog-card:nth-child(1) { animation-delay: 0.3s; }
.login-preview .dialog-card:nth-child(2) { animation-delay: 1.3s; }
.login-preview .dialog-card:nth-child(3) { animation-delay: 2.3s; }
.theme-corner { position: fixed; top: 16px; right: 16px; z-index: 2; }
.theme-corner .btn { background: var(--glass); border: 1px solid var(--glass-line); color: var(--ink); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.login-panel .brand-stack { gap: 6px; }

/* ─── Theme toggle shows the icon of the theme you'd switch to ─────── */
:root[data-theme="light"] .when-dark, :root[data-theme="dark"] .when-light { display: none; }

/* ─── Motion + responsive ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .dialog-card, .event-row, .lat-cell.flash, .speaking-chip::before, .state-pill .state-dot, .vad-indicator .vad-dot { animation: none !important; }
  .meter .seg, .btn { transition: none; }
}
@media (max-width: 1280px) {
  .workspace { grid-template-columns: 290px 1fr 340px; }
  .topbar, .telemetry { padding-left: 16px; padding-right: 16px; gap: 16px; }
  .meta-row { gap: 18px; padding-left: 16px; }
}
@media (max-width: 1100px) {
  .topbar { grid-template-columns: 1fr auto; }
  .meta-row { grid-column: 1 / -1; grid-row: 2; padding-left: 0; border-left: 0; overflow-x: auto; }
  .telemetry { grid-template-columns: 1fr; }
  .tele-group.vad-stack, .tele-group.latency { border-left: 0; padding-left: 0; }
}
@media (max-width: 980px) {
  html, body { overflow: auto; height: auto; }
  .workspace { grid-template-columns: 1fr; }
  .col-config { overflow: visible; }
  .config-body, .dialog-scroll { flex: none; overflow: visible; }
  .event-scroll { flex: none; max-height: 320px; }
  .login-shell { grid-template-columns: minmax(0, 440px); }
  .login-preview { display: none; }
}
@media (max-width: 640px) {
  .topbar { grid-template-columns: 1fr; }
  .state-pill { min-width: 0; }
  .controls { flex-wrap: wrap; }
  .tele-group.latency { grid-template-columns: repeat(3, 1fr); }
  .lat-cell { min-width: 0; padding: 8px 10px; }
  .meter-row { grid-template-columns: 64px 1fr 36px; gap: 8px; }
  .dialog-card { grid-template-columns: 52px 1fr; gap: 8px 12px; }
  .dialog-card .dlg-role { justify-self: start; }
  .dialog-card .dlg-body { grid-column: 1 / -1; }
  .dialog-scroll { padding: 14px 14px 24px; }
  .event-row { grid-template-columns: 80px 1fr; }
  .event-row .evt-body { grid-column: 1 / -1; }
}
