/* airtune v3 dashboard. Light theme, red accent. Always light; OS dark mode is ignored on purpose. */

:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #111418;
  --ink-2: #374151;
  --muted: #6b7280;
  --line: #e6e8ec;
  --line-strong: #d6d9df;
  --accent: #1f8ff0;
  --accent-hover: #1573d0;
  --accent-soft: #eaf5ff;
  --on-accent: #ffffff;
  --danger: #1573d0;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  --sidebar: 232px;
  --player-h: 68px;
}

/* Dark theme: switched on by the button at the top of the dashboard (sets data-theme="dark" on <html>). */
:root[data-theme="dark"] {
  --bg: #0f1115;
  --card: #181b21;
  --ink: #f3f4f6;
  --ink-2: #d1d5db;
  --muted: #9ca3af;
  --line: #2a2f38;
  --line-strong: #3a404b;
  --accent: #3fa2f5;
  --accent-hover: #6cb8ff;
  --accent-soft: #14233a;
  --on-accent: #0f1115;
  --danger: #6cb8ff;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}


* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 "Open Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--player-h) + 12px);
}

/* ---------- Shell ---------- */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--card);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  padding: 4px 8px;
}
.brand-logo {
  display: block;
  width: 100%;
  max-width: 180px;
  height: auto;
}
/* Two logos are in the page; the theme decides which shows. */
:root .logo-for-dark { display: none; }
:root[data-theme="dark"] .logo-for-light { display: none; }
:root[data-theme="dark"] .logo-for-dark { display: block; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
}

.side-nav { display: flex; flex-direction: column; gap: 2px; }
/* Customers and Stations: solid white buttons with white borders. Hover only changes the text. */
.side-nav a.nav-btn {
  display: block; padding: 10px 14px; margin-bottom: 6px; border-radius: 10px;
  background: #ffffff; border: 1px solid #ffffff; color: #111418; font-weight: 600; text-decoration: none;
}
.side-nav a.nav-btn:hover { background: #ffffff; border-color: #ffffff; color: var(--accent); }
.side-nav a.nav-btn.active { background: #ffffff; border-color: #ffffff; color: var(--accent); }

/* Subtle polish */
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.55; }
.row input[type="file"] { flex: 1 1 260px; width: auto; padding: 6px 8px; }
td input { width: 100%; }
/* Library: give titles room; keep play, length and delete tight. */
.library-table td:nth-child(1), .library-table td:nth-child(6), .library-table td:nth-child(7) { width: 1%; white-space: nowrap; }
.library-table td:nth-child(2) { min-width: 260px; }
.library-table td:nth-child(5) { min-width: 180px; }
.side-nav a {
  color: var(--ink-2);
  text-decoration: none;
  padding: 9px 12px;
  border-radius: 9px;
  font-weight: 600;
}
.side-nav a:hover { background: var(--bg); }
.side-nav a.active { background: var(--accent-soft); color: var(--accent); }

.side-foot { margin-top: auto; }
.side-foot button { width: 100%; }
.side-foot #theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  margin-bottom: 12px;
}
.icon-sun { display: none; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

.content { min-width: 0; }

/* Login and password reset screens: full-screen background picture, no side menu, one centred card. */
body.auth {
  background: #0f1115 url("/assets/login-bg.jpg") center / cover no-repeat fixed;
  min-height: 100vh;
}
body.auth .shell, body.auth .content, body.auth .container { background: transparent; }
body.auth .shell { display: block; min-height: 100vh; }
body.auth .sidebar { display: none; }
body.auth .player { display: none; }
body.auth .container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.auth-card {
  width: min(360px, 100%);
  margin: 0;
  padding: 22px 22px 20px;
  text-align: center;
}
.auth-logo { display: block; width: 190px; max-width: 70%; height: auto; margin: 0 auto 10px; }
.auth-card h1 { font-size: 1.2rem; margin: 0 0 2px; }
.auth-card .muted { font-size: 0.85rem; margin: 0 0 14px; }
.auth-card .row { flex-direction: column; align-items: stretch; gap: 10px; margin: 0; }
.auth-card label { flex: none; width: 100%; text-align: left; font-size: 0.82rem; gap: 4px; }
.auth-card input { width: 100%; padding: 8px 10px; }
.auth-card button[type="submit"] { width: 100%; padding: 9px 14px; margin-top: 4px; }
.auth-card .link-btn {
  background: none; border: none; color: var(--accent); padding: 8px 0 0; font-size: 0.85rem; font-weight: 600; box-shadow: none;
}
.auth-card .link-btn:hover { background: none; text-decoration: underline; }

.container {
  max-width: none;
  margin: 0;
  padding: 28px 32px 40px;
}

/* ---------- Type ---------- */

h1 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 4px;
}
h2 { font-size: 1rem; font-weight: 700; margin: 0 0 10px; }
h3 { font-size: 0.95rem; font-weight: 700; margin: 0; }
h1, h2, h3, h4 { color: var(--accent); }
.library-search { margin: 12px 0; max-width: 420px; }
.public-form { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.check { display: inline-flex; flex-direction: row; flex: none; align-items: center; gap: 8px; font-weight: 600; font-size: 0.86rem; color: var(--ink-2); }
.check input { width: auto; }
.logo-box { background: var(--bg); border: 1px dashed var(--line-strong); border-radius: 12px; padding: 14px; display: flex; align-items: center; justify-content: center; min-height: 80px; }
.logo-preview { max-height: 90px; max-width: 100%; }

/* On-air status (sits on the right of the station header) */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 16px; }
.hero > div:first-child { grid-column: 1; grid-row: 1; min-width: 0; }
.hero > .air-strip { grid-column: 2; grid-row: 1; }
.air-strip { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-left: auto; flex: 0 0 auto; }
.hero .air-strip { background: none; border: none; box-shadow: none; padding: 0; margin: 0; width: auto; align-self: flex-start; }
.hero .air-strip .muted { display: none; }
@media (max-width: 640px) { .hero { grid-template-columns: 1fr; } .hero > .air-strip { grid-column: 1; grid-row: 2; } }
.air-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px; font-size: 0.8rem; font-weight: 700;
  letter-spacing: 0.04em; border: 1px solid var(--line-strong); color: var(--muted); background: var(--bg);
}
.air-chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.air-chip.on { color: #fff; background: #e5484d; border-color: #e5484d; }
.air-chip.on::before { background: #fff; }
.air-chip.off { color: #fff; background: var(--muted); border-color: var(--muted); }
.air-chip.off::before { background: #fff; }
.air-chip.live { color: #fff; background: #e5484d; border-color: #e5484d; }
.air-chip.live::before { background: #fff; }
.air-chip.idle { color: var(--muted); }

/* Go live */
.live-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.live-details { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px 20px; }
.live-row { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.live-row code {
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Listener stats */
.ls-top { display: grid; grid-template-columns: minmax(200px, 1fr) 2fr; gap: 16px; margin-bottom: 16px; }
.ls-stats { text-align: center; margin: 0; }
.ls-map { padding: 0; overflow: hidden; margin: 0; }
.listener-map { height: 360px; width: 100%; }
.big-count { font-size: 3rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.pie-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 12px; }
.legend { font-size: 0.8rem; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.history svg { display: block; }
@media (max-width: 760px) { .ls-top { grid-template-columns: 1fr; } .listener-map { height: 280px; } }
.mini.active { border-color: var(--accent); color: var(--accent); }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 10px; }
td.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
@media (max-width: 560px) { .stat-row { grid-template-columns: 1fr; } }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }

/* ---------- Surfaces ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 16px;
}

.grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-bottom: 16px;
}

a.station-card {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
a.station-card:hover { border-color: var(--line-strong); box-shadow: 0 4px 14px rgba(16,24,40,0.07); }
.station-cover {
  height: 96px;
  border-radius: 10px;
  background: var(--accent);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
}
.station-name { font-weight: 700; font-size: 1rem; }

.stat { display: flex; flex-direction: column; gap: 2px; margin: 0; }
.stat .value { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; color: var(--accent); }
.card:has(.np-grid) {
  background: linear-gradient(120deg, var(--accent-soft), var(--card) 55%);
  border-left: 4px solid var(--accent);
}
.np-label { color: var(--accent); }
.stat .label { color: var(--muted); font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }

/* Station header */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 16px;
}
.hero h1 { margin: 0; }
.hero .meta { display: flex; gap: 8px; flex-wrap: wrap; order: -1; }
.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 0.78rem;
  font-weight: 600;
}

.live-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

/* ---------- Tabs ---------- */

.tabs {
  display: flex;
  gap: 4px;
  margin: 0 0 18px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.tabs a {
  padding: 10px 12px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.tabs a:hover { color: var(--ink); }
.tabs a.active { color: var(--ink); border-bottom-color: var(--accent); }

.back { display: inline-block; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.85rem; margin-bottom: 10px; }
.back:hover { color: var(--ink); }

/* ---------- Forms ---------- */

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row.between { justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.row.end { justify-content: flex-end; margin-top: 8px; }
form.inline { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }

label {
  display: flex;
  flex-direction: column;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  gap: 5px;
  flex: 1 1 170px;
  min-width: 0;
}

input, select, textarea {
  font: inherit;
  font-size: 0.92rem;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 8px 11px;
  min-width: 0;
  width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
input[type="checkbox"] { width: auto; }

/* Dropdowns: web/dropdown.js draws the list, the real <select> stays hidden in the form. */
.dd { display: block; position: relative; width: 100%; min-width: 0; }
.dd > select {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}
button.dd-trigger {
  display: block;
  position: relative;
  width: 100%;
  min-height: 2.5em;
  padding: 8px 30px 8px 11px;
  font-size: 0.92rem;
  font-weight: inherit;
  text-align: left;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line-strong);
}
button.dd-trigger:hover { background: var(--card); border-color: var(--muted); }
button.dd-trigger:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
button.dd-trigger::after {
  content: "";
  position: absolute;
  right: 13px;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -6px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
}
.dd-value { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.dd-menu {
  position: fixed;
  z-index: 1000;
  min-width: 140px;
  padding: 4px;
  overflow-y: auto;
  font-size: 0.92rem;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.dd-option { padding: 7px 8px; border-radius: 6px; cursor: pointer; overflow-wrap: anywhere; }
.dd-option.active { background: var(--accent-soft); }
.dd-option[aria-selected="true"] { font-weight: 700; color: var(--accent); }
.dd-option[aria-disabled="true"] { color: var(--muted); cursor: default; }

button {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 9px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
  transition: background 0.15s ease;
  white-space: nowrap;
}
button:hover { background: var(--accent-hover); }
button.ghost { background: var(--card); color: var(--ink); border-color: var(--line-strong); }
button.ghost:hover { background: var(--bg); }
button.danger { background: var(--card); color: var(--danger); border-color: #b9d9f7; }
button.danger:hover { background: #eaf5ff; }
button:disabled { opacity: 0.45; cursor: default; }

/* Small round buttons inside lists */
.mini {
  padding: 3px 10px;
  font-size: 0.8rem;
  border-radius: 999px;
  min-width: 30px;
}
.mini:disabled { background: var(--bg); color: var(--muted); border-color: var(--line); }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; padding: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 0.88rem; vertical-align: middle; }
th { color: var(--muted); font-weight: 700; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; background: var(--bg); }
tr:last-child td { border-bottom: none; }
td input { padding: 5px 8px; font-size: 0.88rem; border-color: transparent; background: transparent; }
td input:hover { border-color: var(--line); background: var(--card); }
td input:focus { background: var(--card); border-color: transparent; }

/* Tag filter chips */
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 0 0 12px; }
.filter-chip {
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--ink-2);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.filter-chip:hover { background: var(--bg); }
.filter-chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.pl-chip { cursor: grab; }

/* Lists */
ul.plain { padding: 0; margin: 0; list-style: none; }
ul.plain li { padding: 9px 0; border-bottom: 1px solid var(--line); }
ul.plain li:last-child { border-bottom: none; }

/* Dropzone */
.dropzone {
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--card);
  padding: 22px;
  text-align: center;
  cursor: pointer;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  justify-content: center;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.upload-log { list-style: none; padding: 0; margin: 0 0 14px; font-size: 0.85rem; color: var(--ink-2); }
.upload-log li { padding: 2px 0; }
.upload-log .err { color: var(--danger); }

.empty {
  text-align: center;
  padding: 28px 20px;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  background: var(--card);
}

/* ---------- Playlist editor ---------- */

.editor-grid {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.editor-panels {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
}
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 16px;
  min-width: 0;
}
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.panel input[type="search"] { margin-bottom: 10px; }

.pl-list-nav { display: flex; flex-direction: column; gap: 2px; }
.pl-list-nav .pl-item {
  padding: 8px 10px;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 600;
  border-bottom: none;
  color: var(--ink-2);
}
.pl-list-nav .pl-item:hover { background: var(--bg); }
.pl-list-nav .pl-item.active { background: var(--accent-soft); color: var(--accent); }

.lib-list, .pl-drop {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 60vh;
  overflow-y: auto;
  min-height: 80px;
}
.lib-item, .drag-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  min-width: 0;
}
.lib-item { cursor: grab; }
.drag-item { cursor: grab; user-select: none; }
.lib-item:hover, .drag-item:hover { border-color: var(--line-strong); background: var(--bg); }
.drag-item.dragging { opacity: 0.45; }
.handle { color: var(--muted); letter-spacing: -2px; font-size: 0.8rem; flex: none; }
.drag-index { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 20px; font-size: 0.82rem; flex: none; }
.drag-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  font-size: 0.88rem;
}
.pl-drop.over { outline: 2px dashed var(--accent); outline-offset: 2px; }
.drop-hint {
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  list-style: none;
}

/* ---------- Schedule calendar ---------- */

.cal-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.cal {
  display: grid;
  grid-template-columns: 52px repeat(7, minmax(96px, 1fr));
  min-width: 760px;
  background: var(--card);
}
.cal-corner, .cal-head {
  padding: 8px;
  text-align: center;
  font-weight: 700;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.cal-gutter { position: relative; height: 960px; border-right: 1px solid var(--line); }
.cal-hour {
  position: absolute;
  left: 0;
  right: 8px;
  transform: translateY(-7px);
  font-size: 0.7rem;
  color: var(--muted);
  text-align: right;
}
.cal-col {
  position: relative;
  height: 960px;
  border-left: 1px solid var(--line);
  touch-action: none;
  cursor: crosshair;
  background: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px 40px);
}
.slot {
  position: absolute;
  left: 4px;
  right: 4px;
  border: none;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  padding: 4px 7px 10px;
  text-align: left;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-size: 0.74rem;
  line-height: 1.25;
  cursor: grab;
  touch-action: none;
  user-select: none;
  white-space: normal;
  box-shadow: 0 1px 2px rgba(16,24,40,0.12);
}
.slot:hover { background: var(--accent-hover); }
.slot.dragging { opacity: 0.9; cursor: grabbing; box-shadow: 0 6px 16px rgba(16,24,40,0.25); z-index: 2; }
.slot-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-time { opacity: 0.9; }
.slot-grip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 12px;
  cursor: ns-resize;
  background: linear-gradient(to bottom, transparent, rgba(0,0,0,0.18));
}
.slot.preview {
  background: rgba(31,143,240,0.18);
  border: 1px dashed var(--accent);
  color: var(--ink);
  pointer-events: none;
}

/* ---------- Modal ---------- */

dialog.modal {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 0;
  max-width: 440px;
  width: calc(100vw - 32px);
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(16,24,40,0.25);
}
dialog.modal::backdrop { background: rgba(16,24,40,0.35); }
.modal-body { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-body h2 { margin: 0; font-size: 1.1rem; }
.modal-body > label { flex: none; }
fieldset.days { border: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
fieldset.days legend { width: 100%; padding: 0; margin-bottom: 4px; font-size: 0.78rem; font-weight: 600; color: var(--muted); }
label.chip {
  flex: none;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 5px 11px;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
}
label.chip:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
label.chip input { width: auto; accent-color: var(--accent); }

/* ---------- Player bar ---------- */

.player {
  position: fixed;
  left: var(--sidebar);
  right: 0;
  bottom: 0;
  z-index: 5;
  height: var(--player-h);
  background: var(--card);
  border-top: 1px solid var(--line);
  box-shadow: 0 -2px 10px rgba(16,24,40,0.05);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 32px;
}
.player-info { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.player-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.92rem; }
.player .muted { font-size: 0.8rem; }
.player audio { height: 40px; width: min(340px, 40vw); }

.toast {
  position: fixed;
  bottom: calc(var(--player-h) + 16px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  max-width: 92vw;
  font-weight: 600;
  font-size: 0.88rem;
  z-index: 10;
  box-shadow: 0 8px 24px rgba(16,24,40,0.25);
}

.hidden { display: none !important; }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .editor-grid, .editor-panels { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  :root { --sidebar: 0px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 4;
    height: auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    gap: 10px;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .side-nav { flex-direction: row; }
  .side-nav a { padding: 7px 10px; }
  .side-foot { margin-top: 0; display: flex; align-items: center; gap: 8px; }
  .side-foot button { width: auto; padding: 6px 12px; }
  .side-foot #theme-toggle { margin-bottom: 0; }
  .container { padding: 18px 14px 32px; }
  .player { left: 0; flex-wrap: wrap; padding: 8px 14px; height: auto; gap: 8px; }
  .player audio { width: 100%; }
  body { padding-bottom: 150px; }
  .toast { bottom: 170px; }
  .row { flex-direction: column; align-items: stretch; }
  label { flex: 1 1 auto; }
  .stat .value { font-size: 1.6rem; }
  .sidebar .brand { font-size: 0.95rem; }
}

/* ---------- Now on air ---------- */
.now-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 0.88rem;
  margin: 0 0 14px;
}
.now-banner.idle { background: var(--bg); color: var(--ink-2); }
.now-banner .now-clock { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.now-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.now-banner .live-dot { animation: pulse 1.8s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(31,143,240,0.55); }
  70% { box-shadow: 0 0 0 9px rgba(31,143,240,0); }
  100% { box-shadow: 0 0 0 0 rgba(31,143,240,0); }
}
.slot.live {
  background: var(--ink);
  box-shadow: 0 0 0 2px var(--accent), 0 4px 14px rgba(16,24,40,0.25);
  z-index: 1;
}
.slot.live:hover { background: #2a2d33; }
.now-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  z-index: 3;
  pointer-events: none;
}
.now-line::before {
  content: "";
  position: absolute;
  left: -4px;
  top: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

/* ---------- Station tabs in the sidebar ---------- */
.sub-nav { margin-top: 0; padding-top: 14px; border-top: 1px solid var(--line); }
.side-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 0 12px 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sub-nav a { font-weight: 600; }

/* ---------- Now playing card ---------- */
.np-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.np-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 4px; }
.np-title { font-weight: 700; font-size: 1.05rem; margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) { .np-grid { grid-template-columns: 1fr; gap: 14px; } }
