/* OpenCB Radio — responsive app shell
   Desktop (≥1024px): radio-first column; optional map dock (data-map-open)
   Mobile  (<1024px): tabbed stage + fixed PTT / status / tab bar
   Safari: 100dvh, safe-area-inset (env+constant), -webkit-fill-available,
           overscroll lock, visualViewport-friendly bottom chrome
*/

:root {
  --app-header-h: 44px;
  --app-radio-width: 412px;
  /* Desktop map-closed solo column (faceplate + PTT); map-open still uses --app-radio-width */
  --app-radio-solo-max: 880px;
  --app-ptt-h: 56px;
  --app-status-h: 28px;
  --app-tabbar-h: 52px;
  --app-touch-min: 44px; /* Apple HIG minimum touch target */
  --app-shell-gap: 0px;
  --app-neon-cyan: #00e5ff;
  --app-neon-orange: #ff8a3d;
  --app-neon-green: var(--cb-vintage-green, #00ff9d);
  --app-chrome-bg: #0b0e13;
  --app-chrome-border: #252a33;
  --app-shell-bg: var(--bg-page, #0f1115);
  /* Older iOS used constant(); modern Safari uses env() — declare both */
  --safe-top: constant(safe-area-inset-top, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: constant(safe-area-inset-right, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: constant(safe-area-inset-bottom, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: constant(safe-area-inset-left, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

/* Shell owns viewport insets; neutralize body padding when shell is present.
   Prefer .opencb-shell-page (set in HTML) so Android WebViews without :has() still lock. */
html.opencb-shell-page,
html:has(.app-shell) {
  height: 100%;
  height: -webkit-fill-available; /* Safari / older WebKit pre-dvh fallback */
  overflow: hidden;
  overscroll-behavior: none;
  /* Prefer clip when supported — avoids scroll chaining to browser chrome */
  overflow: clip;
}

body.opencb-shell-page,
body:has(.app-shell) {
  margin: 0;
  padding: 0; /* neutralize styles.css safe-area body padding — shell chrome owns insets */
  height: 100%;
  height: -webkit-fill-available;
  overflow: hidden;
  overflow: clip;
  background: var(--app-shell-bg);
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* Prevent iOS bounce scrolling the document behind the shell */
  position: relative;
  width: 100%;
  touch-action: manipulation;
}

.app-shell {
  box-sizing: border-box;
  display: grid;
  position: relative;
  width: 100%;
  /* Mobile-first default; desktop overrides at ≥1024px */
  grid-template-areas:
    "header"
    "stage"
    "ptt"
    "status"
    "tabs";
  grid-template-columns: 1fr;
  grid-template-rows:
    calc(var(--app-header-h) + var(--safe-top))
    minmax(0, 1fr)
    auto
    var(--app-status-h)
    calc(var(--app-tabbar-h) + var(--safe-bottom));
  /* Fallbacks: % → vh → svh (stable) → dvh → visualViewport (--app-vv-height) */
  height: 100%;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  height: var(--app-vv-height, 100dvh);
  min-height: -webkit-fill-available;
  max-height: 100%;
  max-height: 100vh;
  max-height: 100svh;
  max-height: 100dvh;
  max-height: var(--app-vv-height, 100dvh);
  overflow: hidden;
  background: var(--app-shell-bg);
  color: var(--text-primary, #e7e9ee);
  padding: 0;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Allow text selection inside inputs / settings / station rows */
.app-shell input,
.app-shell textarea,
.app-shell select,
.app-shell .cb-settings-content,
.app-shell .cb-station-monitor__list,
.app-shell .app-panel__body {
  -webkit-user-select: text;
  user-select: text;
}

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

/* -------------------------------------------------------------------------- */
/* Header — logo + TX/RX/WATCH/WARN + LINK                                     */
/* -------------------------------------------------------------------------- */

.app-header {
  grid-area: header;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: calc(var(--app-header-h) + var(--safe-top));
  height: calc(var(--app-header-h) + var(--safe-top));
  padding:
    var(--safe-top)
    max(10px, var(--safe-right))
    0
    max(10px, var(--safe-left));
  background: linear-gradient(180deg, #141922 0%, var(--app-chrome-bg) 100%);
  border-bottom: 1px solid var(--app-chrome-border);
  z-index: 30;
}

.app-header__brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.app-header__name {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--app-neon-cyan);
  text-shadow: 0 0 12px rgba(0, 229, 255, 0.35);
}

.app-header__model {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--text-tertiary, #8f97a6);
}

.app-header__lamps.cb-lamps {
  grid-area: unset;
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 0;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.app-header__lamps.cb-lamps::-webkit-scrollbar {
  display: none;
}

.app-header__lamps .cb-lamp {
  gap: 2px;
  flex: 0 0 auto;
}

.app-header__lamps .cb-lamp__glow {
  width: 10px;
  height: 10px;
}

.app-header__lamps .cb-lamp__label {
  font-size: 8px;
  letter-spacing: 0.06em;
}

.app-header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.app-header .cb-link-pill {
  margin: 0;
  font-size: 10px;
  padding: 4px 8px;
  max-width: min(28vw, 160px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-header__settings,
.app-header__map-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--app-touch-min);
  min-width: var(--app-touch-min);
  padding: 6px 10px;
  border: 1px solid rgba(0, 229, 255, 0.28);
  border-radius: 8px;
  background: rgba(0, 229, 255, 0.06);
  color: var(--text-primary, #e7e9ee);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation; /* kill 300ms tap delay on older WebKit */
}

/* Desktop-only map dock control; compact layouts keep the Map tab */
.app-header__map-toggle {
  display: none;
}

.app-header__settings:hover,
.app-header__settings[aria-expanded="true"],
.app-header__map-toggle:hover,
.app-header__map-toggle[aria-pressed="true"] {
  border-color: rgba(0, 229, 255, 0.55);
  background: rgba(0, 229, 255, 0.14);
  box-shadow: 0 0 14px rgba(0, 229, 255, 0.18);
}

.app-header__settings-label,
.app-header__map-toggle-label {
  display: none;
}

/* -------------------------------------------------------------------------- */
/* Stage / panels                                                              */
/* -------------------------------------------------------------------------- */

.app-stage {
  grid-area: stage;
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #080a0e;
}

.app-panel {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--app-shell-bg);
  overscroll-behavior: contain;
}

.app-shell[data-active-tab="radio"] .app-panel--radio,
.app-shell[data-active-tab="map"] .app-panel--map,
.app-shell[data-active-tab="stations"] .app-panel--stations {
  display: flex;
}

.app-panel__header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--app-chrome-border);
  background: rgba(20, 25, 34, 0.92);
}

.app-panel__title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--app-neon-green);
}

.app-panel__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 12px;
}

.app-panel__placeholder {
  margin: 24px auto;
  max-width: 28rem;
  text-align: center;
  color: var(--text-secondary, #aab0bd);
  line-height: 1.45;
}

.app-panel__placeholder-hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-tertiary, #8f97a6);
}

/* Radio faceplate fills its panel — dense column, stations scroll inside */
.app-panel--radio {
  background: transparent;
  min-height: 0;
}

.app-panel--radio .cb-faceplate {
  --fp-pad: 12px;
  --fp-gap: 12px;
  max-width: none;
  width: 100%;
  height: 100%;
  margin: 0;
  border-radius: 0;
  border-left: none;
  border-right: none;
  padding: var(--fp-pad);
  gap: var(--fp-gap);
  overflow: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows:
    minmax(0, 1fr)
    auto
    auto;
  grid-template-areas:
    "channel"
    "meter"
    "knobs";
}

/* Shell header owns brand + lamps — hide faceplate duplicates */
.app-panel--radio .cb-brand,
.app-panel--radio .cb-speaker-grille {
  display: none !important;
}

/* PTT / ticker / settings toggle live in shell chrome now */
.app-panel--radio .cb-ptt-section,
.app-panel--radio .cb-ticker,
.app-panel--radio .cb-settings-toggle {
  display: none !important;
}

.app-panel--radio .cb-channel-section {
  min-height: 0;
  height: 100%;
  gap: 12px;
  overflow: hidden;
}

.app-panel--radio .cb-presets {
  gap: 8px;
  flex-wrap: nowrap;
  margin-bottom: 2px;
}

.app-panel--radio .cb-preset-btn {
  min-width: 0;
  flex: 1 1 0;
  padding: 10px 6px;
  gap: 4px;
}

.app-panel--radio .cb-preset-btn__ch {
  font-size: 17px;
}

.app-panel--radio .cb-preset-btn__label {
  letter-spacing: 0.04em;
}

.app-panel--radio .cb-channel-display {
  flex: 1 1 auto;
  min-height: 0;
  padding: 14px 14px 12px;
  gap: 10px;
  overflow: hidden;
}

.app-panel--radio .cb-channel-display__controls {
  gap: 12px;
}

.app-panel--radio .cb-channel-step {
  padding: 12px 14px;
  font-size: 18px;
}

/* Keep channel digits prominent inside ~400–420px */
.app-panel--radio .cb-channel-display__digits {
  font-size: 56px;
  min-width: 76px;
  letter-spacing: 3px;
}

.app-panel--radio .cb-channel-display__info {
  margin: 2px 0 0;
  gap: 6px;
}

.app-panel--radio .cb-channel-display__name {
  line-height: 1.25;
}

.app-panel--radio .cb-monitor-window {
  flex: 1 1 auto;
  min-height: 72px;
  margin-top: 4px;
  overflow: hidden;
}

.app-panel--radio .cb-faceplate[data-monitor-state="empty"] .cb-monitor-window {
  min-height: 56px;
  /*
   * `flex: 0 1 auto` let the empty state shrink below its content height, and
   * .cb-monitor-window clips with overflow:hidden — so the second line
   * ("No nearby stations yet" / "Auto-listening will resume on CH 19") was cut
   * in half. Keep 56px as a floor, never a ceiling.
   */
  flex: 0 0 auto;
}

.app-panel--radio .cb-empty-state {
  padding: 8px 10px;
}

.app-panel--radio .cb-empty-state__title {
  font-size: 13px;
}

.app-panel--radio .cb-empty-state__line {
  font-size: 10px;
}

/* Desktop radio host: stations list scrolls inside the monitor, not the page */
.app-panel--radio .cb-station-monitor[data-shell-host="radio"] {
  min-height: 0;
  height: 100%;
  max-height: 100%;
  padding: 8px 10px;
  gap: 6px;
  overflow: hidden;
}

.app-panel--radio .cb-station-monitor[data-shell-host="radio"] .cb-station-monitor__list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  gap: 6px;
}

.app-panel--radio .cb-station-monitor[data-shell-host="radio"] .cb-station-monitor__item {
  padding: 7px 8px;
  gap: 8px;
}

.app-panel--radio .cb-meter {
  padding: 12px 12px 14px;
}

.app-panel--radio .cb-meter__svg {
  /*
   * The meter SVG has a fixed 220:112 viewBox, so width drives height. A bare
   * max-width:100% let it reach the full column width on tablets (~716px wide
   * => ~430px tall, over half the faceplate), which pushed the channel display
   * and monitor window past the faceplate's overflow:hidden edge.
   *
   * min() keeps phones unchanged (100% is already below the cap) and the
   * map-open desktop column unchanged (412px), while stopping the runaway
   * growth in the 641-1023px band.
   */
  max-width: min(100%, 440px);
}

.app-panel--radio .cb-controls {
  gap: 18px;
  padding: 8px 0 6px;
}

.app-panel--radio .cb-knob-group {
  gap: 6px;
}

.app-panel--radio .cb-knob {
  width: 72px;
  height: 72px;
}

.app-panel--radio .cb-knob-label {
  font-size: 10px;
}

.app-panel--radio .cb-knob-value {
  font-size: 12px;
}

.app-panel--radio .cb-faceplate__rivet {
  width: 12px;
  height: 12px;
}

.app-panel--radio .cb-faceplate__rivet--top-left,
.app-panel--radio .cb-faceplate__rivet--top-right {
  top: 6px;
}

.app-panel--radio .cb-faceplate__rivet--lower-left,
.app-panel--radio .cb-faceplate__rivet--lower-right {
  bottom: 6px;
}

.app-panel--radio .cb-faceplate__rivet--top-left,
.app-panel--radio .cb-faceplate__rivet--lower-left {
  left: 6px;
}

.app-panel--radio .cb-faceplate__rivet--top-right,
.app-panel--radio .cb-faceplate__rivet--lower-right {
  right: 6px;
}

/* Weather is an app-shell overlay sheet now (not inline in the faceplate) */

/* Station monitor mount points (same node moved between hosts) */
.station-monitor-mount {
  display: contents;
}

.station-monitor-mount:empty {
  display: none;
}

.app-panel__body--stations {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.station-monitor-mount--tab {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  padding: 12px;
}

/*
 * Stations tab with nobody in range rendered as a full-height void below the
 * "0 stations online" header. The radio faceplate has .cb-empty-state for the
 * same condition; the tab host had no equivalent, so give the empty list a
 * matching line rather than leaving a blank panel.
 */
.station-monitor-mount--tab .cb-station-monitor__list:empty::after {
  content: "No stations in range yet — nearby rigs appear here once they key up.";
  display: block;
  padding: 20px 14px;
  max-width: 34ch;
  color: rgba(170, 176, 189, 0.62);
  font-size: var(--ocb-text-base, 13px);
  line-height: 1.5;
  text-align: center;
  margin-inline: auto;
}

/* Full-height stations list when hoisted into the mobile Stations tab */
.cb-station-monitor[data-shell-host="stations"] {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  opacity: 1 !important;
  transform: none !important;
  pointer-events: auto !important;
  overflow: hidden;
  background: rgba(12, 16, 22, 0.92);
  border: 1px solid rgba(0, 255, 157, 0.16);
  border-radius: 12px;
}

.cb-station-monitor[data-shell-host="stations"] .cb-station-monitor__list,
body.truck-mode-active .cb-station-monitor[data-shell-host="stations"] .cb-station-monitor__list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  opacity: 1;
  overflow: auto;
  pointer-events: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.cb-station-monitor[data-shell-host="stations"][data-collapsed="true"] .cb-station-monitor__header,
body.truck-mode-active .cb-station-monitor[data-shell-host="stations"] .cb-station-monitor__header {
  border-radius: 8px;
  cursor: default;
}

.cb-station-monitor[data-shell-host="stations"][data-collapsed="true"] .cb-station-monitor__list {
  max-height: none;
  opacity: 1;
  overflow: auto;
  pointer-events: auto;
  margin-top: 10px;
}

/* Map — panel must keep the same positioning model as other tabs.
   Do NOT force position:relative here: on compact layouts .app-panel is
   position:absolute;inset:0 to fill .app-stage. Overriding to relative
   collapses #radioMap to ~0 height (black map on mobile/Safari). */
.app-panel--map {
  background: #0a0c10;
  min-width: 0;
  min-height: 0;
  /* Containing block for absolute #radioMap comes from .app-panel positioning */
}

.app-map-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100% !important;
  min-width: 0;
  min-height: 0;
  z-index: 1;
  /* Leaflet tiles paint into this layer; keep it opaque when panel is visible */
  background: #0a0c10;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.app-map-placeholder {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(0, 229, 255, 0.08), transparent 55%),
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent 27px,
      rgba(0, 229, 255, 0.04) 28px
    ),
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 27px,
      rgba(0, 229, 255, 0.04) 28px
    ),
    #0a0c10;
  color: var(--text-secondary, #aab0bd);
}

.app-map-placeholder[hidden] {
  display: none !important;
}

.app-map-placeholder__title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--app-neon-cyan);
  text-shadow: 0 0 18px rgba(0, 229, 255, 0.35);
}

.app-map-placeholder__hint {
  margin: 0;
  font-size: 13px;
  max-width: 22rem;
  line-height: 1.4;
}

/* Fixed overlays (outside shell) respect notch / home indicator */
#truckModeIndicator,
.cb-truck-indicator {
  top: calc(10px + env(safe-area-inset-top, 0px));
  right: calc(10px + env(safe-area-inset-right, 0px));
}

#txOverlay,
#collision,
#qrmIndicator {
  /* keep existing styles.css positioning; bump above shell chrome */
  z-index: 1100;
}

/* -------------------------------------------------------------------------- */
/* Settings drawer (overlay — radio/map stay visible behind dimmed scrim)     */
/* -------------------------------------------------------------------------- */

.app-settings-backdrop {
  position: absolute;
  inset: 0;
  z-index: 80;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(4, 7, 12, 0.58);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.app-shell[data-settings-open="true"] .app-settings-backdrop,
.app-settings-backdrop:not([hidden]) {
  opacity: 1;
  pointer-events: auto;
}

.app-settings-backdrop[hidden] {
  display: block !important; /* keep for transition; pointer-events/opacity gate interaction */
  opacity: 0;
  pointer-events: none;
}

/* -------------------------------------------------------------------------- */
/* Weather overlay sheet (WX button / ticker — keeps radio+map visible)       */
/* -------------------------------------------------------------------------- */

.app-weather-backdrop {
  position: absolute;
  inset: 0;
  z-index: 85;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(4, 7, 12, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.app-shell[data-weather-open="true"] .app-weather-backdrop,
.app-weather-backdrop:not([hidden]) {
  opacity: 1;
  pointer-events: auto;
}

.app-weather-backdrop[hidden] {
  display: block !important;
  opacity: 0;
  pointer-events: none;
}

.app-shell .cb-weather-drawer.app-weather-drawer {
  position: absolute;
  z-index: 95;
  left: 50%;
  right: auto;
  bottom: 0;
  top: auto;
  width: min(560px, 100%);
  max-width: 100%;
  max-height: min(72dvh, 640px);
  margin: 0;
  padding: 12px 14px calc(14px + var(--safe-bottom));
  border-radius: 18px 18px 0 0;
  border: 1px solid rgba(0, 229, 255, 0.18);
  border-bottom: none;
  opacity: 1;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  transform: translate(-50%, 110%);
  visibility: hidden;
  transition:
    transform 240ms cubic-bezier(0.22, 1, 0.36, 1),
    visibility 240ms ease;
  background:
    linear-gradient(180deg, rgba(0, 229, 255, 0.05), transparent 24%),
    linear-gradient(145deg, #171a21, #0f1218);
  box-shadow:
    0 -16px 48px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(0, 0, 0, 0.35);
}

.app-shell .cb-weather-drawer.app-weather-drawer[aria-hidden="false"],
.app-shell[data-weather-open="true"] .cb-weather-drawer.app-weather-drawer {
  transform: translate(-50%, 0);
  visibility: visible;
}

.app-shell .app-weather-drawer .cb-weather-drawer__header {
  position: sticky;
  top: 0;
  z-index: 1;
  gap: 10px;
  padding-bottom: 10px;
  background: linear-gradient(180deg, #171a21 70%, transparent);
}

.app-shell .app-weather-drawer .cb-weather-drawer__actions {
  flex-wrap: wrap;
}

.app-shell .app-weather-drawer .cb-weather-drawer__grid {
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 720px) {
  .app-shell .app-weather-drawer .cb-weather-drawer__grid {
    grid-template-columns: 1fr 1fr;
  }
}

.dispatcher-map__alert-empty {
  list-style: none;
  margin: 0;
  padding: 8px 2px;
  color: #8b949e;
  font-size: 12px;
}

/* Override legacy fold-down styles from styles.css */
.app-shell .cb-settings-panel.app-settings-drawer {
  position: absolute;
  z-index: 90;
  display: flex !important;
  flex-direction: column;
  max-width: none;
  max-height: none;
  margin: 0;
  opacity: 1;
  overflow: hidden;
  pointer-events: auto;
  background:
    linear-gradient(180deg, rgba(0, 229, 255, 0.04), transparent 28%),
    linear-gradient(145deg, #171a21, #0f1218);
  border: 1px solid rgba(0, 229, 255, 0.18);
  box-shadow:
    -12px 0 40px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(0, 0, 0, 0.4);
  transition:
    transform 240ms cubic-bezier(0.22, 1, 0.36, 1),
    visibility 240ms ease;
  visibility: hidden;
}

.app-shell .cb-settings-panel.app-settings-drawer[aria-hidden="false"],
.app-shell[data-settings-open="true"] .cb-settings-panel.app-settings-drawer {
  visibility: visible;
}

.app-shell .cb-settings-panel.app-settings-drawer.is-dragging {
  transition: none;
}

.app-shell .app-settings-drawer .cb-settings-panel__header {
  position: relative;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 14px 16px 12px;
  background: linear-gradient(135deg, #1a222d, #12171f);
  border-bottom: 1px solid rgba(0, 229, 255, 0.12);
}

.app-shell .app-settings-drawer .cb-settings-panel__grab {
  grid-column: 1 / -1;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2px 0 6px;
  touch-action: none;
  cursor: grab;
}

.app-shell .app-settings-drawer .cb-settings-panel__handle {
  width: 44px;
  height: 4px;
  border-radius: 999px;
  background: rgba(167, 176, 191, 0.55);
}

.app-shell .app-settings-drawer .cb-settings-panel__title {
  margin: 0;
  font-size: 16px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--app-neon-cyan);
  text-shadow: 0 0 12px rgba(0, 229, 255, 0.28);
}

.app-shell .app-settings-drawer .cb-settings-panel__close {
  min-width: var(--app-touch-min);
  min-height: var(--app-touch-min);
  width: var(--app-touch-min);
  height: var(--app-touch-min);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 24px;
  line-height: 1;
  color: #d7dde8;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  touch-action: manipulation;
}

.app-shell .app-settings-drawer .cb-settings-panel__close:hover {
  color: #fff;
  border-color: rgba(0, 229, 255, 0.35);
  background: rgba(0, 229, 255, 0.08);
}

/* Match the settings close: 44px touch target (base styles pin 36px) */
.app-shell .app-weather-drawer .cb-weather-drawer__close {
  min-width: var(--app-touch-min);
  min-height: var(--app-touch-min);
  width: var(--app-touch-min);
  height: var(--app-touch-min);
}

.app-shell .app-settings-drawer .cb-settings-tabs {
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  overflow-x: visible;
  border-bottom: 1px solid rgba(37, 42, 51, 0.95);
  background: rgba(10, 13, 18, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.app-shell .app-settings-drawer .cb-settings-tabs::-webkit-scrollbar {
  display: none;
}

.app-shell .app-settings-drawer .cb-settings-tab {
  flex: 1 1 auto;
  min-width: 4.5rem;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: #9aa3b2;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  touch-action: manipulation;
  text-align: center;
}

.app-shell .app-settings-drawer .cb-settings-tab:hover {
  color: #e7e9ee;
  background: rgba(255, 255, 255, 0.04);
}

.app-shell .app-settings-drawer .cb-settings-tab.active {
  color: #041018;
  background: var(--app-neon-cyan);
  border-color: rgba(0, 229, 255, 0.8);
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.28);
}

.app-shell .app-settings-drawer .cb-settings-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 16px 16px 28px;
}

.app-shell .app-settings-drawer .cb-settings-tabpanel h3 {
  margin: 18px 0 10px;
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--app-neon-green);
}

.app-shell .app-settings-drawer .cb-settings-tabpanel h3:first-child {
  margin-top: 0;
}

.app-shell .app-settings-drawer .cb-settings-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.app-shell .app-settings-drawer .cb-settings-grid {
  gap: 12px;
  margin-bottom: 12px;
}

.app-shell .app-settings-drawer .cb-label {
  gap: 6px;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.app-shell .app-settings-drawer .cb-input,
.app-shell .app-settings-drawer .cb-select,
.app-shell .app-settings-drawer .cb-btn {
  min-height: 44px;
}

.app-shell .app-settings-drawer .cb-input,
.app-shell .app-settings-drawer .cb-select {
  padding: 10px 12px;
  border-radius: 10px;
}

/* Desktop: right slide-over */
@media (min-width: 1024px) {
  .app-shell .cb-settings-panel.app-settings-drawer {
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    width: clamp(420px, 34vw, 480px);
    max-width: min(480px, 100%);
    border-radius: 0;
    border-left: 1px solid rgba(0, 229, 255, 0.2);
    border-right: none;
    border-top: none;
    border-bottom: none;
    transform: translateX(104%);
  }

  .app-shell .cb-settings-panel.app-settings-drawer[aria-hidden="false"],
  .app-shell[data-settings-open="true"] .cb-settings-panel.app-settings-drawer {
    transform: translateX(0);
  }
}

/* Compact: bottom sheet */
@media (max-width: 1023.98px) {
  .app-shell .cb-settings-panel.app-settings-drawer {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: min(92dvh, calc(var(--app-vv-height, 100dvh) - 12px));
    max-height: calc(100% - max(12px, var(--safe-top)));
    border-radius: 18px 18px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    padding-bottom: var(--safe-bottom);
    transform: translateY(108%);
    box-shadow:
      0 -16px 48px rgba(0, 0, 0, 0.55),
      0 0 0 1px rgba(0, 0, 0, 0.35);
  }

  .app-shell .cb-settings-panel.app-settings-drawer[aria-hidden="false"],
  .app-shell[data-settings-open="true"] .cb-settings-panel.app-settings-drawer {
    transform: translateY(0);
  }

  .app-shell .app-settings-drawer .cb-settings-panel__grab {
    display: flex;
  }

  .app-shell .app-settings-drawer .cb-settings-panel__header {
    padding-top: 6px;
  }

  .app-shell .app-settings-drawer .cb-settings-content {
    padding: 14px 14px calc(24px + var(--safe-bottom));
  }
}

/* PTT dock — always reachable (64–68px hold target on phones/tablets) */

.app-ptt-dock {
  grid-area: ptt;
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-height: calc(var(--app-ptt-h) + 12px);
  padding: 6px max(12px, var(--safe-right)) 6px max(12px, var(--safe-left));
  background: linear-gradient(180deg, #12161e 0%, #0b0e13 100%);
  border-top: 1px solid var(--app-chrome-border);
  border-bottom: 1px solid rgba(0, 0, 0, 0.45);
  z-index: 40;
  /* Keep PTT above Safari bottom UI / home indicator stack */
  position: relative;
  /* Grid chrome must not compress under short viewports */
  flex-shrink: 0;
}

.app-ptt-dock .cb-ptt-section {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  grid-area: unset;
}

.app-ptt-dock .cb-ptt-button {
  flex: 1 1 auto;
  min-height: max(56px, var(--app-touch-min));
  height: max(56px, var(--app-ptt-h));
  max-height: 72px;
  margin: 0;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.06em;
  border: 2px solid rgba(255, 138, 61, 0.55);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.5),
    0 0 18px rgba(255, 138, 61, 0.18);
  touch-action: none; /* prevent scroll/zoom while holding PTT */
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none; /* no iOS long-press callout on PTT */
  -webkit-tap-highlight-color: transparent;
  /* Large hold target — thumb-reachable while driving / trucking */
  cursor: pointer;
}

.app-ptt-dock .cb-ptt-button.active,
.app-ptt-dock .cb-ptt-button:active {
  border-color: rgba(0, 255, 157, 0.7);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.5),
    0 0 28px rgba(0, 255, 157, 0.35);
}

.app-ptt-dock .cb-ptt-button.is-unavailable,
.app-ptt-dock .cb-ptt-button:disabled {
  opacity: 0.72;
  border-color: rgba(143, 151, 166, 0.45);
  box-shadow: none;
  color: #c5ccd8;
  letter-spacing: 0.04em;
}

.app-ptt-dock .cb-ptt-button.is-unavailable .cb-ptt-button__label,
.app-ptt-dock .cb-ptt-button:disabled .cb-ptt-button__label {
  font-size: 13px;
}

/* When PTT is unavailable, drop the mic meter to reclaim vertical space */
.app-ptt-dock:has(.cb-ptt-button.is-unavailable) .cb-mic-meter,
.app-ptt-dock:has(.cb-ptt-button:disabled) .cb-mic-meter {
  display: none;
}

.app-ptt-dock:has(.cb-ptt-button.is-unavailable),
.app-ptt-dock:has(.cb-ptt-button:disabled) {
  min-height: calc(var(--app-ptt-h) + 4px);
  padding-top: 4px;
  padding-bottom: 4px;
}

.app-ptt-dock .cb-mic-meter {
  flex: 0 0 auto;
  width: 72px;
}

/* -------------------------------------------------------------------------- */
/* Status bar                                                                  */
/* -------------------------------------------------------------------------- */

.app-status-bar {
  grid-area: status;
  display: flex;
  align-items: center;
  min-height: var(--app-status-h);
  height: var(--app-status-h);
  padding: 0 max(10px, var(--safe-right)) 0 max(10px, var(--safe-left));
  overflow: hidden;
  background: #080a0e;
  border-top: 1px solid #1a1f28;
  z-index: 35;
}

/* Its natural width; the conditions summary takes the space to its right. */
.app-status-bar .cb-ticker {
  flex: 0 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  grid-area: unset;
}

.app-status-bar .cb-ticker__content {
  padding: 0;
  font-size: 11px;
  animation: none;
  white-space: nowrap;
  overflow: hidden;
  /*
   * No-op on its own: .cb-ticker__content is display:flex, so ellipsis never
   * applied and the bar hard-cut its last item mid-word ("WX: no a"). The
   * truncation is moved onto the flex item below.
   */
  text-overflow: ellipsis;
  min-width: 0;
}

/*
 * The weather item is both the longest and the only one that opens a fuller
 * view (#weatherDrawer), so it is the right place to absorb the overflow:
 * it degrades to "WX: no active…" instead of cutting mid-word, and the full
 * text stays one tap away. Fixed items keep their intrinsic width.
 */
.app-status-bar .cb-ticker__item {
  flex: 0 0 auto;
}

.app-status-bar .cb-ticker__item--button {
  flex: 0 1 auto;
  display: block;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* -------------------------------------------------------------------------- */
/* Conditions summary (#conditionsSummary), right of the weather               */
/* -------------------------------------------------------------------------- */
/*
 * The Skip and Solar Conditions panels in one line (app.js draws it from the
 * same descriptions). Nothing scrolls or wraps into view:
 * - the skip status, the stale / last-known / fixture flags and Details always
 *   show: they make up the summary's min-content width, so the weather item
 *   gives way (ellipsis, down to its own minimum) before any of them; the
 *   flags and Details sit at the right end;
 * - the other items sit in a one-line box that wraps and clips, so whatever
 *   does not fit drops from the end (source, model input, Kp, solar flux,
 *   sporadic-E, F2) without any measuring script;
 * - one row only where the worst case fits beside the ticker (desktop, wide
 *   landscape); elsewhere two fixed rows (see the narrow layouts below);
 * - the bar keeps its height, so values changing never move the radio.
 */
.app-status-bar .cb-ticker__item--button {
  /* Shortened by the summary, never squeezed out: about "WX: no ac…". */
  min-width: 7em;
}

.app-status-bar .cb-conds {
  flex: 1 1 0;
  min-width: min-content;
  display: flex;
  align-items: center;
  margin-left: 12px;
  font-size: 11px;
  line-height: 16px;
  color: #aab0bd;
  white-space: nowrap;
}

/* The ticker's own separator, between the weather and the summary. */
.app-status-bar .cb-conds::before {
  flex: none;
  margin-right: 12px;
  color: #4a5562;
  content: "\00b7";
  content: "\00b7" / "";
}

.cb-conds__summary {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  min-width: 0;
  margin: 0;
}

.cb-conds__items {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-content: flex-start;
  min-width: 0;
  height: 16px;
  overflow: hidden;
}

.cb-conds__flags {
  display: flex;
  flex: none;
  align-items: center;
  gap: 6px;
  margin-left: 10px;
}

.cb-conds__flags:empty {
  display: none;
}

.cb-conds__item {
  flex: none;
  white-space: nowrap;
}

/* The skip status shortens (ellipsis) only if even the essentials overflow. */
.cb-conds__item[data-key="skip"] {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cb-conds__items > .cb-conds__item + .cb-conds__item::before {
  display: inline-block;
  margin: 0 var(--cb-conds-sep, 6px);
  color: #4a5562;
  font-weight: 400;
  content: "\00b7";
  content: "\00b7" / "";
}

.cb-conds__label {
  color: #8f97a6;
}

.cb-conds__item[data-tone="neutral"] .cb-conds__text,
.cb-conds__item[data-tone="closed"] .cb-conds__text {
  color: #cfd5e2;
}

.cb-conds__item[data-tone="open"] .cb-conds__text {
  color: #9ff0c4;
}

.cb-conds__item[data-tone="warning"] .cb-conds__text {
  color: #ffd98f;
}

.cb-conds__item[data-tone="muted"] .cb-conds__text,
.cb-conds__item[data-tone="unavailable"] .cb-conds__text,
.cb-conds__item[data-tone="stale"] .cb-conds__text {
  color: #aab0bd;
}

.cb-conds__item[data-key="skip"][data-tone="stale"] .cb-conds__text {
  font-style: italic;
}

/* Flags: small outlined chips. */
.cb-conds__flags .cb-conds__text {
  display: inline-block;
  padding: 0 4px;
  border: 1px solid currentColor;
  border-radius: 3px;
  font-weight: 700;
  line-height: 14px;
}

.cb-conds__item[data-key="fixture"] .cb-conds__text {
  border-style: dashed;
  color: #ffd400;
}

.cb-conds__item[data-key="last-known"] .cb-conds__text {
  border-color: #6b7383;
  color: #cfd5e2;
}

/* One of the two forms shows: the long one here, the short one below the
   desktop layout. Labels likewise. */
.cb-conds__item .cb-conds__text--short,
.cb-conds__item .cb-conds__label--short {
  display: none;
}

.cb-conds__details {
  display: inline-flex;
  flex: none;
  align-items: center;
  /* Within the bar's height less its top border (22px bars in landscape). */
  min-height: min(22px, calc(var(--app-status-h) - 1px));
  margin: 0 0 0 10px;
  padding: 0 2px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #cfd5e2;
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: #6b7383;
  text-underline-offset: 2px;
  cursor: pointer;
}

.cb-conds__details:hover {
  color: #ffffff;
  text-decoration-color: currentColor;
}

.cb-conds__details:focus-visible {
  outline: 2px solid #ffd400;
  outline-offset: 1px;
}

/* -------------------------------------------------------------------------- */
/* Mobile tab bar                                                              */
/* -------------------------------------------------------------------------- */

.app-tabbar {
  grid-area: tabs;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  min-height: calc(var(--app-tabbar-h) + var(--safe-bottom));
  height: calc(var(--app-tabbar-h) + var(--safe-bottom));
  /* Home indicator + landscape notch clearance (iPhone/Android gesture bars) */
  padding:
    0
    max(0px, var(--safe-right))
    var(--safe-bottom)
    max(0px, var(--safe-left));
  background: #0b0e13;
  border-top: 1px solid var(--app-chrome-border);
  z-index: 45;
  position: relative;
  flex-shrink: 0;
  /* Isolate from stage paints during tab cross-fade */
  isolation: isolate;
}

.app-tab {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-top: 2px solid transparent;
  background: transparent;
  color: var(--text-tertiary, #8f97a6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: max(var(--app-tabbar-h), var(--app-touch-min));
  padding: 6px 4px;
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.app-tab__icon {
  font-size: 16px;
  line-height: 1;
}

.app-tab[aria-selected="true"] {
  color: var(--app-neon-cyan);
  border-top-color: var(--app-neon-cyan);
  background: rgba(0, 229, 255, 0.06);
  text-shadow: 0 0 10px rgba(0, 229, 255, 0.35);
}

.app-tab:focus-visible {
  outline: 2px solid var(--app-neon-cyan);
  outline-offset: -2px;
}

/* -------------------------------------------------------------------------- */
/* Mobile layout (<1024px)                                                     */
/* -------------------------------------------------------------------------- */

@media (max-width: 1023.98px) {
  /*
   * Smooth tab transitions (mobile / tablet):
   * Keep panels stacked and cross-fade — Safari cannot animate display toggles.
   */
  .app-stage > .app-panel {
    display: flex !important;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateZ(0); /* promote layer on WebKit */
    transition:
      opacity 180ms ease,
      visibility 180ms ease;
    z-index: 0;
  }

  .app-shell[data-active-tab="radio"] .app-panel--radio,
  .app-shell[data-active-tab="map"] .app-panel--map,
  .app-shell[data-active-tab="stations"] .app-panel--stations {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    z-index: 1;
  }

  .app-header__settings-label {
    display: none;
  }

  .app-header__model {
    display: none;
  }

  .app-header__lamps {
    gap: 6px;
  }

  .app-header__lamps .cb-lamp__label {
    display: none;
  }

  .app-header__lamps .cb-lamp__glow {
    width: 11px;
    height: 11px;
  }

  .app-header .cb-link-pill {
    max-width: min(34vw, 140px);
  }

  /* Radio tab faceplate — denser, no brand/lamps (header owns those) */
  .app-panel--radio .cb-faceplate {
    --fp-pad: 8px;
    --fp-gap: 7px;
    grid-template-columns: 1fr;
    /*
     * Channel used to own minmax(0, 1fr) while meter/knobs were `auto`.
     * On short portrait stages (Chrome URL bar, Samsung FE ~360 CSS px) the
     * meter took its natural height first and the channel row flex-shrunk
     * toward zero under overflow:hidden — steppers/digits looked "smashed"
     * and failed hit-testing. Size channel to its content; let the meter
     * absorb leftover space (and shrink first). Landscape-shell overrides
     * this grid with the side-by-side console split.
     */
    grid-template-rows:
      auto
      minmax(72px, 1fr)
      auto;
    grid-template-areas:
      "channel"
      "meter"
      "knobs";
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .app-panel--radio .cb-brand,
  .app-panel--radio .cb-speaker-grille {
    display: none !important;
  }

  /*
   * Never flex-shrink the channel selector into invisibility. Live-monitor
   * content may grow the panel (section scrolls); the steppers + CH readout
   * must keep a usable box. Matches landscape-shell's flex: 0 0 auto.
   */
  .app-panel--radio .cb-channel-display {
    flex: 0 0 auto;
  }

  /*
   * Base .cb-channel-section uses height:100% for the desktop column. On the
   * compact stack that percentage fights grid row `auto` and collapses the
   * section toward its min-height, clipping presets/controls. Size to content.
   */
  .app-panel--radio .cb-channel-section {
    height: auto;
  }

  .app-panel--radio .cb-channel-display__controls {
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: center;
    row-gap: 8px;
    min-height: var(--app-touch-min);
  }

  .app-panel--radio .cb-channel-display__main {
    flex: 1 1 auto;
    min-width: min(100%, 148px);
  }

  .app-panel--radio .cb-channel-display__digits {
    flex-shrink: 0;
  }

  /* Meter yields before channel; keep overflow from painting over controls. */
  .app-panel--radio .cb-meter-section {
    min-height: 0;
    overflow: hidden;
  }

  /* Stations live in the Stations tab — keep monitor compact (empty/standby) */
  .app-panel--radio .cb-monitor-window {
    flex: 0 1 auto;
    min-height: 52px;
    /* Cap live-list growth so channel+meter both stay on stage. */
    max-height: 120px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .app-panel--radio .cb-faceplate[data-monitor-state="empty"] .cb-monitor-window {
    min-height: 48px;
  }

  .app-panel--radio .cb-channel-display__digits {
    font-size: 48px;
    min-width: 68px;
  }

  .app-panel--radio .cb-preset-btn {
    min-height: var(--app-touch-min);
    min-width: var(--app-touch-min);
    padding: 8px 4px;
    touch-action: manipulation;
  }

  .app-panel--radio .cb-channel-step {
    flex: 0 0 auto;
    min-width: var(--app-touch-min);
    min-height: var(--app-touch-min);
    touch-action: manipulation;
  }

  /*
   * The in-display channel dial is a fixed 70×70 control. On ~360 CSS px
   * phones it competes with two 44px steppers + CH digits and is the first
   * thing to force horizontal overflow / visual smash. Keep it usable but
   * smaller; steppers remain the primary tap targets.
   */
  .app-panel--radio .cb-channel-display__main > .channel-dial {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
  }

  .app-panel--radio .cb-channel-display__main > .channel-dial .channel-dial__knob {
    width: 32px;
    height: 32px;
  }

  .app-panel--radio .cb-channel-display__main > .channel-dial .channel-dial__knob::after {
    top: 3px;
    height: 10px;
  }

  .app-panel--radio .cb-knob {
    width: 64px;
    height: 64px;
    touch-action: none;
  }

  .app-panel--radio .cb-controls {
    gap: 12px;
    padding: 2px 0;
  }

  .app-ptt-dock {
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .app-ptt-dock .cb-ptt-button {
    /* Trucking / one-thumb: larger than HIG 44px minimum */
    min-height: 64px;
    height: 64px;
    font-size: 17px;
  }

  .app-ptt-dock .cb-ptt-button__label {
    font-size: 17px;
  }

  .app-ptt-dock .cb-ptt-button__hotkey {
    display: none;
  }

  /* Thumb-first PTT: full-width hold zone above status + tabs */
  .app-ptt-dock .cb-ptt-section {
    width: 100%;
  }

  .app-ptt-dock .cb-mic-meter {
    width: 64px;
  }

  .app-tab {
    /* Extra vertical hit padding without growing chrome past grid row */
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .app-status-bar .cb-ticker__item--button {
    min-height: 28px;
    padding: 2px 6px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
}

/* Tablets in tabbed mode (iPad portrait, Android tablets <1024) */
@media (max-width: 1023.98px) and (min-width: 768px) {
  :root {
    --app-header-h: 48px;
    --app-tabbar-h: 56px;
    --app-ptt-h: 60px;
  }

  .app-header__model {
    display: inline;
  }

  .app-ptt-dock {
    justify-content: center;
    padding-left: max(24px, var(--safe-left));
    padding-right: max(24px, var(--safe-right));
  }

  .app-ptt-dock .cb-ptt-section {
    max-width: 560px;
    margin: 0 auto;
  }

  .app-ptt-dock .cb-ptt-button {
    min-height: 68px;
    height: 68px;
    font-size: 18px;
  }

  .app-tab {
    font-size: 11px;
  }

  .app-tab__icon {
    font-size: 18px;
  }

  .app-panel--radio .cb-channel-display__digits {
    font-size: 56px;
  }

  .app-panel--radio .cb-knob {
    width: 72px;
    height: 72px;
  }
}

/* -------------------------------------------------------------------------- */
/* Height-adaptive faceplate (compact portrait)                                */
/*                                                                             */
/* The S-meter SVG has a fixed 220:112 viewBox, so width drives height — a     */
/* WIDER phone renders a TALLER meter and steals vertical space from the       */
/* channel display. Measured across devices the meter ran 219px (Fold cover)   */
/* to 268px (16 Pro Max) tall. Add Safari's ~150px of URL bar and the channel  */
/* section absorbed the entire shortfall and clipped under the faceplate's     */
/* overflow:hidden: 14px lost on a 16 Pro Max, 100px on an iPhone 14, 208px on */
/* an SE. That difference between handsets is the "crunched channel".          */
/*                                                                             */
/* Media-query height cannot see the URL bar on iOS — it reports the large     */
/* viewport — so size against the visual viewport instead. layout-shell.js     */
/* publishes --app-vv-height from visualViewport.height (compact only); 100dvh */
/* is the fallback before that first sync lands.                              */
/*                                                                             */
/* Every value is a min() against the existing fixed size, so tall viewports   */
/* keep today's proportions and only short ones scale down.                    */
/* -------------------------------------------------------------------------- */

@media (max-width: 1023.98px) and (orientation: portrait) {
  .app-panel--radio {
    --fp-vh: var(--app-vv-height, 100dvh);
  }

  /* Width cap => height cap, via the 220:112 viewBox. */
  .app-panel--radio .cb-meter__svg {
    max-width: min(100%, 440px, calc(var(--fp-vh) * 0.25));
  }

  /*
   * Floored at the HIG minimum: pure scaling took these to 36px on a 527px
   * viewport. The readout column above absorbs the difference by scrolling;
   * a control you cannot reliably hit is the worse trade.
   */
  .app-panel--radio .cb-knob {
    width: max(var(--app-touch-min), min(64px, calc(var(--fp-vh) * 0.068)));
    height: max(var(--app-touch-min), min(64px, calc(var(--fp-vh) * 0.068)));
  }

  .app-panel--radio .cb-channel-display__digits {
    font-size: min(48px, calc(var(--fp-vh) * 0.052));
  }

  .app-panel--radio .cb-preset-btn {
    padding: min(11px, calc(var(--fp-vh) * 0.013)) 8px;
  }

  /*
   * Last-resort safety. Scaling above fits every handset measured, but a
   * 4.7" SE with the URL bar open leaves ~330px of stage for five stacked
   * sections and no coefficient makes that fit legibly. Scrolling the
   * channel section degrades gracefully; the faceplate must not silently
   * amputate the steppers / CH readout (the portrait "smashed channel").
   *
   * min-height keeps presets + controls visible. Do not use percentage
   * max-height here: on a grid row sized `auto` it resolves cyclically and
   * collapses the section toward min-height. Live-monitor growth is capped
   * on .cb-monitor-window instead.
   */
  .app-panel--radio .cb-channel-section {
    min-height: max(132px, calc(var(--app-touch-min) * 2 + 48px));
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

/* Short landscape phones / foldables — keep chrome compact, PTT reachable */
@media (max-width: 1023.98px) and (max-height: 480px) {
  :root {
    --app-header-h: 36px;
    --app-status-h: 22px;
    --app-tabbar-h: 44px;
    --app-ptt-h: 52px;
  }

  .app-header__lamps .cb-lamp__label {
    display: none;
  }

  .app-ptt-dock {
    padding-top: 4px;
    padding-bottom: 4px;
    min-height: calc(var(--app-ptt-h) + 8px);
  }

  .app-ptt-dock .cb-ptt-button {
    /* Still ≥44px HIG minimum in landscape-short */
    min-height: max(52px, var(--app-touch-min));
    height: 52px;
    font-size: 15px;
  }

  .app-ptt-dock .cb-mic-meter {
    display: none;
  }

  .app-panel--radio .cb-faceplate {
    --fp-pad: 6px;
    --fp-gap: 5px;
  }

  .app-panel--radio .cb-channel-display__digits {
    font-size: 40px;
  }

  .app-panel--radio .cb-knob {
    width: 52px;
    height: 52px;
  }

  .app-map-chrome__side {
    max-height: none;
  }
}

/* Landscape phones / foldables — compact chrome + side insets; map stage gains height */
@media (max-width: 1023.98px) and (orientation: landscape) {
  :root {
    --app-header-h: 36px;
    --app-status-h: 22px;
    --app-tabbar-h: 44px;
    --app-ptt-h: 48px;
  }

  .app-header {
    padding-left: max(12px, var(--safe-left));
    padding-right: max(12px, var(--safe-right));
  }

  .app-header__lamps .cb-lamp__label {
    display: none;
  }

  .app-ptt-dock {
    padding-top: 4px;
    padding-bottom: 4px;
    padding-left: max(16px, var(--safe-left));
    padding-right: max(16px, var(--safe-right));
    min-height: calc(var(--app-ptt-h) + 8px);
  }

  .app-ptt-dock .cb-ptt-button {
    /* ≥44px touch target while reclaiming map height */
    min-height: max(44px, var(--app-touch-min));
    height: max(48px, var(--app-ptt-h));
    max-height: 52px;
    font-size: 15px;
  }

  .app-ptt-dock .cb-mic-meter {
    display: none;
  }

  .app-status-bar {
    padding-left: max(12px, var(--safe-left));
    padding-right: max(12px, var(--safe-right));
  }

  .app-tabbar {
    padding-left: max(4px, var(--safe-left));
    padding-right: max(4px, var(--safe-right));
  }

  .app-tab__label {
    font-size: 9px;
  }

  .app-map-chrome__header {
    padding-top: 4px;
    padding-bottom: 4px;
  }
}

/*
 * Below the desktop layout the ticker and the conditions summary cannot be
 * guaranteed one line together (the summary's kept items beside the ticker's
 * fixed items and the weather), so the bar becomes two fixed rows: the ticker
 * as before, then the summary on a row of its own. Portrait (phones and
 * tablets): 24px rows. Narrow landscape: 22px rows. Wider landscape keeps one
 * compact row (short forms, closer separators), which the worst case fits.
 * Fixed heights, so nothing moves as values change; the grid row keeps the
 * bar clear of TALK.
 */
@media (max-width: 1023.98px) and (orientation: portrait) {
  :root {
    /* Two 24px rows plus the bar's 1px top border. */
    --app-status-h: 49px;
  }

  .app-status-bar {
    --cb-conds-row: 24px;
  }
}

@media (max-width: 879.98px) and (orientation: landscape) {
  :root {
    /* Two 22px rows plus the bar's 1px top border. */
    --app-status-h: 45px;
  }

  .app-status-bar {
    --cb-conds-row: 22px;
  }
}

@media (max-width: 1023.98px) and (orientation: portrait), (max-width: 879.98px) and (orientation: landscape) {
  .app-status-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: var(--cb-conds-row) var(--cb-conds-row);
    align-content: center;
  }

  .app-status-bar .cb-ticker__item--button {
    min-height: var(--cb-conds-row);
    padding-top: 0;
    padding-bottom: 0;
  }

  .app-status-bar .cb-conds {
    min-width: 0;
    margin-left: 0;
  }

  /* Its own row: no separator in front. */
  .app-status-bar .cb-conds::before {
    content: none;
  }

  .cb-conds__details {
    min-height: var(--cb-conds-row);
  }
}

/* Short forms wherever space is tight: every layout below the desktop. */
@media (max-width: 1023.98px) {
  .app-status-bar {
    --cb-conds-sep: 5px;
  }

  .cb-conds__flags {
    gap: 4px;
    margin-left: 6px;
  }

  .cb-conds__flags .cb-conds__text {
    padding: 0 3px;
  }

  .cb-conds__details {
    margin-left: 6px;
  }

  .cb-conds__item .cb-conds__text--long,
  .cb-conds__item .cb-conds__label--long {
    display: none;
  }

  .cb-conds__item .cb-conds__text--short,
  .cb-conds__item .cb-conds__label--short {
    display: inline;
  }

  .cb-conds__flags .cb-conds__item .cb-conds__text--short {
    display: inline-block;
  }
}

/* The narrowest phones (under 360 px): closer chips, gaps and Details, so
   the widest kept set (the longest status, all three flags and Details) fits
   the row in full; the text size stays. */
@media (max-width: 359.98px) {
  .app-status-bar {
    --cb-conds-sep: 3px;
  }

  .cb-conds__flags {
    gap: 2px;
    margin-left: 4px;
  }

  .cb-conds__flags .cb-conds__text {
    padding: 0 1px;
  }

  .cb-conds__details {
    margin-left: 4px;
    padding: 0 1px;
  }
}

/* Wide landscape, one compact row: a smaller weather minimum and gaps. */
@media (min-width: 880px) and (max-width: 1023.98px) and (orientation: landscape) {
  .app-status-bar .cb-ticker__item--button {
    min-width: 5em;
  }

  .app-status-bar .cb-conds {
    margin-left: 8px;
  }

  .app-status-bar .cb-conds::before {
    margin-right: 8px;
  }
}

/* -------------------------------------------------------------------------- */
/* Desktop split (≥1024px)                                                     */
/* -------------------------------------------------------------------------- */

@media (min-width: 1024px) {
  .app-shell {
    /* Radio-first default: map dock closed until data-map-open="true" */
    grid-template-areas:
      "header"
      "radio"
      "ptt"
      "status";
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows:
      calc(var(--app-header-h) + var(--safe-top))
      minmax(0, 1fr)
      auto
      calc(var(--app-status-h) + var(--safe-bottom));
  }

  .app-shell[data-map-open="true"] {
    grid-template-areas:
      "header header"
      "radio  map"
      "ptt    map"
      "status status";
    grid-template-columns: var(--app-radio-width) minmax(0, 1fr);
  }

  .app-stage {
    display: contents;
  }

  .app-panel {
    position: relative;
    inset: auto;
  }

  .app-panel--radio {
    grid-area: radio;
    display: flex !important;
    min-height: 0;
    overflow: hidden;
  }

  .app-shell[data-map-open="true"] .app-panel--radio {
    border-right: 1px solid var(--app-chrome-border);
  }

  .app-panel--map {
    grid-area: map;
    display: none !important;
  }

  .app-shell[data-map-open="true"] .app-panel--map {
    display: flex !important;
  }

  /* Stations is not a separate desktop column; settings is an overlay drawer */
  .app-panel--stations {
    display: none !important;
  }

  .app-tabbar {
    display: none !important;
  }

  .app-header__map-toggle {
    display: inline-flex;
  }

  .app-header__settings-label,
  .app-header__map-toggle-label {
    display: inline;
  }

  .app-header .cb-link-pill {
    max-width: 200px;
  }

  .app-shell[data-map-open="true"] .app-ptt-dock {
    border-right: 1px solid var(--app-chrome-border);
  }

  /*
   * Map closed: radio + PTT share one centered console column (~880px).
   * Avoids a phone-width faceplate floating over a full-bleed HOLD TO TALK bar.
   * Map open: keep the fixed --app-radio-width split (unchanged above).
   */
  .app-shell[data-map-open="false"] .app-panel--radio,
  .app-shell[data-map-open="false"] .app-ptt-dock {
    width: 100%;
    max-width: min(var(--app-radio-solo-max), 100%);
    margin-inline: auto;
    box-sizing: border-box;
  }

  .app-shell[data-map-open="false"] .app-panel--radio .cb-faceplate {
    width: 100%;
    max-width: none;
    margin-inline: 0;
  }

  .app-ptt-dock .cb-ptt-button {
    min-height: 56px;
    height: 56px;
  }

  /* Compact status bar absorbs home-indicator inset on desktop */
  .app-status-bar {
    min-height: calc(var(--app-status-h) + var(--safe-bottom));
    height: calc(var(--app-status-h) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
  }

  /* Desktop: faceplate fills the radio column; stations scroll inside monitor */
  .app-panel--radio .cb-faceplate {
    --fp-pad: 14px;
    --fp-gap: 14px;
    overflow: hidden;
  }

  .app-panel--radio .cb-channel-section {
    gap: 14px;
  }

  .app-panel--radio .cb-presets {
    gap: 10px;
  }

  .app-panel--radio .cb-preset-btn {
    padding: 11px 8px;
  }

  .app-panel--radio .cb-channel-display {
    padding: 16px;
    gap: 12px;
  }

  .app-panel--radio .cb-channel-display__digits {
    font-size: 58px;
    min-width: 80px;
  }

  .app-panel--radio .cb-meter {
    padding: 14px 14px 16px;
  }

  .app-panel--radio .cb-controls {
    gap: 20px;
    padding: 10px 0 8px;
  }

  .app-panel--radio .cb-knob {
    width: 76px;
    height: 76px;
  }

  .app-panel--radio .cb-monitor-window,
  .app-panel--radio .cb-station-monitor[data-shell-host="radio"] {
    min-height: 0;
  }

  .app-panel--radio .cb-station-monitor[data-shell-host="radio"] .cb-station-monitor__list {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
  }

  /* Desktop: stations tab panel unused — list stays in the radio column */
  .app-panel--stations #stationMonitorMount:empty {
    display: none;
  }
}

/* -------------------------------------------------------------------------- */
/* Safari / iOS hardening                                                      */
/* -------------------------------------------------------------------------- */

@supports (-webkit-touch-callout: none) {
  /* iOS Safari / WebKit touch browsers */
  .app-shell {
    /* Prefer dynamic viewport when available; fill-available as belt-and-suspenders */
    min-height: -webkit-fill-available;
  }

  .app-panel--radio .cb-faceplate,
  .app-panel__body,
  .cb-station-monitor[data-shell-host="stations"] .cb-station-monitor__list,
  .app-shell .app-settings-drawer .cb-settings-content {
    -webkit-overflow-scrolling: touch; /* momentum scrolling inside panels */
    overscroll-behavior: contain;
  }

  .app-map-chrome__side {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
}

/* When Safari shows/hides the URL bar, dvh / visualViewport update */
@supports (height: 100dvh) {
  .app-shell {
    height: 100dvh;
    height: var(--app-vv-height, 100dvh);
    max-height: 100dvh;
    max-height: var(--app-vv-height, 100dvh);
  }
}

/* Prefer stable small viewport when dvh unavailable but svh is */
@supports (height: 100svh) and (not (height: 100dvh)) {
  .app-shell {
    height: 100svh;
    height: var(--app-vv-height, 100svh);
    max-height: 100svh;
    max-height: var(--app-vv-height, 100svh);
  }
}

/* -------------------------------------------------------------------------- */
/* Reduced motion                                                              */
/* -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .app-tab,
  .app-header__settings,
  .app-header__map-toggle,
  .app-ptt-dock .cb-ptt-button,
  .app-stage > .app-panel,
  .app-settings-backdrop,
  .app-shell .cb-settings-panel.app-settings-drawer {
    transition: none !important;
    animation: none !important;
  }
}

/* === Map module styles (from traffic integration) === */
.dispatcher-map {
  position: relative;
  width: 100%;
  max-width: 800px;
  margin: 8px auto;
  font-family: inherit;
  font-size: 13px;
  color: #c9d1d9;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 6px;
  overflow: hidden;
}

.dispatcher-map__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: #0d1117;
  border-bottom: 1px solid #30363d;
}

.dispatcher-map__title {
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #c9d1d9;
}

.dispatcher-map__refresh {
  background: none;
  border: 1px solid #30363d;
  color: #8b949e;
  border-radius: 4px;
  padding: 2px 6px;
  cursor: pointer;
  font-size: 14px;
}

.dispatcher-map__refresh:hover {
  color: #c9d1d9;
  border-color: #8b949e;
}

.dispatcher-map__map {
  width: 100%;
  height: 350px;
  background: #0d1117;
}

/* Shell full-bleed map canvas (overrides fixed 350px module height) */
#radioMap.app-map-canvas,
#radioMap.dispatcher-map__map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100% !important;
  min-height: 0;
  z-index: 1;
}

.dispatcher-map__status {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 12px 20px;
  background: rgba(13, 17, 23, 0.9);
  border: 1px solid #30363d;
  border-radius: 6px;
  color: #8b949e;
  font-size: 13px;
  z-index: 1000;
}

.dispatcher-map__status--error {
  color: #f85149;
}

.dispatcher-map__list-container {
  padding: 8px 10px;
  border-top: 1px solid #30363d;
  max-height: 200px;
  overflow-y: auto;
}

.dispatcher-map__list-title {
  margin: 0 0 6px 0;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #8b949e;
}

.dispatcher-map__alert-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.dispatcher-map__alert-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  padding: 4px 0;
  border-bottom: 1px solid #21262d;
  cursor: pointer;
}

.dispatcher-map__alert-item:last-child {
  border-bottom: none;
}

.dispatcher-map__alert-item:hover {
  background: #1c2128;
}

.dispatcher-map__severity-badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
}

.dispatcher-map__alert-type {
  font-weight: 600;
  font-size: 12px;
  color: #f0f6fc;
}

.dispatcher-map__alert-road {
  font-size: 12px;
  color: #8b949e;
}

.dispatcher-map__alert-desc {
  width: 100%;
  font-size: 11px;
  color: #6e7681;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dispatcher-map__alert-meta {
  width: 100%;
  display: flex;
  gap: 8px;
  font-size: 10px;
  color: #484f58;
}

.dispatcher-map__popup {
  font-family: inherit;
  font-size: 12px;
  color: #1c2128;
  max-width: 250px;
}

/* ── Traffic Alerts panel (U3) ─────────────────────────────────────── */
.cb-traffic-alerts {
  position: relative;
  width: 100%;
  max-width: 360px;
  margin: 8px auto;
  font-family: inherit;
  font-size: 13px;
  color: #c9d1d9;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 6px;
  overflow: hidden;
}

.cb-traffic-alerts__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: #0d1117;
  border-bottom: 1px solid #30363d;
}

.cb-traffic-alerts__toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: #c9d1d9;
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.cb-traffic-alerts__toggle:hover {
  color: #f0f6fc;
}

.cb-traffic-alerts__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: #4488ff;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
}

.cb-traffic-alerts__title {
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cb-traffic-alerts__refresh {
  background: none;
  border: 1px solid #30363d;
  color: #8b949e;
  border-radius: 4px;
  padding: 2px 6px;
  cursor: pointer;
  font-size: 14px;
}

.cb-traffic-alerts__refresh:hover {
  color: #c9d1d9;
  border-color: #8b949e;
}

.cb-traffic-alerts__list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 300px;
  overflow-y: auto;
}

.cb-traffic-alerts__item {
  display: flex;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid #21262d;
}

.cb-traffic-alerts__item:last-child {
  border-bottom: none;
}

.cb-traffic-alerts__severity {
  flex-shrink: 0;
  display: inline-block;
  width: 4px;
  min-height: 32px;
  border-radius: 2px;
}

.cb-traffic-alerts__content {
  flex: 1;
  min-width: 0;
}

.cb-traffic-alerts__type-line {
  display: flex;
  gap: 4px;
  align-items: baseline;
}

.cb-traffic-alerts__type {
  font-weight: 600;
  font-size: 12px;
  color: #f0f6fc;
}

.cb-traffic-alerts__road {
  font-size: 12px;
  color: #8b949e;
}

.cb-traffic-alerts__desc {
  font-size: 12px;
  color: #8b949e;
  margin-top: 2px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.cb-traffic-alerts__meta {
  display: flex;
  gap: 8px;
  margin-top: 3px;
  font-size: 11px;
  color: #6e7681;
}

.cb-traffic-alerts__empty,
.cb-traffic-alerts__loading,
.cb-traffic-alerts__error {
  padding: 12px 10px;
  text-align: center;
  color: #8b949e;
  font-size: 12px;
}

.cb-traffic-alerts__error {
  color: #f85149;
}

/* ── Traffic U4 Traveler Context ───────────────────────────────────── */
.cb-traveler-context {
  margin: 8px 0;
  padding: 10px 12px;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  color: #c9d1d9;
  font-size: 12px;
  max-width: 420px;
}

.cb-traveler-context__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 8px;
  user-select: none;
}

.cb-traveler-context[data-collapsed="true"] .cb-traveler-context__header {
  margin-bottom: 0;
}

.cb-traveler-context[data-collapsed="true"] .cb-traveler-context__controls,
.cb-traveler-context[data-collapsed="true"] .cb-traveler-context__body {
  display: none;
}

.cb-traveler-context__title {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #f0f6fc;
}

.cb-traveler-context__status {
  font-size: 11px;
  color: #8b949e;
}

.cb-traveler-context__controls {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.cb-traveler-context__btn {
  flex: 1;
  border: 1px solid #30363d;
  border-radius: 6px;
  background: #21262d;
  color: #f0f6fc;
  font-size: 12px;
  padding: 6px 8px;
  cursor: pointer;
}

.cb-traveler-context__btn:hover {
  background: #30363d;
}

.cb-traveler-context__btn--start {
  border-color: #238636;
}

.cb-traveler-context__btn--stop {
  border-color: #da3633;
}

.cb-traveler-context__body {
  display: grid;
  gap: 4px;
}

.cb-traveler-context__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.cb-traveler-context__key {
  color: #8b949e;
}

.cb-traveler-context__val {
  color: #e6edf3;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 240px;
}


/* Shell map chrome overlays the full-bleed #radioMap */
.app-map-chrome {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px;
  gap: 8px;
}

.app-map-chrome__header,
.app-map-chrome .dispatcher-map__status,
.app-map-chrome__side {
  pointer-events: auto;
}

.app-map-chrome .dispatcher-map__status {
  position: static;
  top: auto;
  left: auto;
  transform: none;
  align-self: flex-start;
  margin: 0;
  padding: 6px 10px;
  font-size: 12px;
}

.app-map-chrome .dispatcher-map__status[hidden] {
  display: none !important;
}

.app-map-chrome__header {
  /*
   * Top-RIGHT at every width. Leaflet renders its zoom control in the
   * top-left (.leaflet-top .leaflet-left), and this chip has
   * pointer-events:auto, so at flex-start its box sat directly over the
   * zoom-in button and swallowed the click — verified by hit test on
   * desktop, where elementFromPoint over zoom-in returned
   * .dispatcher-map__title. The compact breakpoint already moved it; the
   * overlap is geometric, not viewport-specific, so it belongs here.
   */
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(11, 14, 19, 0.88);
  border: 1px solid rgba(0, 229, 255, 0.22);
  backdrop-filter: blur(8px);
}

.app-map-chrome__side {
  align-self: flex-end;
  width: min(300px, 92%);
  max-height: min(48%, 380px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.app-map-chrome .dispatcher-map__list-container,
.app-map-chrome #travelerContextContainer,
.app-map-chrome #trafficAlertContainer {
  background: rgba(11, 14, 19, 0.9);
  border: 1px solid rgba(0, 229, 255, 0.16);
  border-radius: 10px;
  padding: 8px 10px;
  backdrop-filter: blur(8px);
}

.app-map-chrome #travelerContextContainer:empty,
.app-map-chrome #trafficAlertContainer:empty {
  display: none;
}

/* Fit feature-branch panels inside chrome side rail */
.app-map-chrome .cb-traffic-alerts,
.app-map-chrome .cb-traveler-context {
  margin: 0;
  max-width: none;
  width: 100%;
}

.app-map-chrome .dispatcher-map__map {
  /* Map canvas is #radioMap — not nested inside chrome */
  display: none;
}

@media (max-width: 1023.98px) {
  /* Explicit fill so Safari keeps a non-zero Leaflet container after tab switches */
  .app-panel--map {
    position: absolute !important;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
  }

  #radioMap.app-map-canvas,
  #radioMap.dispatcher-map__map {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    min-height: 120px;
  }

  /* Active map panel must stay fully opaque for WebKit tile compositing */
  .app-shell[data-active-tab="map"] .app-panel--map {
    opacity: 1;
    visibility: visible;
  }

  /*
   * Side chrome must not steal map taps in empty flex space.
   * Full-width pointer-events:auto blocked tap-to-set destination on iPhone.
   */
  .app-map-chrome__side {
    width: min(100%, 320px);
    max-height: none;
    overflow: visible;
    pointer-events: none;
    gap: 8px;
  }

  .app-map-chrome__side > * {
    pointer-events: auto;
  }

  /* Hide empty alert list chrome so the map stays the primary surface */
  .app-map-chrome .dispatcher-map__list-container:has(#dispatcherAlertList:empty) {
    display: none;
  }

  /* align-self now lives on the base rule — the zoom overlap is not
     viewport-specific. Compact only needs the tighter padding. */
  .app-map-chrome__header {
    padding: 5px 8px;
  }

  /* Reachable tap targets on touch: refresh button and Leaflet zoom */
  .app-map-chrome__header .dispatcher-map__refresh {
    min-width: 40px;
    min-height: 40px;
  }

  #radioMap .leaflet-bar a {
    width: 40px;
    height: 40px;
    line-height: 40px;
  }
}

/* -------------------------------------------------------------------------- */
/* Radio location: setup panel, readiness beside PTT, map pin placement        */
/* -------------------------------------------------------------------------- */

.app-location-setup {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  z-index: 30;
  max-height: calc(100% - 16px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  box-sizing: border-box;
  padding: 16px;
  border: 1px solid rgba(0, 229, 255, 0.35);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(22, 30, 41, 0.98), rgba(12, 16, 22, 0.98));
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  color: var(--text-primary, #e7e9ee);
}

.app-location-setup[hidden],
.app-location-placement[hidden],
.app-location-placement__fixed[hidden],
.app-radio-readiness[hidden] {
  display: none !important;
}

.app-location-setup__title,
.app-location-placement__title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
  color: var(--app-neon-cyan);
}

.app-location-setup__title:focus,
.app-location-placement__title:focus {
  outline: none;
}

.app-location-setup__title:focus-visible,
.app-location-placement__title:focus-visible {
  outline: 2px solid var(--app-neon-cyan);
  outline-offset: 2px;
}

.app-location-setup__lead,
.app-location-setup__status,
.app-location-setup__detail,
.app-location-setup__help,
.app-location-placement__hint,
.app-location-placement__detail {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.45;
}

.app-location-setup__status,
.app-location-setup__detail,
.app-location-placement__detail {
  color: var(--text-secondary, #aab0bd);
}

.app-location-setup__help {
  padding: 8px 10px;
  border-left: 3px solid #f0b429;
  background: rgba(240, 180, 41, 0.1);
  color: #ffe2a8;
}

.app-location-setup__mode {
  margin: 0 0 12px;
  padding: 8px 10px;
  border: 1px solid var(--app-chrome-border);
  border-radius: 10px;
}

.app-location-setup__mode-legend {
  padding: 0 4px;
  font-size: 12px;
  color: var(--text-secondary, #aab0bd);
}

.app-location-setup__mode-option {
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: flex-start;
  min-height: var(--app-touch-min);
  padding: 6px 0;
  font-size: 14px;
  line-height: 1.35;
}

.app-location-setup__mode-option input,
.app-location-placement__fixed input {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  padding: 0;
}

.app-location-setup__actions,
.app-location-placement__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.app-location-setup__actions .cb-btn,
.app-location-placement__actions .cb-btn {
  flex: 1 1 auto;
  min-height: var(--app-touch-min);
  text-transform: none;
  letter-spacing: 0;
}

.cb-btn--quiet {
  background: transparent;
  color: var(--text-secondary, #aab0bd);
  border-color: transparent;
  text-decoration: underline;
}

.app-radio-readiness {
  flex: 1 1 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid rgba(240, 180, 41, 0.55);
  border-radius: 10px;
  background: rgba(240, 180, 41, 0.12);
  color: #ffd89a;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.app-radio-readiness__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.app-radio-readiness[data-state="ready"] {
  border-color: rgba(0, 208, 132, 0.5);
  background: rgba(0, 208, 132, 0.1);
  color: #b8ffdb;
}

.app-radio-readiness[data-state="rejected"],
.app-radio-readiness[data-state="location-error"] {
  border-color: rgba(255, 92, 92, 0.55);
  background: rgba(255, 92, 92, 0.12);
  color: #ffb0b0;
}

.app-ptt-dock:has(.app-radio-readiness:not([hidden])),
.app-ptt-dock:has(.cb-station-location:not([hidden])) {
  flex-wrap: wrap;
}

.cb-link-pill[data-state="standby"],
.cb-meter__quiet-pill[data-state="standby"] {
  border-color: rgba(240, 180, 41, 0.32);
  background: rgba(240, 180, 41, 0.12);
  color: #ffd89a;
}

.app-location-placement {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  z-index: 1100;
  max-height: calc(100% - 16px);
  overflow: auto;
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1px solid rgba(0, 229, 255, 0.35);
  border-radius: 12px;
  background: rgba(14, 19, 26, 0.96);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
  color: var(--text-primary, #e7e9ee);
}

.app-location-placement__fixed {
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: center;
  min-height: var(--app-touch-min);
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--text-primary, #e7e9ee);
}

#radioMap[data-placing="true"] {
  cursor: crosshair;
}

/* While a pin is being placed the map is for that alone. */
.app-panel--map[data-location-placing="true"] .app-map-chrome {
  display: none;
}

.dispatcher-map__station-pin {
  background: transparent;
  border: none;
}

.dispatcher-map__station-pin-head {
  position: absolute;
  left: 4px;
  top: 2px;
  width: 20px;
  height: 20px;
  border: 3px solid #ffffff;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.dispatcher-map__station-pin--active .dispatcher-map__station-pin-head {
  background: #00d084;
}

.dispatcher-map__station-pin--proposal .dispatcher-map__station-pin-head {
  background: #ffb020;
}

.dispatcher-map__station-pin--placement .dispatcher-map__station-pin-head {
  background: #2b6fff;
}

.cb-location-summary {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 8px 0;
}

.cb-location-summary__line {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-secondary, #aab0bd);
}

/* Station location above PTT: the accepted station only. */
.cb-station-location {
  flex: 1 1 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  column-gap: 8px;
  row-gap: 0;
  min-width: 0;
  max-width: 100%;
  min-height: 32px;
  margin: 0;
  padding: 4px 10px;
  border: 1px solid rgba(0, 229, 255, 0.22);
  border-radius: 10px;
  background: rgba(0, 229, 255, 0.05);
  color: var(--text-secondary, #aab0bd);
  font: inherit;
  font-size: 12px;
  line-height: 1.35;
  text-align: center;
  cursor: pointer;
}

.cb-station-location[hidden],
.app-station-details[hidden],
.app-location-recovery[hidden],
.app-location-recovery [hidden] {
  display: none !important;
}

.cb-station-location__place {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
  color: var(--text-primary, #e7e9ee);
}

.cb-station-location__mode {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cb-station-location[data-tone="warn"] {
  border-color: rgba(240, 180, 41, 0.45);
  background: rgba(240, 180, 41, 0.08);
}

.cb-station-location[data-tone="warn"] .cb-station-location__mode {
  color: #ffd89a;
}

/* Desktop: one line in the header, beside the link status. */
.app-header__station {
  display: flex;
  min-width: 0;
}

.app-header .cb-station-location {
  flex: 0 1 auto;
  flex-wrap: nowrap;
  max-width: min(38vw, 440px);
  min-height: 30px;
  padding: 2px 10px;
}

.cb-station-location:focus-visible {
  outline: 2px solid var(--app-neon-cyan);
  outline-offset: 2px;
}

.app-station-details {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  z-index: 29;
  max-height: calc(100% - 16px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  box-sizing: border-box;
  padding: 16px;
  border: 1px solid rgba(0, 229, 255, 0.35);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(22, 30, 41, 0.98), rgba(12, 16, 22, 0.98));
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  color: var(--text-primary, #e7e9ee);
}

.app-station-details__title {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
  color: var(--app-neon-cyan);
}

.app-station-details__title:focus {
  outline: none;
}

.app-station-details__rows {
  display: grid;
  grid-template-columns: minmax(96px, max-content) 1fr;
  gap: 6px 12px;
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.4;
}

.app-station-details__rows dt {
  color: var(--text-secondary, #aab0bd);
}

.app-station-details__rows dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.app-station-details__note {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--text-secondary, #aab0bd);
}

.app-location-recovery {
  margin: 0 0 12px;
}

.app-location-recovery__options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.app-location-recovery__option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: var(--app-touch-min);
  padding: 10px 12px;
  border: 1px solid var(--app-chrome-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary, #e7e9ee);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.app-location-recovery__option strong {
  font-size: 15px;
}

.app-location-recovery__option span {
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-secondary, #aab0bd);
}

.app-location-recovery__option:hover,
.app-location-recovery__option:focus-visible {
  border-color: rgba(0, 229, 255, 0.55);
}

.app-location-recovery__tips {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-secondary, #aab0bd);
}

.app-location-recovery__tips summary {
  min-height: var(--app-touch-min);
  display: flex;
  align-items: center;
  cursor: pointer;
  color: var(--text-primary, #e7e9ee);
}

.app-location-recovery__tips ul {
  margin: 0;
  padding-left: 20px;
}

.app-location-share__steps {
  margin: 0 0 10px;
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.45;
}

.app-location-share__qr {
  width: min(220px, 70vw);
  margin: 0 auto 10px;
  padding: 0;
  border-radius: 8px;
  background: #ffffff;
}

.app-location-share__qr svg {
  display: block;
  width: 100%;
  height: auto;
}

.app-location-share__alt,
.app-location-share__status {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.45;
}

.app-location-share__link {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}

.app-location-share__code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 20px;
  letter-spacing: 0.08em;
  color: var(--app-neon-cyan);
  white-space: nowrap;
}

.app-location-declare__text {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.45;
}

.app-location-declare__ack {
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: flex-start;
  min-height: var(--app-touch-min);
  font-size: 14px;
  line-height: 1.4;
}

.app-location-declare__ack input {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
}

@media (min-width: 1024px) {
  .app-location-setup {
    left: 50%;
    right: auto;
    width: min(560px, calc(100% - 16px));
    transform: translateX(-50%);
  }

  .app-station-details {
    left: 50%;
    right: auto;
    width: min(560px, calc(100% - 16px));
    transform: translateX(-50%);
  }
}
