/* ==========================================================================
   FDMR Monitor — redesigned stylesheet
   A plain file so browsers cache it; the accent colour (THEME_COLOR) and activity box
   height (HEIGHT_ACTIVITY) from fdmr-mon.cfg are set by include/header.php
   ========================================================================== */

:root {
  --accent: #087a43;        /* THEME_COLOR - set per server in include/header.php */
  --accent-ink: var(--accent);
  --accent-soft: color-mix(in srgb, var(--accent) 11%, transparent);
  --accent-line: color-mix(in srgb, var(--accent) 35%, transparent);

  /* Colour roles (one job each):
       accent  = brand + anything you can click (from THEME_COLOR)
       info    = callsigns            tg-*   = talkgroups (neutral tag, so it never
       rx-*    = ON AIR: a station        competes with the signal colours)
                 transmitting to us   tx-*   = we are sending to a station
       ok/bad  = connected / down only (never used for traffic)            */
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --border: #cbd2d9;
  --border-strong: #cbd3df;
  --text: #18202a;
  --text-2: #334155;
  --muted: #5d6875;
  --faint: #94a3b8;

  --ok: #15803d;
  --ok-soft: #e3f5e9;
  --warn: #b45309;
  --warn-soft: #fff3e0;
  --bad: #dc2626;
  --bad-soft: #fdecec;
  --info: #174b8c;
  --tg: #1e293b;
  --tg-bg: #eef2f7;
  --tg-line: #dbe2ec;

  --rx-bg: #ffe9bf;
  --rx-line: #f59e0b;
  --rx-ink: #7a3a00;
  --tx-bg: #cdf0f7;
  --tx-line: #0e9fb5;
  --tx-ink: #07505d;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .06);
  --shadow-pop: 0 12px 32px rgba(16, 24, 40, .18), 0 2px 6px rgba(16, 24, 40, .08);

  --radius: 14px;
  --radius-sm: 9px;
  --radius-xs: 6px;

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --activity-min: 45px;     /* HEIGHT_ACTIVITY - set per server in include/header.php */
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent-ink: color-mix(in srgb, var(--accent) 62%, white);
    --accent-soft: color-mix(in srgb, var(--accent) 20%, transparent);
    --accent-line: color-mix(in srgb, var(--accent) 50%, transparent);
    --bg: #000000;
    --surface: #111111;
    --surface-2: #191919;
    --surface-3: #242424;
    --border: #333333;
    --border-strong: #505050;
    --text: #e6ebf2;
    --text-2: #c3ccd9;
    --muted: #aaaaaa;
    --faint: #999999;
    --ok: #4ade80;  --ok-soft: rgba(74, 222, 128, .12);
    --warn: #fbbf24; --warn-soft: rgba(251, 191, 36, .12);
    --bad: #f87171;  --bad-soft: rgba(248, 113, 113, .13);
    --info: #7cb2ff;
    --tg: #e6ebf2; --tg-bg: #242424; --tg-line: #444444;
    --rx-bg: rgba(245, 165, 36, .26); --rx-line: #f5a524; --rx-ink: #fde3b0;
    --tx-bg: rgba(34, 184, 207, .26); --tx-line: #22b8cf; --tx-ink: #c4f3fa;
    --shadow-sm: none;
    --shadow: 0 1px 0 rgba(255,255,255,.02) inset, 0 4px 18px rgba(0,0,0,.35);
    --shadow-pop: 0 16px 40px rgba(0,0,0,.55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --accent-ink: color-mix(in srgb, var(--accent) 62%, white);
  --accent-soft: color-mix(in srgb, var(--accent) 20%, transparent);
  --accent-line: color-mix(in srgb, var(--accent) 50%, transparent);
  --bg: #000000;
  --surface: #111111;
  --surface-2: #191919;
  --surface-3: #242424;
  --border: #333333;
  --border-strong: #505050;
  --text: #e6ebf2;
  --text-2: #c3ccd9;
  --muted: #aaaaaa;
  --faint: #999999;
  --ok: #4ade80;  --ok-soft: rgba(74, 222, 128, .12);
  --warn: #fbbf24; --warn-soft: rgba(251, 191, 36, .12);
  --bad: #f87171;  --bad-soft: rgba(248, 113, 113, .13);
  --info: #7cb2ff;
  --tg: #e6ebf2; --tg-bg: #242424; --tg-line: #444444;
  --rx-bg: rgba(245, 165, 36, .26); --rx-line: #f5a524; --rx-ink: #fde3b0;
  --tx-bg: rgba(34, 184, 207, .26); --tx-line: #22b8cf; --tx-ink: #c4f3fa;
  --shadow-sm: none;
  --shadow: 0 1px 0 rgba(255,255,255,.02) inset, 0 4px 18px rgba(0,0,0,.35);
  --shadow-pop: 0 16px 40px rgba(0,0,0,.55);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  font-feature-settings: "tnum" 1, "cv11" 1;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--info); text-decoration: none; }
.talker-alias { display: block; color: var(--muted); white-space: normal; overflow-wrap: anywhere; }
.key-controls, .service-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.key-controls input { min-width: 0; max-width: 100%; }
.service-form { max-width: 760px; }
.service-form fieldset { border: 1px solid var(--border); padding: 16px; margin: 16px 0; }
.service-form label { display: block; margin: 8px 0; }
.service-form input:not([type="checkbox"]), .service-form select { max-width: 100%; }
.service-result { white-space: pre-wrap; overflow-wrap: anywhere; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
b, strong { font-weight: 600; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar::before {
  content: ""; display: block; height: 3px;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 40%, #22d3ee));
}
.wrap { width: 100%; max-width: 1360px; margin: 0 auto; padding: 0 24px; }
.topbar-row { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { height: 38px; width: auto; flex: none; }
/* The logo sits on a small white plate with rounded corners - the same shape in light and dark
   mode (in light mode a fine edge shows the plate against the white bar) */
.brand img { background: #fff; padding: 3px 6px; border-radius: 9px; box-sizing: content-box; box-shadow: 0 0 0 1px var(--border); }
:root[data-theme="dark"] .brand img { box-shadow: none; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.brand-name { font-size: 16px; font-weight: 650; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 12px; color: var(--muted); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: none; }

.icon-btn {
  width: 34px; height: 34px; display: inline-grid; place-items: center;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); color: var(--text-2); cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn .i-sun { display: none; }
:root[data-theme="dark"] .icon-btn .i-sun { display: block; }
:root[data-theme="dark"] .icon-btn .i-moon { display: none; }

/* Language picker */
.lang-pick {
  position: relative; display: inline-flex; align-items: center; height: 34px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2);
  color: var(--text-2); transition: background .15s, border-color .15s;
}
.lang-pick:hover { background: var(--surface-3); color: var(--text); }
.lang-pick:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.lang-pick svg { position: absolute; left: 9px; width: 16px; height: 16px; pointer-events: none; }
.lang-pick select {
  appearance: none; -webkit-appearance: none; border: 0; background: transparent; color: inherit;
  font: inherit; font-size: 13px; font-weight: 550; height: 100%; padding: 0 26px 0 31px; cursor: pointer;
  max-width: 150px; text-overflow: ellipsis;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 13px) 15px, calc(100% - 9px) 15px; background-size: 4px 4px; background-repeat: no-repeat;
}
.lang-pick select:focus { outline: none; }
.lang-pick option { color: #151820; background: #fff; }

/* ---------- Navigation tabs ---------- */
.tabs {
  display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none;
  margin: 0 -8px; padding: 0 0 0;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs .dropbtn {
  position: relative; display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 12px 12px; white-space: nowrap;
  color: var(--muted); font-size: 13.5px; font-weight: 550;
  border: 0; background: none; font-family: inherit; cursor: pointer;
  border-radius: 8px 8px 0 0;
  transition: color .15s;
}
.tabs a svg, .tabs .dropbtn svg { width: 16px; height: 16px; opacity: .85; }
.tabs a:hover, .tabs .dropbtn:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--accent-ink); }
.tabs a.active::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px;
  border-radius: 2px 2px 0 0; background: var(--accent);
}
/* Drop-down menus (groups in buttons.php) */
.dropdown { position: relative; display: inline-flex; }
.tabs .dropbtn .chev { width: 14px; height: 14px; margin-left: -2px; opacity: .6; transition: transform .15s; }
.dropdown.open .dropbtn { color: var(--text); }
.dropdown.open .dropbtn .chev { transform: rotate(180deg); }
.dropdown.active .dropbtn { color: var(--accent-ink); }
.dropdown.active .dropbtn::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px;
  border-radius: 2px 2px 0 0; background: var(--accent);
}
.dropdown-content {
  display: none; position: fixed; z-index: 80; min-width: 250px; max-width: calc(100vw - 24px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-pop); padding: 6px;
}
.dropdown.open .dropdown-content { display: block; animation: dd-in .12s ease-out; }
@keyframes dd-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.dropdown-content a {
  display: flex; align-items: flex-start; gap: 11px; padding: 9px 10px; border-radius: 8px;
  color: var(--text); text-decoration: none;
}
.dropdown-content a svg { width: 17px; height: 17px; margin-top: 2px; flex: none; color: var(--muted); }
.dropdown-content a:hover, .dropdown-content a:focus-visible { background: var(--surface-3); outline: none; }
.dropdown-content a.active { background: var(--accent-soft); }
.tabs .dropdown-content a.active::after { display: none; }
.dropdown-content a.active svg, .dropdown-content a.active .dd-label { color: var(--accent-ink); }
.dd-text { display: flex; flex-direction: column; min-width: 0; }
.dd-label { font-size: 13.5px; font-weight: 600; }
.dd-desc { font-size: 12px; color: var(--muted); margin-top: 1px; }

/* ---------- Page ---------- */
.page { flex: 1; padding-top: 28px; padding-bottom: 40px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.search {
  position: relative; display: flex; align-items: center;
}
.search svg { position: absolute; left: 11px; width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.search input {
  width: 300px; text-overflow: ellipsis; height: 38px; padding: 0 12px 0 35px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text);
  font: inherit; box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
}
.search input::placeholder { color: var(--faint); }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.stack { display: grid; gap: 20px; }
.feed:empty::before {
  content: attr(data-empty-text);
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 160px; border: 1px dashed var(--border-strong); border-radius: var(--radius);
  color: var(--muted); background: var(--surface);
}
.feed { transition: opacity .3s, filter .3s; }
.feed.stale { opacity: .5; filter: grayscale(.6); pointer-events: none; }
.feed[data-offline]:empty::before { content: attr(data-offline-text); color: var(--bad); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card + .card { margin-top: 20px; }
.card-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.card-head h2 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -.005em; display: flex; align-items: center; gap: 9px; }
.card-head h2 svg { width: 17px; height: 17px; color: var(--accent-ink); }
.card-head .count {
  font-size: 12px; font-weight: 600; color: var(--muted);
  background: var(--surface-3); border-radius: 999px; padding: 1px 9px;
}
.card-head .spacer { flex: 1; }
.card-head .hint { font-size: 12.5px; color: var(--muted); }
.card-body { padding: 16px 18px; }
.card-foot { padding: 10px 18px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); background: var(--surface-2); }
.card.flush .card-body { padding: 0; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend .l-rx { background: var(--rx-line); }
.legend .l-tx { background: var(--tx-line); }
/* Repeaters / Hotspots: the legend shows the same RX / TX badges as the slots */
.legend i.badge-rx, .legend i.badge-tx { width: auto; height: auto; padding: 1px 5px; border-radius: 4px; font-style: normal;
  font-family: var(--mono); font-size: 10.5px; font-weight: 800; letter-spacing: .04em; line-height: 15px; }
.legend i.badge-rx { color: #3d1d00; }
.legend i.badge-tx { color: #fff; }

/* ---------- Stat tiles ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 14px;
}
.stat-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); flex: none; }
.stat-icon svg { width: 20px; height: 20px; }
.stat.is-hot .stat-icon { background: var(--rx-bg); color: var(--rx-line); }
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.stat-value { font-size: 24px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }

/* ---------- Activity / on-air ---------- */
.activity { display: flex; flex-wrap: wrap; gap: 10px; min-height: var(--activity-min); align-items: center; }
.qso {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 14px 8px 10px; border-radius: 12px;
  background: var(--rx-bg); border: 1px solid color-mix(in srgb, var(--rx-line) 45%, transparent);
  font-size: 15px; font-weight: 600; color: var(--text);
}
.qso-src {
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  color: var(--rx-ink); background: color-mix(in srgb, var(--rx-line) 22%, transparent);
  border-radius: 6px; padding: 2px 6px;
}
.qso-wave { display: inline-flex; gap: 2px; align-items: center; height: 14px; }
.qso-wave i { width: 3px; border-radius: 2px; background: var(--rx-line); animation: wave 1s ease-in-out infinite; }
.qso-wave i:nth-child(1) { height: 6px; animation-delay: -.3s; }
.qso-wave i:nth-child(2) { height: 12px; animation-delay: -.15s; }
.qso-wave i:nth-child(3) { height: 8px; }
.qso-call { color: var(--info); }
.qso-arrow { color: var(--faint); width: 16px; height: 16px; }
.qso-tg { font-family: var(--mono); font-size: 13.5px; font-weight: 600; color: var(--rx-ink); }
.idle { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.idle-icon { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--faint); }
.idle-icon svg { width: 18px; height: 18px; }
.idle b { color: var(--text-2); display: block; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.data th {
  position: sticky; top: 0; z-index: 1;
  text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); background: var(--surface-2);
  padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.data td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data tbody tr:last-child td { border-bottom: 0; }
.data:not(.grouped) tbody tr:hover td,
.data.grouped tbody[data-search]:hover td,
.data.grouped tr[data-search]:hover td { background: var(--surface-2); }
.data .num { text-align: right; white-space: nowrap; }
.data .center { text-align: center; }
.data th.num { text-align: right; }

.call { font-weight: 650; color: var(--info); }
a.call:hover { color: var(--accent-ink); }
.call-id { display: block; font-family: var(--mono); font-size: 11.5px; color: var(--muted); font-weight: 400; }
.person { color: var(--text-2); }
.tg {
  font-family: var(--mono); font-weight: 600; color: var(--tg); white-space: nowrap;
  background: var(--tg-bg); box-shadow: inset 0 0 0 1px var(--tg-line);
  border-radius: 6px; padding: 1px 6px;
}
td.RX .tg, td.TX .tg { background: transparent; box-shadow: none; padding: 0; color: inherit; }
.tg-name { color: var(--text-2); }
.time { white-space: nowrap; }
.time small { display: block; color: var(--muted); font-size: 11.5px; }
.show-sm { display: none; }
.sys { font-family: var(--mono); font-size: 12.5px; color: var(--text-2); }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 650; line-height: 1;
  padding: 4px 8px; border-radius: 999px; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.plain::before { display: none; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.accent { background: var(--accent-soft); color: var(--accent-ink); }
.badge.data { background: var(--accent-soft); color: var(--accent-ink); }

.tag {
  display: inline-block; font-family: var(--mono); font-size: 12px; font-weight: 600;
  padding: 2px 7px; margin: 2px 2px 2px 0; border-radius: 6px;
  background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border);
}
.tag.single { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
/* Static TGs in the slot rows of Repeaters / Hotspots: compact tags - same text size and weight
   as elsewhere, just the least padding that keeps each number clear of its edge */
.slot-tgs .tag { padding: 0 3px; margin: 1px 2px 1px 0; line-height: 17px; border-radius: 4px; vertical-align: middle; }
.slot-tgs .muted { font-size: 13px; }

/* System groups (linked systems / static TG) */
.data tr.group th {
  position: static; text-transform: none; letter-spacing: 0;
  font-size: 13px; color: var(--text); background: var(--accent-soft);
  border-top: 1px solid var(--border); padding: 9px 14px;
}
.data tbody:first-of-type tr.group th { border-top: 0; }
.group-meta { font-weight: 500; color: var(--muted); margin-left: 8px; font-size: 12px; }
.station { min-width: 180px; }
.station .loc { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data td.span { border-right: 1px solid var(--border); }
.slot { font-family: var(--mono); font-size: 11.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.slot.ts1::before, .slot.ts2::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px; vertical-align: middle; background: var(--border-strong); }
td.RX, td.TX { position: relative; }
td.RX { background: var(--rx-bg) !important; color: var(--rx-ink); font-weight: 600; }
td.TX { background: var(--tx-bg) !important; color: var(--tx-ink); font-weight: 600; }
/* A slot in use: the whole row is tinted and edged in the colour, the slot cell gets a thick
   bar on the left, a pulsing dot and an RX / TX badge (space for the badge is always kept, so
   nothing moves when a call starts or ends) */
td.RX { box-shadow: inset 0 2px 0 var(--rx-line), inset 0 -2px 0 var(--rx-line); }
td.TX { box-shadow: inset 0 2px 0 var(--tx-line), inset 0 -2px 0 var(--tx-line); }
td.slot.RX { box-shadow: inset 5px 0 0 var(--rx-line), inset 0 2px 0 var(--rx-line), inset 0 -2px 0 var(--rx-line); }
td.slot.TX { box-shadow: inset 5px 0 0 var(--tx-line), inset 0 2px 0 var(--tx-line), inset 0 -2px 0 var(--tx-line); }
td.slot.RX::before { background: var(--rx-line); animation: blink 1s ease-in-out infinite; width: 8px; height: 8px; }
td.slot.TX::before { background: var(--tx-line); animation: blink 1s ease-in-out infinite; width: 8px; height: 8px; }
.lnk-table td.slot, .data td.slot.ts1, .data td.slot.ts2 { min-width: 76px; }
td.slot.RX::after, td.slot.TX::after {
  display: inline-block; margin-left: 6px; padding: 1px 5px; border-radius: 4px; vertical-align: middle;
  font-size: 10.5px; font-weight: 800; letter-spacing: .04em; line-height: 15px; color: #fff;
}
td.slot.RX::after { content: "RX"; background: var(--rx-line); color: #3d1d00; }
td.slot.TX::after { content: "TX"; background: var(--tx-line); color: #fff; }
@media (prefers-reduced-motion: reduce) { td.slot.RX::before, td.slot.TX::before { animation: none; } }
.uptime { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
.pings { display: block; font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 3px; }
.sub { color: var(--muted); font-size: 12px; }

/* Horizontal bar (TG count) */
.bar { position: relative; height: 6px; border-radius: 3px; background: var(--surface-3); min-width: 80px; margin-top: 6px; overflow: hidden; }
.bar > span { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: var(--accent); }
.rank { font-family: var(--mono); color: var(--faint); font-size: 12px; width: 32px; }

/* ---------- Chips + popovers (connected stations) ---------- */
.chip-section + .chip-section { margin-top: 16px; }
.chip-title { font-size: 11.5px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.chip-title svg { width: 14px; height: 14px; flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  position: relative; display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 11px; border-radius: 9px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-weight: 600; font-size: 13px; color: var(--text); cursor: default;
  transition: border-color .15s, background .15s, transform .15s;
}
.chip:hover, .chip:focus-within, .chip:focus { border-color: var(--accent-line); background: var(--surface); outline: none; }
.chip a { color: var(--info); font-weight: 650; }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.chip.is-down { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); color: var(--bad); }
.chip.is-down .dot { background: var(--bad); }
.chip .kind { width: 14px; height: 14px; color: var(--faint); }

.pop { display: none; }
/* Popovers are lifted out of their (scrolling) card by ui.js into #float-pop */
#float-pop {
  position: fixed; z-index: 100; top: 0; left: 0;
  width: max-content; max-width: min(340px, calc(100vw - 24px)); min-width: 200px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow-pop);
  padding: 12px 14px; font-size: 12.5px; font-weight: 400; line-height: 1.45;
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity .14s, transform .14s, visibility .14s;
  pointer-events: none; text-align: left;
}
#float-pop.show { opacity: 1; visibility: visible; transform: none; }
#float-pop.small { min-width: 0; padding: 6px 10px; font-weight: 600; }
#float-pop .pop-title { font-size: 14px; font-weight: 700; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
#float-pop dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; }
#float-pop dt { color: var(--muted); }
#float-pop dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }
.has-pop { position: relative; display: inline-block; cursor: help; }
.has-pop:focus { outline: none; }

/* ---------- OpenBridge streams ---------- */
.streams { display: flex; flex-wrap: wrap; gap: 6px; }
.stream { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 4px; border-radius: 8px; font-size: 12.5px; font-weight: 600; background: var(--surface-3); }
.stream .dir { font-size: 10.5px; font-weight: 700; padding: 2px 5px; border-radius: 5px; }
.stream.rx .dir, .badge.rx { background: var(--rx-bg); color: var(--rx-ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--rx-line) 45%, transparent); }
.stream.tx .dir, .badge.tx { background: var(--tx-bg); color: var(--tx-ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tx-line) 45%, transparent); }
.stream .call { font-size: 12.5px; }

/* ---------- Country flags (before DMR IDs) ---------- */
img.flag {
  display: inline-block; width: auto; height: 13px; max-width: 22px;
  margin-right: 6px; vertical-align: -1px; border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .12);
}
img.flag:not([src]) { display: none; }
.qso-call img.flag, .stream img.flag { vertical-align: -1px; }
.chip img.flag { margin-right: 0; }
#float-pop .pop-title img.flag { height: 15px; max-width: 26px; margin-right: 2px; }

/* ---------- Info page: regions > countries > talkgroups, in columns ---------- */
.tg-body { padding: 4px 18px 18px; }
.tg-region + .tg-region { margin-top: 6px; }
.tg-region-head {
  display: flex; align-items: center; gap: 10px; margin: 14px 0 12px; padding: 8px 12px;
  font-size: 14px; font-weight: 650; border-radius: 8px; background: var(--accent-soft); color: var(--text);
}
.tg-region-head img.flag { margin-right: -2px; height: 18px; max-width: 24px; box-shadow: none; }
.tg-region-head .count { font-size: 12px; font-weight: 600; color: var(--muted); }
.tg-cols { columns: 3 300px; column-gap: 16px; }
.tg-country {
  break-inside: avoid; margin: 0 0 14px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface);
}
.tg-country.big { break-inside: auto; }
.tg-country.big:not(:has(.tg-country-head)) { border: 0; background: none; }
.tg-country.big:not(:has(.tg-country-head)) li { border-radius: 6px; }
.tg-country-head {
  display: flex; align-items: center; gap: 2px; padding: 7px 12px;
  background: var(--surface-2); border-bottom: 1px solid var(--border); border-radius: 10px 10px 0 0;
  font-weight: 650; font-size: 13.5px; break-after: avoid;
}
.tg-country-head .count { margin-left: auto; font-size: 11.5px; font-weight: 600; color: var(--muted); background: var(--surface-3); border-radius: 999px; padding: 0 7px; }
.tg-country ul { list-style: none; margin: 0; padding: 4px 0; }
.tg-country li { display: flex; gap: 10px; padding: 4px 12px; font-size: 13.5px; line-height: 1.4; break-inside: avoid; }
.tg-country li:hover { background: var(--surface-2); }
.tg-num { font-family: var(--mono); font-size: 12.5px; font-weight: 600; color: var(--tg); min-width: 64px; flex: none; }
.tg-label { min-width: 0; overflow-wrap: anywhere; color: var(--text); }
@media (max-width: 700px) {
  .tg-body { padding: 2px 12px 12px; }
  .tg-cols { columns: 1; }
}

/* ---------- States ---------- */
.empty { padding: 44px 20px; text-align: center; color: var(--muted); overflow-wrap: anywhere; }
.empty .spinner { margin: 0 auto 14px; }
.empty-title { color: var(--text-2); font-weight: 600; font-size: 15px; margin: 0 0 4px; }
.empty-text { margin: 0; font-size: 13px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.no-match td { text-align: center; color: var(--muted); padding: 28px 14px !important; }
[hidden] { display: none !important; }

/* ---------- Call log console (moni.php) ---------- */
.console {
  margin: 0; height: 60vh; min-height: 320px; overflow-y: auto;
  padding: 16px 18px; background: #0b0d10; color: #b7f0d4;
  font: 12.5px/1.6 var(--mono); white-space: pre-wrap; word-break: break-word;
}
.btn {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); color: var(--text-2);
  font: inherit; font-size: 13px; font-weight: 550; cursor: pointer;
}
.btn:hover { background: var(--surface-3); color: var(--text); }
.btn svg { width: 15px; height: 15px; }
.btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent-line); }

/* ---------- DMR ID Lookup (ids.php) ---------- */
.idq { padding: 18px; margin-bottom: 20px; }
.idq-form { display: flex; gap: 10px; align-items: stretch; }
.search.search-lg { flex: 1; min-width: 0; }
.search.search-lg svg { left: 14px; width: 18px; height: 18px; }
.search.search-lg input { width: 100%; height: 46px; padding-left: 42px; font-size: 16px; font-family: var(--mono); letter-spacing: .02em; }
.btn-go { height: 46px; padding: 0 20px; font-size: 14px; background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-go:hover { filter: brightness(1.08); background: var(--accent); color: #fff; }
.idq-help { margin: 10px 2px 0; font-size: 12.5px; color: var(--muted); }
.idq-id { font-family: var(--mono); white-space: nowrap; }
.idq-id .flag { margin-right: 6px; vertical-align: -1px; }
.data td.idq-heard { white-space: nowrap; color: var(--text-2); }
.idq-heard small { display: block; color: var(--muted); font-size: 12px; }
.idq-never { color: var(--faint); }
.idq-more { margin: 0; padding: 10px 18px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--border); }
mark.idq-hit { background: var(--accent-soft); color: inherit; border-radius: 3px; padding: 0 1px; }
@media (max-width: 560px) { .idq-form .btn-go { padding: 0 14px; } .idq { padding: 14px; } }

/* ---------- Worldwide bridges ---------- */
.ww-body .tg-label a { color: var(--info); overflow-wrap: anywhere; }
.ww-key { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 12px 18px; border-bottom: 1px solid var(--border); background: var(--surface-2); font-size: 13px; color: var(--text-2); }
.ww-key-item b { font-family: var(--mono); color: var(--text); }
.ww-key-label { color: var(--muted); }
.ww-nets { display: flex; flex-wrap: wrap; gap: 6px; }
.ww-net { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--surface); box-shadow: inset 0 0 0 1px var(--border-strong); color: var(--text-2); }
.page-note { margin: 0 0 14px; padding: 10px 14px; font-size: 13px; color: var(--warn); background: var(--warn-soft); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.ww-note { margin: 0; padding: 10px 18px; font-size: 13px; color: var(--warn); background: var(--warn-soft); border-bottom: 1px solid var(--border); }

/* ---------- Options calculator ---------- */
.calc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); gap: 20px; align-items: start; }
.calc > .card { grid-column: 1; margin: 0; }
.calc > .card.result { grid-column: 2; grid-row: 1 / span 3; position: sticky; top: 16px; }
.calc .help { font-size: 12.5px; color: var(--muted); margin: 8px 0 0; line-height: 1.45; }
.calc .help-top { margin: 0 0 14px; }
.seg.seg-lg button { font-size: 13.5px; padding: 7px 14px; }
.calc input[type="text"], .calc select {
  font: inherit; font-size: 14px; height: 36px; padding: 0 10px; width: 100%; min-width: 0;
  color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px;
  transition: border-color .15s, box-shadow .15s;
}
.calc input[type="text"] { font-family: var(--mono); text-overflow: ellipsis; }
.calc input:focus, .calc select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.calc input.dup { border-color: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.slots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.slot-box { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; background: var(--surface-2); }
.slot-box h3 { margin: 0 0 10px; font-size: 13px; font-weight: 650; color: var(--text-2); }
.slot-box.off .tg-rows, .slot-box.off .add-tg { opacity: .4; pointer-events: none; }
.slot-off { margin: 8px 0 0; font-size: 12.5px; color: var(--warn); }
/* "No static talkgroups on this slot": sends an empty TS1= / TS2= */
.no-static { display: flex; align-items: flex-start; gap: 6px; margin: 8px 0 0; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.no-static input { margin: 2px 0 0; accent-color: var(--accent); }
.no-static.muted { color: var(--faint); cursor: default; }
.tg-rows.is-none input { opacity: .5; }
/* Length of the Options line (FreeDMR ignores more than 255) */
.out-len { margin: -4px 0 10px; font-size: 12px; color: var(--muted); }
.out-len.over { color: var(--bad); font-weight: 600; }
.tg-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tg-rows li { display: grid; grid-template-columns: 140px minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.calc .tg-label { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13px; color: var(--text-2); }
.calc .tg-label span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tg-rows .rm { width: 30px; height: 30px; color: var(--muted); }
.tg-rows .rm:hover { color: var(--bad); }
.add-tg { margin-top: 10px; }
.opts { display: grid; gap: 18px; }
.opt { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 0 16px; align-items: center; }
.opt[hidden] { display: none; }
.opt-name { font-weight: 600; font-size: 13.5px; }
.opt-field { display: flex; align-items: center; gap: 10px; min-width: 0; max-width: 420px; }
.opt-field input[type="text"] { width: 120px; flex: none; }
.opt .help { grid-column: 2; margin-top: 5px; }
.unit { color: var(--muted); font-size: 13px; }
.out { margin-bottom: 16px; }
.out-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.out-code {
  display: block; min-height: 42px; padding: 10px 12px; font-family: var(--mono); font-size: 13px; line-height: 1.5;
  color: var(--text); background: var(--surface-3); border: 1px solid var(--border); border-radius: 8px;
  word-break: break-all; user-select: all;
}
.calc.is-empty .out-code { color: var(--faint); }
.calc.is-empty .copy { opacity: .45; pointer-events: none; }
.copy.done { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.calc-msg { margin: 0 0 12px; padding: 8px 12px; border-radius: 8px; font-size: 13px; }
.calc-msg.info { background: var(--surface-3); color: var(--muted); }
.calc-msg.warn { background: var(--warn-soft); color: var(--warn); }
.calc .note { margin-top: 0; }
.calc > details.card { grid-column: 1; margin: 0; }
details.adv > summary { cursor: pointer; list-style: none; user-select: none; }
details.adv > summary::-webkit-details-marker { display: none; }
details.adv:not([open]) > summary { border-bottom: 0; }
details.adv .adv-chev { width: 18px; height: 18px; color: var(--muted); transition: transform .15s; }
details.adv[open] .adv-chev { transform: rotate(180deg); }
.opt.opt-wide { align-items: start; }
.opt-wide .opt-name { padding-top: 26px; }
.timer-grid { display: grid; grid-template-columns: auto repeat(3, minmax(64px, 96px)); justify-content: start; gap: 6px 8px; align-items: center; font-size: 13px; }
.timer-grid b { font-size: 12px; font-weight: 650; color: var(--muted); text-align: center; }
.timer-grid b.muted { opacity: .4; }
.timer-grid > span { color: var(--text-2); padding-right: 6px; }
.timer-grid .tg-same { font-size: 12px; color: var(--muted); text-align: center; padding: 0; }
.timer-grid input:disabled { opacity: .4; }
@media (max-width: 1000px) {
  .calc { grid-template-columns: minmax(0, 1fr); }
  .calc > .card.result { grid-column: 1; grid-row: auto; position: static; }
}
@media (max-width: 640px) {
  .slots { grid-template-columns: minmax(0, 1fr); }
  .opt { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .opt .help { grid-column: 1; }
  .opt-wide .opt-name { padding-top: 0; }
  .timer-grid { grid-template-columns: auto repeat(3, minmax(0, 1fr)); }
  .seg.seg-lg { display: flex; }
  .seg.seg-lg button { flex: 1 1 0; min-width: 0; white-space: normal; line-height: 1.3; }
}

/* ---------- System info ---------- */
/* Chart series colours (validated for colour-blind separation in both themes) */
:root { --series-1: #2a78d6; --series-2: #eb6834; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --series-1: #3987e5; --series-2: #d95926; } }
:root[data-theme="dark"] { --series-1: #3987e5; --series-2: #d95926; }

.sys-meta { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font-size: 13px; color: var(--muted); }
.sys-meta svg { width: 16px; height: 16px; flex: none; color: var(--accent-ink); }
.sys-meta span { display: flex; flex-wrap: wrap; gap: 4px 0; }
.sys-meta b { color: var(--text-2); font-weight: 650; }
.sys-meta i { font-style: normal; padding: 0 8px; color: var(--faint); }
/* System Info tiles: compact, icon in the corner, all in one row on a wide screen */
.stats.sys-stats { grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 12px; }
@media (min-width: 1100px) {
  .stats.sys-stats { grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); grid-template-columns: none; }
}
.sys-stats .stat { position: relative; display: block; padding: 12px 14px; min-width: 0; }
.sys-stats .stat-icon { position: absolute; top: 10px; right: 10px; width: 26px; height: 26px; border-radius: 8px; }
.sys-stats .stat-icon svg { width: 15px; height: 15px; }
.sys-stats .stat-label { padding-right: 30px; line-height: 1.3; }
/* Seven or more tiles in the row: no corner icons, so the labels have the room */
@media (min-width: 1100px) {
  .sys-stats:has(> .stat:nth-child(7)) .stat-icon { display: none; }
  .sys-stats:has(> .stat:nth-child(7)) .stat-label { padding-right: 0; }
}
.sys-stats .stat-value { font-size: 21px; margin-top: 2px; }
.sys-stats .stat-sub { margin-top: 3px; line-height: 1.35; }
.stat-main { min-width: 0; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sys-stats .stat-value { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sys-stats .stat-main { min-width: 0; }
.sys-stats .stat.is-bad .stat-value, .sys-stats .stat.is-warn .stat-value { white-space: normal; font-size: 18px; line-height: 1.2; }
.chart .lane-bg { fill: var(--surface-3); }
.chart .lane-on.s3 { fill: var(--bad); }
.chart .lane-on.s2 { fill: var(--series-2); }
.sys-dir { color: var(--muted); font-weight: 600; margin-right: 3px; }
/* Tiles that need a look (amber) or are a problem (red) */
.stat.is-warn .stat-icon { background: var(--warn-soft); color: var(--warn); }
.stat.is-warn .stat-sub { color: var(--warn); }
.stat.is-bad { border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); }
.stat.is-bad .stat-icon { background: var(--bad-soft); color: var(--bad); }
.stat.is-bad .stat-value, .stat.is-bad .stat-sub { color: var(--bad); }
.stat-sub { white-space: normal; }
/* Data used */
.du-card { margin-bottom: 20px; }
.du-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.du-stat { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); }
.du-label { font-size: 12.5px; color: var(--muted); }
.du-value { font-size: 21px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.du-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.du-legend { margin-top: 8px; }
.du-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.du-note { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); }
.du-months { margin-top: 16px; border-top: 1px solid var(--border); }
/* One row per day: exact figures, and a small bar (incoming, then outgoing) to compare days */
.du-table td, .du-table th { white-space: nowrap; }
.du-table tr.is-today td { background: var(--accent-soft, color-mix(in srgb, var(--accent) 7%, transparent)); }
.du-table th.du-barh, .du-table td.du-barh { width: 40%; }
.du-hb { display: flex; gap: 2px; height: 12px; align-items: stretch; }
.du-hb i { display: block; border-radius: 3px; min-width: 0; }
.du-hb i.rx { background: var(--series-1); }
.du-hb i.tx { background: var(--series-2); }
.du-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.du-foot .du-legend { margin-top: 0; }
.du-more { margin-left: auto; }
.du-split { font-size: 11.5px; color: var(--muted); font-weight: 400; margin-top: 1px; }

/* Services + this machine */
.sys-pair { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; margin-bottom: 20px; align-items: start; }
.sys-pair.one { grid-template-columns: minmax(0, 1fr); }
.sys-pair > .card + .card { margin-top: 0; }
.sys-card td b { font-weight: 650; }
.svc-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 9px; background: var(--ok); vertical-align: 1px; }
.svc-bad .svc-dot { background: var(--bad); }
.svc-bad td { background: color-mix(in srgb, var(--bad-soft) 50%, transparent); }
.svc-note { display: block; color: var(--warn); margin-top: 3px; font-size: 12px; }
/* Containers: image under the name, details under the status, version and build date, update state */
.ct-table td { vertical-align: top; }
.ct-sub { display: block; margin-top: 3px; font-size: 12px; color: var(--muted); line-height: 1.4; }
.ct-img { max-width: 34ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; }
.ct-ver { font-weight: 600; color: var(--text); }
.ct-checking { animation: ct-pulse 1.6s ease-in-out infinite; }
@keyframes ct-pulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .ct-checking { animation: none; } }
.ct-note { margin: 0; padding: 10px 16px 14px; font-size: 12.5px; color: var(--text-2); border-top: 1px solid var(--border); }
.card-head .badge.warn { margin-left: 6px; }
/* Phones: each container is a small card - name and image across the top, then status,
   version and update state side by side */
@media (max-width: 700px) {
  .ct-table, .ct-table tbody { display: block; }
  .ct-table thead { display: none; }
  .ct-table tr { display: grid; grid-template-columns: 1fr 1fr; column-gap: 12px; row-gap: 6px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
  table.data.ct-table td { display: block; padding: 0; border: 0; background: none !important; min-width: 0; height: auto; }
  .ct-table td:first-child { grid-column: 1 / -1; }
  .ct-table td:last-child { grid-column: 1 / -1; }
  .ct-table .ct-img { max-width: 100%; }
  .ct-table tr.svc-bad { background: color-mix(in srgb, var(--bad-soft) 50%, transparent); }
}
.mc-list { list-style: none; margin: 0; padding: 0; }
.mc-row { display: grid; grid-template-columns: minmax(110px, max-content) minmax(0, 1fr); gap: 4px 16px; padding: 12px 18px; border-top: 1px solid var(--border); font-size: 13.5px; }
.mc-row:first-child { border-top: 0; }
.mc-label { color: var(--muted); padding-top: 2px; }
.mc-val small { display: block; margin-top: 4px; color: var(--text-2); font-size: 12.5px; overflow-wrap: anywhere; }
.mc-val code { font-family: var(--mono); font-size: 12px; background: var(--surface-3); border-radius: 5px; padding: 1px 5px; }
.badge.info { background: var(--accent-soft); color: var(--accent-ink); }
.sys-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin: 4px 0 14px; }
.sys-range-title { margin: 0; font-size: 15px; font-weight: 650; }
/* OpenBridge: network ID under the system name, so the streams get the width */
.data .ob-sys { width: 1%; white-space: nowrap; padding-right: 28px; vertical-align: top; }
.ob-net { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.ob-net .mono { color: var(--text-2); }
.ob-table .stream { white-space: nowrap; }
@media (max-width: 700px) {
  /* phones: system name on its own line, its streams underneath at full width */
  .ob-table thead { display: none; }
  .ob-table tr { display: block; border-bottom: 1px solid var(--border); }
  .ob-table tbody tr:last-child { border-bottom: 0; }
  .ob-table td { display: block; border: 0 !important; }
  .data.ob-table td.ob-sys { width: auto; padding-bottom: 4px; }
  .ob-table td.ob-sys + td { padding-top: 6px; }
  .ob-table .ob-net { display: inline; margin: 0 0 0 8px; }
}
/* Repeaters / Hotspots: fixed columns. Station, Connected, Slot and Static TGs keep the width
   their content needs, on the left; Source and Destination share the rest. Static TGs: six
   5-digit TGs per line (more carry on to a second line). Narrower screens use the card layout
   further down. */
@media (min-width: 1200px) {
  .lnk-table { table-layout: fixed; }
  .lnk-table th { box-sizing: border-box; }
  .lnk-table th:nth-child(1) { width: 174px; }
  .lnk-table th:nth-child(2) { width: 104px; }
  .lnk-table th:nth-child(3) { width: 90px; }   /* "TS1" plus the RX / TX badge while a call is on it */
  .lnk-table th:nth-child(4) { width: 306px; }   /* exactly six 5-digit TGs: 6 x (44 + 2) + padding */
  .lnk-table th:nth-child(2), .lnk-table td.uptime { padding-left: 12px; padding-right: 10px; }
  .lnk-table th:nth-child(3), .lnk-table td.slot { padding-left: 10px; padding-right: 6px; }
  .lnk-table thead th { white-space: normal; overflow-wrap: anywhere; }   /* a long heading in another language wraps instead of being cut */
  .lnk-table td.station .loc { max-width: 100%; }
  .lnk-table td.slot ~ td:not(.slot-tgs) { overflow-wrap: anywhere; }
}
/* Options the station set, under its details */
.station .stn-opts { display: grid; grid-template-columns: auto minmax(max-content, 1fr); column-gap: 8px; align-items: baseline;
  margin-top: 5px; padding-top: 5px; border-top: 1px dashed var(--border); font-size: 11.5px; line-height: 1.5; }
.station .stn-opts .so-k { color: var(--muted); white-space: normal; line-height: 1.25; }
.station .stn-opts .so-v { color: var(--text-2); white-space: nowrap; min-width: 0; }
.station .stn-opts .so-v .mono, .station .stn-opts .so-v.mono { font-size: 11px; }
.station .stn-opts .so-lang { color: var(--muted); margin-left: 2px; }
.station .stn-opts .so-warn { grid-column: 1 / -1; color: var(--warn); font-weight: 600; }
.opt-on { color: var(--ok); font-weight: 600; }
.opt-off { color: var(--muted); font-weight: 600; }
/* Frequency / colour code under a station */
.station .st-id { display: block; margin-top: 1px; }
.station .freq { display: block; margin-top: 3px; font-size: 11.5px; line-height: 1.45; color: var(--muted); white-space: nowrap; }
.station .freq .fq { display: block; }
.station .freq b { display: inline-block; min-width: 4.2ch; font-weight: 600; color: var(--faint); }
.station .freq .fq-sys { max-width: 24ch; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
@media (max-width: 700px) {
}
.login-card { max-width: 460px; padding: 22px; }
/* Centred pages (login): heading and card in the middle of the page */
.page-center .page-head { justify-content: center; text-align: center; margin-top: 6vh; }
.page-center .login-card { margin: 0 auto; }
.login-form label { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 10px; }
.login-form label svg, .login-card .empty-title svg { width: 17px; height: 17px; vertical-align: -3px; }
.login-row { display: flex; gap: 10px; }
.login-row input { flex: 1; min-width: 0; height: 44px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; font-size: 15px; }
.login-row input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.login-row .btn-go { height: 44px; }
.login-error { margin: 12px 0 0; padding: 8px 12px; border-radius: var(--radius-xs); background: var(--bad-soft); color: var(--bad); font-size: 13px; }
.login-help { margin: 12px 0 0; font-size: 12.5px; color: var(--muted); }
.tgc-note { margin: 0; padding: 9px 18px; font-size: 12.5px; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--surface-3); border: 1px solid var(--border); border-radius: 10px; }
.seg button {
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--muted); background: transparent;
  border: 0; border-radius: 7px; padding: 5px 11px; min-width: 44px; cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--accent-ink); box-shadow: var(--shadow-sm); }
.seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
#sysinfo.loading .sys-charts { opacity: .45; transition: opacity .2s; }
.chart-tip .tip-time span { font-weight: 500; }
.sys-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr)); gap: 20px; align-items: start; margin-bottom: 20px; }
.sys-charts .card + .card { margin-top: 0; }
/* Current / lowest / highest under each System Info graph */
.chart-stats { display: grid; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.chart-stat { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); gap: 8px; align-items: baseline; font-size: 13px; }
.chart-stat.one { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.chart-stat .cs-name { display: flex; align-items: center; gap: 6px; color: var(--text-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-stat .cs-name i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.chart-stat small { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.chart-stat b { font-family: var(--mono); font-size: 13px; font-weight: 650; white-space: nowrap; }
.chart-stat .cs-cur b { color: var(--accent-ink, var(--text)); }
@media (max-width: 520px) {   /* phones: the series name on its own line above its figures */
  .chart-stat { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 2px; }
  .chart-stat .cs-name { grid-column: 1 / -1; }
}
/* A last graph that would sit alone on its row takes the whole row */
@media (min-width: 1000px) { .sys-charts > .card:last-child:nth-child(odd) { grid-column: 1 / -1; } }
.sys-chart .card-body { padding: 10px 12px 8px; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .tick { stroke: var(--border-strong); }
.chart text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .ylab { text-anchor: end; }
.chart .xlab { text-anchor: middle; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.s1, .chart .dot.s1, .chart .hdot.s1 { stroke: var(--series-1); }
.chart .line.s2, .chart .dot.s2, .chart .hdot.s2 { stroke: var(--series-2); }
.chart .line.s3, .chart .dot.s3, .chart .hdot.s3 { stroke: var(--bad); }
.chart .dot.s3 { fill: var(--bad); }
i.s3 { background: var(--bad); }
.chart .dot.s1 { fill: var(--series-1); } .chart .dot.s2 { fill: var(--series-2); }
.chart .area.s1 { fill: var(--series-1); opacity: .12; stroke: none; }
.chart .hdot { fill: var(--surface); stroke-width: 2.5; }
.chart .cross { stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart-tip {
  position: absolute; top: 6px; z-index: 5; pointer-events: none; min-width: 140px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px;
  box-shadow: var(--shadow); padding: 8px 10px; font-size: 12px;
}
.chart-tip .tip-time { color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.tip-row span { color: var(--text-2); flex: 1; }
.tip-row b { font-variant-numeric: tabular-nums; }
.tip-row i, .sys-chart .legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
i.s1 { background: var(--series-1); } i.s2 { background: var(--series-2); }

/* ---------- Footer ---------- */
/* Always visible at the bottom of the window; the page scrolls underneath it */
.site-footer { position: sticky; bottom: 0; z-index: 40; border-top: 1px solid var(--border); background: var(--surface);
  color: var(--muted); font-size: 12.5px; box-shadow: 0 -4px 14px rgba(15, 23, 42, .06); }
.site-footer .wrap { display: flex; justify-content: space-between; align-items: center; gap: 4px 12px; flex-wrap: wrap;
  padding-top: 10px; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
@media (max-width: 640px) {
  .site-footer { font-size: 11px; }
  .site-footer p { line-height: 1.4; }
  .site-footer .wrap { padding-top: 6px; padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px)); }
}
.site-footer p { margin: 0; line-height: 1.6; }
.site-footer a { color: var(--text-2); font-weight: 550; }

/* ---------- Animations ---------- */
@keyframes ping { 0% { transform: scale(.6); opacity: .7; } 100% { transform: scale(1.8); opacity: 0; } }
@keyframes blink { 50% { opacity: .35; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes wave { 50% { transform: scaleY(.45); } }
@keyframes qso-in { from { opacity: 0; transform: translateY(3px); } }
/* ---------- Smooth live updates (scripts/hbmon.js) ---------- */
/* first data on a page fades in; new items ease in; ended calls and stations shrink away */
.fx-fade { animation: fx-fade .35s ease-out; }
.fx-in { animation: fx-in .28s cubic-bezier(.2,.7,.3,1) both; }
tr.fx-in, tbody.fx-in { animation-name: fx-row-in; }
.qso.fx-out, .chip.fx-out {
  min-width: 0 !important; width: 0 !important; padding-left: 0 !important; padding-right: 0 !important;
  border-width: 0 !important; opacity: 0; transform: scale(.85); overflow: hidden; white-space: nowrap;
  pointer-events: none;
  transition: width .28s ease, padding .28s ease, margin .28s ease, border-width .28s ease, opacity .2s ease, transform .28s ease;
}
.qso.fx-out { margin-right: -10px; }
.chip.fx-out { margin-right: -8px; }
.stat-value.fx-bump { animation: fx-bump .6s ease-out; }
/* cells that change state (e.g. a slot starting to receive) fade to their new colour */
.data td, .data th, .chip, .qso, .stat, .stat-icon, .badge { transition: background-color .35s ease, color .35s ease, border-color .35s ease, box-shadow .35s ease; }
@keyframes fx-fade { from { opacity: 0; } }
@keyframes fx-in { from { opacity: 0; transform: translateY(4px) scale(.96); } }
@keyframes fx-row-in { from { opacity: 0; transform: translateY(-6px); } }
@keyframes fx-bump { 0% { color: var(--accent); transform: translateY(-2px); } 100% { transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Station page (station.php) ---------- */
.st-find { margin-bottom: 20px; }
.st-head { margin-bottom: 20px; }
.st-head .card-body { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.st-name { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.st-name .flag { align-self: center; width: 24px; height: auto; }
.st-name .call { font-size: 26px; font-weight: 750; letter-spacing: -.02em; color: var(--text); }
.st-name .person { font-size: 16px; color: var(--text-2); }
.st-meta { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 4px; font-size: 13px; color: var(--muted); }
.st-meta a { color: var(--accent-ink); }
.st-links { display: flex; gap: 8px; flex-wrap: wrap; }
.st-links .btn { height: 34px; }
.stats.st-stats { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.st-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; margin: 20px 0; }
.st-pair > .card + .card { margin-top: 0; }
.st-pair + .card, .card + .st-pair { margin-top: 20px; }
.st-via { display: inline-flex; align-items: center; gap: 7px; }
.st-via svg { width: 15px; height: 15px; color: var(--faint); flex: none; }
.st-via .call-id { display: inline; margin-left: 4px; }
.st-bars { display: grid; grid-template-columns: repeat(30, minmax(0, 1fr)); gap: 3px; height: 90px; align-items: end; }
.st-bar { height: 100%; display: flex; align-items: flex-end; border-radius: 3px; background: var(--surface-2); }
.st-bar i { display: block; width: 100%; border-radius: 3px; background: var(--accent); }
.st-bar:hover i { filter: brightness(1.15); }
.st-bars-axis { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11.5px; color: var(--muted); font-family: var(--mono); }
a.tg:hover { border-color: var(--accent-line); color: var(--accent-ink); }
a.tag { text-decoration: none; }
a.tag:hover { border-color: var(--accent-line); color: var(--accent-ink); }
a.call:hover, a.call-id:hover { text-decoration: underline; }

/* ---------- Top … by Airtime (Admin) ---------- */
.stats.top-stats { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.top-note { margin: -6px 0 16px; font-size: 12.5px; color: var(--muted); }
.top-table .rank { color: var(--muted); width: 36px; }
.top-table .call { font-size: 14.5px; }
.top-table .top-name { display: block; font-size: 12.5px; color: var(--text-2); }
.top-table .top-tgname { display: block; margin-top: 3px; font-size: 12px; color: var(--text-2); }
.top-table .top-tgname .flag { margin-right: 5px; vertical-align: -1px; }
.top-table .bar { max-width: 260px; }

/* ---------- Busy hours (TG Count) ---------- */
.heat-card { margin-top: 20px; }
.heat { display: grid; grid-template-columns: 38px repeat(24, minmax(0, 1fr)); gap: 3px; align-items: center; }
.heat .hh { font-size: 10.5px; color: var(--muted); font-family: var(--mono); text-align: left; height: 14px; overflow: visible; white-space: nowrap; }
.heat .hd { font-size: 12px; color: var(--text-2); font-weight: 550; }
.heat .hc { aspect-ratio: 1 / 1; min-height: 12px; border-radius: 3px; cursor: pointer; background: var(--surface-3); }
.heat .hc:hover, .heat .hc.sel, .heat .hc:focus-visible { outline: 2px solid var(--text-2); outline-offset: 1px; }
.heat-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.heat-read { margin: 0; font-size: 13px; color: var(--text-2); min-height: 18px; }
.heat-key { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; color: var(--muted); }
.heat-key span { margin: 0 4px; }
.heat-key i { width: 12px; height: 12px; border-radius: 3px; background: var(--surface-3); }
/* Busy hours: 8 steps from quiet to busy, changing colour as well as strength so each step is
   easy to tell apart - pale yellow, orange, red, deep purple in light mode; in dark mode the
   other way round (dark purple to bright yellow), so busy hours are always the most striking */
:root { --hm1: #fde9a6; --hm2: #fdd17a; --hm3: #fdb05a; --hm4: #f8893f; --hm5: #ec5f34; --hm6: #d33a3a; --hm7: #a8204f; --hm8: #6a1558; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --hm1: #3a1c5c; --hm2: #5c2177; --hm3: #85297f; --hm4: #ad3577; --hm5: #d44c63; --hm6: #ef714d; --hm7: #fba046; --hm8: #fcd860; } }
:root[data-theme="dark"] { --hm1: #3a1c5c; --hm2: #5c2177; --hm3: #85297f; --hm4: #ad3577; --hm5: #d44c63; --hm6: #ef714d; --hm7: #fba046; --hm8: #fcd860; }
.heat [data-step="1"], .heat-key [data-step="1"] { background: var(--hm1); }
.heat [data-step="2"], .heat-key [data-step="2"] { background: var(--hm2); }
.heat [data-step="3"], .heat-key [data-step="3"] { background: var(--hm3); }
.heat [data-step="4"], .heat-key [data-step="4"] { background: var(--hm4); }
.heat [data-step="5"], .heat-key [data-step="5"] { background: var(--hm5); }
.heat [data-step="6"], .heat-key [data-step="6"] { background: var(--hm6); }
.heat [data-step="7"], .heat-key [data-step="7"] { background: var(--hm7); }
.heat [data-step="8"], .heat-key [data-step="8"] { background: var(--hm8); }

/* ---------- Health page (health.php) ---------- */
/* Overall status */
.hc-summary { display: flex; align-items: center; gap: 16px; padding: 18px 20px; margin-bottom: 20px; border-left: 5px solid var(--ok); }
.hc-summary.warn { border-left-color: var(--warn); }
.hc-summary.bad { border-left-color: var(--bad); }
.hc-sum-ico { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--ok-soft); color: var(--ok); }
.hc-summary.warn .hc-sum-ico { background: var(--warn-soft); color: var(--warn); }
.hc-summary.bad .hc-sum-ico { background: var(--bad-soft); color: var(--bad); }
.hc-sum-ico svg { width: 26px; height: 26px; stroke-width: 2.2; }
.hc-sum-txt { flex: 1; min-width: 0; }
.hc-sum-head { font-size: 21px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.hc-sum-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.hc-counts { display: flex; gap: 8px; flex-wrap: wrap; }
.hc-count { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 12px; border-radius: 10px; font-size: 12.5px; font-weight: 600; }
.hc-count b { font-size: 18px; font-weight: 750; }
.hc-count.ok { background: var(--ok-soft); color: var(--ok); }
.hc-count.warn { background: var(--warn-soft); color: var(--warn); }
.hc-count.bad { background: var(--bad-soft); color: var(--bad); }
.hc-count.zero { background: var(--surface-3); color: var(--faint); }

/* The checks */
.hc-card { margin-bottom: 20px; }
.hc-list { list-style: none; margin: 0; padding: 0; }
/* Health: the checks in two groups - what needs attention, then what is working */
.hc-group { display: flex; align-items: center; gap: 8px; padding: 10px 20px 8px; font-size: 11.5px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--muted); background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.hc-group:first-of-type { border-top: 0; }
.hc-group .count { font-size: 11px; letter-spacing: 0; }
/* "Working normally" collapses so a healthy page stays short; problems stay open above it */
.hc-fine { border-top: 1px solid var(--border); }
.hc-fine > summary.hc-group { border-top: 0; cursor: pointer; list-style: none; user-select: none; }
.hc-fine > summary.hc-group::-webkit-details-marker { display: none; }
.hc-fine > summary.hc-group::after { content: ''; margin-left: auto; width: 7px; height: 7px; border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; }
.hc-fine[open] > summary.hc-group::after { transform: rotate(45deg); }
.hc-fine > summary.hc-group:hover { color: var(--text); background: var(--surface-3); }
.hc-fine:not([open]) > .hc-list { display: none; }   /* a styled <summary> stops the browser hiding this itself */
/* Section heading between the status checks and the reference cards */
.hc-section { font-size: 12px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  margin: 24px 2px 10px; }
/* System Info status: the items needing attention as small chips under the heading */
.sys-status { margin-bottom: 16px; }
.sys-issues { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.sys-issues li { font-size: 12.5px; padding: 2px 9px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-weight: 500; }
.sys-issues li.bad { background: var(--bad-soft); color: var(--bad); }
.hc-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 4px 14px; align-items: start; padding: 14px 20px; border-top: 1px solid var(--border); }
.hc-row:first-child { border-top: 0; }
.hc-row.bad { background: color-mix(in srgb, var(--bad-soft) 45%, transparent); }
.hc-row.warn { background: color-mix(in srgb, var(--warn-soft) 40%, transparent); }
.hc-ico { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; }
.hc-ico svg { width: 16px; height: 16px; stroke-width: 2.2; }
.hc-row.ok .hc-ico { background: var(--ok-soft); color: var(--ok); }
.hc-row.warn .hc-ico { background: var(--warn-soft); color: var(--warn); }
.hc-row.bad .hc-ico { background: var(--bad-soft); color: var(--bad); }
.hc-txt { min-width: 0; padding-top: 4px; }
.hc-title { font-weight: 650; font-size: 15px; line-height: 1.3; }
.hc-desc { font-size: 13.5px; color: var(--text-2); margin-top: 3px; line-height: 1.55; overflow-wrap: anywhere; }
.hc-badge { margin-top: 5px; }
/* What to do about it */
.hc-fix { margin-top: 8px; padding: 8px 12px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--surface-2);
  border-left: 3px solid var(--warn); font-size: 13px; color: var(--text-2); line-height: 1.5; overflow-wrap: anywhere; }
.hc-row.bad .hc-fix { border-left-color: var(--bad); }
.hc-fix p { margin: 0 0 6px; }
.hc-fix p + p, .hc-cmd + p { margin-top: 10px; }
.hc-cmd { display: flex; align-items: stretch; gap: 0; margin-top: 6px; max-width: 100%; }
.hc-cmd code { flex: 1; min-width: 0; display: block; padding: 7px 10px; border-radius: 7px 0 0 7px; background: var(--surface-3); color: var(--text);
  font-size: 12.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.hc-copy { display: inline-flex; align-items: center; gap: 5px; padding: 0 11px; border: 1px solid var(--border); border-radius: 0 7px 7px 0;
  background: var(--surface-2); color: var(--text-2); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.hc-copy:hover { color: var(--accent-ink); border-color: var(--accent-line); }
.hc-copy.done { color: var(--ok); }
.hc-copy svg { width: 14px; height: 14px; }
.health .hc-desc code, .health .kv code, .health .card-head code { font-family: var(--mono); font-size: 12px; background: var(--surface-3); border-radius: 5px; padding: 1px 5px; overflow-wrap: anywhere; }

/* Details */
.kv { display: grid; grid-template-columns: minmax(110px, max-content) minmax(0, 1fr); gap: 0; margin: 0; font-size: 13.5px; }
.kv dt, .kv dd { padding: 8px 0; border-top: 1px solid var(--border); }
.kv dt:first-of-type, .kv dt:first-of-type + dd { border-top: 0; padding-top: 0; }
.kv dt { color: var(--muted); padding-right: 16px; }
.kv dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }

/* Log */
.hc-logcard .seg button { font-size: 12.5px; }
.hc-log { max-height: 460px; overflow: auto; padding: 6px 0; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; background: var(--surface-2); }
.lg-row { display: grid; grid-template-columns: 74px 70px minmax(0, 1fr); gap: 10px; padding: 3px 20px; }
.lg-row:hover { background: var(--surface-3); }
.lg-time { color: var(--muted); white-space: nowrap; }
.lg-time small { display: block; font-size: 10.5px; color: var(--faint); }
.lg-lvl { font-size: 11px; font-weight: 700; letter-spacing: .03em; color: var(--faint); padding-top: 1px; }
.lg-msg { color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.lg-row.warn { background: color-mix(in srgb, var(--warn-soft) 70%, transparent); }
.lg-row.warn .lg-lvl, .lg-row.warn .lg-msg { color: var(--warn); }
.lg-row.bad { background: color-mix(in srgb, var(--bad-soft) 80%, transparent); }
.lg-row.bad .lg-lvl, .lg-row.bad .lg-msg { color: var(--bad); font-weight: 600; }
.hc-jump { height: 32px; font-size: 12.5px; }
.st-pair { align-items: start; }
.lg-empty { padding: 24px 20px; text-align: center; color: var(--muted); font-family: var(--font); font-size: 13.5px; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .wrap { padding: 0 16px; }
  .topbar-row { min-height: 56px; gap: 10px; }
  .brand img { height: 30px; padding: 2px 5px; border-radius: 7px; }
  .brand-sub { display: none; }
  .brand-name { font-size: 14.5px; }
  .lang-pick select { max-width: 44px; padding-right: 6px; color: transparent; background-image: none; }
  .lang-pick select option { color: #151820; }
  .page { padding-top: 20px; }
  .page-head h1 { font-size: 20px; }
  .page-tools, .search, .search input { width: 100%; }
  .stats { gap: 10px; }
  .stat { padding: 12px; gap: 10px; }
  .stat-icon { width: 34px; height: 34px; }
  .stat-value { font-size: 20px; }
  .card-head { padding: 12px 14px; }
  .card-body { padding: 14px; }
  .data th, .data td { padding: 9px 10px; }
  .hide-sm { display: none; }
  .show-sm { display: block; }
  .seg, .seg.seg-lg { flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .seg button, .seg.seg-lg button { min-width: 0; padding: 5px 8px; }
  small.tg-name { margin-top: 4px; font-size: 12px; color: var(--muted); line-height: 1.3; max-width: 160px; }
  .data.grouped { min-width: 720px; }
  .qso { font-size: 14px; }
}
@media (max-width: 900px) {
  .st-pair, .sys-pair { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
  .st-name .call { font-size: 22px; }
  .heat { grid-template-columns: 30px repeat(24, minmax(0, 1fr)); gap: 2px; }
  .heat .hh { font-size: 9px; }
  .heat .hc { min-height: 8px; border-radius: 2px; }
  .st-bars { gap: 2px; height: 70px; }
  .hc-summary { flex-wrap: wrap; padding: 14px 16px; gap: 12px; }
  .hc-sum-ico { width: 40px; height: 40px; }
  .hc-sum-head { font-size: 18px; }
  .hc-counts { width: 100%; }
  .hc-row { grid-template-columns: 26px minmax(0, 1fr); padding: 12px 14px; gap: 4px 10px; }
  .hc-ico { width: 26px; height: 26px; }
  .hc-badge { grid-column: 2; justify-self: start; margin-top: 2px; }
  .hc-cmd { flex-direction: column; }
  .hc-cmd code { border-radius: 7px 7px 0 0; }
  .hc-copy { border-radius: 0 0 7px 7px; justify-content: center; padding: 6px; }
  .kv { grid-template-columns: minmax(0, 1fr); }
  .kv dt { padding: 8px 0 0; }
  .kv dd { border-top: 0; padding: 2px 0 8px; }
  .lg-row { grid-template-columns: 62px minmax(0, 1fr); padding: 3px 12px; }
  .du-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stats.sys-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .du-stat { padding: 10px 11px; }
  .du-value { font-size: 18px; }
  .lg-lvl { display: none; }
}
@media (max-width: 420px) {
  .brand img { display: none; }
}

/* ---------- Legacy helper classes (kept for custom pages / buttons.php) ---------- */
.txt-green { color: var(--ok); }
.txt-red { color: var(--bad); }
.txt-blue { color: var(--info); }
.txt-b5651d { color: var(--tg); }
.txt-0065ff { color: var(--info); }
.fnt-7pt { font-size: 7pt; }
.fnt-8pt { font-size: 8pt; }
/* Lastheard: a heading per day, "Show more" under the list */
.data tr.day-row th { position: sticky; top: 0; z-index: 1; padding: 8px 14px; background: var(--surface-2); color: var(--text-2);
  font-size: 12.5px; font-weight: 650; text-transform: none; letter-spacing: 0; border-bottom: 1px solid var(--border); }
.lh-foot { display: flex; justify-content: center; }
/* Talk Groups: link to Lastheard, calls in the last 24 hours, busiest ten at the top */
a.tg-num { text-decoration: none; }
a.tg-num:hover { text-decoration: underline; }
.tg-act { margin-left: auto; flex: none; align-self: center; font-size: 11px; font-weight: 650; color: var(--accent-ink);
  background: var(--accent-soft); border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.tg-country li.is-active .tg-label { font-weight: 600; }
.tga-strip { padding: 12px 18px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.tga-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 8px; }
.tga-title { font-weight: 650; font-size: 13.5px; }
.tga-hint { font-size: 12.5px; color: var(--muted); }
.tga-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 8px; }
.tga-chip { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 5px 10px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface); color: var(--text); text-decoration: none; font-size: 13px; }
.tga-chip:hover { border-color: var(--accent); }
.tga-chip .tg { flex: none; min-width: 6.4em; text-align: center; }
.tga-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tga-n { flex: none; margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
/* Repeaters / Hotspots on phones and tablets: each station as a card - station, connected time,
   then each slot with its static TGs and, while there is a call, who is talking and on which TG */
@media (max-width: 1199px) {
  .data.lnk-table { min-width: 0; }
  .lnk-table thead { display: none; }
  .lnk-table tbody[data-group] { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; row-gap: 6px;
    align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .lnk-table tbody[data-group] tr { display: contents; }
  .lnk-table tbody[data-group] td { display: block; padding: 0; border: 0 !important; }
  .lnk-table tbody[data-group] td.station { grid-column: 1 / -1; }
  .lnk-table tbody[data-group] td.station + td { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
  .lnk-table tbody[data-group] td.slot { grid-column: 1; padding: 4px 6px; border-radius: 6px; }
  .lnk-table tbody[data-group] td.slot-tgs { grid-column: 2; }
  .lnk-table tbody[data-group] td.slot ~ td:not(.slot-tgs) { grid-column: 2; font-size: 13px; }
  .lnk-table tbody[data-group] td.slot ~ td:not(.slot-tgs):empty { display: none; }
  .lnk-table tbody[data-group] td.RX:not(.slot), .lnk-table tbody[data-group] td.TX:not(.slot) { padding: 3px 6px; border-radius: 6px; }
}

/* Busy hours: today's row (the top one) */
.heat .hd.is-today { color: var(--accent-ink); font-weight: 700; }

/* TG Count on phones: each talkgroup as a card - TG and name with its airtime, the QSO bar,
   then the most active callsigns - instead of a table that scrolls sideways */
@media (max-width: 700px) {
  .data.tgc-table { min-width: 0; }
  .tgc-table thead { display: none; }
  .tgc-table tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 6px;
    padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .tgc-table tbody tr:last-child { border-bottom: 0; }
  .tgc-table tbody td { display: block; padding: 0; border: 0 !important; }
  .tgc-table td.tgc-tg { grid-column: 1; }
  .tgc-table td.tgc-tg .call-id { display: block; margin-top: 3px; white-space: normal; }
  .tgc-table td.tgc-air { grid-column: 2; grid-row: 1; align-self: start; font-weight: 600; }
  .tgc-table td.tgc-qso { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; }
  .tgc-table td.tgc-qso .bar { flex: 1; margin: 0; }
  .tgc-table .tgc-lbl { font-size: 12px; margin-left: -4px; }
  .tgc-table td.tgc-calls { grid-column: 1 / -1; }
  .tgc-table td.hide-sm { display: none; }
}
