/* Mutara dashboard. Tokens follow the OpusRef design language. */
:root {
  --bg: #F6F7F9; --surface: #FFFFFF; --raised: #EEF0F4; --line: #DCE0E7; --line-strong: #7F8A99;
  --text: #151A23; --muted: #566070;
  --accent: #F529CD; --accent-text: #151A23; --accent-ink: #B5109A;
  --rx: #0A5F77; --rx-box: #E3F3F7;
  --tx: #C2410C; --tx-box: #FDEEE6;
  --busy: #B42318; --busy-box: #FDECEA;
  --warn: #8A4B00; --warn-box: #FFF4DF;
  --ok: #12794A;
  /* The talk button (owner decision): green Ready, red Talking, amber
     Busy with dark text. White on green 5.4:1, white on red 6.0:1, dark
     on amber 9.8:1. The light amber fill is 1.8:1 on the page, so Busy
     has a dark amber border (5.5:1). Hot pink stays the brand accent. */
  --talk-ready: #157A47; --talk-ready-on: #FFFFFF;
  --talk-live: #C21F1F; --talk-live-on: #FFFFFF; --talk-live-box: #FCE9E9;
  --talk-busy: #F2B233; --talk-busy-on: #1A1300; --talk-busy-line: #8A5A00;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 4px 16px rgba(16,24,40,.05);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 20px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1B1D24; --surface: #20232C; --raised: #262A35; --line: #3A4052; --line-strong: #66718A;
    --text: #ECF0F6; --muted: #9BA7B8;
    --accent: #FF2BD6; --accent-text: #1B1D24; --accent-ink: #FF2BD6;
    --rx: #5EEAD4; --rx-box: #163A3A;
    --tx: #FFB224; --tx-box: #3D2E12;
    --busy: #FF8A7E; --busy-box: #3D1F1D;
    --warn: #FFC24D; --warn-box: #3A3018;
    --ok: #3DDC84;
    --talk-ready: #34C77B; --talk-ready-on: #0B1A12;
    --talk-live: #FF6B5E; --talk-live-on: #1B0705; --talk-live-box: #3D1F1D;
    --talk-busy: #FFC24D; --talk-busy-on: #1F1600; --talk-busy-line: #FFC24D;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1B1D24; --surface: #20232C; --raised: #262A35; --line: #3A4052; --line-strong: #66718A;
  --text: #ECF0F6; --muted: #9BA7B8;
  --accent: #FF2BD6; --accent-text: #1B1D24; --accent-ink: #FF2BD6;
  --rx: #5EEAD4; --rx-box: #163A3A;
  --tx: #FFB224; --tx-box: #3D2E12;
  --busy: #FF8A7E; --busy-box: #3D1F1D;
  --warn: #FFC24D; --warn-box: #3A3018;
  --ok: #3DDC84;
  --talk-ready: #34C77B; --talk-ready-on: #0B1A12;
  --talk-live: #FF6B5E; --talk-live-on: #1B0705; --talk-live-box: #3D1F1D;
  --talk-busy: #FFC24D; --talk-busy-on: #1F1600; --talk-busy-line: #FFC24D;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
.mono { font-family: var(--mono); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
h2 { font-size: 15px; font-weight: 650; margin: 0; letter-spacing: .01em; }
a { color: inherit; }

.overline {
  font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted);
}

/* Top bar */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 20px; border-bottom: 1px solid var(--line);
  background: var(--surface); position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 8px; }
.orb { width: 28px; height: 28px; color: var(--text); }
.wordmark { font-weight: 750; font-size: 18px; letter-spacing: -.01em; }
.station { display: flex; gap: 6px; align-items: baseline; color: var(--muted); font-size: 14px; font-weight: 400; margin: 0; }
/* The callsign stays whole; the text after it ends with "…" when the
   bar is narrow. */
.station > span { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.station > span:first-child, .station > .sep { flex: none; }
.station .mono:first-child { color: var(--text); font-weight: 600; }
.sep { opacity: .5; }
/* The module bar, for an install with more nodes: a second row of the
   top bar that scrolls sideways and never wraps. The station shrinks
   first, so that the first row does not wrap. */
.topbar { flex-wrap: wrap; row-gap: 8px; }
.station { flex: 1 1 0; min-width: 0; overflow: hidden; white-space: nowrap; }
.mod-bar { flex: 0 0 100%; min-width: 0; margin: 0 -4px -4px; }
.mod-bar-list {
  list-style: none; margin: 0; padding: 4px; display: flex; gap: 6px; position: relative;
  overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scrollbar-width: none;
  scroll-padding-inline: 36px;
}
.mod-bar-list::-webkit-scrollbar { display: none; }
/* With a mouse, a thin scrollbar shows that the bar scrolls sideways;
   touch and trackpads scroll it without one. */
@media (hover: hover) and (pointer: fine) {
  .mod-bar-list { scrollbar-width: thin; scrollbar-color: var(--line) transparent; padding-bottom: 6px; }
  .mod-bar-list:hover { scrollbar-color: var(--muted) transparent; }
  .mod-bar-list::-webkit-scrollbar { display: block; height: 6px; }
  .mod-bar-list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }
  .mod-bar-list:hover::-webkit-scrollbar-thumb { background: var(--muted); }
}
/* More links past an edge: that edge fades (modbar.js sets the classes). */
.mod-bar-list.more-right { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent); }
.mod-bar-list.more-left { -webkit-mask-image: linear-gradient(90deg, transparent, #000 32px); mask-image: linear-gradient(90deg, transparent, #000 32px); }
.mod-bar-list.more-left.more-right { -webkit-mask-image: linear-gradient(90deg, transparent, #000 32px, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(90deg, transparent, #000 32px, #000 calc(100% - 32px), transparent); }
.mod-bar-list > li { flex: none; }
@media (max-width: 420px) {
  /* The type pill is for screen readers only, so more links fit. */
  .mod-btn .type-tag { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
.mod-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--raised); color: var(--text);
  font: 600 13px var(--sans); text-decoration: none; white-space: nowrap;
}
.mod-btn .mod-tag { flex-wrap: nowrap; }
/* A named node: the name, with the ID and type small under it. A long
   name ends with "…" so that the bar never wraps. */
.mod-btn .mod-chip { line-height: 1.2; }
.mod-btn .mod-chip-name { max-width: 200px; }
.mod-btn .mod-chip-meta { font-size: 11px; }
@media (max-width: 420px) { .mod-btn .mod-chip-name { max-width: 140px; } }
.mod-btn:hover { border-color: var(--muted); }
.mod-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.mod-btn[aria-current="page"] { background: var(--surface); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.mod-all { color: var(--muted); background: transparent; }
/* The activity dot: hollow when the node is quiet, filled when someone
   talks. The shape changes, not only the color. */
.act-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--muted); opacity: .6; }
/* The node that the user hears while the page shows All nodes. */
.hear-mark { display: inline-flex; flex: none; color: var(--rx); }
.hear-mark .ic { width: 14px; height: 14px; }
.mod-btn[data-active="true"] .act-dot { background: var(--rx); border-color: var(--rx); opacity: 1; box-shadow: 0 0 0 3px var(--rx-box); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.user { display: flex; align-items: center; gap: 8px; font-size: 13px; }
/* The More menu, for a phone */
.more { display: none; position: relative; }
.more-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; min-width: 220px; max-width: calc(100vw - 32px);
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow), 0 12px 32px rgba(0, 0, 0, .22);
  padding: 6px;
}
.more-info { margin: 0; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.more-info[hidden] { display: none; }
.more-info .mono { color: var(--text); font-weight: 600; }
.more-menu { display: flex; flex-direction: column; }
.more-item {
  appearance: none; border: 0; background: none; color: var(--text); font: 500 14px var(--sans); text-align: left;
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 10px; border-radius: 8px; cursor: pointer; text-decoration: none;
}
.more-item:hover, .more-item:focus-visible { background: var(--raised); }
.more-item:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.more-item .ic { color: var(--muted); }
.more-item .val { margin-left: auto; color: var(--muted); font-size: 13px; }

/* Buttons and chips */
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--raised); color: var(--text);
  font: 600 14px var(--sans); padding: 0 16px; min-height: 40px; border-radius: 999px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn.danger { color: var(--busy); }
.btn.on { background: var(--rx-box); border-color: var(--rx); color: var(--rx); }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn {
  appearance: none; border: 1px solid var(--line); background: transparent; color: var(--text);
  width: 36px; height: 36px; border-radius: 999px; cursor: pointer; font-size: 16px;
}
.icon-btn .ic { vertical-align: middle; }
a.icon-btn:not([hidden]) { display: inline-flex; align-items: center; justify-content: center; }
:is(.btn, .icon-btn, .ptt, input, select):focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 650; background: var(--raised); color: var(--muted); white-space: nowrap;
}
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .8; }
.chip.ok { color: var(--ok); }
.chip.warn { color: var(--warn); background: var(--warn-box); }
.chip.bad { color: var(--busy); background: var(--busy-box); }
.chip.rx { color: var(--rx); background: var(--rx-box); }
.chip.tx { color: var(--tx); background: var(--tx-box); }
.chip.plain::before { display: none; }

/* Layout: Activity in the main column, the controls in a right column
   that stays on screen. --top-h is the height of the top bar (app.js). */
main {
  display: grid; gap: 16px; padding: 20px; max-width: 1320px; margin: 0 auto;
  grid-template-columns: minmax(0, 1fr) 340px;
  align-items: start;
}
.upgrade-bar, .setup { grid-column: 1 / -1; }
.main-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
/* Activity fills the screen height at least, and grows with the page. */
.main-col .log-card { min-height: calc(100vh - var(--top-h, 61px) - 180px); }
/* On a phone the controls come after Activity, so keep Activity short. */
@media (max-width: 760px) {
  .main-col .log-card { min-height: 200px; }
  .main-col .log { max-height: 60vh; overflow-y: auto; }
}
.rail {
  display: flex; flex-direction: column; gap: 12px; min-width: 0;
  position: sticky; top: calc(var(--top-h, 61px) + 16px);
  max-height: calc(100vh - var(--top-h, 61px) - 32px); overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin;
}
@media (max-width: 1000px) {
  main { grid-template-columns: minmax(0, 1fr) 300px; }
}
@media (max-width: 760px) {
  main { grid-template-columns: minmax(0, 1fr); padding: 12px; gap: 12px; }
  .rail { position: static; max-height: none; overflow: visible; }
  /* One row: the orb, the station, and the main controls. The rest is in
     the More menu. */
  .topbar { padding: 10px 16px; gap: 10px; }
  .wordmark, .wide-only { display: none !important; }
  .station { min-width: 0; overflow: hidden; white-space: nowrap; }
  /* The node number tells the pages of an install apart, so it stays
     whole; the callsign, the same on every page, ends with "…". A name
     (a digital module) can be long: then the callsign stays whole. */
  .station > #st-node.st-num { flex: none; }
  .station > span:first-child:has(+ .sep + .st-num) { flex: 0 1 auto; }
  .top-actions { flex: none; }
  .more { display: block; }
  /* A tool page (DTMF commands, Tone builder): the module bar below marks
     the node of the page, so the page name alone has the room (#65). */
  .topbar:has(.mod-bar:not([hidden])) .station > .st-mod { display: none; }
}

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); min-width: 0;
}
.rail .card { padding: 14px 16px; border-radius: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.rail .card-head { margin-bottom: 10px; }
.count { color: var(--muted); font-weight: 500; margin-left: 4px; }
.note { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.empty { color: var(--muted); margin: 4px 0; font-size: 14px; }

/* Talker strip: who talks now, in the RX or TX color. */
.strip { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 24px; padding: 16px 20px; }
.strip-who { flex: 1 1 220px; min-width: 0; }
.talker { font-size: 34px; font-weight: 500; line-height: 1.1; margin: 2px 0; letter-spacing: -.01em; overflow-wrap: anywhere; }
.hero-sub { color: var(--muted); font-size: 13px; min-height: 1.45em; }
.hero-via { font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.hero-scan { display: flex; align-items: center; gap: 6px; min-width: 0; margin-bottom: 4px; font-size: 12px; color: var(--rx); }
.hero-scan[hidden] { display: none; }
.hero-scan .ic { flex: none; width: 14px; height: 14px; }
.hero-scan > span:first-of-type { font-weight: 650; text-transform: uppercase; letter-spacing: .06em; font-size: 11px; }
.hero-scan .mono { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-scan { margin: -4px 0 8px; overflow-wrap: anywhere; }
.strip[data-state="rx"] #hero-state, .strip[data-state="rx"] .talker { color: var(--rx); }
.strip[data-state="tx"] #hero-state, .strip[data-state="tx"] .talker { color: var(--talk-live); }
.strip[data-state="room"] #hero-state, .strip[data-state="room"] .talker { color: var(--accent-ink); }
.strip[data-state="quiet"] .talker { color: var(--muted); }
.hero-level { flex: 1 1 140px; display: flex; flex-direction: column; gap: 4px; min-width: 120px; }
.hero-read { display: flex; justify-content: flex-end; align-items: center; gap: 8px; min-height: 20px; }
/* The level rows (issue #77): the receive bar, and your own bar while you
   send. Half duplex shows one of them; a room (full duplex) both. */
.lv-row { display: flex; flex-direction: column; gap: 4px; }
.lv-row + .lv-row { margin-top: 6px; }
.lv-row .hero-read { flex-wrap: wrap; row-gap: 2px; }
.lv-name { flex-shrink: 0; margin-right: auto; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 650 12px var(--sans); color: var(--rx); }
.lv-name:empty { display: none; }
.lv-row.tx .lv-name { color: var(--talk-live); }
.lv-row .mono { font-size: 12px; color: var(--muted); white-space: nowrap; }
#hero-db { font-size: 12px; color: var(--muted); white-space: nowrap; }
.hero-read .chip { font-size: 11px; padding: 0 8px; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.hero-stats > div { display: flex; flex-direction: column; }
.hero-stats b { font: 600 15px var(--mono); }
@media (max-width: 760px) {
  .strip { padding: 12px 14px; gap: 8px 16px; }
  .talker { font-size: 26px; }
  .hero-stats { gap: 14px; flex-basis: 100%; }
}

.meter { height: 6px; border-radius: 999px; background: var(--raised); overflow: hidden; }
.meter.big { height: 8px; }
/* Speech level bars (-60 to 0 dBFS): a faint band marks a good average,
   -32 to -21 dBFS. The hero's band shows only while a level shows, so a
   quiet node has an empty bar, not a stuck reading. */
.strip[data-state="rx"] .meter.big, .strip[data-state="tx"] .meter.big, .strip[data-state="room"] .meter.big, .lv-row.tx .meter.big, .row .meter { background: linear-gradient(to right, var(--raised) 45.8%, color-mix(in srgb, var(--ok) 18%, var(--raised)) 45.8% 65.8%, var(--raised) 65.8%); }
.levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px 18px; margin: 12px 0; }
.levels input[type=range] { width: 100%; }
.lv-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.muted { color: var(--muted); }
.meter-fill { height: 100%; width: 0; background: var(--rx); border-radius: inherit; transition: width .12s linear; }
.meter-fill.tx { background: var(--tx); }
.lv-row.tx .meter-fill { background: var(--talk-live); }
/* The peak mark: the highest level of the last 1.5 s. */
.meter { position: relative; }
.meter-peak { position: absolute; top: 0; bottom: 0; left: 0; width: 2px; margin-left: -1px; background: var(--text); opacity: .75; transition: left .12s linear; }
@media (prefers-reduced-motion: reduce) { .meter-fill, .meter-peak { transition: none; } }

/* Link chips: the links in one line, on a phone only. */
.link-chips { display: none; }
@media (max-width: 760px) {
  .link-chips:not(:empty) { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: -2px 0; padding: 2px; }
  .link-chips .chip { border: 0; font: 650 12px var(--mono); padding: 4px 10px; cursor: pointer; flex: none; }
}

/* Recorded clips: one line that scrolls sideways. --p is how much of
   the clip has played, from 0 to 1. */
.clips-card { padding: 14px 16px; }
.clips-card .card-head { margin-bottom: 10px; }
.clips {
  list-style: none; margin: 0; padding: 2px 2px 6px; display: flex; gap: 8px;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: thin;
}
.clips > li { flex: none; position: relative; scroll-snap-align: start; }
.clip {
  appearance: none; display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; align-items: center;
  width: 168px; padding: 10px 34px 12px 12px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--raised); color: var(--text); font: inherit; text-align: left; cursor: pointer;
  position: relative; overflow: hidden;
}
.clip:hover { border-color: var(--muted); }
.clip:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.clip .ic { grid-row: span 2; width: 22px; height: 22px; color: var(--rx); }
.clip-who { font: 650 14px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clip-meta { font-size: 12px; color: var(--muted); white-space: nowrap; }
.clip-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: transparent; }
.clip-bar::after {
  content: ""; position: absolute; inset: 0; background: var(--rx);
  transform-origin: left; transform: scaleX(var(--p, 0));
}
.clip[aria-pressed="true"] { background: var(--rx-box); border-color: var(--rx); }
.clip[aria-pressed="true"] .clip-bar { background: var(--line); }
/* The More button sits on the clip, at the top right. */
.clip-more {
  position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; font-size: 12px;
  background: var(--surface); color: var(--muted);
}
.clip-more .ic { width: 14px; height: 14px; }
/* A clip with no More button (no download, no delete) needs no room for it. */
.clips > li > .clip:only-child { padding-right: 12px; }
.clip-more:hover, .clip-more[aria-expanded="true"] { color: var(--text); border-color: var(--muted); }
/* The clip menu: Save, Share, Delete. The script puts it at its button. */
.clip-menu {
  position: fixed; z-index: 40; min-width: 220px; max-width: calc(100vw - 16px);
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow), 0 12px 32px rgba(0, 0, 0, .22);
  padding: 6px; display: flex; flex-direction: column;
}
.clip-menu[hidden] { display: none; }
.clip-menu-head {
  margin: 0 0 4px; padding: 8px 10px 10px; border-bottom: 1px solid var(--line);
  font: 600 13px var(--mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.more-item.danger, .more-item.danger .ic { color: var(--busy); }
.more-item.danger:hover, .more-item.danger:focus-visible { background: var(--busy-box); }
/* Replay: the user hears clips, not live audio. The bar says so and
   gives the way back. */
.clip-now {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  margin: 0 0 10px; padding: 8px 8px 8px 14px; border-radius: 14px;
  background: var(--warn-box); color: var(--text);
}
.clip-now-text { margin: 0; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: 14px; }
.clip-now-text b { color: var(--warn); font-weight: 650; display: inline-flex; align-items: center; gap: 8px; }
.clip-now-text b::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.clip-now-what { font: 500 13px var(--mono); color: var(--text); overflow-wrap: anywhere; }
.clip-now .btn { background: var(--surface); border-color: var(--warn); color: var(--text); }
.clip-now .btn .ic { color: var(--warn); }
.clip-now .btn:hover { background: var(--raised); }

/* Folds: closed sections in the right column. */
.fold { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; min-width: 0; }
.fold > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px;
  font-size: 14px; font-weight: 600; cursor: pointer; list-style: none; border-radius: 14px;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary small { color: var(--muted); font-weight: 400; }
.fold > summary:hover .car { color: var(--text); }
.fold > summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.fold .car { width: 14px; height: 14px; color: var(--muted); flex: none; transition: transform .15s; }
.fold[open] > summary .car { transform: rotate(90deg); }
.fold-body { padding: 2px 14px 14px; display: grid; gap: 10px; font-size: 14px; min-width: 0; }
.fold-body > .note:first-child { margin: 0; }
.sub-fold { border-radius: 12px; background: transparent; margin-top: 12px; }
.sub-fold > summary { padding: 8px 12px; font-size: 13px; }
.sub-fold .fold-body { padding: 2px 12px 12px; }
.sub-h { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 4px 0 0; }
.pool-events { list-style: none; margin: 4px 0 0; padding: 0; max-height: 240px; overflow-y: auto; font-size: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--raised); }
.pool-events li { padding: 3px 8px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.pool-events li:last-child { border-bottom: 0; }
.tgl { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sel { font: 600 13px var(--sans); color: var(--text); padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); max-width: 60%; }
.sel:disabled { opacity: .6; }
/* A switch: aria-pressed is on or off. */
.sw {
  appearance: none; width: 36px; height: 22px; border-radius: 999px; background: var(--raised); border: 1px solid var(--line);
  position: relative; flex: none; cursor: pointer; padding: 0;
}
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: left .15s; }
.sw[aria-pressed="true"] { background: var(--rx-box); border-color: var(--rx); }
.sw[aria-pressed="true"]::after { left: 17px; background: var(--rx); }
.sw:disabled { cursor: default; opacity: .6; }
.sw:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
#tools-body .levels { grid-template-columns: minmax(0, 1fr); margin: 4px 0; }
#tools-body .gate-box { margin: 0; }

/* Activity filters */
.filters { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.filters button {
  appearance: none; font: 600 12px var(--sans); padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line);
  color: var(--muted); background: transparent; cursor: pointer; white-space: nowrap;
}
.filters button:hover { color: var(--text); }
.filters button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.filters button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
/* On a phone, the filters go under the heading when they do not fit
   beside it. */
@media (max-width: 480px) {
  .card-head:has(> .filters) { flex-wrap: wrap; }
  .card-head > .filters { justify-content: flex-start; }
}
.log[data-filter="talk"] li:not([data-cat="talk"]),
.log[data-filter="link"] li:not([data-cat="link"]),
.log[data-filter="cmd"] li:not([data-cat="cmd"]),
.log[data-filter="sys"] li:not([data-cat="sys"]) { display: none; }

/* Phone talk dock */
.dock { display: none; }
@media (max-width: 760px) {
  .dock {
    display: grid; gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
    padding: 10px max(12px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(16,24,40,.08);
  }
  body.has-dock { padding-bottom: var(--dock-h, 120px); }
  body.has-dock .toast { bottom: calc(var(--dock-h, 120px) + 12px); }
  /* The dock has the talk controls; the card keeps the settings. */
  #txcard .ptt, #listen-btn { display: none !important; }
  #txcard .tx-body { display: block; }
}
.dock-row { display: flex; gap: 8px; align-items: center; }
.dock-btn { width: 48px; height: 48px; flex: none; display: grid; place-items: center; }
.dock-btn[aria-pressed="true"] { background: var(--rx-box); border-color: var(--rx); color: var(--rx); }
/* In the listener line: not listening yet (ADR 0011). */
.dock-btn[data-wait][aria-pressed="true"], .btn.on[data-wait] { background: var(--warn-box); border-color: var(--warn); color: var(--warn); }
.ptt-bar {
  flex: 1; min-width: 0; height: 48px; border-radius: 999px; border: 2px solid var(--line); background: var(--raised); color: var(--text);
  font: 700 15px var(--sans); cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: none;
}
.ptt-bar { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 14px; }
.ptt-bar > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ptt-bar .ic { width: 18px; height: 18px; }
.ptt-bar:disabled { opacity: 1; border-style: dashed; color: var(--muted); cursor: default; }
.ptt-bar:focus-visible, .dock-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Icons */
.sprite { display: none; }
.ic.fill { fill: currentColor; }
.btn .ic { width: 14px; height: 14px; vertical-align: -2px; }
.btn.small .ic { margin-left: -2px; }
.icon-btn.star .ic { width: 18px; height: 18px; }
.suggest .fav .ic, .pick .fav .ic { width: 15px; height: 15px; vertical-align: -2px; }
.pick-remove .ic { width: 14px; height: 14px; }
.chat-file .ic { width: 14px; height: 14px; }

/* Focus, selection, scroll bars and motion */
:where(a, button, summary, input, select, textarea, [tabindex]):focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--accent) 32%, transparent); color: inherit; }
html { scrollbar-color: var(--line) transparent; }
* { scrollbar-color: var(--line) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: padding-box; border: 2px solid transparent; }
/* Reduced motion: no animations and no smooth scroll. The short
   transitions that show a state (the meters, a switch) stay. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important;
  }
  .fold .car { transition: none; }
}
.ic { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.dock-btn .ic { width: 20px; height: 20px; }
.dock-lbl { display: none; }
.dock-btn.wide { flex: 1; width: auto; border-radius: 999px; display: flex; gap: 8px; justify-content: center; font: 700 15px var(--sans); }
.dock-btn.wide .dock-lbl { display: inline; }

/* Transceiver */
.tx-body { display: flex; gap: 14px; align-items: center; }
.ptt {
  width: 108px; height: 108px; border-radius: 50%; flex: none;
  border: 2px solid var(--line); background: var(--raised); color: var(--text);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: none;
  font: 700 15px/1.15 var(--sans); text-align: center; padding: 6px; transition: background .1s, border-color .1s, transform .05s;
}
.ptt { position: relative; }
.ptt .ic { width: 20px; height: 20px; }
.ptt[aria-pressed="true"] { transform: scale(.98); }
/* Disabled: dashed and muted, but readable (3:1 or more). The label
   says what to do first ("Listen first"). */
.ptt:disabled { opacity: 1; border-style: dashed; color: var(--muted); cursor: default; }
.ptt-hint { font: 500 11px var(--sans); color: var(--muted); }
/* The states of the talk button (data-talk): the color, the label and
   the icon change together, so color is never the only sign. */
:is(.ptt, .ptt-bar)[data-talk="ready"] { background: var(--talk-ready); border-color: var(--talk-ready); color: var(--talk-ready-on); }
:is(.ptt, .ptt-bar)[data-talk="live"] { background: var(--talk-live); border: 2px solid var(--talk-live); color: var(--talk-live-on); }
:is(.ptt, .ptt-bar)[data-talk="busy"] { background: var(--talk-busy); border-color: var(--talk-busy-line); color: var(--talk-busy-on); }
:is(.ptt, .ptt-bar)[data-talk="limit"] { background: var(--raised); border: 2px solid var(--talk-live); color: var(--text); }
:is(.ptt, .ptt-bar)[data-talk] .ptt-hint { color: inherit; }
:is(.ptt, .ptt-bar)[data-talk="ready"]:not(:disabled):hover { box-shadow: 0 0 0 4px color-mix(in srgb, var(--talk-ready) 25%, transparent); }
:is(.ptt, .ptt-bar)[data-talk="busy"]:not(:disabled):hover { box-shadow: 0 0 0 4px color-mix(in srgb, var(--talk-busy) 35%, transparent); }
/* The last 30 s before the talk limit: a ring around the button (a bar
   in the dock) that shrinks to zero. --left goes from 1 to 0. */
.ptt::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; pointer-events: none; display: none;
  background: conic-gradient(var(--talk-live) calc(var(--left, 1) * 360deg), color-mix(in srgb, var(--talk-live) 15%, transparent) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 4px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 4px)); }
.ptt[data-count]::after { display: block; }
.ptt-bar::after { content: ""; position: absolute; left: 0; bottom: 0; height: 5px; width: calc(var(--left, 1) * 100%); background: currentColor; display: none; pointer-events: none; }
.ptt-bar[data-count]::after { display: block; }
.tx-side { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.tx-side .note { margin: 0; font-size: 12px; }
.tx-side .vol .overline { font-size: 10px; }
.boost small { font-size: 12px; line-height: 1.3; }
.play-level { font-size: 13px; line-height: 1.3; align-items: flex-start; }
.play-level input { flex: none; width: 16px; height: 16px; margin: 1px 0 0; accent-color: var(--accent); }
.play-level small { display: block; font-size: 12px; }
.tone-picks { display: grid; gap: 6px; font-size: 13px; }
.tone-picks label { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tone-picks select { min-width: 0; max-width: 62%; }
@media (pointer: coarse) { .play-level { min-height: 44px; align-items: center; } .play-level input { width: 20px; height: 20px; margin: 0; } }
#tx-note:empty { display: none; }
.mic-fold-note { margin: 0; }
.slider { display: flex; flex-direction: column; gap: 4px; }
.slider input { width: 100%; accent-color: var(--accent); }
.mini-meter { display: flex; flex-direction: column; gap: 4px; }
.mic-box { display: flex; flex-direction: column; gap: 12px; }
/* Average (RMS), -60 to 0 dBFS: green -32 to -21 dBFS (good), amber -20 to -18 (high). */
.mic-meter { background: linear-gradient(to right, var(--raised) 45.8%, color-mix(in srgb, var(--ok) 35%, var(--raised)) 45.8% 65.8%, color-mix(in srgb, var(--warn) 30%, var(--raised)) 65.8% 70.8%, var(--raised) 70.8%); }
.mic-meter .meter-fill.clip { background: var(--busy); }
.mic-hint { font-size: 13px; color: var(--muted); min-height: 1.3em; }
.mic-hint[data-state="good"] { color: var(--ok); }
.mic-hint[data-state="loud"] { color: var(--busy); }
.mic-hint[data-state="high"] { color: var(--warn); }
.mic-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }

/* Rows */
.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 12px 0; border-top: 1px solid var(--line);
}
.row:first-child { border-top: 0; }
.row .who { min-width: 0; }
.row .name { font: 600 16px var(--mono); }
.row .sub { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; } /* wraps: the name is the part people read */
.row .right { display: flex; align-items: center; gap: 8px; }
.lights { display: flex; gap: 4px; }
.light { width: 30px; height: 20px; border-radius: 6px; font: 700 10px/20px var(--mono); text-align: center; background: var(--raised); color: var(--muted); }
.light.rx.on { background: var(--rx); color: var(--surface); }
.light.tx.on { background: var(--tx); color: var(--surface); }
.kind {
  width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center;
  background: var(--raised); color: var(--muted); font: 700 11px var(--mono);
}
.row.talking .kind { background: var(--rx-box); color: var(--rx); }
.row.sending .kind { background: var(--tx-box); color: var(--tx); }
.row.wx-warning .kind { background: var(--busy-box); color: var(--busy); }
.row.wx-watch .kind { background: var(--warn-box); color: var(--warn); }
.row .meter { height: 4px; margin-top: 6px; max-width: 220px; }
.tree { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px; }
.tree .chip { font: 500 11px var(--mono); padding: 1px 8px; }
.node-chip { border: 0; cursor: pointer; }
.node-chip:hover, .node-chip[aria-expanded=true] { color: var(--text); background: var(--line); }
.node-chip.talking { color: var(--rx); background: var(--rx-box); box-shadow: inset 0 0 0 1px var(--rx); }
.node-card {
  position: fixed; z-index: 50; width: max-content; max-width: min(320px, calc(100vw - 16px));
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--text); box-shadow: 0 4px 24px rgba(0,0,0,.25);
  font-size: 13px; line-height: 1.4;
}
.node-card .head { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; }
.node-card p { margin: 2px 0 0; overflow-wrap: anywhere; }
.node-card .call { font: 600 14px var(--mono); margin-top: 4px; }
.node-card .muted { color: var(--muted); }
.node-card .mono { font-family: var(--mono); font-size: 12px; }

.connect { display: flex; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.connect-more { display: flex; gap: 8px; flex-basis: 100%; }
.connect-more select { flex: 1; min-width: 0; }
.connect input, .connect select, #login-dlg input, #profile-dlg input, .setup-form input {
  min-height: 40px; border-radius: 14px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--text);
  padding: 0 14px; font-size: 15px;
}
.connect input { flex: 1; min-width: 0; width: 100%; }
.connect input[aria-invalid="true"] { border-color: var(--busy); }
.connect-err { flex-basis: 100%; }
.connect-help { flex-basis: 100%; margin: -2px 0 0; }
.connect .combo { position: relative; flex: 1; min-width: 0; display: flex; }
.suggest {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 20; margin: 0; padding: 4px; list-style: none;
  max-height: 320px; overflow-y: auto; border-radius: 14px; border: 1px solid var(--line); background: var(--bg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}
/* The box is narrow beside the buttons, so the name and location go on
   their own line under the number and callsign. */
.suggest li {
  display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "num call fav" "desc desc desc"; gap: 2px 10px; align-items: baseline;
  padding: 8px 10px; border-radius: 10px; cursor: pointer; font-size: 14px;
}
.suggest .num { grid-area: num; }
.suggest .call { grid-area: call; }
.suggest .fav { grid-area: fav; }
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--line); }
.suggest .call { font-weight: 600; }
.suggest .desc { grid-area: desc; color: var(--muted); font-size: 13px; min-width: 0; overflow-wrap: anywhere; }
.suggest .desc:empty { display: none; }
.connect .checks { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.connect .check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; }
.connect .check input { flex: none; min-width: 0; min-height: 0; padding: 0; margin: 0; width: 16px; height: 16px; accent-color: var(--accent); }

/* Favorites and recent nodes */
.quick { margin: 4px 0 10px; }
#recent-box { margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--line); }
.quick h3 { margin: 0 0 6px; }
.picks { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.picks li { min-width: 0; max-width: 100%; }
.pick {
  appearance: none; border: 1px solid var(--line); background: var(--raised); color: var(--text);
  border-radius: 14px; padding: 6px 12px; min-height: 44px; max-width: 100%; cursor: pointer;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; text-align: left; font: inherit;
}
.pick:not(:disabled):hover { border-color: var(--accent); }
.pick:disabled { cursor: default; }
.pick.linked { background: var(--rx-box); border-color: var(--rx); }
.pick .pick-name { font: 600 14px var(--mono); display: flex; align-items: center; gap: 6px; max-width: 100%; }
.pick .pick-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pick .pick-sub { color: var(--muted); font-size: 12px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick .chip { font-size: 11px; padding: 0 8px; flex: none; }
.pick:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
/* An admin's favorite chip has a × on its right side to remove it. */
.picks li.has-remove { display: flex; }
.has-remove .pick { border-top-right-radius: 0; border-bottom-right-radius: 0; min-width: 0; }
.pick-remove {
  appearance: none; flex: none; width: 32px; min-height: 44px; border: 1px solid var(--line); border-left: 0;
  border-radius: 0 14px 14px 0; background: var(--raised); color: var(--muted); font: 600 18px/1 var(--sans); cursor: pointer;
}
.pick-remove.linked { background: var(--rx-box); border-color: var(--rx); }
.pick-remove:hover { color: var(--busy); border-color: var(--accent); }
.pick-remove:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.icon-btn.star { color: var(--muted); font-size: 18px; line-height: 1; flex: none; width: 40px; height: 40px; }
.icon-btn.star[aria-pressed="true"] { color: var(--accent-ink); border-color: var(--accent); }
/* Row tools sit on a line of their own under the node info, so the
   buttons never stack in a narrow column on a phone. */
.row-tools { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: -6px; }
@media (max-width: 560px) { .row-tools { grid-column: 1 / -1; } }
.row-tools .btn[aria-pressed="true"] { color: var(--accent-ink); border-color: var(--accent); }
.suggest .fav { color: var(--accent-ink); font-size: 18px; line-height: 1; padding: 2px 4px; min-width: 1.4em; text-align: center; }
.suggest .fav[data-node] { cursor: pointer; }
.pick .fav { color: var(--accent-ink); }
#name-dlg form { display: flex; flex-direction: column; gap: 12px; }
#name-dlg label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
#name-dlg input {
  width: 100%; min-height: 40px; border-radius: 14px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--text);
  padding: 0 14px; font-size: 15px;
}
#name-dlg .note { margin: 0; }
#name-dlg .dlg-actions { flex-wrap: wrap; }
#name-clear { margin-right: auto; }

/* Keypad: a pop-up on a wide screen, a sheet on a phone. */
.kp-dlg {
  position: fixed; inset: auto; margin: 0; width: 260px; padding: 12px; border-radius: 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .22); z-index: 30;
}
.kp-dlg[open] { display: grid; gap: 8px; }
.kp-dlg.sheet {
  left: 0; right: 0; bottom: 0; top: auto; width: 100%; max-width: 100%; border-radius: 18px 18px 0 0; border-bottom: 0;
  padding: 12px max(16px, env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.kp-dlg.sheet::before { content: ""; justify-self: center; width: 40px; height: 4px; border-radius: 999px; background: var(--line); }
.kp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kp-head h2 { font-size: 15px; }
.kp-head .icon-btn { width: 30px; height: 30px; }
.keypad-display {
  min-height: 40px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line);
  display: flex; align-items: center; padding: 0 12px; font-size: 20px; letter-spacing: .08em;
  overflow-x: auto; white-space: nowrap;
}
/* A-D are rarely used: they show only when the user asks (kp-more). */
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.keypad.abcd { grid-template-columns: repeat(4, 1fr); }
.keypad:not(.abcd) button.l { display: none; }
.keypad button {
  min-height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--raised); color: var(--text);
  font: 600 16px var(--mono); cursor: pointer;
}
.keypad button.l { color: var(--muted); }
.keypad button:active { background: var(--line); }
.keypad button:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.kp-dlg.sheet .keypad button { min-height: 48px; font-size: 18px; }
.kp-actions { display: flex; gap: 8px; }
.kp-actions .btn { flex: 1; }
.kp-help { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.kp-help .mono { color: var(--text); font-weight: 600; }
.kp-list { list-style: none; padding: 0; display: grid; gap: 2px; }
.kp-dlg.sheet .kp-keys { display: none; }
.kp-more[aria-pressed="true"], .kp-btn[aria-expanded="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.head-btns { display: flex; align-items: center; gap: 8px; }
.connect .kp-btn { width: 40px; height: 40px; flex: none; }

/* Log */
.log { list-style: none; margin: 0; padding: 0; font-size: 13px; font-variant-numeric: tabular-nums; }
.log li { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.log li:first-child { border-top: 0; }
.log time { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.log .who { font-family: var(--mono); font-weight: 600; }
.log .ev-rx_key .who { color: var(--rx); }
.log .ev-timeout, .log .ev-error { color: var(--busy); }

/* Chat */
/* Chat drawer: at the right on a wide screen, a full sheet on a phone. */
.chat-btn { position: relative; display: inline-grid; place-items: center; }
.badge {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--accent); color: var(--accent-text); font: 700 11px/18px var(--sans); text-align: center;
  font-variant-numeric: tabular-nums; box-shadow: 0 0 0 2px var(--surface);
}
.drawer {
  position: fixed; top: var(--top-h, 61px); right: 0; bottom: 0; width: min(380px, 100vw); z-index: 25;
  display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: -12px 0 32px rgba(0, 0, 0, .18);
}
.drawer[hidden] { display: none; }
.drawer-h { display: flex; align-items: flex-start; gap: 12px; padding: 16px 16px 10px; border-bottom: 1px solid var(--line); flex: none; }
.drawer-t { flex: 1; min-width: 0; }
.drawer-t h2 { font-size: 17px; }
.drawer-t .note { margin: 2px 0 0; }
.drawer .chat-list { flex: 1; min-height: 0; padding: 4px 16px; }
.drawer > .empty { padding: 0 16px; flex: 1; }
.drawer-f { flex: none; padding: 10px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.drawer-f .chat-form { margin-top: 0; }
.drawer-f .note { margin-top: 6px; font-size: 12px; }
@media (max-width: 760px) {
  .drawer { top: 0; width: 100vw; border-left: 0; box-shadow: none; }
  body.chat-open { overflow: hidden; }
}
.chat-new {
  display: flex; align-items: center; gap: 10px; color: var(--accent-ink); font-size: 12px; font-weight: 700;
  border-top: 0 !important; padding: 6px 0 !important;
}
.chat-new::before, .chat-new::after { content: ""; flex: 1; height: 1px; background: var(--accent); opacity: .5; }
.chat-new + li { border-top: 0; }
.toast.chat-toast {
  display: flex; align-items: center; gap: 12px; border-radius: 16px; padding: 10px 10px 10px 16px;
  left: auto; right: 20px; transform: none; max-width: min(420px, calc(100vw - 32px)); z-index: 19;
}
.chat-toast[hidden] { display: none; }
.chat-toast-text { flex: 1; min-width: 0; display: flex; gap: 6px; white-space: nowrap; }
.chat-toast-text .msg { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.chat-toast .toast-more { flex: none; opacity: .7; }
.chat-toast .btn { flex: none; }
@media (max-width: 760px) {
  .toast.chat-toast { left: 16px; right: 16px; max-width: none; }
}
.chat-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; font-size: 14px; }
.chat-list li { padding: 8px 0; border-top: 1px solid var(--line); }
.chat-list li:first-child { border-top: 0; }
.chat-meta { display: flex; align-items: baseline; gap: 8px; }
.chat-meta .who { font-family: var(--mono); font-weight: 600; }
.chat-meta time { color: var(--muted); font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; }
.chat-meta .btn { margin-left: auto; min-height: 26px; padding: 0 8px; font-size: 12px; }
.chat-text { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-file { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 13px; color: var(--rx); overflow-wrap: anywhere; }
.chat-img { display: block; margin-top: 6px; }
.chat-img img { display: block; max-width: min(100%, 280px); max-height: 220px; border-radius: 12px; border: 1px solid var(--line); background: var(--raised); }
.chat-form { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.chat-form textarea {
  width: 100%; min-height: 44px; resize: vertical; border-radius: 14px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); padding: 10px 14px; font: 15px/1.4 var(--sans);
}
.chat-form textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.chat-actions { display: flex; align-items: center; gap: 8px; }
.chat-actions label.btn { position: relative; }
.chat-actions label.btn:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.chat-file-name { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-actions #chat-send { margin-left: auto; }

/* Dialog, toast */
dialog {
  border: 1px solid var(--line); border-radius: 24px; background: var(--surface); color: var(--text);
  padding: 24px; width: min(380px, calc(100vw - 32px));
}
dialog::backdrop { background: rgba(10, 12, 18, .5); }
#login-dlg form, #profile-dlg form { display: flex; flex-direction: column; gap: 12px; }
#login-dlg label, #profile-dlg label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
#login-dlg input, #profile-dlg input { width: 100%; }
/* Your tones: on or off, the sound, and a preview (ADR 0018). */
.profile-tones { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; min-width: 0; }
.profile-tones legend { padding: 0; margin-bottom: 4px; font-weight: 600; font-size: 13px; color: var(--muted); }
.tone-row { display: grid; grid-template-columns: 7.5em minmax(0, 1fr) auto; align-items: center; gap: 8px; }
#profile-dlg .tone-row label.check { flex-direction: row; align-items: center; gap: 6px; color: var(--text); }
#profile-dlg .tone-row input[type="checkbox"] { width: 16px; height: 16px; margin: 0; flex: none; accent-color: var(--accent); }
.tone-row select { min-width: 0; width: 100%; }
.tone-row .btn { padding-inline: 10px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; }
.error { color: var(--busy); min-height: 1em; margin: 0; font-size: 13px; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: calc(100vw - 32px);
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 20;
}
.toast-act {
  appearance: none; border: 0; background: none; color: inherit; font: 700 14px var(--sans); cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; padding: 4px 6px; margin: -4px -6px -4px 6px; border-radius: 8px;
}
.toast-act:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.offline {
  position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 20;
  background: var(--warn-box); color: var(--warn); padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
}
/* The listener line and the bump notice (ADR 0011). A wait can last
   many minutes, so the bar is at the bottom, not over the node chips;
   a toast shows above it. */
.slot-bar {
  top: auto; bottom: 24px; width: max-content; max-width: calc(100vw - 32px);
  text-align: center; border: 1px solid var(--warn); font-variant-numeric: tabular-nums;
}
body:has(#slot-bar:not([hidden])) .toast { bottom: 72px; }
@media (max-width: 760px) {
  body.has-dock .slot-bar { bottom: calc(var(--dock-h, 120px) + 12px); }
  body.has-dock:has(#slot-bar:not([hidden])) .toast { bottom: calc(var(--dock-h, 120px) + 60px); }
}
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 8px 16px 28px; }

/* Setup */
.setup { grid-column: 1 / -1; border-color: var(--accent); }
.setup-title { font-size: 22px; margin: 4px 0; }
.setup-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; max-width: 640px; }
.setup-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.setup-form .error, .setup-form button { grid-column: 1 / -1; justify-self: start; }
@media (max-width: 560px) { .setup-form { grid-template-columns: 1fr; } }

/* Settings: a head, the rail of pages and the page, and a foot. On a
   phone the rail is a list of pages, and a page fills the screen. */
dialog.settings {
  width: min(980px, calc(100vw - 24px)); height: min(860px, calc(100vh - 24px)); max-height: calc(100vh - 24px); padding: 0;
  display: none; grid-template-columns: 224px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden;
  /* clip, not hidden: a focus in the rail must not scroll the dialog
     itself, which moves the head and Close out of view. */
  overflow: clip;
}
dialog.settings[open] { display: grid; }
.set-head { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); min-width: 0; }
.set-head h2 { font-size: 20px; min-width: 0; overflow-wrap: anywhere; }
/* The title takes the focus when the dialog opens, so that no button
   shows a focus ring then. Tab goes on to the buttons. */
.set-head h2:focus { outline: none; }
#settings-close { margin-left: auto; flex: none; }
.set-back {
  display: none; appearance: none; border: 0; background: none; color: var(--rx); font: 600 15px var(--sans);
  align-items: center; gap: 2px; padding: 0 6px 0 0; min-height: 40px; cursor: pointer; flex: none;
}
.set-back .ic { width: 20px; height: 20px; }
.set-back:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.set-rail { overflow-y: auto; overscroll-behavior: contain; border-right: 1px solid var(--line); padding: 6px 8px 14px; min-height: 0; }
.set-grp { font: 650 11px var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0; padding: 12px 10px 4px; }
.set-rail ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.set-nav {
  display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 6px 10px; border-radius: 10px;
  color: var(--text); text-decoration: none; font-weight: 600; font-size: 14px;
}
.set-nav:hover { background: var(--raised); }
.set-nav[aria-current="page"] { background: var(--raised); box-shadow: inset 3px 0 0 var(--accent); }
.set-nav:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.set-nav-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.set-nav-sum { display: none; }
.set-nav-note { color: var(--muted); font-weight: 500; font-size: 12px; white-space: nowrap; }
.set-nav .tab-dot { margin: 0; flex: none; }
.set-nav .chev { display: none; color: var(--muted); flex: none; line-height: 0; }
.set-nav.ext { color: var(--muted); font-weight: 500; }
.set-nav.ext .chev { display: block; }
.set-nav.ext .ic { width: 14px; height: 14px; }
.set-err { flex: none; font: 700 11px/18px var(--mono); min-width: 18px; padding: 0 5px; text-align: center; border-radius: 999px; background: var(--busy-box); color: var(--busy); }
.set-body { overflow-y: auto; padding: 4px 24px 20px; min-height: 0; min-width: 0; }
.set-foot { grid-column: 1 / -1; }
.set-page-h { font-size: 18px; margin: 14px 0 2px; }
.set-page-h:focus { outline: none; }
/* on a phone, settings fill the screen instead of floating */
@media (max-width: 760px) {
  dialog.settings {
    width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; border: 0;
    grid-template-columns: minmax(0, 1fr);
  }
  .set-head { padding: 8px 12px 8px 16px; gap: 6px; }
  .set-head h2 { font-size: 18px; }
  .set-rail, .set-body { grid-column: 1; grid-row: 2; }
  dialog.settings[data-view="list"] .set-body,
  dialog.settings[data-view="page"] .set-rail,
  dialog.settings[data-view="page"] .set-page-h { display: none; }
  dialog.settings[data-view="page"] .set-back { display: inline-flex; margin-left: -6px; }
  .set-rail { border-right: 0; padding: 0 16px 16px; }
  .set-grp { padding: 16px 2px 6px; }
  .set-rail ul { gap: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); }
  .set-rail li + li { border-top: 1px solid var(--line); }
  .set-nav { min-height: 52px; padding: 6px 12px; border-radius: 0; gap: 10px; }
  .set-nav[aria-current="page"] { background: none; box-shadow: none; }
  .set-nav-sum { display: block; color: var(--muted); font-weight: 400; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .set-nav-sum:empty { display: none; }
  .set-nav-note { display: none; }
  .set-nav .chev { display: block; }
  .set-body { padding: 8px 16px 16px; }
  .set-panel > .note:first-of-type { margin-top: 4px; }
  .set-foot { padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
}
.set-panel > .note { margin: 0 0 8px; max-width: 70ch; }
.set-sec { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 2px; }
.set-sec-h { font-size: 15px; font-weight: 650; margin: 12px 0 0; }
.set-field { display: flex; flex-direction: column; gap: 4px; padding: 10px 0; border-top: 1px solid var(--line); min-width: 0; }
.set-panel > .set-field:first-of-type, .set-sec-h + .set-field { border-top: 0; }
.set-field > label, .set-label { font-weight: 600; font-size: 14px; }
.set-field small { color: var(--muted); font-size: 12px; max-width: 70ch; }
.set-field small a { color: var(--text); text-underline-offset: 2px; }
.set-field input:not([type="checkbox"]):not([type="radio"]), .set-field select {
  min-height: 40px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--text);
  padding: 0 12px; font-size: 15px; max-width: 460px; width: 100%;
}
.set-field.toggle label { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.set-field.toggle input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
/* "More settings": the rare fields of a page, folded */
details.more-fold { border: 1px dashed var(--line); border-radius: 14px; padding: 0 14px; margin: 14px 0 4px; }
details.more-fold > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 0;
  font-weight: 600; font-size: 14px;
}
details.more-fold > summary::-webkit-details-marker { display: none; }
details.more-fold > summary .ic { color: var(--muted); transition: transform .2s cubic-bezier(.16, 1, .3, 1); }
details.more-fold[open] > summary .ic { transform: rotate(90deg); }
details.more-fold > summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.more-t { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; min-width: 0; }
.more-t small { color: var(--muted); font-weight: 400; font-size: 12.5px; }
details.more-fold[open] { padding-bottom: 6px; }
@media (prefers-reduced-motion: reduce) { details.more-fold > summary .ic { transition: none; } }
/* A choice of a few, as cards */
.set-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; max-width: 640px; }
.set-card {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 8px; align-items: start; cursor: pointer;
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--bg);
}
.set-card input { grid-row: span 2; width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); }
.set-card b { font-size: 14px; }
.set-card span { grid-column: 2; color: var(--muted); font-size: 12.5px; }
.set-card:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.set-card:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.set-list { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; align-items: flex-start; }
.set-item {
  width: 100%; border: 1px solid var(--line); border-radius: 16px; padding: 4px 14px 12px; background: var(--raised);
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 14px; align-items: end;
}
.set-item .set-field { border-top: 0; padding: 8px 0 0; }
.set-item > .btn { justify-self: start; margin-top: 8px; }
/* A list item as a one-line row; the chevron opens its editor. */
.set-item.row { display: block; padding: 0; }
.set-row-h {
  appearance: none; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer;
  width: 100%; min-height: 52px; padding: 8px 14px; display: flex; align-items: center; gap: 10px; border-radius: 16px;
}
.set-row-h:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.set-row-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.set-row-t { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-row-s { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-badge { flex: none; font: 600 11.5px/20px var(--sans); padding: 0 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.set-row-h .chev { color: var(--muted); line-height: 0; flex: none; }
.set-row-h .ic { transition: transform .2s cubic-bezier(.16, 1, .3, 1); }
.set-item.open .set-row-h .ic { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) { .set-row-h .ic { transition: none; } }
.set-item-body {
  border-top: 1px solid var(--line); padding: 4px 14px 12px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 14px; align-items: end;
}
.set-item-body > .btn { justify-self: start; margin-top: 8px; }
/* An error line makes its field taller: keep the labels in a line. */
.set-item-body:has(> .set-field > .set-ferr), .set-item:has(> .set-field > .set-ferr) { align-items: start; }
/* A removed item: it goes when the form is saved, and Undo keeps it. */
.set-item.removed { background: transparent; border-style: dashed; }
.set-item.removed .set-row-h { cursor: default; }
.set-item.removed .set-row-t { color: var(--muted); font-weight: 600; }
/* A save error: the field, its message, and the item that holds it */
.set-ferr { display: flex; align-items: flex-start; gap: 6px; margin: 2px 0 0; color: var(--busy); font-size: 13px; font-weight: 600; max-width: 70ch; }
.set-ferr .ic { margin-top: 2px; }
/* A "Live" chip: the node uses another value now. */
.set-live { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 4px 0 0; }
.set-live .chip { white-space: normal; }
.set-item.row > .set-ferr { padding: 0 14px 8px; }
.set-item:not(.row) > .set-ferr { grid-column: 1 / -1; }
.set-invalid > input, .set-invalid > select, .set-invalid > .pw input, .set-invalid .set-card, .set-item.set-invalid, .set-item.has-err { border-color: var(--busy); }
.set-invalid > input:not([type="checkbox"]), .set-invalid > select, .set-invalid > .pw input { box-shadow: 0 0 0 1px var(--busy); }
/* Access (ADR 0010): who may do what on a node. A grid of rows and
   actions on a wide screen, a card per row on a phone. */
.acc { display: grid; gap: 12px; margin-top: 6px; min-width: 0; }
.acc-src { margin: 0; }
.acc-src a { color: var(--text); text-underline-offset: 2px; }
.acc-src .btn { margin-left: 6px; vertical-align: middle; }
.acc-pub { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 18px; }
.acc-pub .set-field { border-top: 0; padding: 4px 0; }
.acc-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.acc-grid { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
.acc-grid th, .acc-grid td { padding: 4px 2px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.acc-grid tbody tr:last-child > * { border-bottom: 0; }
.acc-grid thead th { color: var(--muted); font-weight: 600; font-size: 12px; white-space: nowrap; text-align: center; }
.acc-grid thead tr:first-child th { padding-top: 8px; }
.acc-grid th.acc-grp { font: 650 11px var(--sans); letter-spacing: .06em; text-transform: uppercase; border-bottom: 0; padding-bottom: 0; }
.acc-grid .acc-gs { border-left: 1px solid var(--line); }
.acc-grid th.acc-who {
  text-align: left; position: sticky; left: 0; z-index: 1; background: var(--surface);
  min-width: 128px; max-width: 200px; padding: 4px 8px 4px 12px; font-weight: 400;
}
.acc-grid thead th.acc-who { vertical-align: bottom; }
.acc-name { display: block; font-weight: 600; font-size: 14px; color: var(--text); overflow-wrap: anywhere; }
.acc-who small { display: block; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.acc-cell { text-align: center; }
.acc-box {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; cursor: pointer;
}
.acc-box:hover { background: var(--raised); }
.acc-box input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); cursor: inherit; }
.acc-box:has(input:disabled) { cursor: default; }
.acc-box:has(input:disabled):hover { background: none; }
.acc-box:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: -1px; }
.acc-lab { display: none; }
.acc-na { color: var(--muted); }
.acc-all { color: var(--muted); font-size: 13px; padding-left: 12px !important; }
.acc-all a { color: var(--text); text-underline-offset: 2px; }
.acc-x { width: 1%; text-align: right; padding-right: 6px !important; }
.acc-rm { width: 34px; height: 34px; padding: 0; justify-content: center; }
.acc-rm .ic { width: 16px; height: 16px; }
.acc-rm-t { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.acc-add { display: grid; gap: 4px; }
.acc-add > label { font-weight: 600; font-size: 14px; }
.acc-add-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.acc-add-row select { flex: 1 1 220px; }
.acc-add-row .btn { flex: none; }
.acc-add-row .btn .ic { width: 16px; height: 16px; }
@media (max-width: 760px) {
  .acc-src .btn { margin: 6px 0 0; display: flex; }
  .acc-scroll { overflow: visible; border: 0; border-radius: 0; background: none; }
  .acc-grid, .acc-grid tbody, .acc-grid tr, .acc-grid th, .acc-grid td { display: block; }
  .acc-grid thead { display: none; }
  .acc-grid tbody { display: grid; gap: 10px; }
  .acc-grid tr.acc-row {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 8px;
    border: 1px solid var(--line); border-radius: 16px; padding: 8px 10px; background: var(--raised);
  }
  .acc-grid tr.acc-row > * { border: 0; padding: 0; }
  .acc-grid th.acc-who { grid-column: 1 / -1; position: static; max-width: none; background: none; padding: 4px 4px 6px; }
  .acc-grid .acc-gs { border-left: 0; }
  .acc-cell { text-align: left; }
  .acc-box { display: flex; justify-content: flex-start; gap: 10px; width: 100%; height: auto; min-height: 44px; padding: 0 6px; }
  .acc-box input { width: 20px; height: 20px; flex: none; }
  .acc-lab { display: inline; font-size: 14px; color: var(--text); min-width: 0; overflow-wrap: anywhere; }
  .acc-box:has(input:disabled) .acc-lab { color: var(--muted); }
  .acc-na { display: none !important; }
  .acc-grid td.acc-all { grid-column: 1 / -1; padding: 0 4px 6px !important; }
  .acc-grid td.acc-x { grid-column: 1 / -1; width: auto; text-align: left; padding: 4px 0 2px !important; }
  .acc-grid td.acc-x:empty { display: none; }
  .acc-rm { width: auto; height: auto; min-height: 44px; padding: 0 12px; gap: 6px; }
  .acc-rm-t { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .acc-add-row .btn { min-height: 44px; }
}
/* The groups of an install: built-in ones as a line, others with members. */
.acc-groups { gap: 8px; }
.set-item.acc-group { display: block; padding: 10px 14px 12px; }
.set-item.acc-group.static { background: transparent; padding: 8px 14px; }
.acc-group-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.acc-group-h b { font-size: 14px; }
.acc-group-h small { color: var(--muted); font-size: 12.5px; }
.acc-group > .set-field { padding-top: 0; }
.acc-group > .set-field input { max-width: 260px; }
.acc-members { border: 0; padding: 0; margin: 8px 0 0; min-width: 0; }
.acc-members legend { padding: 0; font-weight: 600; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.acc-members .note { margin: 0; }
.acc-member-list { display: flex; flex-wrap: wrap; gap: 6px; }
.acc-member {
  display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px 0 10px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 14px;
}
.acc-member input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.acc-member:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.acc-member:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.acc-group > .btn { margin-top: 10px; }
@media (pointer: coarse) { .acc-member { min-height: 44px; } .acc-box { min-width: 44px; min-height: 44px; } }
.tool { padding: 14px 0; border-top: 1px solid var(--line); }
/* Radio module: the serial ports that Find module checked. */
.module-ports { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 8px; }
.module-ports li { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.module-ports .mono { overflow-wrap: anywhere; font-size: 13px; }
.module-ports input[type=checkbox] { width: 16px; height: 16px; margin: 0 4px 0 0; vertical-align: -3px; accent-color: var(--accent); }
.set-field small.port-full { color: var(--text); overflow-wrap: anywhere; }
.module-ports .row-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
/* Radio: one row per board, with its mode. */
.hw-boards li { gap: 6px; }
.hw-boards .hw-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; }
.hw-boards dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 2px 14px; margin: 0; font-size: 13px; }
.hw-boards dl.kv dt { color: var(--muted); }
.hw-boards dl.kv dd { margin: 0; overflow-wrap: anywhere; }
.hw-boards small { color: var(--muted); max-width: 62ch; }
.tool h4 { font-size: 15px; margin: 0 0 4px; }
.tool p { color: var(--muted); font-size: 13px; margin: 0 0 10px; max-width: 62ch; }
.tool p.set-path { color: var(--text); overflow-wrap: anywhere; }
.tool dl.kv, .ysf-card dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0 0 12px; font-size: 13px; }
.tool dl.kv dt, .ysf-card dl.kv dt { color: var(--muted); }
.tool dl.kv dd, .ysf-card dl.kv dd { margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
/* Health, Digital modules: a heading per module, then short lists. */
.sys-mod + .sys-mod { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
.sys-mod-h { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; font-size: 15px; font-weight: 650; margin: 0 0 2px; }
.sys-mod-h .muted { font-weight: 400; font-size: 13px; }
.sys-mod .sub-h { margin: 8px 0 4px; }
.sys-mod dl.kv { margin-bottom: 4px; }
.ysf-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ysf-actions[hidden] { display: none; }
/* The two voice server lists share one label width, so their values line up. */
.sys-voice dl.kv { grid-template-columns: minmax(max-content, 10.5em) 1fr; }
.tool a.btn { text-decoration: none; color: inherit; }
.tool .row-btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
/* The Restore file control: a button, as the chat Attach control. */
.tool label.btn { position: relative; }
.tool label.btn:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.tool .file-name { flex: 1 1 auto; min-width: 0; }
.tool .error { color: var(--busy); font-size: 13px; margin: 6px 0 0; min-height: 1em; }
/* Health page: small charts and the IAX call table */
.sys-charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.spark-card { margin: 0; border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px 8px; background: var(--raised); min-width: 0; }
.spark-card figcaption { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 13px; margin-bottom: 6px; }
.spark-title { font-weight: 600; }
.spark-read { margin-left: auto; color: var(--text); font-size: 12px; }
.spark-legend { display: flex; gap: 8px; color: var(--muted); font-size: 12px; }
.spark-legend i { display: inline-block; width: 10px; height: 2px; border-radius: 1px; vertical-align: middle; margin-right: 4px; }
.spark-legend i.dash { width: 12px; height: 0; border-top: 2px dashed; border-radius: 0; }
.spark { display: block; width: 100%; height: 56px; touch-action: pan-y; }
.spark-base { stroke: var(--line); stroke-width: 1; }
.spark-cross { stroke: var(--muted); stroke-width: 1; }
.spark-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin-top: 2px; }
.sys-table { overflow-x: auto; }
.sys-table table { border-collapse: collapse; font-size: 13px; width: 100%; }
.sys-table th { text-align: left; color: var(--muted); font-weight: 600; padding: 4px 10px 4px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.sys-table td { padding: 4px 10px 4px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.sys-table .num { text-align: right; font-family: var(--mono); }
.sys-table th:nth-child(n+3) { text-align: right; }
.set-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); }
.set-status { flex: 1 1 200px; min-width: 0; margin-right: auto; display: grid; gap: 2px; }
.set-status p { margin: 0; font-size: 13px; }
.set-status p:empty { display: none; }
.set-changes { color: var(--muted); }
/* On a phone the short status goes next to the buttons, and an error
   gets its own line. The buttons stay together on the right. */
@media (max-width: 560px) {
  .set-status { flex: 1 1 0; }
  .set-status:has(.error:not(:empty)) { flex-basis: 100%; }
  .set-status p { font-size: 12px; }
  .set-more { display: none; }
  .set-status:not(:has(p:not(:empty))) { display: none; }
  #settings-cancel { margin-left: auto; }
}
/* A dot on a tab with unsaved changes */
.tab-dot { display: inline-block; width: 7px; height: 7px; margin-left: 6px; border-radius: 50%; background: var(--accent); vertical-align: middle; }
.tab-dot[hidden] { display: none; }
/* confirm.js: a question with named buttons; a sheet on a phone */
dialog.confirm-sheet { width: min(420px, calc(100vw - 32px)); padding: 20px 22px; }
.confirm-sheet h2 { font-size: 18px; margin: 0 0 6px; }
.confirm-sheet p { color: var(--muted); font-size: 14px; margin: 0 0 8px; }
.confirm-sheet ul { margin: 0; padding-left: 20px; font-size: 14px; max-height: 40vh; overflow-y: auto; overflow-wrap: anywhere; }
.confirm-sheet .dlg-actions { flex-wrap: wrap; margin-top: 18px; }
@media (max-width: 560px) {
  dialog.confirm-sheet {
    width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 24px 24px 0 0; border-bottom: 0;
    padding: 20px 16px calc(16px + env(safe-area-inset-bottom));
  }
  .confirm-sheet .dlg-actions .btn { flex: 1 1 0; }
}
.warn-text { color: var(--warn) !important; }
.applying { position: fixed; inset: 0; background: rgba(10, 12, 18, .55); display: grid; place-items: center; z-index: 30; }
.applying-box { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 28px 32px; text-align: center; max-width: 360px; }
.orb.spin { width: 48px; height: 48px; animation: spin 1.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .orb.spin { animation: none; } }

/* Upgrade notice */
.upgrade-bar { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; justify-content: space-between;
  padding: 12px 16px; margin-bottom: 16px; border-radius: 12px; background: var(--warn-box); color: var(--warn); }
.upgrade-bar p { margin: 0; flex: 1 1 280px; }
.upgrade-bar.failed { outline: 2px solid var(--warn); }
/* The upgrade in progress (ADR 0019): for admins a bar with a Show
   button, for the other users one line. */
.upgrade-bar.ubar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: center; }
.ubar.admin { background: var(--raised); border: 1px solid var(--line); color: var(--text); }
.ubar.user { background: var(--rx-box); color: var(--rx); }
.ubar p { margin: 0; font-size: 14px; }
.ubar p small { color: var(--muted); font-variant-numeric: tabular-nums; margin-left: 6px; }
.ubar .bar { grid-column: 1 / -1; height: 6px; }

/* The upgrade dialog: the question, the steps and the result. */
dialog.up-dlg { width: min(460px, calc(100vw - 32px)); padding: 0; }
.up { padding: 22px 24px 20px; display: grid; gap: 16px; }
.up > p { margin: 0; color: var(--muted); font-size: 14px; }
.up-head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; align-items: center; }
.up-head .orb, .up-head .orb.spin { width: 40px; height: 40px; grid-row: span 2; }
.up-head h2 { font-size: 18px; letter-spacing: -.005em; margin: 0; text-wrap: balance; }
.up-head p { margin: 0; color: var(--muted); font-size: 13px; }
.up-head .mark { width: 40px; height: 40px; grid-row: span 2; border-radius: 50%; display: grid; place-items: center; }
.up-head .mark .ic { width: 22px; height: 22px; stroke-width: 3; }
.mark.ok { background: color-mix(in srgb, var(--ok) 16%, var(--surface)); color: var(--ok); }
.mark.bad { background: var(--busy-box); color: var(--busy); }

/* The steps: a line down the left joins them. */
.up .steps { list-style: none; margin: 0; padding: 0; display: grid; }
.up .step { display: grid; grid-template-columns: 22px minmax(0, 1fr); column-gap: 12px; position: relative; padding-bottom: 14px; }
.up .step:last-child { padding-bottom: 0; }
.up .step::before { content: ""; position: absolute; left: 10px; top: 24px; bottom: 2px; width: 2px; border-radius: 2px; background: var(--line); }
.up .step:last-child::before { display: none; }
.up .step.done::before { background: var(--ok); }
.up .dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line); background: var(--surface); box-sizing: border-box; }
.up .dot .ic { width: 12px; height: 12px; stroke-width: 3; }
.up .step.done .dot { border-color: var(--ok); background: var(--ok); color: var(--surface); }
.up .step.now .dot { border-color: var(--accent-ink); }
.up .step.now .dot::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-ink); animation: up-beat 1.4s ease-in-out infinite; }
.up .step.bad .dot { border-color: var(--busy); background: var(--busy); color: var(--surface); }
@keyframes up-beat { 50% { transform: scale(.55); opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .up .step.now .dot::after { animation: none; } }
.up .step-t { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; min-height: 22px; font-size: 14px; }
.up .step-t span { font-weight: 600; }
.up .step.todo .step-t span { color: var(--muted); font-weight: 500; }
.up .step-t small { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.up .step-d { grid-column: 2; font-size: 13px; color: var(--muted); margin-top: 6px; display: grid; gap: 8px; overflow-wrap: anywhere; }
.up .step-d b { color: var(--text); }

.up .bar, .ubar .bar { height: 8px; border-radius: 999px; background: var(--raised); overflow: hidden; border: 1px solid var(--line); }
.ubar .bar { height: 6px; }
.up .bar > i, .ubar .bar > i { display: block; height: 100%; width: var(--p, 0%); background: var(--accent-ink); border-radius: inherit; transition: width .4s cubic-bezier(.16, 1, .3, 1); }
.up .bar.indef > i, .ubar .bar.indef > i { width: 35%; animation: up-slide 1.3s cubic-bezier(.45, 0, .55, 1) infinite; }
@keyframes up-slide { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
@media (prefers-reduced-motion: reduce) { .up .bar.indef > i, .ubar .bar.indef > i { animation: none; width: 100%; opacity: .35; } }
.up .nums { display: flex; justify-content: space-between; gap: 12px; font-variant-numeric: tabular-nums; font-size: 12px; }
.up .nums b { color: var(--text); font-weight: 600; }

.up .callout { border-radius: 12px; padding: 10px 12px; font-size: 13px; display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; align-items: start; overflow-wrap: anywhere; }
.up .callout .ic { width: 18px; height: 18px; margin-top: 1px; }
.up .callout.warn { background: var(--warn-box); color: var(--warn); }
.up .callout.info { background: var(--raised); color: var(--muted); }
.up .callout b { font-weight: 650; }
.up .callout code { font-family: var(--mono); font-size: 12px; color: var(--text); }

.up .notes h3 { font-size: 13px; margin: 0 0 6px; }
.up .notes ul { margin: 0; padding-left: 18px; font-size: 14px; display: grid; gap: 4px; }

.up details.log { border: 1px solid var(--line); border-radius: 12px; background: var(--bg); font-size: inherit; }
.up details.log summary { cursor: pointer; padding: 10px 12px; font-size: 13px; font-weight: 600; display: flex; justify-content: space-between; gap: 8px; list-style: none; }
.up details.log summary::-webkit-details-marker { display: none; }
.up details.log summary::after { content: "Show"; color: var(--accent-ink); font-weight: 600; }
.up details.log[open] summary::after { content: "Hide"; }
.up details.log summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 12px; }
.up details.log pre { margin: 0; padding: 0 12px 12px; max-height: 190px; overflow: auto; font: 12px/1.6 var(--mono); color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.up details.log pre .e { color: var(--busy); }
.up details.log pre .k { color: var(--ok); }
.up ::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }

.up .dlg-actions { flex-wrap: wrap; margin-top: 2px; }
.up .dlg-actions .lead { margin-right: auto; }
@media (max-width: 560px) {
  dialog.up-dlg {
    width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 24px 24px 0 0; border-bottom: 0;
  }
  .up { padding: 20px 16px calc(16px + env(safe-area-inset-bottom)); }
  .up .dlg-actions .btn { flex: 1 1 100%; }
  .up .dlg-actions .lead { order: 3; margin-right: 0; }
}
/* A user with no nodes on this install sees the message only. */
body.no-nodes #app > :not(#nonodes-bar) { display: none !important; }

.wx-now { display: flex; gap: 12px; align-items: center; margin: 2px 0 10px; }
.wx-temp { font-size: 30px; font-weight: 650; line-height: 1; font-variant-numeric: tabular-nums; }
.wx-desc { font-weight: 600; }
.wx-sub { color: var(--muted); font-size: 13px; }

/* Radio audio gate (On this node). */
.gate-box { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.gate-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.gate-head .overline { margin: 0; }
/* A link from a Node tools control to its Settings page. */
.set-link { font-size: 12px; font-weight: 600; color: var(--muted); text-underline-offset: 2px; letter-spacing: normal; text-transform: none; white-space: nowrap; }
.set-link:hover { color: var(--text); }
.set-link:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.tgl .set-link { margin-left: 6px; }
.gate-head .set-link { margin-left: auto; }
#wx-slot .set-link { display: none; }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 3px; border-radius: 12px; background: var(--raised); }
.seg-btn { appearance: none; border: 0; border-radius: 9px; padding: 7px 4px; font: 600 13px var(--sans); color: var(--muted); background: none; cursor: pointer; white-space: nowrap; }
.seg-btn:hover { color: var(--text); }
.seg-btn[aria-pressed=true] { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--line-strong); }
.seg-btn[aria-pressed=true][data-gate=off] { color: var(--busy); }
.seg-btn[aria-pressed=true][data-gate=rx], .seg-btn[aria-pressed=true][data-gate=tx] { color: var(--warn); }
/* A room module (ADR 0012): off the air; only its members hear it. The
   node parts of the page (links, ports, radio, counts) do not apply. */
body.room-page .mod-only, body.room-page .hero-stats, body.room-page #netonly { display: none !important; }
.room-line { margin: 0 0 12px; font-size: 13px; color: var(--accent-ink); font-weight: 600; }
.chip.room { color: var(--accent-ink); background: var(--raised); }
.room-card .card-head { margin-bottom: 10px; }
.room-card .count { font: 600 12px var(--mono); color: var(--muted); margin-left: 4px; }
.room-visitors { margin: 0 0 10px; padding: 8px 10px; border-radius: 10px; background: var(--warn-box); color: var(--warn); font-size: 13px; font-weight: 600; }
#txcard .room-visitors { margin: 10px 0 0; }
.room-hold { margin: 0 0 10px; padding: 8px 10px; border-radius: 10px; background: var(--tx-box); color: var(--tx); font-size: 13px; font-weight: 600; }
.room-stop { margin: 10px 0 0; padding: 8px 10px; border-radius: 10px; background: var(--busy-box); color: var(--busy); font-size: 13px; }
.members { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.members li { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 28px; }
.members li.empty { min-height: 0; }
.members b { color: var(--text); font: 600 13px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.members b.talking { color: var(--rx); }
.members .room-acts { margin-left: auto; display: flex; gap: 6px; flex: none; }
/* Interrupt: a manager takes the room. */
.interrupt-box { display: grid; gap: 4px; }
.interrupt-box small { font-size: 12px; }
/* Interrupt: a red outline, never a solid fill, so that it is not the
   red Talking button. Held: a light red tint inside the outline. */
.interrupt-btn { touch-action: none; user-select: none; -webkit-user-select: none; border: 2px solid var(--talk-live); color: var(--talk-live); background: transparent; }
.interrupt-btn:not(:disabled):hover { background: var(--talk-live-box); }
.interrupt-btn.on { background: var(--talk-live-box); }
.interrupt-btn:disabled { border-style: dashed; color: var(--muted); border-color: var(--line); }
.room-kick {
  appearance: none; border: 1px solid var(--line); background: transparent; color: var(--busy);
  font: 600 12px var(--sans); padding: 0 10px; min-height: 28px; border-radius: 999px; cursor: pointer;
}
.room-kick:hover { border-color: var(--busy); background: var(--busy-box); }
.room-kick:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
/* On a touch screen, small buttons get a 44 px target. */
@media (pointer: coarse) {
  .btn.small, .seg-btn, .room-kick, .set-nav { min-height: 44px; }
  /* The look stays; the padding makes the target 44 px. */
  .filters button { min-height: 44px; padding: 11px 12px; }
  .clip-more { width: 44px; height: 44px; top: 0; right: 0; }
  .link-chips .chip { min-height: 44px; display: inline-flex; align-items: center; }
  .pick-remove { width: 44px; }
  dialog.settings .icon-btn, .topbar .icon-btn, .kp-dlg .icon-btn { width: 44px; height: 44px; }
}
/* Open mic in the room: the PTT button shows it; PTT is not used. */
.open-box { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.open-box .note { margin: 0; }
.ptt.open:disabled:not([data-talk]) { opacity: 1; background: var(--raised); border-color: var(--accent); color: var(--accent-ink); }
.gate-for { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.gate-for select { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: 4px 8px; }
.gate-box .note { margin: 0; }

/* Password fields with an eye button (reveal.js). */
.pw { position: relative; display: block; width: 100%; max-width: 460px; }
.pw > input { width: 100%; padding-right: 44px !important; box-sizing: border-box; }
.pw-eye {
  position: absolute; top: 50%; right: 4px; transform: translateY(-50%); width: 36px; height: 36px;
  display: grid; place-items: center; border: 0; border-radius: 10px; background: none; color: var(--muted); cursor: pointer; padding: 0;
}
.pw-eye:hover, .pw-eye:focus-visible { color: var(--text); background: var(--raised); }
.pw-eye svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
input::-ms-reveal { display: none; }
.overline .mono { text-transform: none; letter-spacing: 0; }

/* More nodes (modules.d): the scope of a setting, and the node list. */
.set-scope { font-size: 12px; color: var(--muted); margin: 0; padding: 10px 10px 2px; line-height: 1.5; }
/* The scope of the settings stays at the top of the rail, and the rail
   fades at the bottom when more pages are below. */
.set-rail > .set-scope { position: sticky; top: -6px; z-index: 1; background: var(--surface); padding-bottom: 8px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.set-rail { scrollbar-gutter: stable; }
.set-rail::after { content: ""; display: block; position: sticky; bottom: -14px; height: 24px; margin-top: -10px; background: linear-gradient(transparent, var(--surface)); pointer-events: none; }
.set-scope .mono { color: var(--text); }
.set-scope .chip, .scope-chip, .set-scope-note .chip { font-size: 11px; padding: 1px 8px; vertical-align: 1px; }
.set-scope-note .chip { margin-right: 4px; }
main.mods-main { max-width: 760px; margin: 0 auto; padding: 20px 16px 40px; grid-template-columns: minmax(0, 1fr); }
.mods-main .note.first { margin: 0 0 12px; }
.mods-log { max-height: 60vh; overflow-y: auto; }
.mods-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.mods-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 12px; position: relative; min-height: 44px;
  border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; background: var(--surface);
}
.mods-open { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; text-decoration: none; min-width: 0; border-radius: 8px; }
/* The whole row opens the node; the buttons in it stay on top. */
.mods-open::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.mods-row:hover { border-color: var(--muted); }
.mods-row:hover .mods-call { text-decoration: underline; text-underline-offset: 3px; }
.mods-open:focus-visible { outline: none; }
.mods-open:focus-visible::after { border-radius: 14px; outline: 3px solid var(--accent); outline-offset: 2px; }
.mods-acts { position: relative; z-index: 1; }
.mods-call { font-weight: 700; font-size: 16px; }
/* A module is named by its ID; its type follows in a small tag. */
.mod-tag { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; min-width: 0; max-width: 100%; vertical-align: baseline; }
.mod-id { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* A named node (moduleChip): the name, with the ID and type as small
   text under it. */
.mod-chip { display: inline-flex; flex-direction: column; min-width: 0; max-width: 100%; vertical-align: baseline; }
.mod-chip-name { font-family: var(--sans); min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mod-chip-name.mono { font-family: var(--mono); }
.mod-chip-meta { font: 500 12px/1.35 var(--sans); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.type-tag { flex: none; font: 650 10.5px/1.5 var(--sans); letter-spacing: .04em; padding: 0 6px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); white-space: nowrap; }
.mods-sub { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.mods-chips { grid-column: 1; display: flex; flex-wrap: wrap; gap: 6px; }
.mods-row.scan-on { border-color: var(--rx); }
.mods-acts { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
/* On a phone the buttons go under the chips, so that they do not cover them. */
@media (max-width: 480px) {
  .mods-row { grid-template-columns: minmax(0, 1fr); }
  .mods-acts { grid-column: 1; grid-row: auto; justify-content: flex-start; }
}
.mods-form { display: grid; gap: 10px; max-width: 420px; }
.mods-form > label:not(.check) { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.mods-form small { font-size: 12px; }
.mods-form input:not([type="checkbox"]) {
  font: inherit; font-size: 15px; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 10px; padding: 8px 10px; min-height: 40px; box-sizing: border-box;
}
.mods-form .btn { justify-self: start; }
.user-small { font-size: 13px; color: var(--muted); }
@media (max-width: 760px) { .user-small { display: none; } }

/* Scan: one audio connection for all the user's nodes. */
.scan-btn { flex: none; }
.scan-btn[aria-pressed="true"] { background: var(--rx-box); border-color: var(--rx); color: var(--rx); }
.scan-bar { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 12px; }
.scan-bar[hidden] { display: none; }
.scan-now { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.scan-who { min-width: 0; flex: 1 1 240px; }
.scan-who .overline { display: flex; align-items: center; gap: 8px; }
.scan-node { font-size: 20px; font-weight: 650; overflow-wrap: anywhere; margin-top: 4px; }
.scan-node .mod-chip { max-width: calc(100% - 5em); }
.scan-node .mod-chip-name { font-family: inherit; white-space: normal; overflow-wrap: anywhere; }
.scan-node-sub { display: block; margin-top: 2px; font: 400 13px/1.4 var(--sans); color: var(--muted); }
.scan-sub { color: var(--muted); font-size: 13px; margin-top: 2px; min-height: 1.3em; }
.scan-busy { color: var(--warn); font-size: 13px; font-weight: 600; margin-top: 2px; }
.scan-bar[data-state="active"] .scan-node { color: var(--rx); }
.scan-bar[data-state="talk"] .scan-node { color: var(--tx); }
.scan-hang { height: 4px; border-radius: 2px; background: var(--raised); margin-top: 8px; overflow: hidden; max-width: 320px; }
.scan-hang-fill { height: 100%; width: 0; background: var(--rx); }
.scan-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.scan-acts a.btn { text-decoration: none; color: inherit; }
.scan-opts { display: flex; gap: 12px 24px; flex-wrap: wrap; align-items: center; }
.scan-hang-set { flex: 0 1 260px; min-width: 0; }
.scan-opts .check { font-size: 13px; }
.scan-bar > .note { margin: 0; }
.scan-skipped { display: flex; flex-direction: column; gap: 6px; }
.scan-skipped[hidden] { display: none; }
.scan-skipped-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.scan-skipped-list li {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%;
  padding: 2px 4px 2px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px;
}
.scan-skipped-list li > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* A node with a higher priority waits while the user talks back. */
.scan-wait { color: var(--warn); font-size: 13px; font-weight: 600; margin-top: 2px; }
.scan-wait[hidden] { display: none; }
/* Scan priorities (scanprio.js). The split on the Scan button opens the
   panel; so do the More menu, the scan bar and the All nodes page. */
.scan-split { display: inline-flex; flex: none; }
.scan-split > .scan-btn { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.scan-prio-btn { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; padding: 0 10px; }
.scan-prio-line { margin: 0; }
.link-btn {
  appearance: none; border: 0; background: none; padding: 0; color: inherit; font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}
.link-btn:hover { color: var(--text); }
dialog.prio-dlg { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; overflow: hidden; }
dialog.prio-dlg[open] { display: flex; flex-direction: column; }
.prio-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.prio-head h2 { font-size: 18px; }
.prio-head .icon-btn { width: 44px; height: 44px; }
.prio-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 20px 6px; }
.prio-intro { margin: 0; font-size: 15px; }
.prio-who { margin: 6px 0 0; max-width: 62ch; }
.prio-err { margin: 0; min-height: 0; font-weight: 600; }
.prio-rows { list-style: none; margin: 10px 0 0; padding: 0; }
.prio-rows > li { padding: 14px 0; border-top: 1px solid var(--line); }
.prio-mod { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; min-width: 0; font-weight: 650; }
.prio-mod small { font-weight: 400; font-size: 13px; overflow-wrap: anywhere; }
.prio-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px 16px; margin-top: 10px; }
.prio-col, .prio-def-fold { max-width: 440px; }
.prio-col-h { margin-bottom: 8px; }
/* In my scan, and the admin's "In the default scan list" (ADR 0012). */
.prio-list { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 13px; margin-bottom: 6px; color: var(--muted); }
.prio-list-txt b { color: var(--text); font-weight: 600; }
.prio-def-list { color: var(--muted); font-weight: 500; }
/* The admin's "Default for everyone": folded, with the value in the line. */
.prio-def-fold { border: 1px solid var(--line); border-radius: 14px; background: var(--raised); }
.prio-def-fold > summary { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; cursor: pointer; list-style: none; font-size: 13px; }
.prio-def-fold > summary::-webkit-details-marker { display: none; }
.prio-def-fold > summary b { font-weight: 650; }
.prio-def-fold > summary .ic { margin-left: auto; flex: none; color: var(--muted); transition: transform .15s ease-out; }
.prio-def-fold[open] > summary .ic { transform: rotate(180deg); }
.prio-def-fold > summary:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; border-radius: 14px; }
.prio-def-body { padding: 0 12px 4px; }
@media (prefers-reduced-motion: reduce) { .prio-def-fold > summary .ic { transition: none; } }
.prio-col-sub { text-transform: none; letter-spacing: 0; font-weight: 500; }
.prio-col-sub::before { content: "· "; }
.prio-seg {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--line-strong); border-radius: 12px;
  overflow: hidden; background: var(--surface);
}
.prio-seg-btn {
  appearance: none; border: 0; border-left: 1px solid var(--line); background: transparent; color: var(--text); cursor: pointer;
  min-height: 48px; padding: 4px 2px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  font: 600 13px/1.2 var(--sans); min-width: 0;
}
.prio-seg-btn:first-child { border-left: 0; }
.prio-seg-btn b { font-weight: 650; }
.prio-seg-btn small { font-size: 11px; color: var(--muted); }
.prio-seg-btn:hover:not(:disabled) { background: var(--raised); }
.prio-seg-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
/* The value in use: a 2 px ring in the text colour, the number in the
   accent. A full accent block saying "Off" would be the loudest thing in
   the panel. */
.prio-seg-btn[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 2px var(--text); }
.prio-seg-btn[aria-pressed="true"] small { color: var(--accent-ink); font-weight: 700; }
/* The module follows the default: a thin ring on the raised surface.
   The text under the buttons also says it. */
.prio-seg-btn[aria-pressed="true"].follow { background: var(--raised); box-shadow: inset 0 0 0 1px var(--line-strong); }
.prio-seg-btn[aria-pressed="true"].follow small { color: var(--muted); font-weight: 600; }
.prio-seg-btn:disabled { cursor: default; }
.prio-seg-btn:disabled:not([aria-pressed="true"]) { opacity: .55; }
.prio-custom { margin-top: 8px; }
.prio-state { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; margin-top: 4px; font-size: 13px; }
.prio-src { flex: 1 1 auto; min-width: 0; color: var(--muted); }
.prio-src b { color: var(--text); font-weight: 650; }
/* A fixed column, so that the row does not move or wrap when the
   button shows. */
.prio-reset-slot { flex: none; width: 112px; display: flex; justify-content: flex-end; }
.prio-reset { min-height: 40px; }
.prio-reset.off { visibility: hidden; }
.prio-foot { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line); }
/* The "Saved" line and a save error, always in view. */
.prio-msg { flex: 1 1 auto; min-width: 0; }
.prio-said { margin: 0; font-size: 13px; font-weight: 600; color: var(--ok); }
.prio-step { display: inline-flex; align-items: center; gap: 4px; }
.prio-btn { min-width: 44px; min-height: 44px; padding: 0; justify-content: center; font-size: 20px; line-height: 1; }
.prio-input {
  width: 4.2em; min-height: 44px; text-align: center; font-size: 16px; border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface); color: var(--text); -moz-appearance: textfield; appearance: textfield;
}
.prio-input::-webkit-inner-spin-button, .prio-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
@media (max-width: 560px) {
  dialog.prio-dlg, dialog.prio-dlg.admin {
    width: 100vw; max-width: 100vw; max-height: calc(100dvh - 24px); margin: auto 0 0; border-radius: 24px 24px 0 0; border-bottom: 0;
  }
  .prio-head { padding: 12px 16px; }
  .prio-body { padding: 12px 16px 4px; }
  .prio-foot { padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
}
@media (max-width: 760px) {
  .scan-btn { padding: 0 10px; }
  .scan-btn .ic { margin: 0; }
  .scan-acts { width: 100%; }
  .scan-acts .btn { flex: 1 1 0; }
  .scan-hang-set { flex: 1 1 100%; }
}
/* The menu of the split: Scan all, Scan my list (the last pick has the
   check mark) and Scan priorities. */
.scan-split { position: relative; }
.scan-prio-btn { padding: 0 8px; }
.scan-prio-btn[aria-expanded="true"] { background: var(--surface); }
.scan-menu { position: fixed; right: auto; max-height: calc(100vh - 96px); overflow-y: auto; }
.scan-menu[hidden] { display: none; }
.scan-menu-item { align-items: flex-start; padding: 8px 10px; }
.scan-menu-mark { flex: none; width: 18px; height: 18px; margin-top: 1px; color: var(--accent); }
.scan-menu-mark .ic { color: inherit; }
.scan-menu-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.scan-menu-txt b { font-weight: 600; }
.scan-menu-txt small { color: var(--muted); font-size: 12.5px; font-weight: 400; line-height: 1.35; }
.scan-menu-sep { height: 1px; background: var(--line); margin: 4px 6px; }
/* On the dashboard a phone has the modes in the More menu, so that the
   station title keeps its room. */
@media (max-width: 480px) {
  .scan-split-more > .scan-prio-btn { display: none; }
  .scan-split-more > .scan-btn { border-radius: 999px; }
}
/* Scan my list with no module, and the rooms the scan left out. */
.scan-list-note { font-size: 13px; margin-top: 4px; }
.scan-list-note[hidden] { display: none; }
.scan-list-note p { margin: 2px 0 0; color: var(--warn); font-weight: 600; }
.scan-list-note .scan-list-empty { color: var(--text); font-weight: 500; }

/* Module colors: a node keeps its color (module.js moduleColor). Each
   color has a contrast of 4.5:1 or more on the clip background in both
   themes. */
:root {
  --mc0: #0A5F77; --mc1: #7A3E9D; --mc2: #A3410B; --mc3: #2E6B1F;
  --mc4: #9B1C4A; --mc5: #1F4FA8; --mc6: #6B5B00; --mc7: #8A3B2E;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --mc0: #5EEAD4; --mc1: #D8A8FF; --mc2: #FFB480; --mc3: #9BE07A;
    --mc4: #FF9EC0; --mc5: #9EC2FF; --mc6: #E8D36A; --mc7: #FFA894;
  }
}
:root[data-theme="dark"] {
  --mc0: #5EEAD4; --mc1: #D8A8FF; --mc2: #FFB480; --mc3: #9BE07A;
  --mc4: #FF9EC0; --mc5: #9EC2FF; --mc6: #E8D36A; --mc7: #FFA894;
}
[data-mc="0"] { --mc: var(--mc0); } [data-mc="1"] { --mc: var(--mc1); }
[data-mc="2"] { --mc: var(--mc2); } [data-mc="3"] { --mc: var(--mc3); }
[data-mc="4"] { --mc: var(--mc4); } [data-mc="5"] { --mc: var(--mc5); }
[data-mc="6"] { --mc: var(--mc6); } [data-mc="7"] { --mc: var(--mc7); }

/* Clips of all nodes: the node of each clip, in its color, and the
   Missed mark. */
.clip.has-mod { border-left: 4px solid var(--mc); width: 196px; }
.clip-marks .mod-tag { flex-wrap: nowrap; }
.clip-marks { grid-column: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; min-width: 0; font-size: 12px; }
.clip-mod { color: var(--mc, var(--text)); font-weight: 650; }
.clip-mod .type-tag { color: inherit; border-color: currentColor; }
.clip-missed {
  font: 700 10.5px/1.5 var(--sans); letter-spacing: .04em; text-transform: uppercase;
  padding: 0 6px; border-radius: 999px; color: var(--warn); background: var(--warn-box); border: 1px solid var(--warn);
}
/* A manager's speech while Interrupt held the room. */
.clip-int {
  font: 700 10.5px/1.5 var(--sans); letter-spacing: .04em; text-transform: uppercase;
  padding: 0 6px; border-radius: 999px; color: var(--tx); background: var(--tx-box); border: 1px solid var(--tx);
}
/* A clip with a transcript, or one that the voice server transcribes now
   (ADR 0014). */
.clip-stt {
  font: 700 10.5px/1.5 var(--sans); letter-spacing: .04em; text-transform: uppercase;
  padding: 0 6px; border-radius: 999px; color: var(--rx); background: var(--rx-box); border: 1px solid var(--rx);
}
.clip-stt.busy { animation: stt-pulse 1.4s ease-in-out infinite; }
@keyframes stt-pulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .clip-stt.busy { animation: none; } }
dialog.clip-tx { width: min(520px, calc(100vw - 32px)); }
.clip-tx .clip-tx-text { color: var(--text); font-size: 15px; white-space: pre-line; max-height: 50vh; overflow-y: auto; }
.clip-tx .clip-tx-label { font-size: 12px; }
.clips-card .card-head { flex-wrap: wrap; }
.clips-card .card-head h2 { margin-right: auto; }
.clips-seg { grid-template-columns: repeat(2, auto); }
.missed-btn { appearance: none; border: 1px solid var(--warn); color: var(--warn); background: var(--warn-box); min-height: 32px; cursor: pointer; font: 650 12px var(--sans); }
.missed-btn[aria-pressed="true"] { background: var(--warn); color: var(--surface); }
.missed-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.clips-skipped { margin-top: 10px; }
.clips-skipped .overline { margin: 0 0 6px; }
.clips-skipped .clip { opacity: .85; }

/* The node in the activity log of all nodes. */
.log-mod { vertical-align: baseline; }

/* While the page shows all the nodes, the cards of one node hide. */
body.all-view .mod-only { display: none !important; }
/* All nodes without the scan: the audio stays on the node that the user
   hears, and the talk controls hide, because they have no node there. */
body.listen-all :is(#ptt, #dock-ptt, #dock-kp, #open-box, #interrupt-box, #mic-fold, #where-chip, #netonly,
  #room-card, #room-line, #room-stop, #ptt-visitors, #tx-note) { display: none !important; }
.nodes-card .note.first { margin: 0 0 12px; }
#st-all { color: var(--text); font-weight: 600; }

/* Last heard: two short lines per talker, so it fits a phone. */
.lh-card { padding: 14px 16px; }
.lh-card .card-head { margin-bottom: 8px; }
.lh { list-style: none; margin: 0; padding: 0; }
.lh > li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 10px; align-items: baseline;
  padding: 7px 0; border-top: 1px solid var(--line);
}
.lh > li:first-child { border-top: 0; }
.lh-who { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lh-when, .lh-dur { color: var(--muted); font-size: 12.5px; white-space: nowrap; text-align: right; }
.lh-mod { font-size: 12.5px; color: var(--muted); }
.lh-empty { color: var(--muted); display: block !important; }
.lh-more { margin-top: 6px; }

/* Settings, Modules */
.modset-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-width: 640px; }
.modset-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; background: var(--raised);
}
.modset-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.modset-who small { color: var(--muted); overflow-wrap: anywhere; }
.modset-row .btn { min-height: 44px; }
.modset-types { border: 0; margin: 0 0 12px; padding: 0; min-width: 0; }
.modset-types legend { padding: 0; margin-bottom: 8px; font-weight: 650; }
.modset-type { min-height: 44px; }
.modset-type input { width: 20px; height: 20px; }
.modset-type b { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.modset-type.later { cursor: not-allowed; opacity: .65; }
.modset-fields { max-width: 640px; }
.modset-add > .btn { margin-top: 12px; min-height: 44px; }
.modset-said:empty { display: none; }
