:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --ink: #1d2327;
  --muted: #667075;
  --line: #e1ded6;
  --accent: #1f5f5b;
  --accent-ink: #ffffff;
  --alert: #b3412b;
  --alert-bg: #fbece7;
  --ok: #2d6a3e;
  --ok-bg: #e5f2e8;
  --hosted: #dbe9f6;
  --hosted-edge: #4a7fb0;
  --synd: #e9e0f4;
  --synd-edge: #7b5ea7;
  --filler: #ebebe6;
  --filler-edge: #8a8a80;
  --radius: 10px;
  --open: #fde7c4;
  --open-edge: #c26a00;
  --open-ink: #8a4700;
  --sub: #d3eedb;
  --sub-edge: #2d7a47;
  --sub-ink: #1e5a33;
  --announce: #e0ecf3;
  --announce-edge: #1f5f5b;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15191b; --surface: #1d2326; --ink: #e8ece9; --muted: #98a3a0; --line: #2f393c;
    --accent: #5cb3ab; --accent-ink: #0d1514; --alert: #f08a73; --alert-bg: #3a211b;
    --ok: #8fd0a1; --ok-bg: #1d3325;
    --hosted: #1f3447; --hosted-edge: #6ba6da; --synd: #2d2440; --synd-edge: #a98ad6;
    --filler: #2a2d2c; --filler-edge: #7d8683;
    --open: #4a3212; --open-edge: #f0a24a; --open-ink: #f6c37a;
    --sub: #1d3a29; --sub-edge: #6fc08a; --sub-ink: #a6e0b8;
    --announce: #1f3438; --announce-edge: #5cb3ab;
  }
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.5;
}
a { color: var(--accent); }
h1 { font-size: 1.6rem; margin: 0.4rem 0 0.8rem; line-height: 1.2; }
h2 { font-size: 1.15rem; margin: 1.2rem 0 0.5rem; }
h3 { font-size: 1rem; margin: 0 0 0.4rem; }
.card h2:first-child { margin-top: 0; }
.muted, .hint { color: var(--muted); }
.hint { font-size: 0.88rem; margin: 0.3rem 0 0.9rem; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1200px; margin: 0 auto; padding: 0.6rem 1rem; display: flex; flex-wrap: wrap; gap: 0.5rem 1.2rem; align-items: center; }
.brand { font-weight: 700; font-size: 1.1rem; color: var(--ink); text-decoration: none; }
.nav { display: flex; flex-wrap: wrap; gap: 0.2rem 1rem; flex: 1; }
.nav a { color: var(--ink); text-decoration: none; padding: 0.2rem 0; border-bottom: 2px solid transparent; }
.nav a:hover { border-bottom-color: var(--accent); }
.usermenu { display: flex; gap: 0.8rem; align-items: center; font-size: 0.92rem; }
.usermenu form { margin: 0; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 1rem; }
.footer { max-width: 1200px; margin: 1.5rem auto; padding: 0 1rem; color: var(--muted); font-size: 0.82rem; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin: 0 0 1rem; }
.card.narrow, section.narrow { max-width: 640px; }
.alert-card { border-color: var(--alert); background: var(--alert-bg); }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }

.flash { padding: 0.7rem 1rem; border-radius: var(--radius); margin: 0 0 1rem; border: 1px solid var(--line); background: var(--surface); }
.flash-ok { background: var(--ok-bg); border-color: var(--ok); }
.flash-error { background: var(--alert-bg); border-color: var(--alert); }
.flash ul { margin: 0; padding-left: 1.1rem; }

label { display: block; font-weight: 600; margin: 0.8rem 0 0.25rem; }
label.check { display: flex; align-items: center; gap: 0.5rem; font-weight: 400; margin: 0.35rem 0; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 0.5rem 0.65rem; width: 100%; max-width: 100%;
}
input[type=checkbox] { width: auto; }
input.short { width: 5rem; }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 1rem 0; padding: 0.5rem 0.9rem 0.8rem; }
legend { font-weight: 600; padding: 0 0.3rem; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0.3rem 0; }
.inline-form label { margin: 0; }
.inline-form input:not([type=checkbox]):not(.short), .inline-form select { width: auto; flex: 1 1 14rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin-bottom: 0.3rem; }

.btn {
  display: inline-block; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent);
  border-radius: 8px; padding: 0.5rem 0.95rem; margin-top: 0.8rem;
}
.inline-form .btn, .actions .btn, .episodes .btn { margin-top: 0; }
.btn-quiet { background: transparent; color: var(--accent); }
.btn:hover { filter: brightness(1.07); }
.linklike { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }
.linklike.danger, .danger { color: var(--alert); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.badge { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 0.05rem 0.5rem; border-radius: 999px; background: var(--filler); color: var(--ink); vertical-align: middle; }
.badge-alert { background: var(--alert); color: #fff; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-hosted { background: var(--hosted); }
.badge-syndicated { background: var(--synd); }
.badge-filler { background: var(--filler); }
.badge-mine { background: transparent; border: 2px solid var(--accent); }
.badge-gap { background: var(--alert-bg); border: 1px dashed var(--alert); }
.legend { display: flex; flex-wrap: wrap; gap: 0.4rem; }

ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain > li { padding: 0.55rem 0; border-top: 1px solid var(--line); }
ul.plain > li:first-child { border-top: 0; }
.covers > li, .episodes > li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.episodes > li { display: grid; grid-template-columns: 1fr; gap: 0.3rem; }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }
li.mine { border-left: 3px solid var(--accent); padding-left: 0.6rem; }
.time { color: var(--muted); font-size: 0.9rem; display: block; }

.post-meta { color: var(--muted); font-size: 0.88rem; display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.post h2 { margin: 0.3rem 0; }
.post h2 a { color: var(--ink); text-decoration: none; }
.post.pinned { border-color: var(--accent); }
.excerpt { margin: 0.3rem 0; }
.body-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0.5rem 0; }
.pager { display: flex; justify-content: space-between; margin: 1rem 0; }

.table-wrap { overflow-x: auto; padding: 0.4rem 0.8rem; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.82rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
tr.inactive td { opacity: 0.6; }
.row-actions { white-space: nowrap; display: flex; gap: 0.8rem; align-items: center; }
.row-actions form { margin: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.8rem; margin-bottom: 1rem; }
.stat { display: block; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.8rem 1rem; }
.stat strong { display: block; font-size: 1.7rem; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 0.88rem; }
.stat-alert { border-color: var(--alert); background: var(--alert-bg); }
.links { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0; }
.links .btn { margin-top: 0; }

/* Weekly grid: 1 hour = 52px, 24 hours tall. */
.only-narrow { display: block; }
.only-wide { display: none; }
@media (min-width: 900px) {
  .only-narrow { display: none; }
  .only-wide { display: block; }
}
.grid-wrap { overflow-x: auto; }
.week-grid { display: grid; grid-template-columns: 4.2rem repeat(7, minmax(110px, 1fr)); min-width: 900px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.gutter .day-body { border-right: 1px solid var(--line); }
.day { border-left: 1px solid var(--line); min-width: 0; }
.day-head { text-align: center; font-weight: 600; padding: 0.4rem 0; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 3; border-radius: var(--radius) var(--radius) 0 0; }
.day-body { position: relative; height: 1248px; }
.hour-label, .hour-line { height: 52px; border-top: 1px solid var(--line); }
.hour-label { font-size: 0.7rem; color: var(--muted); padding: 0.1rem 0.3rem; text-align: right; }
.hour-line { border-top-style: dotted; }
.block {
  position: absolute; overflow: hidden; padding: 0.15rem 0.35rem; font-size: 0.78rem; line-height: 1.25;
  border: 1px solid; border-left-width: 4px; border-radius: 6px; text-decoration: none; color: var(--ink); z-index: 1;
}
.block strong { display: block; }
.block span { display: block; color: var(--muted); }
.block.kind-hosted { background: var(--hosted); border-color: var(--hosted-edge); }
.block.kind-syndicated { background: var(--synd); border-color: var(--synd-edge); }
.block.kind-filler { background: var(--filler); border-color: var(--filler-edge); }
.block.mine { box-shadow: inset 0 0 0 2px var(--accent); }
.block.needs-host { border-style: dashed; }
.block.cont-prev { border-top-left-radius: 0; border-top-right-radius: 0; }
.block.cont-next { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.block.gap {
  z-index: 0; border: 1px dashed var(--alert); color: var(--alert);
  background: repeating-linear-gradient(45deg, transparent 0 8px, var(--alert-bg) 8px 16px);
}
.block:hover { filter: brightness(0.97); z-index: 2; }

@media (max-width: 640px) {
  .row { grid-template-columns: 1fr; }
  .topbar-inner { gap: 0.4rem 1rem; }
}

/* Week navigation and cover status on the schedule */
.week-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.week-nav .btn { margin-top: 0; padding: 0.35rem 0.75rem; }
.week-nav .inline-form { margin: 0; }
.week-nav input[type=date] { width: auto; flex: 0 0 auto; padding: 0.3rem 0.5rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.day-head small { display: block; font-weight: 400; color: var(--muted); font-size: 0.75rem; }
.day.today .day-head { background: var(--accent); color: var(--accent-ink); }
.day.today .day-head small { color: var(--accent-ink); opacity: 0.85; }
.block .status { font-weight: 700; }
.week-nav .inline-form { flex-wrap: nowrap; }
@media (max-width: 640px) { .week-nav { width: 100%; } }

/* Sub requests on the schedule: open = orange, hatched and dashed; claimed by a sub = green */
.block.cover-open {
  background-color: var(--open); border-color: var(--open-edge); border-style: dashed; border-left-style: solid;
  background-image: repeating-linear-gradient(135deg, transparent 0 7px, rgba(194, 106, 0, 0.16) 7px 14px);
}
.block.cover-covered { background: var(--sub); border-color: var(--sub-edge); }
.block .status-open { color: var(--open-ink); }
.block .status-sub { color: var(--sub-ink); }
.badge-open { background: var(--open); color: var(--open-ink); border: 1px dashed var(--open-edge); }
.badge-sub { background: var(--sub); color: var(--sub-ink); border: 1px solid var(--sub-edge); }

/* Board: two kinds of message, easy to tell apart, plus filter chips */
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.2rem 0 1rem; }
.chip { display: inline-flex; align-items: center; gap: 0.45rem; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0.3rem 0.85rem; font-weight: 600; }
.chip .count { font-size: 0.78rem; background: var(--filler); border-radius: 999px; padding: 0 0.45rem; }
.chip:hover { border-color: var(--accent); }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip.active .count { background: rgba(255, 255, 255, 0.25); color: inherit; }
.chip-request:not(.active) { border-color: var(--open-edge); }
.chip-announcement:not(.active) { border-color: var(--announce-edge); }
.card.kind-request { border-left: 6px solid var(--open-edge); background: color-mix(in srgb, var(--open) 35%, var(--surface)); }
.card.kind-announcement { border-left: 6px solid var(--announce-edge); }
.badge-request { background: var(--open); color: var(--open-ink); border: 1px dashed var(--open-edge); }
.badge-announcement { background: var(--announce); color: var(--announce-edge); border: 1px solid var(--announce-edge); }
.request-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.request-row h2 { margin: 0.2rem 0; }
.request-row p { margin: 0.15rem 0; }
.request-when { margin: 0.2rem 0 0.4rem; }

/* Home page */
.tagline { margin: -0.4rem 0 0.8rem; color: var(--muted); font-size: 1.05rem; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; align-items: start; }
.home-grid .card { margin: 0; }
.legal-id { border-left: 6px solid var(--accent); }
.legal-when { margin: 0 0 0.4rem; }
.legal-text { margin: 0.4rem 0 0; padding: 0.7rem 1rem; background: var(--bg); border-radius: 8px; font-size: 1.2rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.contacts li > * { margin: 0.05rem 0; }
.card.narrow-wide { max-width: 760px; }
.station-items > li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.station-items .item-main { min-width: 0; overflow-wrap: anywhere; }
.linklike:disabled { color: var(--muted); cursor: default; text-decoration: none; opacity: 0.4; }
.status-line { margin: 0 0 0.8rem; }
code { background: var(--bg); border-radius: 4px; padding: 0.05rem 0.3rem; font-size: 0.9em; }
