/* Mention Ops design system (app.css). Tokens first: market.css, call.css and replay.js read these names.
   8 px grid; type 24 / 16 / 14 / 12; weights 400 / 600; 12 px card corners; one accent for primary actions;
   green = Yes / bid / good, red = No / ask / danger, amber = warning. */
:root {
  --bg: #f6f7f9; --panel: #ffffff; --ink: #121418; --muted: #667085; --line: #e4e7ec; --soft: #f1f3f6;
  --accent: #2563eb; --accent-ink: #ffffff; --accent-soft: rgba(37, 99, 235, .10); --accent-hover: #1d4fd0;
  --up: #0e8a5a; --down: #d0352b; --amber: #b25e00;
  --up-soft: rgba(14, 138, 90, .10); --down-soft: rgba(208, 53, 43, .09); --amber-soft: rgba(178, 94, 0, .11);
  --b-public: #0e8a5a; --b-asked: #7a3fc4; --b-found: #2563eb; --b-reg: #0f7f8c; --b-web: #b25e00; --b-none: #7a8190;
  --flash: rgba(37, 99, 235, .14); --focus: rgba(37, 99, 235, .45);
  --skel: #eceef2; --skel-hi: #f6f7f9; --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 8px 24px rgba(16, 24, 40, .14);
  --r: 12px; --r-sm: 8px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0f13; --panel: #15181e; --ink: #e9ebf0; --muted: #98a1b0; --line: #262b34; --soft: #1c2028;
    --accent: #6b9bf7; --accent-ink: #0b0d11; --accent-soft: rgba(107, 155, 247, .14); --accent-hover: #8ab0fa;
    --up: #3cc48b; --down: #f2786a; --amber: #e8a540;
    --up-soft: rgba(60, 196, 139, .13); --down-soft: rgba(242, 120, 106, .13); --amber-soft: rgba(232, 165, 64, .14);
    --b-public: #3cc48b; --b-asked: #b78cf2; --b-found: #6b9bf7; --b-reg: #4cc3cf; --b-web: #e8a540; --b-none: #8b93a3;
    --flash: rgba(107, 155, 247, .2); --focus: rgba(107, 155, 247, .55);
    --skel: #1e222a; --skel-hi: #262b34; --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 8px 24px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d0f13; --panel: #15181e; --ink: #e9ebf0; --muted: #98a1b0; --line: #262b34; --soft: #1c2028;
  --accent: #6b9bf7; --accent-ink: #0b0d11; --accent-soft: rgba(107, 155, 247, .14); --accent-hover: #8ab0fa;
  --up: #3cc48b; --down: #f2786a; --amber: #e8a540;
  --up-soft: rgba(60, 196, 139, .13); --down-soft: rgba(242, 120, 106, .13); --amber-soft: rgba(232, 165, 64, .14);
  --b-public: #3cc48b; --b-asked: #b78cf2; --b-found: #6b9bf7; --b-reg: #4cc3cf; --b-web: #e8a540; --b-none: #8b93a3;
  --flash: rgba(107, 155, 247, .2); --focus: rgba(107, 155, 247, .55);
  --skel: #1e222a; --skel-hi: #262b34; --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 8px 24px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

/* ---------------------------------------------------------------- base */
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 400 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
b, strong, h1, h2, h3, th { font-weight: 600; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.err { color: var(--down); min-height: 1.2em; margin: 0; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.small { font-size: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
h1 { font-size: 24px; line-height: 1.25; margin: 0; letter-spacing: -.2px; }
h2 { font-size: 16px; line-height: 1.35; margin: 0 0 8px; }
h3 { font-size: 14px; margin: 0 0 8px; }

/* ---------------------------------------------------------------- buttons: primary filled, secondary outlined,
   danger red, ghost; .busy shows a spinner while waiting */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600;
  min-height: 36px; padding: 0 16px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: var(--r-sm);
  cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .12s, border-color .12s, transform .06s, box-shadow .12s; }
.btn:hover:not(:disabled) { border-color: color-mix(in srgb, var(--ink) 25%, var(--line)); background: var(--soft); text-decoration: none; }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.98); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: #fff; background: var(--down); border-color: var(--down); }
.btn.danger:hover:not(:disabled) { background: color-mix(in srgb, var(--down) 88%, #000); border-color: color-mix(in srgb, var(--down) 88%, #000); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover:not(:disabled) { background: var(--soft); color: var(--ink); border-color: transparent; }
.btn.small { min-height: 30px; padding: 0 12px; font-size: 12px; }
.btn:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; }
.btn.busy { color: transparent !important; pointer-events: none; }
.btn.busy::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor;
  border-color: var(--muted) transparent var(--muted) var(--muted); animation: spin .7s linear infinite; }
.btn.primary.busy::after, .btn.danger.busy::after { border-color: var(--accent-ink) transparent var(--accent-ink) var(--accent-ink); }
@keyframes spin { to { transform: rotate(360deg); } }
a.btn { text-decoration: none; }
a.btn.disabled { pointer-events: none; }

input, select, textarea { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 12px; min-height: 36px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="checkbox"], input[type="radio"] { min-height: 0; accent-color: var(--accent); }

/* segmented control + chips */
.seg { display: inline-flex; padding: 2px; gap: 2px; background: var(--soft); border: 1px solid var(--line); border-radius: var(--r-sm); }
.seg button { font: inherit; font-weight: 600; font-size: 12px; border: 0; background: transparent; color: var(--muted); padding: 0 12px; min-height: 30px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.seg button:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--focus); }
.chip { font: inherit; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted); border-radius: 999px; cursor: pointer; white-space: nowrap; transition: background .12s, color .12s, border-color .12s; }
.chip:hover { color: var(--ink); border-color: color-mix(in srgb, var(--ink) 25%, var(--line)); }
.chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.chip:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }
.chip .n { font-weight: 400; opacity: .8; }

/* ---------------------------------------------------------------- login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); display: grid; gap: 16px; padding: 32px; box-shadow: var(--shadow); }
.login-card .mark { width: 40px; height: 40px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.login-card h1 { margin: 0; }
.login-card p { margin: 0; }
.login-card label { display: grid; gap: 8px; font-weight: 600; font-size: 12px; color: var(--muted); }
.login-card label input { min-height: 44px; font-size: 16px; }
.login-card .btn { min-height: 44px; width: 100%; margin-top: 8px; }
.login-card .err:empty { display: none; }

/* ---------------------------------------------------------------- header */
.top { position: sticky; top: 0; z-index: 10; display: flex; gap: 24px; align-items: center; padding: 0 24px; min-height: 60px;
  background: color-mix(in srgb, var(--panel) 92%, transparent); backdrop-filter: saturate(1.4) blur(8px); -webkit-backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 16px; letter-spacing: -.1px; white-space: nowrap; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand .mark { width: 24px; height: 24px; border-radius: 6px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none; }
.tabs { display: flex; gap: 4px; align-self: stretch; }
.tabs a { display: inline-flex; align-items: center; padding: 0 12px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); }
.right { margin-left: auto; display: flex; gap: 12px; align-items: center; }
.clock { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; display: inline-flex; gap: 12px; white-space: nowrap; }
.clock .on { color: var(--ink); font-weight: 600; }
.seg.zone button { padding: 0 8px; min-height: 26px; font-size: 12px; }
.who { display: inline-flex; align-items: center; gap: 8px; padding-left: 12px; border-left: 1px solid var(--line); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 12px; font-weight: 600; text-transform: uppercase; flex: none; }

main { padding: 24px 32px 48px; max-width: 1600px; margin: 0 auto; }
.foot { padding: 16px 24px 32px; font-size: 12px; text-align: center; }

/* ---------------------------------------------------------------- page head + toolbars */
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.pagehead p { margin: 4px 0 0; color: var(--muted); }
.pagehead .pageacts { display: flex; gap: 8px; align-items: center; list-style: none; padding: 0; margin: 0; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .grow { flex: 1; }
.search { position: relative; flex: 1 1 260px; max-width: 360px; }
.search input { width: 100%; padding-left: 36px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.sortctl { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.bar .grow { flex: 1; }
.stat { font-size: 12px; }

/* ---------------------------------------------------------------- tables */
.tablewrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--panel); position: sticky; top: 0; white-space: nowrap; }
th[data-s] { cursor: pointer; user-select: none; }
th[data-s]:hover { color: var(--ink); }
th .arr { display: inline-block; margin-left: 4px; color: var(--accent); }
tr:last-child td { border-bottom: 0; }
tbody tr.row { cursor: pointer; transition: background .1s; }
tbody tr.row:hover td { background: var(--soft); }
tbody tr.row:hover .cd:not(.soon):not(.imminent):not(.live):not(.ended) { background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); }
tbody tr.row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
tr.day td { background: var(--bg); font-weight: 600; font-size: 12px; color: var(--muted); padding: 8px 16px; letter-spacing: .1px; }
td .sub { display: block; color: var(--muted); font-size: 12px; }
td.flash { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: var(--flash); } to { background: transparent; } }
.empty { padding: 32px 16px; color: var(--muted); text-align: center; }

/* markets list */
#mt td { padding: 12px 16px; vertical-align: middle; }
#mt th { padding: 12px 16px; }
#mt th:first-child, #mt td:first-child { padding-left: 20px; }
#mt .co b { font-size: 14px; }
#mt .co .tky { color: var(--muted); font-size: 12px; margin-left: 8px; font-weight: 400; letter-spacing: .2px; }
#mt .co .sub { margin-top: 2px; max-width: 46ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#mt .when { white-space: nowrap; }
#mt .svc { color: var(--muted); font-size: 12px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filters { display: contents; }
.vol { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.vbar { display: block; width: 64px; height: 4px; border-radius: 2px; background: var(--soft); overflow: hidden; }
.vbar i { display: block; height: 100%; background: var(--up); opacity: .7; border-radius: 2px; }
.mstat { font-size: 12px; color: var(--muted); }

/* countdown */
.cd { font-variant-numeric: tabular-nums; white-space: nowrap; display: inline-flex; align-items: center; font-size: 12px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px; background: var(--soft); color: var(--ink); }
.cd.soon { color: var(--amber); background: var(--amber-soft); }
.cd.imminent { color: var(--down); background: var(--down-soft); }
.cd.live { color: var(--down); background: var(--down-soft); letter-spacing: .4px; }
.cd.live::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--down); margin-right: 6px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.cd.ended { color: var(--muted); background: transparent; font-weight: 400; }

/* route badges: soft tint of the route colour */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
  background: color-mix(in srgb, currentColor 11%, transparent); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge.public_dialin { color: var(--b-public); }
.badge.found_line { color: var(--b-found); }
.badge.asked_for { color: var(--b-asked); }
.badge.registration_line { color: var(--b-reg); }
.badge.webcast_only { color: var(--b-web); }
.badge.none_yet { color: var(--b-none); }
.tag { display: inline-block; font-size: 12px; padding: 0 6px; border-radius: 6px; background: var(--soft); color: var(--muted); margin-left: 4px; font-weight: 400; }

/* skeletons */
.sk { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--skel) 25%, var(--skel-hi) 50%, var(--skel) 75%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.sk.t { height: 16px; } .sk.pill { height: 20px; border-radius: 999px; }
tr.skel td { padding: 16px; }
.skcard { display: grid; gap: 12px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .sk, .cd.live::before { animation: none; } }

/* ---------------------------------------------------------------- servers */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 20px; }
.tile .muted:first-child { font-size: 12px; font-weight: 600; }
.tile b { display: block; font-size: 24px; line-height: 1.3; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tile .muted + b + .muted { font-size: 12px; }
#sv td, #svt th { padding: 12px 16px; vertical-align: middle; }
#svt th:first-child, #sv td:first-child { padding-left: 20px; }
.state { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12px; }
.state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.state.running { color: var(--up); }
.state.pending { color: var(--amber); }
.state.stopped, .state.stopping { color: var(--muted); }
.state.terminated, .state.shutting-down { color: var(--down); }
tr.srv.terminated td { opacity: .55; }
.note { font-size: 12px; color: var(--muted); max-width: 80ch; margin: 16px 0 0; }

/* ---------------------------------------------------------------- recent calls + reports */
.calls { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); align-items: start; }
.card.call { padding: 20px; transition: border-color .12s; }
.card.call:hover { border-color: color-mix(in srgb, var(--ink) 18%, var(--line)); }
.call .cardtitle h2 { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; }
.card.call .rp-btn-replay:not(:hover) { background: var(--panel); color: var(--accent); border-color: var(--line); }
.card.call .rp-btn-replay:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.call h2 { margin: 0; }
.card.call .when { margin: 4px 0 12px; font-size: 12px; }
.card.call .lesson { margin: 0 0 16px; font-size: 14px; line-height: 1.6; }
.card.call details.reports { border-top: 1px solid var(--line); padding-top: 12px; }
.card.call details.reports ul { margin: 8px 0 0; padding-left: 20px; }
.card.call details.reports p { margin: 8px 0; overflow-wrap: anywhere; }
.call .route { font-size: 12px; color: var(--muted); margin: 0 0 8px; }
.call p { margin: 8px 0; }
.call ul { margin: 8px 0 0; padding-left: 20px; }
.kindtag { display: inline-block; font-size: 12px; font-weight: 600; color: var(--muted); }
.back { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; margin-bottom: 16px; }
.md { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 32px 32px; overflow-x: auto; max-width: 980px; line-height: 1.6; }
.md h1 { margin: 24px 0 8px; } .md h2 { margin: 24px 0 8px; } .md h3 { margin: 16px 0 8px; }
.md table { width: auto; font-size: 12px; }
.md th { position: static; color: var(--ink); background: var(--soft); cursor: default; }
.md td, .md th { border: 1px solid var(--line); }
.md pre { background: var(--soft); padding: 12px; border-radius: var(--r-sm); overflow-x: auto; }
.md code { font-size: 12px; }

/* ---------------------------------------------------------------- toasts (window.toast) */
#toasts { position: fixed; z-index: 100; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--r); background: var(--ink); color: var(--bg);
  box-shadow: var(--shadow-lg); font-weight: 600; animation: toastin .18s ease-out; }
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.toast.ok::before { background: var(--up); } .toast.warn::before { background: var(--amber); } .toast.err::before { background: var(--down); }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }
@keyframes toastin { from { opacity: 0; transform: translateY(8px); } }

/* ---------------------------------------------------------------- shared detail styles (market + call pages) */
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.grid3 { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); } }
.head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 16px; }
.head h1 { margin: 4px 0; font-size: 24px; }
.head .when { font-size: 14px; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; margin: 8px 0 0; }
.kv dt { color: var(--muted); font-size: 12px; padding-top: 2px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.phone { display: inline-flex; gap: 8px; align-items: center; margin: 0 8px 4px 0; }
.phone b { font-variant-numeric: tabular-nums; font-size: 16px; }
.cardtitle { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.cardtitle h2 { margin: 0; }
.dial { display: flex; gap: 8px; align-items: center; margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line); flex-wrap: wrap; }
.side { color: var(--up); font-weight: 600; }
.side.no { color: var(--down); }
.rules { white-space: pre-wrap; font-size: 12px; color: var(--muted); margin: 0; }
details summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.trades { max-height: 560px; overflow-y: auto; }
.empty { padding: 24px 16px; color: var(--muted); text-align: center; }

/* prices: bid green, ask red, last up green / down red */
td.bid, span.bid { color: var(--up); }
td.ask, span.ask { color: var(--down); }
td.last.up { color: var(--up); }
td.last.down { color: var(--down); }
.tag.res-yes { color: var(--up); }
.tag.res-no { color: var(--down); }
.pmcol.off { display: none; }
tr.strike { cursor: pointer; }
tr.strike:hover td { background: var(--soft); }
tr.strike.open td { background: var(--soft); font-weight: 600; }
.caret { color: var(--muted); display: inline-block; width: 1em; }
tr.detail > td { background: var(--bg); padding: 8px; }
.sgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 8px; }
.spanel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; min-width: 0; }
.spanel.wide { grid-column: 1 / -1; }
.spanel h3 { font-size: 14px; margin: 0 0 8px; }
.spanel p { margin: 4px 0; }
.chart { width: 100%; height: auto; display: block; }
.chart polyline { fill: none; stroke-width: 1.6; }
.chart .lbid { stroke: var(--up); } .chart .lask { stroke: var(--down); } .chart .llast { stroke: var(--ink); stroke-dasharray: 3 2; }
.chart .grid { stroke: var(--line); } .chart .axis { fill: var(--muted); font-size: 10px; }
.chart .dot.yes { fill: var(--up); } .chart .dot.no { fill: var(--down); }
.legend { font-size: 12px; }
.legend .k { display: inline-block; width: 12px; height: 3px; vertical-align: middle; margin: 0 3px 0 8px; }
.legend .k.lbid { background: var(--up); } .legend .k.lask { background: var(--down); } .legend .k.llast { background: var(--ink); }
.legend .k.dyes, .legend .k.dno { width: 7px; height: 7px; border-radius: 50%; } .legend .k.dyes { background: var(--up); } .legend .k.dno { background: var(--down); }
.depth { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.depth table, table.mini { width: 100%; font-size: 12px; }
.depth td, table.mini td, table.mini th { padding: 2px 5px; border-bottom: 0; }
table.mini th { position: static; font-size: 12px; }
td.bar { width: 45%; }
.bidbar, .askbar { display: block; height: 9px; border-radius: 2px; opacity: .55; }
.bidbar { background: var(--up); } .askbar { background: var(--down); }
.term { display: inline-block; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; background: var(--soft); border: 1px solid var(--line); border-radius: 5px; padding: 0 6px; margin: 0 4px 4px 0; }
@media (max-width: 640px) {
  .right { flex-wrap: wrap; gap: 8px; }
  .depth { grid-template-columns: 1fr; }
}
/* call card */
.callcard { margin-bottom: 16px; }
.callroute { margin-bottom: 8px; }
.leg { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.leg.up { border-color: var(--up); }
.leghead { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.lstate { font-weight: 600; color: var(--muted); }
.lstate.up { color: var(--up); } .lstate.dialing, .lstate.ringing { color: var(--amber); } .lstate.failed { color: var(--down); }
.rec { color: var(--down); font-weight: 600; font-size: 12px; }
.rec::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--down); margin-right: 4px; animation: pulse 1.4s ease-in-out infinite; }
.armed { font-size: 12px; font-weight: 600; color: var(--accent); }
.meter { display: inline-block; width: 90px; height: 7px; background: var(--soft); border-radius: 4px; overflow: hidden; vertical-align: middle; }
.meter span { display: block; height: 100%; background: var(--up); transition: width .3s; }
.cbtns { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.btn.danger { color: #fff; background: var(--down); border-color: var(--down); }
.btn.armedbtn { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.keypad { display: grid; grid-template-columns: repeat(3, 52px); gap: 6px; }
.btn.key { padding: 8px 0; font-size: 16px; font-variant-numeric: tabular-nums; }
.fires { margin-top: 8px; font-size: 12px; }
.fire { display: inline-block; background: var(--soft); border-radius: 5px; padding: 1px 7px; margin: 2px 4px 2px 0; }
.alog { margin-top: 8px; font-size: 12px; }
.okdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--up); margin-right: 4px; }
#roomwrap { margin-top: 8px; }
.roombar { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin-bottom: 8px; }
#roomframe { width: 100%; height: 640px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.warn { color: var(--amber); margin: 4px 0 8px; }
.acts { list-style: none; padding: 0; margin: 4px 0; } .acts li { padding: 2px 0; }
.more { margin-top: 8px; } .more summary { color: var(--muted); font-size: 12px; cursor: pointer; }

/* add a number (call card) */
.addbar { display: flex; gap: 8px 12px; align-items: center; flex-wrap: wrap; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.addbar .muted { font-size: 12px; }
.addform { margin-top: 8px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--soft); display: grid; gap: 12px; max-width: 560px; }
.addform label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.addform label input { font-size: 14px; }
.addform .arow { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.addform .arow > label:first-child { flex: 1 1 200px; }
.addform label.secs { flex-direction: row; align-items: center; gap: 6px; white-space: nowrap; }
.addform label.secs input { width: 4.5em; }
.small { font-size: 12px; }
.addedby { margin: 2px 0 6px; }
.btn.ghost { background: transparent; color: var(--down); border-color: var(--line); }
.numline { border-left: 3px solid var(--accent); }
@media (max-width: 480px) { .addform { padding: 10px; } .addform label.secs { white-space: normal; } }
/* call card: listen + talk beside the keypad (every connected line) */
.talkrow { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; margin-top: 4px; }
.talk { flex: 1 1 260px; max-width: 420px; display: grid; gap: 8px; }
.talk .tbtns { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.talk .btn.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.talk .topen.on { background: var(--down); border-color: var(--down); }
.talk .ptt { width: 100%; min-height: 64px; padding: 16px 8px; font-size: 16px; font-weight: 600; border: 2px solid var(--down); color: var(--down); background: transparent; border-radius: 12px;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; cursor: pointer; }
.talk .ptt:disabled { opacity: .55; cursor: default; border-color: var(--line); color: var(--muted); }
.talk .ptt.live, .talk .ptt.live:disabled { background: var(--down); border-color: var(--down); color: #fff; opacity: 1; }
.talk .ptt.wait { border-style: dashed; }
.talk .tlvl { display: inline-block; width: 70px; height: 7px; background: var(--soft); border-radius: 4px; overflow: hidden; vertical-align: middle; }
.talk .tlvl span { display: block; height: 100%; width: 0; background: var(--up); transition: width .08s; }
.talk .tmsg { font-size: 12px; min-height: 1.3em; }
.talk.off .ptt { border-color: var(--line); color: var(--muted); }
@media (max-width: 480px) { .talkrow { flex-direction: column; } .talk { flex: none; max-width: none; width: 100%; } }
/* simplified call buttons */
.bwrap { display: inline-flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.help { font-size: 12px; color: var(--muted); }
.talk .sound { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.slabel { font-weight: 600; font-size: 12px; }
.rlvl, .tlvl { display: inline-block; width: 140px; height: 10px; background: var(--soft); border: 1px solid var(--line); border-radius: 5px; overflow: hidden; vertical-align: middle; }
.rlvl span { display: block; height: 100%; width: 0; background: var(--up); transition: width .12s linear; }
.tlvl { width: 70px; height: 7px; }
.tlvl span { display: block; height: 100%; width: 0; background: var(--accent); }
.btn.ptt { font-size: 16px; padding: 8px 16px; font-weight: 600; }
.callmore { margin-top: 8px; }
.btn.ghost[data-del] { color: var(--down); }

/* ---------------------------------------------------------------- phones: >= 44 px touch targets, no sideways scroll */
@media (max-width: 900px) {
  main { padding: 24px 16px 40px; }
  .top { gap: 16px; padding: 0 16px; }
  #who { display: none; }
  .who { padding-left: 0; border-left: 0; }
}
@media (max-width: 640px) {
  .hide-sm { display: none; }
  #whobox { display: none; }
  .top { position: static; flex-wrap: wrap; gap: 0 8px; padding: 8px 16px 0; backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--panel); }
  /* two compact rows: brand, clock, Sign out / the three switches side by side; then the tabs */
  .brand { order: 1; min-height: 44px; }
  .right { display: contents; }
  .clock { order: 2; margin-left: auto; font-size: 12px; gap: 8px; min-height: 44px; align-items: center; padding-right: 8px; }
  .clock span:not(.on) { display: none; }
  #logout { order: 3; }
  .top::after { content: ""; order: 4; flex: 0 0 100%; height: 4px; }
  #zone, #hfmt, #theme { order: 5; flex: 1 1 auto; margin-right: 8px; }
  #theme { margin-right: 0; flex-grow: 1.6; }
  #zone button, #hfmt button, #theme button { flex: 1; }
  .tabs { order: 6; flex: 1 0 100%; gap: 0; border-top: 1px solid var(--line); margin: 8px -16px 0; padding: 0 8px; }
  .tabs a { flex: 1; justify-content: center; min-height: 44px; padding: 0 4px; }
  main { padding: 16px 16px 40px; }
  h1 { font-size: 24px; }
  .btn { min-height: 44px; }
  .btn.small { min-height: 40px; padding: 0 12px; }
  .seg button { min-height: 40px; }
  .seg.zone button { min-height: 38px; padding: 0 8px; }
  .chip { min-height: 40px; }
  input, select { min-height: 44px; font-size: 16px; }
  .search { max-width: none; flex: 1 1 160px; order: 0; }
  .sortctl { order: 1; } .sortctl .lbl { display: none; }
  .toolbar .grow { display: none; }
  .filters { order: 2; display: flex; gap: 8px; flex: 1 0 100%; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 2px; }
  .filters::-webkit-scrollbar { display: none; }
  .filters { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); padding-right: 32px; }
  .filters > * { flex: none; }
  .depth { grid-template-columns: 1fr; }
  /* markets list as stacked rows */
  #mt thead { display: none; }
  #mt, #mt tbody { display: block; }
  #mt tr.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 16px; border-bottom: 1px solid var(--line); align-items: center; }
  #mt tr.row td { display: block; padding: 0 !important; border: 0; background: none !important; }
  #mt tr.row td.hide-sm { display: none; }
  #mt tr.row:hover { background: var(--soft); }
  #mt td.co { grid-column: 1; grid-row: 1; }
  #mt td.vcell { grid-column: 2; grid-row: 1; }
  #mt td.when { grid-column: 1; grid-row: 2; }
  #mt td.when .sub { display: inline; margin-left: 8px; }
  #mt td.cdcell { grid-column: 2; grid-row: 2; text-align: right; }
  #mt td.rt { grid-column: 1 / -1; grid-row: 3; }
  #mt .co .sub { white-space: normal; }
  #mt tr.day, #mt tr.day td { display: block; }
  #mt tr.day td { padding: 8px 16px; }
  #mt tr.skel { display: block; padding: 16px; border-bottom: 1px solid var(--line); }
  #mt tr.skel td { display: block; padding: 4px 0; border: 0; }
  #mt tr.skel td.hide-sm { display: none; }
  #mt tbody > tr:last-child { border-bottom: 0; }
  /* servers as stacked rows */
  #svt thead { display: none; }
  #svt, #svt tbody { display: block; }
  #sv tr.srv { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 16px; border-bottom: 1px solid var(--line); }
  #sv tr.srv:last-child { border-bottom: 0; }
  #sv tr.srv td { display: block; padding: 0 !important; border: 0; }
  #sv tr.srv td:nth-child(1) { grid-column: 1 / -1; }
  #sv tr.srv td:nth-child(2) { grid-column: 1; grid-row: 2; }
  #sv tr.srv td:nth-child(4) { grid-column: 1 / -1; grid-row: 3; }
  #sv tr.srv td:nth-child(5) { grid-column: 2; grid-row: 2; }
  #sv tr.srv td:nth-child(5)::after { content: " / hour"; color: var(--muted); font-size: 12px; }
  #sv tr.srv td.hide-sm { display: none; }
  #sv tr.skel { display: block; padding: 16px; } #sv tr.skel td { display: block; padding: 4px 0; border: 0; } #sv tr.skel td.hide-sm { display: none; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 8px; }
  .tile { padding: 12px 16px; }
  .tile b { font-size: 20px; }
  .tile:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .md { padding: 8px 16px 24px; }
  .card.call { padding: 16px; }
  .card.call details.reports summary, details.more > summary { min-height: 44px; padding: 12px 0; }
  .card.call details.reports { padding-top: 0; }
  .login-card { padding: 24px; }
}
@media (hover: none) { tbody tr.row:hover td { background: transparent; } }
