/* Host admin + landing page. Plain CSS, mobile first; wide layouts from 900px.
   Spacing scale: --s1 4px, --s2 8px, --s3 12px, --s4 16px, --s5 24px, --s6 32px. */
:root {
    --bg: #101216; --surface: #171a20; --surface-2: #1d2128; --line: #2a2f38; --line-strong: #3a404c;
    --text: #e8ebf0; --muted: #a3adbd; --accent: #4f8cff; --accent-strong: #2f6fe8;
    --focus: #9cc2ff; --ok: #1f8f55; --danger: #c2333a; --new: #f2b44c;
    --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
    --radius: 12px; --radius-sm: 8px; --control-h: 42px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: #8fb6ff; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* Top bar + page frame */
.topbar { background: #14171c; border-bottom: 1px solid var(--line); }
.topbar-inner, .admin { max-width: 1400px; margin: 0 auto; padding-left: var(--s4); padding-right: var(--s4); }
.topbar-inner { padding-top: var(--s3); padding-bottom: var(--s3); display: flex; justify-content: space-between; align-items: center; gap: var(--s2) var(--s4); flex-wrap: wrap; }
.topbar h1 { font-size: 1.05rem; margin: 0; }
.topbar p { margin: 0; }
.home-link { color: inherit; text-decoration: none; }
.admin { padding-top: var(--s4); padding-bottom: var(--s6); }
#loginView, #setupView { max-width: 460px; margin: var(--s6) auto; }

/* Basics */
h2 { font-size: 1.05rem; margin: 0 0 var(--s3); }
p { margin: 0 0 var(--s3); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s5); min-width: 0; }
.card > :last-child { margin-bottom: 0; }
label { display: block; margin: var(--s4) 0 var(--s2); font-size: .92rem; color: #c3cbd8; }
input { width: 100%; min-height: var(--control-h); padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: #12151a; color: inherit; font-size: 1rem; }
input:focus { border-color: var(--accent); }
input[type=file] { padding: 8px; }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--accent); }
button { min-height: var(--control-h); padding: 0 var(--s4); border-radius: var(--radius-sm); border: 1px solid transparent; background: var(--accent-strong); color: #fff; font-size: .95rem; font-weight: 600; cursor: pointer; margin-top: var(--s4); }
button:hover:not(:disabled) { background: var(--accent); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.secondary { background: var(--surface-2); color: var(--text); border-color: var(--line-strong); }
button.secondary:hover:not(:disabled) { background: #272c35; }
button.link { background: none; color: #8fb6ff; padding: 0 var(--s1); min-height: 0; margin: 0; font-weight: 500; }
button.wide { width: 100%; }
button.big { font-size: 1rem; min-height: 46px; padding: 0 var(--s5); margin: 0; }
button.danger { background: var(--danger); }
button.danger:hover:not(:disabled) { background: #d8434a; }
.row { display: flex; gap: var(--s2) var(--s3); align-items: center; flex-wrap: wrap; margin-top: var(--s3); }
.row > button { margin-top: 0; }
.row > a { word-break: break-all; }
.row > input { flex: 1; min-width: 140px; width: auto; }
.muted, .hint { color: var(--muted); font-size: .9rem; }
.hint { margin: var(--s2) 0 0; }
.label { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 var(--s1); }
.divider { text-align: center; color: #7d8696; margin: var(--s4) 0 0; }
.prefix-input { display: flex; align-items: center; background: #12151a; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding-left: 10px; }
.prefix-input span { color: var(--muted); white-space: nowrap; font-size: .9rem; }
.prefix-input input { border: 0; padding-left: 2px; }
label.inline { display: inline-flex; gap: var(--s2); align-items: center; margin: 0; color: #c3cbd8; }
label.check { margin-top: var(--s5); }

/* Notice: a toast, so it never shifts the layout */
.notice { position: fixed; z-index: 50; pointer-events: none; left: 50%; bottom: var(--s5); transform: translateX(-50%); width: max-content; max-width: calc(100% - 2 * var(--s4));
    padding: var(--s3) var(--s4); border-radius: var(--radius); background: #1d355a; border: 1px solid #2d4f86; box-shadow: 0 10px 30px rgba(0,0,0,.45); }
.notice[data-kind=error] { background: #5a1d22; border-color: #8a2d35; }
.notice[hidden] { display: none; }

/* Session bar (always visible on the dashboard) */
.session-bar { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: var(--s3) var(--s4); flex-wrap: wrap;
    background: rgba(16,18,22,.96); backdrop-filter: blur(6px); padding: var(--s3) 0; border-bottom: 1px solid var(--line); }
.session-info h2 { margin: 0 0 var(--s1); font-size: 1.2rem; }
.session-info p { margin: 0; display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; }
.session-actions { display: flex; gap: var(--s4); align-items: center; }
.quick-link { font-weight: 600; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; background: var(--line-strong); }
.pill.open { background: var(--ok); color: #eafff2; }

/* Tabs */
.tabs { display: flex; gap: var(--s1); border-bottom: 1px solid var(--line); margin: var(--s3) 0 var(--s4); overflow-x: auto; }
.tabs button { background: none; color: var(--muted); border: 0; border-bottom: 3px solid transparent; border-radius: 0; margin: 0; min-height: 44px; padding: 0 var(--s4); font-size: 1rem; white-space: nowrap; }
.tabs button:hover:not(:disabled) { background: none; color: var(--text); }
.tabs button[aria-selected=true] { color: var(--text); border-bottom-color: var(--accent); }

/* Panels: one gap value everywhere */
.panel:not([hidden]) { display: grid; gap: var(--s4); align-items: start; }

/* Queue: a clean list inside one card; rows divided by hairlines */
.queue-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--s2) var(--s4); padding-bottom: var(--s3); border-bottom: 1px solid var(--line); }
.queue-head h2 { font-size: 1.25rem; margin: 0; }
.queue-tools { display: flex; gap: var(--s4); flex-wrap: wrap; }
.queue-card { padding-bottom: var(--s2); }
.queue { list-style: none; padding: 0; margin: 0; }
.queue li { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "time song" "actions actions"; gap: var(--s2) var(--s4); align-items: center;
    padding: var(--s4) var(--s2); border-bottom: 1px solid var(--line); }
.queue li:last-child { border-bottom: 0; }
.queue li.latest { background: rgba(242,180,76,.06); }
.queue li.seen .song strong { color: #b7c0cd; }
.queue li.dismissed { opacity: .5; }
.queue time { grid-area: time; color: var(--muted); font-size: .95rem; white-space: nowrap; font-variant-numeric: tabular-nums; align-self: start; padding-top: 4px; }
.queue .song { grid-area: song; min-width: 0; }
.queue .song strong { display: block; font-size: 1.2rem; line-height: 1.25; overflow-wrap: anywhere; }
.queue .artist { display: block; font-size: 1rem; color: #c9d1dd; }
.queue .meta { color: var(--muted); font-size: .92rem; display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; margin-top: var(--s1); }
.queue .singer { color: var(--text); font-weight: 700; }
.queue .actions { grid-area: actions; display: flex; gap: var(--s2); flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.queue .actions button { margin: 0; min-height: 38px; padding: 0 var(--s3); }
.queue-empty { color: var(--muted); margin: var(--s4) var(--s2) 0; }
.queue-empty[hidden] { display: none; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .76rem; font-weight: 600; background: var(--line-strong); color: #e3e7ee; }
.badge.new { background: #1e3f80; color: #e3edff; }
.badge.latest { background: var(--new); color: #241a05; }
.badge.vdj-sent { background: var(--ok); color: #eafff2; }
.badge.vdj-failed { background: #7f1d1d; color: #fee2e2; }
.badge.vdj-dry-run, .badge.vdj-pending { background: #4a4540; color: #f1ede8; }
.badge.paused { background: #5a3036; color: #ffd6da; }
.badge.kiosk { background: #2b3a5c; color: #d6e2ff; }

/* Placeholder rows for an empty queue */
.queue-skeleton[hidden] { display: none; }
.queue-skeleton li { grid-template-columns: 64px minmax(0, 1fr) auto; grid-template-areas: none; opacity: .55; }
.sk { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, #22262e 0%, #2a2f38 50%, #22262e 100%); background-size: 200% 100%; animation: sk 1.6s ease-in-out infinite; }
.sk-lines { display: grid; gap: var(--s2); }
.sk-time { width: 48px; }
.sk-title { width: min(60%, 320px); height: 16px; }
.sk-sub { width: min(40%, 200px); }
.sk-btns { width: 150px; height: 32px; border-radius: var(--radius-sm); }
.queue-skeleton li:nth-child(2) .sk-title { width: min(45%, 260px); }
.queue-skeleton li:nth-child(3) .sk-title { width: min(52%, 290px); }
@keyframes sk { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (max-width: 599px) { .sk-btns { display: none; } .queue-skeleton li { grid-template-columns: 48px minmax(0, 1fr); } }

/* Block: a visible button on every guest request, with a small menu */
.block-menu { position: relative; }
.queue .actions .block-btn { background: transparent; color: #ffb4bc; border: 1px solid #7a3a42; }
.queue .actions .block-btn:hover:not(:disabled) { background: #2a1d20; }
.queue .actions .block-btn[aria-expanded=true] { background: #3a2226; }
.queue .actions .block-btn::after { content: " \25BE"; }
.queue .actions .block-btn:disabled::after { content: ""; }
.block-menu .menu { position: absolute; right: 0; top: calc(100% + var(--s1)); z-index: 30; display: grid; gap: var(--s2); min-width: 210px; padding: var(--s3);
    background: #1f2229; border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: 0 12px 30px rgba(0,0,0,.5); }
.block-menu .menu[hidden] { display: none; }
.block-menu .menu button { margin: 0; text-align: left; }
.block-menu .menu-title { font-size: .85rem; color: var(--muted); }
.blocks { list-style: none; padding: 0; margin: 0; }
.blocks li { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); padding: var(--s3) 0; border-top: 1px solid var(--line); }
.blocks li button { margin: 0; min-height: 34px; padding: 0 var(--s3); }
.blocks .who { font-weight: 600; }
.vdj-test button { margin: 0; }
.test-result { font-size: .92rem; }
.test-result[data-state=ok] { color: #8be3b0; }
.test-result[data-state=error] { color: #ffb4bc; }
#blocksCard .hint { margin: 0 0 var(--s3); }
#blocksEmpty { margin: 0; }

/* Tonight's QR: full card (Venue & songbook) and compact card (Queue) */
.qr { background: #fff; padding: 10px; border-radius: var(--radius-sm); line-height: 0; width: max-content; }
.qr svg { width: 200px; height: 200px; }
.session-qr { display: grid; gap: var(--s4) var(--s5); grid-template-columns: 1fr; align-items: start; }
.session-qr .row:first-of-type { margin-top: 0; }
.session-qr #sessionLink { word-break: break-all; }
.qr-actions { margin-top: var(--s4); }
.qr-compact-body { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s4); align-items: center; }
.qr-small svg { width: 120px; height: 120px; }
.qr-compact-actions { display: grid; gap: var(--s3); justify-items: start; }
.qr-compact-actions button { margin: 0; }
#kioskLink, #guestLink { word-break: break-all; }
.logo-row { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; }
.logo-row input { flex: 1; min-width: 200px; width: auto; }
.logo-row img { width: 72px; height: 72px; object-fit: contain; background: #12151a; border-radius: var(--radius-sm); border: 1px solid var(--line); }
#removeLogo { white-space: nowrap; margin: 0; }
.pin-form label { margin-top: var(--s4); }
.pin-form .row { margin-top: 0; }
.import-report { margin-top: var(--s3); font-size: .92rem; }
.import-report ul { margin: var(--s2) 0 0; padding-left: 18px; color: #fca5a5; }
.settings-card { max-width: 760px; width: 100%; }
#songbookForm .row { margin-top: var(--s3); }
.queue-side { display: grid; gap: var(--s4); }

@media (max-width: 599px) {
    .topbar-inner, .admin { padding-left: var(--s3); padding-right: var(--s3); }
    .card { padding: var(--s4); }
    .queue li { padding: var(--s3) 0; }
    .session-actions { width: 100%; justify-content: space-between; }
}

@media (min-width: 700px) {
    .session-qr { grid-template-columns: auto minmax(0, 1fr); }
}

@media (min-width: 900px) {
    .queue-panel:not([hidden]) { grid-template-columns: minmax(0, 1fr) 340px; }
    .queue-side { position: sticky; top: 92px; }
    .queue li { grid-template-columns: 64px minmax(0, 1fr) auto; grid-template-areas: "time song actions"; padding: var(--s4) var(--s3); }
    .queue .song strong { font-size: 1.3rem; }
    .grid-2:not([hidden]) { grid-template-columns: 1fr 1fr; align-items: stretch; }
    .span-2 { grid-column: 1 / -1; }
}

/* Landing page */
.landing { max-width: 880px; margin: 0 auto; padding: 56px 20px; }
.landing h1 { font-size: clamp(2rem, 5vw, 3rem); margin: 0 0 12px; }
.tagline { font-size: 1.15rem; color: #c9d1dd; line-height: 1.55; max-width: 640px; }
.cta { margin: 28px 0; }
a.button { display: inline-block; padding: 13px 22px; border-radius: 10px; background: var(--accent-strong); color: #fff; text-decoration: none; font-weight: 600; }
a.button:hover { background: var(--accent); }
a.button.secondary { background: var(--surface-2); border: 1px solid #3a404c; color: var(--text); }
.features { display: grid; gap: 12px; padding: 0; list-style: none; color: #c9d1dd; }
.features li { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
@media (min-width: 760px) { .features { grid-template-columns: 1fr 1fr; } }

/* Printed table sign: always one page (A4 or Letter), with or without a logo. */
.table-sign { display: none; }
@page { size: auto; margin: 12mm; }
@media print {
    html, body { background: #fff !important; color: #000; }
    body > *:not(.table-sign) { display: none !important; }
    .table-sign { display: flex !important; flex-direction: column; align-items: center; justify-content: flex-start; text-align: center; font-family: system-ui, sans-serif;
        height: 250mm; max-height: 250mm; overflow: hidden; break-inside: avoid; page-break-inside: avoid; break-after: avoid; }
    .table-sign img { max-width: 70mm; max-height: 32mm; object-fit: contain; margin-bottom: 4mm; }
    .table-sign h1 { font-size: 26pt; line-height: 1.15; margin: 2mm 0; max-width: 170mm; overflow-wrap: anywhere; }
    .sign-call { font-size: 19pt; margin: 2mm 0 5mm; }
    .sign-qr { width: 95mm; height: 95mm; line-height: 0; }
    .sign-qr svg { width: 95mm; height: 95mm; }
    .sign-url { font-size: 10pt; word-break: break-all; max-width: 170mm; margin: 4mm 0 1mm; }
    .sign-small { font-size: 11pt; color: #444; margin: 0; }
}
.kiosk-clear { margin-top: var(--s3); }

/* ---------- Round 2 layout fixes (QC layout review) ----------
   Everything a finger needs to hit is at least 44px; phones get stacked layouts. */
[hidden] { display: none !important; }
:root { --control-h: 44px; --danger: #b42d34; --ok: #157a46; }
button.danger:hover:not(:disabled) { background: #c2333a; }
.pill.open, .badge.vdj-sent { background: var(--ok); color: #fff; }

/* File pickers (logo, songbook): a proper 44px button */
input[type=file] { padding: 0; min-height: 46px; cursor: pointer; }
input[type=file]::file-selector-button { height: 44px; margin: 0 var(--s3) 0 0; padding: 0 var(--s4); border: 0; border-right: 1px solid var(--line-strong);
    border-radius: var(--radius-sm) 0 0 var(--radius-sm); background: var(--surface-2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
input[type=file]::file-selector-button:hover { background: #272c35; }

/* Tap targets */
.quick-link { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 var(--s4); border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); text-decoration: none; font-weight: 600; white-space: nowrap; }
.quick-link:hover { background: #272c35; }
button.link { min-height: 44px; display: inline-flex; align-items: center; }
#resetPassword { margin-top: var(--s3); }
.queue .actions button, .block-menu .menu button, .blocks li button { min-height: 44px; }
#qrMoreLink { display: inline-flex; align-items: center; min-height: 44px; }
.queue-tools label.inline { min-height: 44px; align-items: center; }

/* Labels next to checkboxes: wrapped text lines up with the box */
label.inline { align-items: flex-start; line-height: 1.4; }
label.inline input { margin-top: 3px; flex: 0 0 auto; }
label.check { display: flex; }

/* Long links wrap between words where possible, never mid-letter on wide screens */
.row > a, #guestLink, #kioskLink, .session-qr #sessionLink { word-break: normal; overflow-wrap: anywhere; }

@media (max-width: 599px) {
    /* Session header: one stacked control strip */
    .session-bar { display: grid; grid-template-columns: 1fr; gap: var(--s3); }
    .session-info p { gap: var(--s2) var(--s3); }
    #sessionDetail { flex-basis: 100%; }
    .session-actions { display: grid; grid-template-columns: 1fr; gap: var(--s2); width: 100%; justify-content: stretch; }
    .session-actions:has(.quick-link:not([hidden])) { grid-template-columns: auto 1fr; }
    .session-actions > * { width: 100%; }
    /* Top bar: role label on its own line, Sign out a full tap target */
    .topbar-inner { align-items: flex-start; }
    .topbar h1 .muted { display: block; font-size: .8rem; font-weight: 500; margin-top: 2px; }
    #whoami { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
    /* Link + Copy rows: link on top, full-width Copy below */
    .card .row:has(> a) { flex-direction: column; align-items: stretch; }
    .card .row:has(> a) > button { width: 100%; }
    .qr-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .qr-actions #printSign { grid-column: 1 / -1; }
    .vdj-test, .kiosk-clear { flex-direction: column; align-items: stretch; }
    /* Landing: equal-width calls to action */
    .cta { display: grid; gap: var(--s3); }
    .cta .button { width: 100%; text-align: center; }
}
@media (min-width: 760px) and (max-width: 899px) { .features { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .features { grid-template-columns: 1fr 1fr; } }
.not-found h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
@media print {
    .sign-url { font-size: 9pt; word-break: normal; overflow-wrap: anywhere; max-width: 180mm; }
}

/* Forwarding setup guide */
.setup-guide { margin-top: var(--s3); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0 var(--s4); background: #14171c; }
.setup-guide summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 600; color: #c3cbd8; }
.setup-guide ol { margin: 0 0 var(--s3); padding-left: 20px; display: grid; gap: var(--s2); color: #c9d1dd; font-size: .92rem; }
.setup-guide p { font-size: .9rem; color: #c9d1dd; }
.setup-guide code { overflow-wrap: anywhere; }
.setup-guide .disclaimer { color: var(--muted); font-size: .82rem; }
.queue-closed-note { margin: var(--s3) 0 0; padding: var(--s2) var(--s3); border-radius: var(--radius-sm); background: #2a2416; color: #f5d9a8; font-size: .92rem; }
fieldset.choice { border: 0; padding: 0; margin: var(--s5) 0 0; display: grid; gap: var(--s2); }
fieldset.choice legend { font-size: .92rem; color: #c3cbd8; margin-bottom: var(--s2); padding: 0; }
fieldset.choice label.inline { min-height: 44px; padding: var(--s2) var(--s3); border: 1px solid var(--line); border-radius: var(--radius-sm); background: #14171c; color: var(--text); }
fieldset.choice label.inline:has(input:checked) { border-color: var(--accent); }
fieldset.choice .hint { margin: 0; }

/* Round 2: songbook column mapping */
.queue .details { display: block; font-size: 0.9rem; color: #9aa6b6; }
.mapping { margin: 12px 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.mapping h3 { margin: 0 0 4px; font-size: 1.05rem; }
.mapping-list { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 8px; }
.mapping-row { display: grid; grid-template-columns: 5.5em minmax(8em, 12em) 1fr repeat(3, 44px); gap: 8px; align-items: center; }
.mapping-row select { min-height: 44px; margin: 0; }
.mapping-row .map-num { font-weight: 600; }
.mapping-row .map-sample { color: #9aa6b6; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mapping-row .map-btn { min-width: 44px; min-height: 44px; padding: 0; margin: 0; }
.mapping-preview-wrap { overflow-x: auto; margin-top: 10px; }
.mapping-preview { border-collapse: collapse; font-size: 0.9rem; min-width: 100%; }
.mapping-preview th, .mapping-preview td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; white-space: nowrap; max-width: 16em; overflow: hidden; text-overflow: ellipsis; }
.mapping-preview .ignored { opacity: 0.45; }
@media (max-width: 599px) {
    .mapping-row { grid-template-columns: 1fr repeat(3, 44px); }
    .mapping-row .map-num { grid-column: 1 / -1; }
    .mapping-row .map-sample { display: none; }
}

/* Round 2: Stats tab */
.stats-card { min-width: 0; }
.stats-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: var(--s3); margin: var(--s4) 0; }
.stats-totals div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.stats-totals dt { color: #9aa6b6; font-size: 0.85rem; }
.stats-totals dd { margin: 4px 0 0; font-size: 1.6rem; font-weight: 700; }
.stats-grid { display: grid; gap: var(--s4); }
@media (min-width: 760px) { .stats-grid { grid-template-columns: 1fr 1fr; } }
.stats-list { margin: 0; padding-left: 1.6em; }
.stats-list li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.stats-list li > span { display: inline-flex; }
.stats-list .stats-name { overflow-wrap: anywhere; }
.stats-list .stats-count { float: right; margin-left: 12px; font-weight: 700; color: #c9d1dd; }
.stats-table-wrap { overflow-x: auto; }
.stats-table { width: 100%; border-collapse: collapse; margin-bottom: var(--s4); }
.stats-table th, .stats-table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.stats-table .num, .stats-table th:last-child { text-align: right; }

/* Focus and scrollIntoView stop below the sticky session bar (height set from admin.js). */
html { scroll-padding-top: calc(var(--sticky-top, 0px) + 12px); }

/* File pickers: 44px button; the file name moves onto its own line when the row is
   too narrow, so "No file chosen" never clips (fonts vary by machine). Long names still ellipsize. */
.file-pick { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); min-width: 0; flex: 1 1 200px; margin-top: var(--s2); }
.logo-row .file-pick { margin-top: 0; }
.file-pick .file-input { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; min-width: 0; min-height: 0; padding: 0; margin: 0; border: 0; opacity: 0; overflow: hidden; }
.file-pick .file-button { flex: none; display: inline-flex; align-items: center; min-height: 44px; margin: 0; padding: 0 var(--s4); border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); font-size: .95rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.file-pick .file-button:hover { background: #272c35; }
.file-pick .file-input:focus-visible + .file-button { outline: 3px solid var(--focus); outline-offset: 2px; }
.file-pick .file-name { flex: 1 1 12em; min-width: min(12em, 100%); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #9aa6b6; font-size: .9rem; }

/* Small "?" help button with a tap-to-open note (kiosk card). */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.card-head h2 { margin: 0; }
.help-btn { flex: none; width: 44px; min-height: 44px; margin: 0; padding: 0; border-radius: 50%; background: var(--surface-2); color: var(--text);
    border: 1px solid var(--line-strong); font-size: 1.1rem; font-weight: 700; }
.help-btn:hover:not(:disabled) { background: #272c35; }
.help-btn[aria-expanded=true] { background: var(--accent-strong); border-color: var(--accent-strong); }
.help-pop { margin: var(--s3) 0 0; padding: var(--s3) var(--s4); background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font-size: .92rem; }
.help-pop p { margin: 0 0 var(--s2); }
.help-pop p:last-child { margin-bottom: 0; }

/* Four tabs fit on a phone: "Venue & songbook" shortens to "Venue". */
@media (max-width: 599px) {
    .tabs button { padding: 0 var(--s3); }
    .tabs .tab-long { display: none; }
}
