:root {
  --bg: #f4f2ee;
  --card: #ffffff;
  --raised: #ece9e3;
  --text: #1d1c1a;
  --muted: #6b6760;
  --line: #e3dfd8;
  --accent: #c2410c;
  --accent-text: #ffffff;
  --accent-soft: #fff1e6;
  --accent-line: #fdba74;
  --accent-ink: #9a3412;
  --clip: #2563eb;
  --clip-soft: #e8efff;
  --spot: #ca8a04;
  --radio: #a8a29e;
  --ok: #15803d;
  --warn: #b45309;
  --bad: #b91c1c;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151412;
    --card: #1f1e1b;
    --raised: #2a2825;
    --text: #edeae4;
    --muted: #a19c93;
    --line: #34322e;
    --accent: #f97316;
    --accent-text: #1a0f05;
    --accent-soft: #2b1a0e;
    --accent-line: #9a3412;
    --accent-ink: #fed7aa;
    --clip: #60a5fa;
    --clip-soft: #172554;
    --spot: #fbbf24;
    --radio: #57534e;
    --ok: #4ade80;
    --warn: #fbbf24;
    --bad: #f87171;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* header and navigation */
header {
  position: sticky; top: 0; z-index: 5;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: 10px 24px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo { display: block; width: 28px; height: 28px; border-radius: 7px; }
h1 { font-size: 1.25rem; margin: 0; }
h2 { font-size: 1.1rem; margin: 0 0 8px; }
h3 { font-size: 1.05rem; margin: 0 0 8px; }
nav { display: flex; gap: 4px; overflow-x: auto; }
nav a {
  padding: 10px 14px; border-radius: 8px; color: var(--muted); text-decoration: none; white-space: nowrap;
}
nav a:hover { color: var(--text); }
nav a.active { background: var(--raised); color: var(--text); font-weight: 600; }

main { max-width: 1180px; margin: 0 auto; padding: 24px; }
.view { display: none; }
.view.active { display: block; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; }
.page-title { font-size: 1.75rem; margin: 0 8px 0 0; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 20px;
}
details.card > summary { cursor: pointer; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary h3 { display: inline; }
details.card > summary::after { content: " ▾"; color: var(--muted); }
details.card[open] > summary { margin-bottom: 8px; }
.row { display: flex; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; gap: 8px; }
.end { justify-content: flex-end; margin-top: 8px; }
.gap { gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.push { margin-left: auto; }
.muted { color: var(--muted); }
.fg { color: var(--text); }
.small { font-size: 0.85rem; }
.hidden { display: none !important; }
.sr { position: absolute; left: -9999px; }
.right { text-align: right; }
.center { text-align: center; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
code { font-size: 0.9em; }
a { color: var(--accent); }

.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.live { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 25%, transparent); }
.dot.cutin { background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }

/* controls */
button, .button {
  font: inherit; cursor: pointer; border-radius: 10px; padding: 0 16px; min-height: 40px;
  border: 1px solid var(--line); background: var(--card); color: var(--text); text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
button:hover, .button:hover { border-color: var(--muted); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
button.danger { color: var(--bad); }
.small-btn { padding: 0 12px; min-height: 34px; font-size: .9rem; border-radius: 8px; }
input, select {
  font: inherit; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); min-width: 0; min-height: 40px;
}
input[type=checkbox], input[type=radio] { min-height: 0; }
/* Own arrow, so it sits inside the padding instead of against the edge. */
select {
  width: auto; padding-right: 36px; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238a857c' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 12px 8px;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label.field { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: .85rem; }
label.field input { color: var(--text); font-size: 15px; }
label.check { display: flex; align-items: center; gap: 8px; }
/* A long label must not squeeze its box into a dot. */
label.check > input[type=checkbox], label.check > input[type=radio] { flex: none; width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
label.inline { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.chip, .chips-nav a {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--text); text-decoration: none; white-space: nowrap;
}
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 700; }
.chips-nav { display: flex; flex-wrap: wrap; gap: 8px; }
#source-filters { margin-bottom: 16px; }
#source-filters .chip.active { background: var(--text); border-color: var(--text); color: var(--bg); }
.chip-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 20px; }
.back { color: var(--muted); text-decoration: none; margin-right: 8px; }

.pill { font-size: .72rem; font-weight: 700; letter-spacing: .05em; padding: 3px 10px; border-radius: 999px; background: var(--raised); color: var(--muted); }
.pill.program { background: var(--accent-soft); color: var(--accent-ink); }
.pill.cutin { background: var(--clip-soft); color: var(--clip); }
.pill.silence, .pill.offline { color: var(--bad); }
.tag { font-size: .8rem; padding: 3px 10px; border-radius: 999px; background: var(--raised); white-space: nowrap; }
.badge { font-size: .75rem; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.badge.playing, .badge.started { color: var(--accent); border-color: var(--accent); }
.badge.failed, .badge.skipped { color: var(--bad); border-color: var(--bad); }
.badge.played, .badge.ready { color: var(--ok); border-color: var(--ok); }
.badge.waiting { color: var(--clip); border-color: var(--clip); }

/* lists */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 10px 0; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.list.compact > li { padding: 6px 0; font-size: .9rem; }
.list .empty { color: var(--muted); }
.list > li .title, .list > li .muted { overflow-wrap: anywhere; }
.item-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.item-row .grow { flex: 1 1 240px; }
.item-row .title { overflow-wrap: anywhere; font-weight: 600; }
.links { list-style: none; padding: 0; margin: 8px 0; }
.links li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.links code { background: var(--bg); padding: 6px 8px; border-radius: 8px; overflow-wrap: anywhere; flex: 1 1 180px; }

/* home */
.channel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; margin-bottom: 20px; }
.channel-grid .card { margin: 0; }
.channel-grid .grid-head { grid-column: 1 / -1; margin: 8px 0 -8px; }
.owner-tag { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.owner-tag.public { color: var(--accent-ink); background: var(--accent-soft); border-color: var(--accent-line); }

/* Accounts: users don't see admin things; others' public channels are listen-only. */
body.is-user .admin-only, body:not(.is-user) .user-only, body:not(.readonly) .readonly-only,
body.readonly .edit-only, body.readonly :is(#queue, #why, #programs, #spots, #tl-pop) button,
body.readonly :is(#programs, #spots) input, body.readonly #station-chips .add-link { display: none !important; }
body.readonly #station-chips { pointer-events: none; }
.readonly-note { padding: 10px 14px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-ink); border: 1px solid var(--accent-line); }
.user-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 12px 0; border-bottom: 1px solid var(--line); }
.add-user { margin-top: 20px; }
.add-user-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(120px, auto) auto; gap: 12px 16px; align-items: end; }
.add-user-fields input, .add-user-fields select { width: 100%; }
.paired-head { margin-top: 28px; }
@media (max-width: 700px) { .add-user-fields { grid-template-columns: 1fr; } .add-user-fields button { justify-self: start; } }
.channel-card { display: flex; flex-direction: column; gap: 12px; }
.card-title { font-size: 1.15rem; font-weight: 700; color: var(--text); text-decoration: none; }
.card-title:hover { color: var(--accent); }
.cc-now { display: flex; gap: 12px; align-items: center; }
.cc-art { width: 52px; height: 52px; flex: none; border-radius: 10px; object-fit: cover; background: var(--line); }
.np-art { width: 88px; height: 88px; flex: none; border-radius: 14px; object-fit: cover; background: var(--line); }
.cc-title { font-size: 1.05rem; font-weight: 600; overflow-wrap: anywhere; }
.strip { position: relative; display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--raised); }
.strip i { display: block; }
.strip i.radio { background: var(--radio); }
.strip i.prog { background: var(--accent); }
.strip i.title { background: repeating-linear-gradient(135deg, var(--accent) 0 4px, var(--accent-line) 4px 8px); }
.strip i.clip { background: var(--clip); }
.strip b { position: absolute; top: 0; bottom: 0; width: 3px; background: var(--spot); }
.strip-scale { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); margin-top: -6px; }
button.listen { border-color: var(--accent); color: var(--accent); font-weight: 600; min-height: 44px; }
button.listen.playing { background: var(--accent); color: var(--accent-text); }
.add-card .row { margin-bottom: 8px; }
.add-card input[name=name] { flex: 1 1 160px; }
.add-card input[name=url], .add-card input[name=query] { flex: 3 1 260px; }

/* one channel */
.split { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.split-main { flex: 999 1 560px; min-width: 0; }
.split-side { flex: 1 1 300px; min-width: 0; }
.np-head { display: flex; gap: 16px; align-items: center; margin-bottom: 8px; }
.big-play {
  width: 64px; height: 64px; border-radius: 50%; border: 0; padding: 0; flex: none;
  background: var(--accent); color: var(--accent-text); font-size: 22px;
}
.onair .label { text-transform: uppercase; letter-spacing: .06em; font-size: .75rem; color: var(--accent); font-weight: 700; }
.np-title { font-size: 1.6rem; font-weight: 700; line-height: 1.2; margin: 2px 0; overflow-wrap: anywhere; }
.np-source { color: var(--muted); }
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 12px; }
.progress div { height: 100%; width: 0; background: var(--clip); transition: width 1s linear; }
.np-times { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); margin: 4px 0 8px; font-variant-numeric: tabular-nums; }
.sub-head { font-size: .9rem; color: var(--muted); font-weight: 600; margin: 20px 0 10px; }
.layers { display: flex; flex-direction: column; gap: 8px; }
.layer { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px; border: 1px dashed var(--line); }
.layer.active { border-style: solid; }
.layer.prog.active { background: var(--accent-soft); border-color: var(--accent-line); }
.layer.prog.active .muted { color: var(--accent-ink); }
.layer.clip.active { background: var(--clip-soft); border-color: var(--clip); }
.layer.station.active { background: var(--raised); }
.layer.warn.active { border-color: var(--bad); }
.layer .grow { flex: 1 1 240px; min-width: 0; overflow-wrap: anywhere; }
.ldot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--radio); }
.layer.clip .ldot, .ldot.clip { background: var(--clip); }
.layer.prog .ldot, .ldot.prog { background: var(--accent); }
.ldot.title { background: repeating-linear-gradient(135deg, var(--accent) 0 3px, var(--accent-line) 3px 6px); }
.ldot.spot, .layer.spot .ldot { background: var(--spot); }
.layer.warn .ldot { background: var(--bad); }
.station-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.station-chip { min-height: 44px; }
.station-chip.active { border: 2px solid var(--accent); font-weight: 600; }
.add-link { padding: 0 8px; }
.rundown .rd { display: grid; grid-template-columns: 3.2em 10px minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; padding: 10px 8px; }
.rundown .rd > .grow { overflow-wrap: anywhere; }
.rundown .rd > .small { text-align: right; }
.rundown .rd.now { background: var(--accent-soft); border-radius: 8px; border-top-color: transparent; }
.rundown .rd.now + .rd { border-top-color: transparent; }
.rundown .rd.past { opacity: .7; }
.rd-time { width: 48px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* schedule */
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); font-size: .85rem; margin-bottom: 16px; align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 18px; height: 10px; border-radius: 3px; }
.sw.prog { background: var(--accent); }
.sw.title { background: repeating-linear-gradient(135deg, var(--accent) 0 4px, var(--accent-line) 4px 8px); }
.sw.spot { width: 3px; height: 14px; background: var(--spot); border-radius: 0; }
.sw.now { width: 2px; height: 14px; background: var(--clip); border-radius: 0; }
.timeline-box { overflow-x: auto; }
.timeline { min-width: 820px; display: flex; flex-direction: column; gap: 6px; }
.trow { display: flex; gap: 12px; align-items: center; }
.tday { width: 40px; flex: none; color: var(--muted); font-size: .9rem; }
.trow.today .tday { color: var(--text); font-weight: 700; }
.lane { position: relative; flex: 1; height: 46px; border-radius: 8px; background: var(--raised); }
.lane.scale { height: 18px; background: none; font-size: .75rem; color: var(--muted); }
.lane.scale span { position: absolute; transform: translateX(-50%); }
.lane.scale span:first-child { transform: none; }
.lane.scale span:last-child { transform: translateX(-100%); }
.block {
  position: absolute; top: 6px; bottom: 6px; min-height: 0; padding: 0 8px; border: 0; border-radius: 6px;
  background: var(--accent); color: var(--accent-text); font-size: .78rem; font-weight: 600;
  justify-content: flex-start; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.block.title { background: repeating-linear-gradient(135deg, var(--accent) 0 6px, color-mix(in srgb, var(--accent) 80%, #000) 6px 12px); }
.block.off { opacity: .4; }
/* A 3 px line with a wider invisible hit area, so it is easy to hover or tap. */
.tick {
  position: absolute; top: 0; bottom: 0; width: 13px; margin-left: -5px; padding: 0; min-height: 0; border: 0; border-radius: 0;
  background: linear-gradient(to right, transparent 5px, var(--spot) 5px 8px, transparent 8px); opacity: .85; cursor: pointer;
}
.tick:hover, .tick:focus-visible { opacity: 1; background: linear-gradient(to right, transparent 4px, var(--spot) 4px 9px, transparent 9px); outline: none; }
.lane .now { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--clip); }
.flash { animation: flash 1.6s ease-out; }
@keyframes flash { from { background: var(--accent-soft); } to { background: transparent; } }
.days { display: flex; gap: 4px; flex-wrap: wrap; }
.days label { display: inline-flex; align-items: center; gap: 4px; font-size: .85rem; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.days input { margin: 0; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-top: 10px; align-items: end; }
.filters label { display: flex; flex-direction: column; font-size: .85rem; color: var(--muted); gap: 4px; }
.title-trigger { display: grid; gap: 8px; margin-top: 8px; }
.title-trigger .filters { margin-top: 0; }
.title-trigger details ul { margin-top: 4px; max-height: 240px; overflow: auto; }
#programs > li { padding: 14px 8px; border-radius: 8px; }
.base-pick { display: flex; flex-wrap: wrap; gap: 8px; flex: 3 1 260px; }
.base-pick input[name=url] { flex: 1 1 200px; }

.spot-form { display: grid; gap: 12px; }
.spot-form > label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; }
.spot-form > label.check { flex-direction: row; font-weight: 400; }
.spot-form fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 8px; margin: 0; min-width: 0; }
.spot-form legend { font-weight: 500; padding: 0 4px; }
.spot-form input.num { width: 5.5em; }
.spot-form input.grow { flex: 1; }
.file-pick { max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; display: grid; gap: 4px; }
.file-pick .folder { font-weight: 600; }
.file-pick .sub { padding-left: 18px; }

/* sources */
.seg { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 14px; }
.seg button.active { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chips label { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; }
.chips input { margin: 0; }
.table-box { padding: 0; overflow-x: auto; }
table.sources { width: 100%; min-width: 640px; border-collapse: collapse; font-size: .92rem; }
table.sources th { text-align: left; color: var(--muted); font-weight: 600; padding: 14px 12px; white-space: nowrap; }
table.sources th.center { text-align: center; }
table.sources td { padding: 12px; border-top: 1px solid var(--line); vertical-align: middle; }
table.sources td:first-child, table.sources th:first-child { padding-left: 20px; }
table.sources td:last-child, table.sources th:last-child { padding-right: 20px; }
table.sources td.latest { max-width: 280px; overflow-wrap: anywhere; }
table.sources .empty { color: var(--muted); padding: 20px; }
.editor-row td { background: var(--bg); }
.src-name { display: flex; align-items: center; gap: 10px; }
.sdot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--ok); }
.sdot.bad { background: var(--bad); }
.sdot.off { background: var(--radio); }
#media .folder-head { font-weight: 600; padding-top: 14px; }

/* settings */
.settings { display: grid; gap: 14px; max-width: 560px; }
.settings > label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; }
.settings > label.check { flex-direction: row; font-weight: 400; }
.settings .row input { flex: 1; }
fieldset.formats { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 8px; margin: 0; }
fieldset.formats legend { font-weight: 500; padding: 0 4px; }
fieldset.formats label { align-items: flex-start; font-size: .9rem; }
fieldset.formats input { margin-top: 3px; }
.ok { color: var(--ok); } .bad { color: var(--bad); }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px;
  max-width: calc(100% - 32px); box-shadow: 0 6px 24px rgba(0,0,0,.2); z-index: 10;
}
.banner {
  margin: 0 0 16px; padding: 10px 14px; border-radius: 10px;
  border: 1px solid var(--warn); color: var(--warn);
}
.toast.error { background: var(--bad); color: #fff; }

@media (max-width: 640px) {
  header { padding: 10px 16px; }
  main { padding: 16px; }
  .card { padding: 16px; }
  .page-title { font-size: 1.4rem; }
  .channel-grid { grid-template-columns: 1fr; }
  .big-play { width: 56px; height: 56px; }
  .np-title { font-size: 1.3rem; }
  .np-art { width: 64px; height: 64px; }
  .chips-nav { flex-wrap: nowrap; overflow-x: auto; }
  /* the source moves under the title instead of squeezing it */
  .rundown .rd { grid-template-columns: 3.2em 10px minmax(0, 1fr); }
  .rundown .rd > .small { grid-column: 3; text-align: left; }
  /* buttons always on their own line, whatever the name's length */
  #spots > li > .row.between, #programs > li > .row.between { display: grid; justify-content: start; gap: 8px; }
}

/* pictures in forms and lists */
.src-art { width: 32px; height: 32px; flex: none; border-radius: 6px; object-fit: cover; background: var(--line); }
.pic-field { display: flex; gap: 12px; align-items: flex-start; }
.pic-preview { width: 56px; height: 56px; flex: none; border-radius: 10px; object-fit: cover; background: var(--line); }
.pic-field .stack { gap: 6px; }

/* schedule popups */
.tl-pop {
  position: fixed; z-index: 20; width: min(340px, calc(100vw - 16px)); padding: 14px 16px;
  display: grid; gap: 8px; background: var(--card); color: var(--text); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.25);
  grid-template-columns: minmax(0, 1fr); overflow-wrap: anywhere;
}
.pop-head { display: flex; gap: 12px; align-items: center; }
.pop-art { width: 48px; height: 48px; flex: none; border-radius: 8px; object-fit: cover; background: var(--line); }
.pop-kind { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.pop-ep { padding: 8px 10px; border-radius: 8px; background: var(--accent-soft); }

/* app pairing */
.pair-box { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; padding: 14px; border: 1px solid var(--accent-line); border-radius: 12px; background: var(--accent-soft); }
.pair-box[hidden] { display: none; }
.pair-qr svg { display: block; width: 200px; height: auto; max-width: 100%; border-radius: 8px; }
.pair-code { font: 700 1.6rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; margin: 0; }
.device-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.device-row .grow { flex: 1 1 200px; min-width: 0; }
.warn-text { color: var(--warn); }

/* log-in page */
.login-page main { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(360px, 100%); }
.login-card .logo { width: 40px; height: 40px; border-radius: 10px; }
.login-card p[hidden] { display: none; }
.logout { margin-left: auto; }
.logout[hidden] { display: none; }
@media (max-width: 640px) {
  /* keep "Log out" on the station-name row instead of a line of its own */
  .brand { flex: 1 1 auto; }
  .logout { order: 1; }
  nav { order: 2; flex-basis: 100%; }
}

/* voice messages */
#voice-card [hidden], #voice-preview[hidden] { display: none; }
#voice-audio { width: 100%; }
#btn-voice-rec.recording { background: var(--bad); border-color: var(--bad); }
.voice-time { font-variant-numeric: tabular-nums; }

/* A channel's sources: one row per source, its type on the right. */
.source-ticks { display: flex; flex-direction: column; }
.source-ticks label.check { min-height: 40px; border-top: 1px solid var(--line); }
.source-ticks label.check:first-child { border-top: 0; }

/* Radio Browser search results in the add-station form */
.rb-country { width: 10em; }
.rb-results { max-height: 360px; overflow-y: auto; margin: 0; }
.rb-results > li { display: flex; align-items: center; gap: 10px; }
.rb-logo { width: 36px; height: 36px; flex: none; border-radius: 8px; object-fit: contain; background: var(--line); }
.rb-results .badge { margin-right: 4px; }

/* Admin tab dot: a warning waits on the Admin page */
.nav-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); margin-left: 6px; vertical-align: middle; }
.nav-dot[hidden] { display: none; }

/* player bar: the in-page player on every page */
body.has-pbar main { padding-bottom: 96px; }
body.has-pbar .toast { bottom: 84px; }
.pbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 8; height: 68px;
  display: flex; align-items: center; gap: 14px; padding: 0 24px;
  background: color-mix(in srgb, var(--card) 94%, transparent); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
}
.pbar[hidden] { display: none; }
.pb-art, .pb-art img { width: 44px; height: 44px; border-radius: 8px; flex: none; }
.pb-art img { display: block; object-fit: cover; background: var(--line); }
.pb-text { min-width: 0; }
.pb-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-title .roll { white-space: nowrap; }
.pb-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-play { width: 44px; height: 44px; min-height: 0; padding: 0; border-radius: 50%; background: var(--text); border-color: var(--text); color: var(--bg); font-size: 16px; flex: none; }
.pb-play.playing { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.pb-vol { width: 110px; accent-color: var(--accent); }
#pb-channel { max-width: 180px; }
@media (max-width: 640px) {
  .pbar { padding: 0 12px; gap: 10px; }
  .pb-vol { display: none; }
  #pb-channel { max-width: 110px; }
}

/* lost signal: snow on the picture and a rolling title while the player reconnects */
.art-wrap { position: relative; flex: none; border-radius: 14px; overflow: hidden; }
.pb-art.art-wrap { border-radius: 8px; }
.art-wrap::after { content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity .4s; background: var(--noise) 0 0 / 96px 96px; mix-blend-mode: screen; pointer-events: none; }
.lost .art-wrap::after { opacity: .85; animation: snow .24s steps(4) infinite; }
@keyframes snow { 0% { background-position: 0 0; } 25% { background-position: -37px 21px; } 50% { background-position: 18px -44px; } 75% { background-position: -52px -9px; } }
.wave-title { position: relative; overflow: hidden; }
.wave-title .roll { position: relative; z-index: 1; display: inline-block; max-width: 100%; }
.lost .wave-title .roll { animation: vhold 1.1s steps(6) infinite; }
@keyframes vhold { 0% { transform: translateY(0); } 18% { transform: translateY(-60%); } 19% { transform: translateY(70%); } 40%, 100% { transform: translateY(0); } }
.wave-title .wave { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity .4s; pointer-events: none; }
.wave-title.voice .wave { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .lost .art-wrap::after, .lost .wave-title .roll { animation: none; }
}

/* send card: link and talk in one place */
.send-card .row.nowrap { flex-wrap: nowrap; }
.send-card .row.nowrap input { flex: 1; min-width: 0; }
.send-link { display: grid; gap: 10px; margin-bottom: 10px; }
.send-link[hidden], .send-suggest[hidden], #voice-preview[hidden] { display: none; }
.send-suggest { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--accent-line); border-radius: 10px; background: var(--accent-soft); overflow-wrap: anywhere; }
.send-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.send-tile { flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 2px; text-align: left; padding: 12px; min-height: 72px; background: var(--raised); border-color: transparent; }
.send-tile b { font-size: .95rem; }
.send-tile span { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.send-tile.recording { background: var(--bad); border-color: var(--bad); color: #fff; }
.send-tile.recording span { color: #fff; }
#voice-preview { margin-top: 10px; }
#voice-hint { margin: 10px 0 0; }
.file-link { color: var(--accent); cursor: pointer; text-decoration: underline; }
.file-link input { position: absolute; left: -9999px; }
.send-recent { list-style: none; padding: 0; margin: 8px 0 0; }
.send-recent li { display: flex; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.send-recent .send-recent-head { border-top: 0; padding-bottom: 0; }
.send-recent .ellipsis { max-width: none; }
.over { font: 600 .9rem ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ok); opacity: 0; transition: opacity .25s; }
.over.show { opacity: 1; }

/* stream tiles (Listen elsewhere and Admin › Streams) */
.stream-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin: 8px 0; }
.stream-tiles.wide { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.stile { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 4px; padding: 10px; border-radius: 10px; background: var(--raised); border: 1px solid transparent; text-align: left; min-height: 0; }
.stile .row.between { flex-wrap: nowrap; }
.stile.off { opacity: .55; }
.stile.missing { border-color: var(--warn); }
.stile.missing .small { color: var(--warn); }
.stile-actions { margin-top: 4px; }
.sbars { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.sbars i { width: 3px; border-radius: 1px; background: var(--line); }
.sbars i:nth-child(1) { height: 5px; } .sbars i:nth-child(2) { height: 8px; } .sbars i:nth-child(3) { height: 12px; }
.sbars i.lit { background: var(--accent); }

/* admin page */
.admin-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.admin-grid .card { margin: 0; }
.admin-grid .span2 { grid-column: span 2; }
.admin-grid .span3 { grid-column: 1 / -1; }
.tile.warn { border-color: var(--warn); }
.big { font-size: 1.9rem; font-weight: 700; line-height: 1.2; }
.hl { list-style: none; padding: 0; margin: 6px 0 0; font-size: .88rem; }
.hl li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.hl li:first-child { border-top: 0; }
.hl li > span:last-child { text-align: right; }
.ram-row { display: flex; align-items: center; gap: 16px; }
.ring { width: 86px; height: 86px; flex: none; }
.ring circle { fill: none; stroke-width: 9; }
.ring-bg { stroke: var(--raised); }
.ring-fg { stroke: var(--accent); stroke-linecap: round; transition: stroke-dasharray .6s; }
.tile.warn .ring-fg { stroke: var(--warn); }
.set-links { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.set-links a { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: 10px; background: var(--raised); color: var(--text); text-decoration: none; }
.set-links a span { font-size: .8rem; color: var(--muted); }
.set-links a:hover { outline: 1px solid var(--muted); }
@media (max-width: 900px) {
  .admin-grid { grid-template-columns: minmax(0, 1fr); }
  .admin-grid .span2 { grid-column: auto; }
  .set-links { grid-template-columns: 1fr 1fr; }
}
.send-link { grid-template-columns: minmax(0, 1fr); }
.send-link .row.nowrap input { width: auto; flex: 1 1 0; min-width: 0; }
.stile-actions { flex-wrap: nowrap; }
.pb-title, .pb-sub { max-width: 520px; }
#account-card[hidden] { display: none; }
