/* Allmon3 NX console */
:root {
  --font: "Inter Tight", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --r: 14px;
  --side-w: 248px;
  --ease: cubic-bezier(.2,.7,.2,1);
}
[data-theme="dark"] {
  --bg: #07090d;
  --bg2: #0b0f15;
  --panel: #10151d;
  --panel2: #141a24;
  --line: #1d2531;
  --line2: #273141;
  --text: #e6ebf2;
  --muted: #8591a3;
  --faint: #566174;
  --idle: #3ddc97;
  --local: #ffb020;
  --net: #2fd3f5;
  --tele: #a98bff;
  --remote: #ff7ab8;
  --err: #ff5d6c;
  --glow: .55;
  --grid: rgba(255,255,255,.025);
}
[data-theme="light"] {
  --bg: #eef1f5;
  --bg2: #e6eaf0;
  --panel: #ffffff;
  --panel2: #f6f8fb;
  --line: #e1e6ee;
  --line2: #cfd6e1;
  --text: #121822;
  --muted: #5b6678;
  --faint: #8f99a9;
  --idle: #0fa968;
  --local: #d98200;
  --net: #0596bd;
  --tele: #6d4ce0;
  --remote: #d63384;
  --err: #d92d3e;
  --glow: .25;
  --grid: rgba(0,0,0,.03);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 85% -10%, color-mix(in srgb, var(--net) 8%, transparent), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, color-mix(in srgb, var(--tele) 7%, transparent), transparent 60%),
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 100% 32px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 32px 100%,
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
kbd {
  font-family: var(--mono); font-size: 11px; padding: 1px 6px; border-radius: 5px;
  border: 1px solid var(--line2); color: var(--muted); background: var(--panel2);
}
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.app { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.side {
  position: sticky; top: 0; height: 100vh; width: var(--side-w); flex: none;
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px 14px; border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg2) 85%, transparent);
  backdrop-filter: blur(12px);
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 4px 8px 16px; }
.brand-mark {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px;
  color: var(--idle);
  background: color-mix(in srgb, var(--idle) 12%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--idle) 35%, var(--line));
  box-shadow: 0 0 24px color-mix(in srgb, var(--idle) calc(var(--glow) * 40%), transparent);
  transition: color .3s, background .3s, border-color .3s, box-shadow .3s;
}
.brand-mark svg { width: 24px; height: 24px; }
body.tx-any .brand-mark { color: var(--onair); background: color-mix(in srgb, var(--onair) 14%, var(--panel)); border-color: color-mix(in srgb, var(--onair) 45%, var(--line)); box-shadow: 0 0 28px color-mix(in srgb, var(--onair) calc(var(--glow) * 80%), transparent); }
.brand-text { font-size: 19px; letter-spacing: -.02em; }
.brand-text b { font-weight: 800; }
.brand-text i { font-style: normal; font-weight: 500; color: var(--muted); margin-left: 3px; font-family: var(--mono); font-size: 13px; padding: 1px 6px; border: 1px solid var(--line2); border-radius: 6px; vertical-align: 2px; }

.side-label { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--faint); padding: 6px 10px; font-weight: 600; }
.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; margin: 0 -4px; padding: 0 4px; }
.nav a, .nav summary {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px;
  text-decoration: none; color: var(--muted); font-weight: 500; cursor: pointer;
  border: 1px solid transparent; transition: background .15s, color .15s;
}
.nav a:hover, .nav summary:hover { background: var(--panel); color: var(--text); }
.nav a.active { background: var(--panel); color: var(--text); border-color: var(--line); }
.nav .nav-num { font-family: var(--mono); font-weight: 500; }
.nav .nav-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; transition: background .2s, box-shadow .2s; }
.nav .nav-dot.s-idle { background: var(--idle); }
.nav .nav-dot.s-local { background: var(--local); box-shadow: 0 0 10px var(--local); }
.nav .nav-dot.s-net { background: var(--net); box-shadow: 0 0 10px var(--net); }
.nav .nav-dot.s-tele { background: var(--tele); }
.nav .nav-dot.s-remote { background: var(--remote); }
.nav .nav-dot.s-err { background: var(--err); }
.nav .nav-desc { font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav .nav-stack { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.nav details summary { list-style: none; }
.nav details summary::-webkit-details-marker { display: none; }
.nav details summary::after { content: "›"; margin-left: auto; transition: transform .2s; }
.nav details[open] summary::after { transform: rotate(90deg); }
.nav details .sub { padding-left: 14px; display: flex; flex-direction: column; gap: 2px; border-left: 1px solid var(--line); margin-left: 14px; }
.nav .nav-home svg { width: 16px; height: 16px; }

.side-foot { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.side-meta { display: flex; gap: 6px; }
.side-ver { font-size: 11px; color: var(--faint); font-family: var(--mono); padding: 0 4px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted); cursor: pointer;
  text-decoration: none; transition: color .15s, border-color .15s, background .15s, transform .1s;
}
.icon-btn:hover { color: var(--text); border-color: var(--line2); }
.icon-btn:active { transform: scale(.95); }
.icon-btn svg { width: 16px; height: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line2);
  background: var(--panel2); color: var(--text); font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, transform .1s, opacity .15s;
}
.btn:hover { border-color: var(--faint); }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .5; cursor: progress; }
.btn-primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn-primary:hover { opacity: .9; border-color: var(--text); }
.btn-danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 40%, var(--line)); background: color-mix(in srgb, var(--err) 8%, var(--panel)); }
.btn-block { width: 100%; }
.btn svg { width: 16px; height: 16px; }

.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.user-chip .av { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: color-mix(in srgb, var(--idle) 18%, var(--panel2)); color: var(--idle); font-weight: 800; font-size: 12px; }
.user-chip .who { flex: 1; line-height: 1.15; }
.user-chip .who small { display: block; color: var(--faint); font-size: 11px; }

/* ---------- Topbar ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px; padding: 14px 24px;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid var(--line);
}
.menu-btn { display: none; }
.top-title { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.header-logo { height: 34px; width: auto; }
.top h1 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-tools { display: flex; align-items: center; gap: 12px; }
.search {
  display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px 0 12px; width: 260px;
  border: 1px solid var(--line); border-radius: 11px; background: var(--panel); color: var(--faint);
  transition: border-color .15s, width .25s var(--ease);
}
.search:focus-within { border-color: var(--line2); width: 320px; color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; }
.search input::-webkit-search-cancel-button { filter: grayscale(1); }
.clock { display: flex; flex-direction: column; align-items: flex-end; font-family: var(--mono); line-height: 1.1; min-width: 78px; }
.clock span:first-child { font-size: 15px; font-weight: 500; }
.clock-utc { font-size: 11px; color: var(--faint); }

/* ---------- Layout ---------- */
.content { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; padding: 22px 24px; align-items: start; }
.dash { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.rail { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 16px; }
.foot { padding: 8px 24px 24px; color: var(--faint); font-size: 12px; }
.foot a { color: var(--muted); }

/* ---------- Node card ---------- */
.node {
  --accent: var(--idle);
  position: relative; border-radius: calc(var(--r) + 4px);
  background: linear-gradient(180deg, var(--panel), color-mix(in srgb, var(--panel) 92%, var(--bg)));
  border: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 20px 40px -24px rgba(0,0,0,.6);
  overflow: hidden;
  animation: rise .5s var(--ease) both;
  transition: border-color .3s, box-shadow .3s;
}
.node::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: .5; transition: opacity .3s;
}
.node.s-local  { --accent: var(--local); }
.node.s-net    { --accent: var(--net); }
.node.s-tele   { --accent: var(--tele); }
.node.s-remote { --accent: var(--remote); }
.node.s-err    { --accent: var(--err); }
.node.is-tx {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 20%, transparent), 0 0 60px -10px color-mix(in srgb, var(--accent) calc(var(--glow) * 60%), transparent), 0 20px 40px -24px rgba(0,0,0,.6);
}
.node.is-tx::before { opacity: 1; }

.node-head { display: flex; align-items: center; gap: 16px; padding: 18px 20px 14px; flex-wrap: wrap; }
.node-id {
  font-family: var(--mono); font-weight: 700; font-size: 26px; letter-spacing: -.02em; line-height: 1;
  padding: 10px 12px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line);
  color: var(--text); text-decoration: none;
}
.node-title { flex: 1; min-width: 200px; }
.node-title h2 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.node-chips { display: flex; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 7px;
  font-size: 12px; color: var(--muted); background: var(--panel2); border: 1px solid var(--line);
  font-family: var(--mono);
}
.chip b { color: var(--text); font-weight: 600; }
.chip svg { width: 13px; height: 13px; }
.node-actions { display: flex; gap: 6px; }
.node-actions .locked { opacity: .45; }

/* status band */
.band {
  margin: 0 20px; border-radius: var(--r); padding: 14px 16px;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px;
  background: color-mix(in srgb, var(--accent) 7%, var(--panel2));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line));
  transition: background .3s, border-color .3s;
}
.band-state { display: flex; align-items: center; gap: 12px; min-width: 0; }
.band-ico {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent);
}
.band-ico svg { width: 20px; height: 20px; }
.band-label { font-weight: 800; letter-spacing: .06em; text-transform: uppercase; font-size: 13px; color: var(--accent); }
.band-sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.band-mid { min-width: 0; }
.band-timer { font-family: var(--mono); font-size: 28px; font-weight: 700; color: var(--accent); letter-spacing: -.02em; min-width: 5ch; text-align: right; font-variant-numeric: tabular-nums; }
.band-timer:empty::before { content: "—"; color: var(--faint); font-weight: 400; }

/* equalizer bars */
.eq { display: none; align-items: flex-end; gap: 3px; height: 22px; }
.node.is-tx .eq { display: flex; }
.eq i { width: 3px; border-radius: 2px; background: var(--accent); animation: eq 0.9s ease-in-out infinite; }
.eq i:nth-child(1){animation-delay:-.2s}.eq i:nth-child(2){animation-delay:-.5s}.eq i:nth-child(3){animation-delay:-.1s}
.eq i:nth-child(4){animation-delay:-.7s}.eq i:nth-child(5){animation-delay:-.35s}.eq i:nth-child(6){animation-delay:-.6s}

/* timeline */
.tl-wrap { padding: 12px 20px 4px; }
.tl-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); font-family: var(--mono); margin-bottom: 6px; gap: 10px; flex-wrap: wrap; }
.tl-meta b { color: var(--muted); font-weight: 500; }
.tl { display: block; width: 100%; height: 26px; border-radius: 7px; background: var(--panel2); border: 1px solid var(--line); }

/* connection table */
.conns { padding: 10px 12px 14px; }
.ctable { width: 100%; border-collapse: separate; border-spacing: 0 3px; }
.ctable th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--faint);
  font-weight: 600; padding: 6px 10px; white-space: nowrap;
}
.ctable td { padding: 9px 10px; background: transparent; border-top: 1px solid transparent; border-bottom: 1px solid transparent; transition: background .2s; }
.ctable td:first-child { border-radius: 10px 0 0 10px; }
.ctable td:last-child { border-radius: 0 10px 10px 0; }
.ctable tbody tr { cursor: pointer; }
.ctable tbody tr:hover td { background: var(--panel2); }
.ctable tr.sel td { background: color-mix(in srgb, var(--text) 6%, var(--panel2)); border-color: var(--line2); }
.ctable tr.sel td:first-child { border-left: 1px solid var(--line2); }
.ctable tr.sel td:last-child { border-right: 1px solid var(--line2); }
.ctable tr.keyed td { background: color-mix(in srgb, var(--net) 13%, transparent); }
.ctable tr.keyed td:first-child { box-shadow: inset 3px 0 0 var(--net); }
.ctable tr.connecting td { opacity: .55; }
.c-node { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.c-num { font-family: var(--mono); font-weight: 700; font-size: 14px; }
.c-type {
  font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 5px; border: 1px solid var(--line2); color: var(--muted);
}
.c-type.t-asl { color: var(--idle); border-color: color-mix(in srgb, var(--idle) 35%, var(--line)); }
.c-type.t-el { color: var(--tele); border-color: color-mix(in srgb, var(--tele) 35%, var(--line)); }
.c-type.t-priv { color: var(--local); border-color: color-mix(in srgb, var(--local) 35%, var(--line)); }
.c-type.t-web { color: var(--net); border-color: color-mix(in srgb, var(--net) 35%, var(--line)); }
.c-desc { color: var(--text); max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-desc small { display: block; color: var(--faint); font-size: 11px; font-family: var(--mono); }
.c-heard { font-family: var(--mono); white-space: nowrap; }
.c-heard .rel { color: var(--text); }
.c-heard .abs { display: block; font-size: 11px; color: var(--faint); }
.c-heard.never { color: var(--faint); }
.c-heard.hot .rel { color: var(--net); font-weight: 700; }
.c-heard.warm .rel { color: var(--idle); }
.c-mono { font-family: var(--mono); color: var(--muted); white-space: nowrap; }
.dir { display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.dir svg { width: 14px; height: 14px; }
.dir.out { color: var(--net); }
.pill { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.pill.ok { color: var(--idle); border-color: color-mix(in srgb, var(--idle) 30%, var(--line)); }
.pill.mon { color: var(--local); border-color: color-mix(in srgb, var(--local) 30%, var(--line)); }
.pill.warn { color: var(--remote); border-color: color-mix(in srgb, var(--remote) 30%, var(--line)); }
.unlink {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); color: var(--faint);
  transition: color .15s, border-color .15s, background .15s;
}
.unlink:hover { color: var(--err); border-color: color-mix(in srgb, var(--err) 50%, var(--line)); background: color-mix(in srgb, var(--err) 10%, var(--panel)); }
.unlink svg { width: 14px; height: 14px; }
.empty { padding: 22px; text-align: center; color: var(--faint); border: 1px dashed var(--line2); border-radius: 12px; margin: 4px 8px; }
.err-box { margin: 0 20px 18px; padding: 14px 16px; border-radius: var(--r); color: var(--err); border: 1px solid color-mix(in srgb, var(--err) 35%, var(--line)); background: color-mix(in srgb, var(--err) 8%, var(--panel)); }
.ifr iframe { display: block; width: 100%; border: 0; }

body.compact .ctable td { padding: 5px 10px; }
body.compact .c-desc small, body.compact .c-heard .abs { display: none; }
body.compact .node-head { padding: 12px 16px 10px; }

/* hide columns progressively */
@media (max-width: 1280px) { .col-dir { display: none; } }
@media (max-width: 1100px) { .col-ctime { display: none; } }

/* skeleton */
.skel { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--panel2), var(--line), var(--panel2)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }

/* ---------- Rail ---------- */
.rail-card { background: var(--panel); border: 1px solid var(--line); border-radius: calc(var(--r) + 2px); padding: 14px 16px; }
.rail-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.rail-head h2 { margin: 0; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.rail-sub { font-size: 11px; color: var(--faint); }
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 52vh; overflow-y: auto; }
.feed li { display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; align-items: center; padding: 8px 6px; border-radius: 9px; animation: rise .35s var(--ease) both; }
.feed li:hover { background: var(--panel2); }
.feed .fd { width: 8px; height: 8px; border-radius: 50%; background: var(--net); }
.feed .fd.local { background: var(--local); }
.feed li.live .fd { box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 0%, transparent); animation: pulse 1.2s ease-out infinite; }
.feed li.live .fd { color: var(--net); } .feed li.live .fd.local { color: var(--local); }
.feed .ft { min-width: 0; }
.feed .ft b { font-family: var(--mono); font-size: 13px; }
.feed .ft span { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed .fx { text-align: right; font-family: var(--mono); font-size: 12px; color: var(--muted); line-height: 1.2; }
.feed .fx small { display: block; color: var(--faint); font-size: 10px; }
.feed .feed-empty { display: block; color: var(--faint); font-size: 13px; padding: 10px 6px; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 13px; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 10px; }
.sw { width: 18px; height: 8px; border-radius: 3px; display: inline-block; }
.sw-idle { background: color-mix(in srgb, var(--idle) 35%, var(--panel2)); }
.sw-local { background: var(--local); } .sw-net { background: var(--net); } .sw-tele { background: var(--tele); } .sw-remote { background: var(--remote); }
.rail-tip { margin: 14px 0 0; font-size: 12px; color: var(--faint); line-height: 1.7; }

/* ---------- Modal ---------- */
.modal {
  width: min(560px, calc(100vw - 32px)); padding: 22px; border-radius: 18px;
  border: 1px solid var(--line2); background: var(--panel); color: var(--text);
  box-shadow: 0 40px 80px -20px rgba(0,0,0,.6);
}
.modal.wide { width: min(780px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(3,5,8,.6); backdrop-filter: blur(4px); }
.modal[open] { animation: pop .22s var(--ease); }
.modal h3 { margin: 0 0 16px; font-size: 18px; letter-spacing: -.01em; padding-right: 30px; }
.modal-x { position: absolute; top: 14px; right: 14px; margin: 0; }
.modal-x button { width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel2); cursor: pointer; font-size: 20px; line-height: 1; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.input, select.input {
  height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line2);
  background: var(--panel2); color: var(--text); font: inherit; outline: none; width: 100%;
}
.input.mono { font-family: var(--mono); }
.input:focus { border-color: var(--muted); }
.input.bad { border-color: var(--err); }
.row { display: flex; gap: 12px; } .row > * { flex: 1; }
.seg { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; padding: 4px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line); margin-bottom: 14px; }
.seg button { height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-weight: 600; font-size: 13px; cursor: pointer; }
.seg button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 0 var(--line2), 0 2px 8px rgba(0,0,0,.2); }
.seg button.on.danger { color: var(--err); }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; color: var(--muted); font-size: 13px; }
.switch input { appearance: none; width: 36px; height: 20px; border-radius: 999px; background: var(--line2); position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text); transition: transform .2s var(--ease); }
.switch input:checked { background: var(--idle); }
.switch input:checked::after { transform: translateX(16px); }
.modal-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 18px; }
.modal-actions .grow { flex: 1; }
.hint { font-size: 12px; color: var(--faint); margin: -4px 0 14px; }
.preview { font-family: var(--mono); font-size: 12px; color: var(--muted); padding: 10px 12px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); word-break: break-all; }
.preview b { color: var(--text); font-weight: 500; }
.out { margin-top: 14px; }
.out pre { margin: 0; max-height: 46vh; overflow: auto; padding: 14px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); font-family: var(--mono); font-size: 12px; line-height: 1.55; white-space: pre-wrap; }
.out .tag { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; font-weight: 700; margin-bottom: 8px; }
.out .tag.ok { color: var(--idle); } .out .tag.bad { color: var(--err); }
.notice { padding: 14px; border-radius: 12px; border: 1px solid var(--line2); background: var(--panel2); color: var(--muted); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { padding: 12px 16px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line2); box-shadow: 0 20px 40px -10px rgba(0,0,0,.5); animation: rise .25s var(--ease); max-width: 360px; font-size: 13px; }
.toast.ok { border-left: 3px solid var(--idle); } .toast.bad { border-left: 3px solid var(--err); }

/* ---------- Animations ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes blink { 50% { opacity: .2; } }
@keyframes eq { 0%,100% { height: 4px; } 50% { height: 22px; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 currentColor; } 100% { box-shadow: 0 0 0 8px transparent; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .content { grid-template-columns: minmax(0,1fr); }
  .rail { position: static; display: grid; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .side { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .25s var(--ease); box-shadow: 30px 0 60px rgba(0,0,0,.4); background: var(--bg2); }
  body.nav-open .side { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 25; opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
  .menu-btn { display: inline-grid; }
  .search { display: none; }
  .clock { display: none; }
  .top { padding: 12px 14px; gap: 10px; }
  .content { padding: 14px; }
  .rail { grid-template-columns: 1fr; }
  .top h1 { font-size: 16px; }
}
@media (max-width: 720px) {
  .node-head { padding: 14px; gap: 12px; }
  .node-id { font-size: 20px; padding: 8px 10px; }
  .node-title { min-width: 0; flex-basis: calc(100% - 110px); }
  .node-actions { width: 100%; }
  .node-actions > * { flex: 1; width: auto; }
  .band { margin: 0 14px; grid-template-columns: 1fr auto; }
  .band-mid { display: none; }
  .band-timer { font-size: 22px; }
  .tl-wrap { padding: 10px 14px 2px; }
  .conns { padding: 8px 8px 12px; }
  .ctable thead { display: none; }
  .ctable, .ctable tbody { display: block; }
  .ctable tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 12px; border-radius: 12px; margin-bottom: 6px; background: var(--panel2); border: 1px solid var(--line); }
  .ctable tr.keyed { background: color-mix(in srgb, var(--net) 13%, var(--panel2)); box-shadow: inset 3px 0 0 var(--net); }
  .ctable td { padding: 0 !important; background: none !important; border: 0 !important; border-radius: 0 !important; box-shadow: none !important; }
  .ctable .col-dir, .ctable .col-ctime, .ctable .col-state { display: none; }
  .c-desc { max-width: none; white-space: normal; }
}

/* ---------- Embedded panels (iframepre / iframepost) ---------- */
.panel-fold { margin: 10px 20px 0; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg2); }
.ifr[data-post] .panel-fold { margin-bottom: 16px; }
.panel-fold > summary { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; list-style: none; user-select: none; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); border-radius: var(--r); }
.panel-fold > summary::-webkit-details-marker { display: none; }
.panel-fold > summary:hover { background: color-mix(in srgb, var(--text) 3%, transparent); }
.panel-fold > summary svg { width: 15px; height: 15px; }
.panel-fold > summary .m-chev { width: 14px; height: 14px; color: var(--faint); }
.panel-fold[open] > summary .m-chev { transform: rotate(90deg); }
.panel-fold > summary small { margin-left: auto; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--faint); font-size: 11px; }
.panel-fold .panel-body { padding: 0 12px 12px; }
.panel-fold .ifr-wrap { position: relative; min-height: 120px; max-height: 85vh; resize: vertical; overflow: hidden; border-radius: 8px; border: 1px solid var(--line); background: var(--panel2); }
.panel-fold iframe { display: block; width: 100%; height: 100%; border: 0; background: transparent; }

/* ---------- Area repeaters ---------- */
.area {
  border-radius: calc(var(--r) + 4px); border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), color-mix(in srgb, var(--panel) 92%, var(--bg)));
  padding: 18px 20px; animation: rise .5s var(--ease) both;
}
.area-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.area-head h2 { margin: 0; font-size: 18px; display: flex; align-items: center; gap: 10px; }
.area-head h2 svg { width: 20px; height: 20px; color: var(--net); }
.grid-tag { font-family: var(--mono); font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; color: var(--net); border: 1px solid color-mix(in srgb, var(--net) 40%, var(--line)); background: color-mix(in srgb, var(--net) 8%, transparent); }
.area-sub { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.area-sub b { color: var(--text); }
.area-sub .t-hot { color: var(--net); }
.area-sub code { font-family: var(--mono); font-size: 12px; }
.area-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chips { display: flex; gap: 4px; padding: 3px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); }
.chips button { border: 0; background: transparent; color: var(--muted); font-weight: 600; font-size: 12px; padding: 6px 11px; border-radius: 7px; cursor: pointer; }
.chips button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 0 var(--line2); }
.area-body { display: grid; grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.5fr); gap: 18px; align-items: start; }
.area-map { position: sticky; top: 88px; }
.gridmap { display: block; width: 100%; height: auto; border-radius: 12px; background: var(--bg2); border: 1px solid var(--line); }
.gridmap .gl { stroke: var(--line); stroke-width: 1; }
.gridmap .gl-b { stroke: var(--line2); }
.gridmap .lake { fill: color-mix(in srgb, var(--net) 10%, transparent); stroke: color-mix(in srgb, var(--net) 35%, transparent); stroke-width: 1; }
.gridmap .lake-t { fill: color-mix(in srgb, var(--net) 55%, transparent); font: 600 10px var(--font); letter-spacing: .3em; }
.gridmap .city { fill: var(--faint); }
.gridmap .city-t { fill: var(--faint); font: 500 10px var(--font); }
.gridmap .grid-t { fill: var(--line2); font: 800 28px var(--mono); letter-spacing: -.02em; }
.gridmap .home-t { fill: var(--text); font: 700 11px var(--mono); }
.pin .core { fill: var(--faint); stroke: var(--bg2); stroke-width: 1.5; transition: r .15s; }
.pin.h-warm .core { fill: var(--idle); }
.pin.h-hot .core { fill: var(--net); }
.pin.h-now .core { fill: var(--net); }
.pin .ring { fill: none; stroke: var(--net); stroke-width: 1.5; transform-origin: center; animation: ping 2s ease-out infinite; }
.pin.home .core { fill: var(--local); }
.pin.home .ring { stroke: var(--local); }
.pin.hl .core { r: 8; stroke: var(--text); }
.map-legend { display: flex; gap: 14px; justify-content: center; margin-top: 8px; font-size: 11px; color: var(--faint); }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.area-list { max-height: 460px; overflow: auto; border-radius: 12px; border: 1px solid var(--line); }
.rtable { width: 100%; border-collapse: collapse; }
.rtable th { position: sticky; top: 0; background: var(--panel2); text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); font-weight: 600; padding: 9px 10px; z-index: 1; white-space: nowrap; }
.rtable td { padding: 8px 10px; border-top: 1px solid var(--line); white-space: nowrap; }
.rtable tr:hover td { background: var(--panel2); }
.rtable tr.home td { background: color-mix(in srgb, var(--local) 8%, transparent); }
.r-call { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-weight: 700; }
.r-call em { font-style: normal; font-family: var(--font); font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 1px 6px; border-radius: 5px; color: var(--local); border: 1px solid color-mix(in srgb, var(--local) 40%, var(--line)); }
.r-call em.net { color: var(--tele); border-color: color-mix(in srgb, var(--tele) 40%, var(--line)); }
.r-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); display: inline-block; flex: none; }
.h-warm .r-dot, .r-dot.h-warm { background: var(--idle); }
.h-hot .r-dot, .r-dot.h-hot { background: var(--net); }
.h-now .r-dot, .r-dot.h-now { background: var(--net); box-shadow: 0 0 0 3px color-mix(in srgb, var(--net) 25%, transparent); animation: pulse 1.6s ease-out infinite; color: var(--net); }
.r-dot.h-cold { background: var(--faint); }
.r-freq { font-family: var(--mono); font-weight: 500; }
.r-band { font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 4px; margin-left: 4px; color: var(--muted); border: 1px solid var(--line2); }
.r-band.b-2m { color: var(--idle); border-color: color-mix(in srgb, var(--idle) 35%, var(--line)); }
.r-band.b-70cm { color: var(--net); border-color: color-mix(in srgb, var(--net) 35%, var(--line)); }
.r-loc small { display: block; font-size: 11px; color: var(--faint); }
.r-ago { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.h-now .r-ago, .h-hot .r-ago { color: var(--net); }
.h-cold td { color: var(--muted); }
.area-foot { margin: 12px 0 0; font-size: 11px; color: var(--faint); }
@keyframes ping { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(2.4); opacity: 0; } }

@media (max-width: 1100px) { .m-grid { grid-template-columns: 1fr; } .area-body { grid-template-columns: 1fr; } .area-map { position: static; } }
@media (max-width: 720px) {
  .meter-slot { padding: 10px 14px 0; }
  .m-dev-num strong { font-size: 38px; }
  .area { padding: 14px; }
  .rtable th:nth-child(5), .rtable td:nth-child(5) { display: none; }
  .ctable tr { grid-template-columns: 1fr auto; grid-template-areas: "node heard" "desc desc" "mode act"; }
  .ctable td.col-node { grid-area: node; }
  .ctable td.col-heard { grid-area: heard; text-align: right; }
  .ctable td.col-desc { grid-area: desc; }
  .ctable td.col-mode { grid-area: mode; }
  .ctable td.col-act { grid-area: act; grid-row: auto; justify-self: end; }
}

.rtable td { padding: 8px 9px; }
.r-tone { color: var(--faint); margin-left: 6px; }
.r-loc { white-space: normal; }
.rtable td.r-lc { white-space: normal; min-width: 110px; }
@media (max-width: 1400px) { .rtable .r-band { display: none; } }
@media (max-width: 720px) { .rtable .r-ot, .rtable .r-lc { display: none; } .ctable .col-mode .pill { font-size: 10px; } }

.content > .area { grid-column: 1 / -1; }
.area-map .gridmap .home-t { font-size: 10px; }
.gridmap { stroke: none; stroke-width: 0; fill: none; width: 100%; height: auto; }
.gridmap text { stroke: none; }
.gridmap .lake-t { font-size: 11px; }
.gridmap .city-t { font-size: 11px; }
.pin .ring { transform-box: fill-box; transform-origin: center; }

/* map v2: centered on Buffalo */
.gridmap .river { fill: none; stroke: color-mix(in srgb, var(--net) 55%, transparent); stroke-width: 2; stroke-linecap: round; }
.gridmap .gbox { fill: none; stroke: var(--muted); stroke-width: 1; stroke-dasharray: 5 4; opacity: .55; }
.gridmap .gbox-t { fill: var(--muted); opacity: .6; font: 800 16px var(--mono); }
.gridmap .ctr circle { fill: none; stroke: var(--local); stroke-width: 1; opacity: .55; }
.gridmap .ctr path { stroke: var(--local); stroke-width: 1.2; opacity: .55; }
.gridmap .ctr-t { fill: var(--text); font: 700 12px var(--font); letter-spacing: .02em; }
.gridmap .home-t { fill: var(--local); font: 700 10px var(--mono); }
.map-legend .gsw { width: 14px; height: 9px; border: 1px dashed var(--muted); border-radius: 2px; display: inline-block; }
.area-list { max-height: 560px; }

/* radius rings */
.gridmap .ring-out { fill: color-mix(in srgb, var(--local) 4%, transparent); stroke: var(--local); stroke-width: 1.2; stroke-dasharray: 6 5; opacity: .7; }
.gridmap .ring-in { fill: none; stroke: var(--line2); stroke-width: 1; stroke-dasharray: 2 5; }
.gridmap .ring-t { fill: var(--local); font: 700 11px var(--mono); opacity: .85; }
.map-legend .gsw { border-color: var(--local); border-radius: 50%; width: 11px; height: 11px; }


/* live activity */
.live-pill { display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .1em; padding: 1px 7px; border-radius: 999px; color: var(--net); border: 1px solid color-mix(in srgb, var(--net) 40%, var(--line)); vertical-align: 1px; }
.live-pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: blink 1.4s steps(2) infinite; }
.live-pill.off { color: var(--faint); border-color: var(--line2); }
.r-call em.act { color: var(--net); border-color: color-mix(in srgb, var(--net) 45%, var(--line)); background: color-mix(in srgb, var(--net) 10%, transparent); }
.rtable tr.live td { background: color-mix(in srgb, var(--net) 7%, transparent); }
.rtable tr.live td:first-child { box-shadow: inset 3px 0 0 var(--net); }

/* =====================================================================
   v2: ON AIR sign · Listen live · compact meter strip · recent TX feed
   ===================================================================== */
:root { --onair: #ff3b4e; }

/* ON AIR */
.onair {
  display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 12px 0 5px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--panel); transition: border-color .25s, background .25s, box-shadow .25s;
}
.onair-lamp {
  position: relative; display: grid; place-items: center; height: 32px; padding: 0 11px; border-radius: 8px;
  font: 800 13px/1 var(--mono); letter-spacing: .2em; text-indent: .2em;
  color: color-mix(in srgb, var(--onair) 40%, var(--faint));
  border: 1.5px solid color-mix(in srgb, var(--onair) 28%, var(--line));
  background: color-mix(in srgb, var(--onair) 5%, var(--bg2));
  transition: all .2s var(--ease); overflow: hidden;
}
.onair-meta { display: flex; flex-direction: column; justify-content: center; line-height: 1.15; min-width: 0; max-width: 230px; }
.onair-meta b { font: 700 10px var(--mono); letter-spacing: .14em; color: var(--faint); }
.onair-meta span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.onair-timer { font: 700 16px var(--mono); color: var(--onair); font-variant-numeric: tabular-nums; }
.onair-timer:empty { display: none; }
.onair.live { border-color: color-mix(in srgb, var(--onair) 55%, var(--line)); background: color-mix(in srgb, var(--onair) 10%, var(--panel)); box-shadow: 0 0 34px -8px color-mix(in srgb, var(--onair) 70%, transparent); }
.onair.live .onair-lamp {
  color: #fff; border-color: #ff7884; background: linear-gradient(180deg, #ff5463 0%, #e0172d 100%);
  text-shadow: 0 0 10px rgba(255,255,255,.75);
  box-shadow: 0 0 0 1px rgba(255,70,90,.45), 0 0 22px rgba(255,40,64,.85), 0 0 56px rgba(255,40,64,.4), inset 0 1px 0 rgba(255,255,255,.4);
  animation: onair-glow 1.8s ease-in-out infinite;
}
.onair.live .onair-lamp::after {
  content: ""; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%);
  transform: translateX(-120%); animation: onair-sheen 2.6s ease-in-out infinite;
}
.onair.live .onair-meta b { color: #ff6b78; }
.onair.live .onair-meta span { color: var(--text); font-weight: 600; }
body.tx-any .top { border-bottom-color: color-mix(in srgb, var(--onair) 45%, var(--line)); box-shadow: 0 1px 0 color-mix(in srgb, var(--onair) 25%, transparent), 0 10px 40px -20px color-mix(in srgb, var(--onair) 60%, transparent); }
@keyframes onair-glow { 50% { box-shadow: 0 0 0 1px rgba(255,70,90,.35), 0 0 12px rgba(255,40,64,.6), 0 0 30px rgba(255,40,64,.25), inset 0 1px 0 rgba(255,255,255,.4); } }
@keyframes onair-sheen { 0%, 55% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }

/* Listen live */
.listen { display: flex; align-items: center; gap: 8px; }
.listen[hidden] { display: none; }
.listen-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 15px 0 12px; border-radius: 12px; cursor: pointer;
  font-weight: 700; font-size: 13px; color: var(--net);
  border: 1px solid color-mix(in srgb, var(--net) 45%, var(--line)); background: color-mix(in srgb, var(--net) 10%, var(--panel));
  transition: background .2s, color .2s, box-shadow .2s, transform .1s;
}
.listen-btn:hover { background: color-mix(in srgb, var(--net) 18%, var(--panel)); }
.listen-btn:active { transform: scale(.97); }
.listen-btn svg { width: 20px; height: 20px; stroke-width: 2.2; }
.listen-btn .spk { fill: currentColor; stroke: none; }
.listen-btn .w1, .listen-btn .w2 { opacity: .4; }
.listen.on .listen-btn { color: #00141c; background: var(--net); border-color: var(--net); box-shadow: 0 0 26px -4px color-mix(in srgb, var(--net) 80%, transparent); }
.listen.on .w1 { animation: lw 1.1s ease-in-out infinite; }
.listen.on .w2 { animation: lw 1.1s ease-in-out .25s infinite; }
@keyframes lw { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
.listen-more { display: none; align-items: center; gap: 8px; }
.listen.on .listen-more { display: flex; }
.listen-more input { width: 84px; accent-color: var(--net); }
.listen-more small { font: 11px var(--mono); color: var(--faint); min-width: 44px; }

/* compact meter strip in the node card */
.meter-slot:empty { display: none; }
.meter-slot { padding: 10px 20px 0; }
.meter-card-solo { padding: 14px 20px; }
.mx { border-radius: 12px; border: 1px solid var(--line); background: var(--bg2); transition: border-color .2s, box-shadow .2s, opacity .2s; }
.mx.offline { opacity: .5; }
.mx.keyed[data-side="rx"] { border-color: color-mix(in srgb, var(--local) 45%, var(--line)); box-shadow: 0 0 30px -14px color-mix(in srgb, var(--local) 90%, transparent); }
.mx.keyed[data-side="tx"] { border-color: color-mix(in srgb, var(--net) 45%, var(--line)); box-shadow: 0 0 30px -14px color-mix(in srgb, var(--net) 90%, transparent); }
.mx-row { display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 10px; cursor: pointer; user-select: none; border-radius: 12px; }
.mx-row:hover { background: color-mix(in srgb, var(--text) 3%, transparent); }
.mx-row:focus-visible { outline: 2px solid var(--line2); outline-offset: -2px; }
.mx-side { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 62px; height: 22px; padding: 0 8px; border-radius: 6px; font: 700 10px var(--mono); letter-spacing: .12em; color: var(--faint); border: 1px solid var(--line2); }
.mx-side i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.mx[data-side="rx"] .mx-side { background: var(--local); color: #1a0f00; border-color: var(--local); }
.mx[data-side="tx"] .mx-side { background: var(--net); color: #00141c; border-color: var(--net); }
.mx.keyed .mx-side i { animation: blink 1s steps(2) infinite; }
.mx-who { flex: 1; min-width: 60px; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mx.keyed .mx-who { color: var(--text); font-weight: 600; }
.mx-timer { font: 600 13px var(--mono); color: var(--text); font-variant-numeric: tabular-nums; }
.mx-timer:empty { display: none; }
.mx-lv { display: flex; gap: 10px; }
.mx-lvl { display: inline-flex; align-items: center; gap: 5px; opacity: .45; transition: opacity .2s; }
.mx-lvl.on { opacity: 1; }
.mx-lvl em { font: normal 700 9px var(--mono); letter-spacing: .08em; color: var(--faint); }
.mx-lvl i { position: relative; display: block; width: 56px; height: 6px; border-radius: 3px; background: var(--panel2); overflow: hidden; }
.mx-lvl s { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--local); }
.mx-lvl.tx s { background: var(--net); }
.mx-dev { display: inline-flex; align-items: baseline; justify-content: flex-end; gap: 4px; min-width: 88px; }
.mx-dev b { font: 700 18px/1 var(--mono); letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--muted); transition: color .15s; }
.mx-dev small { font: 10px var(--mono); color: var(--faint); }
.mx.keyed .mx-dev b { color: var(--text); }
.mx-dev[data-z="ok"] b { color: var(--idle); }
.mx-dev[data-z="warn"] b { color: var(--local); }
.mx-dev[data-z="hi"] b { color: var(--err); }
.mx-devbar { position: relative; width: 110px; height: 8px; border-radius: 4px; background: var(--panel2); border: 1px solid var(--line); overflow: hidden; flex: none; }
.mx-z { position: absolute; inset: 0; }
.mx-devbar s { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--idle); }
.mx-devbar s[data-z="warn"] { background: var(--local); }
.mx-devbar s[data-z="hi"] { background: var(--err); }
.mx-devbar u { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--text); opacity: 0; transition: left .2s; }
.mx-max { font: 11px var(--mono); color: var(--faint); white-space: nowrap; }
.mx-max b { color: var(--muted); font-weight: 600; }
.mx-max b[data-z="warn"] { color: var(--local); }
.mx-max b[data-z="hi"] { color: var(--err); }
.mx-cal { font: 700 9px var(--font); letter-spacing: .08em; text-transform: uppercase; padding: 2px 6px; border-radius: 5px; color: var(--local); border: 1px solid color-mix(in srgb, var(--local) 40%, var(--line)); text-decoration: none; }
.mx-cal[hidden] { display: none; }
.m-open { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 7px; border: 1px solid var(--line); color: var(--muted); text-decoration: none; font-size: 12px; flex: none; }
.m-open:hover { color: var(--text); border-color: var(--line2); }
.m-chev { width: 14px; height: 14px; color: var(--faint); transition: transform .2s var(--ease); flex: none; }
.mx.open .m-chev { transform: rotate(90deg); }
.mx-body { display: none; grid-template-columns: 1.4fr 1fr; gap: 12px; padding: 0 10px 10px; }
.mx.open .mx-body { display: grid; animation: rise .2s var(--ease); }
.mx-cap { display: flex; justify-content: space-between; gap: 8px; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin-bottom: 4px; }
.mx-cap span:last-child { font-family: var(--mono); letter-spacing: 0; text-transform: none; }
.mx-key i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin: 0 4px 0 8px; vertical-align: -1px; }
.mx-key i.rx { background: var(--local); } .mx-key i.tx { background: var(--net); }
.mx-strip, .mx-wave { display: block; width: 100%; height: 56px; border-radius: 7px; background: var(--panel2); border: 1px solid var(--line); }

/* recent transmissions feed */
.feed li.rx .fd, .feed .fd.local { background: var(--local); }
.feed li.tx .fd { background: var(--net); }
.feed li.live { background: color-mix(in srgb, var(--onair) 9%, transparent); box-shadow: inset 2px 0 0 var(--onair); }
.feed li.live .fd { animation: pulse 1.2s ease-out infinite; color: var(--onair); background: var(--onair); }
.feed li.live .fx { color: var(--onair); font-weight: 700; }
.feed li.live .fx small { color: var(--onair); letter-spacing: .12em; font-weight: 700; }
.feed li.fresh { animation: fresh 2.4s ease-out; }
.feed .z-warn { color: var(--local); } .feed .z-hi { color: var(--err); font-weight: 700; } .feed .z-ok { color: var(--idle); }
@keyframes fresh { 0% { background: color-mix(in srgb, var(--net) 22%, transparent); } 100% { background: transparent; } }

@media (max-width: 1500px) { .search { width: 200px; } .search:focus-within { width: 260px; } }
@media (max-width: 1400px) { .mx-lv { display: none; } .onair-meta { max-width: 160px; } }
@media (max-width: 1200px) { .search { display: none; } .mx-max { display: none; } }
@media (max-width: 900px) { .onair-meta { display: none; } .listen-more small { display: none; } .mx-devbar { width: 70px; } }
@media (max-width: 720px) {
  .meter-slot { padding: 10px 14px 0; }
  .mx-row { gap: 8px; }
  .mx-devbar, .m-open, .mx-cal { display: none; }
  .mx-dev { min-width: 70px; }
  .mx-body { grid-template-columns: 1fr; }
  .listen-btn span { display: none; }
  .listen-btn { padding: 0 11px; }
  .listen-more input { width: 64px; }
  .onair-lamp { padding: 0 8px; font-size: 11px; }
  .onair { padding: 0 8px 0 4px; gap: 6px; }
}

/* v2 refinements */
.mx-dev.held b { opacity: .6; }
.top h1 { font-size: 17px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.2; }
/* search collapses to an icon; expands when clicked or focused */
.search { width: 42px; height: 42px; padding: 0 0 0 12px; cursor: pointer; transition: width .25s var(--ease), border-color .15s; }
.search input { width: 0; opacity: 0; transition: opacity .15s; }
.search kbd { display: none; }
.search:focus-within, .search.has-q { width: 260px; cursor: text; padding-right: 10px; }
.search:focus-within input, .search.has-q input { width: auto; opacity: 1; }
.search:focus-within kbd { display: inline; }
@media (max-width: 1500px) { .search { width: 42px; } .search:focus-within, .search.has-q { width: 240px; } }
@media (max-width: 1200px) { .search { display: flex; } }
@media (max-width: 900px) { .search { display: none; } }
/* feed titles: readable sans, two lines max */
.feed .ft b { font-family: var(--font); font-weight: 600; font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.25; }
.feed .ft span { margin-top: 2px; font-size: 11px; font-family: var(--mono); color: var(--faint); }
.feed li { align-items: start; }
.feed .fd { margin-top: 5px; }

/* recent transmissions: table */
.tx-card .rail-head { margin-bottom: 8px; }
.tx-card .rail-sub b { color: var(--text); }
.tx-wrap { max-height: 56vh; overflow: auto; margin: 0 -6px; }
.txt { width: 100%; border-collapse: collapse; font-size: 12px; }
.txt th { position: sticky; top: 0; z-index: 1; background: var(--panel); text-align: left; font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); padding: 6px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.txt td { padding: 6px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
.txt .num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.txt td.t { font-family: var(--mono); color: var(--muted); }
.txt td.src { max-width: 120px; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.txt tbody tr:hover td { background: var(--panel2); }
.txt tr.day td { padding: 10px 6px 4px; font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); border-bottom: 1px solid var(--line2); background: transparent !important; }
.txt .tag { display: inline-block; font: 700 9px var(--mono); letter-spacing: .08em; padding: 2px 5px; border-radius: 4px; }
.txt .tag.rx { background: color-mix(in srgb, var(--local) 18%, transparent); color: var(--local); }
.txt .tag.tx { background: color-mix(in srgb, var(--net) 18%, transparent); color: var(--net); }
.txt .pk { color: var(--muted); } .txt .pk em { font-style: normal; color: var(--faint); font-size: 10px; margin-left: 1px; }
.txt .z-ok { color: var(--idle); } .txt .z-warn { color: var(--local); } .txt .z-hi { color: var(--err); font-weight: 700; }
.txt tr.live td { background: color-mix(in srgb, var(--onair) 12%, transparent); color: var(--onair); font-weight: 700; }
.txt tr.live td:first-child { box-shadow: inset 2px 0 0 var(--onair); }
.txt tr.live .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--onair); margin-right: 5px; vertical-align: 1px; animation: blink 1s steps(2) infinite; }
.txt tr.live td.src { color: var(--text); }
.txt tr.fresh td { animation: fresh 2.4s ease-out; }
.tx-empty { text-align: center; color: var(--faint); padding: 16px 6px !important; white-space: normal !important; }
.tx-full-btn { margin-top: 12px; height: 34px; font-size: 12px; }
.tx-full-btn[hidden] { display: none; }
/* full log modal */
.modal.xwide { width: min(1080px, calc(100vw - 32px)); }
.txstats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.txstats > div { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2); min-width: 0; }
.txstats small { display: block; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.txstats b { display: block; font: 700 22px var(--mono); margin: 4px 0 2px; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.txstats span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.txtools { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.txnote { font-size: 12px; color: var(--faint); }
.txfull-wrap { max-height: 58vh; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.txt.full { font-size: 13px; }
.txt.full th { background: var(--panel2); padding: 9px 10px; }
.txt.full td { padding: 7px 10px; }
.txt.full td.src { max-width: 360px; }
@media (max-width: 1180px) { .tx-wrap { max-height: 420px; } }
@media (max-width: 720px) { .txstats { grid-template-columns: 1fr 1fr; } .txt.full th:nth-child(1), .txt.full td:nth-child(1), .txt.full th:nth-child(6), .txt.full td:nth-child(6) { display: none; } }

/* =====================================================================
   v10: fit — primary card + compact grid, viewport-sized rail
   ===================================================================== */
.content { gap: 18px; padding: 18px 22px; }
.dash { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 16px; align-items: start; }
.dash > .primary, .dash > .meter-card-solo { grid-column: 1 / -1; }
.node { animation-duration: .35s; }

/* tighter rows everywhere */
.ctable { border-spacing: 0 2px; }
.ctable td { padding: 7px 10px; }
.ctable th { padding: 4px 10px; }
.c-heard .abs { display: inline; margin-left: 6px; font-size: 10px; }
.c-desc { max-width: 360px; }
.node-head { padding: 16px 18px 12px; gap: 14px; }
.band { margin: 0 18px; padding: 12px 14px; }
.meter-slot { padding: 10px 18px 0; }
.tl-wrap { padding: 10px 18px 2px; }
.conns { padding: 8px 10px 12px; }

/* compact secondary cards */
.node.compact .node-head { padding: 12px 14px 10px; gap: 10px; flex-wrap: nowrap; }
.node.compact .node-id { font-size: 18px; padding: 7px 9px; border-radius: 10px; }
.node.compact .node-title { min-width: 0; }
.node.compact .node-title h2 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node.compact .node-chips { margin-top: 5px; gap: 4px; }
.node.compact .chip { height: 21px; padding: 0 7px; font-size: 11px; }
.node.compact .chip:nth-child(3), .node.compact .chip:nth-child(4) { display: none; }
.node.compact .node-actions { gap: 4px; }
.node.compact .node-actions .icon-btn { width: 28px; height: 28px; border-radius: 8px; }
.node.compact .node-actions .icon-btn svg { width: 14px; height: 14px; }
.node.compact .node-actions a.icon-btn:nth-child(2) { display: none; }
.node.compact .band { margin: 0 14px; padding: 8px 10px; gap: 10px; border-radius: 11px; }
.node.compact .band-ico { width: 30px; height: 30px; border-radius: 9px; }
.node.compact .band-ico svg { width: 16px; height: 16px; }
.node.compact .band-label { font-size: 11px; }
.node.compact .band-sub { font-size: 12px; }
.node.compact .band-timer { font-size: 18px; }
.node.compact .band-mid { display: none; }
.node.compact .band { grid-template-columns: 1fr auto; }
.node.compact .tl-wrap { padding: 8px 14px 0; }
.node.compact .tl-meta { margin-bottom: 4px; font-size: 10px; }
.node.compact .tl { height: 16px; border-radius: 5px; }
.node.compact .conns { padding: 6px 6px 10px; }
.node.compact .ctable td { padding: 5px 8px; font-size: 13px; }
.node.compact .ctable th { padding: 3px 8px; }
.node.compact .col-ctime, .node.compact .col-dir { display: none; }
.node.compact .c-heard .abs { display: none; }
.node.compact .c-type { display: none; }
.node.compact .c-desc { max-width: 190px; }
.node.compact .pill { font-size: 10px; padding: 2px 7px; }
.node.compact .empty { padding: 10px; margin: 2px 4px; font-size: 12px; }
.node.compact .panel-fold { margin: 8px 14px 0; }
.node.compact .ifr[data-post] .panel-fold { margin-bottom: 12px; }

/* right column sized to the window */
.rail { top: 82px; max-height: calc(100vh - 98px); display: flex; flex-direction: column; gap: 12px; }
.rail-card { padding: 12px 14px; }
.tx-card { flex: 1 1 auto; min-height: 220px; display: flex; flex-direction: column; }
.tx-card .tx-wrap, .tx-card .feed { flex: 1 1 auto; min-height: 0; max-height: none; overflow: auto; }
.tx-card .tx-full-btn { flex: none; margin-top: 10px; }
.legend-card { flex: none; padding: 10px 12px; }
.legend-card .legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 11px; }
.legend-card .legend li { gap: 6px; }
.legend-card .sw { width: 12px; height: 6px; }
.foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.foot-keys kbd { font-size: 10px; padding: 0 5px; }
@media (max-width: 1180px) {
  .rail { max-height: none; }
  .tx-card .tx-wrap { max-height: 420px; }
}
@media (max-width: 720px) {
  .dash { grid-template-columns: 1fr; }
  .node.compact .node-head { flex-wrap: wrap; }
  .foot-keys { display: none; }
}

/* cards adapt to their own width, not the window's */
.node { container-type: inline-size; container-name: card; }
.conns { overflow-x: auto; }
.band-state > div { min-width: 0; }
.band-state { overflow: hidden; }
@container card (max-width: 900px) {
  .ctable .col-ctime { display: none; }
  .c-heard .abs { display: none; }
}
@container card (max-width: 720px) {
  .ctable .col-dir { display: none; }
  .ctable .c-type { display: none; }
  .c-desc { max-width: 240px; }
  .band-mid { display: none; }
  .band { grid-template-columns: minmax(0, 1fr) auto; }
  .node-chips .chip:nth-child(n+3) { display: none; }
  .mx-lv { display: none; }
}
@container card (max-width: 560px) {
  .c-desc { max-width: 170px; }
  .mx-max { display: none; }
  .mx-devbar { width: 64px; }
  .tl-meta span:last-child { display: none; }
}
@container card (max-width: 420px) {
  .ctable .col-mode { display: none; }
  .mx-devbar { display: none; }
}

/* fixed column widths: the description column takes whatever is left, so tables always fit */
.ctable { table-layout: fixed; width: 100%; }
.ctable .col-node { width: 136px; }
.ctable .col-heard { width: 172px; }
.ctable .col-ctime { width: 100px; }
.ctable .col-dir { width: 64px; }
.ctable .col-mode { width: 104px; }
.ctable .col-act { width: 44px; }
.ctable td { overflow: hidden; }
.c-desc, .node.compact .c-desc { max-width: none; }
.node.compact .ctable .col-node { width: 84px; }
.node.compact .ctable .col-heard { width: 104px; }
.node.compact .ctable .col-mode { width: 96px; }
@container card (max-width: 720px) {
  .ctable .col-node { width: 92px; }
  .ctable .col-heard { width: 112px; }
}
@container card (max-width: 420px) {
  .ctable .col-heard { width: 96px; }
}
