/* iaxCOMMAND web client. Colours from the desktop app. No inline styles anywhere (the CSP forbids them);
   positions and sizes are set from script through the CSSOM. */

:root {
  --bg: #0E1014;
  --surface: #171A21;
  --surface2: #1F232C;
  --surface3: #262B36;
  --border: #2A2F3A;
  --border2: #3A404D;
  --text: #E6E9EF;
  --muted: #8A93A6;
  --accent: #4C8DFF;
  --rx: #22D36B;
  --tx: #FF4D4F;
  --warn: #FFB020;
  --page: #B57BFF;
  --notify: #2EC4B6;
  --radius: 10px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.4 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- controls */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 32px; padding: 0 14px; border-radius: 8px; cursor: pointer; white-space: nowrap;
  background: var(--surface2); border: 1px solid var(--border2); color: var(--text); font-weight: 600; font-size: 13px;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.btn:hover:not(:disabled) { background: var(--surface3); }
/* every button shows it was pressed: lighter, with a blue outline, easing back on release (as in the
   Windows and Android apps). A filter, so it works on any button colour; inset so layouts don't move. */
button { transition: filter .14s ease-out, box-shadow .14s ease-out; -webkit-tap-highlight-color: transparent; }
button:active:not(:disabled) { filter: brightness(1.35); box-shadow: inset 0 0 0 1.5px var(--accent); transition: none; }
.btn:focus-visible, .icon:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.accent:hover:not(:disabled) { background: #3b7cf0; }
.btn.danger { border-color: #7a2d2f; color: #ff8a8c; }
.btn.flat { background: transparent; border-color: transparent; }
.btn.flat:hover:not(:disabled) { background: var(--surface2); }
.btn.small { min-height: 26px; padding: 0 9px; font-size: 12px; }
.btn svg { width: 14px; height: 14px; flex: none; }
.btn.on { background: #20365e; border-color: var(--accent); color: #cfe0ff; }
.btn.pages { background: #3a2557; border-color: var(--page); color: #e6d4ff; }
.btn.pages:hover:not(:disabled) { background: #48306b; }

.icon {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; border: 0; padding: 0;
  background: transparent; color: var(--muted); cursor: pointer; flex: none;
}
.icon:hover { background: var(--surface2); color: var(--text); }
.icon.on { color: var(--accent); }
.icon svg { width: 16px; height: 16px; }

input[type=text], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; min-height: 32px; padding: 5px 9px; border-radius: 7px;
  background: var(--bg); border: 1px solid var(--border2);
}
textarea { min-height: 70px; resize: vertical; }
/* checkboxes drawn by us too: a box with a visible border, blue with a white tick when checked */
input[type=checkbox] {
  -webkit-appearance: none; appearance: none; flex: none; position: relative;
  width: 18px; height: 18px; margin: 0; border-radius: 4px; cursor: pointer;
  background: var(--bg); border: 2px solid #6B7385;
}
input[type=checkbox]:hover { border-color: var(--accent); }
input[type=checkbox]:checked { background: var(--accent); border-color: var(--accent); }
input[type=checkbox]:checked::after {
  content: ""; position: absolute; left: 4px; top: 0; width: 5px; height: 10px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
input[type=checkbox]:disabled { opacity: .45; cursor: default; }
/* sliders drawn by us, not the browser (some draw them as plain white bars on a dark page) */
input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 18px; margin: 0; padding: 0;
  background: transparent; cursor: pointer;
}
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--border2); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--border2); }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 14px; height: 14px; margin-top: -5px;
  border-radius: 50%; background: var(--accent); border: 2px solid var(--bg);
}
input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); }
input[type=range]:focus-visible { outline: none; }
input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px rgba(76, 141, 255, .45); }
input[type=range]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 3px rgba(76, 141, 255, .45); }
input[type=range]:disabled { opacity: .45; cursor: default; }
label { cursor: pointer; }

/* ---------------------------------------------------------------- login */

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 28px; }
.logo { display: flex; align-items: baseline; gap: 2px; font-weight: 700; letter-spacing: .5px; }
.logo .iax { color: var(--accent); font-size: 15px; }
.logo .cmd { font-size: 22px; }
.logo .cmd-block { display: inline-grid; justify-items: end; line-height: 1; }
.logo .version { font-size: 10px; font-weight: 400; letter-spacing: 0; color: #8B93A3; margin: 1px 1px 0 0; }
.login-card .logo { margin-bottom: 18px; }
.login-card .logo .cmd { font-size: 28px; }
.login-card h2 { margin: 0 0 14px; font-size: 16px; }
.stack { display: grid; gap: 12px; }
.err { color: #ff8a8c; font-size: 13px; min-height: 18px; }
.note { color: var(--muted); font-size: 12px; }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-size: 13px; }

.code-input { font-family: var(--mono); font-size: 20px; letter-spacing: 3px; }
.backup-codes { font-family: var(--mono); font-size: 16px; line-height: 1.7; padding: 10px 14px; border-radius: 8px; background: var(--bg); border: 1px solid var(--border2); columns: 2; margin: 0; user-select: all; }

/* ---------------------------------------------------------------- shell */

.shell { display: grid; grid-template-rows: auto auto 1fr auto; height: 100vh; }
.topbar {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--surface);
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.topbar .spacer { flex: 1; }
.meter-block { width: 120px; display: grid; gap: 3px; }
.meter-block .cap { font-size: 10px; color: var(--muted); letter-spacing: .4px; }
.bar { height: 6px; border-radius: 3px; background: var(--bg); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--rx); transition: width 60ms linear; }
.bar.tx > i { background: var(--tx); }

.tabs { display: flex; align-items: center; gap: 4px; padding: 6px 14px 0; background: var(--surface); border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid transparent; border-bottom: 0;
  border-radius: 8px 8px 0 0; background: transparent; color: var(--muted); cursor: pointer; font-weight: 600; white-space: nowrap;
}
.tab.active { background: var(--bg); border-color: var(--border); color: var(--text); margin-bottom: -1px; }
.tab .led { width: 7px; height: 7px; border-radius: 50%; background: var(--border2); }
.tab .led.rx { background: var(--rx); }
.tab .led.tx { background: var(--tx); }
.tab .led.warn { background: var(--warn); }

/* the modules / map area takes the space left between the bars and scrolls inside it (min-height: 0,
   or the grid row grows to fit every module and the whole page scrolls instead) */
.views { display: grid; min-height: 0; }
.views > * { grid-area: 1 / 1; min-height: 0; }
.canvas-wrap { position: relative; overflow: auto; }
.canvas { position: relative; min-height: 100%; }
.empty { display: grid; place-items: center; text-align: center; padding: 60px 16px; color: var(--muted); }
.empty h3 { color: var(--text); margin: 10px 0 4px; font-size: 18px; }
.empty .row { justify-content: center; margin-top: 14px; }

.statusbar {
  display: flex; align-items: center; gap: 14px; padding: 5px 14px; background: var(--surface); border-top: 1px solid var(--border);
  font-size: 12px; color: var(--muted); min-height: 30px;
}
.statusbar .msg { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.onair { color: var(--tx); font-weight: 800; letter-spacing: .6px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--border2); margin-right: 6px; vertical-align: 0; }
.dot.ok { background: var(--rx); }
.dot.bad { background: var(--tx); }
.dot.warn { background: var(--warn); }

.audio-gate {
  position: fixed; left: 50%; bottom: 46px; transform: translateX(-50%); z-index: 30;
  background: #20365e; border: 1px solid var(--accent); border-radius: 10px; padding: 8px 14px; display: flex; gap: 10px; align-items: center;
  width: max-content; max-width: calc(100vw - 32px);
}

/* ---------------------------------------------------------------- modules */

.module {
  position: absolute; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  transform-origin: 0 0; display: flex; flex-direction: column; overflow: hidden;
}
.module.node { width: 340px; }
.module.node.size-medium { width: 300px; }
.module.node.size-small { width: 230px; }
.module.page { width: 280px; }
.module.page.size-small { width: 220px; }
.module.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.module.rx { border-color: var(--rx); }
.module.tx { border-color: var(--tx); box-shadow: 0 0 0 1px var(--tx); }
.module.emergency { animation: flash 0.8s steps(2) infinite; }
@keyframes flash { 50% { border-color: var(--tx); box-shadow: 0 0 0 3px var(--tx); } }

.m-head { display: flex; align-items: center; gap: 8px; padding: 9px 8px 7px 12px; }
.m-head .led { width: 10px; height: 10px; border-radius: 50%; background: var(--border2); flex: none; }
.led.online { background: var(--rx); }
.led.connecting { background: var(--warn); }
.led.error { background: var(--tx); }
.m-title { flex: 1; min-width: 0; }
.m-title b { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-title span { display: block; font-size: 11px; color: var(--muted); }
.chip { font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 5px; background: var(--surface3); color: #C4CAD6; border: 1px solid #5A6273; letter-spacing: .3px; }
.chip.pub { border-color: #2c5c9a; color: #9cc1ff; }
.chip.listen { border-color: #2c5c9a; color: #9cc1ff; background: transparent; }
.module.public { border-style: dashed; }
.module.public.rx { border-style: solid; }
.module.public.unavailable .m-title, .module.public.unavailable .vol { opacity: .55; }
.module.public .m-body { padding-top: 2px; }
.module.public .m-title span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* public nodes browser */
.pub-list { display: grid; gap: 6px; margin: 10px 0; max-height: min(60vh, 520px); overflow-y: auto; }
.pub-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.pub-row.rx { border-color: var(--rx); }
.pub-row.tx { border-color: var(--tx); }
.pub-row .led { width: 10px; height: 10px; border-radius: 50%; background: var(--border2); flex: none; }
.pub-row .led.online { background: var(--rx); }
.pub-row .led.connecting { background: var(--warn); }
.pub-row .linkmain { flex: 1; min-width: 0; }
.chip.warn { color: var(--warn); border-color: var(--warn); }
.pub-row .linkmain .note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selbtn { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 6px; border: 1px solid var(--border2); background: transparent; color: var(--muted); cursor: pointer; }
.selbtn.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.m-body { padding: 0 12px 12px; display: grid; gap: 8px; }
.m-status { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); min-height: 17px; }
.m-status .net { font-family: var(--mono); font-size: 11px; white-space: nowrap; }
.m-rx {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 34px; padding: 0 10px; border-radius: 8px;
  background: var(--bg); border: 1px solid var(--border); font-weight: 700; font-size: 13px; color: var(--muted);
}
.m-rx.rx { background: #0f2a1b; border-color: var(--rx); color: var(--rx); }
.m-rx.tx { background: #2e1213; border-color: var(--tx); color: #ffb3b4; }
.m-rx .timer { font-family: var(--mono); }
.m-mdc { font-size: 12px; padding: 5px 9px; border-radius: 7px; background: #1d2433; color: #cfe0ff; }
.m-mdc.fresh { background: #20365e; }
.banner { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 7px; font-weight: 700; font-size: 12px; }
.banner span { flex: 1; }
.banner.emergency { background: #5a1517; color: #fff; }
.banner.call { background: #4a3a0c; color: #ffe2a3; }
.banner.selcall { background: #1d2433; color: #cfe0ff; font-weight: 600; }
.banner.selcall.ok { background: #0f2a1b; color: #8ff0b6; }
.banner.selcall.fail { background: #3a1415; color: #ffb3b4; }
.m-links { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-level { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.vol { display: grid; grid-template-columns: auto 1fr; gap: 6px; align-items: center; }

.ptt {
  height: 58px; border-radius: 10px; border: 2px solid #5a2a2c; background: #2a1718; color: #ffb3b4; font-weight: 800;
  font-size: 16px; letter-spacing: 1px; cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: none;
}
.ptt:hover:not(:disabled) { background: #351c1d; }
.ptt.down { background: var(--tx); border-color: var(--tx); color: #fff; }
.ptt:disabled { opacity: .4; cursor: default; }
.size-small .ptt { height: 46px; font-size: 14px; }
.row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.row.fill > * { flex: 1; }
.row > select { width: auto; min-width: 160px; }
.tonebtn.down, .tonebtn.on { background: #4a3a0c; border-color: var(--warn); color: #ffe2a3; }
.notifybtn.on { background: #0e3532; border-color: var(--notify); color: #9ff2ea; }
.dtmf { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; }
.dtmf input { font-family: var(--mono); }
.keypad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.keypad .btn { min-height: 30px; padding: 0; font-family: var(--mono); }
.m-foot { display: flex; gap: 6px; padding: 8px 12px; border-top: 1px solid var(--border); background: var(--surface2); align-items: center; }
.m-foot .spacer { flex: 1; }

.page-detail { font-size: 12px; color: var(--muted); }
.page-target { font-size: 12px; }
.pagebtn { position: relative; height: 44px; border-radius: 9px; border: 2px solid #4b2f73; background: #221a33; color: #dcc4ff; font-weight: 800; cursor: pointer; overflow: hidden; }
.pagebtn:disabled { opacity: .45; cursor: default; }
.pagebtn .prog { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: #4b2f73; }
.pagebtn span { position: relative; }
.bell { color: var(--muted); }
.bell.on { color: var(--page); }
.bell .num { font-size: 11px; font-weight: 800; }
.module.page.queued { border-color: var(--page); }

/* Live / Recordings tabs on a node module, and recording rows */
.m-tabs { display: flex; gap: 2px; padding: 0 12px 6px; }
.m-tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 4px 8px; color: var(--muted); cursor: pointer; font-weight: 600; font-size: 12px; }
.m-tabs button.active { color: var(--text); border-color: var(--accent); }
.rec-pane { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.rec-pane .rec-list { flex: 1; min-height: 0; max-height: none; align-content: start; }
.rec-list { display: grid; gap: 4px; max-height: 320px; overflow-y: auto; }
.rec-list.tall { max-height: min(60vh, 560px); }
.rec { display: grid; grid-template-columns: auto 1fr auto auto; gap: 6px; align-items: center; padding: 5px 6px; border-radius: 8px; background: var(--surface2); }
.rec.playing { background: #1d2433; box-shadow: inset 0 0 0 1px var(--accent); }
.rec .icon { font-size: 12px; text-decoration: none; }
.rec-main { min-width: 0; display: grid; gap: 3px; }
.rec-top { display: flex; gap: 8px; align-items: baseline; font-size: 12px; min-width: 0; }
.rec-top b { color: var(--rx); }
.rec.tx .rec-top b { color: #ff8a8c; }
.rec-who { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.rec-bar { height: 4px; cursor: pointer; }
.rec-bar > i { background: var(--accent); }
.rec-empty { padding: 10px 4px; }
.rec { cursor: default; }
.rec.sel:not(.playing) { box-shadow: inset 0 0 0 1px #3a5a96; }

/* voice graph (desktop app's WaveformView) */
.graph {
  --wave-off: #5A6375; --wave-mid: #2A303C;
  padding: 10px 14px; border-radius: 12px; background: var(--surface2); border: 1px solid var(--border);
}
.gp-head { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: #C4CAD6; }
.gp-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wave { display: block; width: 100%; height: 110px; margin-top: 8px; cursor: pointer; touch-action: none; }

/* floating windows (pop-out recordings) */
.float-win {
  position: fixed; display: flex; flex-direction: column; min-width: 340px; min-height: 300px;
  max-width: calc(100vw - 8px); max-height: calc(100vh - 8px);
  background: var(--surface); border: 1px solid var(--border2); border-radius: 14px; overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .55); resize: both;
}
.fw-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 16px; border-bottom: 1px solid var(--border); cursor: move; user-select: none; touch-action: none; }
.fw-head h2 { flex: 1; margin: 0; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fw-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; padding: 12px 16px 12px; }
.fw-foot { display: flex; justify-content: space-between; gap: 12px; font-size: 11px; }
.fw-status { color: var(--rx); white-space: nowrap; }
@media (max-width: 760px) {
  .float-win { left: 0 !important; top: 0 !important; width: 100vw !important; height: 100vh !important; max-width: none; max-height: none; border-radius: 0; resize: none; }
}

.transport { display: flex; justify-content: center; align-items: center; gap: 8px; }
.tbtn {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid #343A47; background: #232833; color: var(--text);
  font-size: 14px; cursor: pointer; display: inline-grid; place-items: center;
}
.tbtn:hover:not(:disabled) { background: #2D3340; }
.tbtn:disabled { opacity: .35; cursor: default; }
.tbtn.big { width: 52px; height: 52px; font-size: 18px; background: var(--accent); border-color: var(--accent); color: #fff; }
.tbtn.big:hover:not(:disabled) { background: #6AA1FF; }
.transport-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

.prec-list { flex: 1; min-height: 120px; overflow-y: auto; display: grid; gap: 3px; align-content: start; padding: 4px; border-radius: 10px; background: var(--surface2); border: 1px solid var(--border); }
.prec {
  display: grid; grid-template-columns: 16px 140px auto 1fr auto auto; gap: 8px; align-items: center;
  padding: 6px 10px; border-radius: 8px; border: 1px solid transparent; background: #1B1F27; font-size: 13px; cursor: default; user-select: none;
}
.prec:hover { background: #222733; }
.prec.sel { background: #1D2B47; border-color: var(--accent); }
.prec.playing { background: #11291B; border-color: #2E8F55; }
.prec .when { font-size: 12px; }
.prec .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.prec .len { font-size: 12px; color: var(--muted); min-width: 40px; text-align: right; }
.kdot { width: 10px; height: 10px; border-radius: 50%; background: var(--rx); }
.k-outgoing .kdot { background: var(--tx); }
.k-alert .kdot { background: var(--warn); }
.k-marker .kdot { background: var(--accent); }
.k-page .kdot { background: var(--page); }
.k-notify .kdot { background: var(--notify); }
.stopflag { font-size: 9px; font-weight: 800; color: #14171D; background: var(--warn); border-radius: 6px; padding: 1px 6px; }

.ctx-menu {
  position: fixed; z-index: 10001; min-width: 220px; padding: 4px; display: grid;
  background: var(--surface2); border: 1px solid var(--border2); border-radius: 8px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
}
.ctx-menu button { text-align: left; background: transparent; border: 0; padding: 7px 10px; border-radius: 5px; cursor: pointer; font-size: 13px; }
.ctx-menu button:hover:not(:disabled) { background: var(--surface3); }
.ctx-menu button:disabled { opacity: .4; cursor: default; }
.ctx-menu hr { border: 0; border-top: 1px solid var(--border); margin: 3px 0; }
.recdot { font-size: 10px; font-weight: 800; color: #fff; background: var(--tx); border-radius: 4px; padding: 1px 5px; letter-spacing: .5px; }

/* patching, join, side panes (links / voter / IDs) */
.chip.patch { border-color: #7b5a12; color: #ffd27a; background: #2d2410; }
.patchrow { display: flex; gap: 4px; align-items: center; }
.patchrow .cap { font-size: 11px; font-weight: 700; color: var(--muted); margin-right: 4px; }
.patchrow .btn { min-width: 30px; padding: 0 6px; }
.patchrow .btn.on { background: #4a3a0c; border-color: var(--warn); color: #ffe2a3; }
.side-pane { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.pane-head { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.pane-head .note { margin-left: auto; }
.pane-list { flex: 1; min-height: 0; overflow-y: auto; display: grid; gap: 4px; align-content: start; }
.linkrow, .voterrow { display: grid; grid-template-columns: auto 1fr auto; gap: 7px; align-items: center; padding: 5px 7px; border-radius: 7px; background: var(--surface2); font-size: 12px; }
.voterrow { grid-template-columns: auto auto 1fr auto auto auto; }
.linkrow.down, .voterrow.down { opacity: .75; }
.voterrow.voted { box-shadow: inset 0 0 0 1px var(--rx); }
.linkmain { min-width: 0; display: grid; gap: 2px; }
.linkmain > div:first-child { display: flex; gap: 6px; align-items: center; min-width: 0; }
.linkmain b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini { width: 9px; height: 9px; border-radius: 50%; background: var(--border2); flex: none; }
.mini.rx, .mini.ok { background: var(--rx); }
.mini.tx, .mini.bad { background: var(--tx); }
.mini.warn { background: var(--warn); }
.chip.voted { background: #0f2a1b; border-color: var(--rx); color: #8ff0b6; }
.chip.lost { background: #3a1415; border-color: var(--tx); color: #ffb3b4; }
.bar.rssi { height: 5px; }
.vote { display: flex; gap: 2px; }
.vote .btn { min-height: 22px; padding: 0 5px; font-size: 11px; }

/* arranging */
.arrange .module { cursor: move; touch-action: none; }
.arrange .module::after {
  content: "Drag to move"; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(76,141,255,.16);
  border: 2px dashed var(--accent); border-radius: 12px; color: #fff; font-weight: 700; pointer-events: none;
}
.module .grip { display: none; }
.arrange .module .grip {
  display: block; position: absolute; right: 0; bottom: 0; width: 22px; height: 22px; cursor: nwse-resize; z-index: 2;
  background: linear-gradient(135deg, transparent 50%, var(--accent) 50%); border-bottom-right-radius: 11px;
}
.arrange .module .sizes { display: flex; position: absolute; top: 6px; right: 6px; z-index: 2; gap: 3px; }
.module .sizes { display: none; }
.module.dragging { z-index: 10; opacity: .92; }

/* ---------------------------------------------------------------- dialogs */

dialog { padding: 0; border: 1px solid var(--border2); border-radius: 14px; background: var(--surface); color: var(--text); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
dialog.wide { width: min(980px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(4,6,10,.65); }
.dlg { display: flex; flex-direction: column; max-height: calc(100vh - 34px); }
.dlg-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.dlg-head h2 { flex: 1; margin: 0; font-size: 16px; }
.dlg-body { padding: 16px; overflow: auto; display: grid; gap: 14px; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.dlg-foot .left { margin-right: auto; }
fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin: 0; display: grid; gap: 10px; }
legend { padding: 0 6px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.field { display: grid; gap: 4px; }
.field > span { font-size: 12px; color: var(--muted); }
.field .hint { font-size: 11px; color: var(--muted); }
.check { display: flex; gap: 8px; align-items: center; }
.subtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: -4px 0 0; }
.subtabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; color: var(--muted); cursor: pointer; font-weight: 600; }
.subtabs button.active { color: var(--text); border-color: var(--accent); }

table.list { width: 100%; border-collapse: collapse; font-size: 13px; }
table.list th { text-align: left; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .3px; padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.list td { padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.list tr.pending td { background: #221d0e; }
table.list input[type=text], table.list input[type=number], table.list select { min-height: 28px; padding: 3px 6px; }
.table-wrap { overflow-x: auto; }
.mono { font-family: var(--mono); font-size: 12px; }

.toasts { position: fixed; right: 16px; bottom: 44px; display: grid; gap: 8px; z-index: 10000; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--surface2); border: 1px solid var(--border2); border-left: 4px solid var(--accent); border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.toast.error { border-left-color: var(--tx); }
.toast.warn { border-left-color: var(--warn); }
.toast.ok { border-left-color: var(--rx); }
.toast.emergency { border-left-color: var(--tx); background: #5a1517; color: #fff; font-weight: 700; }

/* ---------------------------------------------------------------- small screens: modules stack */

/* ---------------------------------------------------------------- mobile view (one node at a time) */

.mobile-only { display: none; }
body.mobile .mobile-only { display: inline-grid; }
body.mobile .full-only, body.mobile .wide-only, body.mobile .tabs, body.mobile .statusbar .hint { display: none !important; }
body.mobile .shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
body.mobile .views { flex: 1; min-height: 0; display: grid; }
body.mobile .views > * { grid-area: 1 / 1; min-height: 0; }
body.mobile .topbar { padding: 6px 10px; gap: 8px; flex-wrap: nowrap; }
body.mobile .topbar .icon { width: 40px; height: 40px; }
body.mobile .topbar .icon svg { width: 20px; height: 20px; }
body.mobile .canvas { display: block; padding: 10px 10px 16px; min-height: 0; }
body.mobile .audio-gate { bottom: auto; top: 64px; }
body.mobile .ctx-menu button { min-height: 42px; font-size: 15px; }

.node-strip {
  display: flex; gap: 6px; padding: 8px 10px; overflow-x: auto; background: var(--surface);
  border-bottom: 1px solid var(--border); scrollbar-width: thin;
}
.chip-node {
  display: inline-flex; align-items: center; gap: 7px; flex: none; max-width: 60vw; min-height: 36px; padding: 0 12px;
  border-radius: 18px; border: 1px solid var(--border2); background: var(--surface2); color: var(--muted);
  font-weight: 700; font-size: 13px; cursor: pointer; touch-action: manipulation;
}
.chip-node span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-node.public { border-style: dashed; }
.chip-node.active { background: #20365e; border-color: var(--accent); color: #fff; }
.chip-node.heard { border-color: var(--warn); color: #ffe2a3; }
.chip-node .led { width: 9px; height: 9px; border-radius: 50%; background: var(--border2); flex: none; }
.chip-node .led.online { background: #2c6b45; }
.chip-node .led.rx { background: var(--rx); }
.chip-node .led.tx { background: var(--tx); }
.chip-node .led.warn { background: var(--warn); }

.mobile-view { max-width: 560px; margin: 0 auto; display: grid; gap: 10px; }
.mobile-view .section-cap { font-size: 11px; font-weight: 800; letter-spacing: .6px; color: var(--muted); margin: 6px 2px 0; text-transform: uppercase; }
.module.mobile-card { position: static !important; width: auto !important; transform: none !important; }
.module.mobile-card .sizes, .module.mobile-card .grip, .module.mobile-card .selbtn,
.module.node.mobile-card .m-body > .ptt { display: none; }
.module.mobile-card.selected { border-color: var(--border); box-shadow: none; }
.module.mobile-card.rx { border-color: var(--rx); }
.module.mobile-card.tx { border-color: var(--tx); box-shadow: 0 0 0 1px var(--tx); }
.module.mobile-card .m-title b { font-size: 20px; }
.module.mobile-card .m-title span { font-size: 12px; }
.module.mobile-card .m-head .led { width: 14px; height: 14px; }
.module.mobile-card .m-rx { height: 44px; font-size: 16px; }
.module.mobile-card .m-tabs { overflow-x: auto; }
.module.mobile-card .m-tabs button { font-size: 13px; padding: 8px 10px; }
.module.mobile-card .btn { min-height: 40px; }
.module.mobile-card .vol input[type=range] { height: 28px; }

.mobile-bar { background: var(--surface); border-top: 1px solid var(--border); padding: 8px 10px 10px; }
.mb-inner { max-width: 560px; margin: 0 auto; display: grid; gap: 6px; }
.scan-row { display: flex; align-items: center; gap: 8px; min-height: 30px; }
.scan-row input[type=checkbox] { width: 22px; height: 22px; }
.scan-row input[type=checkbox]:checked::after { left: 6px; top: 2px; }
.scan-text { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.last-heard {
  text-align: left; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--warn); background: #2b2410;
  color: #ffe2a3; font-weight: 700; font-size: 13px; cursor: pointer;
}
.ptt.big { width: 100%; height: 88px; font-size: 22px; letter-spacing: 1.5px; border-radius: 14px; }

@media (max-width: 760px) {
  .topbar { padding: 8px 10px; gap: 8px; }
  .topbar .wide-only { display: none; }
  .tabs { padding: 6px 10px 0; }
  .canvas { display: flex; flex-direction: column; gap: 12px; padding: 12px 10px 24px; }
  .canvas .module { position: static !important; width: auto !important; transform: none !important; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .statusbar .hint { display: none; }
}

/* ---------------------------------------------------------------- updates (Administration) */
.icon.badge { position: relative; color: var(--text); }
.icon.badge::after { content: ""; position: absolute; top: 3px; right: 3px; width: 8px; height: 8px; border-radius: 50%; background: var(--rx); box-shadow: 0 0 0 2px var(--surface); }
.update-log, .release-notes { font-family: var(--mono); font-size: 12px; white-space: pre-wrap; max-height: 320px; overflow: auto; padding: 8px 10px; border-radius: 8px; background: var(--bg); border: 1px solid var(--border); margin: 6px 0 0; }
.release-notes { font-family: var(--font); font-size: 13px; }
