/* ── Utility ─────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Design tokens ───────────────────────────────────────────────────────── */
:root {
  --bg:          #0f0f0f;
  --sidebar-bg:  #1a1a1a;
  --surface:     #222222;
  --surface2:    #2a2a2a;
  --surface3:    #333333;
  --fg:          #f0f0f0;
  --fg-sub:      #888888;
  --fg-muted:    #444444;
  --accent:      #00c8d4;
  --accent-dim:  rgba(0,200,212,0.12);
  --accent-hover:#00b4be;
  --ok:          #22c55e;
  --warn:        #f59e0b;
  --alarm:       #ef4444;
  --disabled:    #555555;
  --border:      #2c2c2c;
  --radius:      6px;
  --sidebar-w:   216px;
  --header-h:    52px;
}

/* ── Base ────────────────────────────────────────────────────────────────── */
body {
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 13px;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── App shell ───────────────────────────────────────────────────────────── */
#app-shell {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.18s ease;
}
#sidebar.collapsed { width: 50px; }
#sidebar::-webkit-scrollbar { width: 3px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 3px; }

/* ── Sidebar logo / header ───────────────────────────────────────────────── */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 10px 12px 13px;
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
  flex-shrink: 0;
  gap: 6px;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  overflow: hidden;
  flex: 1;
}
.logo-mark {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  color: #000;
  flex-shrink: 0;
  letter-spacing: -0.01em;
}
.logo-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  letter-spacing: 0.01em;
}
#sidebar.collapsed .logo-text { display: none; }

.sidebar-collapse-btn {
  background: none;
  border: none;
  color: var(--fg-sub);
  padding: 4px 5px;
  cursor: pointer;
  font-size: 13px;
  border-radius: 4px;
  flex-shrink: 0;
  line-height: 1;
  transition: background 0.1s, color 0.1s;
}
.sidebar-collapse-btn:hover { background: var(--surface2); color: var(--fg); }
#sidebar.collapsed .sidebar-collapse-btn { margin: 0 auto; }

/* ── Sidebar section labels ──────────────────────────────────────────────── */
.sidebar-section {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--fg-sub);
  text-transform: uppercase;
  padding: 16px 14px 5px;
  white-space: nowrap;
  overflow: hidden;
  flex-shrink: 0;
}
#sidebar.collapsed .sidebar-section { visibility: hidden; height: 20px; padding: 10px 0 0; }

/* ── Sidebar nav ─────────────────────────────────────────────────────────── */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0 6px;
  flex-shrink: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: var(--radius);
  color: var(--fg-sub);
  cursor: pointer;
  font-size: 12.5px;
  text-decoration: none;
  transition: background 0.1s, color 0.1s;
  white-space: nowrap;
  overflow: hidden;
  user-select: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.nav-item:hover { background: var(--surface2); color: var(--fg); }
.sidebar-submenu { display:flex; flex-direction:column; padding:2px 0 4px 28px; }
.sidebar-submenu.hidden { display:none; }
.nav-subitem { background:none; border:none; color:var(--fg-sub); text-align:left; padding:5px 8px; font-size:12px; cursor:pointer; border-radius:var(--radius); width:100%; }
.nav-subitem:hover { background:var(--surface2); color:var(--fg); }
.submenu-sep { border:none; border-top:1px solid var(--border); margin:3px 0; }
.schedule-row { display:flex; align-items:center; gap:6px; padding:6px 0; border-bottom:1px solid var(--border); }
.schedule-days { display:flex; gap:4px; flex-shrink:0; }
.sched-day-lbl { display:flex; flex-direction:column; align-items:center; gap:2px; font-size:10px; color:var(--fg-sub); cursor:pointer; }
.sched-day-lbl input { accent-color:var(--accent); cursor:pointer; }
.sched-sep { font-size:11px; color:var(--fg-sub); white-space:nowrap; }
.sched-time { flex:1; min-width:128px; }
.sched-kind { display:flex; gap:8px; flex-shrink:0; }
.sched-kind-lbl { display:flex; align-items:center; gap:3px; font-size:11px; color:var(--fg-sub); cursor:pointer; white-space:nowrap; }
.sched-kind-lbl input { accent-color:var(--accent); cursor:pointer; }
.sched-del { background:none; border:none; color:var(--fg-sub); cursor:pointer; font-size:14px; padding:2px 4px; border-radius:var(--radius); flex-shrink:0; }
.sched-del:hover { color:var(--alarm); }
.schedule-tz-row { display:flex; align-items:center; gap:8px; padding:6px 0 8px; border-bottom:1px solid var(--border); margin-bottom:4px; }
.sched-tz-wrap { position:relative; flex:1; max-width:300px; }
.sched-tz-input { width:100%; box-sizing:border-box; background:var(--surface2); color:var(--fg); border:1px solid var(--border); border-radius:var(--radius); padding:3px 8px; font-size:12px; }
.sched-tz-input:focus { outline:none; border-color:var(--accent); }
.sched-tz-list { position:absolute; top:calc(100% + 2px); left:0; right:0; max-height:200px; overflow-y:auto; background:var(--surface2); border:1px solid var(--border); border-radius:var(--radius); z-index:1000; }
.sched-tz-item { padding:5px 8px; font-size:12px; cursor:pointer; color:var(--fg); }
.sched-tz-item:hover { background:var(--accent-dim); color:var(--accent); }
.sched-tz-item.selected { color:var(--accent); }
.nav-item.active, .nav-item.filter-pill.active {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 500;
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
}
.nav-ok-icon    { color: var(--ok); font-size: 8px; }
.nav-alarm-icon { color: var(--alarm); font-size: 8px; }
.nav-warn-icon  { color: var(--warn); font-size: 8px; }
.nav-dis-icon   { color: var(--disabled); font-size: 8px; }

.nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; color: #aaa; }
.nav-badge {
  font-size: 10px;
  font-weight: 600;
  background: var(--surface2);
  padding: 1px 6px;
  border-radius: 9px;
  color: var(--fg-sub);
  flex-shrink: 0;
}
.nav-item.active .nav-badge,
.nav-item.filter-pill.active .nav-badge { background: var(--accent-dim); color: var(--accent); }

#sidebar.collapsed .nav-label,
#sidebar.collapsed .nav-badge  { display: none; }
#sidebar.collapsed .nav-item   { justify-content: center; padding: 8px 0; }
#sidebar.collapsed .nav-icon   { width: 20px; height: 20px; font-size: 15px; }

.sidebar-spacer { flex: 1; }

.sidebar-bottom {
  padding: 8px 6px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex-shrink: 0;
}

/* ── Main area ───────────────────────────────────────────────────────────── */
#main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Header / top bar ────────────────────────────────────────────────────── */
header {
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 8px;
}
.page-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
}
.header-right { display: flex; gap: 6px; align-items: center; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
button {
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 12px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  transition: background 0.12s, border-color 0.12s;
  white-space: nowrap;
}
button:hover { background: var(--surface2); border-color: #3c3c3c; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: 600;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #000; }

/* ── Status bar ──────────────────────────────────────────────────────────── */
#status-bar {
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border);
  padding: 4px 16px;
  display: flex;
  gap: 20px;
  font-size: 11px;
  color: var(--fg-sub);
  flex-shrink: 0;
}
#stat-alarm { color: var(--alarm); }
.stat-clickable { cursor: pointer; user-select: none; }
.stat-clickable:hover { opacity: 0.8; }
#stat-alarm.filter-active { text-decoration: underline; font-weight: 600; }

/* ── Toolbar ─────────────────────────────────────────────────────────────── */
#toolbar-area {
  position: relative;
  flex-shrink: 0;
  height: 40px;
  border-bottom: 1px solid var(--border);
}
#filter-bar {
  position: absolute;
  inset: 0;
  background: var(--sidebar-bg);
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 8px;
}

/* ── Search input ────────────────────────────────────────────────────────── */
#search-name {
  width: 220px;
  padding: 4px 12px;
  font-size: 12px;
  font-family: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--fg);
  outline: none;
  transition: border-color 0.15s;
}
#search-name:focus { border-color: var(--accent); }
#search-name::placeholder { color: var(--fg-sub); }

/* ── Bulk action bar ─────────────────────────────────────────────────────── */
#bulk-bar {
  position: absolute;
  inset: 0;
  background: var(--surface);
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 6px;
  font-size: 12px;
  z-index: 2;
}
#bulk-bar.hidden { display: none; }
#bulk-count { color: var(--accent); font-weight: 600; margin-right: 4px; }

/* ── Stream table ────────────────────────────────────────────────────────── */
#stream-container { flex: 1; overflow-y: auto; }
#stream-table { width: 100%; border-collapse: collapse; }
#stream-table thead th {
  background: var(--sidebar-bg);
  color: var(--fg-sub);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
  white-space: nowrap;
}
#stream-table tbody tr { border-bottom: 1px solid var(--border); transition: background 0.08s; cursor: pointer; }
#stream-table tbody tr:hover              { background: rgba(255,255,255,0.02); }
#stream-table tbody tr.row-alarm          { background: rgba(239,68,68,0.06); }
#stream-table tbody tr.row-alarm:hover    { background: rgba(239,68,68,0.11); }
#stream-table tbody tr.row-pre-alarm      { background: rgba(234,179,8,0.06); }
#stream-table tbody tr.row-pre-alarm:hover{ background: rgba(234,179,8,0.11); }
#stream-table tbody tr.row-disabled       { opacity: 0.4; }
#stream-table tbody tr.row-selected       { background: rgba(0,200,212,0.09) !important; }
#stream-table td { padding: 6px 8px; vertical-align: middle; }

.col-check   { width: 28px; text-align: center; }
.col-dot     { width: 28px; text-align: center; }
.col-icon    { width: 28px; text-align: center; }
.col-name    { min-width: 150px; max-width: 260px; }
.col-meta    { min-width: 120px; max-width: 220px; font-size: 11px; color: var(--fg-sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-meters  { width: 130px; }
.col-dbfs    { width: 60px; text-align: right; font-variant-numeric: tabular-nums; }
.col-bitrate { width: 64px; text-align: right; font-variant-numeric: tabular-nums; }
.col-type    { width: 46px; text-align: center; }
.col-status  { width: 90px; }
.col-actions { width: 110px; text-align: right; white-space: nowrap; }

.col-name-sort { cursor: pointer; user-select: none; }
.col-name-sort:hover { color: var(--fg); }
#btn-name-sort { color: var(--fg-sub); }
#btn-name-sort.active { color: var(--accent); }

/* ── Stream cells ────────────────────────────────────────────────────────── */
.stream-name  { font-weight: 600; }
.stream-url   { font-size: 10px; color: var(--fg-sub); word-break: break-all; }
.stream-error { font-size: 10px; color: var(--alarm); word-break: break-all; }

.stream-pick-row {
  display: grid;
  grid-template-columns: 16px 1fr;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 3px;
  font-size: 12px;
  color: var(--fg);
  cursor: pointer;
  user-select: none;
}
.stream-pick-row:hover { background: rgba(0,200,212,0.07); }
.stream-pick-row input[type="checkbox"] { margin: 0; cursor: pointer; }
.stream-pick-row span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Tags ────────────────────────────────────────────────────────────────── */
.tag-badge {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--fg-sub);
  font-size: 9px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  margin: 1px 2px 0 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Status dot ──────────────────────────────────────────────────────────── */
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin: auto; }
.dot-ok         { background: var(--ok);    box-shadow: 0 0 5px var(--ok); }
.dot-alarming     { background: var(--alarm); box-shadow: 0 0 5px var(--alarm); animation: pulse 1s infinite; }
.dot-pre-alarming { background: var(--warn);  box-shadow: 0 0 5px var(--warn); animation: pulse 1.5s infinite; }
.dot-connecting   { background: var(--warn); }
.dot-stopped    { background: var(--fg-sub); }
.dot-disabled   { background: var(--disabled); }
.dot-error      { background: var(--alarm); }

@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.3; } }

/* ── VU meters ───────────────────────────────────────────────────────────── */
.vu-canvas     { display: block; }
.meters-pair   { display: flex; flex-direction: column; gap: 3px; padding: 2px 0; }
.meter-track-v { height: 8px; width: 100%; background: var(--surface2); border-radius: 3px; overflow: hidden; }
.meter-fill-v  { height: 100%; border-radius: 3px; min-width: 0; }
.m-green  { background: var(--ok); }
.m-yellow { background: var(--warn); }
.m-red    { background: var(--alarm); }
.dbfs-val    { color: var(--fg-sub); font-size: 12px; }
.bitrate-val { color: var(--fg-sub); font-size: 11px; }

/* ── Icon & row buttons ──────────────────────────────────────────────────── */
.icon-btn { background:none; border:none; padding:2px; cursor:pointer; border-radius:3px; display:inline-flex; align-items:center; justify-content:center; vertical-align:middle; }
.icon-btn:hover { background: var(--surface2); }
.icon-btn.icon-ok       { color: var(--ok); }
.icon-btn.icon-alarm    { color: var(--alarm); }
.icon-btn.icon-muted    { color: var(--fg-sub); opacity:0.5; }
.icon-btn.icon-disabled { color: var(--warn); }
.icon-btn.icon-enabled  { color: var(--fg-sub); opacity:0.35; }

.row-btn { background:none; border:1px solid var(--border); padding:3px 7px; font-size:11px; border-radius:4px; margin-left:3px; }
.row-btn:hover { background:var(--surface2); border-color:#3c3c3c; }
.sort-btn { background:none; border:1px solid var(--border); padding:2px 6px; font-size:11px; border-radius:4px; cursor:pointer; color:var(--fg-sub); }
.sort-btn:hover { background:var(--surface2); color:var(--fg); }
.sort-btn.active { border-color:var(--accent); color:var(--accent); }
#btn-freeze.active { background: #1a3a4a; border-color: #4fc3f7; color: #4fc3f7; }
#help-body h3 { font-size:12px; color:var(--fg-sub); margin:14px 0 4px; text-transform:uppercase; letter-spacing:.05em; }
#help-body ul { margin:0 0 4px 16px; padding:0; }
#help-body li { margin-bottom:3px; }
.row-btn.play-btn.active { background:var(--ok); border-color:var(--ok); color:#000; }

/* ── Player bar ──────────────────────────────────────────────────────────── */
#player-bar { background:var(--sidebar-bg); border-top:1px solid var(--border); padding:6px 16px; display:flex; align-items:center; gap:12px; flex-shrink:0; }
#player-bar.hidden { display:none; }
#player-info { display:flex; align-items:center; gap:8px; min-width:180px; }
#player-icon { color:var(--ok); font-size:14px; }
#player-name { font-weight:600; color:var(--fg); font-size:13px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:200px; }
#audio-el { flex:1; height:32px; }

/* ── Empty message ───────────────────────────────────────────────────────── */
#empty-msg { text-align:center; color:var(--fg-sub); padding:60px 20px; display:none; }

/* ── WS dot ──────────────────────────────────────────────────────────────── */
.ws-dot { width:8px; height:8px; border-radius:50%; display:inline-block; }
.ws-dot.connected    { background: var(--ok); }
.ws-dot.disconnected { background: var(--alarm); }

/* ── Dropdown ────────────────────────────────────────────────────────────── */
.dropdown { position:relative; display:inline-block; }
.dropdown-menu { position:absolute; top:calc(100% + 4px); right:0; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); min-width:172px; z-index:50; display:flex; flex-direction:column; padding:4px 0; box-shadow:0 8px 24px rgba(0,0,0,0.55); }
.dropdown-menu button { border:none; border-radius:0; text-align:left; padding:7px 14px; background:none; font-size:12px; color:var(--fg); }
.dropdown-menu button:hover { background:var(--surface2); }
.dropdown-menu hr { border:none; border-top:1px solid var(--border); margin:3px 0; }

/* ── Modals ──────────────────────────────────────────────────────────────── */
.modal { position:fixed; inset:0; background:rgba(0,0,0,0.72); display:flex; align-items:center; justify-content:center; z-index:100; }
.modal.hidden { display:none; }
.modal-box { background:var(--surface); border:1px solid var(--border); border-radius:10px; padding:24px; width:420px; max-height:90vh; overflow-y:auto; scrollbar-gutter:stable; display:flex; flex-direction:column; gap:8px; box-shadow:0 20px 60px rgba(0,0,0,0.65); }
.modal-box.wide { width:min(640px, 96vw); }
.modal-box.modal-users { width:min(680px,96vw); height:88vh; max-height:88vh; overflow-y:hidden; }
.modal-scroll-body { flex:1; overflow-y:auto; min-height:0; padding-right:2px; }
.modal-box h2 { font-size:15px; margin-bottom:4px; }
.modal-box h3 { font-size:12px; color:var(--fg-sub); margin-top:8px; }
.modal-box label { font-size:11px; color:var(--fg-sub); margin-top:4px; }
.modal-box input, .modal-box select { background:var(--surface2); color:var(--fg); border:1px solid var(--border); border-radius:var(--radius); padding:6px 8px; font-size:13px; font-family:inherit; width:100%; }
.modal-box input:focus, .modal-box select:focus { outline:none; border-color:var(--accent); }
.form-row { display:flex; gap:16px; flex-wrap:wrap; }
.form-row label { color:var(--fg); font-size:12px; display:flex; align-items:center; gap:5px; }
.modal-buttons { display:flex; gap:8px; margin-top:12px; justify-content:flex-end; }
.modal-buttons button { padding:7px 18px; font-size:13px; }
.modal-buttons button:first-child { background:var(--accent); border-color:var(--accent); color:#000; font-weight:600; }
.modal-buttons button:first-child:hover { background:var(--accent-hover); border-color:var(--accent-hover); }
.settings-grid { display:grid; grid-template-columns:160px 1fr; gap:6px 10px; align-items:center; }
.settings-grid label { font-size:12px; color:var(--fg); }

/* ── Preview tables ──────────────────────────────────────────────────────── */
.preview-table-wrap { max-height:260px; overflow-y:auto; overflow-x:auto; border:1px solid var(--border); border-radius:var(--radius); margin-top:8px; }
.preview-table { width:100%; border-collapse:collapse; font-size:12px; }
.preview-table th { background:var(--surface2); color:var(--fg-sub); padding:5px 8px; text-align:left; font-size:10px; text-transform:uppercase; letter-spacing:0.06em; position:sticky; top:0; white-space:nowrap; }
.col-resize-handle { position:absolute; right:0; top:0; bottom:0; width:6px; cursor:col-resize; z-index:2; }
.col-resize-handle:hover { background:var(--accent); opacity:0.4; }
.preview-table td { padding:4px 8px; border-bottom:1px solid var(--border); }
.preview-table .url-cell { font-size:10px; color:var(--fg-sub); word-break:break-all; }
.preview-table tr.dup-row td { color:var(--warn); }
.dup-badge { background:var(--warn); color:#000; font-size:9px; font-weight:700; padding:1px 5px; border-radius:3px; text-transform:uppercase; }
.badge-pending  { display:inline-block; background:#92400e; color:#fde68a; font-size:9px; font-weight:700; padding:1px 5px; border-radius:3px; text-transform:uppercase; letter-spacing:0.04em; margin-left:4px; vertical-align:middle; }
.badge-verified { display:inline-block; background:#14532d; color:#86efac; font-size:9px; font-weight:700; padding:1px 5px; border-radius:3px; text-transform:uppercase; letter-spacing:0.04em; margin-left:4px; vertical-align:middle; }
.modal-note { font-size:12px; color:var(--fg-sub); }

/* ── Login/verify overlays ───────────────────────────────────────────────── */
#verify-overlay { position:fixed; inset:0; background:var(--bg); display:flex; align-items:center; justify-content:center; z-index:300; }
#verify-overlay.hidden { display:none; }
.verify-ok  { color:var(--ok);    font-weight:600; }
.verify-err { color:var(--alarm); font-weight:600; }

#login-overlay { position:fixed; inset:0; background:var(--bg); display:flex; align-items:center; justify-content:center; z-index:200; }
#login-overlay.hidden { display:none; }

#forgot-overlay { position:fixed; inset:0; background:var(--bg); display:flex; align-items:center; justify-content:center; z-index:210; }
#forgot-overlay.hidden { display:none; }

#register-overlay { position:fixed; inset:0; background:var(--bg); display:flex; align-items:center; justify-content:center; z-index:210; }
#register-overlay.hidden { display:none; }

.login-box { background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:36px 32px; width:320px; display:flex; flex-direction:column; gap:10px; box-shadow:0 20px 60px rgba(0,0,0,0.6); }
.login-logo-row { display:flex; align-items:center; gap:10px; margin-bottom:4px; }
.login-logo-row .logo-mark { width:32px; height:32px; border-radius:7px; font-size:11px; }
.login-app-name { font-size:16px; font-weight:700; color:var(--fg); }
.login-box input { width:100%; background:var(--surface2); color:var(--fg); }
.login-box button { width:100%; padding:9px; font-size:14px; }
.login-error { color:var(--alarm); font-size:12px; }

/* ── Impersonation banner ────────────────────────────────────────────────── */
#impersonate-bar { background:#5b21b6; color:#fff; padding:5px 16px; display:flex; align-items:center; gap:12px; font-size:12px; flex-shrink:0; }
#impersonate-bar.hidden { display:none; }
#impersonate-bar button { background:rgba(255,255,255,0.14); border-color:rgba(255,255,255,0.25); color:#fff; font-size:11px; padding:3px 10px; }
#impersonate-bar button:hover { background:rgba(255,255,255,0.26); }

/* ── Tooltip ─────────────────────────────────────────────────────────────── */
#tip { position:fixed; z-index:9999; padding:5px 10px; background:rgba(18,18,18,0.96); color:rgba(220,220,220,0.9); font-size:0.72rem; border-radius:6px; border:1px solid rgba(255,255,255,0.07); pointer-events:none; white-space:nowrap; opacity:0; transition:opacity 0.12s ease; }

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width:10px; height:10px; }
::-webkit-scrollbar-track { background:var(--surface); border-radius:5px; }
::-webkit-scrollbar-thumb { background:var(--surface3); border-radius:5px; border:2px solid var(--surface); }
::-webkit-scrollbar-thumb:hover { background:#555; }
::-webkit-scrollbar-corner { background:var(--surface); }
* { scrollbar-width: auto; scrollbar-color: var(--surface3) var(--surface); }

/* ── Analytics ───────────────────────────────────────────────────────────── */

#analytics-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* Top bar with Back button + tabs */
.analytics-topbar {
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.btn-back {
  background: none;
  border: 1px solid var(--border);
  color: var(--fg-sub);
  border-radius: var(--radius);
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-back:hover { border-color: var(--accent); color: var(--accent); }

.atabs { display: flex; gap: 4px; }

.atab {
  background: none;
  border: 1px solid transparent;
  color: var(--fg-sub);
  border-radius: var(--radius);
  padding: 5px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.atab:hover { color: var(--fg); }
.atab.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* Section panels */
.asec {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.asec-toolbar {
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.asec-toolbar button {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--fg-sub);
  border-radius: var(--radius);
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}
.asec-toolbar button:hover { color: var(--fg); border-color: var(--accent); }

.asec-empty {
  padding: 32px;
  color: var(--fg-sub);
  text-align: center;
  font-style: italic;
}

/* Analytics table */
.atable-wrap { flex: 1; overflow-y: auto; }
.atable { width: 100%; border-collapse: collapse; }
.atable thead th {
  background: var(--sidebar-bg);
  padding: 8px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-sub);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
}
.atable tbody tr { border-bottom: 1px solid var(--border); }
.atable tbody tr:hover { background: var(--surface); }
.atable tbody td { padding: 7px 12px; font-size: 12px; color: var(--fg); }

/* ── Now Playing filters ──────────────────────────────────────────────────── */

.np-filters {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.np-filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.np-filter-group > label {
  font-size: 11px;
  color: var(--fg-sub);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.np-filter-group input[type="datetime-local"] {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: var(--radius);
  padding: 5px 8px;
  font-size: 12px;
  font-family: inherit;
}
.np-filter-group input[type="datetime-local"]:focus { outline: none; border-color: var(--accent); }

/* Station picker dropdown */
.sp-wrap { position: relative; }
.sp-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: var(--radius);
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 150px;
  text-align: left;
}
.sp-btn:hover { border-color: var(--accent); }
.sp-arrow { color: var(--fg-sub); font-size: 10px; margin-left: auto; }
.sp-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(0,0,0,0.5);
  max-height: 280px;
  overflow-y: auto;
  min-width: 220px;
  z-index: 200;
  padding: 4px 0;
}
.sp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 12px;
  color: var(--fg);
}
.sp-row:hover { background: var(--surface3); }
.sp-row input[type="checkbox"] { cursor: pointer; accent-color: var(--accent); flex-shrink: 0; }
.sp-search-row { padding: 6px 8px; cursor: default; }
.sp-search-row:hover { background: none; }
.sp-search { width: 100%; background: var(--surface3); border: 1px solid var(--border); border-radius: var(--radius); color: var(--fg); font-size: 12px; padding: 4px 8px; font-family: inherit; }
.sp-search:focus { outline: none; border-color: var(--accent); }

/* Sort pills */
.sort-pills { display: flex; gap: 4px; }
.spill {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--fg-sub);
  border-radius: var(--radius);
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
}
.spill.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.spill:hover { color: var(--fg); border-color: var(--fg-muted); }

/* Sortable table headers */
.th-sort {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.th-sort:hover { color: var(--accent); }
.sort-ind { color: var(--accent); font-size: 10px; }

/* Scatter plot legend */
.scatter-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 8px 0 2px;
  font-size: 11px;
  color: var(--fg-sub);
}
.scatter-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}
.scatter-legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Results toolbar (search + view toggle) */
.np-search-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.np-results-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 2;
}
#np-search {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: var(--radius);
  padding: 4px 8px;
  font-size: 12px;
  font-family: inherit;
  width: 180px;
}
#np-search:focus { outline: none; border-color: var(--accent); }
.np-result-count {
  font-size: 11px;
  color: var(--fg-sub);
  margin-left: auto;
  white-space: nowrap;
}
.analytics-exclude-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.np-exclude-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.excl-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--fg);
}
.excl-pill button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--fg-sub);
  font-size: 13px;
  line-height: 1;
  padding: 0 0 0 2px;
}
.excl-pill button:hover { color: var(--alarm); }

/* Graph button in table */
.btn-graph {
  background: none;
  border: 1px solid var(--border);
  color: var(--fg-sub);
  border-radius: var(--radius);
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-graph:hover { border-color: var(--accent); color: var(--accent); }

/* ── Now Playing body ──────────────────────────────────────────────────────── */

.np-body {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

.np-table-wrap {
  flex: 1;
  overflow-y: auto;
  min-width: 0;
}

/* ── Graph panel ──────────────────────────────────────────────────────────── */

.np-graph {
  width: 640px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: var(--surface);
}

.graph-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
  gap: 8px;
}
.graph-head span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.graph-close {
  background: none;
  border: none;
  color: var(--fg-sub);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius);
  flex-shrink: 0;
}
.graph-close:hover { color: var(--alarm); }

.graph-stat {
  padding: 6px 16px;
  font-size: 11px;
  color: var(--fg-sub);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.graph-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.graph-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-sub);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

#chart-dow  { width: 100%; height: 150px; display: block; }
#chart-hour { width: 100%; height: 150px; display: block; }
#chart-heat { display: block; }

.modal-graph-box {
  width: min(860px, 95vw);
  max-height: 90vh;
  overflow-y: auto;
  padding: 0;
  gap: 0;
}
.modal-graph-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── Spins section ──────────────────────────────────────────────────────────── */

.spins-body {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

.spins-list-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.spins-list-panel .atable-wrap,
.spins-list-panel #spins-table {
  flex: 1;
  overflow-y: auto;
  width: 100%;
}

/* Rank badge in spins table */
.spins-rank {
  font-variant-numeric: tabular-nums;
  color: var(--fg-sub);
  font-size: 11px;
}
.spins-rank-top { color: var(--accent); font-weight: 700; }

/* Spin count badge */
.spins-count {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--accent);
  text-align: right;
}

/* Hovered row highlight */
#spins-tbody tr.spins-active { background: var(--accent-dim) !important; }

/* Right panel: bubble chart */
.spins-bubble-panel {
  width: 604px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  background: var(--bg2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.spins-bubble-header {
  padding: 10px 16px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-height: 36px;
}

.spins-bubble-trackname {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.spins-bubble-stat {
  font-size: 11px;
  color: var(--fg-sub);
  white-space: nowrap;
  flex-shrink: 0;
}

.spins-bubble-canvas-wrap {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 16px;
}

.spins-bubble-placeholder {
  color: var(--fg-muted);
  font-size: 13px;
  margin: auto;
  display: none;
}

/* ── AI Rotation button ─────────────────────────────────────────────────────── */

.btn-rotation-ai {
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: var(--radius);
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn-rotation-ai:hover { background: var(--accent); color: #000; }
.btn-rotation-ai:disabled { opacity: .5; cursor: default; }
.ra-count-wrap { display:inline-flex; align-items:center; gap:4px; font-size:.8rem; color:var(--fg-sub); }
.ra-count-input { width:46px; padding:2px 4px; background:var(--input-bg,var(--bg2)); border:1px solid var(--border); border-radius:4px; color:var(--fg); font-size:.8rem; text-align:center; }
.ra-count-input:disabled { opacity:.4; }
.ra-all-label { display:inline-flex; align-items:center; gap:3px; cursor:pointer; }

/* ── Rotation Analysis Modal ─────────────────────────────────────────────────── */

.ra-modal {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(0,0,0,0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.ra-modal-content {
  background: var(--bg);
  border: 1px solid var(--accent);
  border-radius: 8px;
  width: 100%;
  max-width: 780px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 0 40px rgba(0,200,212,0.15);
}

.ra-modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  background: var(--surface);
  border-bottom: 2px solid var(--accent);
  flex-shrink: 0;
}

.ra-modal-title-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.ra-modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.06em;
}

.ra-modal-station {
  font-size: 11px;
  color: var(--fg-sub);
}

.ra-modal-status {
  font-size: 11px;
  color: var(--fg-sub);
}

.ra-modal-close {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--fg);
  font-size: 12px;
  cursor: pointer;
  padding: 6px 16px;
  border-radius: var(--radius);
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.ra-modal-close:hover { background: var(--surface3); color: var(--accent); border-color: var(--accent); }

.ra-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Section headers inside modal */
.ra-section-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* Key observations bullets */
.ra-observations-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ra-observations-list li {
  font-size: 12px;
  color: var(--fg);
  line-height: 1.5;
  padding-left: 14px;
  position: relative;
}
.ra-observations-list li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* Rotation structure table */
.ra-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.ra-table th {
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  color: var(--fg-sub);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}
.ra-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.ra-table tr:last-child td { border-bottom: none; }
.ra-table tr:hover td { background: var(--surface); }
.ra-table .ra-tier-name {
  font-weight: 600;
  color: var(--fg);
}
.ra-table .ra-tier-label {
  color: var(--accent);
  font-size: 11px;
}
.ra-table .ra-tier-artists {
  color: var(--fg-sub);
  font-size: 11px;
  font-style: italic;
}

.ra-narratives {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.ra-narrative {
  font-size: 12px;
  color: var(--fg);
  line-height: 1.6;
}

.ra-narrative strong { color: var(--fg); }
.ra-narrative em { color: var(--fg-sub); font-style: normal; }

.spins-ai-raw {
  font-size: 10px;
  color: var(--fg-sub);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  white-space: pre-wrap;
  overflow-x: auto;
}

.ra-email-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ra-email-form input[type="email"] {
  flex: 1;
  max-width: 320px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 5px 10px;
  border-radius: var(--radius);
  font-size: 12px;
}
.ra-email-form button {
  background: var(--accent);
  border: none;
  color: #000;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: var(--radius);
  cursor: pointer;
}
.ra-email-form button:hover { background: var(--accent-hover); }
.ra-email-status { font-size: 11px; color: var(--fg-sub); }

/* Shared report email panel (fixed bottom bar) */
.report-email-panel {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 800;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  background: var(--surface);
  border-top: 2px solid var(--accent);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.5);
  flex-wrap: wrap;
}
.report-email-panel .rep-title {
  font-size: 12px;
  color: var(--fg-sub);
  white-space: nowrap;
  flex-shrink: 0;
}
.report-email-panel input[type="email"] {
  flex: 1;
  max-width: 300px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 5px 10px;
  border-radius: var(--radius);
  font-size: 12px;
}
.report-email-panel .rep-send {
  background: var(--accent);
  border: none;
  color: #000;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: var(--radius);
  cursor: pointer;
}
.report-email-panel .rep-send:hover { background: var(--accent-hover); }
.report-email-panel .rep-close {
  background: none;
  border: none;
  color: var(--fg-sub);
  cursor: pointer;
  font-size: 15px;
  margin-left: auto;
  padding: 0 4px;
}
.report-email-panel .rep-close:hover { color: var(--fg); }
@media print {
  .report-email-panel { display: none !important; }
}

/* Scheduled reports */
.sched-toggle {
  width: 100%;
  background: none;
  border: none;
  color: var(--fg-sub);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  padding: 10px 16px;
  cursor: pointer;
  letter-spacing: 0.04em;
}
.sched-toggle:hover { color: var(--fg); }

.sched-list { padding: 0 16px 8px; display: flex; flex-direction: column; gap: 6px; }
.sched-empty { font-size: 12px; color: var(--fg-sub); font-style: italic; padding: 4px 0; }

.sched-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
}
.sched-disabled { opacity: 0.5; }
.sched-item-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sched-item-name { font-weight: 600; color: var(--fg); }
.sched-item-meta { color: var(--fg-sub); font-size: 11px; }
.sched-item-actions { display: flex; gap: 6px; flex-shrink: 0; }
.sched-action-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--fg-sub);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: var(--radius);
  cursor: pointer;
}
.sched-action-btn:hover { color: var(--fg); border-color: var(--fg-sub); }
.sched-del-btn:hover { color: var(--alarm); border-color: var(--alarm); }

.sched-form {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sched-form-title { font-size: 12px; font-weight: 600; color: var(--fg-sub); margin-bottom: 2px; }
.sched-row { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.sched-lbl { font-size: 11px; color: var(--fg-sub); width: 70px; flex-shrink: 0; padding-top: 4px; }
.sched-input {
  flex: 1;
  max-width: 400px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 4px 8px;
  border-radius: var(--radius);
  font-size: 12px;
  font-family: inherit;
}
.sched-radios { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--fg); align-items: center; }
.sched-radios label { display: flex; align-items: center; gap: 4px; cursor: pointer; }
.sched-custom-dates { display: flex; align-items: center; gap: 8px; margin-top: 6px; width: 100%; }
.sched-custom-dates input { background: var(--bg); border: 1px solid var(--border); color: var(--fg); padding: 3px 6px; border-radius: var(--radius); font-size: 12px; font-family: inherit; }
.sched-freq-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--fg); }
.sched-freq-row select, .sched-freq-row input[type="time"] {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 3px 6px;
  border-radius: var(--radius);
  font-size: 12px;
  font-family: inherit;
}
.sched-save-btn {
  background: var(--accent);
  border: none;
  color: #000;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 16px;
  border-radius: var(--radius);
  cursor: pointer;
}
.sched-save-btn:hover { background: var(--accent-hover); }

.ra-modal-email-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--fg-sub);
  font-size: 12px;
  cursor: pointer;
  padding: 6px 14px;
  border-radius: var(--radius);
  letter-spacing: 0.04em;
}
.ra-modal-email-btn:not(:disabled):hover { background: var(--surface3); color: var(--fg); border-color: var(--fg-sub); }
.ra-modal-email-btn:disabled { opacity: 0.35; cursor: default; }

/* Tier song expand rows */
.ra-tier-expand { cursor: pointer; user-select: none; }
.ra-tier-expand:hover td { background: var(--surface2); }
.ra-tier-expand td:first-child::before { content: '▶ '; font-size: 9px; color: var(--accent); }
.ra-tier-expand.open td:first-child::before { content: '▼ '; }
.ra-tier-songs-row td {
  padding: 0 !important;
  background: var(--surface) !important;
}
.ra-tier-songs-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 2px 16px;
  padding: 8px 16px 12px;
  font-size: 11px;
  color: var(--fg-sub);
}
.ra-tier-songs-list span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ra-modal-print {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--fg-sub);
  font-size: 12px;
  cursor: pointer;
  padding: 6px 14px;
  border-radius: var(--radius);
  letter-spacing: 0.04em;
}
.ra-modal-print:not(:disabled):hover { background: var(--surface3); color: var(--fg); border-color: var(--fg-sub); }
.ra-modal-print:disabled { opacity: 0.35; cursor: default; }

/* ── Print styles ────────────────────────────────────────────────────────── */
@media print {
  body > *:not(#ra-modal) { display: none !important; }

  #ra-modal {
    position: static !important;
    background: white !important;
    padding: 0 !important;
    display: block !important;
  }

  .ra-modal-content {
    max-height: none !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
  }

  .ra-modal-header {
    background: white !important;
    border-bottom: 2px solid #000 !important;
    padding: 12px 0 8px !important;
  }

  .ra-modal-title   { color: #000 !important; font-size: 18px !important; }
  .ra-modal-station { color: #444 !important; }
  .ra-modal-close, .ra-modal-print, .ra-modal-status { display: none !important; }

  .ra-modal-body {
    padding: 16px 0 !important;
    overflow: visible !important;
    color: #000 !important;
  }

  .ra-section-title { color: #000 !important; border-bottom-color: #ccc !important; }

  .ra-table th, .ra-table td { color: #000 !important; border-bottom-color: #ccc !important; }
  .ra-table tr:hover td { background: transparent !important; }
  .ra-tier-label strong { color: #000 !important; }
  .ra-tier-artists { color: #444 !important; }

  .ra-observations-list li { color: #000 !important; }
  .ra-observations-list li::before { color: #000 !important; }

  .ra-narrative { color: #000 !important; }
  .ra-narrative em { color: #444 !important; }

  .ra-narratives { border-top-color: #ccc !important; }
}
