/* The staff pages' styles, from nextOne4's site.css without its game pages (docs/staff-pages.md). */
body { margin: 0; font-family: system-ui, sans-serif; color: #222; background: #fff; }
header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid #ccc; }
.brand { display: inline-flex; align-items: center; gap: 8px; }
/* nextOne3's logo. */
.brand-logo { display: block; width: auto; height: 40px; }
.brand-area { color: #5f5f5a; font-size: 14px; }
/* Staff on a team's pages: in the header, in the staff pages' red, between the brand and the logout. */
.header-staff-view { margin: 0 auto; color: #c8102e; font-weight: 600; font-size: 14px; text-align: center; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
main { max-width: 720px; margin: 0 auto; padding: 16px; }
form.stacked label { display: block; margin-top: 12px; }
form.stacked input { display: block; padding: 6px; width: 100%; max-width: 320px; box-sizing: border-box; }
form.stacked input.number-input { max-width: 140px; }
form.stacked button { margin-top: 12px; }
button { padding: 6px 12px; }
table { border-collapse: collapse; width: 100%; margin: 12px 0; }
th, td { border-bottom: 1px solid #ddd; padding: 6px; text-align: left; }
td.number { text-align: right; }
.message { padding: 8px 12px; }
/* The text items: the search in a row, and each text as wide as its neighbours. */
.text-search { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; }
.text-search > div { display: flex; flex-direction: column; gap: 4px; }
.text-search input, .text-search select { font: inherit; min-height: 40px; padding: 6px 8px; box-sizing: border-box; border: 1px solid #cfcfca; border-radius: 6px; background: #fff; }
.text-search input { width: min(260px, 100%); }
.text-search > a { padding: 8px 0; }
.text-items td { vertical-align: top; min-width: 140px; overflow-wrap: anywhere; }
.text-items td:last-child { min-width: 0; white-space: nowrap; overflow-wrap: normal; }
.text-items td:first-child { min-width: 200px; }
#text-form textarea { font: inherit; display: block; width: 100%; max-width: 720px; padding: 8px; box-sizing: border-box; border: 1px solid #cfcfca; border-radius: 6px; }
.success { background: #e6f4e6; }
.error { background: #fbe6e6; }
.field-validation-error, .validation-summary-errors { color: #a00000; }
.validation-summary-valid { display: none; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.section { border-top: 1px solid #ccc; margin-top: 16px; padding-top: 4px; }
form.inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
form.inline input { padding: 6px; }
form.stacked label.check { display: flex; align-items: center; gap: 8px; }
form.stacked label.check input { width: auto; }
.message-item { border-top: 1px solid #ccc; padding-top: 4px; }
.message-body { white-space: pre-wrap; }
/* nextOne3's standard messages are HTML: their own paragraphs and lists, without the kept line breaks. */
.message-body.message-html { white-space: normal; }
.message-html > :first-child { margin-top: 0; }
.message-html > :last-child { margin-bottom: 0; }
.message-html h3 { font-size: 16px; margin: 16px 0 6px; }
textarea { display: block; width: 100%; box-sizing: border-box; padding: 6px; }
.itemTable { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 4px 8px; border-bottom: 1px solid #eee; }
.itemLabel { flex: 1 1 200px; }
.valueResultContainer { display: flex; gap: 12px; }
.itemResultValue { min-width: 100px; text-align: right; }
.itemTrend { min-width: 56px; text-align: right; color: #555; }
.itemValue input, .itemValue select { padding: 4px; text-align: right; }
.infoButton { cursor: help; border: 1px solid #888; border-radius: 50%; padding: 0 6px; font-size: 12px; }
.feedback { background: #fff6e0; }
.missingNode { color: #a00000; }
.page-nav { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0; }

/* Corners: small, as on a plain tool; tiles inside a card a little smaller still. */
:root { --radius: 4px; --radius-inner: 3px; }

#team-issues tr.issue th { color: #8a4b00; }
#team-issues .issue-heading th { padding-top: 16px; }
@media (max-width: 800px) { .team-analysis { grid-template-columns: minmax(0, 1fr); } }
.table-scroll { max-width: 100%; overflow-x: auto; }
#raw-data th.number { text-align: right; }
#raw-data td.number { white-space: nowrap; }
#raw-data .raw-heading th { padding-top: 16px; text-align: left; }
#raw-data .raw-gap td { height: 12px; }

/* Staff pages: a menu per session beside the page, and each section as a card with its next step (the "control room"). */
body.staff { --accent: #c8102e; --accent-dark: #a30d22; --ink: #1c1c1c; --muted: #5f5f5a; --line: #e2e2de; --soft: #f4f4f2; background: var(--soft); color: var(--ink); }
body.staff header { background: #fff; border-bottom-color: var(--line); min-height: 40px; }
body.staff a { color: var(--accent-dark); }
body.staff button { font: inherit; padding: 8px 14px; min-height: 40px; border: 1px solid #cfcfca; border-radius: 8px; background: #fff; color: var(--ink); cursor: pointer; }
body.staff button:hover { border-color: #9a9a95; }
body.staff button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
body.staff button.primary:hover { background: var(--accent-dark); }
body.staff button.danger { color: #8f0a1d; border-color: #e3b4bb; }
body.staff button.link { border: none; background: none; padding: 0; min-height: 0; color: var(--accent-dark); text-decoration: underline; }
body.staff input, body.staff select, body.staff textarea { font: inherit; border: 1px solid #cfcfca; border-radius: 6px; }
body.staff table { background: #fff; }
body.staff th, body.staff td { border-bottom-color: #efefec; padding: 8px 10px; }
body.staff th { font-size: 14px; color: var(--muted); font-weight: 600; }
.admin-shell { display: flex; flex-wrap: wrap; gap: 24px; max-width: 1440px; margin: 0 auto; padding: 24px; box-sizing: border-box; }
.admin-main { flex: 999 1 560px; min-width: 0; max-width: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 20px; }
.admin-main > h1, .admin-main > h2, .admin-main > p, .admin-main > form, .admin-main > table, .admin-main > div { margin-top: 0; margin-bottom: 0; }
.admin-nav { flex: 1 1 200px; max-width: 240px; display: flex; flex-direction: column; gap: 20px; }
body.staff .admin-nav a { display: block; padding: 9px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.admin-nav a:hover { background: #ebebe8; }
.admin-nav a[aria-current] { background: #fff; font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
body.staff .admin-nav .admin-nav-back { color: var(--muted); padding-left: 0; }
.admin-nav-group { display: flex; flex-direction: column; gap: 2px; }
.admin-nav-title { padding: 0 12px 4px; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.admin-nav-groups { display: flex; flex-direction: column; gap: 20px; }
.admin-nav-toggle { display: none; }
/* On a phone the session menu folds away behind a Menu button; open, its groups sit side by side. Without a script it stays open. */
@media (max-width: 760px) {
    .admin-shell { padding: 16px; gap: 16px; }
    .admin-nav { max-width: none; flex-basis: 100%; gap: 10px; }
    .admin-nav-session { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; padding: 0; }
    body.staff .admin-nav .admin-nav-back { padding: 0; }
    .has-script .admin-nav-toggle { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; }
    body.staff .admin-nav-toggle { padding: 8px 14px; min-height: 40px; border: 1px solid #cfcfca; border-radius: 8px; background: #fff; color: var(--ink); font-weight: 600; }
    .admin-nav-current { font-weight: 400; color: var(--muted); }
    .has-script .admin-nav:not(.is-open) .admin-nav-groups { display: none; }
    .admin-nav-groups { flex-direction: row; flex-wrap: wrap; gap: 12px 24px; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
    .admin-nav-group { flex: 1 1 140px; }
    .admin-nav-title { padding-left: 12px; }
}
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-head h1 { margin: 0; font-size: 30px; letter-spacing: -0.02em; }
.page-head .actions { margin: 0; }
.page-kicker { margin: 0 0 4px; color: var(--muted); }
.page-kicker strong { color: var(--ink); }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.card h2 { margin: 0; font-size: 21px; }
.card p { margin: 0; }
.card table { margin: 0; }
.card-quiet { background: transparent; border-style: dashed; }
body.staff .section { border-top: 1px solid var(--line); margin-top: 0; padding-top: 24px; }
.section-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px; }
.section-head .actions { margin: 0; }
.section-title { display: flex; flex-direction: column; gap: 6px; }
.section-name { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.section-progress-text { color: #4a4a46; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.badge-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge-open { background: #e3f1e6; color: #1d5a2c; }
.badge-closed { background: #efefec; color: #3d3d39; }
.quarter-bar { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; }
.quarter-bar li { flex: 1; height: 8px; border-radius: 4px; background: var(--line); }
.quarter-bar li.done { background: var(--ink); }
.quarter-bar li.current { background: var(--accent); }
.teams td:last-child { text-align: right; }
.teams { min-width: 600px; }
.teams td:last-child { white-space: nowrap; }
.actions-end { justify-content: flex-end; align-items: center; margin: 0; gap: 12px; }
/* The other staff pages: a heading with the page's actions, and the content in cards. */
.admin-main.admin-narrow { max-width: 960px; margin: 0 auto; }
.admin-nav-session { margin: 0; padding: 0 12px; display: flex; flex-direction: column; gap: 2px; font-size: 14px; color: var(--muted); }
.admin-nav-session strong { color: var(--ink); font-size: 16px; }
.admin-nav-session span { color: var(--ink); font-size: 15px; font-weight: 400; }
.page-lead { margin: 6px 0 0; color: #4a4a46; max-width: 70ch; }
.page-kicker a { text-decoration: none; }
body.staff a.button { display: inline-flex; align-items: center; padding: 8px 14px; min-height: 40px; box-sizing: border-box; border: 1px solid #cfcfca; border-radius: 8px; background: #fff; color: var(--ink); text-decoration: none; }
body.staff a.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
body.staff a.button.primary:hover { background: var(--accent-dark); }
.empty { color: var(--muted); }
.card-notice { background: #fff6e0; border-color: #f0d9a8; }
.card-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
body.staff th.number { text-align: right; }
.cell-end { text-align: right; }
.quarter-switch { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-right: 8px; }
body.staff form.stacked input:not([type=checkbox]), body.staff form.stacked select { display: block; width: 100%; box-sizing: border-box; max-width: 420px; padding: 8px; }
body.staff form.stacked button { margin-top: 16px; }
body.staff fieldset.card { display: block; margin: 0; min-width: 0; }
body.staff fieldset.card legend { float: left; width: 100%; padding: 0; margin-bottom: 4px; font-size: 18px; font-weight: 600; }
body.staff fieldset.card legend + * { clear: both; }
form.settings, form.stacked:has(> fieldset) { display: flex; flex-direction: column; gap: 20px; }
form.stacked:has(> fieldset) label:first-of-type { margin-top: 0; }
.form-actions { display: flex; gap: 8px; }
.form-actions button { margin-top: 0 !important; }
.participants td { vertical-align: middle; }
body.staff .team-analysis { gap: 20px; }
body.staff form.stacked label:not(.check) > input, body.staff form.stacked label:not(.check) > select { display: block; width: 100%; margin-top: 4px; }
body.staff tbody th { color: var(--ink); font-size: inherit; font-weight: 500; }
body.staff tbody th[scope=rowgroup] { font-weight: 600; font-size: 13px; letter-spacing: 0.04em; color: var(--muted); }

/* Login and password pages: one card in the middle, in the staff look, for staff and participants alike. */
main.account-main { max-width: 440px; padding: 56px 16px; }
.account-card h1 { margin: 0; font-size: 28px; letter-spacing: -0.02em; }
.account-card .page-lead { margin-top: 6px; }
body.staff .account-card form.stacked input:not([type=checkbox]) { max-width: none; }
body.staff .account-card form.stacked button { width: 100%; margin-top: 24px; }
.account-card .message { border-radius: 8px; }

body.staff .account-card form.stacked input.input-short { max-width: 160px; }
.label-note { font-weight: normal; color: var(--muted); font-size: 14px; }

/* The list of sessions: a row per session, the whole row a link, and the new session form folded away. */
.table-scroll { overflow-x: auto; }
.session-list { min-width: 640px; }
.session-list tbody tr { position: relative; }
.session-list tbody tr:hover { background: #fafaf8; }
.session-list .row-link { font-weight: 600; text-decoration: none; }
.session-list .row-link::after { content: ""; position: absolute; inset: 0; }
.session-list .row-link:focus-visible { outline: none; }
.session-list tbody tr:has(.row-link:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
.session-list .tick { width: 1%; text-align: center; }
body.staff button:disabled { color: #85857f; background: var(--soft); border-color: var(--line); cursor: not-allowed; }
.new-sections { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
/* Above the link that covers the row, so a tick does not open the session; the label fills the cell. */
.session-list td.tick label { position: relative; z-index: 1; display: flex; justify-content: center; padding: 8px; margin: -8px; cursor: pointer; }
.session-list .tick input { width: 18px; height: 18px; margin: 0; }
.session-list tbody tr:has(.tick input:checked) { background: var(--soft); }
.clients-overview .client-row > * { border-top: 1px solid var(--line); font-size: inherit; color: var(--ink); text-align: left; }
.clients-overview .client-row > .number, .clients-overview .number { text-align: right; width: 1%; white-space: nowrap; }
.clients-overview .client-row > * { font-weight: 600; }
.clients-overview .department-row > td:first-child { padding-left: 32px; }
.clients-overview .actions-cell { text-align: right; width: 1%; white-space: nowrap; }
.clients-overview form { margin: 0; }
.selection-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
body.staff .selection-bar select { margin: 0; width: auto; }
.session-list td.number, .session-list th.number { text-align: right; width: 1%; white-space: nowrap; }
.session-list td { white-space: nowrap; }
.session-list td.session-name { white-space: normal; width: 40%; }
.fold:not(.is-open):not(:target) { display: none; }
.admin-main:has(.fold.is-open, .fold:target) .page-head .button.primary { display: none; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }

/* Staff pages without a session: a small menu in the header, and clients with their departments. */
.staff-top { display: flex; gap: 4px; margin-right: auto; margin-left: 24px; }
body.staff .staff-top a { padding: 8px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; }
body.staff .staff-top a:hover { background: var(--soft); }
body.staff .staff-top a[aria-current] { font-weight: 600; background: var(--soft); }
/* The staff language switch beside the log-out button (ADR-081). */
.staff-language { display: flex; align-items: center; gap: 6px; margin-right: 12px; }
.staff-language select { padding: 4px 8px; font-size: 0.9rem; }
.cell-note { display: block; color: var(--muted); font-size: 14px; }
.session-list td.cell-wrap { white-space: normal; color: #4a4a46; }
.field-note { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.inline-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.department-list td { vertical-align: top; }
.department-list td:first-child { width: 40%; }
body.staff form.stacked textarea { max-width: 420px; padding: 8px; box-sizing: border-box; }
body.staff form.stacked .actions { margin: 16px 0 0; align-items: center; }
body.staff form.stacked .actions button { margin-top: 0; }

/* Staff logins: a role as a choice with its meaning, and departments as boxes per client. */
.choice-group { border: 0; padding: 0; margin: 16px 0 0; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.choice-group legend { padding: 0; margin-bottom: 6px; font-weight: 600; }
body.staff form.stacked label.choice { display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; max-width: 420px; box-sizing: border-box; cursor: pointer; }
body.staff form.stacked label.choice:has(input:checked) { border-color: var(--accent); background: #fdf3f4; }
body.staff form.stacked label.choice input { width: auto; margin: 3px 0 0; display: inline-block; }
body.staff form.stacked label.choice-compact { padding: 6px 10px; }
.choice-client { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.choice-client-name { font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.admin-departments-note { display: none; }
form.staff-form:has(input[name$="Role"][value="Administrator"]:checked) .staff-departments { display: none; }
form.staff-form:has(input[name$="Role"][value="Administrator"]:checked) .admin-departments-note { display: block; }
.staff-clients .staff-line { display: block; min-height: 1.4em; }

/* Deleting a session: a card that says what goes, and a solid red button only there. */
.card-danger { border-color: #e3b4bb; }
.card-danger h2 { color: #8f0a1d; }
.delete-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
body.staff a.button.danger { color: #8f0a1d; border-color: #e3b4bb; }
body.staff button.danger-solid { background: #8f0a1d; border-color: #8f0a1d; color: #fff; font-weight: 600; }
body.staff button.danger-solid:hover { background: #6e0816; }
body.staff form.stacked input.input-short { max-width: 160px; }

/* The session page: each section's teams and settings fold away below its head, which keeps its main buttons. */
.section-fold { border-top: 1px solid #efefec; padding-top: 12px; }
.section-fold-summary { cursor: pointer; display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px; min-height: 40px; box-sizing: border-box; border: 1px solid #cfcfca; border-radius: 8px; background: var(--soft); color: var(--ink); font-weight: 600; list-style: none; user-select: none; }
.section-fold-summary:hover { border-color: #9a9a95; background: #ebebe8; }
.section-fold-summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.section-fold-summary::-webkit-details-marker { display: none; }
.section-fold-summary::before { content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform 0.15s; margin-right: 2px; }
.section-fold[open] > .section-fold-summary::before { transform: rotate(45deg); margin-top: -4px; }
.section-fold[open] > .section-fold-summary { margin-bottom: 16px; }
.section-fold .when-open, .section-fold[open] > summary .when-folded { display: none; }
.section-fold[open] > summary .when-open { display: inline; }
.section-body { display: flex; flex-direction: column; gap: 16px; }
.account-links { display: flex; flex-wrap: wrap; gap: 6px 10px; font-size: 14px; color: var(--muted); }

/* A section's settings and resets: a gear after its name that opens a small panel below it. */
.section-settings { position: relative; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 1px solid transparent; border-radius: 8px; color: var(--muted); cursor: pointer; list-style: none; }
.icon-button::-webkit-details-marker { display: none; }
.icon-button:hover, .section-settings[open] > .icon-button { color: var(--ink); background: var(--soft); border-color: var(--line); }
.icon-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.section-settings-panel { position: absolute; top: calc(100% + 6px); left: 0; z-index: 10; width: max-content; max-width: min(560px, calc(100vw - 48px)); padding: 16px 18px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12); display: flex; flex-direction: column; gap: 12px; }
.section-settings-panel h3 { margin: 0; font-size: 16px; }
.section-settings-panel .actions { margin: 0; }

/* The join link on the Participants page, and participants still waiting for a team. */
.copy-field { display: flex; gap: 8px; max-width: 640px; }
body.staff .copy-field input { flex: 1; min-width: 0; padding: 8px; font-family: ui-monospace, Consolas, monospace; font-size: 14px; background: var(--soft); }
.participants tr.row-waiting td { background: #fff8e6; }

/* A help popup behind a question mark next to a heading. */
.heading-with-help { display: flex; align-items: center; gap: 8px; }
.help-popup { position: relative; }
.help-popup[open] > .icon-button { color: var(--ink); background: var(--soft); border-color: var(--line); }
.popup-panel { position: absolute; top: calc(100% + 6px); left: 0; z-index: 10; width: min(520px, calc(100vw - 48px)); padding: 16px 20px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12); font-size: 15px; }
.popup-panel h3 { margin: 12px 0 4px; font-size: 15px; }
.popup-panel h3:first-child { margin-top: 0; }
.popup-panel ul, .popup-panel ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }

/* The Participants page: a summary line under the heading, and the joining rules behind the gear. */
.participant-summary { display: flex; flex-wrap: wrap; gap: 6px 8px; margin: 0; padding: 0; list-style: none; font-size: 14px; }
.participant-summary li { padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--muted); }
.participant-summary li strong { color: var(--ink); }
.participant-summary li.summary-attention { background: #fff8e6; border-color: #f1dfb0; color: #6b4e00; }
.joining-rules { width: min(480px, calc(100vw - 48px)); gap: 20px; }
.joining-rules > section + section { padding-top: 16px; border-top: 1px solid var(--line); }
.joining-rules h3 { margin: 0 0 6px; }
.joining-rules p { margin: 0 0 8px; }

/* Tabs in a card: one panel at a time once the script runs; without it, every panel under its own heading. */
.tab-list[hidden] { display: none; }
.tab-list { display: flex; gap: 2px; overflow-x: auto; margin: 0 0 16px; border-bottom: 1px solid var(--line); }
body.staff .tab-list [role=tab] { padding: 10px 12px 9px; border: none; border-bottom: 3px solid transparent; border-radius: 0; background: none; color: var(--muted); white-space: nowrap; font: inherit; font-size: 15px; cursor: pointer; }
body.staff .tab-list [role=tab]:hover { color: var(--ink); }
body.staff .tab-list [role=tab][aria-selected=true] { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
.tab-list [role=tab]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
[data-tabs] [role=tabpanel] + [role=tabpanel] { margin-top: 24px; }
[data-tabs].tabs-ready [role=tabpanel] { margin-top: 0; }
[data-tabs].tabs-ready .tab-heading { display: none; }
.tab-intro { margin-top: 0; }

/* The logins on the Participants page: a toolbar, light rows, and a menu per login and for the checked logins. */
.logins-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.logins-find { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex: 1; }
.logins-find[hidden] { display: none; }
/* Search, filter and the Actions button line up at the height of a button. */
body.staff .logins-find input[type=search], body.staff .logins-find select, body.staff .logins-toolbar .menu-button { box-sizing: border-box; height: 40px; min-height: 40px; }
body.staff .logins-find input[type=search] { flex: 1 1 220px; max-width: 320px; padding: 0 10px; }
body.staff .logins-find select { padding: 0 8px; }
body.staff .logins-toolbar .menu-button { padding: 0 12px 0 14px; }
.logins-count, .logins-empty { color: var(--muted); font-size: 14px; }
#bulk-logins { margin-left: auto; }
.logins td { vertical-align: middle; }
.logins tr[hidden] { display: none; }
.logins .col-check { width: 32px; padding-right: 0; }
.logins .col-check input { width: 18px; height: 18px; margin: 0; vertical-align: middle; }
.logins .col-menu { width: 40px; text-align: right; }
.logins .login-name { font-weight: 500; }
.logins td[data-label=Status] .badge + .badge { margin-left: 4px; }
.participants tr.row-checked td { background: #f1f5fb; }
.logins form.inline select { padding: 6px; }

.menu { position: relative; display: inline-block; text-align: left; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
body.staff .menu-button { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px 8px 14px; min-height: 40px; border: 1px solid #cfcfca; border-radius: 8px; background: #fff; cursor: pointer; }
.menu-button:hover, .menu[open] > .menu-button { border-color: #9a9a95; }
.menu-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.menu[open] > .icon-button { color: var(--ink); background: var(--soft); border-color: var(--line); }
.menu-panel { position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; width: max-content; min-width: 220px; max-width: min(360px, calc(100vw - 48px)); padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12); display: flex; flex-direction: column; gap: 4px; }
.menu-panel-end { left: auto; right: 0; }
.menu-panel hr { width: 100%; margin: 4px 0; border: none; border-top: 1px solid var(--line); }
.menu-panel form { margin: 0; }
body.staff .menu-panel > button, body.staff .menu-panel > form:not(.menu-row) > button { width: 100%; text-align: left; border-color: transparent; background: none; }
body.staff .menu-panel > button:hover:not(:disabled), body.staff .menu-panel > form:not(.menu-row) > button:hover { background: var(--soft); border-color: transparent; }
body.staff .menu-panel button:disabled { color: #9a9a95; cursor: default; }
.menu-note { margin: 4px 8px; color: var(--muted); font-size: 13px; }
.menu-row { display: flex; gap: 6px; padding: 4px; }
body.staff .menu-row input, body.staff .menu-row select { flex: 1; min-width: 140px; padding: 6px 8px; }
body.staff .menu-row button { flex: none; }

/* On a phone each login is a small card: name and checkbox on top, the rest under it. */
@media (max-width: 760px) {
    .logins, .logins tbody { display: block; }
    .logins thead { display: none; }
    .logins tbody tr { display: grid; grid-template-columns: 32px 1fr 40px; gap: 4px 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
    .logins tbody td { display: block; padding: 0; border: none; }
    .logins .col-check { grid-row: 1; grid-column: 1; }
    .logins .col-name { grid-row: 1; grid-column: 2; }
    .logins .col-menu { grid-row: 1; grid-column: 3; }
    .logins td[data-label] { grid-column: 2 / 4; }
    .logins td[data-label]:empty { display: none; }
    .logins td[data-label=Section]::before, .logins td[data-label=Team]::before { content: attr(data-label) ": "; color: var(--muted); }
    #bulk-logins { margin-left: 0; }
}

/* Cards that fold under their heading (Participants page): the heading is the button, with a chevron before it. */
details.card.card-fold { display: block; }
.card-fold-summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; user-select: none; }
.card-fold-summary::-webkit-details-marker { display: none; }
.card-fold-summary::before { content: ""; flex: none; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform 0.15s; margin: 0 4px 4px 2px; }
details.card-fold:not([open]) > .card-fold-summary::before { transform: rotate(-45deg); margin-bottom: 0; }
.card-fold-summary:hover h2 { color: var(--accent-dark); }
.card-fold-summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.card-fold-body { display: flex; flex-direction: column; gap: 16px; margin-top: 16px; }
.card-fold-links { margin: 0; font-size: 14px; }

/* The starting password: its fields only while the box is ticked, and "Give it to every login" set apart below. */
.starting-form:has([data-starting-switch]:not(:checked)) .starting-fields { display: none; }
.starting-give { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.starting-give form { margin: 0; }

/* Countdowns: the session page's Countdown button and panel, and the time left in the game's menu bar. */
.deadline-popup { position: relative; }
.deadline-popup > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.deadline-popup > summary::-webkit-details-marker { display: none; }
body.staff .deadline-popup > summary.button { padding: 8px 14px; min-height: 40px; box-sizing: border-box; border: 1px solid #cfcfca; border-radius: 8px; background: #fff; color: var(--ink); }
body.staff .deadline-popup > summary.button:hover, .deadline-popup[open] > summary.button { border-color: #9a9a95; }
.deadline-panel { position: absolute; top: calc(100% + 6px); right: 0; z-index: 10; width: min(360px, calc(100vw - 48px)); padding: 16px 18px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12); display: flex; flex-direction: column; gap: 10px; text-align: left; }
.deadline-panel h3 { margin: 0; font-size: 16px; }
.deadline-panel .hint { margin: 0; font-size: 14px; color: var(--muted); }
.deadline-panel form { margin: 0; }
.deadline-quick { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
body.staff .deadline-quick button { min-height: 32px; padding: 4px 10px; font-size: 14px; }
.countdown { font-variant-numeric: tabular-nums; font-weight: 600; }
.deadline-popup .countdown { padding: 2px 8px; border-radius: 999px; background: var(--soft); font-size: 13px; }
.countdown.is-low { background: #fff1e0; color: #a14a00; }
.countdown.is-up { background: #fbe6e6; color: #a30d22; }
.game-countdown { padding: 4px 10px; border-radius: 999px; background: #eef0f4; color: #2a2f3a; }
.game-countdown[hidden] { display: none; }
.game-closing { font-weight: 600; }

:is(body.staff, body.game) .message.success { transition: opacity 0.6s ease, max-height 0.6s ease, margin 0.6s ease, padding 0.6s ease; max-height: 200px; overflow: hidden; }
:is(body.staff, body.game) .message.success.is-fading { opacity: 0; max-height: 0; margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0; animation: none; }

/* The message editor on the staff pages: a toolbar over an area that shows the text as the inbox will. */
.html-editor { border: 1px solid #cfcfca; border-radius: 8px; background: #fff; overflow: hidden; }
.html-editor[hidden] { display: none; }
.html-editor:focus-within { border-color: var(--accent); }
.html-editor-toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border-bottom: 1px solid var(--line); background: var(--soft); }
body.staff .html-editor-toolbar button { min-height: 32px; padding: 4px 10px; font-size: 14px; }
body.staff .html-editor-toolbar button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.html-editor-area { min-height: 220px; max-height: 60vh; overflow-y: auto; padding: 10px 12px; line-height: 1.5; outline: none; }
.html-editor-area > :first-child { margin-top: 0; }
.html-editor-area a { color: var(--accent-dark); }

/* A participant's new password, with a QR code to choose their own instead. */
.password-qr { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px 24px; margin-top: 8px; }
.password-qr-code { flex: none; width: 168px; height: 168px; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.password-qr-code svg { display: block; width: 100%; height: 100%; }
.password-qr h3 { margin: 0 0 4px; font-size: 16px; }
.password-qr > div:last-child { flex: 1 1 260px; min-width: 0; }

/* The Upload Excel tab: room between the explanation, the download link and the form. */
.upload-panel .tab-intro { margin-bottom: 16px; line-height: 1.5; }
.upload-panel .upload-download { margin: 0 0 24px; }
.upload-panel .upload-form { padding-top: 8px; border-top: 1px solid var(--line); }
.upload-panel .upload-form label { margin-top: 16px; }
.upload-panel .upload-form input[type=file] { margin-top: 8px; padding: 10px; border: 1px dashed #cfcfca; border-radius: 8px; background: var(--soft); }
.upload-panel .upload-form button { margin-top: 24px; }

/* A session's first and last day, side by side. */
.date-range { display: flex; flex-wrap: wrap; gap: 0 16px; }
.date-range > div { flex: 0 1 200px; min-width: 0; }

/* A person's first and last name, side by side. */
.name-fields { display: flex; flex-wrap: wrap; gap: 0 16px; }
.name-fields > div { flex: 1 1 180px; min-width: 0; max-width: 260px; }

/* The waiting screen while a section calculates. */
dialog.calculating { border: 0; border-radius: var(--radius); padding: 28px 32px; width: min(420px, calc(100vw - 48px)); box-sizing: border-box; text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); }
dialog.calculating::backdrop { background: rgba(20, 20, 20, 0.45); }
dialog.calculating h2 { margin: 12px 0 4px; font-size: 18px; }
.calculating-note { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.calculating-spinner { width: 36px; height: 36px; margin: 0 auto; border: 4px solid var(--line); border-top-color: var(--accent); border-radius: 50%; }
@media (prefers-reduced-motion: no-preference) {
    .calculating-spinner { animation: game-spin 0.9s linear infinite; }
}
body.staff form[data-calculate] button[aria-disabled="true"] { opacity: 0.6; cursor: progress; }

/* Password fields with a button to show what was typed. */
.password-field { position: relative; display: block; max-width: 420px; }
.password-field input { padding-right: 44px !important; }
/* Forms style their buttons broadly (full width, margins), so the eye button sets its own size firmly. */
.password-field .password-toggle { position: absolute; top: 50%; right: 4px; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center; width: 36px !important; height: 32px; min-height: 0 !important; padding: 0 !important; margin: 0 !important; border: 0 !important; border-radius: 6px; background: transparent !important; color: var(--muted, #5f5f5a) !important; cursor: pointer; }
.password-field .password-toggle:hover, .password-field .password-toggle[aria-pressed="true"] { color: var(--ink, #1c1c1c) !important; background: var(--soft, #f4f4f2) !important; }
.password-field .password-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.validation-summary-errors[hidden], .field-validation-error[hidden] { display: none; }

/* Mail templates (ADR-077): the text in a monospace box as wide as the card, and the fields beside their meaning. */
#template-body { width: 100%; max-width: none; box-sizing: border-box; font-family: ui-monospace, Consolas, monospace; font-size: 14px; line-height: 1.5; }
.template-fields { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.template-fields div { display: contents; }
.template-fields dd { margin: 0; color: var(--muted); }
.page-head h1 .cell-note { display: inline; margin-left: 8px; font-size: 16px; font-weight: 400; }
