:root {
  --panel: #161d24;
  --panel-2: #1e2731;
  --line: #2c3845;
  --text: #d7dee5;
  --muted: #8796a4;
  --readout: #f2a93b;
  --ok: #5fc27c;
  --warn: #e3b341;
  --bad: #e2625b;
  --grid: rgba(135, 150, 164, 0.18);
  --trace: #9fd3ff;
  --trace-fill: rgba(159, 211, 255, 0.14);
  --font: "Barlow Semi Condensed", "Segoe UI", "Roboto Condensed", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--panel);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

body {
  display: grid;
  grid-template-rows: auto 1fr;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 28px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}

.ident h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.2;
}

.ident .dev {
  color: var(--muted);
  font-size: 0.9rem;
}

.readout {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 2px 12px 4px;
  background: #0a0d10;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.freq {
  width: 11ch;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--readout);
  font: inherit;
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-align: right;
  text-shadow: 0 0 12px rgba(242, 169, 59, 0.35);
  font-variant-numeric: tabular-nums;
}

.freq:focus { outline: none; color: #fff; }

.knob {
  width: 168px;
  height: 168px;
  border-radius: 50%;
  padding: 7px;
  background: radial-gradient(circle at 50% 50%, #0a0d10 62%, var(--line) 63%, #0a0d10 70%);
  cursor: grab;
  touch-action: none;
  flex: 0 0 auto;
  outline: none;
}

.knob:focus-visible { box-shadow: 0 0 0 2px var(--readout); }
.knob.turning { cursor: grabbing; }

.knob-face {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background:
    repeating-conic-gradient(from 0deg, rgba(255, 255, 255, 0.07) 0deg 3deg, rgba(0, 0, 0, 0.18) 3deg 6deg),
    radial-gradient(circle at 35% 30%, #59636e, #2a3139 60%, #181d22);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.18), 0 2px 6px rgba(0, 0, 0, 0.6);
}

.knob-dimple {
  position: absolute;
  top: 9%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin-left: -10px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #111, #000);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(242, 169, 59, 0.55);
}

.mode-label {
  margin-left: 6px;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
}

.smeter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 150px;
}

.smeter-track {
  height: 8px;
  background: #0a0d10;
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
}

.smeter-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--ok) 0 60%, var(--warn) 60% 85%, var(--bad) 85%);
  background-size: 150px 100%;
}

.smeter-val { color: var(--muted); font-size: 0.85rem; }

.unit { color: var(--muted); }

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 22px;
  margin: 0;
}

.meta div { display: flex; flex-direction: column; }
.meta dt { color: var(--muted); font-size: 0.8rem; }
.meta dd { margin: 0; font-weight: 500; min-width: 6ch; }

.status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
}

.status[data-state="ok"]::before { background: var(--ok); }
.status[data-state="down"]::before { background: var(--bad); }

#display {
  position: relative;
  display: grid;
  grid-template-rows: var(--spec-h, minmax(110px, 28%)) 16px 26px 1fr;
  min-height: 0;
  background: #000;
  touch-action: none;
  cursor: crosshair;
  outline: none;
}

#display:focus-visible { box-shadow: inset 0 0 0 2px var(--readout); }
#display.dragging { cursor: grabbing; }

#display canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
}

#scale { background: var(--panel-2); border-bottom: 1px solid var(--line); }
#bandplan { background: var(--panel-2); border-top: 1px solid var(--line); cursor: pointer; }

.marks {
  position: absolute;
  top: 4px;
  left: 0;
  right: 0;
  height: 0;
  pointer-events: none;
}

.mark {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 6px;
  min-height: 0;
  height: 20px;
  font-size: 0.8rem;
  line-height: 18px;
  border-radius: 3px;
  background: rgba(22, 29, 36, 0.85);
  border: 1px solid var(--readout);
  color: var(--readout);
  pointer-events: auto;
  cursor: pointer;
}

.mark.personal { border-color: var(--trace); color: var(--trace); }
.mark:hover { background: var(--panel-2); color: var(--text); }

.rx-pickers { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.rx-select { padding: 2px 8px; min-height: 28px; max-width: 220px; }

.nodevice {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  background: rgba(10, 13, 16, 0.92);
  text-align: center;
}

.nodevice strong { font-size: 1.6rem; font-weight: 600; color: var(--readout); }
.nodevice span { max-width: 46ch; color: var(--muted); }

.decoder-panel {
  border-top: 1px solid var(--line);
  padding: 8px 16px;
  background: var(--panel-2);
}

.decoder-head { display: flex; align-items: center; gap: 12px; }
.decoder-head button { margin-left: auto; padding: 2px 10px; min-height: 28px; }
.decoder-status { color: var(--muted); font-size: 0.9rem; }

.decoded {
  margin: 6px 0 0;
  height: 4.6em;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font: 500 1.05rem/1.4 "Cascadia Mono", "Consolas", ui-monospace, monospace;
  color: var(--text);
}

.passband {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(242, 169, 59, 0.10);
  border-inline: 1px solid rgba(242, 169, 59, 0.55);
  pointer-events: none;
}

.passband .dial {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--readout);
}

.passband .edge {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 14px;
  pointer-events: auto;
  cursor: ew-resize;
  touch-action: none;
}

.edge-low { left: -7px; }
.edge-high { right: -7px; }

.notice {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 24px);
  padding: 6px 14px;
  background: var(--panel-2);
  border: 1px solid var(--warn);
  border-radius: 4px;
  color: var(--text);
  pointer-events: none;
}

.scope-tools {
  position: absolute;
  top: 4px;
  right: 6px;
  z-index: 4;
  display: flex;
  gap: 3px;
}

.scope-tools button,
.pal-menu {
  font: 600 0.72rem/1 var(--font);
  letter-spacing: 0.04em;
}

.scope-tools button {
  min-height: 0;
  height: 20px;
  padding: 0 7px;
  border-radius: 3px;
  background: rgba(10, 13, 16, 0.85);
  border: 1px solid var(--line);
  color: var(--muted);
}

.scope-tools button:hover { color: var(--text); border-color: var(--muted); }
.scope-tools button[aria-pressed="true"] { color: var(--readout); border-color: rgba(242, 169, 59, 0.6); }
.pal-chip { color: var(--readout) !important; min-width: 74px; }

.pal-menu {
  position: fixed;
  z-index: 50;
  min-width: 150px;
  max-height: 70vh;
  overflow-y: auto;
  padding: 4px;
  background: rgba(10, 13, 16, 0.97);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
}

.pal-head { padding: 4px 6px 2px; color: var(--muted); }
.pal-head:not(:first-child) { margin-top: 4px; border-top: 1px solid var(--line); }

.pal-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 0;
  padding: 3px 6px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.pal-item:hover, .pal-item:focus-visible { background: var(--panel-2); outline: none; }
.pal-item[aria-checked="true"] { color: var(--readout); }
.pal-sw { flex: 0 0 auto; width: 52px; height: 9px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15); }
.pal-item[aria-checked="true"] .pal-sw { box-shadow: 0 0 0 1px var(--readout); }

.spec-grip {
  position: absolute;
  left: 0;
  right: 0;
  height: 7px;
  z-index: 3;
  cursor: ns-resize;
  touch-action: none;
}

.spec-grip:hover, .spec-grip.dragging { background: rgba(159, 211, 255, 0.22); }

.cursor {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(242, 169, 59, 0.55);
  pointer-events: none;
}
.cursor-freq {
  position: absolute;
  top: 4px;
  left: 8px;
  padding: 0 4px;
  border-radius: 3px;
  background: rgba(3, 7, 15, 0.8);
  border: 1px solid rgba(var(--acc-rgb), 0.5);
  color: var(--acc);
  font: 500 10px/1.3 var(--mono);
  white-space: nowrap;
  pointer-events: none;
}
.cursor-freq.flip { left: auto; right: 8px; }

.controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
}

.modes { gap: 0; }
.modes button { border-radius: 0; margin-left: -1px; min-width: 48px; }
.modes button:first-child { border-radius: 4px 0 0 4px; margin-left: 0; }
.modes button:last-child { border-radius: 0 4px 4px 0; }
.modes button[aria-pressed="true"] {
  position: relative;
  background: var(--readout);
  border-color: var(--readout);
  color: #1a1206;
  font-weight: 600;
}

.primary { min-width: 110px; font-weight: 600; }
.primary[aria-pressed="true"] { border-color: var(--ok); color: var(--ok); }
.range.short { flex: 0 1 160px; }

.group { display: flex; align-items: center; gap: 8px; }
.range { flex: 1 1 180px; max-width: 280px; }
.range span { white-space: nowrap; min-width: 9.5ch; color: var(--muted); }
.range output { color: var(--text); }
.range input { flex: 1; accent-color: var(--readout); }
.select span { color: var(--muted); }

button, select {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 6px 12px;
  min-height: 34px;
}

.zoom button { width: 40px; font-size: 1.2rem; padding: 0; }
button:hover { border-color: var(--muted); }
button:active { background: var(--line); }
button:focus-visible, select:focus-visible, input:focus-visible {
  outline: 2px solid var(--readout);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .bar { gap: 8px 16px; padding: 8px 12px; }
  .freq { font-size: 1.6rem; }
  .smeter { min-width: 120px; }
  .meta { gap: 2px 14px; font-size: 0.9rem; }
  .status { margin-left: 0; }
  .controls { padding: 8px 12px; }
  .range { max-width: none; }
}


.ident h1 { display: flex; align-items: baseline; gap: 8px; }
.brand { color: var(--readout); font-weight: 600; letter-spacing: 0.02em; }
.station { color: var(--text); font-weight: 500; }
.station:empty { display: none; }
.rx-pickers { align-items: center; }
.rx-pickers .dev { color: var(--muted); font-size: 0.9rem; }

.rig {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 30;
  width: min(720px, calc(100vw - 16px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  background: rgba(22, 29, 36, 0.96);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}

.rig.placed { transform: none; bottom: auto; }

.rig-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 4px 10px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.rig.collapsed .rig-head { border-bottom: 0; border-radius: 8px; }
.rig.dragging .rig-head { cursor: grabbing; }

.rig-grip {
  width: 14px;
  height: 14px;
  background: radial-gradient(circle, var(--muted) 1.2px, transparent 1.6px) 0 0 / 5px 5px;
  opacity: 0.8;
}

.rig-name { color: var(--muted); font-size: 0.85rem; flex: 1; }
.rig-min { min-height: 26px; height: 26px; width: 30px; padding: 0; font-size: 1.1rem; }

.rig-body { padding: 10px 12px 12px; }

.rig-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin-bottom: 10px;
}

.rig-top .readout { flex: 0 0 auto; }
.rig-top .smeter { flex: 1 1 160px; }

.rig-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.rig-knob {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.stack { display: flex; flex-direction: column; gap: 3px; color: var(--muted); font-size: 0.85rem; width: 100%; }

.rig-ctrl { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.rig-ctrl .row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.rig-ctrl .range { flex: 1 1 150px; max-width: none; }
.rig-ctrl .modes button { min-width: 0; flex: 1; }
.rig-ctrl .modes { flex: 1 1 auto; display: flex; }

.rig .decoder-panel { margin: 10px -12px -12px; border-radius: 0 0 8px 8px; }

@media (max-width: 700px) {
  .rig, .rig.placed {
    position: static;
    transform: none;
    width: auto;
    max-height: none;
    border-radius: 0;
    border-width: 1px 0 0;
    box-shadow: none;
  }
  body { grid-template-rows: auto minmax(55vh, 1fr) auto; }
  .rig-head { cursor: default; border-radius: 0; }
  .rig-main { grid-template-columns: 1fr; }
  .rig-knob { flex-direction: row; justify-content: center; }
  .knob { width: 104px; height: 104px; }
  .stack { width: auto; }
}

.freq-digits {
  display: inline-flex;
  align-items: baseline;
  color: var(--readout);
  font-size: 2rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 12px rgba(242, 169, 59, 0.35);
  cursor: ns-resize;
  user-select: none;
  outline: none;
  touch-action: none;
}

.freq-digits.ghz { font-size: 1.55rem; }

.freq-digits .dg {
  display: inline-block;
  min-width: 0.6em;
  text-align: center;
  border-radius: 3px;
  transition: background-color 80ms;
}

.freq-digits .dg.lead { color: rgba(242, 169, 59, 0.28); text-shadow: none; }
.freq-digits .dg:hover,
.freq-digits .dg.sel { background: rgba(242, 169, 59, 0.16); color: #ffd28a; }
.freq-digits:focus-visible .dg.sel { box-shadow: inset 0 -2px 0 var(--readout); }
.freq-digits .sep { width: 0.22em; }
.freq-digits .dot { padding: 0 0.04em; }

.eq-panel {
  padding: 8px 10px 10px;
  background: #0f1419;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.eq-bands {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.eq-band {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--muted);
}

.eq-band output { color: var(--text); min-width: 4ch; text-align: center; }

.eq-slider {
  writing-mode: vertical-lr;
  direction: rtl;
  width: 26px;
  height: 110px;
  accent-color: var(--readout);
}

.eq-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 8px; }
.eq-foot button { min-height: 28px; padding: 2px 10px; }
.eq-hint { color: var(--muted); font-size: 0.8rem; }
#eq-edit[aria-expanded="true"] { border-color: var(--readout); color: var(--readout); }

.work {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  min-height: 0;
}

.dock {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 0 10px 4px;
  background: var(--panel);
  border-left: 1px solid var(--line);
}

.dock-tab {
  writing-mode: vertical-rl;
  min-height: 0;
  padding: 12px 5px;
  border: 1px solid var(--line);
  border-right: 0;
  border-radius: 6px 0 0 6px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dock-tab:hover, .dock-tab[aria-expanded="true"] { color: var(--text); background: #26313c; }
.dock-tab.pinned { color: var(--readout); border-color: rgba(242, 169, 59, 0.6); }

.panel {
  position: fixed;
  z-index: 40;
  width: 300px;
  max-height: calc(100vh - 16px);
  overflow-y: auto;
  background: rgba(22, 29, 36, 0.97);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
}

.panel.flyout { z-index: 45; }
.panel.dragging { opacity: 0.92; }

.panel-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 2px 4px 2px 12px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.panel.dragging .panel-head { cursor: grabbing; }

.panel-title {
  flex: 1;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.panel-pin {
  display: grid;
  place-items: center;
  width: 30px;
  height: 28px;
  min-height: 0;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.panel-pin:hover { color: var(--text); border-color: var(--line); }
.panel-pin[aria-pressed="true"] { color: var(--readout); }
.panel-pin[aria-pressed="false"] svg { transform: rotate(45deg); }

.sec-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 10px 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.sec-body .field { display: flex; flex-direction: column; gap: 4px; }
.sec-body .field > span { color: var(--muted); font-size: 0.85rem; }
.sec-body .field output { color: var(--text); }
.sec-body input[type="range"] { width: 100%; accent-color: var(--readout); }
.sec-body select { width: 100%; }
.sec-body .wide { width: 100%; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

.pick-row { display: flex; flex-direction: column; gap: 6px; }
.pick-row:has(select:not([hidden])) { margin-bottom: 2px; }

.panel .readout {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  background: #0a0d10;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.panel .freq-digits { font-size: 2.2rem; }
.panel .freq { width: 100%; text-align: center; font-size: 1.8rem; }

.step-row { display: grid; grid-template-columns: 44px 1fr 44px; gap: 6px; }
.step-row button { padding: 0; font-size: 1.2rem; }

.panel .modes,
.panel #modes-digital {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 3px;
}

.panel .modes button,
.panel .modes button:first-child,
.panel .modes button:last-child {
  flex: none;
  border-radius: 4px;
  margin-left: 0;
  min-width: 0;
  min-height: 26px;
  padding: 2px 0;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}

.panel .smeter { min-width: 0; }
.knob-wrap { display: flex; justify-content: center; padding: 4px 0; }

.panel .eq-bands { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.panel .eq-slider { height: 100px; width: 22px; }
.panel .decoder-panel { margin: 0; border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; }

@media (max-width: 760px) {
  body { grid-template-rows: auto 1fr auto; }
  .work { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .dock { flex-direction: row; justify-content: center; padding: 4px; border-left: 0; border-top: 1px solid var(--line); }
  .dock-tab { writing-mode: horizontal-tb; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; }
  .panel, .panel.flyout {
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    width: auto;
    max-height: 60vh;
    border-radius: 8px 8px 0 0;
  }
  .panel-head { cursor: default; }
  .knob { width: 140px; height: 140px; }
}


.sound-hint {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 25;
  padding: 8px 16px;
  border: 1px solid var(--readout);
  border-radius: 20px;
  background: rgba(22, 29, 36, 0.95);
  color: var(--readout);
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

.side-toggle { margin-left: auto; }

.lst-count {
  min-width: 22px;
  padding: 1px 6px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-family: var(--mono, monospace);
  font-size: 0.78rem;
  text-align: center;
}

.lst-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 340px;
  overflow-y: auto;
}

.lst-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto 38px;
  grid-template-rows: auto auto;
  column-gap: 8px;
  align-items: center;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.02);
  cursor: default;
}

.lst-row[role="button"] { cursor: pointer; }
.lst-row[role="button"]:hover,
.lst-row[role="button"]:focus-visible { background: rgba(255, 255, 255, 0.07); outline: none; }
.lst-row.other-rx { opacity: 0.6; }

.lst-dot {
  grid-row: 1 / span 2;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.lst-row.on .lst-dot { background: #46e3a3; box-shadow: 0 0 6px rgba(70, 227, 163, 0.8); }

.lst-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lst-row.you .lst-name { color: var(--acc, var(--readout)); }

.lst-freq {
  font-family: var(--mono, monospace);
  font-variant-numeric: tabular-nums;
  color: var(--readout);
  white-space: nowrap;
}

.lst-mode {
  font-family: var(--mono, monospace);
  font-size: 0.72rem;
  color: var(--muted);
  text-align: right;
}

.lst-sub {
  grid-column: 2 / span 3;
  font-size: 0.72rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lst-empty { margin: 0; color: var(--muted); font-size: 0.8rem; }

.work { position: relative; }

.ldock {
  position: absolute;
  left: 0;
  top: 120px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 5px;
  pointer-events: none;
}

.work .ltab {
  pointer-events: auto;
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 132px;
  height: 30px;
  padding: 0 10px 0 16px;
  border: 1px solid #000;
  border-left: 0;
  border-radius: 0 6px 6px 0;
  background: linear-gradient(180deg, #34383f 0%, #24272c 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 2px 5px rgba(0, 0, 0, 0.5);
  color: #cfd4d9;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  writing-mode: horizontal-tb;
  text-align: left;
  cursor: pointer;
}

.work .ltab::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.08);
}

.work .ltab:hover, .work .ltab[aria-expanded="true"] { color: #fff; background: linear-gradient(180deg, #3d424a 0%, #2b2f35 100%); }
.work .ltab.pinned::before { background: var(--acc, #f2a93b); box-shadow: 0 0 6px var(--acc, #f2a93b); }
.work .ltab svg { flex: none; opacity: 0.85; }
.work .ltab-label { flex: 1; }
.work .ltab-count { font-size: 0.68rem; color: var(--acc, #f2a93b); letter-spacing: 0; }
.work .ltab-count:empty { display: none; }

@media (max-width: 760px) {
  .ldock {
    position: static;
    grid-column: 1;
    grid-row: 3;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    padding: 4px;
    pointer-events: auto;
  }
  .work { grid-template-rows: 1fr auto auto; }
  .work .ltab { width: auto; border: 1px solid #000; border-radius: 6px; }
}

@media (min-width: 761px) {
  .work { grid-template-columns: minmax(0, 1fr); }
  .work > .dock {
    position: absolute;
    right: 0;
    top: 120px;
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 0;
    background: none;
    border: 0;
    box-shadow: none;
    pointer-events: none;
  }
  .work > .dock .ltab {
    padding: 0 16px 0 10px;
    border: 1px solid #000;
    border-right: 0;
    border-radius: 6px 0 0 6px;
  }
  .work > .dock .ltab::before { left: auto; right: 6px; }
}

@media (max-width: 760px) {
  .work > .dock .ltab { width: auto; border: 1px solid #000; border-radius: 6px; }
  .work .ltab::before { display: none; }
}

.nb-hint { margin: 0; color: var(--muted); font-size: 0.78rem; line-height: 1.35; }
.nb-hint.warn { color: #e3b341; }
.nb-hint.warn::before { content: "Not active in FM modes. "; font-weight: 600; }
#nb-on[aria-pressed="true"] { color: var(--acc-on, #000); background: var(--acc, #f2a93b); border-color: var(--acc, #f2a93b); }

.work .ltab-label { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.work .ltab-count { flex: none; white-space: nowrap; }
@media (min-width: 761px) {
  .work .ltab { width: 148px; }
}

.work .ltab-label { overflow: visible; text-overflow: clip; }
@media (min-width: 761px) {
  .work > .ldock, .work > .dock { align-items: stretch; }
  .work .ltab { width: auto; min-width: 148px; }
  .work .ltab-count:not(:empty) { margin-left: 4px; }
}

@media (min-width: 761px) {
  .work > .ldock { align-items: flex-start; }
  .work > .dock { align-items: flex-end; }
}

#panel-doppler { width: 340px; }
.dop-body { gap: 8px; font-family: var(--mono, monospace); }
.dop-status { font-family: var(--mono, monospace); font-size: 0.7rem; color: var(--muted); letter-spacing: 0.04em; }
.dop-status.live { color: #3adb4a; text-shadow: 0 0 6px rgba(60, 220, 80, 0.55); }
.work .ltab-count.dop-live { color: #3adb4a; }

.dop-top { display: flex; align-items: baseline; gap: 7px; min-height: 20px; }
.dop-name {
  min-width: 0;
  overflow: hidden;
  font-size: 1rem;
  font-weight: 600;
  color: #f2f5f7;
  letter-spacing: 0.04em;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-shadow: 0 0 6px rgba(60, 220, 80, 0.4);
}
.dop-mode { padding: 0 4px; border-radius: 2px; color: var(--muted); font-size: 0.66rem; box-shadow: inset 0 0 0 1px var(--line); }
.dop-mode:empty { display: none; }
.dop-badge { margin-left: auto; color: var(--muted); font-size: 0.7rem; white-space: nowrap; }
.dop-badge.up { color: #3adb4a; }
.dop-badge.bad { color: var(--bad); }

.dop-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.dop-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3px 2px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.025);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}
.dop-k { color: #6f7b86; font-size: 0.6rem; letter-spacing: 0.08em; }
.dop-v { margin-top: 1px; color: #d9e6f2; font-size: 0.76rem; font-weight: 600; white-space: nowrap; }
.dop-v.neg { color: #5c6670; }

.dop-freq {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 5px 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.02);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}
.dop-frow { display: flex; align-items: baseline; gap: 8px; }
.dop-fk { width: 42px; flex: none; color: #6f7b86; font-size: 0.66rem; letter-spacing: 0.1em; }
.dop-fv { color: var(--text); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.dop-fv.custom { color: #f0c040; }
.dop-fv.rx { color: #3adb4a; font-size: 1.3rem; font-weight: 600; letter-spacing: 0.02em; text-shadow: 0 0 8px rgba(60, 220, 80, 0.5); }
.dop-fv.shift.pos { color: #22e0b0; }
.dop-fv.shift.neg { color: #f0c040; }
.dop-fv.dim, .dop-fv.rx.dim { color: #4a545e; text-shadow: none; }
.dop-mini {
  min-height: 0;
  padding: 0 6px;
  border: 0;
  border-radius: 2px;
  background: #10161b;
  box-shadow: 0 0 0 1px #1d242b;
  color: var(--muted);
  font: inherit;
  font-size: 0.66rem;
  cursor: pointer;
}
.dop-mini.first { margin-left: auto; }
.dop-mini:hover { color: #fff; background: #1d5fae; }

.dop-curve { display: block; flex: none; border-radius: 3px; background: rgba(0, 0, 0, 0.25); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04); }

.dop-ctl { display: flex; align-items: center; gap: 6px; }
.dop-ctl button { min-width: 64px; }
.dop-ctl button[aria-pressed="true"] { color: #fff; background: #1d7a3a; border-color: #2a9a4c; }
.dop-hint { margin-left: auto; color: #5b656e; font-size: 0.66rem; }

.dop-list {
  display: flex;
  flex-direction: column;
  max-height: 210px;
  min-height: 60px;
  overflow-y: auto;
  padding-top: 3px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  scrollbar-width: thin;
  scrollbar-color: #2e343b #0d1013;
}
.dop-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px 76px 74px;
  gap: 4px;
  align-items: baseline;
  min-height: 0;
  padding: 2px 4px;
  border: 0;
  border-radius: 3px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.72rem;
  text-align: left;
  cursor: pointer;
}
.dop-row:hover, .dop-row:focus-visible { background: rgba(29, 95, 174, 0.18); outline: none; }
.dop-row.sel { background: rgba(29, 95, 174, 0.32); color: #fff; }
.dop-row .dname { overflow: hidden; color: var(--text); white-space: nowrap; text-overflow: ellipsis; }
.dop-row.up .dname, .dop-row.up .dwhen { color: #3adb4a; }
.dop-row.none { opacity: 0.45; }
.dop-row .dfreq, .dop-row .dshift { text-align: right; font-variant-numeric: tabular-nums; }
.dop-row .dwhen { white-space: nowrap; }
.dop-row .dshift { color: #22e0b0; }
.dop-row .dshift.wait { color: #6f7b86; }
.dop-row .dshift.wait.soon { color: #f0c040; }
.dop-foot { color: #4a545e; font-size: 0.62rem; text-align: right; }

@media (max-width: 760px) {
  #panel-doppler { width: auto; }
}

@media (max-width: 380px) {
  .dop-row { grid-template-columns: minmax(0, 1fr) 54px 70px; }
  .dop-row .dwhen { display: none; }
}

#modes-digital { margin-top: 3px; }

.dv {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.dv-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.dv-status { color: var(--muted); font-size: 0.85rem; }
.dv-slots { display: inline-flex; margin-left: auto; }
.dv-slots button { border-radius: 0; margin-left: -1px; padding: 2px 10px; min-height: 28px; }
.dv-slots button:first-child { border-radius: 4px 0 0 4px; margin-left: 0; }
.dv-slots button:last-child { border-radius: 0 4px 4px 0; }
.dv-slots button[aria-pressed="true"] { background: var(--readout); border-color: var(--readout); color: #1a1206; font-weight: 600; }

.dv-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px; }

.dv-card {
  min-height: 84px;
  padding: 6px 10px 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: 4px;
}

.dv-card[data-active="true"] { border-left-color: var(--ok); }

.dv-card-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.dv-card[data-active="true"] .dv-card-head { color: var(--text); }
.dv-sync { margin-left: auto; font-size: 0.75rem; font-weight: 500; color: var(--ok); }
.dv-card dl { display: grid; grid-template-columns: auto 1fr; gap: 1px 10px; margin: 0; }
.dv-card dt { color: var(--muted); font-size: 0.85rem; }
.dv-card dd { margin: 0; min-width: 0; overflow-wrap: anywhere; color: var(--readout); font-weight: 500; }
.dv-idle { color: var(--muted); font-size: 0.9rem; }

.dv-heard-head { display: flex; align-items: center; color: var(--muted); font-size: 0.85rem; }
.dv-heard-head button { margin-left: auto; padding: 1px 10px; min-height: 26px; }

.dv-heard {
  max-height: 9.5em;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
}

.dv-heard li { display: flex; gap: 10px; padding: 2px 0; border-bottom: 1px solid var(--line); }
.dv-heard time { flex: none; color: var(--muted); }
.dv-heard span { min-width: 0; overflow-wrap: anywhere; }

@media (max-width: 760px) {
  .bar .meta { display: flex !important; flex-wrap: wrap; gap: 2px 12px; margin-top: 4px; }
  .bar .meta div { flex-direction: row; align-items: baseline; gap: 4px; }
  .bar .meta dt { font-size: 0.68rem; }
  .bar .meta dd { font-size: 0.78rem; min-width: 0; }
  .bar .meta div:has(#m-cursor) { display: none; }
  .work > #display { margin-bottom: var(--sheet-h, 0px); min-height: 200px; }
  .panel, .panel.flyout { max-height: 48vh; max-height: 48dvh; }
  .panel.full { max-height: 70vh; max-height: 70dvh; }
  .panel-head { min-height: 30px; padding-top: 10px; cursor: pointer; }
  .panel-head::before {
    content: "";
    position: absolute;
    top: 4px;
    left: 50%;
    width: 40px;
    height: 4px;
    margin-left: -20px;
    border-radius: 2px;
    background: var(--line);
  }
  #panel-receiver .sec-body { gap: 6px !important; padding: 6px 8px 8px !important; }
  #panel-receiver .tft { padding: 6px 8px !important; }
  #panel-receiver .tft-tags .tag { padding: 1px 5px; font-size: 0.68rem; }
  #panel-receiver .readout { padding: 2px 6px !important; }
  #panel-receiver .freq-digits { font-size: 1.5rem !important; }
  #panel-receiver .freq { font-size: 1.3rem !important; }
  #panel-receiver .step-row { grid-template-columns: 52px 1fr 52px; }
  #panel-receiver .modes button { min-height: 32px; }
  #panel-receiver:not(.full) .tft-foot,
  #panel-receiver:not(.full) .meter-scale { display: none !important; }
  #panel-receiver .knob-wrap { padding: 2px 0 !important; }
  #panel-receiver .sec-body {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-areas: "tft tft tft" "pick pick pick" "step step step" "modes knob dig";
    align-items: center;
  }
  #panel-receiver .sec-body:has(#modes-digital[hidden]) {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "tft tft" "pick pick" "step step" "modes knob";
  }
  #panel-receiver .tft { grid-area: tft; }
  #panel-receiver .pick-row { grid-area: pick; }
  #panel-receiver .step-row { grid-area: step; }
  #panel-receiver .knob-wrap { grid-area: knob; }
  #panel-receiver .modes:not(#modes-digital) { grid-area: modes; }
  #panel-receiver #modes-digital { grid-area: dig; margin-top: 0; }
  #panel-receiver .modes,
  #panel-receiver #modes-digital { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #panel-receiver .sec-body:has(#modes-digital[hidden]) .modes:not(#modes-digital) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #panel-receiver .mode-label { display: none; }
  #panel-receiver .knob { width: 96px !important; height: 96px !important; }
  #panel-receiver.full .knob { width: 130px !important; height: 130px !important; }
  .panel#panel-map:not([hidden]) {
    top: 0 !important;
    max-height: none !important;
    display: flex;
    flex-direction: column;
    border-radius: 0;
    z-index: 60;
  }
  #panel-map .map-body { flex: 1; min-height: 0; }
  #panel-map .map-canvas { flex: 1; height: auto !important; min-height: 0; }
}

@media (max-width: 760px) and (orientation: landscape) {
  .panel, .panel.flyout { max-height: 55vh; max-height: 55dvh; }
}

@media (max-width: 760px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  .work > .dock, .work > .ldock { flex-wrap: wrap; justify-content: center; width: 100%; max-width: 100vw; box-sizing: border-box; gap: 4px; }
  .work > .dock .dock-tab, .work > .ldock .dock-tab { zoom: 0.8; }
  .panel, .panel.flyout { box-sizing: border-box; width: 100vw !important; max-width: 100vw; }
  #panel-receiver .panel-body { zoom: 0.8; max-width: 460px; margin: 0 auto; }
  #panel-receiver .sec-body > * { min-width: 0; }
  #panel-receiver .modes button { padding: 2px 0; font-size: 0.7rem; }
}
