/* BBCQ Sermons & Shorts: design tokens, light + dark themes, components. No build step, system fonts only.
   Theme: no data-theme -> follows the system; data-theme="light" | "dark" (set by theme-init.js) overrides it. */

:root {
  color-scheme: light;
  --bg: #f2f4f6; --surface: #ffffff; --surface-2: #f6f8f9; --surface-3: #eceff2;
  --ink: #14212a; --ink-2: #33434e; --muted: #53636e; --line: #dce2e7; --line-strong: #bfcad2;
  --brand: #37596e; --brand-strong: #294557; --brand-soft: #e5edf2; --brand-ink: #24414f;
  --on-brand: #ffffff; --accent: #feec00; --accent-ink: #1a1a00;
  --link: #2a5872; --focus: #0b5f8a;
  --primary: #37596e; --primary-hover: #294557; --on-primary: #ffffff;
  --ok: #1d6a4a; --ok-soft: #e2f2e9; --warn: #855400; --warn-soft: #fcf0d2; --bad: #a12c2c; --bad-soft: #fbe6e6;
  --neutral: #44525c; --neutral-soft: #e9edf0;
  --header-bg: #37596e; --header-ink: #ffffff; --header-muted: #d8e3ea; --header-line: rgba(255, 255, 255, .14);
  --player-bg: #0e171d; --thumb-bg: #dfe6eb;
  --shadow-sm: 0 1px 2px rgba(20, 33, 42, .06), 0 1px 1px rgba(20, 33, 42, .04);
  --shadow: 0 1px 2px rgba(20, 33, 42, .05), 0 6px 18px -6px rgba(20, 33, 42, .12);
  --shadow-lg: 0 24px 60px -12px rgba(10, 20, 28, .35);
  --scrim: rgba(10, 18, 24, .55);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c1419; --surface: #131e25; --surface-2: #17242c; --surface-3: #1e2d37;
  --ink: #e8eef2; --ink-2: #c3cfd7; --muted: #98a9b4; --line: #24333d; --line-strong: #3a4c58;
  --brand: #8fb7cd; --brand-strong: #b4d2e2; --brand-soft: #1b3140; --brand-ink: #cfe3ee;
  --on-brand: #0b1820; --link: #9fcbe4; --focus: #feec00;
  --primary: #9cc4da; --primary-hover: #bcdaea; --on-primary: #0a1820;
  --ok: #7dd4a8; --ok-soft: #12301f; --warn: #f2c66b; --warn-soft: #34270b; --bad: #f19a9a; --bad-soft: #3a1717;
  --neutral: #b7c4cc; --neutral-soft: #22313b;
  --header-bg: #111c23; --header-ink: #f1f5f8; --header-muted: #a9bac5; --header-line: rgba(255, 255, 255, .08);
  --player-bg: #05090c; --thumb-bg: #1c2a33;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -8px rgba(0, 0, 0, .5);
  --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, .7);
  --scrim: rgba(0, 0, 0, .66);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0c1419; --surface: #131e25; --surface-2: #17242c; --surface-3: #1e2d37;
    --ink: #e8eef2; --ink-2: #c3cfd7; --muted: #98a9b4; --line: #24333d; --line-strong: #3a4c58;
    --brand: #8fb7cd; --brand-strong: #b4d2e2; --brand-soft: #1b3140; --brand-ink: #cfe3ee;
    --on-brand: #0b1820; --link: #9fcbe4; --focus: #feec00;
    --primary: #9cc4da; --primary-hover: #bcdaea; --on-primary: #0a1820;
    --ok: #7dd4a8; --ok-soft: #12301f; --warn: #f2c66b; --warn-soft: #34270b; --bad: #f19a9a; --bad-soft: #3a1717;
    --neutral: #b7c4cc; --neutral-soft: #22313b;
    --header-bg: #111c23; --header-ink: #f1f5f8; --header-muted: #a9bac5; --header-line: rgba(255, 255, 255, .08);
    --player-bg: #05090c; --thumb-bg: #1c2a33;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -8px rgba(0, 0, 0, .5);
    --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, .7);
    --scrim: rgba(0, 0, 0, .66);
  }
}

:root {
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --r-sm: 8px; --r: 12px; --r-lg: 16px; --pad: clamp(1rem, 3.2vw, 2rem);
  --header-h: 112px; --ease: cubic-bezier(.2, .7, .2, 1);
  font: 15px/1.5 var(--font); color: var(--ink); background: var(--bg);
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; }
a { color: var(--link); text-underline-offset: .18em; text-decoration-thickness: from-font; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -.01em; color: var(--ink); }
h1 { font-size: 1.6rem; margin: 0 0 .5rem; } h2 { font-size: 1.2rem; margin: 0; } h3 { font-size: 1rem; margin: 0; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); } .small { font-size: .84rem; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; font-weight: 700; color: var(--muted); margin: 0 0 .4rem; }
svg.i { width: 1.1em; height: 1.1em; flex: none; vertical-align: -.18em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* focus: visible on keyboard only, high contrast in both themes */
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.top :focus-visible, .banner :focus-visible { outline-color: var(--accent); }
main:focus { outline: none; }

.skip { position: absolute; left: .75rem; top: -3rem; z-index: 100; background: var(--accent); color: var(--accent-ink); font-weight: 700; padding: .55rem .9rem; border-radius: var(--r-sm); text-decoration: none; transition: top .15s; }
.skip:focus { top: .75rem; }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 30; background: var(--header-bg); color: var(--header-ink); box-shadow: 0 1px 0 var(--header-line), 0 6px 20px -12px rgba(0, 0, 0, .5); }
.top::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--accent); transform-origin: left; }
.top-in { max-width: 1440px; margin: 0 auto; padding: .7rem var(--pad) .55rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .9rem; color: inherit; text-decoration: none; min-width: 0; }
.brand img { height: 40px; width: auto; display: block; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.2; padding-left: .9rem; border-left: 1px solid rgba(255, 255, 255, .28); min-width: 0; }
.brand-txt b, .brand-txt strong { font-size: 1.02rem; font-weight: 650; letter-spacing: -.005em; white-space: nowrap; }
.brand-txt span { font-size: .78rem; color: var(--header-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-tools { display: flex; align-items: center; gap: .5rem; }
.yt { color: var(--header-ink); text-decoration: none; font-size: .85rem; font-weight: 600; padding: .4rem .7rem; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .28); display: inline-flex; gap: .35rem; align-items: center; }
.yt:hover { background: rgba(255, 255, 255, .1); }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .28); background: transparent; color: var(--header-ink); cursor: pointer; font: inherit; }
.icon-btn:hover { background: rgba(255, 255, 255, .12); }
.icon-btn svg.i { width: 20px; height: 20px; }
.tabs { max-width: 1440px; margin: 0 auto; padding: 0 calc(var(--pad) - .6rem); display: flex; gap: .15rem; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { position: relative; flex: none; color: var(--header-muted); text-decoration: none; font-weight: 550; font-size: .92rem; padding: .55rem .6rem .8rem; border-radius: 6px 6px 0 0; transition: color .15s; }
.tabs a:hover { color: var(--header-ink); }
.tabs a[aria-current] { color: var(--header-ink); }
.tabs a[aria-current]::after { content: ""; position: absolute; left: .6rem; right: .6rem; bottom: 3px; height: 3px; border-radius: 3px; background: var(--accent); }
.tabs a .n { display: inline-block; min-width: 1.35rem; margin-left: .3rem; padding: 0 .35rem; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: .72rem; font-weight: 700; text-align: center; line-height: 1.35rem; }

/* ---------- banner ---------- */
.banner { max-width: 1440px; width: calc(100% - 2 * var(--pad)); margin: 1rem auto 0; padding: .7rem 1rem; border-radius: var(--r); background: var(--brand-soft); color: var(--brand-ink); border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent); display: flex; gap: .65rem; align-items: flex-start; font-size: .9rem; }
.banner svg.i { margin-top: .15rem; }
.banner.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.banner b { font-weight: 650; }

/* ---------- layout ---------- */
main { width: 100%; max-width: 1440px; margin: 0 auto; padding: 1.25rem var(--pad) 2.5rem; display: flex; flex-direction: column; gap: 1.5rem; flex: 1; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: clamp(1rem, 2.4vw, 1.6rem); box-shadow: var(--shadow-sm); min-width: 0; }
.ph { display: flex; flex-direction: column; gap: .2rem; margin-bottom: 1.1rem; }
.ph h2 { font-size: clamp(1.15rem, 1rem + .6vw, 1.4rem); font-weight: 700; display: flex; align-items: center; gap: .5rem; }
.ph h2::before { content: ""; width: 6px; height: 1.1em; border-radius: 3px; background: var(--accent); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.ph-sub { margin: 0; color: var(--muted); font-size: .9rem; }
.body > :last-child { margin-bottom: 0; }
.sub-h { font-size: .95rem; font-weight: 650; margin: 1.4rem 0 .6rem; }

/* summary stats */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: .85rem 1rem; box-shadow: var(--shadow-sm); display: flex; flex-direction: column-reverse; gap: .15rem; min-width: 0; }
.metric b { font-size: 1.45rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.metric span { color: var(--muted); font-size: .8rem; line-height: 1.3; }
.metric.hl { background: var(--brand); border-color: var(--brand); }
.metric.hl b, .metric.hl span { color: var(--on-brand); }
.metric.hl span { opacity: .9; }

/* ---------- controls ---------- */
.row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; }
label.f { display: flex; flex-direction: column; gap: .3rem; font-size: .8rem; font-weight: 600; color: var(--ink-2); min-width: 0; }
input, select, textarea { font: inherit; font-size: .95rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: .5rem .7rem; min-height: 40px; max-width: 100%; transition: border-color .15s, box-shadow .15s; }
select { padding-right: 2rem; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2378889a' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .55rem center; background-size: 16px; cursor: pointer; }
input:hover:not(:disabled), select:hover:not(:disabled), textarea:hover:not(:disabled) { border-color: var(--brand); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 35%, transparent); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--ink-2); border-style: dashed; cursor: not-allowed; opacity: 1; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
textarea { width: 100%; resize: vertical; min-height: 64px; }

.btn { font: inherit; font-size: .9rem; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 40px; padding: .45rem .95rem; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, transform .1s; }
.btn:hover:not(:disabled) { border-color: var(--brand); background: var(--surface-2); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line-strong)); }
.btn.danger:hover:not(:disabled) { background: var(--bad-soft); border-color: var(--bad); }
.btn.danger-solid { background: var(--bad); border-color: var(--bad); color: var(--surface); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--link); padding-inline: .6rem; }
.btn.ghost:hover:not(:disabled) { background: var(--brand-soft); border-color: transparent; }
.btn.sm { min-height: 34px; padding: .3rem .7rem; font-size: .84rem; }
.btn:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }
.approver:not(.turn) .btn:disabled { filter: saturate(.3); }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after { content: ""; position: absolute; width: 1em; height: 1em; border-radius: 50%; border: 2px solid var(--muted); border-top-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--surface-3); border: 1px solid var(--line); }
.seg button { font: inherit; font-size: .86rem; font-weight: 600; display: inline-flex; align-items: center; gap: .35rem; border: 0; border-radius: 7px; background: transparent; color: var(--ink-2); padding: .4rem .75rem; min-height: 34px; cursor: pointer; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ---------- catalogue toolbar ---------- */
.cat-toolbar { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; }
.search { position: relative; flex: 1 1 280px; display: block; }
.search svg.i { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); width: 18px; height: 18px; pointer-events: none; }
.search input { width: 100%; padding-left: 2.4rem; padding-right: 2.6rem; min-height: 44px; border-radius: 999px; background: var(--surface-2); }
.search kbd { position: absolute; right: .7rem; top: 50%; transform: translateY(-50%); font: 600 .72rem/1 var(--font); color: var(--muted); border: 1px solid var(--line-strong); border-radius: 5px; padding: .2rem .4rem; pointer-events: none; }
.search input:not(:placeholder-shown) + kbd, .search input:focus + kbd { display: none; }
.sort { display: flex; align-items: center; gap: .45rem; font-size: .84rem; font-weight: 600; color: var(--ink-2); }
.sort select { min-height: 44px; border-radius: 999px; padding-left: .9rem; }
.cat-toolbar .seg { min-height: 44px; align-items: stretch; }
.filters { margin-top: .85rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.filters > summary { list-style: none; cursor: pointer; padding: .65rem .9rem; font-weight: 650; font-size: .9rem; display: flex; align-items: center; gap: .5rem; border-radius: var(--r); }
.filters > summary::-webkit-details-marker { display: none; }
.filters > summary .chev { margin-left: auto; transition: transform .2s; color: var(--muted); }
.filters[open] > summary .chev { transform: rotate(180deg); }
.filters > summary .count { font-size: .75rem; background: var(--brand); color: var(--on-brand); border-radius: 999px; padding: 0 .5rem; line-height: 1.4rem; }
.filters > summary .count:empty { display: none; }
.filter-body { padding: .2rem .9rem .9rem; display: flex; flex-direction: column; gap: .8rem; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.filter-grid select { width: 100%; }

.pills { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.pills + .pills { margin-top: .55rem; }
.pills .lbl { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); min-width: 5.2rem; }
.pill { font: inherit; font-size: .84rem; font-weight: 550; display: inline-flex; align-items: center; gap: .35rem; min-height: 34px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: .2rem .75rem; cursor: pointer; color: var(--ink); transition: background .15s, border-color .15s; }
.pill:hover { border-color: var(--brand); }
.pill .c { font-size: .74rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.pill[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.pill[aria-pressed="true"] .c { color: inherit; opacity: .85; }
.pill.more { border-style: dashed; color: var(--link); background: transparent; }
.active-filters { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: .85rem; }
.active-filters:empty { display: none; }
.af { display: inline-flex; align-items: center; gap: .3rem; font: inherit; font-size: .8rem; font-weight: 600; border-radius: 999px; padding: .2rem .35rem .2rem .7rem; min-height: 30px; border: 1px solid color-mix(in srgb, var(--brand) 35%, transparent); background: var(--brand-soft); color: var(--brand-ink); cursor: pointer; }
.af svg.i { width: 14px; height: 14px; }
.af:hover { border-color: var(--brand); }
.count-line { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .5rem; margin: 1rem 0 .2rem; font-size: .86rem; color: var(--muted); }
.count-line b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; gap: .35rem; font-size: .74rem; font-weight: 650; padding: .14rem .55rem; border-radius: 999px; background: var(--brand-soft); color: var(--brand-ink); white-space: nowrap; line-height: 1.35; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.chip.plain::before { display: none; }
.chip.draft { background: var(--neutral-soft); color: var(--neutral); }
.chip.changes_requested { background: var(--warn-soft); color: var(--warn); }
.chip.pre_approved { background: var(--brand-soft); color: var(--brand-ink); }
.chip.approved { background: var(--ok-soft); color: var(--ok); }
.chip.rejected, .chip.cancelled { background: var(--bad-soft); color: var(--bad); }
.chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.chips:empty { display: none; }

/* ---------- catalogue grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 1.1rem; margin-top: .8rem; }
.card { position: relative; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); display: flex; flex-direction: column; transition: border-color .2s, box-shadow .2s, transform .2s var(--ease); }
.card:hover, .card:focus-within { border-color: var(--line-strong); box-shadow: var(--shadow); transform: translateY(-2px); }
.card.sel { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand); }
.media { position: relative; display: block; aspect-ratio: 16 / 9; background: var(--thumb-bg); overflow: hidden; }
.thumb { display: block; width: 100%; height: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--thumb-bg); transition: transform .35s var(--ease); }
.card:hover .thumb { transform: scale(1.035); }
.badge { position: absolute; font-size: .72rem; font-weight: 700; padding: .12rem .42rem; border-radius: 5px; background: rgba(8, 14, 18, .82); color: #fff; font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.badge.dur { right: .45rem; bottom: .45rem; }
.badge.type { left: .45rem; top: .45rem; background: var(--accent); color: var(--accent-ink); text-transform: capitalize; }
.badge.shorts { left: .45rem; bottom: .45rem; background: rgba(8, 14, 18, .82); }
.card .in { padding: .8rem .9rem .9rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.card h3 { font-size: .97rem; font-weight: 650; line-height: 1.32; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a:hover { color: var(--link); text-decoration: underline; }
.card .meta { font-size: .82rem; color: var(--muted); display: flex; flex-wrap: wrap; column-gap: .45rem; }
.card .meta.who { color: var(--ink-2); font-weight: 550; }
.card .meta .dot::before { content: "·"; margin-right: .45rem; }
.card .series { font-size: .78rem; color: var(--brand-ink); background: var(--brand-soft); align-self: flex-start; padding: .08rem .5rem; border-radius: 5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .foot { margin-top: auto; padding-top: .45rem; display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.card .stats { font-size: .8rem; color: var(--muted); display: inline-flex; align-items: center; gap: .3rem; font-variant-numeric: tabular-nums; }

/* ---------- tables ---------- */
.tablewrap { overflow: auto; margin-top: .8rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.tablewrap.tall { max-height: 760px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .88rem; }
th, td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
th { color: var(--muted); font-weight: 650; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; background: var(--surface-2); position: sticky; top: 0; z-index: 1; white-space: nowrap; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--surface-2); }
td img.tn { width: 112px; height: 63px; object-fit: cover; border-radius: 6px; background: var(--thumb-bg); display: block; }
td.c-tn { width: 128px; min-width: 128px; } td img.tn { max-width: none; aspect-ratio: 16 / 9; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
td .t-title { font-weight: 600; color: var(--ink); text-decoration: none; }
td .t-title:hover { color: var(--link); text-decoration: underline; }
td.nowrap, th.nowrap { white-space: nowrap; }

/* ---------- approval queue ---------- */
.flow { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.flow .step { display: inline-flex; align-items: center; gap: .45rem; padding: .35rem .75rem .35rem .4rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: .84rem; font-weight: 600; color: var(--ink-2); }
.flow .step b { min-width: 1.6rem; height: 1.6rem; display: inline-grid; place-items: center; border-radius: 999px; background: var(--surface-3); color: var(--ink); font-size: .8rem; font-variant-numeric: tabular-nums; }
.flow .step.on b { background: var(--accent); color: var(--accent-ink); }
.flow .arrow { color: var(--muted); }
.qgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr)); gap: 1.1rem; }
.qcard { border: 1px solid var(--line); border-radius: var(--r); padding: 1rem; display: grid; grid-template-columns: minmax(150px, 210px) 1fr; gap: 1.1rem; background: var(--surface); min-width: 0; scroll-margin-top: calc(var(--header-h) + 16px); }
.qcard.no-media { grid-template-columns: 1fr; }
.qcard .qmain { display: flex; flex-direction: column; gap: .6rem; min-width: 0; }
.qcard .qhead { display: flex; justify-content: space-between; align-items: flex-start; gap: .6rem; }
.qcard h3 { font-size: 1.02rem; font-weight: 700; }
.qcard .src { font-size: .83rem; color: var(--muted); }
.qcard .src a { font-weight: 600; }
.qcard .stage-note { font-size: .86rem; color: var(--ink-2); display: flex; gap: .4rem; align-items: center; }
.qmedia { display: flex; flex-direction: column; gap: .45rem; align-items: stretch; }
.player { display: block; width: 100%; aspect-ratio: 9 / 16; border: 0; border-radius: 10px; background: var(--player-bg); box-shadow: var(--shadow-sm); }
.player-empty { aspect-ratio: 9 / 16; border-radius: 10px; border: 1px dashed var(--line-strong); background: var(--surface-2); display: grid; place-items: center; text-align: center; padding: 1rem; color: var(--muted); font-size: .82rem; }
.qcard.no-media .player-empty { aspect-ratio: auto; display: flex; gap: .5rem; justify-content: flex-start; padding: .6rem .8rem; text-align: left; }
.qcard.no-media .player-empty svg.i { margin: 0; width: 18px; height: 18px; }
.player-empty svg.i { width: 28px; height: 28px; display: block; margin: 0 auto .4rem; }
.drive-link { font-size: .82rem; display: inline-flex; gap: .3rem; align-items: center; font-weight: 600; }
.approver { border: 1px solid var(--line); border-radius: var(--r-sm); padding: .65rem .7rem; background: var(--surface-2); display: flex; flex-direction: column; gap: .5rem; }
.approver.turn { border-color: color-mix(in srgb, var(--brand) 55%, var(--line)); background: var(--brand-soft); }
.approver .who { font-size: .8rem; font-weight: 650; color: var(--ink-2); display: flex; align-items: center; gap: .4rem; }
.approver .who .tag { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; background: var(--accent); color: var(--accent-ink); padding: .05rem .4rem; border-radius: 4px; }
.approver .acts { display: flex; flex-wrap: wrap; gap: .45rem; }
.approver .acts .btn { flex: 1 1 auto; }
.note-box { display: flex; flex-direction: column; gap: .5rem; }
.note-box .acts { display: flex; flex-wrap: wrap; gap: .45rem; justify-content: space-between; }
.note-box .acts .l { display: flex; flex-wrap: wrap; gap: .45rem; }
.hint { font-size: .82rem; color: var(--muted); display: flex; gap: .35rem; align-items: center; }
.notes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; font-size: .85rem; }
.notes li { position: relative; padding-left: 1rem; border-left: 2px solid var(--line-strong); }
.notes li::before { content: ""; position: absolute; left: -5px; top: .45rem; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.notes .by { font-size: .76rem; color: var(--muted); display: block; }
.notes-h { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: .2rem 0 -.1rem; }
.rendered .quote { font-size: .92rem; color: var(--ink); border-left: 3px solid var(--accent); padding-left: .7rem; font-style: italic; }
.rendered .caption { font-size: .82rem; color: var(--muted); background: var(--surface-2); border-radius: var(--r-sm); padding: .55rem .7rem; overflow-wrap: anywhere; }

.callout { display: flex; gap: .6rem; align-items: flex-start; background: var(--brand-soft); color: var(--brand-ink); border-radius: var(--r); padding: .7rem .9rem; font-size: .88rem; margin: 0 0 1rem; }
.callout svg.i { margin-top: .12rem; }
.callout.warn { background: var(--warn-soft); color: var(--warn); }
.empty { text-align: center; padding: 2rem 1rem; border: 1px dashed var(--line-strong); border-radius: var(--r); color: var(--muted); background: var(--surface-2); }
.empty svg.i { width: 32px; height: 32px; display: block; margin: 0 auto .6rem; color: var(--brand); }
.empty b { display: block; color: var(--ink); font-size: 1rem; margin-bottom: .2rem; }

/* ---------- schedule ---------- */
.chan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: .75rem; }
.chan { border: 1px solid var(--line); border-radius: var(--r); padding: .85rem 1rem; display: flex; flex-direction: column; gap: .3rem; background: var(--surface-2); }
.chan .p { display: flex; align-items: center; gap: .5rem; font-weight: 650; }
.chan .p .dotp { width: 10px; height: 10px; border-radius: 50%; background: var(--brand); flex: none; }
.chan .q { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.chan .q small { font-size: .8rem; font-weight: 500; color: var(--muted); margin-left: .25rem; }
.slots { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .4rem; }
.slot { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--line); border-radius: var(--r-sm); padding: .35rem .65rem; font-size: .84rem; background: var(--surface); font-variant-numeric: tabular-nums; }
.slot svg.i { color: var(--brand); }
.assign { margin-top: 1rem; padding: 1rem; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface-2); }
.assign .row > label.f { flex: 1 1 150px; }
.assign .row > label.f select, .assign .row > label.f input { width: 100%; }

/* ---------- metrics ---------- */
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 1rem; }
.chart { border: 1px solid var(--line); border-radius: var(--r); padding: .9rem 1rem .6rem; background: var(--surface-2); min-width: 0; }
.chart h3 { font-size: .92rem; margin-bottom: .5rem; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 150px; padding: .3rem 0; border-bottom: 1px solid var(--line-strong); }
.bars div { flex: 1; background: linear-gradient(to top, var(--brand), color-mix(in srgb, var(--brand) 65%, var(--surface))); border-radius: 3px 3px 0 0; min-height: 2px; transition: opacity .15s; }
.bars div:hover { opacity: .75; }
.bars + p { margin: .45rem 0 0; }
.met-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .6rem; margin-top: 1.2rem; }

/* ---------- settings ---------- */
.set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 1rem; }
.fieldset { border: 1px solid var(--line); border-radius: var(--r); padding: 1rem; margin: 0; display: flex; flex-direction: column; gap: .75rem; background: var(--surface-2); min-width: 0; }
.fieldset legend { padding: 0 .4rem; font-weight: 700; font-size: .9rem; }
.fieldset label.f input, .fieldset label.f select { width: 100%; }
.fieldset .desc { font-size: .82rem; color: var(--muted); margin: -.2rem 0 0; }
.set-foot { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; margin-top: 1rem; }
.set-foot p { margin: 0; }

/* ---------- dialogs ---------- */
dialog { color: var(--ink); background: var(--surface); border: 1px solid var(--line); padding: 0; box-shadow: var(--shadow-lg); }
dialog::backdrop { background: var(--scrim); backdrop-filter: blur(3px); }
dialog.sheet { width: min(1100px, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); border-radius: var(--r-lg); overflow: auto; }
dialog.sheet[open] { animation: rise .25s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.99); } }
.sheet-head { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .9rem 1.2rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.sheet-head h2 { font-size: 1.08rem; }
.sheet-body { padding: 1.2rem; display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 1.4rem; align-items: start; }
.sheet-body .hero img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--r); display: block; background: var(--thumb-bg); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: .35rem .9rem; font-size: .86rem; margin: .9rem 0; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; font-weight: 550; }
.sheet .qgrid { grid-template-columns: 1fr; }
dialog.confirm { width: min(440px, calc(100vw - 2rem)); border-radius: var(--r-lg); }
dialog.confirm form { padding: 1.3rem; }
dialog.confirm h2 { font-size: 1.1rem; margin-bottom: .5rem; }
dialog.confirm .actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.2rem; flex-wrap: wrap; }

/* ---------- toasts ---------- */
.toasts { position: fixed; z-index: 60; bottom: max(1rem, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: .5rem; width: min(440px, calc(100vw - 2rem)); pointer-events: none; }
.toast { pointer-events: auto; background: var(--ink); color: var(--bg); border-radius: var(--r); padding: .75rem 1rem; box-shadow: var(--shadow-lg); font-size: .9rem; display: flex; gap: .55rem; align-items: flex-start; animation: rise .2s var(--ease); }
.toast.err { background: var(--bad); color: #fff; }
:root[data-theme="dark"] .toast.err { color: #1a0505; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast.err { color: #1a0505; } }

/* ---------- footer ---------- */
.foot-bar { border-top: 1px solid var(--line); padding: 1.2rem var(--pad) 2rem; text-align: center; font-size: .8rem; color: var(--muted); }
.foot-bar p { margin: .2rem auto; max-width: 900px; }

/* ---------- standalone pages: 404 and the signed-link confirm page ---------- */
body.solo { background: var(--bg); }
.solo-main { flex: 1; display: grid; place-items: start center; padding: clamp(1.5rem, 6vw, 4rem) 1rem; }
.solo-card { width: min(520px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: clamp(1.3rem, 4vw, 2rem); box-shadow: var(--shadow); }
.solo-card h1, main.link-page h1 { font-size: clamp(1.3rem, 1.1rem + 1vw, 1.65rem); }
main.link-page { display: block; max-width: 560px; margin: clamp(1.5rem, 6vw, 4rem) auto; padding: clamp(1.3rem, 4vw, 2rem); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); width: calc(100% - 2rem); flex: none; }
main.link-page form { display: flex; flex-direction: column; gap: .9rem; margin: 1rem 0; }
main.link-page label { font-weight: 600; font-size: .9rem; margin-bottom: -.5rem; }
main.link-page label br, main.link-page form > br { display: none; }
main.link-page .btn { align-self: flex-start; min-width: 9rem; min-height: 44px; }
main.link-page b { color: var(--ink); }
main.link-page > p:last-child { margin: 1.2rem 0 0; padding-top: 1rem; border-top: 1px solid var(--line); font-size: .9rem; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .sheet-body { grid-template-columns: 1fr; }
  .sheet-body .hero { max-width: 560px; }
}
@media (max-width: 760px) {
  :root { font-size: 15px; --header-h: 104px; }
  .brand img { height: 32px; }
  .brand-txt { padding-left: .7rem; }
  .brand-txt b, .brand-txt strong { font-size: .95rem; }
  .yt { display: none; }
  .tabs a { font-size: .88rem; padding: .5rem .55rem .75rem; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
  .metric { padding: .7rem .8rem; } .metric b { font-size: 1.25rem; }
  .panel { border-radius: var(--r); }
  .search { flex-basis: 100%; }
  .search kbd { display: none; }
  .sort { flex: 1; } .sort select { flex: 1; }
  .pills { flex-wrap: nowrap; overflow-x: auto; margin-inline: calc(-1 * clamp(1rem, 2.4vw, 1.6rem)); padding: .1rem clamp(1rem, 2.4vw, 1.6rem) .3rem; scrollbar-width: none; scroll-snap-type: x proximity; }
  .pills::-webkit-scrollbar { display: none; }
  .pills .lbl { position: sticky; left: -1px; z-index: 1; background: var(--surface); min-width: auto; padding-right: .4rem; align-self: stretch; display: flex; align-items: center; }
  .pill { flex: none; scroll-snap-align: start; }
  .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid { grid-template-columns: 1fr; gap: .9rem; }
  .qcard { grid-template-columns: 1fr; padding: .85rem; }
  .tabs { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .qmedia { align-items: center; }
  .qmedia .player, .qmedia .player-empty { max-width: 260px; margin: 0 auto; }
  .qmedia .player-empty { aspect-ratio: auto; width: 100%; max-width: none; padding: .8rem; }
  .qmedia .player-empty svg.i { display: inline; margin: 0 .3rem 0 0; width: 18px; height: 18px; }
  .approver .acts .btn { flex: 1 1 calc(50% - .5rem); }
  dialog.sheet { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; margin: 0; border-radius: 0; border: 0; }
  .sheet-body { padding: 1rem; }
  /* list view: table rows become stacked rows */
  table.cat-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.cat-table, table.cat-table tbody { display: block; }
  table.cat-table tr { display: grid; grid-template-columns: 104px 1fr; column-gap: .8rem; row-gap: .1rem; padding: .75rem; border-bottom: 1px solid var(--line); }
  table.cat-table td { border: 0; padding: 0; font-size: .82rem; color: var(--muted); }
  table.cat-table td.c-tn { grid-row: 1 / span 6; width: auto; min-width: 0; }
  table.cat-table td.c-tn img { width: 104px; height: 59px; }
  table.cat-table td.c-title { font-size: .92rem; color: var(--ink); }
  table.cat-table td[data-label]:not(:empty)::before { content: attr(data-label) ": "; color: var(--muted); font-weight: 600; }
  table.cat-table td.c-hide-sm, table.cat-table td:empty { display: none; }
  table.cat-table td.num { text-align: left; }
  .tablewrap.tall { max-height: none; }
}
@media (max-width: 420px) {
  .brand-txt span { display: none; }
  .brand { gap: .65rem; }
  .brand img { height: 28px; }
  .icon-btn { width: 38px; height: 38px; }
  .flow .arrow { display: none; }
}
@media (min-width: 1600px) { :root { font-size: 16px; } }

/* ---------- motion & print ---------- */
@media (prefers-reduced-motion: reduce) {
  :root { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .card:hover, .card:focus-within { transform: none; }
  .card:hover .thumb { transform: none; }
}
@media (forced-colors: active) {
  .chip, .pill, .btn, .seg button[aria-pressed="true"] { border: 1px solid CanvasText; }
  .tabs a[aria-current]::after, .ph h2::before { background: Highlight; }
}
@media print {
  .top, .tabs, .banner, .toasts, .cat-toolbar, .filters, .pills, dialog, iframe { display: none !important; }
  .panel { box-shadow: none; break-inside: avoid-page; }
}

/* Public view (not signed in through Cloudflare Access): approvals, drafts, schedule and settings are hidden. */
body.public [data-private] { display: none !important; }
.banner a { color: inherit; font-weight: 650; }
.signin { white-space: nowrap; }
@media (max-width: 760px) { .yt.signin { display: inline-flex; } }
