/* VSL.V admin. One hand-written stylesheet, no framework. Light and dark follow the system setting. */
:root {
    --bg: #07090c; --surface: #11151b; --raised: #161b23; --line: #222935; --line-strong: #323b49;
    --text: #f5f7fa; --muted: #98a1b0; --accent: #4ade80; --accent-text: #052e16; --accent-soft: #10281b;
    --good: #5fd58d; --good-soft: #143122; --warn: #f0b860; --warn-soft: #3a2a10; --bad: #ff8a80; --bad-soft: #3d1917;
    --idle: #b4b4bc; --idle-soft: #262b34;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
    --radius: 14px;
    color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; background: var(--bg); color: var(--text);
    font: 15px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 28px; line-height: 1.15; letter-spacing: -.02em; margin: 0; font-weight: 650; }
h2 { font-size: 17px; letter-spacing: -.01em; margin: 0 0 14px; font-weight: 650; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

/* Rolling VSL banners down both edges of the admin site: a strip of brand tape, deep green, with the name
   alternating between solid and outlined lettering and the V mark between each. The strip glows faintly onto
   the page and fades out at the top and bottom so words never pop in or out. Decoration only: hidden from
   screen readers, still for reduced motion, and gone on narrow screens where the space is needed. */
.banner { display: none; }
@media (min-width: 1100px) {
    body.has-banners { padding: 0 84px; }
    .banner {
        display: block; position: fixed; top: 0; bottom: 0; width: 84px; overflow: hidden; z-index: 20;
        background:
            linear-gradient(90deg, rgba(255,255,255,.07), rgba(255,255,255,0) 30%, rgba(0,0,0,.18)),
            linear-gradient(180deg, #005c43, #008a60 50%, #005c43);
    }
    .banner.left { left: 0; box-shadow: inset -1px 0 0 rgba(74,222,128,.55), 14px 0 60px -12px rgba(74,222,128,.28); }
    .banner.right { right: 0; box-shadow: inset 1px 0 0 rgba(74,222,128,.55), -14px 0 60px -12px rgba(74,222,128,.28); }
    .banner .roll {
        display: flex; flex-direction: column; align-items: center; animation: roll-up 46s linear infinite;
        -webkit-mask-image: none;
    }
    .banner::after {   /* fades the tape into the page top and bottom */
        content: ""; position: absolute; left: 0; right: 0; top: 0; bottom: 0; pointer-events: none;
        background: linear-gradient(180deg, #005c43, rgba(0,92,67,0) 12%, rgba(0,92,67,0) 88%, #005c43);
    }
    .banner.right .roll { animation-name: roll-down; }
    .banner .roll span {
        writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap;
        color: #fff; font-weight: 900; font-size: 34px; letter-spacing: .14em; padding: 18px 0; line-height: 1;
    }
    .banner .roll span.outline { color: transparent; -webkit-text-stroke: 1.4px rgba(255,255,255,.92); }
    .banner .roll span.tag { font-size: 13px; font-weight: 800; letter-spacing: .42em; color: #b9f6d2; padding: 14px 0; }
    .banner .roll .pip { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; margin: 12px 0; box-shadow: 0 0 12px rgba(74,222,128,.9); }
}
@keyframes roll-up { from { transform: translateY(0); } to { transform: translateY(-50%); } }
@keyframes roll-down { from { transform: translateY(-50%); } to { transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .banner .roll { animation: none; } }

/* Top bar */
.top {
    position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 20px;
    padding: 0 24px; height: 56px; background: color-mix(in srgb, var(--surface) 86%, transparent);
    backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px);
    border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; color: var(--text); letter-spacing: -.01em; white-space: nowrap; }
.brand:hover { text-decoration: none; }
/* The VSL mark: a black tile with a green V, as on the staff guides and the Internal app. */
.mark { width: 26px; height: 26px; border-radius: 7px; background: #0d1117; color: #4ade80; font-weight: 900; font-size: 15px; line-height: 26px; text-align: center; flex: none; box-shadow: inset 0 0 0 1px rgba(255,255,255,.10); }
.mark.big { width: 64px; height: 64px; border-radius: 16px; font-size: 38px; line-height: 64px; }
.eyebrow { text-transform: uppercase; letter-spacing: .16em; font-size: 12px; font-weight: 700; color: var(--accent); margin: 0; }
.top nav { display: flex; align-items: center; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.top nav::-webkit-scrollbar { display: none; }
.top nav a { padding: 7px 12px; border-radius: 9px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.top nav a:hover { color: var(--text); text-decoration: none; background: var(--idle-soft); }
.top nav a.on { color: var(--text); background: var(--idle-soft); }
.top nav .sep { width: 1px; height: 18px; background: var(--line-strong); margin: 0 8px; flex: none; }
.who { display: flex; align-items: center; gap: 12px; margin: 0; white-space: nowrap; font-size: 13px; }
.who a { color: var(--muted); }
.checkin { white-space: nowrap; font-size: 13px; color: var(--muted); padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--raised); }
.checkin b { color: var(--accent); font-weight: 650; font-variant-numeric: tabular-nums; margin-left: 4px; }

main { max-width: 1180px; margin: 0 auto; padding: 32px 24px 80px; }
main.narrow { max-width: 620px; }
main.center { max-width: 420px; padding-top: 12vh; }
main.center .brand { margin-bottom: 18px; }
main.center .brand .mark { width: 34px; height: 34px; border-radius: 9px; font-size: 20px; line-height: 34px; }

/* Download page. Opened in a new screen's own browser, read from across a counter and driven by a remote.
   Always dark, to match the app. Kept to old-browser CSS: no clamp(), no flex gap, no :has(). */
body.vsl-dark { color-scheme: dark; --bg: #0b0e13; --surface: #12161d; --raised: #171c25; --line: #232a35; --line-strong: #323b49; --text: #ffffff; --muted: #98a1b0; --accent: #4ade80; --accent-text: #052e16; --accent-soft: #10281b; background: #0b0e13; color: #fff; }
main.get-main { max-width: 1040px; padding: 7vh 28px 48px; }
.get-brand { display: flex; align-items: center; margin-bottom: 34px; }
.get-brand .mark { margin-right: 18px; }
.get-brand .name { font-size: 26px; font-weight: 750; letter-spacing: -.01em; margin: 2px 0 0; }
.get h1 { font-size: 44px; line-height: 1.05; letter-spacing: -.03em; font-weight: 750; }
.get .lede { color: var(--muted); font-size: 19px; margin: 14px 0 30px; max-width: 34em; }
.get-go { display: inline-block; min-height: 0; padding: 20px 38px; font-size: 22px; font-weight: 700; border-radius: 16px; background: var(--accent); border: 3px solid var(--accent); color: var(--accent-text); text-decoration: none; }
.get-go:hover { text-decoration: none; }
.get-go:focus { outline: 5px solid #ffffff; outline-offset: 4px; }
.get .press { color: var(--muted); margin: 14px 0 0; }
.get-steps { list-style: none; padding: 0; margin: 44px -10px 26px; display: flex; flex-wrap: wrap; }
.get-steps li { flex: 1 1 260px; margin: 0 10px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 22px; }
.get-steps .n { display: block; width: 44px; height: 44px; line-height: 44px; border-radius: 50%; background: #007a55; color: #fff; font-weight: 800; font-size: 20px; text-align: center; margin-bottom: 14px; }
.get-steps strong { display: block; font-size: 19px; margin-bottom: 4px; }
.get-steps p { color: var(--muted); margin: 0; }
@media (min-width: 1500px) {
    main.get-main { max-width: 1500px; }
    .get h1 { font-size: 84px; }
    .get .lede { font-size: 30px; }
    .get-go { font-size: 36px; padding: 30px 60px; border-radius: 22px; }
    .get .press, .get-steps p { font-size: 24px; }
    .get-steps strong { font-size: 30px; }
    .get-steps li { padding: 32px; }
    .get-steps .n { width: 60px; height: 60px; line-height: 60px; font-size: 28px; }
    .get-brand .name { font-size: 38px; }
    .get .eyebrow { font-size: 17px; }
}

.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.head p { margin: 6px 0 0; color: var(--muted); max-width: 62ch; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-bottom: 20px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > h2 { padding: 18px 22px 0; }
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.empty { text-align: center; padding: 56px 24px; color: var(--muted); }
.empty strong { display: block; color: var(--text); font-size: 17px; margin-bottom: 6px; font-weight: 650; }
.empty p { max-width: 46ch; margin: 0 auto 16px; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--raised); }
td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.right, th.right { text-align: right; }
td .sub { display: block; color: var(--muted); font-size: 13px; }
td.tight { width: 1%; white-space: nowrap; }
.scroll { overflow-x: auto; }

/* Tabs (Screens: connected / waiting) and group headings inside a table */
.tabs { display: flex; gap: 6px; margin-bottom: 20px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 600; text-decoration: none; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.tabs .count, tr.group .count { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--raised); border: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0; text-transform: none; }
.card.flush > .hint { padding: 6px 22px 16px; margin: 0; color: var(--muted); font-size: 13px; }
tr.group th { font-size: 14px; letter-spacing: 0; text-transform: none; color: var(--text); padding: 14px 16px 10px; border-top: 1px solid var(--line); }
tr.group th .muted { margin-left: 10px; font-weight: 400; font-size: 13px; }
tbody:first-of-type tr.group th { border-top: 0; }
tr.group th .btn { float: right; margin-top: -4px; }
.crumb { margin: 0 0 4px; font-size: 13px; color: var(--muted); }
.stat meter { display: block; width: 100%; margin-top: 10px; }

/* Publish: three ways to choose where a playlist goes. The list under a choice shows once it is picked. */
.where { border: 0; padding: 0; margin: 18px 0 14px; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.where legend { font-weight: 600; margin-bottom: 10px; padding: 0; }
.choice { display: block; position: relative; padding: 16px 16px 16px 46px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--raised); cursor: pointer; }
.choice input[type=radio] { position: absolute; left: 16px; top: 18px; width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.choice .t { display: block; font-weight: 650; font-size: 16px; }
.choice .d { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; }
.choice select, .choice input[type=search] { display: none; width: 100%; margin-top: 12px; }
.choice:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.choice:has(input:checked) select, .choice:has(input:checked) input[type=search] { display: block; }
@supports not selector(:has(*)) { .choice select, .choice input[type=search] { display: block; } }

details.note { margin-top: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--raised); }
details.note summary { padding: 12px 16px; cursor: pointer; color: var(--muted); }
details.note summary .pill { margin-right: 8px; }

details.when { margin: 4px 0 14px; }
details.when summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
details.when summary .muted { font-weight: 400; }
details.when .row { margin-top: 10px; }
input[type=datetime-local] { color-scheme: dark; }

.filters .field.wide { flex: 2; min-width: 240px; }
.suggest { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--raised); }
.suggest .actions { margin-top: 10px; }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; background: var(--idle-soft); color: var(--idle); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.plain::before { display: none; }

/* Forms */
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.field .hint { color: var(--muted); font-size: 13px; margin-top: 6px; }
.row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=datetime-local], select, textarea {
    width: 100%; font: inherit; color: var(--text); background: var(--surface);
    border: 1px solid var(--line-strong); border-radius: 10px; padding: 9px 12px; min-height: 40px;
}
select[multiple] { min-height: 140px; padding: 6px; }
input[type=file] { width: 100%; font: inherit; color: var(--muted); padding: 14px; border: 1px dashed var(--line-strong); border-radius: 10px; background: var(--raised); }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px; }
input.pos { width: 72px; text-align: center; }
.check { display: flex; align-items: center; gap: 9px; font-weight: 500; font-size: 15px; margin: 0; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

button, .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600; cursor: pointer;
    border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
    padding: 8px 16px; border-radius: 10px; min-height: 40px; white-space: nowrap;
}
button:hover, .btn:hover { background: var(--raised); text-decoration: none; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.primary:hover, .btn.primary:hover { filter: brightness(1.07); background: var(--accent); }
button.danger { color: var(--bad); }
button.small, .btn.small { min-height: 32px; padding: 4px 12px; font-size: 13px; border-radius: 8px; }
button.link { border: 0; background: none; padding: 0; min-height: 0; color: var(--accent); font-weight: 500; }
button.link:hover { text-decoration: underline; background: none; }
form.inline { display: inline; margin: 0; }

/* Messages */
.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 20px; border: 1px solid transparent; }
.flash.ok { background: var(--good-soft); color: var(--good); border-color: color-mix(in srgb, var(--good) 25%, transparent); }
.flash.err { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.flash.note { background: var(--accent-soft); color: var(--text); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }

/* Data use */
.usage { min-width: 150px; }
.usage meter { width: 100%; height: 8px; display: block; margin-bottom: 4px; }
.usage span { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cost { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin: 4px 0 18px; }
.cost > div { background: var(--raised); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.cost .big { display: block; font-size: 24px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.review { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }

/* Stat strip on the screens page */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .big { font-size: 26px; font-weight: 650; letter-spacing: -.02em; display: block; font-variant-numeric: tabular-nums; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.filters .field { margin: 0; min-width: 160px; flex: 1; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; font-weight: 600; }

/* The conditions page */
.rules { counter-reset: rule; list-style: none; padding: 0; margin: 0 0 22px; }
.rules li { counter-increment: rule; position: relative; padding: 14px 0 14px 46px; border-bottom: 1px solid var(--line); }
.rules li:last-child { border-bottom: 0; }
.rules li::before { content: counter(rule); position: absolute; left: 0; top: 13px; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; display: grid; place-items: center; font-size: 14px; }
.rules strong { display: block; }

/* Phones: tables become stacked cards */
.foot { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 8px 0 32px; color: var(--muted); font-size: 14px; }
.foot .mark { width: 22px; height: 22px; line-height: 22px; font-size: 13px; border-radius: 6px; }
.foot button.link { margin-left: 8px; color: var(--muted); text-decoration: underline; }

/* Installer pairing page: one small step per screen. Big type, one button, nothing else to read. */
button.wide, .btn.wide { width: 100%; justify-content: center; min-height: 56px; font-size: 18px; margin-top: 20px; }
.step h1 { font-size: 30px; line-height: 1.12; margin: 6px 0 10px; }
.step .help { color: var(--muted); font-size: 17px; margin: 0 0 6px; }
.step .help.later { margin-top: 26px; font-size: 14px; }
.step .count { color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; margin: 0; }
.step input[type=text] { font-size: 20px; min-height: 56px; margin-top: 16px; }
.step input.code.big { font-size: 34px; text-align: center; letter-spacing: .3em; text-transform: uppercase; min-height: 72px; }
.step.solo { text-align: center; padding: 40px 24px; }
.step .tick { width: 72px; height: 72px; line-height: 72px; border-radius: 50%; background: var(--good-soft); color: var(--good); font-size: 38px; margin: 0 auto 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.chip { min-height: 48px; padding: 8px 18px; border-radius: 999px; font-size: 17px; }
form.wizard { padding: 30px 24px 22px; }
form.wizard .no-wiz, form:not(.wizard) .wiz-only { display: none; }
form:not(.wizard) section.step { padding: 16px 0; border-bottom: 1px solid var(--line); }
.wiz-back { display: block; margin: 18px auto 0; color: var(--muted); font-size: 15px; }
.wiz-back[hidden] { display: none; }

/* Video previews and the playlist builder. A playlist is shown as a row of pictures in playing order. */
.shot { position: relative; display: block; padding: 0; border: 0; min-height: 0; border-radius: 10px; overflow: hidden; background: #000; aspect-ratio: 16 / 9; width: 100%; cursor: pointer; }
.shot img { width: 100%; height: 100%; object-fit: contain; display: block; }
.shot .play { position: absolute; inset: 0; display: grid; place-items: center; font-size: 26px; color: #fff; background: rgba(0,0,0,.28); opacity: 0; transition: opacity .15s; }
.shot:hover .play, .shot:focus-visible .play { opacity: 1; }
.shot.small { width: 96px; flex: none; }
td.withshot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
td.withshot .sub { flex-basis: 100%; }
.minis { display: flex; align-items: center; gap: 4px; margin-top: 6px; }
.minis img { width: 44px; aspect-ratio: 16 / 9; object-fit: contain; background: #000; border-radius: 4px; }

.h-note { font-weight: 400; font-size: 13px; color: var(--muted); margin-left: 8px; }
.strip { list-style: none; margin: 12px 0; padding: 4px 2px 10px; display: flex; gap: 12px; overflow-x: auto; }
.strip li { flex: 0 0 190px; background: var(--raised); border: 1px solid var(--line); border-radius: 12px; padding: 8px; position: relative; cursor: grab; }
.strip.locked li { cursor: default; }
.strip li img { width: 100%; aspect-ratio: 16 / 9; object-fit: contain; background: #000; border-radius: 8px; display: block; }
.strip .n { position: absolute; top: 14px; left: 14px; width: 26px; height: 26px; line-height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-weight: 800; font-size: 13px; text-align: center; z-index: 1; }
.strip .t { display: block; font-weight: 600; font-size: 14px; margin-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strip .m { display: block; color: var(--muted); font-size: 12.5px; }
.strip .tools { display: flex; justify-content: space-between; margin-top: 8px; }
.strip .tools button { min-height: 32px; padding: 2px 12px; font-size: 13px; }
.strip-empty { border: 1px dashed var(--line-strong); border-radius: 12px; padding: 28px; text-align: center; color: var(--muted); margin: 12px 0; }
.strip-empty[hidden] { display: none; }

.pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.vid { background: var(--raised); border: 2px solid var(--line); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.vid.on { border-color: var(--accent); background: var(--accent-soft); }
.vid strong { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vid .m { color: var(--muted); font-size: 12.5px; }
.vid .tick { margin-top: 4px; width: 100%; justify-content: center; font-weight: 700; }
.vid.on .tick { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

dialog.preview { border: 1px solid var(--line-strong); border-radius: 16px; background: var(--surface); color: var(--text); padding: 14px; width: min(92vw, 1100px); }
dialog.preview::backdrop { background: rgba(0,0,0,.72); }
dialog.preview video { width: 100%; max-height: 74vh; background: #000; border-radius: 10px; display: block; }
dialog.preview form { margin-top: 12px; text-align: right; }

/* Rules panel: sits beside the working pages on a wide screen, folds to a strip above them on a narrow one. */
main:has(.with-rules) { max-width: 1440px; }
.with-rules { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.rules-side { position: sticky; top: 76px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; font-size: 14px; }
.rules-side summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 650; font-size: 15px; cursor: pointer; list-style: none; }
.rules-side summary::-webkit-details-marker { display: none; }
.rule-list { margin: 12px 0 14px; border-top: 1px solid var(--line); }
.rule-list details { border-bottom: 1px solid var(--line); }
.rule-list summary { font-size: 14px; font-weight: 600; padding: 10px 0; font-variant-numeric: tabular-nums; }
.rule-list summary::after { content: "+"; color: var(--muted); font-weight: 400; font-size: 17px; line-height: 1; }
.rule-list details[open] summary::after { content: "\2212"; }
.rule-list details[open] summary { color: var(--accent); }
.rule-list p { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
@media (max-width: 1040px) {
    .with-rules { grid-template-columns: minmax(0, 1fr); }
    .rules-side { position: static; order: -1; }
}

@media (max-width: 760px) {
    main { padding: 20px 16px 64px; }
    .top { padding: 0 14px; gap: 10px; height: auto; flex-wrap: wrap; padding-top: 8px; }
    .top nav { order: 3; flex-basis: 100%; padding-bottom: 8px; }
    .who { margin-left: auto; }
    h1 { font-size: 24px; }
    table.stack thead { display: none; }
    table.stack tr { display: block; padding: 12px 16px; border-bottom: 1px solid var(--line); }
    table.stack tr:last-child { border-bottom: 0; }
    table.stack tr.group { background: var(--raised); }
    table.stack tr.group th { display: block; padding: 0; border: 0; white-space: normal; background: none; }
    /* Each cell becomes a row: its column name on the left, its content (however many lines) on the right. */
    table.stack td { display: block; position: relative; width: auto; white-space: normal; border: 0; padding: 5px 0 5px 42%; text-align: right; min-height: 30px; }
    table.stack td::before { content: attr(data-label); position: absolute; left: 0; top: 6px; width: 40%; text-align: left; color: var(--muted); font-size: 13px; }
    table.stack td:first-child { padding-left: 0; text-align: left; font-weight: 600; font-size: 16px; }
    table.stack td:first-child .sub { font-weight: 400; }
    table.stack td:first-child::before { display: none; }
    table.stack td[data-label=""] { padding-left: 0; text-align: left; padding-top: 10px; }
    table.stack td[data-label=""]:empty { display: none; }
    table.stack td .actions { justify-content: flex-end; }
    .who a { display: inline-block; max-width: 130px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
    .filters .field { min-width: 100%; }
    .head .actions { width: 100%; }
    .head .actions input { flex: 1; }
    .usage { min-width: 120px; }
}
