/* Dark gray with gold accents, in every system theme. */
:root {
  --bg: #232427; --surface: #2d2e32; --fg: #ece7dc; --muted: #a29d92; --line: #42434a;
  --accent: #d6a841; --on-accent: #1f1d18; --sel: #3d3627; --done: #8cc47e; --rec: #e8665a; --warn: #e8b85a;
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.45 var(--sans); }
/* The page is exactly the window's height: the list scrolls inside itself and the spectrum takes the height that is left. */
main { max-width: 1400px; margin: 0 auto; padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 12px; height: 100vh; height: 100dvh; }
.top, .panel { flex: none; }
h1 { font-size: 20px; margin: 0; color: var(--accent); }
h2 { font-size: 15px; margin: 0; }
.muted { color: var(--muted); }
.top { display: flex; gap: 16px; align-items: baseline; flex-wrap: wrap; }
.status { color: var(--muted); font-size: 14px; }
.status.warn { color: var(--warn); font-weight: 600; }
.status.err { color: var(--rec); font-weight: 600; }

.panel { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-end; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 4px; flex: 1 1 200px; min-width: 0; }
.field.narrow { flex: 0 1 150px; }
.field.wide { flex: 2 1 260px; }
.field.actions { flex: 0 1 auto; flex-direction: row; align-items: center; gap: 10px; }
.field.checks { flex: 1 1 100%; flex-direction: row; flex-wrap: wrap; gap: 6px 22px; }
.field.checks label { font-size: 14px; color: var(--fg); display: inline-flex; align-items: center; gap: 6px; }
label { font-size: 12px; color: var(--muted); }
.field.checks select { width: auto; padding: 3px 6px; }
.field.checks input[type="number"] { width: 4.5em; padding: 3px 6px; }
.checks-title { font-size: 12px; color: var(--muted); align-self: center; }
select, input[type="text"], input[type="number"] { font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px; min-width: 0; width: 100%; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
button { font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 6px 12px; cursor: pointer; white-space: nowrap; }
button.primary, button.go { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; }
button:disabled { opacity: 0.5; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pill { font-size: 12px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.pill.on { color: var(--done); border-color: var(--done); }
.pill.heard { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }

.meter { display: flex; align-items: center; gap: 8px; min-width: 150px; }
.meter-track { flex: 1; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; min-width: 80px; }
.meter-fill { height: 100%; width: 0%; background: var(--done); }
.meter-fill.hot { background: var(--rec); }
#meterLabel { font-size: 12px; font-variant-numeric: tabular-nums; min-width: 52px; }

.work { display: grid; grid-template-columns: minmax(320px, 440px) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 12px; flex: 1; min-height: 0; }
.listwrap { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.next { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.next-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.next-count { font-size: 14px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.next-label { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.next.rec .next-label { color: var(--rec); }
.next-name { font-size: 30px; line-height: 1.15; font-weight: 700; overflow-wrap: anywhere; }
.next-file { font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }
.bar { height: 6px; border-radius: 3px; background: var(--line); margin-top: 10px; overflow: hidden; }
.bar-fill { height: 100%; width: 0%; background: var(--rec); }

.list { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow-y: auto; flex: 1 1 0; min-height: 0; }
.row { display: grid; grid-template-columns: 30px minmax(0, 1fr) 62px 56px; gap: 8px; align-items: center; padding: 5px 10px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 14px; min-height: 36px; }
.row:last-child { border-bottom: 0; }
.row .num { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; }
.row .pos { font-family: var(--mono); overflow-wrap: anywhere; }
.row .dist { font-family: var(--mono); text-align: right; }
.row .act { text-align: right; font-size: 13px; color: var(--muted); }
.row.done .act { color: var(--done); font-weight: 600; }
.row.sel { background: var(--sel); box-shadow: inset 3px 0 0 var(--accent); }
.row.rec { box-shadow: inset 3px 0 0 var(--rec); }
.row.group-start { border-top: 2px solid var(--line); }
.row button.go { padding: 3px 10px; }

.graph { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0; min-height: 0; }
.graph-head { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
#graphInfo { font-size: 13px; font-variant-numeric: tabular-nums; }
canvas { width: 100%; flex: 1 1 0; min-height: 0; display: block; border-radius: 6px; }
.hint { font-size: 13px; margin: 0; }

dialog { background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; width: min(900px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); }
dialog::backdrop { background: rgb(0 0 0 / 0.6); }
dialog form { display: flex; flex-direction: column; gap: 12px; }
dialog h2 { color: var(--accent); }
h3 { font-size: 13px; font-weight: 600; margin: 0 0 6px; }
h3 label { font: inherit; color: inherit; }
dialog section { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; min-width: 0; }
dialog section h3 { margin: 0; }
#micRows { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.mic-row { display: grid; grid-template-columns: minmax(80px, 140px) minmax(0, 1fr) auto auto auto; gap: 8px; align-items: center; }
.mic-row label { font-size: 13px; color: var(--fg); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.mic-row button { padding: 4px 10px; }
.mic-row .mic-id, textarea { font-family: var(--mono); font-size: 13px; }
.lists-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
textarea { line-height: 1.5; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px; width: 100%; resize: vertical; }
#listsError:empty { display: none; }
.dialog-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.dialog-actions .spacer { flex: 1; }
@media (max-width: 720px) {
  .lists-cols { grid-template-columns: 1fr; }
  .mic-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto auto; }
  .mic-row label { grid-column: 1 / 3; grid-row: 2; white-space: normal; }
}
[hidden] { display: none !important; }
/* Too short or too narrow to fit everything: let the page scroll and give the list and spectrum fixed sizes. */
@media (max-width: 860px), (max-height: 520px) {
  main { height: auto; min-height: 100%; }
  .work { grid-template-columns: 1fr; grid-template-rows: none; }
  .list { flex: none; height: 50vh; min-height: 200px; }
  canvas { flex: none; height: auto; aspect-ratio: 15 / 7; }
}
