/* CineVault design system.
   "Midnight cinema": a near-black blue stage, the electric blue and amber of the logo as accents, chrome-white text.
   One stylesheet, no JavaScript, no web fonts, no external assets (the CSP allows none of them).
   Light and dark follow the visitor's system setting. Every colour pair is checked by tests/contrast.py. */

:root {
  color-scheme: light dark;

  /* surfaces */
  --bg: #f3f6fb;
  --bg-grad: #e6edf8;
  --surface: #ffffff;
  --surface-2: #f6f8fc;
  --surface-3: #e9eef7;
  --line: #d9e1ee;
  --line-strong: #c3cfe2;
  --input-line: #7d8da8;

  /* text */
  --text: #0e1726;
  --muted: #52627d;
  --on-dark: #f2f6fd;

  /* brand */
  --blue: #0b5fd6;
  --blue-hover: #094fb4;
  --blue-soft: #e3eefc;
  --blue-text: #0a58c8;
  --on-blue: #ffffff;
  --gold: #f5a524;
  --gold-hover: #e69610;
  --gold-text: #8a5700;
  --on-gold: #1b1203;
  --ring: #0b5fd6;

  /* status: bg / fg pairs, each at least 4.5:1 */
  --ok-bg: #dcf5e7;    --ok: #11603a;
  --warn-bg: #fdf0cf;  --warn: #7a4b00;
  --bad-bg: #fde4e4;   --bad: #a11d1d;
  --info-bg: #e3eefc;  --info: #0a58c8;
  --mute-bg: #e9eef7;  --mute: #44546e;
  --gold-bg: #fdecc6;  --gold-fg: #7a4b00;
  --purple-bg: #ece6fb; --purple: #5a2fb0;

  /* shape */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(14, 23, 38, .08);
  --shadow-md: 0 8px 24px -8px rgba(14, 23, 38, .18);
  --shadow-lg: 0 24px 60px -20px rgba(14, 23, 38, .35);
  --glow: 0 14px 34px -12px rgba(11, 95, 214, .45);

  --topbar: rgba(255, 255, 255, .82);
  --hero-a: rgba(11, 95, 214, .16);
  --hero-b: rgba(245, 165, 36, .20);
  --fade: linear-gradient(180deg, rgba(243, 246, 251, .35) 0%, rgba(243, 246, 251, .86) 62%, #f3f6fb 100%);
  --dots: rgba(14, 23, 38, .07);

  --av-0-bg: #dbeafe; --av-0-fg: #1e3a8a;
  --av-1-bg: #dcfce7; --av-1-fg: #14532d;
  --av-2-bg: #fef3c7; --av-2-fg: #78350f;
  --av-3-bg: #fce7f3; --av-3-fg: #831843;
  --av-4-bg: #ede9fe; --av-4-fg: #4c1d95;
  --av-5-bg: #ffedd5; --av-5-fg: #7c2d12;
  --av-6-bg: #cffafe; --av-6-fg: #164e63;
  --av-7-bg: #e2e8f0; --av-7-fg: #1e293b;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #070a11;
    --bg-grad: #0c1424;
    --surface: #0f1522;
    --surface-2: #131b2c;
    --surface-3: #1a2438;
    --line: #202b40;
    --line-strong: #2d3b58;
    --input-line: #6c7d9b;

    --text: #eaf0fb;
    --muted: #9aa8c2;

    --blue: #3b9bff;
    --blue-hover: #62b0ff;
    --blue-soft: #10264a;
    --blue-text: #6fb4ff;
    --on-blue: #04101f;
    --gold: #ffb331;
    --gold-hover: #ffc250;
    --gold-text: #ffc457;
    --on-gold: #1b1203;
    --ring: #6fb4ff;

    --ok-bg: #0f2e1f;    --ok: #5fe0a0;
    --warn-bg: #36280a;  --warn: #ffd37a;
    --bad-bg: #3a1618;   --bad: #ff9a9a;
    --info-bg: #11284a;  --info: #7fbcff;
    --mute-bg: #1a2438;  --mute: #aab8d0;
    --gold-bg: #3a2a08;  --gold-fg: #ffc457;
    --purple-bg: #271c47; --purple: #c1a6ff;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
    --shadow-md: 0 10px 28px -10px rgba(0, 0, 0, .7);
    --shadow-lg: 0 28px 70px -20px rgba(0, 0, 0, .85);
    --glow: 0 16px 38px -12px rgba(59, 155, 255, .55);

    --topbar: rgba(8, 12, 20, .78);
    --hero-a: rgba(59, 155, 255, .24);
    --hero-b: rgba(255, 179, 49, .14);
    --fade: linear-gradient(180deg, rgba(7, 10, 17, .30) 0%, rgba(7, 10, 17, .82) 60%, #070a11 100%);
    --dots: rgba(255, 255, 255, .055);

    --av-0-bg: #172a52; --av-0-fg: #bcd4ff;
    --av-1-bg: #12351f; --av-1-fg: #b4f0c7;
    --av-2-bg: #3a2c0a; --av-2-fg: #ffe29a;
    --av-3-bg: #43142c; --av-3-fg: #ffc4df;
    --av-4-bg: #2a1d4d; --av-4-fg: #d6c7ff;
    --av-5-bg: #40200c; --av-5-fg: #ffd0a6;
    --av-6-bg: #0f3140; --av-6-fg: #a8eaf7;
    --av-7-bg: #243044; --av-7-fg: #d3deef;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  background-image: linear-gradient(180deg, var(--bg-grad) 0, var(--bg) 520px);
  background-repeat: no-repeat;
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.main { flex: 1; padding-bottom: 3rem; }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.015em; margin: 0; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.2rem); font-weight: 800; }
h2 { font-size: 1.2rem; font-weight: 700; }
h3 { font-size: 1.02rem; font-weight: 700; }
p { margin: 0 0 .75rem; }
a { color: var(--blue-text); text-underline-offset: 3px; }
a:hover { color: var(--blue-hover); }
code { font: .85em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--surface-3); padding: .1em .4em; border-radius: 6px; }
strong { font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.gap { margin-top: 1.5rem; }
.lead { color: var(--muted); font-size: 1.02rem; margin: .35rem 0 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .75rem; font-weight: 700; color: var(--gold-text); margin: 0 0 .5rem; }
.sr, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.skip:focus { position: fixed; top: .6rem; left: .6rem; z-index: 100; background: var(--surface); color: var(--text); padding: .6rem 1rem; border-radius: var(--radius-sm); box-shadow: var(--shadow-md); }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 6px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 1.1em; height: 1.1em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.17em; }
.container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 1.25rem; }
.narrow { max-width: 640px; }
.title-body { display: grid; grid-template-columns: minmax(10rem, 17rem) 1fr; gap: clamp(1.25rem, 4vw, 2.75rem); }
.title-main { grid-column: 2; min-width: 0; padding-bottom: 1rem; }

/* ---- top bar */
.topbar { position: sticky; top: 0; z-index: 30; background: var(--topbar); -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px); border-bottom: 1px solid var(--line); }
.topbar-in { display: flex; align-items: center; gap: 1rem; min-height: 4rem; flex-wrap: wrap; padding-top: .35rem; padding-bottom: .35rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--text); }
.brand-mark { display: block; width: 2.5rem; height: 2.5rem; object-fit: contain; filter: drop-shadow(0 2px 8px rgba(59, 155, 255, .35)); }
.wordmark { font-weight: 850; font-size: 1.2rem; letter-spacing: .14em; text-transform: uppercase; }
.wm-a { color: var(--text); }
.wm-b { color: var(--gold-text); }
.nav { display: flex; gap: .25rem; }
.nav a { display: inline-flex; align-items: center; gap: .45rem; padding: .5rem .8rem; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .95rem; }
.nav a:hover { background: var(--surface-3); color: var(--text); }
.nav a[aria-current="page"] { background: var(--blue-soft); color: var(--blue-text); }
.count { display: inline-flex; align-items: center; justify-content: center; min-width: 1.35rem; height: 1.35rem; padding: 0 .4rem; border-radius: 99px; background: var(--gold); color: var(--on-gold); font-size: .75rem; font-weight: 800; }
.topsearch { flex: 1; min-width: 12rem; max-width: 30rem; margin-left: auto; position: relative; }
.topsearch .icon { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.topsearch input { width: 100%; padding: .6rem 1rem .6rem 2.6rem; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); font: inherit; font-size: .95rem; transition: border-color .15s, background .15s, box-shadow .15s; }
.topsearch input::placeholder { color: var(--muted); opacity: 1; }
.topsearch input:focus { outline: none; border-color: var(--blue); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 30%, transparent); }

/* ---- user menu (a <details>, no script) */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.user { display: inline-flex; align-items: center; gap: .55rem; padding: .25rem .6rem .25rem .3rem; border-radius: 999px; border: 1px solid transparent; font-weight: 600; font-size: .92rem; }
.user:hover, .menu[open] > .user { background: var(--surface-3); }
.user-name { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-panel { position: absolute; right: 0; top: calc(100% + .5rem); min-width: 15rem; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: .5rem; z-index: 40; }
.menu-who { display: grid; gap: .15rem; padding: .6rem .7rem .7rem; border-bottom: 1px solid var(--line); margin-bottom: .4rem; }
.menu-who .badge { justify-self: start; margin-top: .3rem; }
.menu-item { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .6rem .7rem; border-radius: var(--radius-sm); border: 0; background: transparent; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-align: left; }
.menu-item:hover { background: var(--surface-3); }
.avatar { display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 50%; font-weight: 800; font-size: .85rem; letter-spacing: .02em; flex: none; border: 1px solid transparent; }
.avatar-sm { width: 2.1rem; height: 2.1rem; font-size: .78rem; }
.avatar.is-admin { border-color: var(--gold); box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) 28%, transparent); }
.av-0 { background: var(--av-0-bg); color: var(--av-0-fg); } .av-1 { background: var(--av-1-bg); color: var(--av-1-fg); }
.av-2 { background: var(--av-2-bg); color: var(--av-2-fg); } .av-3 { background: var(--av-3-bg); color: var(--av-3-fg); }
.av-4 { background: var(--av-4-bg); color: var(--av-4-fg); } .av-5 { background: var(--av-5-bg); color: var(--av-5-fg); }
.av-6 { background: var(--av-6-bg); color: var(--av-6-fg); } .av-7 { background: var(--av-7-bg); color: var(--av-7-fg); }

/* ---- footer */
.foot { border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; }
.foot-in { display: flex; flex-wrap: wrap; gap: .4rem .8rem; align-items: center; justify-content: center; padding-top: 1.1rem; padding-bottom: 1.1rem; }
.foot-in .icon { margin-right: .15rem; }

/* ---- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .6rem 1.1rem; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 650; font-size: .95rem; cursor: pointer; text-decoration: none; line-height: 1.2; transition: background .15s, border-color .15s, transform .1s, box-shadow .15s; min-height: 2.5rem; }
.btn:hover { background: var(--surface-3); color: var(--text); border-color: var(--input-line); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--blue); border-color: var(--blue); color: var(--on-blue); box-shadow: var(--glow); }
.btn-primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); color: var(--on-blue); }
.btn-request { background: var(--gold); border-color: var(--gold); color: var(--on-gold); box-shadow: 0 14px 34px -12px color-mix(in srgb, var(--gold) 70%, transparent); }
.btn-request:hover { background: var(--gold-hover); border-color: var(--gold-hover); color: var(--on-gold); }
.btn-danger { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 45%, transparent); color: var(--bad); }
.btn-danger:hover { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.btn-ghost { background: transparent; }
.btn-sm { padding: .35rem .8rem; font-size: .85rem; min-height: 2.1rem; }
.btn-lg { padding: .8rem 1.5rem; font-size: 1.02rem; min-height: 3rem; }
.btn-block { display: flex; width: 100%; }
summary.btn { list-style: none; } summary.btn::-webkit-details-marker { display: none; }

/* ---- forms */
.input, select.input { width: 100%; padding: .6rem .8rem; border-radius: var(--radius-sm); border: 1px solid var(--input-line); background: var(--surface); color: var(--text); font: inherit; min-height: 2.6rem; }
.input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 30%, transparent); }
.field { display: grid; gap: .35rem; align-content: start; }
.label { font-weight: 650; font-size: .9rem; }
.hint { display: block; color: var(--muted); font-size: .85rem; font-weight: 400; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; }
.check { display: flex; gap: .8rem; align-items: flex-start; }
.check input { width: 1.25rem; height: 1.25rem; margin-top: .15rem; accent-color: var(--blue); flex: none; }
.check label { display: grid; gap: .15rem; cursor: pointer; }
.stack { display: grid; gap: 1.1rem; }
.form-actions { display: flex; gap: .75rem; }

/* ---- alerts, badges, pills */
.alert { display: flex; gap: .7rem; align-items: flex-start; padding: .8rem 1rem; border-radius: var(--radius); border: 1px solid var(--line); background: var(--info-bg); color: var(--text); margin: 1rem 0; }
.alert .icon { margin-top: .2rem; color: var(--info); }
.alert-success { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 35%, transparent); } .alert-success .icon { color: var(--ok); }
.alert-error { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 40%, transparent); } .alert-error .icon { color: var(--bad); }
.alert-warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 35%, transparent); } .alert-warn .icon { color: var(--warn); }
.badge { display: inline-flex; align-items: center; gap: .4rem; padding: .22rem .7rem; border-radius: 99px; font-size: .8rem; font-weight: 700; background: var(--mute-bg); color: var(--mute); white-space: nowrap; }
.badge-lg { font-size: .95rem; padding: .4rem .95rem; }
.badge-ok, .badge.st-available { background: var(--ok-bg); color: var(--ok); }
.badge-danger, .badge.st-failed, .badge.st-denied { background: var(--bad-bg); color: var(--bad); }
.badge-info, .badge.st-processing, .badge.st-approved { background: var(--info-bg); color: var(--info); }
.badge-warn, .badge.st-pending { background: var(--warn-bg); color: var(--warn); }
.badge.st-downloading { background: var(--purple-bg); color: var(--purple); }
.badge.st-partial { background: var(--gold-bg); color: var(--gold-fg); }
.badge-gold { background: var(--gold-bg); color: var(--gold-fg); }
.badge-mono { background: var(--mute-bg); color: var(--mute); }
.badge.st-none { background: var(--mute-bg); color: var(--mute); }
.pill { display: inline-flex; align-items: center; gap: .35rem; padding: .12rem .6rem; border-radius: 99px; background: var(--surface-3); color: var(--text); font-size: .8rem; font-weight: 650; }
.pill-line { background: transparent; border: 1px solid var(--line-strong); color: var(--muted); }

/* ---- cards, tables, empty states */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head h2 { display: flex; align-items: center; gap: .55rem; }
.card-body { padding: 1.25rem; }
.card-flush { padding: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr)); gap: 1.25rem; align-items: start; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; padding: 2rem 0 1.25rem; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.card .table-wrap { border: 0; border-radius: 0; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { text-align: left; padding: .75rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); background: var(--surface-2); font-weight: 700; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.cell-user { display: flex; align-items: center; gap: .8rem; }
.empty { display: grid; justify-items: center; gap: .4rem; text-align: center; padding: 2rem 1rem; color: var(--muted); }
.empty .icon { width: 2rem; height: 2rem; color: var(--blue-text); opacity: .85; }
.empty-lg { padding: 4rem 1rem; }
.empty-lg .icon { width: 3rem; height: 3rem; }
.empty h1, .empty h2 { color: var(--text); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .7rem 1.2rem; margin: 0; align-items: center; padding: 1rem 1.25rem; }
.kv dt { margin: 0; } .kv dd { margin: 0; color: var(--muted); }
.card > h2 { padding: 1rem 1.25rem 0; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: 1.5rem 0; }

/* ---- tabs, segmented control, chips */
.tabs { display: flex; gap: .25rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 1.5rem; }
.tabs a { display: inline-flex; align-items: center; gap: .5rem; padding: .7rem 1rem; text-decoration: none; color: var(--muted); font-weight: 650; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--gold-text); border-bottom-color: var(--gold); }
.seg { display: inline-flex; background: var(--surface-3); border-radius: 999px; padding: .25rem; gap: .15rem; }
.seg a { display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .95rem; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 650; font-size: .9rem; }
.seg a:hover { color: var(--text); }
.seg a[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.25rem; }
.chipbtn { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .9rem; border-radius: 999px; border: 1px solid var(--line-strong); text-decoration: none; color: var(--muted); font-weight: 650; font-size: .88rem; background: var(--surface); }
.chipbtn:hover { color: var(--text); border-color: var(--input-line); }
.chipbtn[aria-current="page"] { background: var(--blue); border-color: var(--blue); color: var(--on-blue); }

/* ---- hero (home) */
.hero { position: relative; isolation: isolate; text-align: center; padding: clamp(2.5rem, 7vw, 5rem) 0 clamp(1.5rem, 4vw, 3rem); overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: -30% -10% 0; z-index: -2; background: radial-gradient(48% 55% at 18% 8%, var(--hero-a), transparent 72%), radial-gradient(42% 50% at 86% 0%, var(--hero-b), transparent 72%); -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent 100%); mask-image: linear-gradient(180deg, #000 55%, transparent 100%); }
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background-image: radial-gradient(var(--dots) 1px, transparent 1.4px); background-size: 22px 22px; -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 85%); mask-image: linear-gradient(180deg, #000 0%, transparent 85%); }
.hero-title { font-size: clamp(2rem, 1.2rem + 4vw, 3.6rem); font-weight: 850; letter-spacing: -.03em; }
.grad { background: linear-gradient(90deg, var(--blue-text), var(--gold-text)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-lead { color: var(--muted); max-width: 36rem; margin: 1rem auto 0; font-size: 1.08rem; }
.hero-search { position: relative; display: flex; align-items: center; gap: .5rem; max-width: 46rem; margin: 2rem auto 0; padding: .4rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow-lg); }
.hero-search:focus-within { border-color: var(--blue); box-shadow: var(--shadow-lg), 0 0 0 3px color-mix(in srgb, var(--blue) 30%, transparent); }
.hs-field { position: relative; flex: 1; min-width: 0; }
.hs-field .icon { position: absolute; left: 1.15rem; top: 50%; transform: translateY(-50%); width: 1.3rem; height: 1.3rem; color: var(--muted); pointer-events: none; }
.hero-search input[type="search"] { width: 100%; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 1.1rem; padding: .7rem .5rem .7rem 3rem; }
.hero-search input:focus { outline: none; }
.hero-search input::placeholder { color: var(--muted); opacity: 1; }
.hero-type { border: 0; border-left: 1px solid var(--line-strong); background: transparent; color: var(--muted); font: inherit; font-weight: 600; padding: .6rem 1rem; border-radius: 0; cursor: pointer; }
.hero-type:focus-visible { outline-offset: -2px; }

.banner { display: flex; align-items: center; gap: .8rem; padding: .85rem 1.1rem; margin: 1rem 0 0; border-radius: var(--radius); background: var(--warn-bg); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); text-decoration: none; font-weight: 600; }
.banner strong { font-weight: 800; }
.banner > span { flex: 1; }
.banner:hover { color: var(--warn); border-color: var(--warn); }

/* ---- sections, rails, grids of posters */
.section { margin-top: 2.25rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; }
.section-head h2 { display: flex; align-items: center; gap: .55rem; font-size: 1.3rem; }
.section-head a { font-weight: 650; font-size: .9rem; text-decoration: none; }
.section-head a:hover { text-decoration: underline; }
.rail, .grid { list-style: none; margin: 0; padding: 0; }
.rail { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(8.5rem, 10.5rem); gap: 1rem; overflow-x: auto; padding: .5rem .25rem 1.1rem; margin: 0 -.25rem; scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.rail > li { scroll-snap-align: start; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 1.4rem 1.1rem; }
.tile { min-width: 0; }
.tile-link { display: block; text-decoration: none; color: var(--text); }
.poster { position: relative; display: block; aspect-ratio: 2 / 3; border-radius: var(--radius); overflow: hidden; background: linear-gradient(160deg, var(--surface-3), var(--surface-2)); border: 1px solid var(--line); box-shadow: var(--shadow-sm); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.poster-ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.poster-ph .icon { width: 2.4rem; height: 2.4rem; opacity: .6; }
.tile-link:hover .poster, .tile-link:focus-visible .poster { transform: translateY(-4px); border-color: var(--blue); box-shadow: var(--glow); }
.tile-link:focus-visible { outline-offset: 4px; }
.tile-title { display: block; margin-top: .6rem; font-weight: 650; font-size: .95rem; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tile-sub { display: flex; align-items: center; gap: .6rem; color: var(--muted); font-size: .82rem; margin-top: .1rem; }
.rate { display: inline-flex; align-items: center; gap: .25rem; }
.rate .icon { width: .95em; height: .95em; color: var(--gold-text); fill: currentColor; stroke-width: 1.2; }
.chip { position: absolute; display: inline-flex; align-items: center; gap: .3rem; padding: .18rem .55rem; border-radius: 99px; background: rgba(6, 9, 15, .82); color: #f2f6fd; font-size: .7rem; font-weight: 750; letter-spacing: .02em; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); max-width: calc(100% - 1rem); }
.chip-kind { top: .5rem; left: .5rem; text-transform: uppercase; letter-spacing: .08em; font-size: .62rem; }
.chip-st { bottom: .6rem; left: .5rem; }
.chip-st .icon { width: .95em; height: .95em; }
.chip-st > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.st-available { color: #6ff0aa; } .chip.st-downloading { color: #cdb6ff; } .chip.st-processing, .chip.st-approved { color: #8fc6ff; }
.chip.st-pending { color: #ffd37a; } .chip.st-partial { color: #ffcf6b; } .chip.st-failed, .chip.st-denied { color: #ff9f9f; }
.meter-poster { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: .3rem; border-radius: 0; }

progress.meter { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: .5rem; border: 0; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin: .5rem 0; }
progress.meter::-webkit-progress-bar { background: var(--surface-3); border-radius: 99px; }
progress.meter::-webkit-progress-value { background: linear-gradient(90deg, var(--blue), var(--gold)); border-radius: 99px; }
progress.meter::-moz-progress-bar { background: linear-gradient(90deg, var(--blue), var(--gold)); border-radius: 99px; }
.meter-poster::-webkit-progress-bar { background: rgba(6, 9, 15, .7); }

/* ---- title page */
.title-hero { position: relative; isolation: isolate; padding: clamp(1.5rem, 4vw, 3rem) 0; overflow: hidden; }
.title-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 20%; z-index: -2; opacity: .55; }
.title-hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--fade); }
.title-grid { display: grid; grid-template-columns: minmax(10rem, 17rem) 1fr; gap: clamp(1.25rem, 4vw, 2.75rem); align-items: start; }
.title-poster { position: relative; aspect-ratio: 2 / 3; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--line-strong); box-shadow: var(--shadow-lg); background: var(--surface-3); }
.title-poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.title-name { font-size: clamp(1.8rem, 1rem + 3.4vw, 3rem); font-weight: 850; letter-spacing: -.03em; }
.title-year { color: var(--muted); font-weight: 500; }
.facts { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.1rem; color: var(--muted); font-size: .95rem; margin: .9rem 0 .6rem; }
.facts > span { display: inline-flex; align-items: center; gap: .4rem; }
.genres { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1rem; }
.overview { max-width: 46rem; font-size: 1.05rem; line-height: 1.65; }
.status-panel { max-width: 36rem; margin: 1.4rem 0 1.2rem; padding: 1rem 1.1rem; border-radius: var(--radius); background: color-mix(in srgb, var(--surface) 82%, transparent); border: 1px solid var(--line); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.status-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.status-note { margin: .7rem 0 0; display: grid; gap: .2rem; }
.link-ext { display: inline-flex; align-items: center; gap: .35rem; font-weight: 650; font-size: .9rem; }
.request-form { display: grid; gap: .6rem; justify-items: start; }
.seasons-actions { margin-top: 1.1rem; grid-auto-flow: column; justify-content: start; align-items: center; gap: .75rem; flex-wrap: wrap; }
.seasons-actions .small { align-self: center; }
.seasons { list-style: none; margin: 0; padding: 0; }
.season { display: flex; align-items: center; gap: 1rem; padding: .85rem 1.25rem; border-bottom: 1px solid var(--line); }
.season:last-child { border-bottom: 0; }
.season-name { flex: 1; font-weight: 650; cursor: pointer; }
.check-box { width: 1.25rem; height: 1.25rem; margin: 0; accent-color: var(--blue); flex: none; }
.check-ph { width: 1.25rem; height: 1.25rem; flex: none; }

/* ---- request rows */
.reqlist { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; }
.reqlist-flush { gap: 0; }
.req { display: grid; grid-template-columns: 4rem 1fr auto; gap: 1rem; align-items: start; padding: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.reqlist-flush .req { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.reqlist-flush .req:last-child { border-bottom: 0; }
.reqlist-flush .req { grid-template-columns: 3.4rem 1fr; }
.reqlist-flush .req-side { grid-column: 1 / -1; justify-items: start; min-width: 0; }
.reqlist-flush .req-side .meter { width: 100%; }
.reqlist-flush .req-actions { justify-content: flex-start; }
.req-poster { position: relative; display: block; aspect-ratio: 2 / 3; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-3); border: 1px solid var(--line); }
.req-poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.req-poster .poster-ph .icon { width: 1.4rem; height: 1.4rem; }
.req-title { font-size: 1.05rem; }
.req-title a { color: var(--text); text-decoration: none; }
.req-title a:hover { color: var(--blue-text); text-decoration: underline; }
.req-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .9rem; margin: .35rem 0 0; color: var(--muted); font-size: .88rem; }
.req-note { display: flex; gap: .5rem; align-items: flex-start; margin: .5rem 0 0; color: var(--muted); font-size: .9rem; }
.req-note .icon { margin-top: .2rem; }
.req-note-bad { color: var(--bad); }
.req-side { display: grid; gap: .5rem; justify-items: end; min-width: 11rem; }
.req-side .meter { width: 11rem; }
.req-actions { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: flex-end; }
.req-actions form { margin: 0; }
.deny { position: relative; }
.deny[open] { flex-basis: 100%; }
.deny-form { display: flex; gap: .4rem; margin-top: .4rem; }
.deny-form .input { min-width: 12rem; min-height: 2.1rem; padding: .3rem .6rem; font-size: .88rem; }

/* ---- admin */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat { display: grid; gap: .3rem; padding: 1.1rem 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); text-decoration: none; color: var(--text); }
.stat-link:hover { border-color: var(--blue); box-shadow: var(--glow); color: var(--text); }
.stat-n { font-size: 2.2rem; font-weight: 850; letter-spacing: -.03em; line-height: 1; }
.stat-l { display: inline-flex; align-items: center; gap: .45rem; color: var(--muted); font-weight: 600; font-size: .9rem; }
.stat-bad .stat-n { color: var(--bad); }
.checks { list-style: none; margin: 0; padding: .4rem 1.25rem 1rem; }
.check-row { display: flex; align-items: flex-start; gap: .9rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.check-row:last-child { border-bottom: 0; }
.check-row div { display: grid; }
.check-row .muted { font-size: .9rem; }
.check-icon { display: inline-grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--mute-bg); color: var(--mute); flex: none; }
.check-icon.ok { background: var(--ok-bg); color: var(--ok); } .check-icon.bad { background: var(--bad-bg); color: var(--bad); }

.storage { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 1.5rem; padding: 1.25rem; }
.storage-group h3 { display: flex; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.disks { list-style: none; margin: 0; padding: 0; display: grid; gap: .9rem; }
.disk-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.disk-low .disk-head strong { color: var(--bad); }
.disk-low progress.meter::-webkit-progress-value { background: var(--bad); }
.disk-low progress.meter::-moz-progress-bar { background: var(--bad); }

/* ---- sign-in (auth shell) */
.shell-auth { background-image: radial-gradient(60% 40% at 50% 0%, var(--hero-a), transparent 70%), radial-gradient(40% 35% at 85% 10%, var(--hero-b), transparent 70%), radial-gradient(var(--dots) 1px, transparent 1.4px); background-size: auto, auto, 22px 22px; background-repeat: no-repeat, no-repeat, repeat; }
.auth { flex: 1; display: grid; place-items: center; padding: 2rem 1rem; }
.auth-wrap { width: 100%; max-width: 27rem; text-align: center; }
.auth-logo { display: block; width: min(30rem, 100%); height: auto; margin: 0 auto; filter: drop-shadow(0 12px 40px rgba(59, 155, 255, .35)); }
.auth-logo-sm { width: min(18rem, 80%); }
.auth-tag { text-transform: uppercase; letter-spacing: .3em; font-size: .72rem; font-weight: 750; color: var(--muted); margin: 1rem 0 1.6rem; }
.auth-card { position: relative; text-align: left; padding: 1.75rem; box-shadow: var(--shadow-lg); border-radius: var(--radius-lg); }
.auth-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: linear-gradient(90deg, var(--blue), var(--gold)); }
.auth-card h1 { font-size: 1.5rem; margin-bottom: .4rem; }
.auth-card .lead { margin-bottom: 1.25rem; }
.auth-card .btn { margin-top: .5rem; }
.auth-card .alert { margin-top: 0; }
.auth-foot { display: flex; align-items: center; justify-content: center; gap: .5rem; color: var(--muted); font-size: .82rem; margin-top: 1.3rem; }

/* ---- small screens: the main navigation becomes a tab bar at the bottom, like an app */
@media (max-width: 52rem) {
  .topbar { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--bg); }
  .topbar-in { gap: .5rem .75rem; min-height: 3.4rem; }
  .menu { margin-left: auto; }
  .topsearch { order: 5; flex-basis: 100%; max-width: none; margin: 0 0 .35rem; }
  .user-name, .user > .icon:last-child { display: none; }
  .user { padding: .15rem; }
  .shell-app { padding-bottom: 4.6rem; }
  .nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; justify-content: space-around; gap: 0; padding: .3rem .5rem calc(.3rem + env(safe-area-inset-bottom)); background: var(--topbar); -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px); border-top: 1px solid var(--line); }
  .nav a { flex: 1; max-width: 8rem; flex-direction: column; justify-content: center; gap: .15rem; padding: .45rem .5rem; border-radius: var(--radius); font-size: .72rem; position: relative; }
  .nav a .icon { width: 1.35rem; height: 1.35rem; }
  .nav .count { position: absolute; top: .15rem; left: calc(50% + .5rem); }
  .title-grid { grid-template-columns: 1fr; }
  .title-poster { max-width: 11rem; }
  .title-body { grid-template-columns: 1fr; }
  .title-main { grid-column: 1; }
  .req { grid-template-columns: 3.4rem 1fr; }
  .req-side { grid-column: 1 / -1; justify-items: start; min-width: 0; }
  .req-side .meter { width: 100%; }
  .req-actions { justify-content: flex-start; }
  .page-head { padding-top: 1.4rem; }
  .hero-search { flex-wrap: wrap; border-radius: var(--radius-lg); padding: .5rem; }
  .hs-field { flex-basis: 100%; }
  .hero-type { flex: 1; border-left: 0; border: 1px solid var(--line-strong); border-radius: 999px; }
  .hero-search .btn { flex: 1; }
  .seasons-actions { grid-auto-flow: row; }
  .kv { grid-template-columns: 1fr; gap: .2rem; } .kv dd { margin-bottom: .6rem; }
}
@media (max-width: 30rem) {
  .container { padding: 0 1rem; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 1.1rem .8rem; }
  .btn-label { display: none; }
  .wordmark { font-size: 1.05rem; letter-spacing: .1em; }
}
@media (hover: none) { .tile-link:hover .poster { transform: none; box-shadow: var(--shadow-sm); border-color: var(--line); } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
