/* dstargateway dashboard */
:root {
  --series-1: #3987e5;     /* charts: validated against --panel in both themes */
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --bg: #060a12;
  --bg-grid: rgba(56, 189, 248, 0.045);
  --panel: #0b1220;
  --panel-2: #0f1829;
  --line: #1a2740;
  --line-2: #24375a;
  --text: #e3ebf7;
  --muted: #7d8ca8;
  --faint: #4a5a78;
  --accent: #22d3ee;
  --accent-2: #38bdf8;
  --accent-ink: #031418;
  --onair: #34f5a5;
  --onair-ink: #02160d;
  --onair-glow: rgba(52, 245, 165, 0.35);
  --warn: #fbbf24;
  --bad: #f87171;
  --alert: #ff3333;        /* pure red for warnings that must stand out (mic test) */
  --lock: #a78bfa;
  --shadow: 0 1px 0 rgba(255,255,255,0.03) inset, 0 8px 24px rgba(0,0,0,0.35);
  --radius: 10px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;     /* under 3:1 on white: the chart labels its lines */
  --series-4: #eda100;
  --bg: #eef2f8;
  --bg-grid: rgba(8, 145, 178, 0.06);
  --panel: #ffffff;
  --panel-2: #f6f8fc;
  --line: #dbe3ef;
  --line-2: #c5d2e5;
  --text: #0d1726;
  --muted: #56657f;
  --faint: #8c9ab2;
  --accent: #0891b2;
  --accent-2: #0284c7;
  --accent-ink: #ffffff;
  --onair: #059669;
  --onair-ink: #ffffff;
  --onair-glow: rgba(5, 150, 105, 0.22);
  --warn: #b45309;
  --bad: #dc2626;
  --alert: #cc0000;        /* #ff3333 is too faint on white (3.6:1) */
  --lock: #7c3aed;
  --shadow: 0 1px 2px rgba(15,23,42,0.06), 0 6px 18px rgba(15,23,42,0.06);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--text);
  font: 14px/1.45 var(--sans);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
button { font: inherit; color: inherit; }
.mono { font-family: var(--mono); }
td small.day { display: block; font-size: 11px; color: var(--muted); line-height: 1.2; }
td small.day.warn { color: var(--warn); }
td small.day.bad { color: var(--bad); }
td.pkts { white-space: nowrap; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---- top bar ---- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 20px;
  padding: 0 24px; height: 60px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: 0.08em; font-size: 13px; white-space: nowrap; }
.brand .logo { width: 32px; height: 32px; flex: none; }
.brand .logo svg { display: block; width: 100%; height: 100%; }
.brand .logo .logo-d { fill: none; stroke: var(--accent); stroke-width: 11; stroke-linejoin: round; }
.brand .logo .logo-wave { fill: none; stroke: var(--accent); stroke-width: 6; stroke-linecap: round; }
.brand .logo .logo-plus { fill: var(--onair); }
.brand small { display: block; font-weight: 500; letter-spacing: 0.04em; color: var(--muted); font-size: 11px; }
nav.tabs { display: flex; gap: 4px; }
nav.tabs a { padding: 7px 12px; border-radius: 7px; color: var(--muted); font-weight: 500; }
nav.tabs a:hover { color: var(--text); background: var(--panel-2); }
nav.tabs a.active { color: var(--text); background: var(--panel); box-shadow: inset 0 0 0 1px var(--line-2); }
.top .spacer { flex: 1; }
.clock { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap;
  background: none; border: 1px solid transparent; border-radius: 7px; padding: 5px 8px; cursor: pointer; }
.clock:hover { color: var(--text); border-color: var(--line-2); }
th .tz { font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--faint); }
.conn { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.ok { background: var(--onair); box-shadow: 0 0 8px var(--onair-glow); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }

.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  height: 34px; padding: 0 13px; border-radius: 8px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line-2); color: var(--text); font-weight: 500;
  white-space: nowrap; transition: border-color .15s, background .15s;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--panel-2); border-color: var(--line); }
.btn.icon { width: 34px; padding: 0; }
.btn.sm { height: 28px; padding: 0 9px; font-size: 12px; border-radius: 7px; }
.btn.danger { color: var(--bad); }
.btn.on { background: var(--onair); border-color: var(--onair); color: var(--onair-ink); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

main { max-width: 1440px; margin: 0 auto; padding: 24px; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 4px 0 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 22px; letter-spacing: -0.01em; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* ---- stats ---- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .k { font-size: 11px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); }
.stat .v { font: 600 26px/1.2 var(--mono); margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 13px; color: var(--muted); font-weight: 500; }
.stat.live .v { color: var(--onair); }
.stat .sub { margin-top: 4px; font: 12px var(--mono); color: var(--muted); display: flex; flex-wrap: wrap; gap: 2px 12px; }
.stat .sub .n { white-space: nowrap; }
.stat .v { white-space: nowrap; }
.stat .sub b { color: var(--text); font-weight: 600; }

/* ---- on air ---- */
.onair { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 12px; margin-bottom: 18px; }
.onair:empty { display: none; }
.tx {
  position: relative; overflow: hidden;
  border-radius: var(--radius); padding: 14px 16px; background: var(--panel);
  border: 1px solid var(--onair); box-shadow: 0 0 0 1px var(--onair-glow), 0 0 28px var(--onair-glow);
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center;
}
.tx .label { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--onair); font-weight: 600; }
/* Every line of a card stays one line, so all cards (and the idle placeholder) are the same height
   and the page below doesn't move as people key up and unkey. */
.tx > div:first-child, .tx .where, .tx .msg { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tx .call { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx > div:nth-child(2) { min-width: 0; }
.tx.idle { grid-column: 1 / -1; border: 1px dashed var(--line); box-shadow: none; background: transparent; }
.tx.idle > :not(.idle-text) { visibility: hidden; }
.tx.idle .idle-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 13px; }
.tx.gap, .tx.held { border: 1px dashed var(--line); box-shadow: none; background: transparent; }
.tx.gap > * { visibility: hidden; }
.tx.held > :not(.label):not(.tx-side) { opacity: .6; }
.tx.held .label, .tx.held .timer { color: var(--muted); }
.tx.held canvas { visibility: hidden; }
.tx .label .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--onair); animation: pulse 1.2s infinite; }
.tx .call { font: 700 24px/1.15 var(--mono); letter-spacing: 0.02em; }
.tx .call small { font-size: 14px; color: var(--muted); font-weight: 500; margin-left: 6px; }
.tx .where { color: var(--muted); font-size: 12px; font-family: var(--mono); }
.tx .timer { font: 600 18px var(--mono); color: var(--onair); font-variant-numeric: tabular-nums; text-align: right; }
.tx .msg { grid-column: 1 / -1; font-family: var(--mono); font-size: 12px; color: var(--text); opacity: .85; height: 17px; line-height: 17px; }
.tx .tx-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.btn .stop { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; padding-left: 8px;
  border-left: 1px solid color-mix(in srgb, currentColor 35%, transparent); font-size: 12px; opacity: .85; }
.btn .stop svg.i { width: 12px; height: 12px; }
.btn.listen-hint { color: var(--muted); }
.btn.warn { background: color-mix(in srgb, var(--warn) 16%, var(--panel)); border-color: var(--warn); color: var(--warn); }
.page-head > div { min-width: 0; max-width: 100%; }
#listen-state { max-width: 100%; }
#listen-state .lbl { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#listen-state .stop { flex: none; }
.tx canvas { grid-column: 1 / -1; width: 100%; height: 34px; display: block; }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1);} 50% { opacity: .35; transform: scale(.75);} }

/* ---- systems ---- */
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 26px 0 12px; gap: 8px 12px; flex-wrap: wrap; }
.section-title h2 { margin: 0; font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.systems { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 14px; }
.sys { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.sys header { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.sys header .name { font: 700 16px var(--mono); letter-spacing: .03em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sys header .desc { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sys header .grow { flex: 1; min-width: 96px; }
.badge { font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; padding: 3px 7px; border-radius: 5px;
  border: 1px solid var(--line-2); color: var(--muted); white-space: nowrap; }
.badge.ref { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.badge.gw { color: var(--lock); border-color: color-mix(in srgb, var(--lock) 40%, transparent); }
.sys.offline { opacity: .62; }
.sys { position: relative; }
.picker { display: flex; align-items: center; gap: 10px; flex: 1 1 140px; min-width: 0; padding: 4px 6px; margin: -4px -6px;
  background: none; border: 1px solid transparent; border-radius: 8px; cursor: pointer; text-align: left; }
.picker:hover { border-color: var(--line-2); background: var(--panel-2); }
.picker .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.picker .name { font: 700 16px var(--mono); letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker .desc { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker .chev { color: var(--muted); flex: none; }
.pick-list { max-height: min(60vh, 520px); overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.pick-row { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: none; border: 0;
  border-top: 1px solid var(--line); cursor: pointer; text-align: left; }
.pick-row:first-child { border-top: 0; }
.pick-head { position: sticky; top: 0; z-index: 1; padding: 7px 12px; font-size: 11px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); background: var(--panel-2); border-top: 1px solid var(--line); }
.pick-head:first-child { border-top: 0; }
.pick-head span { font-weight: 500; letter-spacing: 0; margin-left: 4px; color: var(--faint); }
.pick-head + .pick-row { border-top: 0; }
.pick-row:hover, .pick-row:focus-visible { background: var(--panel-2); outline: none; }
.pick-row.current { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.pick-row .grow { flex: 1; min-width: 0; }
.pick-row .desc { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-row .st { flex: none; font-size: 12px; display: flex; gap: 6px; align-items: center; }
#pick-q { width: 100%; }
.mods { display: flex; flex-direction: column; }
.mod { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center; padding: 9px 14px; border-top: 1px solid var(--line); min-height: 52px; }
.mod:first-child { border-top: 0; }
.mod .letter { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; font: 700 15px var(--mono);
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }
.mod .body { min-width: 0; }
.mod .now { font: 600 14px var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mod .sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mod .idle { color: var(--faint); font-weight: 500; font-family: var(--sans); font-size: 13px; }
.mod.active { background: linear-gradient(90deg, color-mix(in srgb, var(--onair) 11%, transparent), transparent 70%); }
.mod.active .letter { background: var(--onair); color: var(--onair-ink); border-color: var(--onair); box-shadow: 0 0 14px var(--onair-glow); }
.mod.active .now { color: var(--onair); }
.mod .acts { display: flex; gap: 6px; align-items: center; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line-2); border-radius: var(--radius); background: var(--panel); }

/* ---- tables ---- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; background: var(--panel-2); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--panel-2); }
td.call { font: 600 13px var(--mono); }
td.call small { color: var(--muted); font-weight: 400; margin-left: 4px; }
td .tag { font: 12px var(--mono); padding: 2px 6px; border-radius: 5px; background: var(--panel-2); border: 1px solid var(--line); }
td.msg { color: var(--muted); max-width: 260px; overflow: hidden; text-overflow: ellipsis; font-family: var(--mono); font-size: 12px; }
td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }
th.num { text-align: right; }
tr.playing td { background: color-mix(in srgb, var(--accent) 10%, transparent) !important; }

/* ---- forms ---- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; padding: 14px; border-bottom: 1px solid var(--line); }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
input, select, textarea {
  height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text);
  font: 14px var(--sans); outline: none; min-width: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input.mono { font-family: var(--mono); text-transform: uppercase; }
/* iOS Safari zooms the page when a field under 16px gets focus and doesn't zoom
   back out, leaving the page wider than the screen. 16px on touch screens avoids it. */
@media (pointer: coarse) { input, select, textarea { font-size: 16px; } }
label.f textarea { height: auto; min-height: 60px; padding: 8px 10px; resize: vertical; line-height: 1.4;
  text-transform: none; letter-spacing: normal; font-weight: 400; }
.u-notes { max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.checks label { display: flex; gap: 6px; align-items: center; font-size: 13px; }

/* ---- player bar ---- */
.player {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 30;
  width: min(760px, calc(100% - 32px));
  display: grid; grid-template-columns: auto 1fr auto auto; gap: 14px; align-items: center;
  padding: 10px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line-2);
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
}
.player .meta { min-width: 0; }
.player .meta b { font-family: var(--mono); }
.player .meta div { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player .bar { height: 4px; background: var(--line); border-radius: 2px; margin-top: 6px; cursor: pointer; }
.player .bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 2px; }
.player .t { font: 12px var(--mono); color: var(--muted); }

/* ---- modal ---- */
.modal { position: fixed; inset: 0; z-index: 40; display: flex; overflow-y: auto; background: rgba(2,6,14,.6); backdrop-filter: blur(4px); padding: 16px; }
.dialog { margin: auto; width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.45); }
.dialog.wide { width: min(560px, 100%); }
.dialog header { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 0; }
.dialog h3 { margin: 0; font-size: 17px; }
.dialog .content { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 12px; }
.dialog .row { display: flex; gap: 10px; }
.dialog .row > * { flex: 1; }
.guest-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.guest-btns .btn { flex: 1 1 150px; }
.seg { display: flex; background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.seg button { flex: 1; border: 0; background: none; padding: 6px; border-radius: 6px; cursor: pointer; color: var(--muted); font-weight: 500; }
.seg button.active { background: var(--panel); color: var(--text); box-shadow: 0 0 0 1px var(--line-2); }
.seg.lh-mode { flex: none; }
.seg.lh-mode button { padding: 4px 12px; font-size: 13px; white-space: nowrap; }
.lh-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.blk-notes { padding: 10px 16px; display: grid; gap: 4px; border-bottom: 1px solid var(--line); }
.err { color: var(--bad); font-size: 13px; min-height: 1em; }
.note { font-size: 13px; color: var(--muted); }
.note.regwarn { color: var(--warn); }
/* status page */
.ss-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ss-table th { position: static; }
.ss-table tr.ss-gtitle td { padding: 14px 14px 8px; border-bottom: none; background: none; }
.ss-table tbody + tbody tr.ss-gtitle td { padding-top: 26px; }
.ss-table tr.ss-gtitle h2 { display: inline; margin: 0 8px 0 0; font-size: 15px; }
.ss-table tr.ss-gtitle:hover td, .ss-table tr.ss-head:hover th { background: none; }
.ss-table tr.ss-head:hover th { background: var(--panel-2); }
.ss-table td { vertical-align: top; }
.ss-table .sys { display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.ss-table .sys a { font: 600 13px var(--mono); color: inherit; }
.ss-table .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.ss-table td.os { min-width: 110px; }
.ss-table td.cpu { min-width: 150px; }
.ss-table th.mcol { text-align: center; }
.ss-table td.mcell { padding-left: 3px; padding-right: 3px; white-space: nowrap; }
.ss-table td.mcell .mchip { width: 100%; justify-content: center; box-sizing: border-box; }
.mchip { display: inline-flex; gap: 5px; align-items: baseline; padding: 2px 7px; border-radius: 6px; font: 12px var(--mono);
  background: var(--panel-2); border: 1px solid var(--line); white-space: nowrap; }
.mchip b { color: var(--muted); }
.mchip.on { border-color: var(--onair); color: var(--onair); }
button.mchip.clickable { cursor: pointer; color: inherit; font: 12px var(--mono); }
button.mchip.clickable.off { color: var(--muted); }
button.mchip.clickable:hover { border-color: var(--accent, var(--onair)); color: var(--text); }
.mchip.off { color: var(--muted); }
.mchip small { color: var(--muted); font-size: 11px; }
.lock { color: var(--lock); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; letter-spacing: .04em;
  border: 1px solid var(--line-2); color: var(--muted); }
.pill.paid { color: var(--onair); border-color: color-mix(in srgb, var(--onair) 45%, transparent); }
.pill.admin { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.pill.full { color: var(--lock); border-color: color-mix(in srgb, var(--lock) 45%, transparent); }
.pill.owner { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.menu { position: absolute; right: 24px; top: 56px; z-index: 35; width: 260px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0,0,0,.35); padding: 8px; }
.menu .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu .who b { font-family: var(--mono); font-size: 15px; }
.menu button { width: 100%; display: flex; gap: 8px; align-items: center; padding: 8px 10px; border: 0; background: none; border-radius: 7px; cursor: pointer; text-align: left; }
.menu button:hover { background: var(--panel-2); }
.toast { position: fixed; top: 72px; left: 50%; transform: translateX(-50%); z-index: 50; padding: 10px 16px; border-radius: 9px;
  background: var(--panel); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-size: 13px; }
.toast.bad { background: #000; border: 2px solid #ff3333; color: #ff3333; font-weight: 600; }   /* pure red on black (5.8:1), the same in both themes */
.banner { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px;
  background: color-mix(in srgb, var(--lock) 9%, var(--panel)); border: 1px solid color-mix(in srgb, var(--lock) 35%, transparent); font-size: 13px; }
.banner .grow { flex: 1; }

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }

}
@media (max-width: 640px) {
  .top { padding: 0 12px; gap: 10px; height: auto; min-height: 56px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  .brand small, .conn span { display: none; }
  .clock { padding: 4px 6px; font-size: 11px; }
  nav.tabs { order: 3; width: 100%; }
  nav.tabs a { flex: 1; text-align: center; }
  main { padding: 16px; }
  .stat .v { font-size: 22px; }
  .systems { grid-template-columns: 1fr; }
  .menu { right: 12px; }
  .player { grid-template-columns: auto 1fr auto; }
  .player .t { display: none; }
}

/* ---- system page ---- */
.sysp-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 16px; }
.sysp-head .spacer { flex: 1; }
.picker.big { flex: 0 1 auto; margin: 0; padding: 8px 12px; border-color: var(--line); background: var(--panel); }
.picker.big .name { font-size: 22px; }
.picker.big .desc { font-size: 13px; }
.sysp-info { padding: 16px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr)); gap: 10px; }
.fact { background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; min-width: 0; }
.fact .k { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.fact .v { font-weight: 600; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fact .v.mono { font-family: var(--mono); }
.fact .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.sysp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 16px; }
.sysp-info h3 { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; font-weight: 600; }
.sysp-info h3 .muted { text-transform: none; letter-spacing: 0; font-weight: 400; }
.sysp-info .table-wrap { border: 1px solid var(--line); border-radius: 9px; }
.sysp-heard { margin-top: 16px; }
.sysp-detail { margin-top: 0; }
.links td { vertical-align: top; }
.links td div + div { margin-top: 2px; }
.sysp-heard .table-wrap { max-height: 320px; overflow-y: auto; }
.sysp-updated { margin-top: 10px; font-size: 12px; }
.sysp-mods { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 12px; }
.sysp-mods .sys .mod { border-top: 0; }
a.tag { color: inherit; }
a.tag:hover { border-color: var(--accent); color: var(--accent); }
.tx .label a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* GPS pin next to a callsign */
a.gps { display: inline-flex; align-items: center; vertical-align: -2px; margin-left: 6px; color: var(--accent);
  padding: 1px; border-radius: 5px; }
a.gps:hover { background: color-mix(in srgb, var(--accent) 15%, transparent); }
a.gps svg.i { width: 15px; height: 15px; }
.tx .call a.gps svg.i { width: 18px; height: 18px; }

/* Where a keyup came from: RF, Internet, or via a linked system */
.src { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 5px; font: 600 11px var(--mono);
  letter-spacing: .02em; white-space: nowrap; border: 1px solid var(--line-2); color: var(--muted); vertical-align: 1px; }
.src.rf { color: var(--onair); border-color: color-mix(in srgb, var(--onair) 40%, transparent); }
.src.link { color: var(--lock); border-color: color-mix(in srgb, var(--lock) 40%, transparent); }
.src.net { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.src.also { color: var(--muted); font-weight: 500; }
.tx .where .src { margin-left: 8px; }
.u-filters { padding: 12px 14px; margin-bottom: 16px; display: grid; gap: 8px; }
.u-filters .checks { align-items: center; }
.u-filters .checks .note { min-width: 92px; }
.seg.u-first { flex-wrap: wrap; flex: 0 1 auto; gap: 1px; }
.seg.u-first button { flex: none; min-width: 26px; padding: 4px 6px; font: 12px var(--mono); }
.seg.u-first button.all { font-family: var(--sans); padding: 4px 10px; }

/* Admin sub-tabs and the Sessions list */
.seg.adm-tabs { display: inline-flex; margin: 0 0 14px; }
.seg.adm-tabs button { flex: none; padding: 6px 18px; }
#sessions td { vertical-align: top; }
#sessions .ua { font-size: 11px; color: var(--muted); max-width: 420px; word-break: break-word; margin-top: 2px; }
#sessions .dis { color: var(--bad, #c33); font-size: 12px; }
#sessions .on { color: var(--onair); font-weight: 600; white-space: nowrap; }
#sessions .on::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; margin-right: 6px; vertical-align: 1px; }

/* Tools page: one panel per tool */
.tools { display: grid; gap: 28px; }
.tool { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; min-width: 0; }
.tool-head { display: flex; gap: 14px; align-items: flex-start; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tool-head h2 { margin: 0; font-size: 17px; }
.tool-head p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.tool-ic { flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.tool-ic .i { width: 20px; height: 20px; }
.tool-step + .tool-step { margin-top: 22px; padding-top: 20px; border-top: 1px dashed var(--line-2); }
.tool-step h3 { margin: 0 0 6px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.tool-step > .note { margin: 0 0 10px; }
.step-n { width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; font-weight: 700;
  background: var(--panel-2); border: 1px solid var(--line-2); color: var(--muted); }
.tool .card { box-shadow: none; }
.tool-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tool-form #t-call { width: 150px; }
.tool-form select { max-width: 100%; }
#t-result:not(:empty), #al-list:not(:empty) { margin-top: 14px; }
#t-entries td.f { font-family: var(--mono); white-space: pre; }
#t-result .note { margin-top: 8px; }
.note .regwarn { color: var(--warn); }
.tool-form .keyin { font-family: var(--mono); width: 290px; max-width: 100%; }
.tool-form #al-watch { width: 170px; }
.tool-form #al-system { width: 130px; }
.tool-form #tb-system { min-width: 200px; }
#tb-card { margin-top: 14px; }
.al-quiet { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.al-quiet input, #al-rows input[type=number] { width: 76px; }
#al-rows td { vertical-align: middle; }
#al-rows .mono { font-family: var(--mono); }
@media (max-width: 600px) { .tool { padding: 16px 14px; } .tools { gap: 20px; } }

/* transmit (System page) */
.xmit-card { padding: 10px 14px; display: grid; gap: 10px; }
.xmit-row { display: flex; gap: 10px 16px; align-items: center; flex-wrap: wrap; }
.xmit-id { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.xmit-who, .xmit-msg { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); white-space: nowrap; }
.xmit-who .mono { color: var(--text); font-weight: 600; font-size: 14px; }
#xmit-sfx { width: 64px; text-transform: uppercase; }
#xmit-msgtext { width: 200px; }
.xmit-saved.ok { color: var(--onair); }
.xmit-saved.bad { color: var(--alert); font-weight: 600; }
.xmit-mic { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); min-width: 0; }
.xmit-mic select { max-width: 260px; min-width: 0; }
.xmit-latch { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); white-space: nowrap; }
.xmit-gain { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); white-space: nowrap; }
.xmit-gain input { width: 110px; accent-color: var(--accent); }
.xmit-gain span { font: 12px var(--mono); min-width: 44px; text-align: right; }
.xmit-meter { flex: 1 1 120px; min-width: 120px; height: 8px; border-radius: 4px; background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; }
.xmit-meter i { display: block; height: 100%; width: 0; background: var(--onair); transition: width 60ms linear; }
#xmit-test.need { border-color: var(--accent); color: var(--accent); animation: xmit-need 1.6s ease-in-out infinite; }
@keyframes xmit-need { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent); } }
@media (prefers-reduced-motion: reduce) { #xmit-test.need { animation: none; } }
#xmit-test.rec { background: var(--bad); border-color: var(--bad); color: #fff; }
#xmit-test.wait { border-color: var(--warn); color: var(--warn); }
.xmit-note.live { color: var(--bad); font-weight: 600; }
.xmit-note.bad { color: var(--alert); font-weight: 600; }
.xmit-note.warn { color: var(--warn); }
/* a module's push-to-talk button, next to its listen button */
.btn.sm.ptt-mod { gap: 4px; min-width: 34px; justify-content: center; padding: 0 8px;
  user-select: none; -webkit-user-select: none; touch-action: none; -webkit-touch-callout: none; }
.ptt-mod .secs { font: 600 12px var(--mono); }
.ptt-mod .secs:empty { display: none; }
.ptt-mod.x-busy, .ptt-mod.x-off { opacity: .45; }
.ptt-mod.x-space { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }   /* the space bar's module */
.ptt-mod.x-wait { border-color: var(--warn); color: var(--warn); }
.ptt-mod.x-live { background: var(--bad); border-color: var(--bad); color: #fff; }
.ptt-mod.x-onair { box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.3); }
@media (max-width: 600px) { .xmit-mic { flex: 1 1 100%; } .xmit-mic select { flex: 1; max-width: none; } .xmit-meter { flex-basis: 100%; } }
.pill.onair { background: var(--bad); color: #fff; }

/* the D-STAR header box on last heard / history rows */
.hdr-tip { position: fixed; z-index: 60; pointer-events: none; padding: 8px 12px; border-radius: 8px;
  background: var(--panel); border: 1px solid var(--line-2); box-shadow: var(--shadow);
  font: 12px/1.6 var(--mono); white-space: pre; color: var(--text); }
.hdr-tip .t { font: 600 10px var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.hdr-tip .k { color: var(--muted); }
.hdr-tip .v { background: var(--panel-2); border-radius: 3px; margin-left: 8px; }
.hdr-tip .ok { color: var(--onair); font-family: var(--sans); font-weight: 600; }
.hdr-tip .bad { color: var(--alert); font-family: var(--sans); font-weight: 600; }
.hdr-tip .na { color: var(--faint); font-family: var(--sans); }
.hdr-tip .n { font: 11px/1.4 var(--sans); color: var(--muted); white-space: normal; max-width: 240px; margin-top: 4px; }

/* ---- admin: Server tab ---- */
.srv-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.srv-tile { padding: 12px 14px; display: grid; gap: 4px; align-content: start; }
.srv-tile .k { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.srv-tile .v { font: 600 22px var(--sans); font-variant-numeric: tabular-nums; color: var(--text); }
.srv-tile .v small { font-size: 12px; font-weight: 500; color: var(--muted); }
.srv-tile .s { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.srv-meter { height: 6px; border-radius: 3px; background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; margin-top: 4px; }
.srv-meter i { display: block; height: 100%; border-radius: 3px; background: var(--series-1); }
.srv-meter.high i { background: var(--warn); }
.srv-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; margin-bottom: 12px; }
.srv-head { display: flex; gap: 10px; align-items: baseline; padding: 10px 14px 0; flex-wrap: wrap; }
.srv-legend { font-size: 12px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.srv-legend i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; margin-left: 4px; }
.srv-plot { position: relative; height: 170px; margin: 4px 6px 8px; }
.srv-plot svg { display: block; width: 100%; height: 100%; overflow: visible; }
.srv-plot .grid { stroke: var(--line); stroke-width: 1; }
.srv-plot .axis { fill: var(--muted); font: 10px var(--sans); font-variant-numeric: tabular-nums; }
.srv-plot .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.srv-plot .area { stroke: none; opacity: .12; }
.srv-plot .end { font: 600 11px var(--sans); fill: var(--text); }
.srv-plot .xh { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 3; }
.srv-plot .dot { stroke: var(--panel); stroke-width: 2; }
.srv-plot .empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.srv-tip { position: absolute; top: 4px; pointer-events: none; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px;
  padding: 6px 9px; font-size: 12px; color: var(--text); white-space: nowrap; box-shadow: var(--shadow); z-index: 2; font-variant-numeric: tabular-nums; }
.srv-tip .t { color: var(--muted); margin-bottom: 2px; }
.srv-tip i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
