/* ================================================================
   Broadcast Dark Theme — Studio Dashboard
   Inspired by RCS Zetta / Dalet broadcast software conventions.
   Cosmetic-only. All selectors preserved from original.
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  --primary:   #e05c00;
  --secondary: #7c4dff;
  --bg:        #111118;
  --card:      #1a1a2e;
  --card-alt:  #16213e;
  --text:      #e0e0e0;
  --muted:     #8a8aaa;
  --border:    rgba(255,255,255,0.07);
  --shadow:    0 4px 18px rgba(0,0,0,0.45);
  --radius:    6px;

  /* Status colors */
  --status-ready:   #00c853;
  --status-started: #ffab00;
  --status-error:   #ff1744;
  --status-paused:  #7c4dff;

  /* Monospace font for time/status displays */
  --mono: 'JetBrains Mono', 'Source Code Pro', 'Fira Mono', monospace;
}

* { box-sizing: border-box; }
html, body { overflow-x: clip; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.wrap { max-width: 1160px; margin: 0 auto; padding: 16px 14px 40px; }

/* ── Topbar ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 14px;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand img {
  height: 72px;
  width: auto;
  border-radius: 6px;
  background: #0d0d1a;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.headerRight {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  min-width: 0;
}

.headerTitle {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.02em;
  text-align: right;
  line-height: 1.05;
  color: var(--text);
}

.titleBlock h1 {
  font-size: 28px;
  line-height: 1.05;
  margin: 0;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.titleBlock .underline {
  height: 4px;
  width: 140px;
  margin-top: 6px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.subtitle { margin-top: 6px; color: var(--muted); font-size: 13px; }

/* ── Mode toggle ── */
.toggleCard {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
}

.pill {
  font-weight: 700;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  color: var(--muted);
  letter-spacing: 0.06em;
  font-family: var(--mono);
}

.pill.auto  { color: var(--text); }
.pill.hybrid { color: var(--secondary); }

.switch {
  position: relative;
  width: 46px;
  height: 26px;
  background: rgba(255,255,255,0.10);
  border-radius: 999px;
  border: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}

.knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--muted);
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  transition: transform 180ms ease, background 180ms ease;
}

.switch.on {
  background: var(--secondary);
  border-color: var(--secondary);
}
.switch.on .knob {
  transform: translateX(20px);
  background: #fff;
}

/* ── Grid ── */
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.grid > * { min-width: 0; }

@media (max-width: 980px) {
  .grid { grid-template-columns: 1fr; }
  .brand { min-width: 0; }
}

@media (max-width: 640px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }
  .brand { justify-content: center; }
  .brand img { height: 56px; }
  .headerRight { align-items: center; }
  .headerTitle { text-align: center; }
  .toggleCard { width: 100%; justify-content: center; gap: 6px; padding: 8px; }
  .pill { font-size: 10px; padding: 4px 7px; }
  .switch { width: 40px; height: 24px; }
  .knob { width: 16px; height: 16px; }
  .switch.on .knob { transform: translateX(16px); }
  .formatCard { grid-template-columns: 100px minmax(0, 1fr); }
  .formatArt { width: 100px; height: 100px; }
  .select { width: 100%; }
  .voiceRow { flex-direction: column; align-items: stretch; }
  .statusRow { flex-direction: column; align-items: flex-start; }
  .statusRow .statusText:last-child { text-align: left; width: 100%; }
}

/* ── Card ── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 10px;
  min-width: 0;
  /* Status left-accent band: updated by :has() based on stageTag data-status */
  border-left: 3px solid transparent;
  transition: border-left-color 400ms ease;
}

/* Status left-accent bands using :has() + data-status set by MutationObserver */
.card:has(.stageTag[data-status="ready"])   { border-left-color: var(--status-ready); }
.card:has(.stageTag[data-status="started"]) { border-left-color: var(--status-started); }
.card:has(.stageTag[data-status="error"])   { border-left-color: var(--status-error); }
.card:has(.stageTag[data-status="paused"])  { border-left-color: var(--status-paused); }

.card h2 {
  margin: 0;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--text);
}

.muted { color: var(--muted); font-size: 12px; }

/* ── Status row ── */
.statusRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

/* ── Stage tag ── */
.stageTag {
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 3px;
  color: #000;
  background: var(--muted);
  font-family: var(--mono);
  text-transform: uppercase;
  transition: background 300ms ease, color 300ms ease;
}

/* State-conditional stageTag colors via data-status attribute (set by MutationObserver) */
.stageTag[data-status="ready"]   { background: var(--status-ready);   color: #000; }
.stageTag[data-status="started"] { background: var(--status-started);  color: #000; }
.stageTag[data-status="error"]   { background: var(--status-error);    color: #fff; }
.stageTag[data-status="paused"]  { background: var(--status-paused);   color: #fff; }

/* ── Status text ── */
.statusText {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
}

.statusRow .statusText:last-child { text-align: right; flex: 1 1 auto; }

/* ── Error box ── */
.errorBox {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid rgba(255,23,68,0.35);
  background: rgba(255,23,68,0.12);
  color: #ff6b8a;
  font-size: 12px;
  font-family: var(--mono);
  display: none;
}

/* ── Format card ── */
.formatCard {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card-alt);
  min-width: 0;
}

.formatCard > div { min-width: 0; }

.formatArt {
  width: 120px;
  height: 120px;
  border-radius: var(--radius);
  background: #0d0d1a;
  border: 1px solid var(--border);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.04), 0 4px 12px rgba(0,0,0,0.4);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.formatArt img { width: 100%; height: 100%; object-fit: cover; }

.formatHead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.formatHead > div { min-width: 0; flex: 1 1 auto; }
.formatName { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.formatHead .stageTag { flex: 0 0 auto; margin-left: auto; }

.formatName {
  font-size: 15px;
  font-weight: 900;
  margin: 1px 0 2px;
  color: var(--text);
  letter-spacing: -0.01em;
}

/* ── Button row ── */
.btnRow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.btnRow > * { min-width: 0; }

/* ── Buttons ── */
.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius);
  padding: 8px 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 12px;
  background: rgba(255,255,255,0.07);
  color: var(--text);
  border: 1px solid var(--border);
  transition: background 150ms ease, opacity 150ms ease;
}

.btn:hover:not(:disabled) { background: rgba(255,255,255,0.12); }

.btn.primary {
  color: #000;
  background: var(--status-started);
  border-color: var(--status-started);
}
.btn.primary:hover:not(:disabled) { background: #ffc107; border-color: #ffc107; }

.btn.secondary {
  color: var(--text);
  background: rgba(255,255,255,0.09);
  border: 1px solid var(--border);
}

.btn.danger {
  color: #fff;
  background: rgba(255,23,68,0.25);
  border-color: rgba(255,23,68,0.45);
}
.btn.danger:hover:not(:disabled) { background: rgba(255,23,68,0.40); }

/* Cancel button: red-tinted when enabled */
#cancelRunBtn:not(:disabled) {
  color: #fff;
  background: rgba(255,23,68,0.25);
  border-color: rgba(255,23,68,0.45);
}
#cancelRunBtn:not(:disabled):hover { background: rgba(255,23,68,0.40); }

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

.linkBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

/* ── Select / Input ── */
.select {
  appearance: none;
  padding: 7px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font-weight: 600;
  font-size: 12px;
  box-sizing: border-box;
  max-width: 100%;
  min-width: 0;
}

.select:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 2px rgba(124,77,255,0.25);
}

/* cfUrl input shares .select style */
input#cfUrl {
  appearance: none;
  padding: 7px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font-size: 12px;
  box-sizing: border-box;
}

input#cfUrl::placeholder { color: var(--muted); }
input#cfUrl:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 2px rgba(124,77,255,0.25);
}

/* Custom range (scrub/volume) styling */
input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.15);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--status-started);
  cursor: pointer;
  border: none;
  box-shadow: 0 0 4px rgba(255,171,0,0.6);
}

input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--status-started);
  cursor: pointer;
  border: none;
}

/* ── HYBRID Editor ── */
.editor {
  margin-top: 10px;
  padding: 10px;
  border-radius: var(--radius);
  border: 1px solid rgba(124,77,255,0.35);
  background: rgba(124,77,255,0.06);
  display: none;
}

.editor h3 { margin: 0 0 4px; font-size: 13px; letter-spacing: -0.01em; color: var(--text); }

textarea {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  border-radius: var(--radius);
  border: 1px solid rgba(124,77,255,0.30);
  padding: 10px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
  background: rgba(0,0,0,0.35);
  color: var(--text);
  box-sizing: border-box;
}

textarea:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 2px rgba(124,77,255,0.30);
}

textarea::placeholder { color: var(--muted); }

.smallTextArea { min-height: 90px; }

/* ── Footer links ── */
.footerLinks { margin-top: 10px; display: flex; gap: 10px; flex-wrap: wrap; }
.footerLinks a { color: var(--status-started); font-weight: 700; text-decoration: none; font-size: 12px; }
.footerLinks a:hover { text-decoration: underline; }

/* ── Station Clock ── */
.stationClock {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 20px 10px;
  background: #0a0a0f;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.7), 0 1px 4px rgba(0,0,0,0.5);
}
.clockLabel {
  font-family: 'Inter', sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #555;
  margin-bottom: 4px;
}
.clockTime {
  font-family: 'DSEG7-Modern-MINI', monospace;
  font-weight: bold;
  font-size: 52px;
  line-height: 1;
  letter-spacing: 0.04em;
  color: #ffffff;
  text-shadow: 0 0 3px rgba(255,255,255,0.8), 0 0 10px rgba(255,255,255,0.4), 0 0 25px rgba(255,255,255,0.15);
}

/* ── Exigone Agent Logo ── */
.agentLogo {
  height: 48px;
  width: auto;
  border-radius: 6px;
  background: #0d0d1a;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  margin-left: 6px;
}

/* ── Live Stream Bar ── */
.streamBar {
  margin-top: 6px;
  width: 100%;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.streamEmbed {
  width: 100%;
  height: 150px;
  border: none;
  display: block;
  background: var(--bg);
}

@media (max-width: 640px) {
  .stationClock { padding: 8px 14px 6px; }
  .clockTime { font-size: 32px; }
  .agentLogo { height: 36px; }
  .streamEmbed { height: 150px; }
}

/* ── Global WaveSurfer Player Bar ── */
.globalPlayerBar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  padding: 8px 12px;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  min-width: 0;
}

.globalPlayPause {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  border: 1px solid rgba(0,200,83,0.4);
  background: rgba(0,200,83,0.15);
  color: var(--status-ready);
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  transition: background 150ms ease;
}
.globalPlayPause:hover { background: rgba(0,200,83,0.28); }

.globalPlayerLabel {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.globalWaveform {
  flex: 1;
  min-width: 0;
  height: 48px;
  overflow: hidden;
}

.globalPlayerTime {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
}

/* ── Card Play Button ── */
.cardPlayBtn {
  border: 1px solid rgba(0,200,83,0.4);
  background: rgba(0,200,83,0.12);
  color: var(--status-ready);
}
.cardPlayBtn:hover:not(:disabled) { background: rgba(0,200,83,0.25); }

/* ── Native Live Stream Player Bar ── */
.livePlayerBar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  padding: 8px 14px;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  min-width: 0;
  min-height: 88px;
}

.liveArt {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 4px;
  object-fit: cover;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
}

.liveMeta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.liveTopRow {
  display: flex;
  align-items: center;
  gap: 6px;
}

.liveStationName {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.liveBadge {
  flex-shrink: 0;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: #fff;
  background: #d32f2f;
  border-radius: 3px;
  padding: 1px 5px;
  line-height: 1.5;
}

.liveNowPlayingWrap {
  overflow: hidden;
  white-space: nowrap;
  min-width: 0;
}

.liveNowPlaying {
  display: inline-block;
  font-size: 12px;
  color: var(--text);
  font-family: var(--mono);
  white-space: nowrap;
}

.liveNowPlaying.marqueeActive {
  animation: marquee linear infinite;
}

@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-100%); }
}

.livePlayBtn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  border: 1px solid rgba(224,92,0,0.5);
  background: rgba(224,92,0,0.18);
  color: var(--primary);
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  transition: background 150ms ease;
}
.livePlayBtn:hover { background: rgba(224,92,0,0.32); }

/* ── Responsive: global player + live bar ── */
@media (max-width: 640px) {
  .globalPlayerBar {
    flex-wrap: wrap;
    gap: 8px;
  }
  .globalWaveform { min-width: 100%; order: 3; }
  .globalPlayerTime { order: 4; }
  .liveArt { width: 56px; height: 56px; }
  .liveStationName { max-width: 80px; }
}

/* ── Package Page — migrated from inline style in package.py ── */
.item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.item:last-child {
  border-bottom: none;
}
.name {
  font-weight: 800;
  font-size: 13px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.item .row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.statusLine {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}
.select {
  appearance: none;
  padding: 10px 12px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--card-alt);
  color: var(--text);
  font-weight: 800;
  font-size: 13px;
}

/* ── Health Bar ── */
#stationHealthBar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px 14px;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-wrap: wrap;
  min-height: 24px;
}
#stationHealthBar:empty { display: none; }
.healthOk  { color: var(--status-ready); }
.healthWarn { color: var(--status-error); }
.healthMuted { color: var(--muted); }
.healthSep { color: var(--border); margin: 0 2px; }
.healthAlarmLink {
  color: var(--status-error);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 11px;
}
.healthAlarmLink:hover { text-decoration: underline; }

/* ── Card empty state ── */
.cardEmptyState {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
  letter-spacing: 0.04em;
  margin-left: 8px;
}

/* ── Dashboard hub (/dashboard index) ── */
.hub-station-card.station-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s;
}
.hub-station-card.station-card:hover {
  border-color: var(--muted);
}
.hub-card-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}
.hub-card-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.hub-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
}
.hub-card-caption {
  font-size: 0.75rem;
  color: var(--muted);
  font-family: var(--mono);
}
.hub-new-station-card {
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-height: 5.5rem;
  gap: 0.35rem;
}
.hub-new-station-plus {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
  color: var(--muted);
}
.hub-new-station-label {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── /admin/users draft actions ── */
.draft-action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
}
.draft-open-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
}
.draft-open-link:hover {
  color: var(--text);
}
.btn-draft-delete {
  background: var(--card);
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
}
.btn-draft-delete:hover {
  color: var(--text);
  border-color: var(--muted);
}
.draft-delete-error {
  margin: 0.35rem 0 0 0;
  font-size: 0.8rem;
  color: var(--status-error);
}

/* ── Chrome helpers (chrome.py render_topbar / render_footer) ── */
.chrome-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.65rem 1.25rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  flex-wrap: nowrap;
  position: sticky;
  top: 0;
  z-index: 500;
}

.chrome-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 1 auto;
  min-width: 0;
}

.chrome-topbar-spacer {
  flex: 1 1 auto;
  min-width: 0;
  height: 1px;
}

.chrome-logo-link { display: flex; align-items: center; flex-shrink: 0; }
.chrome-logo { height: 48px; width: auto; }

.chrome-page-title {
  flex: 0 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--text);
}

.chrome-action-slot:empty {
  display: none;
}

/* Global nav strip */
.topbar-nav {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  flex-shrink: 0;
}
.topbar-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.topbar-nav a:hover { color: var(--text); }

/* Hamburger — hidden on desktop */
.topbar-hamburger {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
}

/* User identity + logout (desktop — mobile Logout lives in nav drawer) */
.chrome-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
  margin-left: 0.75rem;
  padding-left: 0.85rem;
  border-left: 1px solid var(--border);
}
.chrome-user-name {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 400;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chrome-logout-form { margin: 0; }
.chrome-logout-form--mobile-drawer {
  display: none;
}
.topbar-nav .chrome-logout-form--mobile-drawer {
  margin-top: 0.35rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  width: 100%;
  box-sizing: border-box;
}
.topbar-nav .chrome-logout-form--mobile-drawer .chrome-logout-btn {
  width: 100%;
  min-height: 44px;
}
.chrome-logout-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.28rem 0.65rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.75rem;
  font-family: inherit;
  white-space: nowrap;
}
.chrome-logout-btn:hover { color: var(--text); border-color: var(--muted); }

/* Shared page subtitle (hub section labels + alarms + admin child pages) */
.chrome-page-subtitle {
  font-size: 1.1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 1.5rem 0;
  color: var(--text);
}
.hub-content > .chrome-page-subtitle:not(:first-of-type) {
  margin-top: 1.5rem;
}

/* Status pill (cockpit + edit page) */
.stationStatusPill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(102,187,106,0.12);
  color: #66bb6a;
  border: 1px solid rgba(102,187,106,0.3);
  white-space: nowrap;
}
.stationStatusPill.offline {
  background: rgba(255,167,38,0.12);
  color: #ffa726;
  border-color: rgba(255,167,38,0.3);
}
.stationStatusPill.draft {
  background: rgba(144,164,174,0.12);
  color: var(--muted);
  border-color: rgba(144,164,174,0.3);
}

/* Admin ⋮ menu */
.adminMenuWrap { position: relative; flex-shrink: 0; }
.adminMenuBtn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 4px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  font-family: inherit;
}
.adminMenuBtn:hover { color: var(--text); border-color: var(--muted); }
.adminMenuDropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  min-width: 180px;
  z-index: 100;
  display: flex;
  flex-direction: column;
}
.adminMenuItem {
  background: transparent;
  border: none;
  color: var(--text);
  padding: 0.6rem 1rem;
  text-align: left;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  border-bottom: 1px solid var(--border);
}
.adminMenuItem:last-child { border-bottom: none; }
.adminMenuItem:hover { background: var(--bg); }

/* Station offline banner */
#stationOfflineBanner {
  background: rgba(255,167,38,0.10);
  border: 1px solid rgba(255,167,38,0.3);
  color: #ffa726;
  padding: 0.55rem 1rem;
  font-size: 0.85rem;
  border-radius: var(--radius);
  margin-bottom: 8px;
}

/* Hub redesign: live stations + drafts rows */
.hub-station-row {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1rem;
}
.hub-live-card, .hub-draft-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.hub-card-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
}
.hub-card-logo-sm {
  height: 36px;
  width: auto;
  border-radius: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.hub-card-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hub-card-id {
  font-size: 0.75rem;
  color: var(--muted);
  font-family: var(--mono);
}
.hub-status-dot {
  font-size: 0.85rem;
  flex-shrink: 0;
}
.hub-status-dot.live { color: #66bb6a; }
.hub-status-dot.offline { color: #ffa726; }
.hub-status-dot.draft { color: var(--muted); }
.hub-card-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.hub-draft-meta {
  font-size: 0.75rem;
  color: var(--muted);
  font-family: var(--mono);
}
.hub-new-tile {
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: border-color 0.15s, color 0.15s;
}
.hub-new-tile:hover { border-color: var(--muted); color: var(--text); }

/* Mobile chrome */
@media (max-width: 640px) {
  .chrome-topbar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 0.6rem 1rem;
  }
  .chrome-topbar-spacer {
    display: none;
  }
  .chrome-topbar-left {
    order: 1;
    flex: 1 1 auto;
    min-width: 0;
  }
  .chrome-page-title { font-size: 14px; }
  .topbar-hamburger {
    display: flex;
    order: 2;
    margin-left: auto;
  }
  .chrome-action-slot {
    order: 3;
    flex-basis: 100%;
    margin-top: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .topbar-hamburger {
    display: flex;
    order: 2;
    margin-left: auto;
  }
  .chrome-action-slot {
    order: 3;
    flex-basis: 100%;
    margin-top: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .chrome-user {
    display: none;
  }
  .chrome-logout-form--desktop {
    display: none !important;
  }
  .chrome-logout-form--mobile-drawer {
    display: block;
  }
  .topbar-nav {
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    width: 100%;
    flex-basis: 100%;
    order: 10;
    padding: 0.5rem 0 0 0;
    margin-top: 0.25rem;
    border-top: 1px solid var(--border);
  }
  .topbar-nav.open { display: flex; }
  .chrome-logo { height: 36px; }
}
