:root {
  --bg: #070b11;
  --panel: #0d1117;
  --panel-raised: #171c23;
  --panel-soft: #23282f;
  --border: #2a3443;
  --border-strong: #394657;
  --text: #edf1f7;
  --muted: #98a7bc;
  --muted-2: #6f7c90;
  --cyan: #26c9f5;
  --cyan-soft: rgba(38, 201, 245, 0.2);
  --green: #54ff78;
  --amber: #f5b458;
  --danger: #ff6b74;
  --purple: #aa78ff;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --radius-lg: 10px;
  --radius-md: 6px;
  --radius-sm: 4px;
  --gutter: 14px;
  --left-fixed: 108px;
  --rail-width: 366px;
  --waterfall-width: 1024px;
  --display-width: 1064px;
  --page-min: 1440px;
  --ref-panel: #1b1e1f;
  --ref-panel-soft: #242626;
  --ref-panel-soft-2: #1e2122;
  --ref-active: #0f3131;
  --ref-active-mode: #173f27;
  --rail-bg: #1f2126;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: var(--page-min);
  background: #05080d;
  overflow-x: auto;
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(26, 98, 126, 0.2), transparent 26%),
    radial-gradient(circle at top right, rgba(81, 59, 126, 0.16), transparent 22%),
    linear-gradient(180deg, #071018 0%, #05080d 56%, #04070c 100%);
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
  overflow-x: auto;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

select {
  background: linear-gradient(180deg, #0c1016, #080b10);
  color: #f5f8fd;
  border: 1px solid rgba(79, 90, 104, 0.58);
  border-radius: 5px;
  padding: 6px 26px 6px 10px;
}

button {
  cursor: pointer;
}

select,
input[type="search"] {
  appearance: none;
  -webkit-appearance: none;
}

.app-shell {
  height: 100vh;
  min-width: var(--page-min);
  width: max(100%, var(--page-min));
  padding: 18px;
  display: grid;
  grid-template-rows: max-content 1fr;
  gap: var(--gutter);
  overflow: hidden;
}

/* ── Audio-unlock banner ────────────────────────────────────────────────── */
.audio-unlock-banner {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9000;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: rgba(8, 11, 16, 0.96);
  border: 1px solid rgba(38, 201, 245, 0.55);
  border-radius: 999px;
  color: var(--text);
  font: 600 0.78rem/1 "Space Grotesk", sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.55);
  cursor: pointer;
  animation: audio-unlock-pulse 1.8s ease-in-out infinite;
}
.audio-unlock-banner[hidden] { display: none; }
.audio-unlock-banner svg {
  width: 18px;
  height: 18px;
  color: var(--cyan);
  flex-shrink: 0;
}
.audio-unlock-banner:hover {
  background: rgba(15, 22, 30, 0.98);
  border-color: rgba(38, 201, 245, 0.85);
}
@keyframes audio-unlock-pulse {
  0%, 100% { box-shadow: 0 10px 26px rgba(0, 0, 0, 0.55), 0 0 0 0 rgba(38, 201, 245, 0.45); }
  50%      { box-shadow: 0 10px 26px rgba(0, 0, 0, 0.55), 0 0 0 10px rgba(38, 201, 245, 0); }
}

/* ── Connection-error toast (Centered) ────────────────────────────────── */
.conn-error-banner {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: rgba(8, 11, 16, 0.97);
  border: 1px solid rgba(255, 80, 80, 0.6);
  border-radius: 10px;
  color: var(--text);
  font: 500 0.82rem/1 "Space Grotesk", sans-serif;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 80, 80, 0.15);
  animation: conn-error-in 0.2s ease;
}
.conn-error-banner[hidden] { display: none; }
.conn-error-banner svg {
  width: 16px;
  height: 16px;
  color: #ff6040;
  flex-shrink: 0;
}
.conn-error-banner #conn-error-msg { color: #e8eaf0; }
.conn-error-dismiss {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 2px;
  margin-left: 8px;
  transition: color 0.15s;
}
.conn-error-dismiss:hover {
  color: #fff;
}
@keyframes conn-error-in {
  from { opacity: 0; transform: translate(-50%, -40%); }
  to   { opacity: 1; transform: translate(-50%, -50%); }
}

/* ── Sessions finder in the topbar ── */
.topbar-sessions {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  min-height: 68px;
  width: 100%;
  min-width: 0;
}
.session-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(180, 190, 205, 0.75);
  width: 100%;
}
.session-search__icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: rgba(180, 190, 205, 0.6);
}
.session-search input[type="search"] {
  background: rgba(255, 255, 255, 0.12);
  color: #e8ecf2;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 6px 10px;
  width: 100%;
  font-size: 0.82rem;
}
.session-search input[type="search"]::placeholder {
  color: rgba(200, 208, 220, 0.5);
}
.session-current {
  display: flex;
  align-items: center;
  gap: 14px;
  font: 400 12px/1 Roboto, sans-serif;
  color: rgba(220, 226, 235, 0.7);
}
.server-finder {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
}
.server-finder-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 80px;
  font-family: 'Roboto', sans-serif;
  font-size: 12px;
  color: rgba(220, 226, 235, 0.7);
}
.status-name {
  display: none;
}
.status-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: rgba(160, 168, 180, 0.5);
  box-shadow: 0 0 0 0 rgba(80, 200, 130, 0);
  transition: background 200ms, box-shadow 200ms;
  flex-shrink: 0;
  margin-left: 4px;
}
.status-dot[data-state="on"] {
  background: rgba(80, 220, 140, 1);
  box-shadow: 0 0 6px rgba(80, 220, 140, 0.7);
}
.session-status__btn {
  flex-shrink: 0;
  padding: 7px 14px;
  background: rgba(80, 200, 130, 0.15);
  color: rgba(140, 230, 180, 0.95);
  border: 1px solid rgba(80, 200, 130, 0.35);
  border-radius: 6px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 100ms;
}
.session-status__btn:hover { background: rgba(80, 200, 130, 0.25); }
.session-status__btn[data-state="streaming"] {
  background: rgba(220, 100, 90, 0.15);
  color: rgba(255, 160, 150, 0.95);
  border-color: rgba(220, 100, 90, 0.35);
}
.session-status__btn[data-state="streaming"]:hover { background: rgba(220, 100, 90, 0.25); }
.server-finder__label {
  font-family: 'Roboto', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(180, 190, 205, 0.7);
}
#server-finder-input {
  flex: 1;
  padding: 8px 10px;
  background: var(--rail-bg);
  border: 0;
  border-radius: 6px;
  color: inherit;
  font-family: 'Roboto', sans-serif;
  font-size: 13px;
  outline: none;
  transition: background 120ms, box-shadow 120ms;
}
#server-finder-input:focus {
  background: rgba(8, 11, 16, 0.92);
  box-shadow: 0 0 0 1px rgba(120, 170, 255, 0.5);
}
#server-finder-input::-webkit-search-cancel-button { filter: invert(0.5); }

.server-finder-dropdown {
  position: absolute;
  left: 80px;
  right: 0;
  top: 100%;
  z-index: 30;
  max-height: 60vh;
  overflow-y: auto;
  background: rgba(8, 11, 16, 0.97);
  border: 1px solid rgba(120, 170, 255, 0.55);
  border-top: 0;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.5);
}
.server-finder-row {
  display: block;
  padding: 9px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: background 80ms;
}
.server-finder-row:last-child { border-bottom: 0; }
.server-finder-row:hover { background: rgba(120, 170, 255, 0.08); }
.server-finder-row__name {
  display: block;
  color: #ffffff;
  font-size: 13px;
  font-weight: 400;
  font-family: 'Roboto', sans-serif;
  line-height: 1.3;
}
.server-finder-row__meta {
  display: block;
  color: rgba(180, 190, 205, 0.7);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  margin-top: 2px;
  word-break: break-all;
}
.server-finder-row__pill {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 6px;
  background: rgba(80, 200, 130, 0.14);
  color: rgba(140, 230, 180, 0.95);
  border-radius: 99px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 400;
}
.server-finder-row__pill--full {
  background: rgba(220, 100, 90, 0.14);
  color: rgba(255, 160, 150, 0.95);
}
.server-finder-row__fullness {
  display: inline-block;
  width: 50px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.08);
  margin-left: 8px;
  vertical-align: middle;
  overflow: hidden;
}
.server-finder-row__fullness span {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--cyan);
  transition: width 200ms;
}
.server-finder-row__snr {
  display: inline-block;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 3px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.5;
}
.server-finder-row__snr--good { background: rgba(84, 255, 120, 0.18); color: #54ff78; }
.server-finder-row__snr--ok   { background: rgba(245, 180, 88, 0.18);  color: #f5b458; }
.server-finder-row__snr--bad  { background: rgba(255, 107, 116, 0.18); color: #ff6b74; }

.app-card,
.topbar-card,
.rail-card,
.context-switcher {
  background: linear-gradient(180deg, rgba(20, 27, 38, 0.96), rgba(12, 17, 25, 0.96));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.topbar-card {
  background: linear-gradient(180deg, rgba(10, 14, 20, 0.98), rgba(7, 10, 15, 0.98));
  border-color: rgba(63, 75, 90, 0.5);
}

.rail-card {
  background: linear-gradient(180deg, rgba(38, 42, 47, 0.96), rgba(31, 35, 40, 0.96));
  border-color: rgba(77, 88, 101, 0.55);
}

.context-switcher {
  background: linear-gradient(180deg, rgba(13, 17, 23, 0.98), rgba(10, 13, 19, 0.98));
}

.topbar {
  display: grid;
  width: 100%;
  min-width: 0;
  max-width: none;
  height: 102px;
  grid-template-columns: max-content 1fr;
  align-items: center;
  align-content: space-around;
  gap: 10px;
}

.topbar__edge,
.freq-card,
.metric-card {
  min-height: 68px;
}

.topbar__edge {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 2px 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  align-items: center;
}

#clock-display {
  margin-left: auto;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: -0.02em;
  color: var(--muted);
  white-space: nowrap;
  cursor: help;
}

.freq-card {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  display: grid;
  align-items: center;
  justify-self: start;
}

.freq-inline {
  display: grid;
  grid-template-columns: 86px max-content 94px;
  gap: 10px;
  align-items: end;
  min-width: 0;
}

.mode-chip {
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid rgba(78, 88, 100, 0.58);
  border-radius: 6px;
  background: #080b10;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: none;
}

.freq-inline__freq,
.inline-step-wrap--band,
.inline-step-wrap--bw,
.inline-step-wrap--step {
  min-width: 0;
  align-self: end;
}

.inline-step-wrap,
.settings-chip__step,
.field,
.mini-control {
  display: grid;
  gap: 4px;
  align-content: end;
}

.inline-step-wrap {
  align-self: end;
  align-content: end;
}

.inline-step-wrap span,
.settings-chip__label,
.field span,
.mini-control span,
.panel-title,
.tool-group h3,
.drawer-group h3 {
  color: var(--muted);
  letter-spacing: 0.05em;
}

.inline-step-wrap span,
.field span,
.mini-control span,
.panel-title {
  text-transform: uppercase;
  font-size: 0.82rem;
  font-weight: 700;
}
#dock-fullwidth {
  display: none;
}

.inline-select,
.field select,
.mini-control select,
.field input[type="search"] {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  padding: 7px 26px 7px 9px;
  color: var(--text);
  background: var(--rail-bg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.select-shell {
  position: relative;
  display: block;
  align-self: end;
}

.select-shell__chevron {
  position: absolute;
  right: 10px;
  top: 50%;
  width: 10px;
  height: 10px;
  transform: translateY(-60%);
  pointer-events: none;
}

.select-shell__chevron::before,
.select-shell__chevron::after {
  content: "";
  position: absolute;
  top: 4px;
  width: 6px;
  height: 1.5px;
  background: rgba(243, 247, 252, 0.92);
  border-radius: 999px;
}

.select-shell__chevron::before {
  left: 0;
  transform: rotate(45deg);
}

.select-shell__chevron::after {
  right: 0;
  transform: rotate(-45deg);
}

.inline-select--band,
.inline-select--bw,
.inline-select--step {
  font-size: 0.72rem;
  min-height: 34px;
  padding: 6px 26px 6px 12px;
  border-radius: 6px;
  border-color: rgba(79, 90, 104, 0.58);
  background: var(--rail-bg);
  color: #f5f8fd;
  box-shadow: none;
}

.inline-select--step {
  color: #f5f8fd;
}

.tuner-group {
  min-width: 0;
  width: max-content;
  height: auto;
  display: grid;
  grid-template-columns: max-content 70px;
  align-items: end;
  gap: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: hidden;
}

.freq-value {
  min-width: 0;
  padding: 0;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 6px;
}

.freq-number {
  font-family: "Roboto", sans-serif;
  font-size: 4.48rem;
  font-weight: 400;
  line-height: 0.88;
  letter-spacing: -0.045em;
  white-space: nowrap;
  color: var(--text);
  background: transparent;
  border: none;
  outline: none;
  padding: 0;
  margin: 0;
  width: 8ch;
  display: inline-block;
  cursor: text;
  text-align: right;
  margin-bottom: -16px;
}

.passband-band {
  transition: left 220ms ease, width 220ms ease, background 220ms ease;
}
.passband-overlay.mode-flash .passband-band {
  animation: pb-mode-flash 600ms ease-out;
}
@keyframes pb-mode-flash {
  0%   {
    background: rgba(var(--pb-rgb), 0.55);
    box-shadow: inset 0 0 0 1px rgba(var(--pb-rgb), 1),
                0 0 22px 6px rgba(var(--pb-rgb), 0.85);
    filter: brightness(1.8);
  }
  100% {
    background: rgba(var(--pb-rgb), 0.18);
    box-shadow: inset 0 0 0 1px rgba(var(--pb-rgb), 0.5),
                0 0 0 0 rgba(var(--pb-rgb), 0);
    filter: brightness(1);
  }
}

.freq-main {
  display: grid;
  gap: 8px;
  padding-left: 2px;
}

.freq-unit-stack {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 4px;
  min-width: 34px;
}

.freq-mode-inline {
  color: var(--green);
  font-family: "Roboto", sans-serif;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1;
}

.freq-unit {
  color: var(--muted);
  font-family: "Roboto", sans-serif;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1;
  display: none;
}

.freq-readout-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.freq-accent {
  display: none;
}

.freq-rocker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 70px;
  min-height: 46px;
  background: linear-gradient(180deg, rgba(28, 33, 39, 0.88), rgba(19, 24, 31, 0.96));
  border: 1px solid rgba(77, 87, 100, 0.56);
  border-radius: 6px;
  justify-self: start;
}

.freq-rocker__btn {
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 700;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: background 0.2s ease, color 0.2s ease;
}

.freq-rocker__btn svg {
  width: 24px;
  height: 24px;
  display: block;
}

.freq-rocker__btn polygon {
  fill: #f3f6fb;
}

.freq-rocker__btn + .freq-rocker__btn {
  border-left: 1px solid rgba(255, 255, 255, 0.05);
}

.freq-rocker__btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.settings-chip {
  min-height: 58px;
  padding: 5px 7px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: rgba(15, 19, 28, 0.86);
  display: grid;
  grid-template-columns: 1fr;
  gap: 3px;
  align-items: center;
}

.settings-chip__readout {
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
}

.settings-chip__value {
  font-size: 0.68rem;
  font-weight: 700;
}

.settings-chip__label {
  font-size: 0.6rem;
}

.metric-card header strong,
.metric-card header span,
.metric-card footer small { font-weight: 400; }
.freq-mode-inline { font-weight: 400; }

.metric-card {
  padding: 10px 14px 8px;
  display: grid;
  gap: 2px;
  background: #06090d;
  border: 1px solid rgba(57, 67, 79, 0.6);
  border-radius: 8px;
  box-shadow: none;
}

.metric-card footer,
.panel-title-row,
.session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.metric-card header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
}

.metric-card header span {
  color: #f2f6fb;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  grid-column: 1;
}

.metric-card header strong {
  font-size: 1.28rem;
  line-height: 1;
  grid-column: 2;
  justify-self: center;
  text-align: center;
}

.meter {
  position: relative;
  height: 15px;
  border-radius: 2px;
  overflow: hidden;
  background: #1f242c;
  margin-bottom: 1px;
}

.meter span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 72%;
}

.meter--snr span {
  width: 0%;
  background:
    linear-gradient(
      90deg,
      #1cff43 0%,
      #4bff29 46%,
      #d9ff25 70%,
      #ffe94a 84%,
      #ffb440 92%,
      #ff1f4f 100%
    );
  -webkit-mask: repeating-linear-gradient(90deg, #000 0 7px, transparent 7px 10px);
  mask: repeating-linear-gradient(90deg, #000 0 7px, transparent 7px 10px);
}

.meter--power span {
  width: 50%;
  background: linear-gradient(90deg, #27c8ff 0%, #3ec8ff 100%);
}

.metric-card footer {
  gap: 8px;
  color: #f1f4f8;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1;
  margin-top: 0;
  padding-top: 1px;
  transform: none;
}

.metric-card--tx-power {
  display: none;
}

.app-shell.mode-transmit .metric-card--snr {
  display: none;
}

.app-shell.mode-transmit .metric-card--tx-power {
  display: grid;
}

.workspace {
  display: grid;
  grid-template-columns: var(--rail-width) 1fr;
  gap: var(--gutter);
  align-items: stretch;
  justify-content: stretch;
  width: 100%;
  min-height: 0;
  height: 100%;
}
.workspace .display-panel { min-height: 0; order: 1; }
.workspace .context-rail  {
  order: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  position: sticky;
  top: 0;
  align-self: stretch;
  background: var(--rail-bg);
  border-radius: 6px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rail-section {
  --accent: var(--cyan);
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  border-left: 3px solid transparent;
  border-radius: 4px;
  overflow: hidden;
  flex: 0 1 auto;
  min-height: 28px;
  position: relative;
  transition: background 120ms, border-left-color 120ms;
}
.rail-section:hover {
  background: rgba(13, 17, 23, 0.55);
}
.rail-section[open] {
  border-left-color: var(--accent);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}
.rail-section:hover[open] {
  border-left-color: var(--accent);
}
.rail-section[open]:not([data-accordion]) { flex: 0 1 auto; }
.rail-section[data-accordion="extra"][open] {
  flex: 1 1 0;
  min-height: 120px;
}
.rail-section[data-accent="cyan"]   { --accent: #26c9f5; }
.rail-section[data-accent="green"]  { --accent: #54ff78; }
.rail-section[data-accent="amber"]  { --accent: #f5b458; }
.rail-section[data-accent="violet"] { --accent: #aa78ff; }
.rail-section[data-accent="blue"]   { --accent: #6aa3ff; }
.rail-section[data-accent="red"]    { --accent: #ff6b74; }

.rail-section__title {
  list-style: none;
  cursor: pointer;
  padding: 8px 10px 8px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font: 600 0.74rem/1 "Space Grotesk", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.7);
  user-select: none;
}
.rail-section[open] > .rail-section__title { color: var(--accent); }
.rail-section__title::-webkit-details-marker { display: none; }
.rail-section__title::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  margin-bottom: 1px;
  transition: transform 160ms ease;
  opacity: 0.55;
}
.rail-section[open] > .rail-section__title::after {
  transform: rotate(225deg);
  margin-bottom: -1px;
  opacity: 0.85;
}
.rail-section__gear {
  position: absolute;
  top: 8px;
  right: 10px;
  cursor: pointer;
  color: #c0c8d4;
  transition: color 150ms;
  z-index: 2;
  line-height: 0;
}
.rail-section__gear:hover { color: #fff; }
.rail-tab[aria-controls="tab-audio"] { display: none; }
.rail-section > .rail-card {
  padding: 8px 10px 10px;
  display: grid;
  gap: 8px;
  background: transparent;
  border-top: 1px solid transparent;
  transition: background 120ms, border-top-color 120ms;
}
.rail-section:hover > .rail-card {
  background: rgba(7, 10, 14, 0.45);
  border-top-color: rgba(255, 255, 255, 0.05);
}
.rail-section[open] > .rail-card {
  min-height: 0;
  max-height: 100%;
  height: 100%;
  overflow-y: auto;
  align-content: start;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}
.rail-section[open] > .rail-card::-webkit-scrollbar         { width: 8px; }
.rail-section[open] > .rail-card::-webkit-scrollbar-track   { background: transparent; }
.rail-section[open] > .rail-card::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.rail-section[open] > .rail-card::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
  background-clip: padding-box;
}

.rail-section .audio-actions,
.rail-section .audio-actions--audio {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 6px;
}
.rail-section .audio-actions .choice-pill {
  flex: 1 1 0;
  min-height: 32px;
  /* padding: 6px 8px;
  font-size: 0.78rem; */
  white-space: nowrap;
  text-align: center;
}

.context-rail .metric-card {
  background: rgba(13, 17, 23, 0.6);
  border-radius: 6px;
  padding: 8px 10px;
  display: grid;
  gap: 4px;
  min-height: 0;
}
.context-rail .metric-card + .metric-card { margin-top: 8px; }
.context-rail .metric-card header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font: 600 0.72rem/1 "Space Grotesk", sans-serif;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
}
.context-rail .metric-card header strong {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.92rem;
  color: var(--text);
  letter-spacing: -0.02em;
}
.context-rail .metric-card .meter {
  width: 100%;
  height: 12px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.context-rail .metric-card .meter span {
  display: block;
  height: 100%;
  width: 0%;
}
.context-rail .metric-card footer {
  display: flex;
  justify-content: space-between;
  gap: 0;
  font: 600 0.58rem/1 "JetBrains Mono", monospace;
  color: var(--muted-2);
  padding-top: 1px;
}
.context-rail .metric-card--tx-power { display: grid; }

.app-shell .topbar,
.app-shell .display-panel,
.app-shell .signal-map,
.app-shell .scale-panel,
.app-shell .display-header,
.app-shell .statusbar {
  width: 100%;
  min-width: 0;
  max-width: none;
  justify-self: stretch;
}
.app-shell .waterfall-stage {
  width: 100%;
  min-width: var(--waterfall-width);
  max-width: none;
  justify-self: stretch;
}
.app-shell .display-panel { grid-template-columns: 1fr; }
.app-shell.is-fullwidth .workspace { grid-template-columns: var(--rail-width) 1fr; }
.app-shell.is-fullwidth .context-rail { display: flex; }

.app-shell.is-locked .waterfall-surface canvas { cursor: not-allowed; }

.display-panel {
  padding: 0;
  width: var(--display-width);
  min-width: var(--display-width);
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  height: 100%;
  min-height: 0;
}

.display-header {
  overflow: visible;
  width: var(--waterfall-width);
  justify-self: center;
  padding-top: 0;
}

.signal-map {
  position: relative;
  height: 156px;
  overflow: visible;
  padding-top: 0;
  background: var(--rail-bg);
  border-radius: 6px;
}

.station-node {
  position: absolute;
  left: var(--x);
  bottom: 0;
  transform: translateX(-50%);
  width: max-content;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #f1f4f7;
}

.station-node::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  width: 2px;
  height: calc(var(--label-bottom) - 18px);
  background: rgba(248, 136, 140, 0.86);
  border-radius: 999px;
}

.station-node::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(248, 136, 140, 0.96);
  box-shadow: 0 0 0 2px rgba(248, 136, 140, 0.14);
}

.station-node--purple::after {
  background: rgba(164, 100, 255, 0.9);
}

.station-node--purple::before {
  background: rgba(164, 100, 255, 0.98);
  box-shadow: 0 0 0 2px rgba(164, 100, 255, 0.14);
}

.station-node--soft::after,
.station-node--soft::before {
  background: rgba(255, 151, 151, 0.96);
  box-shadow: 0 0 0 2px rgba(255, 151, 151, 0.12);
}

.station-stack {
  position: absolute;
  left: 50%;
  bottom: var(--label-bottom);
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  gap: 4px;
}

.station-node--elbow-right .station-stack {
  left: calc(50% + var(--shift, 16px));
}

.station-node--elbow-right .station-stack::before {
  content: "";
  position: absolute;
  right: 100%;
  bottom: -6px;
  width: var(--shift, 16px);
  height: 2px;
  background: rgba(248, 136, 140, 0.86);
  border-radius: 999px;
}

.station-node--purple.station-node--elbow-right .station-stack::before {
  background: rgba(164, 100, 255, 0.9);
}

.station-node--soft.station-node--elbow-right .station-stack::before {
  background: rgba(255, 151, 151, 0.96);
}

.station-card,
.station-sub {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  padding: 2px 10px;
  border-radius: 7px;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
}

.station-card {
  border: 1px solid rgba(255, 128, 128, 0.55);
  background: rgba(14, 16, 19, 0.96);
  color: #ff9b9b;
  box-shadow: inset 0 0 0 1px rgba(255, 128, 128, 0.08);
}

.station-sub {
  border: 0;
  background: rgba(252, 139, 144, 0.96);
  color: #17191d;
  padding-inline: 8px;
}

.station-node--purple .station-card {
  border-color: rgba(214, 219, 227, 0.4);
  color: #f3f6f8;
}

.station-node--purple .station-sub {
  background: rgba(125, 60, 222, 0.96);
  color: #f4f2ff;
}

.station-node--soft .station-sub {
  background: rgba(255, 151, 151, 0.96);
}

.station-node--stack {
  gap: 5px;
}

.station-node--stack .station-sub:first-child {
  margin-bottom: -2px;
}

.station-node[style*="--row: 1"] { --label-bottom: 34px; }
.station-node[style*="--row: 2"] { --label-bottom: 48px; }
.station-node[style*="--row: 3"] { --label-bottom: 62px; }
.station-node[style*="--row: 4"] { --label-bottom: 76px; }
.station-node[style*="--row: 5"] { --label-bottom: 90px; }
.station-node[style*="--row: 6"] { --label-bottom: 104px; }
.station-node[style*="--row: 7"] { --label-bottom: 118px; }
.station-node[style*="--row: 8"] { --label-bottom: 132px; }

.scale-panel {
  position: relative;
  padding: 0 4px 0;
  width: var(--waterfall-width);
  justify-self: center;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.scale-panel__labels,
.scale-panel__ticks {
  display: grid;
  grid-template-columns: repeat(21, minmax(0, 1fr));
  gap: 8px;
}

.scale-panel__labels {
  color: #e8edf5;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.66rem;
  letter-spacing: -0.04em;
}

.scale-panel__labels span {
  text-align: center;
  white-space: nowrap;
}

.scale-panel__labels .scale-marker {
  color: var(--cyan);
  font-weight: 700;
}

.scale-panel__ticks {
  margin-top: 8px;
  align-items: end;
  height: 18px;
}

.scale-panel__ticks::before,
.scale-panel__ticks::after,
.scale-panel__ticks span {
  content: "";
}

.scale-panel__ticks--dense {
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.18) 0,
      rgba(255, 255, 255, 0.18) 1px,
      transparent 1px,
      transparent calc((100% - 20px) / 20)
    );
  background-size: 100% 24px;
  background-position: center bottom;
  background-repeat: no-repeat;
}

.waterfall-stage {
  position: relative;
  width: var(--waterfall-width);
  flex: 1 1 auto;
  min-height: 320px;
  border-radius: 0;
  overflow: visible;
  background: #04080d;
  border: 0;
  justify-self: center;
}

.waterfall-surface {
  position: absolute;
  inset: 0;
  background: #000;
  overflow: hidden;
}

#spectrum-canvas {
  display: none;
  height: 90px;
  width: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  pointer-events: none;
}

.waterfall-stage.spectrum-active #spectrum-canvas {
  display: block;
}

.waterfall-stage.spectrum-active #waterfall-surface {
  top: 90px;
  height: calc(100% - 90px);
}

/* Suppress native image-drag ghost and text-selection overlay on the canvas */
.waterfall-surface canvas {
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.passband-overlay {
  position: absolute;
  inset: -20px 0 0 0;
  pointer-events: none;
  z-index: 1;
  --pb-lo: 49%;
  --pb-hi: 51%;
  --pb-center: 50%;
  --pb-rgb: 38, 201, 245;
  --pb-color: rgb(var(--pb-rgb));
}
.passband-band {
  position: absolute;
  top: 2px;
  bottom: 0;
  left: var(--pb-lo);
  width: calc(var(--pb-hi) - var(--pb-lo));
  background: rgba(var(--pb-rgb), 0.18);
  box-shadow: inset 0 0 0 1px rgba(var(--pb-rgb), 0.5);
  pointer-events: auto;
  cursor: grab;
}
.passband-band:active,
.passband-triangle:active { cursor: grabbing; }
.passband-edge {
  position: absolute;
  top: 2px;
  bottom: 0;
  width: 24px;
  margin-left: -12px;
  pointer-events: auto;
  cursor: ew-resize;
  z-index: 10;
}
.passband-edge::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(var(--pb-rgb), 0.95);
  box-shadow: 0 0 8px rgba(var(--pb-rgb), 0.55);
  transform: translateX(-50%);
  border-radius: 999px;
}
.passband-edge--lo { left: var(--pb-lo); }
.passband-edge--hi { left: var(--pb-hi); }

.passband-overlay--lo-clip .passband-edge--lo::before,
.passband-overlay--hi-clip .passband-edge--hi::before {
  content: '';
  position: absolute;
  top: 12px;
  width: 8px;
  height: 8px;
  border-top: 2px solid var(--pb-color);
  border-right: 2px solid var(--pb-color);
  filter: drop-shadow(0 0 4px rgba(var(--pb-rgb), 0.5));
}
.passband-overlay--lo-clip .passband-edge--lo::before { left: 4px; transform: rotate(-135deg); }
.passband-overlay--hi-clip .passband-edge--hi::before { right: 4px; transform: rotate(45deg); }

.passband-triangle {
  position: absolute;
  top: 2px;
  left: var(--pb-center);
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 18px solid var(--pb-color);
  filter: drop-shadow(0 0 10px rgba(var(--pb-rgb), 0.85));
  pointer-events: auto;
  cursor: grab;
  z-index: 5;
}
.passband-band { min-width: 3px; }
.passband-readout {
  position: absolute;
  top: 22px;
  left: var(--pb-center);
  transform: translateX(-50%);
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(8, 11, 16, 0.86);
  border: 1px solid rgba(var(--pb-rgb), 0.45);
  color: var(--pb-color);
  font: 600 11px/1.1 "JetBrains Mono", monospace;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms ease;
}
.passband-overlay.is-dragging .passband-readout { opacity: 1; }

.wf-crosshair {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(38, 201, 245, 0.5);
  pointer-events: none;
  z-index: 3;
  display: none;
}
.wf-crosshair__label {
  position: absolute;
  top: 2px;
  left: 8px;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(8, 11, 16, 0.85);
  color: var(--cyan);
  font: 600 10px/1.2 "JetBrains Mono", monospace;
  white-space: nowrap;
  pointer-events: none;
}

.waterfall-surface__grid {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(34, 201, 247, 0.06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(34, 201, 247, 0.04) 1px, transparent 1px);
  background-size: 126px 100%, 100% 90px;
  mix-blend-mode: screen;
  opacity: 0.18;
}

.waterfall-surface__lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.waterfall-surface__lines--a {
  background:
    linear-gradient(90deg, transparent 10%, rgba(255, 72, 72, 0.16) 10.2%, transparent 10.7%, transparent 22%, rgba(255, 196, 72, 0.12) 22.2%, transparent 22.7%, transparent 49%, rgba(96, 241, 255, 0.12) 49.2%, transparent 49.8%, transparent);
}

.waterfall-surface__lines--b {
  background:
    linear-gradient(90deg, transparent 60%, rgba(80, 255, 134, 0.1) 60.2%, transparent 60.7%, transparent 76%, rgba(255, 83, 83, 0.12) 76.2%, transparent 76.7%, transparent);
}

.waterfall-surface__lines--c {
  background:
    radial-gradient(circle at 40% 36%, rgba(48, 198, 245, 0.16), transparent 14%),
    radial-gradient(circle at 77% 18%, rgba(74, 240, 180, 0.12), transparent 18%);
  mix-blend-mode: screen;
}

.display-drawer-wrap {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;
  width: min(286px, calc(100% - 28px));
  display: grid;
  gap: 0;
}

.display-drawer-wrap.is-collapsed .display-drawer,
.display-drawer-wrap.is-collapsed .panel-title-row--drawer {
  display: none;
}

.panel-title-row {
  gap: 10px;
  margin-bottom: 2px;
}

.panel-title-row--drawer {
  padding: 10px 12px 4px;
  background: var(--ref-panel);
  border-radius: 10px 10px 0 0;
  justify-content: flex-end;
}

.section-action,
.results-pill,
.drawer-pill,
.drawer-expand,
.choice-pill,
.tool-btn,
.dock-btn {
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  background: rgba(49, 53, 58, 0.98);
  color: var(--text);
}

.section-action,
.results-pill {
  padding: 5px 8px;
  font-size: 0.78rem;
}

.section-action,
.results-pill {
  background: rgba(12, 16, 22, 0.98);
}

.display-drawer {
  padding: 8px 12px 12px;
  border-radius: 0 0 10px 10px;
  background: var(--ref-panel);
  border: 0;
  display: grid;
  gap: 8px;
}

.display-drawer .mini-control select,
.display-drawer .field select,
.display-drawer .field input[type="search"] {
  border: 0;
  background: linear-gradient(180deg, var(--ref-panel-soft), var(--ref-panel-soft-2));
  color: #f1f4f6;
  box-shadow: none;
  min-height: 28px;
  padding: 4px 20px 4px 7px;
  font-size: 0.72rem;
  border-radius: 5px;
}

.display-drawer .drawer-pill,
.display-drawer .drawer-expand {
  border: 0;
  background: linear-gradient(180deg, var(--ref-panel-soft), var(--ref-panel-soft-2));
  color: #f1f4f6;
  box-shadow: none;
  min-height: 28px;
  padding: 5px 6px;
  font-size: 0.72rem;
}

.display-drawer .drawer-pill--active {
  background: var(--ref-active);
  color: #17d9ff;
}

.display-drawer .drawer-group h3,
.panel-title-row--drawer .panel-title {
  color: #f1f3f5;
}

.panel-title-row--drawer .panel-title {
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}

.drawer-close {
  min-height: 28px;
  padding: 5px 10px;
  border: 0;
  border-radius: 5px;
  background: linear-gradient(180deg, var(--ref-panel-soft), var(--ref-panel-soft-2));
  color: #f1f4f6;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.display-drawer .mini-control span,
.display-drawer .drawer-group h3 {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.range-stack {
  display: grid;
  gap: 4px;
  align-content: end;
}

.range-stack strong {
  color: var(--cyan);
  font-size: 0.78rem;
  font-weight: 600;
}

.mini-control.is-disabled span,
.mini-control.is-disabled strong {
  color: rgba(190, 198, 210, 0.48);
}

.range-stack input[type="range"],
.audio-range {
  --range-pct: 50%;
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  height: 6px;
  border: 0;
  border-radius: 999px;
  background:
    linear-gradient(90deg, var(--cyan) 0 var(--range-pct), #3b4045 var(--range-pct) 100%);
  outline: none;
}

.mini-control.is-disabled .range-stack input[type="range"],
.mini-control.is-disabled .audio-range {
  background:
    linear-gradient(90deg, rgba(124, 132, 142, 0.45) 0 var(--range-pct), #34383d var(--range-pct) 100%);
}

.range-stack input[type="range"]::-webkit-slider-runnable-track,
.audio-range::-webkit-slider-runnable-track {
  height: 6px;
  border: 0;
  border-radius: 999px;
  background: transparent;
}

.range-stack input[type="range"]::-webkit-slider-thumb,
.audio-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -4px;
  border: 0;
  border-radius: 50%;
  background: #eef1f4;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}

.mini-control.is-disabled .range-stack input[type="range"]::-webkit-slider-thumb,
.mini-control.is-disabled .audio-range::-webkit-slider-thumb {
  background: rgba(214, 220, 227, 0.72);
}

.range-stack input[type="range"]::-moz-range-track,
.audio-range::-moz-range-track {
  height: 6px;
  border: 0;
  border-radius: 999px;
  background: #3b4045;
}

.range-stack input[type="range"]::-moz-range-progress,
.audio-range::-moz-range-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--cyan);
}

.mini-control.is-disabled .range-stack input[type="range"]::-moz-range-progress,
.mini-control.is-disabled .audio-range::-moz-range-progress {
  background: rgba(124, 132, 142, 0.45);
}

.range-stack input[type="range"]::-moz-range-thumb,
.audio-range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: #eef1f4;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}

.mini-control.is-disabled .range-stack input[type="range"]::-moz-range-thumb,
.mini-control.is-disabled .audio-range::-moz-range-thumb {
  background: rgba(214, 220, 227, 0.72);
}

.drawer-summary,
.drawer-grid {
  display: grid;
  gap: 8px;
  align-items: end;
}

.stepper {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  gap: 8px;
  align-items: center;
}

.stepper button,
.dock-btn {
  height: 40px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.stepper strong {
  text-align: center;
  color: var(--cyan);
  font-size: 0.96rem;
}

.drawer-group {
  display: grid;
  gap: 6px;
}

.drawer-group h3,
.tool-group h3 {
  margin: 0;
  font-size: 0.74rem;
  text-transform: uppercase;
}

.drawer-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.drawer-pill,
.drawer-expand,
.choice-pill,
.tool-btn {
  padding: 6px 8px;
}

.drawer-pill--active,
.choice-pill.is-active,
.context-tab.is-active {
  color: var(--green);
  border-color: rgba(84, 255, 120, 0.28);
  box-shadow: inset 0 0 0 1px rgba(84, 255, 120, 0.06);
}

.drawer-expand {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-advanced {
  display: none;
}

.drawer-advanced.is-open {
  display: grid;
  gap: 12px;
}

.bottom-dock {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  gap: 6px;
  padding: 6px;
  border-radius: 12px;
  background: rgba(14, 18, 26, 0.88);
  border: 1px solid var(--border-strong);
  backdrop-filter: blur(10px);
}

.dock-btn {
  min-width: 38px;
  padding-inline: 8px;
  font-size: 0.92rem;
  line-height: 1;
  display: grid;
  place-items: center;
}

.dock-btn--active,
.dock-btn.is-active {
  color: #f2d478;
  box-shadow: inset 0 0 0 1px rgba(242, 212, 120, 0.18);
}

.bottom-dock .dock-btn {
  min-width: 42px;
  font-size: 1.48rem;
}

.dock-btn--session {
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 10px;
  color: #0a0e14;
  background: var(--green);
  box-shadow: 0 0 0 1px rgba(84, 255, 120, 0.3), 0 0 14px rgba(84, 255, 120, 0.25);
  transition: background 120ms, box-shadow 120ms, transform 80ms;
}
.dock-btn--session[data-state="running"] {
  background: var(--danger);
  color: #1a0507;
  box-shadow: 0 0 0 1px rgba(255, 107, 116, 0.32), 0 0 14px rgba(255, 107, 116, 0.3);
}
.dock-btn--session:hover { transform: translateY(-1px); }
.dock-btn--session:active { transform: translateY(0); }
.dock-btn--session.is-active { box-shadow: 0 0 0 1px rgba(84, 255, 120, 0.3), 0 0 14px rgba(84, 255, 120, 0.25); color: #0a0e14; }
.dock-btn--session[data-state="running"].is-active { box-shadow: 0 0 0 1px rgba(255, 107, 116, 0.32), 0 0 14px rgba(255, 107, 116, 0.3); color: #1a0507; }

.dock-icon { width: 22px; height: 22px; fill: currentColor; }
.dock-btn--session .dock-icon--stop { display: none; }
.dock-btn--session[data-state="running"] .dock-icon--play { display: none; }
.dock-btn--session[data-state="running"] .dock-icon--stop { display: block; }

.bottom-dock .dock-btn:nth-child(-n + 3) {
  min-width: 46px;
  font-size: 1.96rem;
}

.bottom-dock .dock-btn--gear {
  min-width: 42px;
  padding: 0;
}

.bottom-dock .dock-btn--gear svg {
  width: 24px;
  height: 24px;
}

.bottom-dock .dock-btn--gear path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dock-btn--lock {
  display: grid;
  place-items: center;
  padding: 0;
}

.dock-btn--lock svg {
  width: 16px;
  height: 16px;
  overflow: visible;
}

.dock-btn--lock path,
.dock-btn--lock rect {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.statusbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  color: var(--muted);
  font-size: 0.68rem;
  width: var(--waterfall-width);
  justify-self: center;
}
#status-zoom { color: var(--cyan); font-weight: 600; }

.context-rail {
  display: grid;
  gap: 10px;
  min-width: 0;
  width: var(--rail-width);
}

.context-switcher {
  padding: 5px;
  display: grid;
  grid-template-columns: max-content max-content 1fr 1fr;
  gap: 2px 4px;
  align-items: center;
}

.context-tab {
  border: 0;
  border-radius: 6px;
  padding: 8px 10px;
  background: transparent;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.context-tab.is-active {
  background: rgba(38, 201, 245, 0.18);
  color: var(--text);
}

.context-view {
  display: none;
  gap: 12px;
}

.context-view.is-active {
  display: grid;
}

.panel-block {
  display: grid;
  gap: 6px;
  padding: 10px;
  border-radius: 10px;
  background: var(--ref-panel);
  border: 0;
}

.panel-block--grow,
.rail-card--grow {
  min-height: 100%;
}

.rail-card {
  padding: 0;
  display: grid;
  gap: 8px;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.choice-pills,
.tools-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  align-items: end;
}

.choice-pills--mode {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
}

.choice-pills--filter {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.choice-pill,
.tool-btn,
.drawer-pill,
.drawer-expand {
  min-height: 28px;
  min-width: 0;
  border: 0;
  font-size: 0.78rem;
  background: linear-gradient(180deg, var(--ref-panel-soft), var(--ref-panel-soft-2));
  color: #f1f4f6;
  box-shadow: none;
  align-self: end;
}

.choice-pills--mode .choice-pill {
  min-height: 28px;
  padding: 4px 3px;
  font-size: 0.7rem;
  white-space: nowrap;
}

.choice-pills--filter .choice-pill {
  min-height: 28px;
  padding: 4px 6px;
  font-size: 0.72rem;
  white-space: nowrap;
}

.panel-title {
  color: #f1f3f5;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}

.section-action {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: transparent;
  font-size: 0;
  position: relative;
}

.section-action::before {
  content: "⚙";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #f6f7f8;
  font-size: 1.75rem;
  line-height: 1;
}

.choice-pill.is-active {
  background: var(--ref-active);
  color: #17d9ff;
  border-color: transparent;
  box-shadow: none;
}

.choice-pill.is-disabled {
  background: linear-gradient(180deg, rgba(42, 45, 48, 0.86), rgba(34, 37, 40, 0.86));
  color: rgba(190, 198, 210, 0.48);
  border-color: transparent;
  box-shadow: none;
  pointer-events: none;
}

.choice-pills--mode .choice-pill.is-active {
  background: rgba(84, 255, 120, 0.18);
  color: #62ff83;
  box-shadow: inset 0 0 0 1px rgba(84, 255, 120, 0.55);
  font-weight: 700;
}

.field input[type="search"] {
  padding-right: 18px;
  background-image: none;
}

.range-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}

.range-row span {
  font-size: 0.68rem;
}

.range-row strong {
  font-size: 0.68rem;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--cyan);
}

.range-row--audio {
  grid-template-columns: auto 1fr auto;
  gap: 10px;
}

.audio-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  align-items: end;
}

.audio-actions--record {
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.audio-actions--secondary,
.audio-actions--tertiary {
  margin-top: 0;
}

.audio-actions--audio {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.audio-actions .choice-pill {
  min-height: 28px;
  padding: 4px 6px;
  font-size: 0.74rem;
  white-space: nowrap;
}

.record-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 30px;
  padding-inline: 6px;
  color: #ff9d9d;
  background: linear-gradient(180deg, rgba(42, 28, 28, 0.96), rgba(33, 25, 25, 0.98));
  align-self: stretch;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  width: 70%;
}

.record-toggle.is-active {
  color: #ffe1e1;
  background: linear-gradient(180deg, rgba(118, 28, 28, 0.98), rgba(88, 20, 20, 1));
}

.record-toggle__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ff6666;
  box-shadow: 0 0 0 2px rgba(255, 102, 102, 0.12);
}

.record-toggle__label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.record-format {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  align-self: stretch;
}

.choice-pill--record {
  align-self: stretch;
  min-height: 28px;
  padding: 3px 4px;
  font-size: 0.68rem;
  color: #d9e6f2;
  background: linear-gradient(180deg, rgba(38, 39, 40, 0.98), rgba(31, 33, 34, 0.98));
}

.choice-pill--record.is-active {
  background: linear-gradient(180deg, rgba(24, 76, 91, 0.98), rgba(16, 58, 69, 1));
  color: #72eeff;
}

.audio-extra-panel {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.rec-note {
  font-size: 0.68rem;
  color: #8899aa;
  line-height: 1.4;
}

.rec-heading {
  font-size: 0.72rem;
  color: #aabbcc;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.rec-history {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.rec-entry {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 6px;
  padding: 5px 6px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 4px;
  font-size: 0.68rem;
  line-height: 1.4;
}

.rec-entry--empty {
  font-size: 0.68rem;
  color: #667788;
  display: block;
  padding: 4px 6px;
}

.rec-entry__name {
  font-weight: 600;
  color: #ddeeff;
}

.rec-entry__addr,
.rec-entry__time,
.rec-entry__freq {
  color: #8899aa;
}

.rec-entry__actions {
  display: flex;
  gap: 4px;
  align-items: center;
  grid-column: 2;
  grid-row: 1 / 5;
}

.rec-entry__dl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.65rem;
  font-weight: 700;
  color: #72eeff;
  background: rgba(24, 76, 91, 0.6);
  cursor: pointer;
  text-decoration: none;
}

.rec-entry__dl:hover {
  background: rgba(24, 76, 91, 0.9);
}

.rec-entry__del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 3px;
  font-size: 0.7rem;
  color: #ff6b6b;
  background: rgba(80, 30, 30, 0.5);
  cursor: pointer;
}

.rec-entry__del:hover {
  background: rgba(120, 40, 40, 0.8);
}

.audio-extra-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
  margin-top: 10px;
  align-items: end;
}

.audio-extra-grid--3col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.rail-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.rail-pair .rail-section[open] {
  flex: 1 1 0;
}

.audio-extra-group {
  display: grid;
  gap: 8px;
}

.audio-extra-grid--agc {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mini-control-title {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #aeb9cb;
}

.audio-extra-panel .mini-control span {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.choice-pill--icon {
  display: grid;
  place-items: center;
  padding: 0;
}

.choice-pill--icon svg {
  width: 18px;
  height: 18px;
  overflow: visible;
}

.audio-icon .mute-icon--off {
  display: none;
}

.audio-icon.is-active .mute-icon--on {
  display: none;
}

.audio-icon.is-active .mute-icon--off {
  display: block;
}

.choice-pill--icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.choice-pill--icon path:first-child {
  fill: currentColor;
  stroke: currentColor;
}

.choice-pill--icon circle {
  fill: currentColor;
}

.audio-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
}

.audio-icon--button {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #f1f4f8;
  cursor: pointer;
}

.audio-icon svg {
  width: 20px;
  height: 20px;
  overflow: visible;
}

.audio-icon path {
  fill: none;
  stroke: #f1f4f8;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.audio-icon path:first-child {
  fill: #f1f4f8;
  stroke: #f1f4f8;
}

.session-list {
  display: grid;
  gap: 10px;
}

.session-item {
  gap: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.session-item strong {
  display: block;
  margin-bottom: 4px;
}

.session-item p {
  margin: 0;
  color: var(--muted);
}

.session-item span {
  color: var(--cyan);
  font-weight: 700;
}

.tools-grid--wide .tool-btn {
  flex: 1 1 calc(50% - 12px);
}

.settings-panel {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 5;
  width: min(320px, calc(100% - 28px));
  max-height: calc(100% - 92px);
  display: flex;
  flex-direction: column;
  background: rgba(14, 18, 26, 0.95);
  border: 1px solid rgba(63, 75, 90, 0.7);
  border-radius: 10px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  color: var(--text);
}
.settings-panel[hidden] { display: none; }

.settings-panel__head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.settings-panel__title {
  margin: 0;
  font: 700 0.78rem/1 "Space Grotesk", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text);
}
.settings-panel__close {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: rgba(220, 226, 235, 0.7);
  cursor: pointer;
  transition: background 120ms, color 120ms;
}
.settings-panel__close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.settings-panel__close svg { width: 16px; height: 16px; }

.settings-panel__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}
.settings-panel__body::-webkit-scrollbar         { width: 8px; }
.settings-panel__body::-webkit-scrollbar-track   { background: transparent; }
.settings-panel__body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.settings-group__title {
  margin: 0 0 2px;
  font: 600 0.66rem/1 "Space Grotesk", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.setting-row {
  display: grid;
  grid-template-columns: 84px 1fr 56px;
  align-items: center;
  gap: 10px;
  font: 400 0.78rem/1.1 Roboto, sans-serif;
}
.setting-row__label { color: rgba(220, 226, 235, 0.85); }
.setting-row__value {
  font: 600 0.72rem/1 "JetBrains Mono", monospace;
  text-align: right;
  color: var(--cyan);
}
.setting-row > select,
.setting-row__select {
  width: 100%;
  padding: 6px 26px 6px 10px;
  color: inherit;
  border-radius: 6px;
  font-size: 0.78rem;
}
.setting-row > select:focus,
.setting-row__select:focus {
  outline: none;
  border-color: rgba(38, 201, 245, 0.55);
}
.setting-row > input[type="range"] {
  width: 100%;
}
.setting-row:has(select) { grid-template-columns: 84px 1fr; }
.setting-row:has(select) .setting-row__value { display: none; }

.setting-btn {
  align-self: flex-start;
  padding: 7px 12px;
  background: rgba(8, 11, 16, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  color: var(--text);
  font: 600 0.74rem/1 "Space Grotesk", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 120ms, border-color 120ms, color 120ms;
}
.setting-btn:hover { background: rgba(255, 255, 255, 0.06); }
.setting-btn.is-active {
  background: rgba(38, 201, 245, 0.15);
  border-color: rgba(38, 201, 245, 0.55);
  color: var(--cyan);
}

.check-row {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 6px 2px;
  font: 400 0.78rem/1.1 Roboto, sans-serif;
  color: rgba(220, 226, 235, 0.9);
  cursor: pointer;
  user-select: none;
}
.check-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  background: rgba(8, 11, 16, 0.7);
  cursor: pointer;
  display: grid;
  place-content: center;
  transition: background 120ms, border-color 120ms;
}
.check-row input[type="checkbox"]::before {
  content: "";
  width: 8px;
  height: 8px;
  transform: scale(0);
  transition: transform 120ms;
  background: var(--cyan);
  border-radius: 2px;
}
.check-row input[type="checkbox"]:checked {
  border-color: rgba(38, 201, 245, 0.65);
  background: rgba(38, 201, 245, 0.12);
}
.check-row input[type="checkbox"]:checked::before { transform: scale(1); }
.check-row__state {
  font: 600 0.66rem/1 "Space Grotesk", sans-serif;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.35);
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  min-width: 32px;
  text-align: center;
}
.check-row:has(input:checked) .check-row__state {
  color: var(--cyan);
  border-color: rgba(38, 201, 245, 0.45);
  background: rgba(38, 201, 245, 0.08);
}

.rail-section--link {
  width: 100%;
  background: rgba(13, 17, 23, 0.55);
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  padding: 0;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
}

.rail-tabs {
  display: none;
}

.rail-tab {
  min-height: 28px;
  min-width: 0;
  border: 0;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--ref-panel-soft), var(--ref-panel-soft-2));
  color: #f1f4f6;
  font: 600 0.7rem/1 "Space Grotesk", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  box-shadow: none;
  padding: 6px 4px;
  transition: background 120ms ease, color 120ms ease;
}

.rail-tab:hover {
  background: linear-gradient(180deg, rgba(42, 48, 58, 0.95), rgba(34, 40, 50, 0.95));
  color: #fff;
}

.rail-tab.is-active {
  background: var(--ref-active);
  color: #17d9ff;
  box-shadow: inset 0 0 0 1px rgba(38, 201, 245, 0.35);
  font-weight: 700;
}

.tab-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 4px;
}
.tab-header__back {
  position: absolute;
  left: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: rgba(220, 226, 235, 0.7);
  cursor: pointer;
  padding: 2px;
  line-height: 0;
  transition: color 120ms;
}
.tab-header__back:hover { color: #fff; }
.tab-header__back svg {
  display: block;
}
.tab-header__title {
  font: 600 0.78rem/1 "Space Grotesk", sans-serif;
  color: rgba(220, 226, 235, 0.9);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.context-rail.flash {
  animation: railFlash 0.45s ease 2;
}
@keyframes railFlash {
  0%, 100% { outline: 1px solid transparent; background: transparent; }
  50% { outline: 1px solid var(--accent, rgba(180, 190, 205, 0.3)); background: rgba(180, 190, 205, 0.06); }
}
.rail-tab-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex: 1 1 0;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.rail-tab-panel[hidden] {
  display: none;
}

.rail-tab-panel .rail-section[open] {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
}

.rail-tab-panel .rail-section[open] > .rail-card {
  height: auto;
  max-height: none;
  overflow-y: visible;
}

.rail-tab-panel .rail-section > summary {
  pointer-events: none;
  cursor: default;
}

.rail-tab-panel .rail-section > summary::after {
  display: none;
}

/* ─── Hover states on controls ──────────────────────────────────────────────── */
.mini-control select:hover,
.field select:hover {
  background: linear-gradient(180deg, #151a22, #0f131b);
  border-color: rgba(100, 115, 135, 0.7);
}

.rail-tab-panel .choice-pill:hover {
  background: linear-gradient(180deg, rgba(55, 62, 72, 0.98), rgba(45, 52, 62, 0.98));
}

.rail-tab-panel .choice-pill--record:hover {
  background: linear-gradient(180deg, rgba(50, 55, 60, 0.98), rgba(42, 47, 52, 0.98));
}

.record-toggle:hover {
  background: linear-gradient(180deg, rgba(55, 35, 35, 0.98), rgba(44, 30, 30, 0.98));
}

.check-row:hover {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 3px;
}

/* ─── Viewport width warning ─────────────────────────────────────────────────── */
#viewport-warning {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #0b0e14;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  text-align: center;
}
#viewport-warning strong {
  font: 700 1.1rem/1.4 'Space Grotesk', sans-serif;
  color: #dde6f0;
}
#viewport-warning p {
  font: 400 0.85rem/1.5 'Space Grotesk', sans-serif;
  color: #8899aa;
  max-width: 360px;
  margin: 0;
}

@media (max-width: 1439px) {
  #viewport-warning { display: flex !important; }
  body > *:not(#viewport-warning) { display: none !important; }
}

/* ─── Keyboard focus indicators ───────────────────────────────────────────
   Several controls strip the default outline for pointer use. Restore a
   visible ring for keyboard navigation only (:focus-visible) so mouse clicks
   stay clean while keyboard users can see where focus is. */
button:focus-visible,
select:focus-visible,
.rail-tab:focus-visible,
.dock-btn:focus-visible,
.choice-pill:focus-visible,
.range-stack input[type="range"]:focus-visible,
.audio-range:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.freq-number:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--cyan-soft);
}