/* ---------- design tokens ---------- */
:root {
  --bg: #080b11;
  --bg-elevated: #0d1119;
  --bg-card: #111726;
  --bg-hover: #182031;
  --bg-inset: #0a0e16;
  --border: #212a3d;
  --border-soft: #171e2d;

  --text: #e8edf7;
  --text-dim: #8b96ac;
  --text-faint: #57627a;

  --accent: #38bdf8;
  --accent-dim: #123246;
  --accent-strong: #0ea5e9;
  --tx: #ef4444;
  --tx-dim: #3a1414;
  --good: #22c55e;
  --good-dim: #0f2f1d;
  --warn: #f59e0b;
  --warn-dim: #3a2a0d;
  --purple: #a78bfa;
  --purple-dim: #241f3d;

  --radius: 10px;
  --radius-sm: 6px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  --sidebar-w: 216px;
  --topbar-h: 64px;
  --dock-h: 108px;
  --statusfooter-h: 22px;
  --logpanel-w: 340px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  --mono: "SF Mono", Consolas, "Liberation Mono", monospace;

  --mountain-svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 140'%3E%3Cdefs%3E%3ClinearGradient id='sky' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23132033'/%3E%3Cstop offset='1' stop-color='%23a8632f'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='300' height='140' fill='url(%23sky)'/%3E%3Cpolygon points='0,140 40,70 90,110 140,50 190,100 230,60 300,100 300,140' fill='%230d1119' opacity='0.9'/%3E%3C/svg%3E");
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.45;
}

a {
  color: inherit;
}

button {
  font-family: inherit;
  font-size: inherit;
}

code {
  font-family: var(--mono);
}

/* ---------- shell layout ---------- */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas:
    "sidebar topbar"
    "sidebar content";
  height: 100vh;
}

/* ---------- sidebar ---------- */
.sidebar {
  grid-area: sidebar;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: var(--space-4) 0 0;
  position: relative;
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-4) var(--space-5);
}

.brand-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #04202c;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.2;
}

.brand-name {
  font-weight: 700;
  font-size: 15px;
}

.brand-tag {
  font-size: 10.5px;
  color: var(--text-faint);
}

.nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px var(--space-4);
  margin: 0 var(--space-2);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-left: 2px solid transparent;
}

.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.nav-item.active {
  background: var(--accent-dim);
  color: var(--text);
  border-left-color: var(--accent);
}

.sidebar-spacer {
  flex: 1;
}

.sidebar-footer {
  position: relative;
  padding: var(--space-5) var(--space-4) var(--space-4);
  overflow: hidden;
}

.sidebar-footer::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 90% at 15% 0%, rgba(56, 189, 248, 0.06), transparent 60%),
    linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.35)),
    var(--mountain-svg);
  background-repeat: no-repeat;
  background-position: bottom;
  background-size: cover;
  opacity: 0.9;
}

.sidebar-footer-content {
  position: relative;
  z-index: 1;
}

.sidebar-tagline {
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
}

.sidebar-version {
  margin-top: var(--space-2);
  font-size: 10.5px;
  color: var(--text-faint);
}

/* ---------- topbar ---------- */
.topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 0 var(--space-5);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  overflow-x: auto;
}

.topbar-group {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.station-select {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: default;
}

.station-select-icon {
  width: 16px;
  height: 16px;
  color: var(--text-dim);
}

.station-select-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.station-select-text strong {
  font-size: 12.5px;
  font-weight: 600;
}

.station-select-text span {
  font-size: 10.5px;
  color: var(--text-faint);
}

.conn-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 6px var(--good);
  flex-shrink: 0;
}

.conn-status-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.conn-status-text strong {
  font-size: 12.5px;
}

.conn-status-text span {
  font-size: 10.5px;
  color: var(--text-faint);
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
}

.topbar-meta .divider {
  width: 1px;
  height: 14px;
  background: var(--border);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  white-space: nowrap;
}

.pill-good {
  color: var(--good);
  border-color: var(--good-dim);
  background: var(--good-dim);
}

.pill-accent {
  color: var(--accent);
  border-color: var(--accent-dim);
  background: var(--accent-dim);
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--purple-dim);
  color: var(--purple);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.operator-block {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.operator-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.operator-text strong {
  font-size: 12.5px;
}

.operator-text span {
  font-size: 10.5px;
  color: var(--text-faint);
}

/* ---------- content ---------- */
.content {
  grid-area: content;
  overflow-y: auto;
  min-height: 0; /* grid items default to min-height:auto, which grows to
                    fit content instead of letting overflow-y scroll it */
  padding: var(--space-5);
  padding-bottom: calc(var(--dock-h) + var(--statusfooter-h) + var(--space-5));
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.page-header {
  margin-bottom: var(--space-2);
}

.page-header h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.page-header p {
  margin: 0;
  color: var(--text-dim);
  font-size: 13px;
}

/* ---------- dashboard layout ---------- */
.dashboard-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

/* ---------- generic card / grid (still used by simpler pages) ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-4);
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
}

.card h3 {
  margin: 0 0 var(--space-3);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
}

.stat-value {
  font-size: 22px;
  font-weight: 600;
  font-family: var(--mono);
}

.stat-sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-dim);
}

.placeholder-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.placeholder-list li {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-dim);
}

.placeholder-list li span:last-child {
  color: var(--text-faint);
  font-family: var(--mono);
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
}

.badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-hover);
  color: var(--text-faint);
  border: 1px solid var(--border);
}

/* ---------- panel (dashboard component card) ---------- */
.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  /* .content is a column flexbox; a flex item with non-visible overflow
     gets an automatic minimum size of 0 (flexbox spec), so without this
     a tall card (e.g. a long QSO table) gets silently squeezed down and
     clipped instead of pushing .content to scroll. */
  flex-shrink: 0;
}

.panel-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-soft);
}

.panel-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--accent-dim);
  color: var(--accent);
}

.panel-icon.purple {
  background: var(--purple-dim);
  color: var(--purple);
}

.panel-icon svg {
  width: 14px;
  height: 14px;
}

.panel-title {
  font-size: 13px;
  font-weight: 600;
  flex: 1;
}

.panel-card-body {
  padding: var(--space-4);
}

/* ---------- radio strip (top row) ---------- */
.radio-strip {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: var(--space-4);
}

.radio-summary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.radio-summary-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--accent-dim);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.radio-summary-icon.purple {
  background: var(--purple-dim);
  color: var(--purple);
}

.radio-summary-icon svg {
  width: 18px;
  height: 18px;
}

.radio-summary-main {
  flex: 1;
  min-width: 0;
}

.radio-summary-top {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: 2px;
}

.radio-summary-name {
  font-weight: 700;
  font-size: 13px;
}

.radio-summary-freq {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
}

.radio-summary-sub {
  font-size: 11.5px;
  color: var(--text-faint);
  display: flex;
  gap: var(--space-2);
}

.signal-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 16px;
}

.signal-bars span {
  width: 3px;
  background: var(--border);
  border-radius: 1px;
}

.signal-bars span:nth-child(1) { height: 30%; }
.signal-bars span:nth-child(2) { height: 55%; }
.signal-bars span:nth-child(3) { height: 75%; }
.signal-bars span:nth-child(4) { height: 100%; }

.signal-bars.live span {
  background: var(--accent);
}

.mode-pills-strip {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  align-items: flex-end;
  justify-content: center;
}

/* ---------- spectrum panel ---------- */
.spectrum-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.btn-group {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.btn-group button {
  background: var(--bg-inset);
  border: none;
  border-right: 1px solid var(--border);
  color: var(--text-dim);
  padding: 6px 12px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.btn-group button:last-child {
  border-right: none;
}

.btn-group button.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.btn-group button:hover:not(.active) {
  background: var(--bg-hover);
}

.spectrum-wrap {
  position: relative;
  margin-top: var(--space-4);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-inset);
}

.spectrum-wrap canvas {
  display: block;
  width: 100%;
}

.spectrum-marker {
  position: absolute;
  top: 8px;
  transform: translateX(-50%);
  text-align: center;
  font-size: 10.5px;
  color: var(--text-dim);
  pointer-events: none;
}

.spectrum-marker .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-faint);
  margin: 0 auto 2px;
}

.spectrum-marker.self {
  color: var(--good);
  font-weight: 700;
}

.spectrum-marker.self .dot {
  background: var(--good);
  box-shadow: 0 0 6px var(--good);
}

.spectrum-passband {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(56, 189, 248, 0.12);
  border-left: 1px solid rgba(56, 189, 248, 0.5);
  border-right: 1px solid rgba(56, 189, 248, 0.5);
  pointer-events: none;
}

/* Where the dial frequency itself sits — the exact reference point
   current_passband_hz()'s (low, high) offsets are measured from. Centered
   in the passband for CW, at its low edge for USB / high edge for LSB —
   a separate line from the passband's own border so that relationship is
   visible at a glance rather than implied. */
.spectrum-carrier {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--warn);
  pointer-events: none;
}

.spectrum-ticks {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2px;
  pointer-events: none;
}

.spectrum-tick {
  position: absolute;
  transform: translateX(-50%);
  font-size: 9.5px;
  font-family: var(--font-mono, monospace);
  color: var(--text-faint);
  white-space: nowrap;
}

/* Fixed CSS heights, not height:auto — a canvas with no CSS height sizes
   by its intrinsic ratio (its own width/height *attributes*), and
   fitCanvas() (spectrum.js) sets those attributes FROM the rendered
   size every frame. With height:auto those two feed each other: the
   very first paint (before fitCanvas ever runs) renders at the browser
   default 300x150 ratio stretched to the container's full width — way
   taller than intended — and fitCanvas's first call bakes that inflated
   height into the canvas attribute, which then keeps reproducing itself
   every frame after. Pinning the height here breaks the loop; it no
   longer depends on the canvas's own attributes at all.
*/
canvas[data-spectrum="trace"] {
  height: 160px;
  cursor: crosshair;
}

canvas[data-spectrum="waterfall"] {
  height: 110px;
  cursor: crosshair;
}

.spectrum-axis {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--text-faint);
  font-family: var(--mono);
  margin-top: var(--space-2);
}

/* ---------- data tables ---------- */
/* ---------- world map ---------- */
.world-map-wrap {
  position: relative;
  width: 100%;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-inset);
  border: 1px solid var(--border-soft);
}

.world-map-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 11.5px;
  line-height: 1.4;
  white-space: nowrap;
  transform: translate(-50%, -100%);
  margin-top: -8px;
  z-index: 5;
}

.world-map-tooltip strong {
  font-family: var(--mono);
}

.world-map-wrap svg {
  width: 100%;
  height: auto;
  display: block;
}

.world-map-land {
  fill: #1c2636;
  stroke: #2e3d54;
  stroke-width: 0.4;
}

.world-map-line {
  fill: none;
  stroke-width: 0.6;
  opacity: 0.55;
}

.world-map-station {
  fill: var(--accent);
  stroke: var(--bg-inset);
  stroke-width: 1;
}

.world-map-spot {
  stroke: var(--bg-inset);
  stroke-width: 0.6;
  cursor: pointer;
}

.world-map-spot:hover {
  stroke: var(--text);
  stroke-width: 1.2;
}

.table-wrap {
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.data-table th {
  text-align: left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-faint);
  padding: 0 var(--space-2) var(--space-2);
  border-bottom: 1px solid var(--border-soft);
}

.data-table td {
  padding: 6px var(--space-2);
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-dim);
  white-space: nowrap;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.spot-row {
  cursor: pointer;
}

.spot-row:hover td {
  background: var(--bg-hover);
}

.data-table td.mono {
  font-family: var(--mono);
}

.data-table td.strong {
  color: var(--text);
  font-weight: 600;
}

.tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}

.tag-new-dxcc { background: var(--good-dim); color: var(--good); }
.tag-worked { background: var(--bg-hover); color: var(--text-dim); }
.tag-new-band { background: var(--accent-dim); color: var(--accent); }
.tag-rare { background: var(--tx-dim); color: var(--tx); }
.tag-dupe { background: var(--warn-dim); color: var(--warn); }

/* ---------- quick log lookup result ---------- */
.lookup-result {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-height: 20px;
  margin-top: -4px;
  font-size: 11px;
  color: var(--text-faint);
}

.dot-status {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--good);
  display: inline-block;
  margin-right: 4px;
}

/* ---------- rotor compass ---------- */
.rotor-body {
  display: flex;
  gap: var(--space-4);
  align-items: center;
}

.rotor-readout {
  flex: 1;
}

.rotor-heading {
  font-size: 30px;
  font-weight: 700;
  font-family: var(--mono);
}

.rotor-heading-label {
  font-size: 10.5px;
  color: var(--text-faint);
  text-transform: uppercase;
}

.rotor-target-row {
  margin-top: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.rotor-target-row input {
  width: 70px;
}

.compass {
  width: 96px;
  height: 96px;
  flex-shrink: 0;
}

.compass-ring {
  fill: var(--bg-inset);
  stroke: var(--border);
  stroke-width: 1.5;
}

.compass-tick {
  stroke: var(--border);
  stroke-width: 1;
}

.compass-label {
  fill: var(--text-faint);
  font-size: 8px;
  text-anchor: middle;
}

.compass-needle {
  stroke: var(--good);
  stroke-width: 2.5;
  stroke-linecap: round;
}

.compass-target-tick {
  stroke: var(--accent);
  stroke-width: 2;
}

.compass-hub {
  fill: var(--text);
}

/* ---------- RF route flow ---------- */
.route-flow {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.route-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-inset);
  min-width: 90px;
}

.route-chip strong {
  font-size: 12px;
}

.route-chip span {
  font-size: 10px;
  color: var(--text-faint);
}

.route-arrow {
  color: var(--text-faint);
  flex-shrink: 0;
}

.route-meta {
  margin-top: var(--space-4);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: var(--space-3);
}

.route-meta div span {
  display: block;
  font-size: 10px;
  color: var(--text-faint);
  text-transform: uppercase;
}

.route-meta div strong {
  font-family: var(--mono);
  font-size: 13px;
}

/* ---------- telemetry gauges ---------- */
.gauge-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.gauge-row:last-child {
  margin-bottom: 0;
}

.gauge-label {
  width: 110px;
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-dim);
}

.gauge-track {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--bg-inset);
  overflow: hidden;
}

.gauge-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--good);
}

.gauge-fill.warn { background: var(--warn); }
.gauge-fill.accent { background: var(--accent); }

.gauge-value {
  width: 60px;
  flex-shrink: 0;
  text-align: right;
  font-family: var(--mono);
  font-size: 12px;
}

.radio-panel-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
  align-items: flex-end;
}

.freq-input-lg {
  width: 14ch;
}

/* ---------- quick log card ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field label {
  font-size: 10.5px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.field input,
.field select {
  background: var(--bg-inset);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 13px;
  width: 100%;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
}

.log-fields {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.log-row {
  display: flex;
  gap: var(--space-3);
}

.log-row .field {
  flex: 1;
}

.log-checks {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
}

.log-checks label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.log-save-btn {
  width: 100%;
  padding: 10px;
  background: var(--good-dim);
  border: 1px solid var(--good);
  color: var(--good);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 700;
}

.log-save-btn:hover {
  background: var(--good);
  color: #04140b;
}

.log-note {
  font-size: 10.5px;
  color: var(--text-faint);
  text-align: center;
}

.log-note.error {
  color: var(--tx);
}

/* ---------- generic buttons ---------- */
.btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn:hover {
  background: var(--bg-hover);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* Distinguishes a button that opens something (e.g. the Quick Log panel
   toggle) from the plain informational .btn style, so it doesn't blend
   into a row of neutral pills/buttons next to it. */
.btn-accent {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-color: var(--accent-dim);
  color: var(--accent);
}

.btn-accent:hover {
  background: var(--accent-dim);
}

.btn-accent svg {
  width: 14px;
  height: 14px;
}

.icon-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  cursor: pointer;
  flex-shrink: 0;
}

.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.icon-btn svg {
  width: 14px;
  height: 14px;
}

/* ---------- global radio dock ---------- */
.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--statusfooter-h);
  height: var(--dock-h);
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  z-index: 20;
  display: flex;
  flex-direction: column;
}

.dock-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px var(--space-4);
  border-bottom: 1px solid var(--border-soft);
  font-size: 11px;
  color: var(--text-faint);
}

.dock-header strong {
  color: var(--text-dim);
  font-weight: 600;
}

.dock-header-spacer {
  flex: 1;
}

.dock.collapsed {
  height: auto;
}

.dock.collapsed .dock-body {
  display: none;
}

.dock-body {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-5);
  padding: 0 var(--space-4);
  overflow-x: auto;
}

.dock-freq-block {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.dock-freq-display {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  min-width: 12ch;
  text-align: right;
}

.dock-freq-steppers {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dock-freq-steppers button {
  width: 20px;
  height: 15px;
  font-size: 9px;
  line-height: 1;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 3px;
}

.dock-mode-group {
  display: flex;
  gap: 3px;
}

.dock-mode-group button {
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.dock-mode-group button.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.dock-tx-block {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.rx-tx-toggle {
  display: flex;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

.rx-tx-toggle span {
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-faint);
  background: var(--bg-card);
}

.rx-tx-toggle span.rx-on {
  color: var(--good);
  background: var(--good-dim);
}

.rx-tx-toggle span.tx-on {
  color: #fff;
  background: var(--tx);
}

.ptt-btn {
  width: 46px;
  height: 34px;
  background: var(--tx-dim);
  border: 1px solid var(--tx);
  color: var(--tx);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 700;
  font-size: 10px;
}

.ptt-btn.active {
  background: var(--tx);
  color: #fff;
  box-shadow: 0 0 12px var(--tx);
}

.live-audio-btn {
  padding: 4px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 700;
  font-size: 11px;
  font-family: var(--mono);
}

.live-audio-btn.connecting {
  border-color: var(--accent);
  color: var(--accent);
}

.live-audio-btn.active {
  background: rgba(34, 197, 94, 0.15);
  border-color: var(--good);
  color: var(--good);
}

.dock-spectrum {
  flex: 1;
  min-width: 160px;
  height: 46px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-soft);
  background: var(--bg-inset);
}

.dock-spectrum canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.dock-mini {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 10.5px;
  color: var(--text-faint);
  min-width: 70px;
}

.dock-mini strong {
  color: var(--text);
  font-size: 12px;
  font-family: var(--mono);
}

.dock-radio-select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
}

.status-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--statusfooter-h);
  background: var(--bg-inset);
  border-top: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4);
  font-size: 10.5px;
  color: var(--text-faint);
  z-index: 19;
}

.status-footer .status-dot {
  width: 6px;
  height: 6px;
  box-shadow: none;
}

/* ---------- global log panel (slide-out, used on every page) ---------- */
.log-panel {
  position: fixed;
  top: var(--topbar-h);
  right: 0;
  bottom: calc(var(--dock-h) + var(--statusfooter-h));
  width: var(--logpanel-w);
  background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  transform: translateX(100%);
  transition: transform 0.18s ease;
  z-index: 15;
  overflow-y: auto;
  padding: var(--space-4);
}

.log-panel.open {
  transform: translateX(0);
}

.log-panel h3 {
  margin: 0 0 var(--space-4);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
}
