/* VoxLog — operator console.
 *
 * Design language follows WarnFlux (the sibling station panel): graphite
 * surfaces, one warm brand accent, cool blue only for links/information, a
 * small 6px radius, flat cards and monospaced machine values. Density over
 * decoration: this is a console that runs all day, not a landing page.
 *
 * Fonts are Inter and JetBrains Mono (SIL OFL 1.1), self-hosted with latin and
 * latin-ext subsets so Polish diacritics stay in the same face.
 */

@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/inter-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/inter-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4,
    U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("fonts/inter-latin-500-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("fonts/inter-latin-ext-500-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4,
    U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("fonts/inter-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("fonts/inter-latin-ext-600-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4,
    U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/jetbrains-mono-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4,
    U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* Graphite surfaces. ~85% of the UI is neutral; colour means something. */
  --bg: #0f1419;
  --surface: #151b21;
  --surface-raised: #1b232b;
  --surface-muted: #202a33;
  --border: #303c46;
  --border-strong: #46545f;

  --text: #eef2f5;
  --text-secondary: #b4bec7;
  --muted: #87939e;
  --text-disabled: #626d76;

  /* One brand accent: the receiver's own colour, used sparingly. */
  --brand: #f06828;
  --brand-hover: #f47b42;
  --brand-soft: #342018;
  --on-brand: #101418;
  --brand-border: rgba(240, 104, 40, 0.38);

  /* Cool blue: links and information, never decoration. */
  --link: #6eadd0;
  --link-hover: #9bc6d8;
  --focus: #8abbd0;
  --focus-ring: rgba(138, 187, 208, 0.32);

  --ok: #5dbb88;
  --ok-bg: rgba(93, 187, 136, 0.16);
  --ok-border: rgba(93, 187, 136, 0.45);
  --warn: #e0a63c;
  --warn-bg: rgba(224, 166, 60, 0.16);
  --warn-border: rgba(224, 166, 60, 0.45);
  --bad: #f05a69;
  --bad-bg: rgba(240, 90, 105, 0.16);
  --bad-border: rgba(240, 90, 105, 0.45);
  --muted-bg: rgba(135, 147, 158, 0.14);
  /* Chrome (topbar, footer rail): one step darker than the page, as in WarnFlux. */
  --header: #0b0f13;

  --btn-secondary-bg: #25303a;
  --btn-secondary-hover: #303d48;
  --input-bg: #11171c;
  --input-border: #3b4853;

  --radius: 6px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-pop: 0 8px 24px rgba(0, 0, 0, 0.5);

  --topbar-h: 48px;
  --font-sans: "Inter", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
}

/* Controls do not inherit the page font by default: without this every button
   and select falls back to the browser's own sans. */
button, input, select, textarea { font-family: inherit; }

h1 { font-size: 1rem; font-weight: 600; margin: 0; }
h2 { font-size: 0.95rem; font-weight: 600; margin: 0; }

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.wrap { overflow-wrap: anywhere; }
.inline-form { display: inline; margin: 0; }
.stack { display: flex; flex-direction: column; gap: 0.85rem; }

/* Machine text: timestamps, levels, counters, ids. */
.mono, code, kbd, samp { font-family: var(--font-mono); }
.mono { font-size: 0.8rem; font-variant-numeric: tabular-nums; }
code { font-size: 0.82rem; color: var(--text-secondary); }

.icon { display: block; width: 16px; height: 16px; fill: currentColor; flex: none; }
.icon-lg { width: 20px; height: 20px; }

/* ---------------------------------------------------------------- topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: var(--topbar-h);
  padding: 0 1rem;
  background: var(--header);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
}
.brand:hover { color: var(--text); text-decoration: none; }
/* Logo: the same three ascending bars + wave as the favicon, in WarnFlux
   graphite-and-orange. Fixed colours (not currentColor) so the tab icon and
   the topbar cannot drift apart. */
.brand-mark {
  width: 26px;
  height: 26px;
  display: block;
  flex: none;
  filter: drop-shadow(0 0 8px rgba(240, 104, 40, 0.16));
}

.mainnav { display: flex; align-items: center; gap: 0.15rem; }
.mainnav a {
  display: inline-flex;
  align-items: center;
  height: var(--topbar-h);
  padding: 0 0.65rem;
  color: var(--muted);
  font-size: 0.85rem;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  text-decoration: none;
}
.mainnav a:hover { color: var(--text-secondary); background: var(--surface-muted); text-decoration: none; }
.mainnav a.active { color: var(--text); border-bottom-color: var(--brand); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }
.who { color: var(--muted); font-size: 0.8rem; }

/* Language switch: two-letter segmented control, not a dropdown. */
.lang-switch { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.lang-switch a {
  padding: 0.12rem 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-decoration: none;
}
.lang-switch a + a { border-left: 1px solid var(--border); }
.lang-switch a:hover { background: var(--surface-muted); color: var(--text); text-decoration: none; }
.lang-switch a.active { background: var(--brand-soft); color: var(--brand); }

/* Receiver state: dot + word, the dot carries the colour. */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.1rem 0.5rem 0.1rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-secondary);
  font-size: 0.74rem;
  white-space: nowrap;
}
.pill.pill-ok { border-color: var(--ok-border); color: var(--ok); background: var(--ok-bg); }
.pill.pill-warn { border-color: var(--warn-border); color: var(--warn); background: var(--warn-bg); }
.pill.pill-bad { border-color: var(--bad-border); color: var(--bad); background: var(--bad-bg); }
.pill.pill-muted { color: var(--muted); }

.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(93, 187, 136, 0.15); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px rgba(224, 166, 60, 0.15); }
.dot.bad { background: var(--bad); box-shadow: 0 0 0 3px rgba(240, 90, 105, 0.15); }

/* ------------------------------------------------------------------ page */
.page {
  flex: 1 0 auto;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.1rem 1rem 1.75rem;
}

.page-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin: 0 0 0.9rem;
}
.page-head .muted { font-size: 0.8rem; margin: 0; }
.back { font-size: 0.78rem; color: var(--muted); display: inline-block; margin-bottom: 0.35rem; }

/* Status strip: the numbers an operator reads at a glance, on one line. */
.statusbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.75rem;
  padding: 0.7rem 0.95rem;
  margin: 0 0 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.stat { display: flex; flex-direction: column; gap: 0.12rem; flex: 0 0 auto; }
.stat-label {
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.stat-value {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  white-space: nowrap;
}
.stat-value small { font-size: 0.72rem; color: var(--muted); margin-left: 0.2rem; }
.stat-value.brand { color: var(--brand); }

/* ----------------------------------------------------------------- cards */
.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1rem;
}
.card {
  grid-column: span 6;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0.85rem 1rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.card-wide { grid-column: span 12; }
.card-narrow { grid-column: span 12; max-width: 520px; }
.card > h2 {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding-bottom: 0.55rem;
  margin: 0 0 0.8rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.card > h2 .icon { color: var(--muted); }
.card > h2 .meta { margin-left: auto; font-size: 0.72rem; font-weight: 400; color: var(--muted); font-family: var(--font-mono); }
.card > form, .card > .btn { margin-top: 0.85rem; align-self: flex-start; }

/* Key/value list: muted label column, monospaced values. */
.kv {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.3rem 1rem;
  margin: 0;
}
.kv dt { color: var(--muted); font-size: 0.8rem; }
.kv dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  overflow-wrap: anywhere;
}
/* Parts of one long transmission (cut at sdr.max_transmission_ms). */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 0.4rem;
  font-size: 0.8rem;
}

.chip-part {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  background: var(--surface-muted);
  border-color: var(--border-strong);
}
/* Both live inside .page-head (a wrapping flex row): force them onto their own
   lines so the cut note reads as a note, not as a caption for the button. */
.part-nav { display: flex; flex-wrap: wrap; gap: 0.5rem; flex-basis: 100%; margin: 0.2rem 0 0; }
.hint-cut {
  display: flex;
  flex-basis: 100%;
  gap: 0.45rem;
  align-items: flex-start;
  margin: 0.1rem 0 0;
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.hint-cut .icon { color: var(--warn); margin-top: 2px; }
.segments.part-list { list-style: none; padding-left: 0; }
.part-list a { font-family: var(--font-mono); font-size: 0.75rem; margin-right: 0.5rem; }
.part-list li.current { color: var(--text); }
.part-list li.current .seg-text { font-weight: 500; }
.part-list li:not(.current) .seg-text { color: var(--text-secondary); }

/* Mini utilisation gauge inside the System card (CPU / memory), as in WarnFlux. */
.kv-grid { display: grid; grid-template-columns: auto 1fr; gap: 0.4rem 1rem; font-size: 0.82rem; }
.kv-grid .kv { display: contents; }
.kv-grid .k { color: var(--muted); }
.kv-grid .v { min-width: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.kv-gauge {
  display: inline-block;
  vertical-align: -1px;
  width: 4.5rem;
  height: 6px;
  margin-right: 0.45rem;
  border-radius: 999px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  overflow: hidden;
}
.kv-gauge-fill { display: block; height: 100%; border-radius: 999px; transition: width 0.4s ease; }
.kv-gauge-fill.ok { background: var(--ok); }
.kv-gauge-fill.warn { background: var(--warn); }
.kv-gauge-fill.bad { background: var(--bad); }

/* Signal meter: mean level of the transmission above the learned noise
   floor (app/audio/levels.py). Segments grow like a bar of rising bars, so
   "how well did it come through" is readable at a glance. */
.sig-meter { display: inline-flex; align-items: center; gap: 0.4rem; }
.sig-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 15px; }
.sig-bars i { display: block; width: 3px; height: 5px; border-radius: 1px; background: var(--muted-bg); }
.sig-bars i:nth-child(2) { height: 7px; }
.sig-bars i:nth-child(3) { height: 9px; }
.sig-bars i:nth-child(4) { height: 11px; }
.sig-bars i:nth-child(5) { height: 13px; }
.sig-bars i:nth-child(6) { height: 15px; }
.sig-bars i.on { background: var(--ok); }
.sig-meter.warn .sig-bars i.on { background: var(--warn); }
.sig-meter.bad .sig-bars i.on { background: var(--bad); }
.sig-db { font-size: 0.72rem; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.sig-meter.ok .sig-db { color: var(--ok); }
.sig-meter.warn .sig-db { color: var(--warn); }
.sig-meter.bad .sig-db { color: var(--bad); }

.kv-2 { grid-template-columns: max-content minmax(0, 1fr) max-content minmax(0, 1fr); column-gap: 1.25rem; }

.hint { margin: 0.7rem 0 0; font-size: 0.75rem; color: var(--muted); line-height: 1.45; }

/* Result of a destructive action, echoed back after the redirect. */
.flash {
  margin: 0 0 0.7rem;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.8rem;
}
.flash-ok { border-color: var(--ok-border); background: var(--ok-bg); color: var(--ok); }
.flash-warn { border-color: var(--warn-border); background: var(--warn-bg); color: var(--warn); }

/* A card that deletes things sits apart and is outlined in red. */
.danger-zone { border-color: var(--bad-border); }
.danger-zone h2 .icon { color: var(--bad); }
.purge-form { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: flex-end; margin-top: 0.85rem; }
.purge-form .field { max-width: 15rem; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; margin: 0 -0.25rem; }
.table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.table th {
  padding: 0.35rem 0.5rem;
  text-align: left;
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 0.42rem 0.5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--surface-muted); }
.table td.nowrap, .table td.time { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 0.78rem; }
.table td.clip { max-width: 520px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table td.actions, .table th.actions { text-align: right; white-space: nowrap; }

/* History: a row opens the whole transcript of the over underneath it. */
.table tbody tr[data-href] { cursor: pointer; }
.table tbody tr[data-href]:hover td { background: rgba(255, 255, 255, 0.025); }
.table tbody tr[data-href]:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.table tbody tr[data-href][aria-expanded="true"] td { background: var(--surface-raised); }

tr.expand-row > td {
  padding: 0;
  background: var(--input-bg);
  border-bottom: 1px solid var(--border);
}
.expand-body {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.85rem 1rem 0.95rem;
}
.expand-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 0.85rem;
}
.expand-title {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
.expand-text {
  margin: 0;
  white-space: pre-wrap;
  max-width: 92ch;
}
.expand-parts { margin-top: 0.15rem; }
tr.row-simulated td.clip, tr.row-simulated td:first-child a { opacity: 0.75; }

/* --------------------------------------------------------------- badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.05rem 0.5rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 500;
  line-height: 1.45;
  white-space: nowrap;
}
.badge.ok, .badge-ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-border); }
.badge.warn, .badge-warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-border); }
.badge.bad, .badge-bad { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-border); }
.badge.muted, .badge-muted { background: var(--muted-bg); color: var(--muted); border-color: var(--border); }

/* Neutral chips: language, model, counts. Not a status, so no colour. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.02rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-muted);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  white-space: nowrap;
}
.chip-warn { color: var(--warn); border-color: var(--warn-border); background: var(--warn-bg); }
.detail-badges { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }

/* -------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.32rem 0.85rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--btn-secondary-bg);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { background: var(--btn-secondary-hover); border-color: var(--text-muted, var(--muted)); color: var(--text); text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand-border); color: var(--on-brand); font-weight: 600; }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-border); color: var(--on-brand); }
/* Destructive action: only ever used where something is really deleted. */
.btn-danger { background: var(--bad-bg); border-color: var(--bad-border); color: var(--bad); font-weight: 600; }
.btn-danger:hover { background: var(--bad); border-color: var(--bad); color: #12161a; }
.btn-small { padding: 0.16rem 0.5rem; font-size: 0.75rem; }
.btn:disabled { opacity: 0.45; border-style: dashed; cursor: not-allowed; }
.btn-block { width: 100%; }
.play-btn { padding: 0.1rem 0.32rem; }
.row-actions { display: inline-flex; align-items: center; gap: 0.25rem; margin-left: 0.3rem; vertical-align: middle; }

/* --------------------------------------------------------------- fields */
.field { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.field > span {
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
input[type="text"], input[type="search"], input[type="password"], input[type="date"], select {
  min-width: 0;
  padding: 0.32rem 0.45rem;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.82rem;
}
input::placeholder { color: var(--text-disabled); }
input:focus, select:focus { border-color: var(--focus); box-shadow: 0 0 0 3px var(--focus-ring); outline: none; }

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 0.75rem 0.9rem;
  align-items: end;
  padding: 0.85rem 1rem 1rem;
  margin: 0 0 1rem;
}
.filter-actions { display: flex; gap: 0.4rem; }
.table-card { padding-bottom: 0.4rem; }

.pager {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.25rem 0.2rem;
}
.pager .muted { margin-left: auto; font-family: var(--font-mono); font-size: 0.75rem; }

/* ------------------------------------------------------------- messages */
.alert {
  padding: 0.5rem 0.65rem;
  margin: 0 0 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.82rem;
}
.alert-ok { border-color: var(--ok-border); background: var(--ok-bg); color: var(--ok); }
.alert-bad { border-color: var(--bad-border); background: var(--bad-bg); color: var(--bad); }

.eventlist { list-style: none; margin: 0; padding: 0; }
.eventlist li {
  display: grid;
  grid-template-columns: max-content max-content minmax(0, 1fr);
  gap: 0.65rem;
  align-items: baseline;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
}
.eventlist li:last-child { border-bottom: none; }
.event-time { font-family: var(--font-mono); font-size: 0.74rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.event-comp { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-secondary); }
.event-msg { color: var(--text-secondary); overflow-wrap: anywhere; }
.event-warning .event-comp { color: var(--warn); }
.event-error .event-comp { color: var(--bad); }

/* -------------------------------------------------------- transmission */
.last-tx { display: flex; flex-direction: column; align-items: flex-start; gap: 0.55rem; }
.last-when { display: flex; align-items: baseline; gap: 0.6rem; }
.last-when strong { font-family: var(--font-mono); font-size: 0.82rem; font-weight: 500; }
.last-when .muted { font-family: var(--font-mono); font-size: 0.75rem; }
.last-text { margin: 0; font-size: 0.9rem; line-height: 1.55; color: var(--text); }
.transcript {
  margin: 0;
  padding: 0.75rem 0.9rem;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  line-height: 1.6;
}
.segments { margin: 0; padding-left: 1.4rem; }
.segments li { padding: 0.25rem 0; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
.segments li:last-child { border-bottom: none; }
.seg-time { font-family: var(--font-mono); font-size: 0.74rem; color: var(--muted); margin-right: 0.6rem; }
.audio-player { width: 100%; height: 34px; margin-bottom: 0.7rem; }
.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem 0.6rem; margin: 0; }
.btn-row .note { font-family: var(--font-mono); font-size: 0.72rem; }

/* Floating player for the history table. */
.floating-player {
  position: fixed;
  left: 50%;
  bottom: -70px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem 0.5rem 0.85rem;
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  transition: bottom 0.18s ease-out;
  z-index: 40;
}
.floating-player.visible { bottom: 1rem; }
.floating-player .muted { font-size: 0.75rem; white-space: nowrap; }
.floating-player audio { height: 32px; max-width: 320px; }
.floating-player button {
  border: 1px solid var(--border-strong);
  background: var(--btn-secondary-bg);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.1rem 0.4rem;
  cursor: pointer;
}

/* ---------------------------------------------------------- auth pages */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
}
.auth-card {
  position: relative;
  width: 100%;
  max-width: 340px;
  padding: 1.5rem 1.4rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.auth-brand { display: flex; align-items: center; gap: 0.65rem; margin-bottom: 1.15rem; }
.auth-brand h1 { font-size: 1rem; }
.auth-brand p {
  margin: 0.2rem 0 0;
  font-size: 0.66rem;
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.auth-form { display: flex; flex-direction: column; gap: 0.75rem; }
.auth-note { margin: 1rem 0 0; font-size: 0.72rem; line-height: 1.5; color: var(--muted); }
.auth-lang { margin: 0.9rem 0 0; display: flex; justify-content: flex-end; }

/* ---------------------------------------------------------------- footer */
.footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.6rem;
  align-items: center;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.72rem;
  font-family: var(--font-mono);
}
.footer .sep { color: var(--border-strong); }

/* ----------------------------------------------------------- responsive */
@media (max-width: 900px) {
  .card, .card-wide { grid-column: span 12; }
  .kv-2 { grid-template-columns: max-content minmax(0, 1fr); }
  .topbar { flex-wrap: wrap; gap: 0.5rem 0.75rem; padding: 0.45rem 0.75rem; }
  .mainnav a { height: auto; padding: 0.2rem 0.5rem; }
  .topbar-right { gap: 0.5rem; }
  .who { display: none; }
  .table td.clip { max-width: 260px; }
}

@media (prefers-reduced-motion: reduce) {
  .floating-player { transition: none; }
}
