﻿:root {
    /* Pins native form controls (plain text inputs, scrollbars, spinners) to the theme the page
       actually draws, instead of letting Chromium/WebView2 follow the OS preference on its own:
       on a light page under a dark OS that produced a dark, near-illegible box for e.g. the
       Group text input on Participants. The dark theme flips this below — otherwise scrollbars,
       dropdown lists and date pickers stay bright white inside the dark app. */
    color-scheme: light;
    color: var(--rl-text-primary);
    background: var(--rl-bg-app);
    font-family: var(--rl-font-family);
    font-size: var(--rl-font-ui);
    font-synthesis: none;
}

* {
    box-sizing: border-box;
}

/* A <fieldset> is used purely to disable a group of controls at once (round availability). Its
   native frame, padding and min-width: min-content are pure browser chrome — the frame drew a
   second box inside the panel and the intrinsic minimum width stopped the grid inside from
   shrinking. */
fieldset {
    margin: 0;
    padding: 0;
    border: 0;
    min-width: 0;
}

/* Every <summary> is a click target, whether or not its page gave it a class. */
summary {
    cursor: pointer;
}

html,
body,
#app {
    height: 100%;
}

body {
    /* 1366x768 at 200 % DPI is 683 CSS px wide. The floor stays below that and scrolls instead of
       clipping, so no shell control is cut off silently. */
    min-width: 640px;
    margin: 0;
    overflow-x: auto;
    overflow-y: hidden;
    background: var(--rl-bg-app);
}

button,
input,
select,
textarea,
a {
    font: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
    outline: 2px solid var(--rl-primary);
    outline-offset: 1px;
}

/* Shared base for text inputs, drop-downs and text areas. Until now only controls inside
   particular containers (.field, .toolbar-field, .pairing-*, .report-*) carried the house form
   while every other control stayed in Chromium's native rendering — visible on the prize, report,
   round and team pages as a foreign-looking box next to a styled one. The base now applies to
   every control and the container rules only add width and placement on top. Check boxes, radio
   buttons and the visually hidden file picker keep their native rendering on purpose.
   The :not() chain sits in :where() so the rule weighs exactly one element selector (0,0,1):
   enough to beat `input { font: inherit }` above, which comes earlier, and below every class rule.
   With the chain counted it outweighed every class rule (finding CS-4), and the check-in scan field lost
   its 20 px type and frame, the result field its bold. Hover, focus and disabled below keep their
   weight on purpose — a state must win over a component's resting look. */
input:where(:not([type="checkbox"]):not([type="radio"]):not([type="file"])),
select,
textarea {
    min-height: var(--rl-control-height);
    padding: 4px 7px;
    border: 1px solid var(--rl-border-strong);
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-surface);
    color: var(--rl-text-primary);
    /* `font: inherit` above hands the control whatever the surrounding label uses. Where that
       label is a small uppercase caption — the pairing command bar, every label that wraps its
       own control — the typed value came out at caption size in capitals. Entered text is data
       and always reads at UI size. */
    font-size: var(--rl-font-ui);
    font-weight: 400;
    letter-spacing: normal;
    text-transform: none;
}

textarea {
    min-height: 64px;
    padding: 6px 7px;
    resize: vertical;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):hover:not(:disabled),
select:hover:not(:disabled),
textarea:hover:not(:disabled) {
    border-color: var(--rl-text-secondary);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus,
select:focus,
textarea:focus {
    border-color: var(--rl-primary);
    /* CS-6: was --rl-primary-soft, about 1.1:1 against white. A field shows where typing goes
       for mouse users as well, so this stays on :focus, not only :focus-visible. */
    outline: var(--rl-focus-ring);
    outline-offset: 0;
}

/* Carries the same :not() chain as the base rule: without it the base wins on specificity and a
   disabled text field keeps the enabled colours. background-color rather than background, so the
   drop-down keeps the chevron drawn below. */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):disabled,
select:disabled,
textarea:disabled {
    background-color: var(--rl-bg-hover);
    color: var(--rl-text-disabled);
    cursor: not-allowed;
}

input[type="checkbox"]:disabled,
input[type="radio"]:disabled {
    cursor: not-allowed;
}

input[type="checkbox"],
input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--rl-primary);
}

/* The drop-down arrow is drawn here instead of by the platform: the native Windows arrow comes
   with its own separator, its own grey button field and its own metrics, which is what made a
   plain <select> read as unstyled next to the app's own fields. The chevron is a data URI, so it
   cannot inherit currentColor and needs the dark counterpart below. */
select {
    appearance: none;
    padding-right: 24px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%234c5968' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 7px center;
    background-size: 9px 6px;
    cursor: pointer;
}

:root[data-theme="dark"] select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23a7b0bc' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.workspace h1[tabindex="-1"]:focus {
    outline: none;
}

/* Pairing review workspace */
.pairing-heading {
    align-items: end;
    display: grid;
    gap: var(--rl-space-4);
}

.pairing-command-bar {
    align-items: end;
    display: grid;
    gap: var(--rl-space-4);
    grid-template-columns: auto minmax(0, 1fr);
    margin-bottom: var(--rl-space-3);
}

.pairing-command-fields {
    align-items: end;
    display: grid;
    gap: var(--rl-space-2);
    grid-template-columns: minmax(190px, 0.7fr) minmax(280px, 1.4fr) auto;
}

.pairing-command-fields label,
.pairing-board-toolbar label,
.pairing-action-area label {
    display: grid;
    gap: 4px;
}

.pairing-command-fields input,
.pairing-command-fields select,
.pairing-list-filters input,
.pairing-list-filters select,
.pairing-board-toolbar input,
.pairing-inline-controls select,
.pairing-action-area textarea {
    min-height: var(--rl-control-height);
}

.pairing-review-layout {
    display: grid;
    gap: var(--rl-space-3);
    grid-template-columns: minmax(200px, 260px) minmax(0, 1fr);
    min-height: 580px;
}

.pairing-proposal-list,
.pairing-proposal-detail {
    min-width: 0;
}

.pairing-list-filters {
    display: grid;
    gap: var(--rl-space-2);
    grid-template-columns: minmax(0, 1fr) 120px;
    margin-bottom: var(--rl-space-2);
}

.proposal-scroll-list {
    border: 1px solid var(--rl-border);
    max-height: 660px;
    overflow: auto;
}

.proposal-list-row {
    align-items: start;
    background: var(--rl-bg-surface);
    border: 0;
    border-bottom: 1px solid var(--rl-border-subtle);
    color: var(--rl-text-primary);
    cursor: pointer;
    display: grid;
    font: inherit;
    gap: var(--rl-space-2);
    grid-template-columns: minmax(0, 1fr) auto;
    padding: var(--rl-space-3);
    text-align: left;
    width: 100%;
}

.proposal-list-row:hover {
    background: var(--rl-bg-hover);
}

.proposal-list-row.selected {
    background: var(--rl-bg-selection-focus);
    box-shadow: inset 3px 0 var(--rl-primary);
}

.proposal-list-row span,
.proposal-row-state {
    display: grid;
    gap: 3px;
}

.proposal-list-row small {
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
}

.proposal-row-state {
    justify-items: end;
}

.pairing-detail-empty {
    margin: 90px auto;
    max-width: 520px;
}

.pairing-detail-heading {
    border-bottom: 1px solid var(--rl-border);
    margin-bottom: var(--rl-space-3);
    padding-bottom: var(--rl-space-2);
}

.pairing-board-toolbar {
    align-items: end;
    display: flex;
    justify-content: space-between;
    margin: var(--rl-space-3) 0 var(--rl-space-2);
}

.pairing-board-toolbar label {
    min-width: 260px;
}

.pairing-board-table-wrap {
    border: 1px solid var(--rl-border);
    max-height: 430px;
    overflow: auto;
}

.pairing-board-table {
    margin: 0;
}

.pairing-board-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.pairing-board-table .action-column {
    width: 128px;
}

.pairing-edit-tools {
    background: var(--rl-bg-app);
    border: 1px solid var(--rl-border);
    display: grid;
    gap: var(--rl-space-3);
    grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.8fr);
    margin-top: var(--rl-space-2);
    padding: var(--rl-space-3);
}

.pairing-edit-tools h3 {
    font-size: var(--rl-font-small);
    margin: 0 0 var(--rl-space-2);
}

.pairing-inline-controls {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* One column: the reason field, then the buttons. With two columns the buttons sat on the right
   while a reason was asked for and on the left once the round was released. */
.pairing-action-area {
    border-bottom: 1px solid var(--rl-border);
    border-top: 1px solid var(--rl-border);
    display: grid;
    gap: var(--rl-space-3);
    margin: var(--rl-space-4) 0;
    padding: var(--rl-space-3) 0;
}

/* Left-aligned like .round-actions, so the step the round is waiting for keeps its place. */
.pairing-actions {
    align-items: end;
    display: flex;
    flex-wrap: wrap;
    gap: var(--rl-space-2);
    justify-content: flex-start;
}

.pairing-load-error,
.pairing-action-error {
    border-color: var(--rl-danger);
}

.pairing-error-detail {
    border-top: 1px solid var(--rl-border-subtle);
    margin-bottom: var(--rl-space-3);
    padding: var(--rl-space-2) 0;
}

.pairing-error-detail p {
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
    margin: var(--rl-space-1) 0 0;
    overflow-wrap: anywhere;
}

.pairing-metadata,
.pairing-audit,
.pairing-error-detail {
    border-bottom: 1px solid var(--rl-border);
    padding: var(--rl-space-2) 0;
}

.pairing-metadata summary,
.pairing-audit summary,
.pairing-error-detail summary {
    cursor: pointer;
    font-weight: 700;
    padding: var(--rl-space-2) 0;
}

.pairing-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pairing-facts .hash {
    overflow-wrap: anywhere;
}

/* Package U12 (finding N13): the kept files of the engine run, below the metadata. */
.pairing-engine-files {
    margin-top: var(--rl-space-3);
}

.pairing-engine-files .hash {
    font-size: var(--rl-font-small);
    overflow-wrap: anywhere;
}

.pairing-audit ol {
    list-style: none;
    margin: var(--rl-space-2) 0 0;
    padding: 0;
}

.pairing-audit li {
    display: grid;
    gap: var(--rl-space-2);
    grid-template-columns: 12px minmax(0, 1fr);
    padding: var(--rl-space-2) 0;
}

.audit-marker {
    background: var(--rl-primary);
    border: 3px solid var(--rl-bg-selection);
    border-radius: 50%;
    height: 10px;
    margin-top: 3px;
    width: 10px;
}

.pairing-audit li div {
    display: grid;
    gap: 3px;
}

.pairing-audit li span,
.pairing-audit li small {
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
}

.pairing-audit li p {
    margin: 0;
}

@media (max-width: 1220px) {
    .pairing-heading,
    .pairing-command-bar,
    .pairing-review-layout {
        grid-template-columns: 1fr;
    }

    .pairing-proposal-list {
        max-height: none;
    }

    .proposal-scroll-list {
        max-height: 280px;
    }
}

@media (max-width: 850px) {
    .pairing-command-fields,
    .pairing-edit-tools,
    .pairing-action-area {
        grid-template-columns: 1fr;
    }

    .pairing-review-layout {
        min-height: 0;
    }
}

/* Sign-in pages (desktop PIN page and the browser host's page share these rules). A slowly drifting
   chessboard fades out behind the panel; the panel rises in, the mark breathes. Every motion stops
   under prefers-reduced-motion, and nothing here carries information. Tokens only. */
.sign-in-shell {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: var(--rl-space-5);
    overflow: hidden;
    isolation: isolate;
    background:
        radial-gradient(60rem 40rem at 15% 10%, color-mix(in srgb, var(--rl-primary) 14%, transparent), transparent 70%),
        radial-gradient(50rem 36rem at 90% 95%, color-mix(in srgb, var(--rl-primary-strong) 12%, transparent), transparent 70%),
        var(--rl-bg-app);
}

.sign-in-shell::before {
    content: "";
    position: absolute;
    inset: -96px;
    z-index: -1;
    background:
        conic-gradient(
            color-mix(in srgb, var(--rl-primary) 9%, transparent) 25%,
            transparent 0 50%,
            color-mix(in srgb, var(--rl-primary) 9%, transparent) 0 75%,
            transparent 0)
        0 0 / 96px 96px;
    -webkit-mask-image: radial-gradient(ellipse at center, #000 0%, transparent 72%);
    mask-image: radial-gradient(ellipse at center, #000 0%, transparent 72%);
    animation: sign-in-board-drift 40s linear infinite;
}

.sign-in-panel {
    width: min(100%, 560px);
    padding: var(--rl-space-8);
    border-top: 3px solid var(--rl-primary);
    border-radius: var(--rl-radius-md);
    box-shadow: var(--rl-shadow-popover);
    animation: sign-in-rise 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.sign-in-heading {
    display: flex;
    align-items: flex-start;
    gap: var(--rl-space-4);
    margin-bottom: var(--rl-space-5);
}

.sign-in-heading > :last-child { animation: sign-in-rise 0.6s 0.12s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.sign-in-heading h1 { margin: 0 0 var(--rl-space-2); }
.sign-in-heading .lead { margin: 0; max-width: 42ch; }

.sign-in-heading .menu-brand-mark {
    flex: none;
    width: 52px;
    height: 52px;
    border-radius: var(--rl-radius-md);
    font-size: 30px;
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--rl-primary) 45%, transparent);
    animation: sign-in-pulse 3.6s ease-out 0.8s infinite;
}

.sign-in-panel .form-actions {
    margin-top: var(--rl-space-5);
    animation: sign-in-rise 0.6s 0.24s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.sign-in-panel .notice { animation: sign-in-rise 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.sign-in-panel .button-primary {
    min-width: 220px;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.sign-in-panel .button-primary::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 35%, color-mix(in srgb, #fff 35%, transparent) 50%, transparent 65%);
    transform: translateX(-120%);
}

.sign-in-panel .button-primary:hover:not(:disabled)::after { transform: translateX(120%); transition: transform 0.7s ease; }
.sign-in-panel .button-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px color-mix(in srgb, var(--rl-primary) 35%, transparent);
}

.sign-in-panel .button-primary:active:not(:disabled) { transform: translateY(0); box-shadow: none; }

@keyframes sign-in-rise {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}

@keyframes sign-in-pulse {
    0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--rl-primary) 45%, transparent); }
    70%, 100% { box-shadow: 0 0 0 16px transparent; }
}

@keyframes sign-in-board-drift {
    to { transform: translate(96px, 96px); }
}

@keyframes sign-in-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Reduced motion keeps only a short fade: nothing slides, drifts or pulses. */
@media (prefers-reduced-motion: reduce) {
    :root:not([data-motion="full"]) .sign-in-shell::before,
    :root:not([data-motion="full"]) .sign-in-heading .menu-brand-mark {
        animation: none;
    }

    :root:not([data-motion="full"]) .sign-in-panel,
    :root:not([data-motion="full"]) .sign-in-heading > :last-child,
    :root:not([data-motion="full"]) .sign-in-panel .form-actions,
    :root:not([data-motion="full"]) .sign-in-panel .notice {
        animation: sign-in-fade 0.3s ease-out both;
    }

    :root:not([data-motion="full"]) .sign-in-panel .button-primary,
    :root:not([data-motion="full"]) .sign-in-panel .button-primary::after {
        transition: none;
    }

    :root:not([data-motion="full"]) .sign-in-panel .button-primary:hover:not(:disabled) {
        transform: none;
    }
}

:root[data-motion="reduced"] .sign-in-shell::before,
:root[data-motion="reduced"] .sign-in-heading .menu-brand-mark {
    animation: none;
}

:root[data-motion="reduced"] .sign-in-panel,
:root[data-motion="reduced"] .sign-in-heading > :last-child,
:root[data-motion="reduced"] .sign-in-panel .form-actions,
:root[data-motion="reduced"] .sign-in-panel .notice {
    animation: sign-in-fade 0.3s ease-out both;
}

:root[data-motion="reduced"] .sign-in-panel .button-primary,
:root[data-motion="reduced"] .sign-in-panel .button-primary::after {
    transition: none;
}

:root[data-motion="reduced"] .sign-in-panel .button-primary:hover:not(:disabled) {
    transform: none;
}

/* Groups everything a confirmation question makes inert, without a box of its own. */
.app-shell-content {
    display: contents;
}

.app-shell {
    display: grid;
    grid-template-rows: minmax(31px, auto) minmax(var(--rl-toolbar-height), auto) auto auto minmax(0, 1fr) minmax(var(--rl-statusbar-height), auto);
    height: 100vh;
    min-height: 0;
    background: var(--rl-bg-app);
}

/* Explicit grid-row placement (rather than relying on source order) so the round-overview
   band's row collapses to 0 height when RoundOverviewBar renders nothing — no section open —
   instead of shifting every row below it up by one track. */
.main-menu-bar {
    grid-row: 1;
}

.main-toolbar {
    grid-row: 2;
}

.round-overview-bar {
    grid-row: 3;
}

.app-body {
    grid-row: 5;
}

.status-bar {
    grid-row: 6;
}

/* FIDE mode banner (package U3): its own row, which is 0 high while the tournament is in FIDE mode. */
.fide-mode-banner {
    grid-row: 4;
}

.main-menu-bar {
    position: relative;
    z-index: 20;
    display: flex;
    align-items: center;
    min-width: 0;
    border-bottom: 1px solid var(--rl-border);
    background: var(--rl-bg-surface);
}

.menu-brand {
    display: inline-flex;
    align-items: center;
    gap: var(--rl-space-2);
    width: var(--rl-sidebar-width);
    height: 100%;
    padding: 0 var(--rl-space-3);
    border-right: 1px solid var(--rl-border);
    color: var(--rl-text-primary);
    text-decoration: none;
}

.menu-brand-mark {
    display: grid;
    width: 20px;
    height: 20px;
    place-items: center;
    border-radius: var(--rl-radius-sm);
    background: var(--rl-primary);
    color: var(--rl-primary-contrast);
    font: 700 12px/1 Georgia, serif;
}

.menu-brand strong {
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.desktop-menu {
    display: flex;
    align-self: stretch;
    min-width: 0;
}

.desktop-menu > button,
.desktop-menu > a,
.menu-item > summary {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 var(--rl-space-3);
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--rl-text-primary);
    cursor: default;
    font-size: var(--rl-font-control);
    list-style: none;
    text-decoration: none;
}

.desktop-menu > button:not(:disabled):hover,
.desktop-menu > a:hover,
.menu-item > summary:hover,
.menu-item[open] > summary {
    background: var(--rl-bg-hover);
}

.desktop-menu > button:disabled {
    color: var(--rl-text-secondary);
    opacity: 1;
}

.desktop-menu > a {
    cursor: pointer;
}

.menu-item {
    position: relative;
}

.menu-item > summary::-webkit-details-marker {
    display: none;
}

.menu-popup {
    position: absolute;
    top: 100%;
    left: 0;
    display: grid;
    min-width: 260px;
    padding: var(--rl-space-1);
    border: 1px solid var(--rl-border-strong);
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-surface);
    box-shadow: var(--rl-shadow-popover);
}

.menu-popup a,
.menu-command {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--rl-space-6);
    min-height: 28px;
    padding: var(--rl-space-1) var(--rl-space-2);
    border-radius: var(--rl-radius-sm);
    color: var(--rl-text-primary);
    text-decoration: none;
}

.menu-popup a:hover {
    background: var(--rl-bg-selection);
}

.menu-command.disabled {
    color: var(--rl-text-disabled);
}

/* A menu entry that runs a command instead of following an address (Hilfe → Einführung starten).
   A button brings its own frame and font; this makes it read exactly like the links around it. */
button.menu-command {
    width: 100%;
    border: 0;
    background: transparent;
    cursor: default;
    font: inherit;
    text-align: left;
}

button.menu-command:hover {
    background: var(--rl-bg-selection);
}

.menu-popup kbd {
    border: 0;
    background: transparent;
    color: var(--rl-text-secondary);
}

.menu-separator {
    height: 1px;
    margin: var(--rl-space-1);
    background: var(--rl-border-subtle);
}

.desktop-mode-label {
    margin-left: auto;
    padding: 0 var(--rl-space-3);
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
    white-space: nowrap;
}

.cloud-share-widget {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.cloud-share-id {
    padding: 3px 7px;
    border: 1px solid var(--rl-border);
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-surface);
    font-size: var(--rl-font-small);
}

.cloud-share-manage {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 var(--rl-space-3);
    border: 1px solid var(--rl-border-strong);
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-surface);
    color: var(--rl-text-primary);
    font-size: var(--rl-font-small);
    font-weight: 600;
    text-decoration: none;
}

.cloud-share-manage:hover,
.cloud-share-manage:focus-visible {
    background: var(--rl-bg-hover);
    outline-color: var(--rl-primary);
}

.cloud-activity-panel {
    width: min(100%, 560px);
    margin-top: var(--rl-space-3);
    padding: var(--rl-space-3);
    border: 1px solid var(--rl-border);
    background: var(--rl-bg-surface);
}

.cloud-activity-panel p { margin: var(--rl-space-2) 0 0; }
.cloud-activity-avatars { display: flex; gap: var(--rl-space-1); margin-top: var(--rl-space-3); }
.cloud-activity-avatars span {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border: 1px solid var(--rl-border-strong);
    border-radius: 50%;
    background: var(--rl-bg-hover);
    color: var(--rl-text-primary);
    font-size: var(--rl-font-caption);
    font-weight: 700;
}
.cloud-activity-list { margin: var(--rl-space-3) 0 0; padding: 0; list-style: none; }
.cloud-activity-list li {
    display: flex;
    flex-wrap: wrap;
    gap: var(--rl-space-3);
    padding: var(--rl-space-2) 0;
    border-top: 1px solid var(--rl-border);
    font-size: var(--rl-font-small);
}
.cloud-activity-list time { margin-left: auto; color: var(--rl-text-secondary); }

.main-toolbar {
    z-index: 10;
    display: flex;
    align-items: center;
    gap: var(--rl-space-1);
    min-width: 0;
    padding: var(--rl-space-1) var(--rl-space-2);
    border-bottom: 1px solid var(--rl-border-strong);
    background: var(--rl-bg-toolbar);
}

.toolbar-button {
    display: inline-flex;
    align-items: center;
    gap: var(--rl-space-2);
    min-height: 34px;
    padding: 0 var(--rl-space-3);
    border: 1px solid transparent;
    border-radius: var(--rl-radius-sm);
    background: transparent;
    color: var(--rl-text-primary);
    cursor: pointer;
    font-size: var(--rl-font-control);
    text-decoration: none;
}

.toolbar-button:hover:not(:disabled) {
    border-color: var(--rl-border);
    background: var(--rl-bg-surface);
}

.toolbar-button:disabled {
    color: var(--rl-text-disabled);
    cursor: default;
    opacity: 0.62;
}

.toolbar-primary:not(:disabled) {
    border-color: var(--rl-primary);
    background: var(--rl-primary);
    color: var(--rl-primary-contrast);
}

.toolbar-primary:hover:not(:disabled) {
    border-color: var(--rl-primary);
    background: var(--rl-primary);
    color: var(--rl-primary-contrast);
}

.toolbar-icon {
    display: inline-grid;
    width: 18px;
    color: currentColor;
    font-size: 16px;
    place-items: center;
}

.toolbar-separator {
    width: 1px;
    height: 24px;
    margin: 0 var(--rl-space-1);
    background: var(--rl-border-strong);
}

/* Round-overview band ("Turnierverlauf"): current round, the whole schedule as chips, and a
   next-step call to action. Only rendered while a section is open, so its grid row (see
   .app-shell above) collapses to 0 height the rest of the time. */
.round-overview-bar {
    z-index: 9;
    display: flex;
    align-items: stretch;
    min-width: 0;
    border-bottom: 1px solid var(--rl-border-strong);
    background: var(--rl-bg-surface);
}

.round-overview-heading {
    display: flex;
    flex: 0 0 var(--rl-sidebar-width);
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: var(--rl-space-2) var(--rl-space-3);
    border-right: 1px solid var(--rl-border-subtle);
    background: var(--rl-bg-sidebar);
}

.round-overview-eyebrow {
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-caption);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.round-overview-round {
    color: var(--rl-text-primary);
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
}

.round-overview-system {
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
    white-space: nowrap;
}

.round-overview-track {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 0;
    min-width: 0;
    padding: var(--rl-space-1) var(--rl-space-2);
    overflow-x: auto;
}

.round-chip {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    gap: 2px;
    min-width: 96px;
    padding: 5px var(--rl-space-2);
    border-left: 3px solid var(--rl-border-subtle);
    border-radius: 0;
    color: var(--rl-text-primary);
    text-decoration: none;
    white-space: nowrap;
}

.round-chip:hover {
    background: var(--rl-bg-hover);
    text-decoration: none;
}

.round-chip.current {
    border-left-color: var(--rl-primary);
    background: var(--rl-bg-selection);
}

.round-chip-number {
    font-size: 15px;
    font-weight: 700;
}

.round-chip-state {
    font-size: var(--rl-font-caption);
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.round-chip-completed:not(.current) {
    border-left-color: var(--rl-success);
}

.round-chip-completed .round-chip-state {
    color: var(--rl-success);
}

.round-chip-active:not(.current) {
    border-left-color: var(--rl-warning);
}

.round-chip-active .round-chip-state {
    color: var(--rl-warning);
}

.round-chip-drawn:not(.current) {
    border-left-color: var(--rl-primary);
}

.round-chip-drawn .round-chip-state {
    color: var(--rl-primary);
}

.round-chip-correction:not(.current) {
    border-left-color: var(--rl-danger);
}

.round-chip-correction .round-chip-state {
    color: var(--rl-danger);
}

.round-chip-planned .round-chip-number {
    color: var(--rl-text-secondary);
}

.round-chip-planned .round-chip-state {
    color: var(--rl-text-disabled);
}

.round-overview-next {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: var(--rl-space-3);
    padding: var(--rl-space-2) var(--rl-space-3);
    border-left: 1px solid var(--rl-border-subtle);
    background: var(--rl-bg-sidebar);
}

.round-overview-next-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    text-align: right;
}

.round-overview-next-step {
    color: var(--rl-text-primary);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.round-overview-next-action {
    flex: 0 0 auto;
    white-space: nowrap;
}

.round-stage-track {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin: 2px 0;
}

.round-stage-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--rl-border);
}

.round-stage-dot-done {
    background: var(--rl-success);
}

.round-stage-dot-current {
    background: var(--rl-primary);
    box-shadow: 0 0 0 2px var(--rl-bg-selection);
}

.round-stage-dot-pending {
    background: var(--rl-border);
}

.app-body {
    display: grid;
    grid-template-columns: var(--rl-sidebar-width) var(--rl-sidebar-handle-width) minmax(0, 1fr);
    min-height: 0;
}

.navigation-sidebar {
    /* Explicit columns for both sidebar and workspace: while the sidebar is collapsed the resize
       handle is display:none, so it drops out of the grid entirely. With auto placement the
       workspace then slid into the handle's zero-width column and squeezed the whole page into a
       few pixels — collapsing the tournament along with the sidebar. */
    grid-column: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    /* overflow-x is set explicitly: with only overflow-y declared, CSS computes the other axis
       to auto, which gave the sidebar a permanent horizontal scrollbar as soon as one label was
       wider than the column. Labels ellipsize instead (see .nav-label). */
    overflow-x: hidden;
    overflow-y: auto;
    border-right: 1px solid var(--rl-border-strong);
    background: var(--rl-bg-sidebar);
}

/* Drag target between sidebar and workspace. Kept as its own grid column rather than an overlay
   inside the sidebar, so it is never clipped by the sidebar's scroll container. */
.sidebar-resize-handle {
    position: relative;
    grid-column: 2;
    background: var(--rl-bg-app);
    cursor: col-resize;
    touch-action: none;
}

.sidebar-resize-handle::after {
    content: "";
    position: absolute;
    inset: 0 2px;
    border-radius: var(--rl-radius-sm);
    background: transparent;
}

.sidebar-resize-handle:hover::after,
.sidebar-resize-handle:focus-visible::after,
.sidebar-resize-handle.dragging::after {
    background: var(--rl-primary);
}

.sidebar-resize-handle:focus-visible {
    outline: none;
}

/* While dragging, the pointer is captured by the handle: without this, crossing the workspace
   would flicker between the resize and text cursors and select text underneath. */
body.resizing-sidebar {
    cursor: col-resize;
    user-select: none;
}

.sidebar-footer-card {
    margin-top: auto;
}

.sidebar-navigation {
    display: grid;
    /* UI pass 2026-11: without an explicit column the implicit `auto` track grew to the widest
       label's full text (218 px in a 174 px sidebar), the sidebar's overflow-x clipped it hard, and
       the ellipsis of .nav-label never applied ("Seitenleiste einklap"). */
    grid-template-columns: minmax(0, 1fr);
    gap: 1px;
    padding: var(--rl-space-2);
}

.sidebar-group {
    margin-top: var(--rl-space-3);
    padding: var(--rl-space-1) var(--rl-space-2);
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-caption);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.sidebar-group:first-child {
    margin-top: 0;
}

.sidebar-navigation a,
.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--rl-space-2);
    /* CS-21: 38 px rows made the sidebar scroll at 768 px with a team section open; 34 px keeps a
       comfortable target and fits the list. */
    min-height: 34px;
    padding: 0 var(--rl-space-2);
    border-left: 3px solid transparent;
    border-radius: var(--rl-radius-sm);
    color: var(--rl-text-primary);
    text-decoration: none;
}

.sidebar-navigation a:hover {
    background: var(--rl-bg-hover);
}

.sidebar-navigation a.active {
    border-left-color: var(--rl-primary);
    background: var(--rl-bg-selection);
    color: var(--rl-primary-hover);
    font-weight: 600;
}

.sidebar-link.disabled {
    color: var(--rl-text-disabled);
}

.nav-icon {
    display: inline-grid;
    flex: 0 0 auto;
    width: 20px;
    color: var(--rl-icon);
    font-size: 16px;
    place-items: center;
}

.sidebar-navigation a.active .nav-icon {
    color: var(--rl-primary);
}

.nav-badge {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    margin-left: auto;
    padding: 0 5px;
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-hover);
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
    font-weight: 700;
}

.nav-badge-warning {
    background: var(--rl-warning);
    color: var(--rl-primary-contrast);
}

/* The hint ("Ausweise scannen", "Freigegeben") gives way before the label: in a 190 px sidebar
   both shrank alike and the label ended as "Meld…" (UI pass 2026-11). */
.nav-hint {
    flex: 0 4 auto;
    min-width: 0;
    margin-left: auto;
    overflow: hidden;
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Labels shrink and ellipsize so a narrow sidebar clips text instead of growing a scrollbar. */
.nav-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-collapse-toggle {
    display: flex;
    align-items: center;
    gap: var(--rl-space-2);
    min-height: 36px;
    margin-bottom: var(--rl-space-2);
    padding: 0 var(--rl-space-2);
    border: 1px solid var(--rl-border);
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-surface);
    color: var(--rl-text-primary);
    font-weight: 600;
    cursor: pointer;
}

.sidebar-collapse-toggle .nav-icon {
    font-weight: 700;
}

.sidebar-collapse-toggle:hover {
    border-color: var(--rl-border-strong);
    background: var(--rl-bg-hover);
}

/* Manually collapsed sidebar (icon-only), toggled independently of viewport width. Reuses the
   same visual treatment as the width-driven auto-collapse in the media query below. */
.app-body.sidebar-collapsed {
    grid-template-columns: 56px 0 minmax(0, 1fr);
}

.app-body.sidebar-collapsed .sidebar-resize-handle {
    display: none;
}

.app-body.sidebar-collapsed .sidebar-group,
.app-body.sidebar-collapsed .nav-label,
.app-body.sidebar-collapsed .sidebar-footer-card,
.app-body.sidebar-collapsed .nav-badge,
.app-body.sidebar-collapsed .nav-hint {
    display: none;
}

.app-body.sidebar-collapsed .sidebar-navigation {
    padding-inline: var(--rl-space-1);
}

.app-body.sidebar-collapsed .sidebar-collapse-toggle {
    justify-content: center;
}

.app-body.sidebar-collapsed .sidebar-navigation a,
.app-body.sidebar-collapsed .sidebar-link {
    justify-content: center;
    padding: 0;
}

.sidebar-footer-card {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin: var(--rl-space-3) var(--rl-space-2);
    padding: var(--rl-space-2) var(--rl-space-3);
    border: 1px solid var(--rl-border-subtle);
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-surface);
}

.sidebar-footer-eyebrow {
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-caption);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sidebar-footer-name {
    color: var(--rl-text-primary);
    font-size: 12.5px;
}

.sidebar-footer-meta {
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
}

.workspace {
    /* See .navigation-sidebar: the workspace stays in the third column even when the drag handle
       is removed from the grid. */
    grid-column: 3;
    width: auto;
    min-width: 0;
    margin: 0;
    padding: var(--rl-space-4);
    overflow: auto;
    /* Reserves the scrollbar's width even while the page is short enough not to need one.
       Without it, opening a panel that makes the page scroll shifts the whole workspace left by
       the scrollbar width — which is what moved the button out from under the pointer the first
       time the participant editor was opened. */
    scrollbar-gutter: stable;
    background: var(--rl-bg-app);
}

.status-bar {
    z-index: 20;
    display: flex;
    align-items: center;
    gap: var(--rl-space-2);
    min-width: 0;
    padding: 0 var(--rl-space-3);
    border-top: 1px solid var(--rl-border-strong);
    background: var(--rl-bg-surface);
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
}

.status-bar strong {
    color: var(--rl-success);
}

.status-release-candidate {
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--rl-danger);
}

/* Upload of a chosen file in a hosted Director; created by the host's script while it runs. */
.upload-progress {
    position: fixed;
    right: 16px;
    bottom: 44px;
    z-index: 60;
    display: grid;
    gap: 6px;
    min-width: 260px;
    max-width: 420px;
    padding: 10px 12px;
    border: 1px solid var(--rl-border-strong);
    border-radius: var(--rl-radius-md);
    background: var(--rl-bg-surface);
    box-shadow: var(--rl-shadow-popover);
    color: var(--rl-text-primary);
    overflow-wrap: anywhere;
}

.upload-progress progress {
    width: 100%;
}

.status-attention,
.status-attention strong {
    color: var(--rl-danger);
}

.status-spacer {
    flex: 1;
}

.status-divider {
    width: 1px;
    height: 16px;
    background: var(--rl-border);
}

.status-language {
    height: 22px;
    padding: 0 4px;
    border: 1px solid var(--rl-border);
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-surface);
    color: var(--rl-text-primary);
    font-size: var(--rl-font-small);
}

.status-restart-hint {
    color: var(--rl-warning);
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 5px;
    color: var(--rl-text-primary);
    font-family: var(--rl-font-family-heading);
    font-size: 26px;
    font-weight: 600;
    line-height: 1.2;
}

h2 {
    margin-bottom: 5px;
    color: var(--rl-text-primary);
    font-family: var(--rl-font-family-heading);
    /* CS-20: panel headings are 14–16 px by the guideline; 18 px competed with the page title. */
    font-size: 16px;
    font-weight: 600;
    line-height: 1.25;
}

h3 {
    margin-bottom: 4px;
    color: var(--rl-text-primary);
    font-family: var(--rl-font-family-heading);
    font-size: 15px;
    font-weight: 600;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-caption);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.lead {
    max-width: 80ch;
    margin-bottom: 0;
    color: var(--rl-text-secondary);
    font-size: 13px;
    line-height: 1.45;
}

.hero,
.page-heading,
.workspace-heading,
/* CS-19: the header was ~107 px high (14/16 px padding, 26 px title, 7 px under the crumbs) and
   pushed the table below the fold at 768 px. It keeps its primary edge (it marks where the page
   starts) and loses about 20 px. */
.record-header {
    margin-bottom: var(--rl-space-3);
    padding: var(--rl-space-2) var(--rl-space-4) var(--rl-space-3);
    border: 1px solid var(--rl-border-strong);
    border-top: 3px solid var(--rl-primary);
    background: var(--rl-bg-surface);
}

.record-header h1 {
    margin-bottom: 2px;
    font-size: 24px;
}

.record-header .breadcrumbs {
    margin-bottom: var(--rl-space-1);
}

.hero {
    max-width: none;
}

.hero h1 {
    font-size: 25px;
}

.hero-actions,
.page-heading,
.workspace-heading,
.record-header,
.record-header-actions,
.page-heading-actions,
.form-actions,
.work-actions,
.section-heading,
.panel-heading,
.provider-summary,
.heading-status,
.status-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-heading,
.workspace-heading,
.record-header {
    justify-content: space-between;
}

.page-heading-narrow {
    max-width: none;
}

.hero-actions {
    margin-top: 12px;
}

.back-link,
.breadcrumbs a,
.button-link {
    color: var(--rl-primary);
    text-decoration: none;
}

.back-link {
    display: inline-block;
    margin-bottom: 7px;
    font-size: 12px;
}

.back-link:hover,
.breadcrumbs a:hover,
.button-link:hover {
    text-decoration: underline;
}

.heading-status {
    margin-bottom: 5px;
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
}

.workspace-grid,
.workspace-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(290px, 0.75fr);
    gap: 12px;
    align-items: start;
}

.workspace-primary {
    display: flex;
    flex-direction: column;
    gap: var(--rl-space-3);
    min-width: 0;
}

.workspace-layout.tournament-workspace {
    grid-template-columns: minmax(0, 1fr);
}

.workspace-layout.master-data-view {
    grid-template-columns: minmax(0, 1fr);
    max-width: 1100px;
}

.workspace-layout.master-data-view .details-panel {
    min-width: 0;
}

.round-schedule-indicator {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--rl-space-3);
    margin-bottom: var(--rl-space-3);
    color: var(--rl-text-secondary);
}

.settings-navigation-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--rl-space-4);
    padding: var(--rl-space-4);
    color: var(--rl-text-primary);
    text-decoration: none;
}

.settings-navigation-card strong,
.settings-navigation-card small {
    display: block;
}

.settings-navigation-card small {
    margin-top: var(--rl-space-1);
    color: var(--rl-text-secondary);
}

.settings-navigation-card:hover,
.settings-navigation-card:focus-visible {
    border-color: var(--rl-primary);
    background: var(--rl-bg-hover);
}

.settings-advanced,
.settings-organization-choices {
    margin-top: var(--rl-space-4);
    border-top: 1px solid var(--rl-border);
    padding-top: var(--rl-space-4);
}

.settings-advanced > summary {
    cursor: pointer;
    font-weight: 600;
}

.settings-advanced > .form-grid {
    margin-top: var(--rl-space-3);
}

.cloud-add-panel {
    margin-bottom: var(--rl-space-4);
}

.cloud-add-form {
    display: flex;
    align-items: end;
    gap: var(--rl-space-3);
    border-top: 1px solid var(--rl-border);
    padding: var(--rl-space-4) 0;
}

.cloud-add-form > .field {
    flex: 1;
    min-width: 0;
}

@media (max-width: 760px) {
    .cloud-add-form {
        align-items: stretch;
        flex-direction: column;
    }
}

.panel,
.work-panel {
    border: 1px solid var(--rl-border-strong);
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-surface);
}

/* Every bordered panel keeps its content off the border. A bare .panel had no padding, so the
   FIDE mode, rating list, help, Chess960 and pairing panels sat flush against their frame next
   to padded neighbours. */
.panel,
.panel-primary,
.form-panel,
.section-panel,
.empty-workspace,
.work-panel {
    padding: 14px;
}

.panel-heading,
.provider-summary,
.section-heading,
.work-panel-title {
    justify-content: space-between;
}

.panel-heading,
.section-heading,
.work-panel-title {
    margin-bottom: 12px;
}

/* Title on the left, action on the right: their first text lines share one baseline (the title
   used to sit 6 px above the middle of a 32 px button); a description under the title stays below. */
.work-panel-title {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.work-panel-title p,
.record-header p {
    margin-bottom: 0;
    color: var(--rl-text-secondary);
    font-size: 12px;
}

.directory-source-actions {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

@media (max-width: 720px) {
    .work-panel-title {
        flex-wrap: wrap;
    }

    .directory-source-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

/* Aktualisieren pro Datenquelle in den Einstellungen: eine Zeile je Verband, damit auf einen
   Blick erkennbar bleibt, welcher Stand zu welcher Quelle gehört. */
.settings-subheading {
    margin: 16px 0 2px;
    font-size: 12px;
    font-weight: 600;
}

.directory-update-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.directory-update-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    border: 1px solid var(--rl-border-strong);
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-surface);
}

.directory-update-row > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.directory-update-actions {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

@media (max-width: 720px) {
    .directory-update-row {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .directory-update-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

.provider-list {
    display: grid;
    gap: 8px;
}

.provider-card {
    padding: 12px;
    border: 1px solid var(--rl-border-strong);
    background: var(--rl-bg-hover);
}

.provider-summary p,
.provider-note {
    margin-bottom: 0;
    color: var(--rl-text-secondary);
    font-size: 12px;
}

.provider-note {
    padding-top: 9px;
    border-top: 1px solid var(--rl-border-subtle);
}

/* The last-error line under a failed publication. It carried a class no stylesheet defined, so
   the reason a revision failed read as ordinary small print. */
.publish-error {
    display: block;
    margin-top: 2px;
    color: var(--rl-danger);
    font-size: var(--rl-font-caption);
}

.facts {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 10px 0;
}

.facts dt,
.tournament-meta dt {
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-caption);
    font-weight: 700;
    text-transform: uppercase;
}

.facts dd,
.tournament-meta dd {
    margin: 2px 0 0;
    color: var(--rl-text-primary);
    font-size: 12px;
    font-weight: 600;
}

.facts .hash {
    overflow: hidden;
    font-family: Consolas, monospace;
    text-overflow: ellipsis;
}

.roadmap-panel {
    background: var(--rl-bg-hover);
}

.check-list {
    display: grid;
    gap: 7px;
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
}

.check-list li::before {
    content: "✓";
    margin-right: 7px;
    color: var(--rl-success);
    font-weight: 700;
}

.button-primary,
.button-secondary,
.button-danger,
.button-quiet,
.icon-button,
.button-link {
    min-height: var(--rl-control-height);
    padding: var(--rl-space-1) var(--rl-space-3);
    border-radius: var(--rl-radius-sm);
    cursor: pointer;
    font-size: var(--rl-font-ui);
    font-weight: 600;
}

.button-primary {
    border: 1px solid var(--rl-primary);
    background: var(--rl-primary);
    color: var(--rl-primary-contrast);
    text-decoration: none;
}

.button-primary:hover:not(:disabled) {
    background: var(--rl-primary-hover);
}

.button-secondary {
    border: 1px solid var(--rl-border-strong);
    background: var(--rl-bg-surface);
    color: var(--rl-text-primary);
    text-decoration: none;
}

.button-secondary:hover:not(:disabled) {
    background: var(--rl-bg-hover);
}

.button-link {
    border: 0;
    background: transparent;
    font-weight: 500;
}

.button-danger {
    border: 1px solid var(--rl-danger);
    background: var(--rl-bg-surface);
    color: var(--rl-danger);
    text-decoration: none;
}

.button-danger:hover:not(:disabled) {
    background: var(--rl-danger-bg);
}

.button-quiet {
    border: 1px solid transparent;
    background: transparent;
    color: var(--rl-primary);
    text-decoration: none;
}

.button-quiet:hover:not(:disabled) {
    border-color: var(--rl-border);
    background: var(--rl-bg-hover);
}

.button-compact {
    min-height: var(--rl-control-height-compact);
    padding: 4px 9px;
}

/* A page-content dropdown (Reports.razor's export menu) — same disclosure pattern as the main
   menu bar's .menu-item, but the summary has to look like the .button-secondary it replaces
   rather than a flat navbar link, and the popup opens below a normal-height button instead of
   a full-height nav bar. */
.export-menu {
    position: relative;
}

.export-menu > summary {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    list-style: none;
}

.export-menu > summary::-webkit-details-marker {
    display: none;
}

.export-menu > summary::after {
    content: "▾";
    font-size: var(--rl-font-caption);
}

.export-menu-popup {
    right: 0;
    left: auto;
    min-width: 180px;
}

.export-menu-popup button {
    display: flex;
    width: 100%;
    align-items: center;
    min-height: 28px;
    padding: var(--rl-space-1) var(--rl-space-2);
    border: 0;
    border-radius: var(--rl-radius-sm);
    background: transparent;
    color: var(--rl-text-primary);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.export-menu-popup button:hover:not(:disabled) {
    background: var(--rl-bg-selection);
}

.export-menu-popup button:disabled {
    color: var(--rl-text-disabled);
    cursor: default;
    opacity: 0.55;
}

/* Inline busy indicator for a button mid-action (FIDE download, round transitions, backups —
   anything that used to just leave the button text changed with no other sign of life). */
.spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 6px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    vertical-align: -2px;
    animation: rl-spin 0.6s linear infinite;
}

@keyframes rl-spin {
    to {
        transform: rotate(360deg);
    }
}

/* CS-10: disabled is not the same as busy. A button that waits for a condition shows "not
   allowed"; only a control that marks itself aria-busy (an action in flight) shows progress. */
.button-primary:disabled,
.button-secondary:disabled,
.button-danger:disabled,
.button-quiet:disabled,
.icon-button:disabled,
.button-link:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

:is(.button-primary, .button-secondary, .button-danger, .button-quiet, .icon-button, .button-link, button, a, input, label)[aria-busy="true"],
[aria-busy="true"] :is(.button-primary, .button-secondary, .button-danger, .button-quiet, .icon-button, .button-link, button, a, input, label) {
    cursor: progress;
}

.icon-button {
    min-width: 30px;
    border: 1px solid var(--rl-border-strong);
    background: var(--rl-bg-hover);
    color: var(--rl-text-secondary);
    font-size: 18px;
}

.empty-workspace,
.table-empty {
    display: grid;
    min-height: 160px;
    place-content: center;
    gap: 6px;
    color: var(--rl-text-secondary);
    text-align: center;
}

.empty-icon {
    font-size: 30px;
}

.tournament-list {
    display: grid;
    gap: 7px;
}

.tournament-group + .tournament-group {
    margin-top: 18px;
}

.tournament-group-heading {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 6px;
}

.tournament-group-heading h2 {
    margin: 0;
    font-size: 13px;
}

.tournament-group-heading p {
    margin: 0;
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
}

/* The card itself stays an anchor, so the actions live beside it rather than inside. */
.tournament-entry {
    display: grid;
    gap: 0;
}

.tournament-entry-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 6px 13px;
    border: 1px solid var(--rl-border-strong);
    border-top: 0;
    border-left: 4px solid var(--rl-primary);
    background: var(--rl-bg-surface);
}

.tournament-entry-confirm {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 8px 13px;
    border: 1px solid var(--rl-warning);
    border-top: 0;
    border-left: 4px solid var(--rl-warning);
    background: var(--rl-warning-bg);
    color: var(--rl-warning);
    font-size: var(--rl-font-small);
}

.tournament-entry-confirm p {
    margin: 0 auto 0 0;
    max-width: 60ch;
}

.tournament-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 18px;
    padding: 11px 13px;
    border: 1px solid var(--rl-border-strong);
    border-left: 4px solid var(--rl-primary);
    background: var(--rl-bg-surface);
    color: inherit;
    text-decoration: none;
}

.tournament-card:hover {
    border-color: var(--rl-primary);
    background: var(--rl-bg-hover);
}

.tournament-card h2 {
    margin-top: 4px;
    font-size: 16px;
}

.tournament-card p {
    margin: 3px 0 0;
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
}

.tournament-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(90px, 1fr));
    gap: 16px;
    margin: 0;
}

.card-action {
    color: var(--rl-primary);
    font-size: var(--rl-font-small);
    font-weight: 700;
}

.status-pill,
.unsaved-badge,
.status-cell,
.import-badge,
.import-summary span {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 2px 6px;
    border-radius: var(--rl-radius-sm);
    font-size: var(--rl-font-caption);
    font-weight: 700;
    white-space: nowrap;
}

.status-ready,
.status-active,
.summary-new {
    background: var(--rl-success-bg);
    color: var(--rl-success);
}

.status-error,
.status-withdrawn,
.status-expelled,
.summary-invalid {
    background: var(--rl-danger-bg);
    color: var(--rl-danger);
}

.status-neutral {
    background: var(--rl-bg-hover);
    color: var(--rl-text-secondary);
}

.unsaved-badge,
.summary-duplicate {
    background: var(--rl-warning-bg);
    color: var(--rl-warning);
}

.summary-changed {
    background: var(--rl-info-bg);
    color: var(--rl-info);
}

/* Federation workspace: bounded lists and a separate editing column, shared desktop tokens. */
.federation-navigation {
    display: flex;
    flex-wrap: wrap;
    gap: var(--rl-space-1);
    border-bottom: 1px solid var(--rl-border);
    margin-bottom: var(--rl-space-4);
}
.federation-navigation a, .federation-nav-disabled {
    padding: var(--rl-space-2) var(--rl-space-3);
    border-bottom: var(--rl-space-1) solid transparent;
    text-decoration: none;
    font-weight: 600;
    color: var(--rl-text-secondary);
}
.federation-navigation a:hover { background: var(--rl-bg-hover); }
.federation-navigation a[aria-current="page"] {
    color: var(--rl-primary);
    border-color: var(--rl-primary);
    background: var(--rl-primary-soft);
}
.federation-nav-disabled { color: var(--rl-text-disabled); }
.federation-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: var(--rl-space-3);
    margin-bottom: var(--rl-space-3);
}
.federation-toolbar > .field { flex: 1; min-width: 12rem; }
.federation-toolbar h2 { margin: 0; flex: 1; }
.federation-toolbar button[aria-pressed="true"] {
    color: var(--rl-primary);
    border-color: var(--rl-primary);
    background: var(--rl-primary-soft);
}
.federation-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: var(--rl-space-4);
}
.federation-split:has(> .federation-editor) { grid-template-columns: minmax(0, 1fr) 20rem; }
.federation-split > * { min-width: 0; }
.federation-editor {
    padding: var(--rl-space-4);
    border: 1px solid var(--rl-border);
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-toolbar);
}
.federation-editor .form-grid { grid-template-columns: minmax(0, 1fr); gap: var(--rl-space-3); }
.federation-workspace .form-grid { gap: var(--rl-space-3); }
.federation-workspace .checkbox-field { grid-column: 1 / -1; }
.federation-workspace fieldset legend { margin-bottom: var(--rl-space-3); font-weight: 600; }
.federation-workspace .data-table tr[data-selected="true"] { background: var(--rl-bg-selection); }
.federation-workspace .data-table th { white-space: nowrap; }
.federation-workspace .data-table td { overflow-wrap: anywhere; }
.federation-workspace .data-table { margin-bottom: var(--rl-space-3); }
.federation-workspace .form-actions { gap: var(--rl-space-2); }
.federation-empty { padding: var(--rl-space-6); color: var(--rl-text-secondary); border: 1px dashed var(--rl-border-strong); }
.federation-rules { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--rl-space-4); }
.federation-rules section { padding: 14px; border: 1px solid var(--rl-border-subtle); border-radius: var(--rl-radius-sm); }
.federation-rules h3 { margin-top: 0; }
.federation-rules dl { display: grid; gap: var(--rl-space-2); margin: 0; }
.federation-rules dt { color: var(--rl-text-secondary); }
.federation-rules dd { margin: 0 0 var(--rl-space-2); font-weight: 600; }
@media (max-width: 1150px) {
    .federation-split:has(> .federation-editor), .federation-rules { grid-template-columns: minmax(0, 1fr); }
}

.form-grid,
.participant-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--rl-space-3);
}

.cloud-sync-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    gap: 0.75rem;
    margin: 1rem 0 0;
}

.cloud-sync-summary > div {
    padding: 0.75rem;
    border: 1px solid var(--rl-border-subtle);
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-hover);
}

.cloud-sync-summary dt {
    color: var(--rl-text-secondary);
    font-size: 0.78rem;
}

.cloud-sync-summary dd {
    margin: 0.25rem 0 0;
    font-weight: 700;
}

.status-cloud-link {
    color: inherit;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
}

.form-grid-single {
    grid-template-columns: 1fr;
}

.field-wide {
    grid-column: 1 / -1;
}

.field-small {
    max-width: 160px;
}

.field {
    display: grid;
    gap: 3px;
    /* A sibling with helper text makes the shared form-grid row taller. Keep this field's
       caption and control at the top instead of stretching its internal rows to that height. */
    align-content: start;
}

/* The caption above a field. Six containers used to spell this out for themselves and had drifted
   apart — 10 px capitals here, 12 px capitals in the pairing command bar, 12 px sentence case in
   the standings and report pickers — so the same kind of label looked like three different things
   depending on which page it was on. */
.field label,
.search-box label,
.toolbar-field label,
.pairing-command-fields label,
.pairing-board-toolbar label,
.pairing-action-area label,
.standings-command-controls label,
.report-round-picker label,
.report-control-fields label,
label:where(:has(> input:not([type="checkbox"]):not([type="radio"]):not([type="file"]))),
label:where(:has(> select)),
label:where(:has(> textarea)) {
    /* WP-30.04: sentence case at 12 px instead of 10 px capitals — testers read these captions
       as shouting and too small at the same time. */
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-caption);
    font-weight: 600;
    text-transform: none;
}

/* Box, focus ring and the native rendering of checkbox/radio come from the shared control base
   at the top of this file; a labelled field only adds the full column width. */
.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.field textarea,
.search-box input,
.toolbar-field select {
    width: 100%;
}

/* A checkbox label carries the readable text itself, so it must not inherit the small uppercase
   caption treatment .field gives to the label above an input — which is how the check boxes on
   the cloud and prize pages ended up shouting in 10 px capitals. */
.field label.checkbox-field,
.field label.checkbox-label {
    color: var(--rl-text-primary);
    font-size: var(--rl-font-ui);
    font-weight: 400;
    text-transform: none;
}

/* Many pages predate .field and write the caption and the control into one <label> instead. Those
   labels used to render as running text with a control dropped in the middle of the line — the
   caption in body type, the field sitting wherever it happened to land. They now get the same
   caption-over-control shape as .field, so a page mixing both spellings looks like one form.
   Checkbox and radio labels are excluded: their text belongs beside the box, not above it. */
label:where(:has(> input:not([type="checkbox"]):not([type="radio"]):not([type="file"]))),
label:where(:has(> select)),
label:where(:has(> textarea)) {
    display: grid;
    gap: 3px;
    align-content: start;
}

.field small,
.save-hint,
.action-note,
.muted {
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-caption);
}

.action-note:has(> button, > a.button-secondary, > a.button-primary) {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--rl-space-2) var(--rl-space-3);
}

/* Dialogs keep their buttons at the lower right, "later" or "cancel" before the confirming one. */
.first-run-dialog .form-actions {
    justify-content: flex-end;
}

/* Action rows in the workspace are left-aligned with the primary action first, like
   .round-actions: the button for the next step keeps its place whatever stands beside it.
   A hint or a save status follows the buttons. Only the page header (title left, actions right),
   row actions at the end of a table row and dialogs differ. */
.form-actions,
.work-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
    margin-top: 12px;
}

.notice,
.work-message {
    margin-bottom: 10px;
    padding: 10px 12px;
    border: 1px solid var(--rl-border-strong);
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-surface);
}

.notice-error,
.work-message-error {
    border-color: var(--rl-danger-border);
    background: var(--rl-danger-bg);
    color: var(--rl-danger);
}

/* Success counterpart to .notice-error/.notice-warning. The plain .notice already carries the
   success colouring, so this only names what the bracket page was relying on implicitly. */
.notice-success {
    border-color: var(--rl-success-border);
    background: var(--rl-success-bg);
    color: var(--rl-success);
}

.notice-warning {
    border-color: var(--rl-border-strong);
    border-left: 3px solid var(--rl-warning);
    background: var(--rl-bg-surface);
    color: var(--rl-text-primary);
}

.notice-warning .notice-actions {
    margin-top: 8px;
}

.notice h1,
.notice h2 {
    font-size: 16px;
}

.form-notice {
    margin-top: 10px;
    font-size: var(--rl-font-small);
}

.form-notice ul {
    margin: 5px 0 0;
    padding-left: 17px;
}

/* A line under the bold outcome of a notice (a reason, the heading of quoted messages). */
.notice-detail {
    margin: 4px 0 0;
}

.inline-empty,
.duplicate-warning {
    padding: 9px;
    border: 1px dashed var(--rl-border-strong);
    background: var(--rl-bg-hover);
    font-size: var(--rl-font-small);
}

.duplicate-warning {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    border-color: var(--rl-warning-border);
    background: var(--rl-warning-bg);
    color: var(--rl-warning);
}

.section-heading-actions {
    display: flex;
    align-items: center;
    gap: var(--rl-space-2);
}

.section-count-badge {
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
    white-space: nowrap;
}

.section-list {
    display: grid;
    gap: var(--rl-space-3);
}

.section-card {
    border: 1px solid var(--rl-border-strong);
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-surface);
}

.section-card.selected {
    border-color: var(--rl-primary);
}

.section-card-header {
    display: flex;
    align-items: center;
    gap: var(--rl-space-3);
    padding: var(--rl-space-2) var(--rl-space-3);
    border-bottom: 1px solid var(--rl-border-subtle);
}

.section-badge {
    display: inline-grid;
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    place-items: center;
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-hover);
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
    font-weight: 700;
}

.section-card-title {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
}

.section-card-title strong,
.section-card-title small {
    display: block;
}

.section-card-title small {
    margin-top: 1px;
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
}

.section-edit-button {
    flex: 0 0 auto;
}

.section-link-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    background: var(--rl-border-subtle);
}

.section-link {
    display: flex;
    align-items: center;
    gap: var(--rl-space-2);
    padding: var(--rl-space-2) var(--rl-space-3);
    background: var(--rl-bg-surface);
    color: var(--rl-text-primary);
    font-size: 12.5px;
    text-decoration: none;
}

.section-link:hover {
    background: var(--rl-bg-hover);
    text-decoration: none;
}

.section-form-divider {
    height: 1px;
    margin: 14px 0;
    background: var(--rl-border-subtle);
}

.checkbox-card {
    padding: var(--rl-space-2) var(--rl-space-3);
    border: 1px solid var(--rl-border);
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-sidebar);
}

.loading,
.empty-state {
    margin: 0;
    padding: 20px;
    border: 1px dashed var(--rl-border-strong);
    color: var(--rl-text-secondary);
    text-align: center;
}

.record-header {
    align-items: flex-end;
}

.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 7px;
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
}

.workspace-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 10px;
    border: 1px solid var(--rl-border-strong);
    border-bottom: 2px solid var(--rl-primary);
    background: var(--rl-bg-hover);
}

.workspace-tabs a,
.workspace-tabs span {
    padding: 7px 13px;
    border-right: 1px solid var(--rl-border-strong);
    color: var(--rl-primary);
    font-size: var(--rl-font-control);
    font-weight: 600;
    text-decoration: none;
}

/* CS-8: hovering a tab looked exactly like the open tab. Hover is now a light tint; only the
   open tab is filled. */
.workspace-tabs a:hover:not(.active) {
    background: var(--rl-bg-surface);
    color: var(--rl-primary-hover);
}

.workspace-tabs a.active {
    background: var(--rl-primary);
    color: var(--rl-primary-contrast);
}

.workspace-tabs .disabled {
    color: var(--rl-text-secondary);
}

.editor-panel,
.import-panel,
.fide-directory-panel,
.status-panel {
    margin-bottom: 10px;
    border-top: 3px solid var(--rl-primary);
}

.participant-form-grid {
    /* Fields wrap onto a second row instead of forcing ~1200 px (1366 px wide screens at 125 % DPI
       leave about 1130 px for the work area). */
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    align-items: end;
}

.status-panel {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
}

.status-panel p {
    margin-bottom: 0;
    font-size: 12px;
}

.status-controls {
    align-items: flex-end;
}

/* The registration/payment panel opens as a row directly under the participant it belongs to
   (Participants.razor) instead of a fixed panel elsewhere on the page — no horizontal scrolling
   to find it. The cell itself carries no extra table padding; .status-panel supplies its own. */
.inline-panel-row > td {
    padding: 0;
    background: var(--rl-bg-hover);
    /* The cell spans the whole table: it must not inherit .data-table td { white-space: nowrap },
       otherwise explanation text widens the table to several thousand pixels. */
    white-space: normal;
}

.inline-panel-row .status-panel {
    margin-bottom: 0;
    border-radius: 0;
}

.list-panel {
    padding: 0;
    overflow: hidden;
}

/* The list panel is full-bleed for its toolbar and table only. Everything else inside it (the
   hidden-columns hint, the group planner, follow-up actions) keeps the toolbar's 10 px inset
   instead of touching the frame. */
.list-panel > :not(.list-toolbar, .data-table-scroll) {
    margin: var(--rl-space-2) 10px;
}

/* LS-17: work panels stacked on a page (prizes, reports, standings, participants) stood border on
   border. 12 px between them; margins of status and editor panels collapse into it. */
.work-page > .work-panel + .work-panel {
    margin-top: var(--rl-space-3);
}

.list-toolbar {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 9px 10px;
    border-bottom: 1px solid var(--rl-border-strong);
    background: var(--rl-bg-hover);
}

.participant-list-toolbar {
    flex-wrap: wrap;
}

.participant-list-toolbar .search-box {
    flex: 1 1 260px;
    width: auto;
}

.participant-list-toolbar .toolbar-field {
    flex: 1 1 130px;
    width: auto;
}

.participant-list-toolbar .toolbar-spacer {
    min-width: var(--rl-space-2);
}

.search-box,
.toolbar-field {
    display: grid;
    gap: 2px;
}

.search-box {
    width: min(360px, 40vw);
}

.toolbar-field {
    width: 150px;
}

.toolbar-spacer {
    flex: 1;
}

.table-count {
    padding-bottom: 7px;
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
}

.data-table-scroll {
    max-width: 100%;
    overflow: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--rl-bg-surface);
    font-size: var(--rl-font-table);
}

.data-table th,
.data-table td {
    padding: 6px 7px;
    border-right: 1px solid var(--rl-border-subtle);
    border-bottom: 1px solid var(--rl-border-subtle);
    vertical-align: middle;
    text-align: left;
    white-space: nowrap;
}

/* CS-20: no capitals (WP-30.04 removed them from every other caption) and a 32 px header row,
   the lower end of the guideline's 32–36 px. */
.data-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    height: 32px;
    background: var(--rl-bg-toolbar);
    color: var(--rl-text-primary);
    font-size: var(--rl-font-small);
    font-weight: 700;
    text-transform: none;
}

.data-table tbody th[scope="row"] {
    position: static;
    background: inherit;
    font-size: inherit;
    text-transform: none;
}

.data-table th button {
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: inherit;
    font-weight: inherit;
    text-transform: inherit;
}

.data-table th button:hover {
    color: var(--rl-primary);
}

.data-table tbody tr:nth-child(even) {
    background: var(--rl-bg-app);
}

.data-table tbody tr:hover {
    background: var(--rl-bg-hover);
}

.data-table .numeric {
    font-variant-numeric: tabular-nums;
    text-align: right;
}

/* Round-robin schedule: banding follows round boundaries, not raw row index, so a round
   reads as one visual group instead of blending into the next one. */
.schedule-table tbody tr.round-group-a {
    background: var(--rl-bg-surface);
}

.schedule-table tbody tr.round-group-b {
    background: var(--rl-bg-app);
}

.schedule-table tbody tr.round-group-a:hover,
.schedule-table tbody tr.round-group-b:hover {
    background: var(--rl-bg-hover);
}

.schedule-table tbody tr.schedule-round-header td {
    padding-top: 9px;
    padding-bottom: 9px;
    border-top: 2px solid var(--rl-border-subtle);
    background: var(--rl-bg-toolbar);
    color: var(--rl-text-primary);
    font-weight: 700;
    white-space: normal;
}

.schedule-table tbody tr.schedule-round-header .status-cell {
    margin-left: 10px;
    font-weight: 400;
    text-transform: none;
}

.schedule-table .schedule-result {
    font-variant-numeric: tabular-nums;
    text-align: center;
    font-weight: 600;
}

.participant-name {
    min-width: 210px;
    font-weight: 600;
}

.participant-registration-column {
    font-weight: 600;
}

.participant-table .row-actions {
    flex-wrap: wrap;
    max-width: 220px;
    white-space: normal;
}

@media (max-width: 1500px) {
    .participant-table .participant-col-low {
        display: none;
    }
}

@media (max-width: 1180px) {
    .participant-table .participant-col-medium {
        display: none;
    }
}

/* CS-12: name the dropped columns instead of letting them vanish. */
.participant-columns-hint {
    display: none;
    margin: 0 0 var(--rl-space-2);
}

@media (max-width: 1500px) and (min-width: 1181px) {
    .participant-columns-hint-low {
        display: block;
    }
}

@media (max-width: 1180px) {
    .participant-columns-hint-medium {
        display: block;
    }
}

.row-withdrawn {
    color: var(--rl-text-secondary);
}

.row-withdrawn .participant-name {
    text-decoration: line-through;
}

/* Package U7: an expelled player is a withdrawn player with a mark; the status cell says so in words. */
.row-expelled .participant-name {
    font-style: italic;
}

.actions-column {
    width: 1%;
}

.row-actions {
    display: flex;
    gap: 4px;
}

.row-actions button {
    padding: 2px 5px;
    border: 1px solid var(--rl-border-strong);
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-surface);
    color: var(--rl-primary);
    cursor: pointer;
    font-size: var(--rl-font-caption);
}

.row-actions button:hover:not(:disabled) {
    border-color: var(--rl-primary);
    background: var(--rl-primary-soft);
}

.row-actions button:disabled {
    color: var(--rl-text-disabled);
    cursor: not-allowed;
}

.import-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.file-picker {
    display: inline-flex;
    align-items: center;
    min-height: var(--rl-control-height);
    padding: var(--rl-space-1) var(--rl-space-3);
    border: 1px solid var(--rl-primary-strong);
    border-radius: var(--rl-radius-sm);
    background: var(--rl-primary);
    color: var(--rl-primary-contrast);
    cursor: pointer;
    font-size: var(--rl-font-ui);
    font-weight: 600;
}

/* CS-5: the real <input type="file"> is visually hidden inside the label, so the label shows the
   keyboard focus on its behalf. */
.file-picker:focus-within {
    outline: var(--rl-focus-ring);
    outline-offset: 2px;
}

.file-picker:hover {
    background: var(--rl-primary-hover);
}

.file-picker input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.import-controls code {
    flex: 1 1 100%;
    padding: 6px 8px;
    border: 1px solid var(--rl-border-strong);
    background: var(--rl-bg-hover);
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-caption);
    white-space: normal;
}

.import-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0;
}

.import-summary span {
    gap: 4px;
    border: 1px solid rgb(0 0 0 / 8%);
}

.import-preview-table {
    max-height: 330px;
    border: 1px solid var(--rl-border-strong);
}

.compact-table td {
    max-width: 420px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.import-new .import-badge {
    background: var(--rl-success-bg);
    color: var(--rl-success);
}

.import-changed .import-badge {
    background: var(--rl-info-bg);
    color: var(--rl-info);
}

.import-duplicate .import-badge {
    background: var(--rl-warning-bg);
    color: var(--rl-warning);
}

.import-invalid .import-badge {
    background: var(--rl-danger-bg);
    color: var(--rl-danger);
}

.import-unchanged .import-badge {
    background: var(--rl-bg-hover);
    color: var(--rl-text-secondary);
}

.player-directory-badge {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 2px 6px;
    border-radius: var(--rl-radius-sm);
    font-size: var(--rl-font-caption);
    font-weight: 700;
    text-transform: uppercase;
}

.player-directory-badge-existing {
    background: var(--rl-info-bg);
    color: var(--rl-info);
}

.player-directory-badge-new {
    background: var(--rl-success-bg);
    color: var(--rl-success);
}

.directory-legal-note {
    margin-bottom: 10px;
    padding: 8px 10px;
    border: 1px solid var(--rl-warning-border);
    background: var(--rl-warning-bg);
    color: var(--rl-warning);
    font-size: var(--rl-font-small);
}

.directory-import-row,
.directory-search-toolbar {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.directory-import-row {
    margin-bottom: 10px;
}

.directory-status {
    display: grid;
    gap: 1px;
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-caption);
}

.directory-status strong {
    color: var(--rl-text-primary);
    font-size: 12px;
}

.directory-success {
    margin: 8px 0;
    padding: 7px 9px;
    border: 1px solid var(--rl-success-border);
    background: var(--rl-success-bg);
    color: var(--rl-success);
    font-size: var(--rl-font-small);
}

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--rl-font-ui);
    color: var(--rl-text-primary);
    cursor: pointer;
}

/* Same shape as .checkbox-field, for the handful of checkboxes whose label text sits directly
   in the <label> instead of a <span> — this rule was missing entirely, so those checkboxes
   rendered with no layout at all (bare native checkbox, unstyled inline text). */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--rl-font-ui);
    color: var(--rl-text-primary);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    flex: 0 0 auto;
}

.first-run-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--rl-scrim);
    z-index: 50;
}

/* Process-owned FIDE task: visible above setup, without a backdrop or focus grab. */
.fide-background-download {
    position: fixed;
    right: 12px;
    bottom: 36px;
    z-index: 62;
    width: min(360px, calc(100vw - 24px));
    max-height: 32vh;
    overflow: auto;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid var(--rl-border-strong);
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-surface);
    color: var(--rl-text-primary);
    box-shadow: var(--rl-shadow-popover);
}

.fide-background-download-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.fide-background-download p { margin: 6px 0; }
.fide-background-download small { color: var(--rl-text-secondary); }

.first-run-panel {
    max-width: 440px;
    padding: 20px;
    border: 1px solid var(--rl-border-strong);
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-surface);
}

.first-run-panel h2 {
    margin: 0 0 8px;
    font-size: 16px;
}

.first-run-panel p {
    margin: 0 0 16px;
    font-size: 13px;
    color: var(--rl-text-secondary);
}

.first-run-panel .record-header-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.first-run-panel .language-choices {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.first-run-panel .checkbox-field,
.first-run-panel .toolbar-field {
    margin-bottom: 12px;
}

/* First-start cloud sign-in: one row per organization when an account belongs to several. */
.first-run-panel .organization-choices {
    display: grid;
    gap: var(--rl-space-2);
    margin-bottom: var(--rl-space-3);
}

.first-run-panel .organization-choices button {
    text-align: left;
}

/* In-app question before unsaved input is discarded (DiscardConfirmationDialog.razor). Replaces the
   browser's confirm(): it drops in below the toolbar in the same card language as .notice-warning
   instead of a centred system box. */
.discard-confirmation-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: var(--rl-scrim-soft);
    animation: discard-confirmation-fade 120ms ease-out;
}

.discard-confirmation {
    position: fixed;
    top: 88px;
    left: 50%;
    z-index: 61;
    width: 400px;
    max-width: calc(100vw - 2 * var(--rl-space-4));
    padding: var(--rl-space-3) var(--rl-space-4);
    border: 1px solid var(--rl-border-strong);
    border-left: 3px solid var(--rl-warning);
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-surface);
    box-shadow: var(--rl-shadow-popover);
    color: var(--rl-text-primary);
    transform: translateX(-50%);
    animation: discard-confirmation-drop 140ms ease-out;
    /* Long texts (the consequences of a level-4 warning in a long language, a large font) scroll
       inside the dialog instead of pushing the buttons out of the window. */
    max-height: calc(100vh - 88px - var(--rl-space-4));
    overflow-y: auto;
    overflow-wrap: anywhere;
}

/* The dialog takes the focus when a click lands on its text or no button can (so that Escape
   reaches it); it is not a control and shows no focus ring. */
.discard-confirmation:focus {
    outline: none;
}

.discard-confirmation strong {
    display: block;
    margin-bottom: var(--rl-space-1);
    font-size: var(--rl-font-ui);
}

.discard-confirmation p {
    margin: 0 0 var(--rl-space-3);
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
}

.discard-confirmation-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--rl-space-2);
    /* When the text scrolls, the buttons stay at the lower edge of the dialog. */
    position: sticky;
    bottom: 0;
    margin-bottom: calc(-1 * var(--rl-space-3));
    padding: var(--rl-space-2) 0 var(--rl-space-3);
    background: var(--rl-bg-surface);
}

/* Regulation warnings (FIDE warning levels 2 to 5, RegulationWarningDialogService) use the same
   dialog. The level is written out and has its own symbol; the colour of the edge and the badge only
   repeats it: information for level 2, attention for level 3, red for levels 4 and 5. */
.discard-confirmation.regulation-warning {
    width: 460px;
}

.regulation-warning-level-2 {
    border-left-color: var(--rl-info);
}

.regulation-warning-level-3 {
    border-left-color: var(--rl-warning);
}

.regulation-warning-level-4,
.regulation-warning-level-5 {
    border-left-color: var(--rl-danger);
}

.regulation-warning-level {
    display: flex;
    align-items: center;
    gap: var(--rl-space-2);
    margin-bottom: var(--rl-space-2);
    font-size: var(--rl-font-small);
    font-weight: 600;
}

.regulation-warning-symbol {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    border-radius: var(--rl-radius-sm);
    font-size: var(--rl-font-ui);
    line-height: 1;
}

.regulation-warning-level-2 .regulation-warning-level {
    color: var(--rl-info);
}

.regulation-warning-level-2 .regulation-warning-symbol {
    background: var(--rl-info-bg);
}

.regulation-warning-level-3 .regulation-warning-level {
    color: var(--rl-warning);
}

.regulation-warning-level-3 .regulation-warning-symbol {
    background: var(--rl-warning-bg);
}

.regulation-warning-level-4 .regulation-warning-level,
.regulation-warning-level-5 .regulation-warning-level {
    color: var(--rl-danger);
}

.regulation-warning-level-4 .regulation-warning-symbol,
.regulation-warning-level-5 .regulation-warning-symbol {
    background: var(--rl-danger-bg);
}

.regulation-warning-step {
    margin-left: auto;
    color: var(--rl-text-secondary);
    font-weight: 400;
}

.discard-confirmation p.regulation-warning-statement {
    margin-bottom: var(--rl-space-2);
    color: var(--rl-text-primary);
    font-weight: 600;
}

@keyframes discard-confirmation-fade {
    from { opacity: 0; }
}

@keyframes discard-confirmation-drop {
    from { opacity: 0; transform: translate(-50%, -6px); }
}

@media (prefers-reduced-motion: reduce) {
    :root:not([data-motion="full"]) .discard-confirmation-backdrop,
    :root:not([data-motion="full"]) .discard-confirmation {
        animation: none;
    }
}

:root[data-motion="reduced"] .discard-confirmation-backdrop,
:root[data-motion="reduced"] .discard-confirmation {
    animation: none;
}

/* First-start guide (SetupGuide.razor). The blocker keeps the tour read-only. The frame's spread
   shadow is the dimmed scrim with a cut-out around what is being explained — a functional layer,
   not a decorative shadow. Frame and explanation stay hidden until rookLane.guide.place has
   positioned them, so neither shows up in the top-left corner first. */
.setup-guide-blocker {
    position: fixed;
    inset: 0;
    z-index: 50;
}

.setup-guide-highlight {
    position: fixed;
    z-index: 51;
    visibility: hidden;
    border: 2px solid var(--rl-primary);
    border-radius: var(--rl-radius-md);
    box-shadow: 0 0 0 100vmax var(--rl-scrim);
    pointer-events: none;
}

.setup-guide-callout {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 52;
    visibility: hidden;
    width: 340px;
    max-width: calc(100vw - 2 * var(--rl-space-3));
    padding: var(--rl-space-4);
    border: 1px solid var(--rl-border-strong);
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-surface);
    color: var(--rl-text-primary);
}

.setup-guide-highlight.is-placed,
.setup-guide-callout.is-placed {
    visibility: visible;
}

.setup-guide-callout h2 {
    margin: 0 0 var(--rl-space-2);
    font-size: 16px;
}

.setup-guide-callout p {
    margin: 0 0 var(--rl-space-4);
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-ui);
}

.setup-guide-callout .setup-guide-progress {
    margin-bottom: var(--rl-space-1);
    font-size: var(--rl-font-small);
}

.setup-guide-actions {
    display: flex;
    align-items: center;
    gap: var(--rl-space-2);
}

.setup-guide-actions .button-link {
    margin-right: auto;
}

.download-progress {
    margin-bottom: 16px;
}

.download-progress-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--rl-space-3);
    margin-bottom: 6px;
}

.download-progress-stage {
    color: var(--rl-text-primary);
    font-size: var(--rl-font-ui);
    font-weight: 600;
}

.download-progress-detail {
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.download-progress-track {
    display: flex;
    align-items: center;
    gap: var(--rl-space-2);
}

.download-progress-percent {
    flex: 0 0 auto;
    min-width: 3.2em;
    text-align: right;
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
    font-variant-numeric: tabular-nums;
}

.download-progress-bar {
    display: block;
    flex: 1 1 auto;
    width: 100%;
    height: 8px;
    border: 1px solid var(--rl-border);
    border-radius: 999px;
    background: var(--rl-bg-hover);
    appearance: none;
}

.download-progress-bar::-webkit-progress-bar {
    border-radius: 999px;
    background: var(--rl-bg-hover);
}

.download-progress-bar::-webkit-progress-value {
    border-radius: 999px;
    background: var(--rl-primary);
    transition: width 120ms linear;
}

/* Chromium draws no indeterminate animation for a value-less <progress> once the bar itself is
   restyled, so the "still working" motion is drawn here instead — on the element's own
   background, which means the shadow-DOM track has to get out of the way. */
.download-progress-bar:not([value])::-webkit-progress-bar {
    background: transparent;
}

.download-progress-bar:not([value]) {
    overflow: hidden;
    background:
        linear-gradient(90deg, transparent 0%, var(--rl-primary) 45%, var(--rl-primary) 55%, transparent 100%)
        var(--rl-bg-hover);
    background-size: 45% 100%;
    background-repeat: no-repeat;
    animation: rl-progress-sweep 1.4s ease-in-out infinite;
}

@keyframes rl-progress-sweep {
    0% { background-position: -45% 0; }
    100% { background-position: 145% 0; }
}

.download-progress-note {
    margin: 6px 0 0;
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
}

.stale-warning-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    padding: 8px 12px;
    border: 1px solid var(--rl-border-strong);
    border-left: 3px solid var(--rl-warning);
    background: var(--rl-bg-surface);
    color: var(--rl-text-primary);
    font-size: 12px;
}

.directory-search-toolbar {
    padding: 9px 10px;
    border: 1px solid var(--rl-border-strong);
    background: var(--rl-bg-hover);
}

.directory-search-toolbar .search-box {
    flex: 1 1 300px;
}

.directory-search-toolbar .toolbar-field input {
    width: 100%;
}

/* The in-place group editor in the participants table: it should use the column it sits in
   rather than the browser's default text-field width. */
.group-input {
    width: 100%;
    min-width: 90px;
}

.directory-fed-filter {
    width: 100px;
}

.directory-round-field {
    width: 120px;
}

.directory-results {
    max-height: 360px;
    border: 1px solid var(--rl-border-strong);
    border-top: 0;
}

.file-picker.disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.status-warning {
    background: var(--rl-warning-bg);
    color: var(--rl-warning);
}

.round-workspace {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
}

.round-list-panel {
    padding: 10px;
}

.round-list {
    display: grid;
    gap: 4px;
}

.round-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 7px 8px;
    border: 1px solid var(--rl-border-strong);
    border-left: 3px solid var(--rl-primary);
    background: var(--rl-bg-surface);
    color: var(--rl-text-primary);
    cursor: pointer;
    text-align: left;
}

/* CS-8: hover only tints; the selected round keeps the frame and the stronger fill. */
.round-list-item:hover:not(.selected) {
    background: var(--rl-bg-hover);
}

.round-list-item.selected {
    border-color: var(--rl-primary);
    border-left-color: var(--rl-primary);
    background: var(--rl-info-bg);
    box-shadow: inset 0 0 0 1px var(--rl-primary);
}

.round-list-item strong,
.round-list-item small {
    display: block;
}

.round-list-item small {
    margin-top: 2px;
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-caption);
}

.round-list-facts {
    display: grid;
    justify-items: end;
    gap: 2px;
}

/* Block flow rather than a grid: a sticky panel inside a grid track can only stick within its
   own row, which is exactly as tall as the panel - so it would never actually stick. */
.round-main {
    display: block;
    min-width: 0;
    margin: 0;
    padding: 0;
}

.round-main > * + * {
    margin-top: 10px;
}

.round-command-panel,
.board-builder,
.board-overview {
    padding: 10px;
}

.round-command-panel {
    background: var(--rl-bg-surface);
}

.round-title-row,
.round-actions,
.board-builder-grid,
.result-entry {
    display: flex;
    align-items: center;
    gap: 7px;
}

.round-title-row h2,
.round-title-row p {
    margin-bottom: 0;
}

.round-title-row .status-pill {
    margin-left: auto;
}

.round-version,

.round-alert {
    display: grid;
    gap: 3px;
    margin-top: 9px;
    padding: 8px 10px;
    border: 1px solid;
    font-size: var(--rl-font-small);
}

.round-alert ul {
    margin: 2px 0 0;
    padding-left: 18px;
}

.round-alert-warning {
    border-color: var(--rl-warning-border);
    background: var(--rl-warning-bg);
    color: var(--rl-warning);
}

.round-alert-success {
    border-color: var(--rl-success);
    background: var(--rl-success-bg);
    color: var(--rl-success);
}

.round-alert-error {
    border-color: var(--rl-danger-border);
    background: var(--rl-danger-bg);
    color: var(--rl-danger);
}

/* One command bar per round, left-aligned so the primary action keeps the same place whatever
   the round status is - right-aligned buttons moved with every change of their number. */
.round-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
    margin-top: 10px;
}

.round-action-reason {
    width: min(420px, 55vw);
    margin-top: 8px;
}

.board-builder-grid {
    align-items: end;
    flex-wrap: wrap;
}

.board-builder-grid .field {
    flex: 1 1 190px;
}

.round-board-table tbody tr {
    outline: none;
}

.round-board-table tbody tr.focused-board,
.round-board-table tbody tr:focus {
    background: var(--rl-info-bg);
    box-shadow: inset 3px 0 var(--rl-primary);
}

.result-entry {
    gap: 2px;
}

.result-button {
    min-width: 31px;
    padding: 3px 5px;
    border: 1px solid var(--rl-border-strong);
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-surface);
    color: var(--rl-text-primary);
    cursor: pointer;
    font-size: var(--rl-font-caption);
    font-weight: 700;
}

/* CS-8: a hovered result button looked entered. Hover is now an outline and tint; only the
   entered result is filled. */
.result-button:hover:not(.active):not(:disabled) {
    border-color: var(--rl-primary);
    background: var(--rl-primary-soft);
    color: var(--rl-primary-hover);
}

.result-button.active {
    border-color: var(--rl-primary);
    background: var(--rl-primary);
    color: var(--rl-primary-contrast);
}

.result-button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.result-text {
    font-weight: 700;
}

.revision-details {
    max-width: 360px;
    white-space: normal;
}

.revision-details summary {
    color: var(--rl-primary);
    cursor: pointer;
}

.revision-details div {
    margin-top: 3px;
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-caption);
}

/* Standings workspace */
.standings-state {
    align-items: end;
    display: grid;
    gap: var(--rl-space-1);
    justify-items: end;
}

.standings-state small,
.standings-command-note {
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
}

.standings-command-panel {
    align-items: end;
    display: grid;
    gap: var(--rl-space-3);
    grid-template-columns: minmax(190px, 1fr) auto;
}

.standings-command-panel h2 {
    margin-bottom: 0;
}

.standings-command-controls {
    align-items: end;
    display: grid;
    gap: var(--rl-space-2);
    grid-template-columns: minmax(180px, 1fr) auto;
}

.standings-command-controls label {
    grid-column: 1 / -1;
}

.standings-command-controls select {
    min-height: var(--rl-control-height);
}

.standings-command-note {
    grid-column: 1 / -1;
    margin: 0;
}

.standings-table-panel {
    min-width: 0;
}

.standings-table-wrap {
    border: 1px solid var(--rl-border);
    max-height: 600px;
}

.standings-table {
    margin: 0;
}

.standings-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.standings-explanation {
    border-top: 1px solid var(--rl-border);
    margin-top: var(--rl-space-3);
    padding-top: var(--rl-space-2);
}

.standings-explanation summary {
    cursor: pointer;
    font-weight: 700;
    padding: var(--rl-space-2) 0;
}

.standings-facts {
    display: grid;
    gap: var(--rl-space-2);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: var(--rl-space-2) 0 0;
}

.standings-facts div {
    background: var(--rl-bg-hover);
    border: 1px solid var(--rl-border-subtle);
    padding: var(--rl-space-2);
}

.standings-facts dt {
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
    font-weight: 700;
}

.standings-facts dd {
    margin: var(--rl-space-1) 0 0;
}

.standings-facts .hash {
    overflow-wrap: anywhere;
}

/* List and print workspace */
.report-controls {
    align-items: end;
    display: grid;
    gap: var(--rl-space-3);
    grid-template-columns: minmax(190px, 1fr) auto;
    margin-bottom: var(--rl-space-3);
}

.report-controls > .list-kind-group,
.report-controls > .report-control-fields {
    grid-column: 1 / -1;
}

.report-controls h2 {
    margin-bottom: 0;
}

.report-control-fields {
    align-items: end;
    display: flex;
    flex-wrap: wrap;
    gap: var(--rl-space-2) var(--rl-space-3);
}

.report-round-picker {
    display: flex;
    align-items: center;
    gap: var(--rl-space-2);
    margin-bottom: var(--rl-space-3);
}

.report-round-picker select {
    min-height: var(--rl-control-height);
}

.report-action-bar {
    align-items: center;
    align-self: start;
    background: var(--rl-bg-surface);
    border: 1px solid var(--rl-border-strong);
    border-radius: var(--rl-radius-sm);
    display: flex;
    gap: var(--rl-space-2);
    grid-column: 1 / -1;
    justify-content: flex-start;
    padding: var(--rl-space-2);
}

.report-action-summary {
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
    font-weight: 700;
    margin-right: auto;
}

.report-print-button {
    min-width: 104px;
}

.list-kind-group {
    margin-bottom: var(--rl-space-3);
}

.list-kind-group-label {
    margin: 0 0 var(--rl-space-1);
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.list-kind-grid {
    display: grid;
    gap: var(--rl-space-3);
    grid-template-columns: repeat(auto-fit, minmax(236px, 1fr));
}

.list-kind-tile {
    align-items: start;
    display: grid;
    gap: 2px var(--rl-space-2);
    grid-template-columns: 76px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    min-height: 108px;
    padding: var(--rl-space-2);
    border: 1px solid var(--rl-border-strong);
    border-radius: var(--rl-radius-md);
    background: var(--rl-bg-surface);
    color: var(--rl-text-primary);
    text-align: left;
    cursor: pointer;
}

.list-kind-tile:hover:not(:disabled):not(.active) {
    border-color: var(--rl-primary);
    background: var(--rl-bg-hover);
}

.list-kind-tile.active {
    border-color: var(--rl-primary);
    background: var(--rl-primary-soft);
}

.list-kind-tile:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.list-kind-thumb {
    grid-row: 1 / 3;
    height: 92px;
    width: 76px;
    border: 1px solid var(--rl-border-subtle);
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-app);
    object-fit: cover;
    object-position: top;
}

.list-kind-label {
    color: var(--rl-text-primary);
    font-size: var(--rl-font-ui);
    font-weight: 600;
    padding-top: var(--rl-space-1);
}

.list-kind-tile.active .list-kind-label {
    color: var(--rl-primary);
}

.list-kind-description {
    margin-top: 2px;
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
    line-height: 1.3;
}

.report-control-fields select {
    min-height: var(--rl-control-height);
}

.report-preview {
    background: var(--rl-bg-surface);
    border: 1px solid var(--rl-border);
    padding: var(--rl-space-5);
}

.report-preview-header {
    align-items: start;
    border-bottom: 2px solid var(--rl-border-strong);
    display: grid;
    gap: var(--rl-space-4);
    grid-template-columns: minmax(0, 1fr) auto;
    margin-bottom: var(--rl-space-4);
    padding-bottom: var(--rl-space-3);
}

.report-preview-header h2,
.report-preview-header p {
    margin-bottom: 0;
}

.report-preview-facts {
    display: grid;
    gap: var(--rl-space-1);
    grid-template-columns: auto auto;
    margin: 0;
}

.report-preview-facts dt {
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
}

.report-preview-facts dd {
    font-size: var(--rl-font-small);
    font-weight: 700;
    margin: 0;
    text-align: end;
}

.report-notices {
    margin-bottom: var(--rl-space-3);
}

.report-table-wrap {
    border: 1px solid var(--rl-border);
    max-height: 620px;
}

.report-table {
    margin: 0;
}

.report-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.report-cell-emphasized {
    font-weight: 700;
}

.report-pdf-preview-shell {
    padding: var(--rl-space-3);
}

.report-pdf-preview-shell .section-heading {
    margin-bottom: var(--rl-space-3);
}

.report-pdf-preview-shell .section-heading span {
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
}

.report-pdf-preview {
    display: block;
    width: 100%;
    height: min(78vh, 920px);
    min-height: 620px;
    border: 1px solid var(--rl-border);
    background: var(--rl-bg-app);
}

@media (max-width: 1050px) {
    .report-controls,
    .report-preview-header {
        grid-template-columns: 1fr;
    }
}

@media print {
    .main-menu-bar,
    .main-toolbar,
    .round-overview-bar,
    .fide-mode-banner,
    .navigation-sidebar,
    .sidebar-resize-handle,
    .status-bar,
    .breadcrumbs,
    .workspace-tabs,
    .record-header-actions,
    .form-actions,
    .work-actions,
    .round-actions,
    .pairing-actions,
    .report-controls,
    .error-summary {
        display: none !important;
    }

    body,
    .app-shell,
    .app-body,
    .workspace,
    .work-page {
        background: var(--rl-bg-surface);
        display: block;
        height: auto;
        overflow: visible;
        padding: 0;
        width: auto;
    }

    .record-header {
        margin: 0 0 var(--rl-space-3);
    }

    .report-preview {
        border: 0;
        padding: 0;
    }

    .report-table-wrap {
        max-height: none;
        overflow: visible;
    }

    .report-table thead {
        position: static;
    }

    .report-pdf-preview-shell {
        display: none !important;
    }
}

/* U22: the English user manual (Pages/UserManual.razor, Shared/ManualBook.cs). Contents on the left,
   the text at a readable line length on the right; in print every part starts on a new page. */
.manual-layout {
    display: grid;
    grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
    gap: var(--rl-space-6);
    align-items: start;
}

.manual-toc {
    position: sticky;
    top: 0;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
    padding: var(--rl-space-3);
    border: 1px solid var(--rl-border);
    background: var(--rl-bg-surface);
    font-size: var(--rl-font-small);
}

.manual-toc ol {
    margin: 0;
    padding-left: var(--rl-space-5);
}

.manual-toc li {
    margin-block: var(--rl-space-1);
}

.manual-toc a[aria-current] {
    color: var(--rl-primary-strong);
    font-weight: 600;
}

.manual-book {
    min-width: 0;
    max-inline-size: 100ch;
    line-height: 1.55;
}

.manual-heading {
    scroll-margin-top: var(--rl-space-3);
}

.manual-heading:focus {
    outline: none;
}

.manual-heading:focus-visible {
    outline: 2px solid var(--rl-primary);
    outline-offset: 2px;
}

.manual-heading-1 {
    margin-top: 0;
    font-size: 24px;
}

.manual-heading-2 {
    margin-top: var(--rl-space-8);
    padding-top: var(--rl-space-4);
    border-top: 1px solid var(--rl-border);
    font-size: 19px;
}

.manual-heading-3 {
    margin-block: var(--rl-space-5) var(--rl-space-2);
    font-size: 15px;
}

.manual-book p,
.manual-book li {
    margin-block: var(--rl-space-2);
}

.manual-book code {
    padding: 0 3px;
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-hover);
    font-family: "Cascadia Mono", Consolas, monospace;
    font-size: 0.92em;
}

.manual-code {
    padding: var(--rl-space-3);
    overflow-x: auto;
    border: 1px solid var(--rl-border);
    background: var(--rl-bg-hover);
    white-space: pre;
}

.manual-code code {
    padding: 0;
    background: none;
}

.manual-table-wrap {
    overflow-x: auto;
    margin-block: var(--rl-space-3);
}

.manual-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--rl-font-table);
}

.manual-table th,
.manual-table td {
    padding: var(--rl-space-1) var(--rl-space-2);
    border: 1px solid var(--rl-border);
    text-align: start;
    vertical-align: top;
}

.manual-table th {
    background: var(--rl-bg-toolbar);
}

@media (max-width: 1100px) {
    .manual-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .manual-toc {
        position: static;
        max-height: none;
    }
}

@media print {
    .manual-layout {
        display: block;
    }

    .manual-book {
        max-inline-size: none;
    }

    .manual-heading-2 {
        break-before: page;
        border: 0;
    }

    .manual-heading {
        break-after: avoid;
    }

    .manual-table-wrap {
        overflow: visible;
    }

    .manual-table tr {
        break-inside: avoid;
    }

    .manual-code {
        white-space: pre-wrap;
    }
}

kbd {
    padding: 1px 4px;
    border: 1px solid var(--rl-border-strong);
    border-bottom-width: 2px;
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-hover);
    font-size: var(--rl-font-caption);
}

@media (max-width: 1100px) {
    /* Icon-only sidebar at this width, so its width is fixed and the drag handle has nothing
       left to adjust. */
    .app-body {
        grid-template-columns: 56px 0 minmax(0, 1fr);
    }

    .sidebar-resize-handle {
        display: none;
    }

    .menu-brand {
        width: 56px;
    }

    .menu-brand strong,
    .sidebar-group,
    .nav-label,
    .sidebar-footer-card,
    .nav-badge,
    .nav-hint {
        display: none;
    }

    .sidebar-navigation {
        padding-inline: var(--rl-space-1);
    }

    .sidebar-navigation a,
    .sidebar-link {
        justify-content: center;
        padding: 0;
    }

    .round-overview-heading {
        display: none;
    }

    .participant-form-grid {
        grid-template-columns: repeat(4, minmax(100px, 1fr));
    }

    .field-name,
    .field-club {
        grid-column: span 2;
    }
}

@media (max-width: 820px) {
    .workspace-grid,
    .workspace-layout,
    .round-workspace {
        grid-template-columns: 1fr;
    }

    .facts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .record-header,
    .page-heading,
    .workspace-heading,
    .status-panel {
        align-items: flex-start;
        flex-direction: column;
    }

    .workspace-tabs {
        overflow-x: auto;
    }

    .round-list {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .standings-command-panel {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .workspace {
        width: auto;
        padding-top: 8px;
    }

    .participant-form-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .field-name,
    .field-club,
    .field-wide {
        grid-column: auto;
    }

    .list-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .directory-search-toolbar,
    .directory-import-row {
        align-items: stretch;
        flex-direction: column;
    }

    .directory-search-toolbar .search-box,
    .directory-search-toolbar .toolbar-field {
        width: 100%;
    }

    .search-box,
    .toolbar-field {
        width: 100%;
    }

    .table-count {
        padding: 0;
    }

    .tournament-card {
        grid-template-columns: 1fr;
    }

    .tournament-meta {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-actions,
    .work-actions,
    .status-controls,
    .round-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .round-action-reason {
        width: 100%;
    }

    /* Below this width the panel is most of the viewport; sticking it would leave no room for
       the board list it is supposed to sit above. */
    .round-command-panel {
        position: static;
        max-height: none;
    }

    .standings-command-controls,
    .standings-facts {
        grid-template-columns: 1fr;
    }

    .standings-state {
        align-items: start;
        justify-items: start;
    }
}

/* Motion off: the operating system asks for reduced motion and the user did not switch it on in
   the settings (data-motion="full"), or the user switched it off there (data-motion="reduced"). */
@media (prefers-reduced-motion: reduce) {
    :root:not([data-motion="full"]) *,
    :root:not([data-motion="full"]) *::before,
    :root:not([data-motion="full"]) *::after {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}

:root[data-motion="reduced"] *,
:root[data-motion="reduced"] *::before,
:root[data-motion="reduced"] *::after {
    scroll-behavior: auto !important;
    transition: none !important;
}

.info-hint {
    display: inline-block;
    margin-left: 4px;
    color: var(--rl-text-secondary);
    cursor: help;
}

.fide-name-autocomplete {
    position: relative;
}

.fide-name-suggestions {
    position: absolute;
    z-index: 20;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    max-height: 220px;
    margin: 0;
    padding: var(--rl-space-1);
    overflow-y: auto;
    border: 1px solid var(--rl-border);
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-surface);
    box-shadow: var(--rl-shadow-popover);
    list-style: none;
}

.fide-name-suggestions li + li {
    margin-top: 1px;
}

.fide-name-suggestions button {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--rl-space-2);
    width: 100%;
    padding: var(--rl-space-1) var(--rl-space-2);
    border: none;
    border-radius: var(--rl-radius-sm);
    background: transparent;
    color: var(--rl-text-primary);
    cursor: pointer;
    text-align: left;
}

.fide-name-suggestions button:hover {
    background: var(--rl-bg-hover);
}

.fide-name-suggestion-name {
    overflow: hidden;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fide-name-suggestion-meta {
    flex: 0 0 auto;
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
}

/* Hall display (projector): pairing list and standings, one screen-sized page at a time. It
   uses the application's tokens, so it follows the light or dark theme like every other page. */
.kiosk-shell {
    height: 100vh;
    width: 100vw;
    background: var(--rl-bg-app);
    color: var(--rl-text-primary);
    overflow: hidden;
}

.hall {
    /* Header and footer are fixed; the rows (and the column headings) share what is left. */
    --hall-head: clamp(64px, 11vh, 120px);
    --hall-foot: 56px;
    --hall-row: calc((100vh - var(--hall-head) - var(--hall-foot) - 2 * var(--rl-space-4)) / (var(--hall-rows) + 1));
    display: grid;
    grid-template-rows: var(--hall-head) minmax(0, 1fr) var(--hall-foot);
    height: 100%;
    font-family: var(--rl-font-family);
}

.hall > .hall-message {
    grid-row: 1 / -1;
}

.hall-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--rl-space-4);
    height: 100%;
    font-size: clamp(20px, 3.5vh, 40px);
    color: var(--rl-text-secondary);
}

.hall-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--rl-space-8);
    padding: 0 var(--rl-space-8);
    background: var(--rl-bg-surface);
    border-bottom: 1px solid var(--rl-border);
}

.hall-with-fide-warning {
    --hall-head: clamp(120px, 22vh, 200px);
}

.hall-with-fide-warning .hall-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--rl-space-2) var(--rl-space-8);
}

.hall-fide-warning {
    grid-column: 1 / -1;
    min-width: 0;
}

.hall-title,
.hall-view {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.hall-title {
    flex: 1 1 0;
}

.hall-title strong {
    font-family: var(--rl-font-family-heading);
    font-size: clamp(22px, 3.6vh, 44px);
    font-weight: 600;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hall-title span,
.hall-view span {
    font-size: clamp(14px, 2vh, 24px);
    color: var(--rl-text-secondary);
}

.hall-view strong,
.hall-view span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* The clock keeps its place; in a narrow window the list name gives way first. */
.hall-now {
    display: flex;
    align-items: center;
    gap: var(--rl-space-6);
    flex: 0 1 auto;
    min-width: 0;
}

.hall-view {
    align-items: flex-end;
}

.hall-view strong {
    font-family: var(--rl-font-family-heading);
    font-size: clamp(18px, 2.8vh, 34px);
    font-weight: 600;
    color: var(--rl-primary);
}

.hall-clock {
    padding-left: var(--rl-space-6);
    border-left: 1px solid var(--rl-border);
    flex: 0 0 auto;
    font-size: clamp(26px, 5vh, 60px);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.hall-body {
    min-height: 0;
    padding: 0 var(--rl-space-8) var(--rl-space-4);
    /* UM5: the whole list scrolls (hall-display.js glides it down; the audience may scroll too). */
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    outline: none;
}

.hall-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    /* Tied to the row height, capped by the width so long names still fit a narrow window. */
    font-size: min(calc(var(--hall-row) * 0.5), 2.7vw);
    animation: hall-in 0.35s ease-out;
}

.hall-table th {
    height: var(--hall-row);
    padding: 0 0.5em;
    border-bottom: 2px solid var(--rl-border-strong);
    font-size: 0.6em;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-align: left;
    text-transform: uppercase;
    color: var(--rl-text-secondary);
}

.hall-table td {
    height: var(--hall-row);
    padding: 0 0.5em;
    border-bottom: 1px solid var(--rl-border-subtle);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hall-table tbody tr:nth-child(even) {
    background: var(--rl-bg-surface);
}

.hall-table .hall-number {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.hall-table .hall-result {
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.hall-table td.hall-result {
    font-weight: 700;
    color: var(--rl-primary);
}

.hall-table td.is-strong {
    font-weight: 600;
}

.hall-foot {
    display: flex;
    flex-direction: column;
    background: var(--rl-bg-surface);
    border-top: 1px solid var(--rl-border);
}

.hall-progress {
    height: 3px;
    background: var(--rl-border-subtle);
}

.hall-progress span {
    display: block;
    height: 100%;
    background: var(--rl-primary);
    transform-origin: left;
    animation: hall-progress linear forwards;
}

.hall-foot-row {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: space-between;
    gap: var(--rl-space-4);
    padding: 0 var(--rl-space-8);
}

.hall-page {
    flex: 0 0 auto;
    font-size: clamp(13px, 1.8vh, 20px);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    color: var(--rl-text-secondary);
}

.hall-controls {
    display: flex;
    align-items: center;
    gap: var(--rl-space-4);
    min-width: 0;
    font-size: var(--rl-font-ui);
    white-space: nowrap;
}

/* On the projector only the lists are wanted; Esc leaves full screen and brings these back. */
:root:fullscreen .hall-controls {
    visibility: hidden;
}

.hall-segment {
    display: inline-flex;
    border: 1px solid var(--rl-border-strong);
    border-radius: var(--rl-radius-md);
    overflow: hidden;
}

.hall-segment button,
.hall-stepper button {
    height: 30px;
    padding: 0 var(--rl-space-3);
    border: 0;
    background: var(--rl-bg-surface);
    color: var(--rl-text-primary);
    font: inherit;
    cursor: pointer;
}

.hall-segment button + button {
    border-left: 1px solid var(--rl-border-strong);
}

.hall-segment button:hover,
.hall-stepper button:hover:not(:disabled) {
    background: var(--rl-bg-hover);
}

/* CS-16: the same "selected" look as the bracket view switch — primary tint, primary text, a
   primary frame — so a segmented choice reads the same on every page. */
.hall-segment button.is-active {
    background: var(--rl-primary-soft);
    box-shadow: inset 0 0 0 1px var(--rl-primary);
    color: var(--rl-primary);
    font-weight: 600;
}

.hall-segment button:focus-visible,
.hall-stepper button:focus-visible {
    outline: 2px solid var(--rl-primary);
    outline-offset: -2px;
}

.hall-stepper,
.hall-select {
    display: inline-flex;
    align-items: center;
    gap: var(--rl-space-2);
    color: var(--rl-text-secondary);
}

.hall-stepper button {
    width: 30px;
    padding: 0;
    border: 1px solid var(--rl-border-strong);
    border-radius: var(--rl-radius-md);
}

.hall-stepper button:disabled {
    color: var(--rl-text-disabled);
    cursor: default;
}

.hall-stepper output {
    min-width: 2ch;
    text-align: center;
    font-variant-numeric: tabular-nums;
    color: var(--rl-text-primary);
}

.hall-select select {
    height: 30px;
}

@keyframes hall-progress {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

@keyframes hall-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    :root:not([data-motion="full"]) .hall-table,
    :root:not([data-motion="full"]) .hall-progress span {
        animation: none;
    }
}

:root[data-motion="reduced"] .hall-table,
:root[data-motion="reduced"] .hall-progress span {
    animation: none;
}

.report-raw {
    max-height: 320px;
    overflow: auto;
    margin-top: var(--rl-space-2);
    padding: var(--rl-space-3);
    border: 1px solid var(--rl-border);
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-toolbar);
    font-family: "Cascadia Mono", Consolas, "Courier New", monospace;
    font-size: var(--rl-font-small);
    white-space: pre-wrap;
    word-break: break-word;
}

/* WP-19: Auslosungsoptionen, Brettreihenfolge und Turnierstatusbericht. */
.standings-profile-list {
    margin: var(--rl-space-3) 0;
    padding-left: var(--rl-space-5);
    display: flex;
    flex-direction: column;
    gap: var(--rl-space-2);
}

.standings-profile-row {
    padding: var(--rl-space-2) var(--rl-space-3);
    border: 1px solid var(--rl-border-subtle);
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-surface);
}

.standings-profile-row-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--rl-space-3);
}

.standings-profile-row-actions,
.standings-profile-row-params {
    display: flex;
    align-items: center;
    gap: var(--rl-space-2);
    flex-wrap: wrap;
}

.standings-profile-add,
.pairing-option-add {
    display: flex;
    align-items: end;
    gap: var(--rl-space-3);
    flex-wrap: wrap;
    margin-top: var(--rl-space-3);
    padding-top: var(--rl-space-3);
    border-top: 1px solid var(--rl-border-subtle);
}

/* Each label/control pair in one of these rows is wrapped in .field so it stacks (label above
   control) instead of every label and control becoming its own loose flex item next to the
   next field's label — which is what made these rows look like an unsorted pile of controls. */
.standings-profile-add .field,
.pairing-option-add .field {
    flex: 1 1 180px;
    min-width: 160px;
}

.standings-profile-row-params > label {
    min-width: 150px;
}

/* Fields of a tie-break carry their caption above the input; the row lines up on the inputs, and
   a check box ("Eigene Punkte addieren") takes the input height so it sits on the same line
   instead of 10 px above it. */
.standings-profile-row-params:has(> label:not(.checkbox-label) > input) {
    align-items: flex-end;
}

.standings-profile-row-params > .checkbox-label {
    min-height: var(--rl-control-height);
}

.standings-profile-row-head > label {
    flex: 1 1 220px;
}

/* A drop-down that stands alone in one of these rows (the team tie-break list) should take the
   width the row gives it rather than sit at its intrinsic option width next to the remove
   button. */
.standings-profile-row-head > select {
    flex: 1 1 220px;
}

/* The pairing code a station reads out loud. It carried its type in a style attribute, which is
   the one place a token cannot reach — the value now lives here like every other size in the
   app, and reads as a code rather than as a paragraph. */
.pairing-code {
    margin: var(--rl-space-2) 0;
    font-family: "Cascadia Mono", "Consolas", ui-monospace, monospace;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 0.3em;
    color: var(--rl-text-primary);
}

.pairing-option-row {
    padding: var(--rl-space-2) 0;
    border-bottom: 1px solid var(--rl-border-subtle);
}

.pairing-option-row:last-of-type {
    border-bottom: none;
}

.pairing-option-unsupported {
    margin: var(--rl-space-1) 0 0;
    color: var(--rl-warning);
    font-size: var(--rl-font-small);
}

.status-finding-list {
    margin: var(--rl-space-2) 0 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--rl-space-1);
}

.status-finding {
    display: flex;
    gap: var(--rl-space-2);
    padding: var(--rl-space-2) var(--rl-space-3);
    border-left: 3px solid var(--rl-border-strong);
    background: var(--rl-bg-toolbar);
    font-size: var(--rl-font-small);
}

.status-finding-error {
    border-left-color: var(--rl-danger);
    background: var(--rl-danger-bg);
}

.status-finding-warning {
    border-left-color: var(--rl-warning);
    background: var(--rl-warning-bg);
}

.status-finding-info {
    border-left-color: var(--rl-primary);
    background: var(--rl-primary-soft);
}

/* Result entry: one empty field per board, typed and stepped through with the keyboard. */
.result-input {
    width: 5.5ch;
    min-height: 30px;
    padding: 3px 6px;
    border: 1px solid var(--rl-border-strong);
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-surface);
    color: var(--rl-text-primary);
    font: inherit;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
}

/* CS-6: the field drew a near-invisible light ring and switched the outline off. */
.result-input:focus-visible {
    border-color: var(--rl-primary);
    outline: var(--rl-focus-ring);
    outline-offset: 0;
}

.result-input:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.result-key-legend {
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
}

.result-key-legend kbd {
    margin-right: 2px;
}

/* Preisschema charts (WP-22 follow-up): plain CSS bar rows instead of a charting library —
   the amounts involved are a handful of prize ranks and one income/expense pair, not a data
   grid that would justify pulling in a dependency. */
.chart-bars {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 8px 0 12px;
}

.chart-bar-row {
    display: grid;
    grid-template-columns: 8ch 1fr 10ch;
    align-items: center;
    gap: 10px;
    font-size: var(--rl-font-small);
}

.chart-bar-label {
    color: var(--rl-text-secondary);
}

.chart-bar-track {
    display: block;
    height: 14px;
    border-radius: var(--rl-radius-sm);
    background: var(--rl-border-subtle);
    overflow: hidden;
}

.chart-bar-fill {
    display: block;
    height: 100%;
    min-width: 2px;
    border-radius: var(--rl-radius-sm);
    transition: width 0.2s ease;
}

.chart-bar-value {
    color: var(--rl-text-primary);
    font-weight: 600;
    text-align: right;
    white-space: nowrap;
}

/* ------------------------------------------------------------------ ADR 0019: check-in desk */

/*
   Everything here serves one goal: the clerk stands, the player waits, and the outcome of a
   scan has to be readable at arm's length without leaning in.
*/

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.table-scroll {
    max-height: 420px;
    overflow: auto;
}

.table-actions {
    display: flex;
    gap: var(--rl-space-2);
    flex-wrap: wrap;
}

.checkin-scan-panel {
    border-color: var(--rl-border-strong);
}

.checkin-scan-form {
    display: flex;
    gap: var(--rl-space-2);
    align-items: stretch;
    margin: var(--rl-space-3) 0;
}

/* Oversized on purpose: this is the one control the desk touches all evening. */
.checkin-scan-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 48px;
    padding: 0 var(--rl-space-3);
    font-size: 20px;
    letter-spacing: 0.08em;
    color: var(--rl-text-primary);
    background: var(--rl-bg-surface);
    border: 2px solid var(--rl-primary);
    border-radius: var(--rl-radius-md);
}

.checkin-scan-input:focus-visible {
    outline: 2px solid var(--rl-primary);
    outline-offset: 1px;
}

.checkin-scan-form .button-primary {
    min-width: 140px;
    font-size: var(--rl-font-ui);
}

.checkin-result {
    display: flex;
    flex-direction: column;
    gap: var(--rl-space-1);
    padding: var(--rl-space-3) var(--rl-space-4);
    border: 1px solid transparent;
    border-left-width: 6px;
    border-radius: var(--rl-radius-md);
}

.checkin-result-headline {
    font-size: 22px;
    font-weight: 600;
    line-height: 1.2;
}

.checkin-result-name {
    font-size: 18px;
    color: var(--rl-text-primary);
}

.checkin-result-meta {
    font-size: var(--rl-font-small);
    color: var(--rl-text-secondary);
}

/* Colour repeats what the headline already says; it never carries the meaning alone. */
.checkin-result-success {
    background: var(--rl-success-bg);
    border-color: var(--rl-success);
}

.checkin-result-success .checkin-result-headline {
    color: var(--rl-success);
}

.checkin-result-warning {
    background: var(--rl-warning-bg);
    border-color: var(--rl-warning);
}

.checkin-result-warning .checkin-result-headline {
    color: var(--rl-warning);
}

.checkin-result-error {
    background: var(--rl-danger-bg);
    border-color: var(--rl-danger);
}

.checkin-result-error .checkin-result-headline {
    color: var(--rl-danger);
}

.checkin-result-fee {
    display: flex;
    align-items: center;
    gap: var(--rl-space-3);
    margin-top: var(--rl-space-2);
}

.checkin-fee-amount {
    font-size: 18px;
    font-weight: 600;
    color: var(--rl-warning);
}

.checkin-counters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--rl-space-4);
}

.checkin-counter {
    display: flex;
    flex-direction: column;
    gap: var(--rl-space-1);
    min-width: 110px;
    padding: var(--rl-space-3);
    background: var(--rl-bg-toolbar);
    border: 1px solid var(--rl-border-subtle);
    border-radius: var(--rl-radius-md);
}

.checkin-counter-value {
    font-size: 28px;
    font-weight: 600;
    line-height: 1;
    color: var(--rl-text-primary);
    font-variant-numeric: tabular-nums;
}

.checkin-counter-label {
    font-size: var(--rl-font-small);
    color: var(--rl-text-secondary);
}

.checkin-counter-warning {
    border-color: var(--rl-warning);
}

.checkin-counter-warning .checkin-counter-value {
    color: var(--rl-warning);
}

.checkin-exclude-toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--rl-space-2);
    font-size: var(--rl-font-small);
    white-space: nowrap;
}

.checkin-search-bar {
    margin-bottom: var(--rl-space-3);
}

.checkin-search-bar input {
    width: 100%;
    max-width: 420px;
}

.checkin-walkin-form {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: var(--rl-space-3);
}

.checkin-walkin-form .field {
    flex: 1 1 200px;
    min-width: 160px;
}

.checkin-walkin-form .button-primary {
    flex: 0 0 auto;
}

/* ------------------------------------------------------------------ ADR 0019: badge sheet */

.badge-sheet {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--rl-space-3);
}

.badge-card {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
        "text qr"
        "action qr";
    gap: var(--rl-space-2) var(--rl-space-3);
    align-items: start;
    padding: var(--rl-space-3);
    background: var(--rl-bg-surface);
    border: 1px solid var(--rl-border);
    border-radius: var(--rl-radius-md);
    break-inside: avoid;
}

.badge-card-text {
    grid-area: text;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.badge-card .qr-code {
    grid-area: qr;
}

.badge-card .button-compact {
    grid-area: action;
    justify-self: start;
    align-self: end;
}

.badge-card-number {
    font-size: var(--rl-font-small);
    color: var(--rl-text-secondary);
    font-variant-numeric: tabular-nums;
}

.badge-card-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--rl-text-primary);
    overflow-wrap: anywhere;
}

.badge-card-section,
.badge-card-club {
    font-size: var(--rl-font-small);
    color: var(--rl-text-secondary);
    overflow-wrap: anywhere;
}

/* The human-readable form of the code, for when the symbol will not scan. */
.badge-card-code {
    margin-top: var(--rl-space-1);
    font-family: Consolas, "Courier New", monospace;
    font-size: 15px;
    letter-spacing: 0.08em;
    color: var(--rl-text-primary);
}

.qr-code {
    display: block;
    background: #ffffff;
}

.qr-unavailable {
    display: inline-block;
    padding: var(--rl-space-2);
    font-size: var(--rl-font-small);
    color: var(--rl-danger);
}

@media print {
    .no-print {
        display: none !important;
    }

    .badge-sheet {
        grid-template-columns: repeat(2, 1fr);
        gap: 6mm;
    }

    .badge-card {
        border-color: #000000;
    }
}

/* Guided cloud/live setup: three numbered steps whose state is visible at a glance, and the
   collapsed groups that keep connection, administration and conflicts out of the daily path. */
.live-guide {
    list-style: none;
    margin: 0 0 var(--rl-space-3) 0;
    padding: 0;
    display: grid;
    gap: var(--rl-space-2);
}

.live-guide-step {
    display: flex;
    align-items: flex-start;
    gap: var(--rl-space-3);
    padding: var(--rl-space-2) var(--rl-space-3);
    border: 1px solid var(--rl-border-subtle);
    border-radius: var(--rl-radius-sm);
}

.live-guide-step small {
    display: block;
    color: var(--rl-text-secondary);
}

.live-guide-marker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
    border-radius: 50%;
    font-variant-numeric: tabular-nums;
    background: var(--rl-bg-surface);
    border: 1px solid var(--rl-border-strong);
}

.live-guide-done {
    border-color: var(--rl-success);
}

.live-guide-done .live-guide-marker {
    background: var(--rl-success-bg);
    border-color: var(--rl-success);
    color: var(--rl-success);
}

.work-panel-group > summary {
    cursor: pointer;
    padding: var(--rl-space-2) 0;
    font-weight: 600;
}

.work-panel-group[open] > summary {
    margin-bottom: var(--rl-space-2);
}

/* ==========================================================================
   Knockout bracket (Brackets.razor)

   A knockout is a tree, and the page now draws it as one: one column per
   round, every match vertically centred between the two matches that feed it,
   with the connectors drawn in CSS rather than implied by reading order. The
   previous flat list per round asked the arbiter to rebuild that tree in their
   head, and put the result buttons in a right-hand column so far from the
   pairing they belonged to that the two no longer read as one row.

   The geometry is one idea: inside a round every slot is `flex: 1 1 0`, so a
   column of four slots and a column of eight both divide the same height
   evenly. A round-2 slot is therefore exactly twice as tall as a round-1 slot
   and its centre lands exactly between its two feeders - no per-round margin
   arithmetic, and it stays right whether a bracket has three rounds or seven.
   ========================================================================== */

.bracket-summary {
    display: flex;
    flex-wrap: wrap;
    gap: var(--rl-space-2);
    align-items: center;
    margin-bottom: var(--rl-space-3);
}

.bracket-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--rl-space-1);
    padding: 2px var(--rl-space-2);
    border: 1px solid var(--rl-border);
    border-radius: 999px;
    background: var(--rl-bg-surface);
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
    white-space: nowrap;
}

.bracket-chip strong {
    color: var(--rl-text-primary);
    font-variant-numeric: tabular-nums;
}

/* The tree is the one place in the app that may be wider than the window: a
   seven-round bracket is simply wide. It scrolls on its own so the page around
   it - tabs, toolbar, editor - stays put. */
/* Controls above the canvas. The gestures themselves are the fast way around the
   draw, but a gesture nobody is told about is a hidden feature, so the same moves
   have buttons and the hint line names them once. */
.bracket-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--rl-space-2);
    margin-bottom: var(--rl-space-2);
}

.bracket-view-switch {
    display: inline-flex;
    align-items: center;
}

.bracket-view-switch button {
    border-radius: 0;
}

.bracket-view-switch button:first-child {
    border-radius: var(--rl-radius-sm) 0 0 var(--rl-radius-sm);
}

.bracket-view-switch button:last-child {
    margin-left: -1px;
    border-radius: 0 var(--rl-radius-sm) var(--rl-radius-sm) 0;
}

.bracket-view-switch button.is-active {
    position: relative;
    z-index: 1;
    border-color: var(--rl-primary);
    background: var(--rl-primary-soft);
    color: var(--rl-primary);
    font-weight: 600;
}

.bracket-view-switch button:focus-visible {
    position: relative;
    z-index: 2;
}

.bracket-zoom {
    display: flex;
    align-items: center;
    gap: var(--rl-space-1);
}

.bracket-zoom-value {
    min-width: 52px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
}

.bracket-canvas-hint {
    flex: 1 1 240px;
    min-width: 0;
    text-align: right;
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
}

/* The viewport. A seven-round bracket is larger than any window, so this is a fixed
   window onto the drawing rather than a box that grows with it — that is what makes
   "grab it and pull" mean something. The tree inside is moved by transform, which the
   compositor handles without a layout pass, so dragging keeps up with the pointer. */
.bracket-board {
    --rl-bracket-stub: 18px;
    /* Taller than a card on purpose: at the card's own height the round-1 matches
       stack into one unbroken block and the foot of one reads as a third row of
       the next. The surplus is the gap between them. */
    --rl-bracket-slot: 104px;
    --rl-bracket-line: var(--rl-border-strong);
    position: relative;
    height: clamp(320px, 56vh, 720px);
    overflow: hidden;
    border: 1px solid var(--rl-border-subtle);
    border-radius: var(--rl-radius-md);
    background: var(--rl-bg-app);
    cursor: grab;
    /* The wheel zooms and a drag pans, so the browser must not also scroll or start a
       text selection under the same gesture. */
    touch-action: none;
    user-select: none;
}

.bracket-board.is-grabbing {
    cursor: grabbing;
}

.bracket-tree {
    display: flex;
    align-items: stretch;
    width: max-content;
    padding: var(--rl-space-1) var(--rl-space-3) var(--rl-space-3);
    transform-origin: 0 0;
}

.bracket-board.is-grabbing .bracket-tree {
    will-change: transform;
}

.bracket-round {
    display: flex;
    flex-direction: column;
    min-width: 250px;
}

.bracket-round-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--rl-space-2);
    margin: 0 var(--rl-bracket-stub) var(--rl-space-2);
    padding-bottom: var(--rl-space-1);
    border-bottom: 1px solid var(--rl-border-subtle);
    font-size: var(--rl-font-small);
    font-weight: 600;
    color: var(--rl-text-primary);
}

.bracket-round-title small {
    font-weight: 400;
    color: var(--rl-text-secondary);
    font-variant-numeric: tabular-nums;
}

.bracket-slots {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.bracket-slot {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1 1 0;
    min-height: var(--rl-bracket-slot);
    padding: var(--rl-space-1) var(--rl-bracket-stub);
}

/* Horizontal stub leaving a match towards the round on its right. */
.bracket-round:not(:last-child) .bracket-slot::before {
    content: "";
    position: absolute;
    right: 0;
    top: 50%;
    width: var(--rl-bracket-stub);
    height: 2px;
    background: var(--rl-bracket-line);
}

/* The vertical joiner of a pair, drawn once by its upper half. Because both
   slots of a pair are equally tall, 100% reaches exactly the centre of the
   lower one. */
.bracket-round:not(:last-child) .bracket-slot[data-pair="upper"]::after {
    content: "";
    position: absolute;
    right: 0;
    top: 50%;
    width: 2px;
    height: 100%;
    background: var(--rl-bracket-line);
}

.bracket-match {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 0;
    border: 1px solid var(--rl-border);
    border-radius: var(--rl-radius-md);
    background: var(--rl-bg-surface);
    text-align: left;
    color: inherit;
    cursor: pointer;
}

/* Horizontal stub arriving from the round on the left. */
.bracket-round:not(:first-child) .bracket-match::before {
    content: "";
    position: absolute;
    left: calc(-1 * var(--rl-bracket-stub));
    top: 50%;
    width: var(--rl-bracket-stub);
    height: 2px;
    background: var(--rl-bracket-line);
}

.bracket-match:hover {
    border-color: var(--rl-primary);
}

.bracket-match.is-selected {
    border-color: var(--rl-primary);
    box-shadow: 0 0 0 2px var(--rl-primary-soft);
}

.bracket-match.is-pending {
    border-style: dashed;
    background: transparent;
}

.bracket-side {
    display: flex;
    align-items: center;
    gap: var(--rl-space-2);
    padding: 5px var(--rl-space-2);
    min-height: 28px;
}

.bracket-side + .bracket-side {
    border-top: 1px solid var(--rl-border-subtle);
}

.bracket-seed {
    flex: none;
    min-width: 20px;
    text-align: right;
    font-size: var(--rl-font-caption);
    font-variant-numeric: tabular-nums;
    color: var(--rl-text-disabled);
}

.bracket-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bracket-side-open .bracket-name {
    color: var(--rl-text-disabled);
    font-style: italic;
}

.bracket-score {
    flex: none;
    font-variant-numeric: tabular-nums;
    color: var(--rl-text-secondary);
}

.bracket-side-winner {
    background: var(--rl-success-bg);
}

.bracket-side-winner .bracket-name {
    font-weight: 600;
    color: var(--rl-text-primary);
}

.bracket-side-winner .bracket-score {
    color: var(--rl-success);
    font-weight: 600;
}

.bracket-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--rl-space-1);
    padding: 3px var(--rl-space-2);
    border-top: 1px solid var(--rl-border-subtle);
    border-radius: 0 0 var(--rl-radius-md) var(--rl-radius-md);
    background: var(--rl-bg-toolbar);
    font-size: var(--rl-font-caption);
    color: var(--rl-text-secondary);
}

.bracket-quick {
    display: flex;
    gap: 2px;
}

.bracket-quick button {
    min-height: 19px;
    padding: 0 5px;
    border: 1px solid var(--rl-border-strong);
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-surface);
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-caption);
    font-variant-numeric: tabular-nums;
    cursor: pointer;
}

.bracket-quick button:hover:not(:disabled) {
    border-color: var(--rl-primary);
    color: var(--rl-primary);
}

.bracket-quick button:disabled {
    color: var(--rl-text-disabled);
    cursor: default;
}

/* The result a game currently carries. In the editor the same row is both the
   display of what was entered and the control that changes it, so the entered
   value has to be readable as a state and not only as one more button. */
.bracket-quick button.is-active {
    border-color: var(--rl-primary);
    background: var(--rl-primary);
    color: var(--rl-primary-contrast);
    font-weight: 600;
}

.bracket-quick button.is-active:hover:not(:disabled) {
    background: var(--rl-primary-hover);
    color: var(--rl-primary-contrast);
}

/* The winner's column: no match, just who came out of the final. */
.bracket-champion {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: var(--rl-space-3);
    border: 1px solid var(--rl-success);
    border-radius: var(--rl-radius-md);
    background: var(--rl-success-bg);
}

.bracket-champion small {
    color: var(--rl-text-secondary);
}

.bracket-champion strong {
    font-size: 15px;
}

.bracket-champion.is-open {
    border-color: var(--rl-border);
    border-style: dashed;
    background: transparent;
    color: var(--rl-text-disabled);
}

/* The editor for one match. A correction needs room the card cannot give: the
   games in order, who had White in each, and what the change would cost. */
.bracket-editor-games {
    display: flex;
    flex-direction: column;
    gap: var(--rl-space-2);
    margin: var(--rl-space-2) 0;
}

.bracket-editor-game {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--rl-space-2);
}

/* One fixed column so the result strips of several games line up under each
   other instead of starting wherever the two names happen to end. */
.bracket-editor-game > label {
    flex: 1 1 100%;
    color: var(--rl-text-primary);
    font-size: var(--rl-font-small);
}

.bracket-colours {
    display: block;
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-caption);
}

/* Setup: choosing the round count is choosing the format, so every option says
   what it means for this field instead of only how many rounds it is. */
.bracket-format-options {
    display: flex;
    flex-direction: column;
    gap: var(--rl-space-1);
    margin: var(--rl-space-2) 0 var(--rl-space-3);
}

.bracket-format-option {
    display: flex;
    align-items: baseline;
    gap: var(--rl-space-2);
    padding: var(--rl-space-2);
    border: 1px solid var(--rl-border-subtle);
    border-radius: var(--rl-radius-sm);
    cursor: pointer;
}

.bracket-format-option:hover {
    background: var(--rl-bg-hover);
}

.bracket-format-option.is-selected {
    border-color: var(--rl-primary);
    background: var(--rl-primary-soft);
}

.bracket-format-option span {
    flex: 1;
}

.bracket-format-option small {
    display: block;
    color: var(--rl-text-secondary);
}

.bracket-draw-preview {
    margin: var(--rl-space-4) 0;
    padding: var(--rl-space-3);
    border: 1px solid var(--rl-border);
    background: var(--rl-bg-toolbar);
}

.bracket-draw-preview h3 { margin: 0 0 var(--rl-space-2); }
.bracket-draw-preview p { margin: 0 0 var(--rl-space-3); }
.bracket-draw-columns { display: flex; flex-wrap: wrap; gap: var(--rl-space-4); }
.bracket-draw-columns > div { flex: 1 1 260px; min-width: 0; }
.bracket-draw-columns ol, .bracket-draw-columns ul {
    max-height: 220px;
    overflow: auto;
    margin: var(--rl-space-2) 0 0;
    padding-left: var(--rl-space-5);
}
.bracket-draw-columns li { padding: var(--rl-space-1) 0; }
.bracket-draw-columns li small { margin-left: var(--rl-space-2); color: var(--rl-text-secondary); }
.bracket-draw-confirm { display: flex; align-items: center; justify-content: space-between; gap: var(--rl-space-3); }
.bracket-draw-confirm p { margin: var(--rl-space-1) 0 0; }

/* Column designer of the list page: the sheet as a strip of column blocks that are dragged into
   order, the unused columns in a tray below it. */
.column-board {
    display: grid;
    gap: var(--rl-space-2);
    margin: var(--rl-space-3) 0;
}

.column-board-strip {
    display: flex;
    align-items: stretch;
    gap: 2px;
    min-height: 76px;
    padding: var(--rl-space-2);
    overflow-x: auto;
    background: var(--rl-bg-app);
    border: 1px solid var(--rl-border-strong);
    border-radius: var(--rl-radius-md);
}

.column-block {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    gap: 2px;
    min-width: 64px;
    padding: var(--rl-space-2);
    overflow: hidden;
    background: var(--rl-bg-surface);
    border: 1px solid var(--rl-border);
    border-radius: var(--rl-radius-sm);
    color: var(--rl-text-primary);
    font: inherit;
    font-size: var(--rl-font-small);
    text-align: left;
    cursor: grab;
}

.column-block.is-end {
    text-align: right;
}

.column-block strong,
.column-block span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.column-block strong {
    font-size: var(--rl-font-table);
}

.column-block span {
    color: var(--rl-text-secondary);
}

.column-block:hover {
    background: var(--rl-bg-hover);
}

.column-block.is-selected {
    background: var(--rl-bg-selection);
    border-color: var(--rl-primary);
}

.column-block:focus-visible {
    outline: 2px solid var(--rl-primary);
    outline-offset: -2px;
}

.column-board-tray {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--rl-space-2);
    min-height: 44px;
    padding: var(--rl-space-2);
    border: 1px dashed var(--rl-border-strong);
    border-radius: var(--rl-radius-md);
}

.column-board-tray small,
.column-inspector-hint,
.column-inspector-group > span {
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
}

.column-board-reset {
    margin-left: auto;
}

.column-inspector {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--rl-space-4);
    margin-bottom: var(--rl-space-3);
}

.column-inspector-group {
    display: inline-flex;
    align-items: center;
    gap: var(--rl-space-2);
}

.column-inspector-group output {
    min-width: 3ch;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.column-inspector-group .is-active {
    background: var(--rl-bg-selection);
    border-color: var(--rl-primary);
    font-weight: 600;
}

.name-card-designer { display: flex; flex-wrap: wrap; gap: var(--rl-space-4); margin: var(--rl-space-3) 0; }
.name-card-fields {
    display: flex;
    flex: 0 0 220px;
    flex-direction: column;
    align-items: stretch;
    gap: var(--rl-space-2);
    padding: var(--rl-space-3);
    border: 1px solid var(--rl-border);
    background: var(--rl-bg-toolbar);
}
.name-card-fields small { color: var(--rl-text-secondary); }
.name-card-sheet { flex: 1 1 400px; max-width: 620px; border: 1px solid var(--rl-border-strong); background: var(--rl-bg-surface); }
.name-card-face {
    display: flex;
    min-height: 150px;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: var(--rl-space-3);
    text-align: center;
}
.name-card-face.is-reversed { transform: rotate(180deg); }
.name-card-face > strong, .name-card-preview-name { font-family: var(--rl-font-family-heading); font-size: 28px; }
.name-card-fold { border-top: 1px dashed var(--rl-border-strong); text-align: center; color: var(--rl-text-secondary); font-size: var(--rl-font-caption); }
.name-card-drop-zone {
    display: flex;
    width: 100%;
    min-height: 32px;
    align-items: center;
    justify-content: center;
    gap: var(--rl-space-2);
    border: 1px dashed var(--rl-border-strong);
}
.name-card-drop-zone span { font-size: var(--rl-font-caption); color: var(--rl-text-secondary); }
.name-card-drop-zone:focus-within, .name-card-drop-zone:hover { background: var(--rl-primary-soft); }

@media print {
    /* On paper there is nothing to pan: the viewport becomes the whole drawing again,
       and the transform the canvas left behind would otherwise crop it. */
    .bracket-board {
        height: auto;
        overflow: visible;
        border: 0;
        background: none;
    }

    .bracket-tree {
        transform: none !important;
    }

    .bracket-controls,
    .bracket-quick,
    .bracket-editor {
        display: none;
    }
}

/* Per-game cells on a match card: what each player scored in each game, on the colour
   they had in it — the way chess-results prints a knockout. A bare "1:0 1:0 1:0" is
   from White's side of each board and says nothing about who that was. The chess
   colours are literal white and black on purpose, like the QR quiet zone: they name a
   colour of the board, not a colour of the theme. */
.bracket-games {
    display: flex;
    flex: none;
    gap: 2px;
}

.bracket-game {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 17px;
    height: 17px;
    padding: 0 2px;
    border-radius: var(--rl-radius-sm);
    font-size: var(--rl-font-caption);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.bracket-game.is-white {
    border: 1px solid #aeb6c1;
    background: #ffffff;
    color: #1f2933;
}

.bracket-game.is-black {
    border: 1px solid #6b7480;
    background: #151a20;
    color: #f4f6f8;
}

/* The game still to be played: empty, dashed, but already on its colour, so the board
   is set up the right way round before anyone asks. */
.bracket-game.is-next {
    border-style: dashed;
    opacity: 0.6;
}

.bracket-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* A decided match has no quick-entry buttons, which left no visible way back into it:
   correcting a result was possible, but only for someone who already knew to click the
   card. */
.bracket-edit {
    min-height: 19px;
    padding: 0 6px;
    border: 1px solid var(--rl-border-strong);
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-surface);
    color: var(--rl-primary);
    font-size: var(--rl-font-caption);
    cursor: pointer;
}

.bracket-edit:hover {
    border-color: var(--rl-primary);
}

/* The editor sits beside the canvas, not under it. Under a fixed-height canvas it opened
   below the fold, so clicking a match looked like it did nothing at all. */
.bracket-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--rl-space-3);
    align-items: start;
}

.bracket-workspace.has-editor {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
}

/* The dense alternative to the drawing. Each match remains a two-row unit so names, colours and
   game points can be compared vertically, while round headings preserve the bracket's order. */
.bracket-table-view {
    display: flex;
    flex-direction: column;
    gap: var(--rl-space-3);
    min-width: 0;
    max-height: clamp(320px, 56vh, 720px);
    overflow-y: auto;
    padding-right: var(--rl-space-1);
}

.bracket-table-round {
    min-width: 0;
}

.bracket-table-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--rl-space-2);
    margin-bottom: var(--rl-space-1);
}

.bracket-table-heading h3 {
    margin: 0;
    font-size: var(--rl-font-ui);
}

.bracket-table-heading span {
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
}

.bracket-table-scroll {
    border: 1px solid var(--rl-border-subtle);
}

.bracket-table th[scope="rowgroup"] {
    width: 1%;
    background: var(--rl-bg-toolbar);
    color: var(--rl-text-secondary);
    font-weight: 600;
    text-align: right;
}

.bracket-table tbody tr:nth-child(even) {
    background: inherit;
}

.bracket-table tbody tr:nth-child(4n + 3),
.bracket-table tbody tr:nth-child(4n + 4) {
    background: var(--rl-bg-app);
}

.bracket-table tbody tr.is-winner {
    background: var(--rl-success-bg);
}

.bracket-table tbody tr.is-winner .bracket-table-name,
.bracket-table tbody tr.is-winner .bracket-table-score {
    font-weight: 600;
}

.bracket-table tbody tr.is-selected {
    box-shadow: inset 3px 0 0 var(--rl-primary);
}

.bracket-table-name {
    width: 34%;
    min-width: 160px;
    white-space: normal;
}

.bracket-table-score {
    font-weight: 600;
}

.bracket-table-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--rl-space-1);
}

.bracket-table-champion {
    display: flex;
    align-items: baseline;
    gap: var(--rl-space-2);
    padding: var(--rl-space-2) var(--rl-space-3);
    border: 1px solid var(--rl-success);
    border-radius: var(--rl-radius-sm);
    background: var(--rl-success-bg);
}

.bracket-table-champion span {
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
}

@media (max-width: 1100px) {
    .bracket-workspace.has-editor {
        grid-template-columns: minmax(0, 1fr);
    }
}

.bracket-editor {
    max-height: clamp(320px, 56vh, 720px);
    overflow-y: auto;
    padding: var(--rl-space-3);
    border: 1px solid var(--rl-border);
    border-radius: var(--rl-radius-md);
    background: var(--rl-bg-surface);
}

.bracket-editor-title:focus {
    outline: none;
}

@media print {
    .bracket-actions,
    .bracket-game.is-next {
        display: none;
    }
}

/* ── WP-30: practice-test feedback (2026-09-14) ─────────────────────────── */

/* A required field says so beside its caption. The asterisk is decoration; the control carries
   aria-required and the form states the legend in words. */
.required-marker {
    margin-left: 2px;
    color: var(--rl-danger);
    font-weight: 700;
}

.form-legend {
    margin: var(--rl-space-2) 0 0;
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
}

.optional-badge {
    display: inline-flex;
    align-items: center;
    margin-left: var(--rl-space-2);
    padding: 1px 6px;
    border: 1px solid var(--rl-border);
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-app);
    color: var(--rl-text-secondary);
    font-family: var(--rl-font-family);
    font-size: var(--rl-font-small);
    font-weight: 600;
    vertical-align: middle;
}

/* Groups inside a long form: a hairline and a readable legend, nothing heavier. The fieldset
   keeps the reset from the top of this file. */
.form-section {
    margin-top: var(--rl-space-4);
    padding-top: var(--rl-space-3);
    border-top: 1px solid var(--rl-border-subtle);
}

.form-section > legend {
    float: left;
    width: 100%;
    margin-bottom: var(--rl-space-2);
    padding: 0;
    color: var(--rl-text-primary);
    font-size: 15px;
    font-weight: 600;
}

.form-section > legend + * {
    clear: both;
}

.form-section-details {
    margin-top: var(--rl-space-4);
    padding-top: var(--rl-space-3);
    border-top: 1px solid var(--rl-border-subtle);
}

.form-section-details > summary {
    color: var(--rl-text-primary);
    font-size: 15px;
    font-weight: 600;
}

.form-section-details > .form-section {
    margin-top: var(--rl-space-2);
    padding-top: 0;
    border-top: 0;
}

/* The live region around the save confirmation (SaveStatus.razor) draws no box of its own, so an
   empty one adds no gap to the action row it sits in. */
.save-status-region {
    display: contents;
}

/* The confirmation after a successful save: icon and time in text, success colour only as
   support. */
.save-status {
    display: inline-flex;
    align-items: center;
    gap: var(--rl-space-1);
    padding: 3px 8px;
    border: 1px solid var(--rl-success-border);
    border-radius: var(--rl-radius-sm);
    background: var(--rl-success-bg);
    color: var(--rl-success);
    font-size: var(--rl-font-small);
    font-weight: 600;
    white-space: nowrap;
}

.save-status-icon {
    font-weight: 700;
}

.notice-info {
    border-color: var(--rl-info-border);
    border-left: 3px solid var(--rl-info);
    background: var(--rl-info-bg);
    color: var(--rl-text-primary);
}

.workspace-guidance p {
    margin: var(--rl-space-1) 0 0;
}

.next-step-notice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--rl-space-3);
}

.input-with-unit {
    display: flex;
    align-items: center;
    gap: var(--rl-space-2);
}

.input-with-unit input {
    flex: 1;
    min-width: 0;
}

.input-unit {
    min-width: 2.5em;
    color: var(--rl-text-secondary);
    font-weight: 600;
}

.announcement-timing {
    display: block;
    margin-top: var(--rl-space-1);
    color: var(--rl-info);
}

.mailing-list {
    margin-top: var(--rl-space-4);
    padding: var(--rl-space-3);
    border: 1px solid var(--rl-border);
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-app);
}

.mailing-list-heading,
.mailing-list-actions {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--rl-space-3);
}

.mailing-list-heading h3 {
    margin-bottom: var(--rl-space-1);
}

.mailing-list-actions {
    align-items: center;
    margin: var(--rl-space-2) 0;
}

.mailing-list-table {
    max-height: 240px;
    overflow: auto;
    border: 1px solid var(--rl-border-subtle);
    background: var(--rl-bg-surface);
    user-select: text;
}

.rating-range {
    display: grid;
    gap: var(--rl-space-1);
    min-width: 280px;
}

.rating-range-summary {
    display: flex;
    align-items: baseline;
    gap: var(--rl-space-2);
}

.rating-range-caption {
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-caption);
    font-weight: 600;
}

.rating-range-row {
    display: grid;
    grid-template-columns: 3em minmax(120px, 1fr) 6.5em;
    align-items: center;
    gap: var(--rl-space-2);
}

.rating-range-row label {
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
}

.rating-range-row input[type="range"] {
    width: 100%;
    accent-color: var(--rl-primary);
}

.pairing-change-log {
    margin: var(--rl-space-3) 0;
}

.pairing-change-log ol {
    margin: var(--rl-space-2) 0 0;
    padding-left: 20px;
}

.pairing-change-log li + li {
    margin-top: var(--rl-space-2);
}

.pairing-change-reason {
    display: block;
    margin-top: 2px;
    white-space: pre-wrap;
}

.participant-contact-consent {
    grid-column: 1 / -1;
}

.help-panel {
    display: grid;
    gap: var(--rl-space-2);
}

.help-search {
    max-width: 520px;
}

.help-group {
    margin: var(--rl-space-4) 0 var(--rl-space-1);
    font-size: 16px;
}

.help-topic {
    border: 1px solid var(--rl-border);
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-surface);
}

.help-topic > summary {
    padding: var(--rl-space-2) var(--rl-space-3);
    font-weight: 600;
}

.help-topic > summary:hover {
    background: var(--rl-bg-hover);
}

.help-answer {
    padding: 0 var(--rl-space-3) var(--rl-space-3);
    line-height: 1.5;
}

.help-answer p {
    max-width: 90ch;
    margin-bottom: var(--rl-space-2);
}

.save-status-row {
    margin: var(--rl-space-2) 0;
}

.help-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--rl-space-2);
    margin-top: var(--rl-space-4);
    padding-top: var(--rl-space-3);
    border-top: 1px solid var(--rl-border-subtle);
}

/* Compact disclosure actions stay in the table's scroll container. */
.table-actions-menu { display: flex; flex-direction: column; align-items: flex-start; }
.table-actions-menu summary { cursor: pointer; }
.table-actions-menu[open] > a { display: block; margin-top: var(--rl-space-1); }
.data-table-scroll { max-width: 100%; overflow: auto; }
.data-table .numeric { text-align: right; font-variant-numeric: tabular-nums; }

/* Log of interventions (package U2b): the TRF line of an entry is shown as it is written, in the
   monospace face, and wraps instead of widening the table. */
.regulation-event-line {
    padding: 2px 6px;
    border: 1px solid var(--rl-border-subtle);
    background: var(--rl-bg-hover);
    color: var(--rl-text-secondary);
    font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
    font-size: var(--rl-font-caption);
    overflow-wrap: anywhere;
    white-space: normal;
}

.regulation-event-table td {
    vertical-align: top;
}

/* LS-12: the cells stay top-aligned (multi-line TRF entries), so the compact undo button pulls
   itself up until its label sits on the first text line of its neighbours. */
.regulation-event-table td > .button-compact {
    margin-block: calc((1lh - var(--rl-control-height-compact)) / 2);
}

/* FIDE mode (package U3, checklist Q46). The banner is the permanent notice that a tournament has a
   section outside FIDE mode: a symbol and words in the warning colours, one line, on every page of the
   tournament. A contradiction (marked as FIDE rated although outside FIDE mode) is danger-coloured. */
.fide-mode-banner {
    z-index: 8;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--rl-space-2);
    min-width: 0;
    padding: 4px var(--rl-space-3);
    border-bottom: 1px solid var(--rl-warning-border);
    background: var(--rl-warning-bg);
    color: var(--rl-warning);
    font-size: var(--rl-font-small);
}

.fide-mode-banner-conflict {
    border-bottom-color: var(--rl-danger);
    background: var(--rl-danger-bg);
    color: var(--rl-danger);
}

.fide-mode-banner-icon {
    font-size: var(--rl-font-ui);
}

.fide-mode-banner-text,
.fide-mode-banner-conflict-text {
    min-width: 0;
    overflow-wrap: anywhere;
}

.fide-mode-banner-conflict-text {
    font-weight: 700;
}

.fide-mode-banner-link {
    margin-left: auto;
    color: inherit;
    text-decoration: underline;
    white-space: nowrap;
}

.status-fide {
    white-space: nowrap;
}

.status-fide-outside,
.status-fide-outside strong {
    color: var(--rl-warning);
}

.status-fide-conflict,
.status-fide-conflict strong {
    color: var(--rl-danger);
}

.fide-mode-settings {
    margin: 0;
    padding-left: var(--rl-space-4);
}

/* Package U5: what a board set by hand violates, next to the board. The level is written out; the
   colour only repeats it. */
.pairing-finding {
    border-left: 3px solid var(--rl-warning);
    display: block;
    font-size: var(--rl-font-small);
    padding-left: var(--rl-space-1);
}

.pairing-finding + .pairing-finding {
    margin-top: var(--rl-space-1);
}

.pairing-finding-level-3 {
    color: var(--rl-warning);
}

.pairing-finding-level-2 {
    border-left-color: var(--rl-info);
    color: var(--rl-info);
}

.pairing-unpaired {
    grid-column: 1 / -1;
}

.pairing-unpaired p {
    margin: 0 0 var(--rl-space-2);
}

.pairing-manual-phase p {
    margin: var(--rl-space-1) 0 0;
}

/* Package U6: ranking settings and exchange of pairing numbers on the participants page. */
.start-ranking-exchange-heading {
    margin: var(--rl-space-4) 0 var(--rl-space-1);
    font-size: var(--rl-font-ui);
    font-weight: 600;
}

.start-number-exchange-table select {
    min-width: 12rem;
    max-width: 100%;
}

/* Result entry, package U8: the menu for the results that have no key (½:0, 0:½, 0:0, not rated). */
.result-more {
    min-height: 30px;
    max-width: 7rem;
    margin-left: 6px;
    padding: 3px 4px;
    font-size: var(--rl-font-small);
}

/* Keep the collapsed navigation scrollable with wheel and keyboard, without a permanent gutter. */
.app-body.sidebar-collapsed .navigation-sidebar { scrollbar-width: none; }
.app-body.sidebar-collapsed .navigation-sidebar::-webkit-scrollbar { display: none; }
.fide-mode-panel { border-left: 4px solid var(--rl-success); }
.fide-mode-panel.is-out { border-left-color: var(--rl-warning); }
.fide-mode-panel .status-in { background: var(--rl-success-bg); color: var(--rl-success); }
.fide-mode-table a { color: var(--rl-primary); font-weight: 600; text-decoration: none; }
.fide-mode-table a:hover, .fide-mode-table a:focus-visible { text-decoration: underline; }

/* Compact, keyboard-accessible secondary tournament actions. */
.tournament-import-menu { position: relative; }
.tournament-import-menu summary { cursor: pointer; list-style: none; }
.tournament-import-options { position: absolute; right: 0; z-index: 5; min-width: 220px; padding: var(--rl-space-2); border: 1px solid var(--rl-border-strong); background: var(--rl-bg-surface); box-shadow: var(--rl-shadow-popover); }
.tournament-import-options a { display: block; padding: var(--rl-space-2); color: var(--rl-text-primary); }
.tournament-import-options a:hover, .tournament-import-options a:focus-visible { background: var(--rl-bg-hover); }
.tournament-publishing-options > .field { padding: var(--rl-space-3); border: 1px solid var(--rl-border-strong); background: var(--rl-primary-soft); }
.directory-entry-action { border-color: var(--rl-primary); color: var(--rl-primary); font-weight: 700; }
/* Rating-list order: number, name, list badge and the three buttons stand in columns shared by all
   rows (subgrid), so "Nach oben / Nach unten / Entfernen" line up whatever the list is called. */
.rating-list-sequence {
    display: grid;
    grid-template-columns: max-content max-content max-content minmax(0, 1fr);
    column-gap: var(--rl-space-3);
    margin: 0 0 var(--rl-space-3);
    padding: 0;
    list-style: none;
    counter-reset: rating-list;
}
.rating-list-sequence li {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: subgrid;
    /* A row that fades out while it is removed is taken out of the grid for that moment (no
       subgrid); column flow keeps its parts on one line instead of stacking them. */
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    align-items: center;
    min-height: calc(var(--rl-control-height-compact) + var(--rl-space-2) * 2);
    padding: 0 var(--rl-space-2);
    border-bottom: 1px solid var(--rl-border);
    counter-increment: rating-list;
}
.rating-list-sequence li::before {
    content: counter(rating-list) ".";
    color: var(--rl-text-secondary);
    font-variant-numeric: tabular-nums;
    text-align: right;
}
.rating-list-sequence .status-pill { justify-self: start; }
.rating-list-actions { display: inline-flex; gap: var(--rl-space-1); flex-wrap: wrap; }
#rating-list-sequence .inline-fields { display: flex; gap: var(--rl-space-2); align-items: end; }
#rating-list-sequence .inline-fields select { width: auto; min-width: 220px; max-width: 100%; }
.work-panel input, .work-panel select { max-width: 100%; box-sizing: border-box; }

.round-series-controls { display: flex; flex-wrap: wrap; align-items: center; gap: var(--rl-space-2); margin-bottom: var(--rl-space-3); }
.round-series-controls input { width: 6rem; }
.round-series-controls select { width: auto; }
.round-series-controls small { flex-basis: 100%; color: var(--rl-text-secondary); }
.round-time-fields { display: flex; flex-wrap: wrap; gap: var(--rl-space-2); }

.group-editor { display: flex; align-items: center; gap: var(--rl-space-1); min-width: 0; }
.group-editor .group-input { width: 100%; min-width: 0; }
.group-editor .icon-button { flex: 0 0 auto; }
.participant-action-menu { display: inline-block; }
.participant-action-menu summary { cursor: pointer; color: var(--rl-primary); }
.participant-action-menu[open] { display: inline-flex; flex-direction: column; align-items: stretch; gap: var(--rl-space-1); }
.participant-action-menu button { text-align: left; }

.round-board-table tr:focus-within { outline: 2px solid var(--rl-success); outline-offset: -2px; }
.verification-pair-lists { display: flex; flex-wrap: wrap; gap: var(--rl-space-6); }
.verification-pair-lists section { min-width: 180px; }

/* ---- UI scan 2026-11-04: overflow fixes confirmed on the installed Director ---- */
.page-heading,
.workspace-heading,
.record-header,
.record-header-actions,
.page-heading-actions,
.form-actions,
.work-actions {
    flex-wrap: wrap;
}

/* Long free text in a data table (tournament lists, report reasons) wraps instead of widening it. */
.data-table td.cell-wrap,
.data-table th.cell-wrap {
    min-width: 12ch;
    overflow-wrap: anywhere;
    white-space: normal;
}

.report-table td {
    white-space: normal;
}

.report-table td.numeric {
    white-space: nowrap;
}

.rating-list-table td {
    white-space: normal;
}

.rating-list-table td.numeric {
    white-space: nowrap;
}

/* The row buttons ("Aktualisieren", "Datei importieren") stay side by side; the list name wraps
   instead. Before, the name column took the width and the buttons stacked into 69 px rows. */
.rating-list-table tbody th {
    white-space: normal;
}

.rating-list-table td.actions-column {
    white-space: nowrap;
}

.rating-list-table td.actions-column > .muted {
    display: inline-block;
    min-width: 14rem;
    white-space: normal;
}

/* The participant list has up to 14 columns; the action column sticks to the right edge of the
   scroll container so "Bearbeiten" / "Aktionen" stay reachable without horizontal scrolling. */
.participant-table th.actions-column,
.participant-table td.row-actions {
    position: sticky;
    right: 0;
    border-left: 1px solid var(--rl-border-strong);
    background: var(--rl-bg-surface);
}

.participant-table th.actions-column {
    z-index: 3;
    background: var(--rl-bg-toolbar);
}

.participant-table td.row-actions {
    z-index: 2;
}

/* Row actions stay reachable: the action column keeps its buttons together on one line. */
.data-table td.row-actions .rating-list-actions,
.data-table td .rating-list-actions {
    flex-wrap: wrap;
}

@media (max-width: 960px) {
    /* The menu bar is one 31 px row (its popups hang below it), so it is made to fit rather than
       wrapped: tighter item padding and no session label; the work area shows the same state. */
    .main-toolbar {
        flex-wrap: wrap;
    }

    .desktop-menu > button,
    .desktop-menu > a,
    .menu-item > summary {
        padding-inline: var(--rl-space-1);
    }

    .desktop-mode-label {
        display: none;
    }

    .menu-brand {
        width: auto;
    }

    .menu-brand strong {
        display: none;
    }

    .round-overview-next {
        flex: 0 1 auto;
        min-width: 0;
    }

    .round-overview-next-step {
        white-space: normal;
    }

    .status-bar {
        flex-wrap: wrap;
        row-gap: 0;
        padding-block: var(--rl-space-1);
    }

    .status-bar > span,
    .status-bar > a {
        white-space: nowrap;
    }

    .status-spacer {
        flex: 1 1 auto;
    }
}

/* A table cell must stay a table cell: display:flex on td.row-actions removed it from the row's
   cell layout (misaligned borders, row height). Buttons wrap inside the cell instead. */
.data-table td.row-actions {
    display: table-cell;
    white-space: normal;
}

.data-table td.row-actions > button,
.data-table td.row-actions > a,
.data-table td.row-actions > details {
    margin: 2px var(--rl-space-1) 2px 0;
    vertical-align: middle;
}

/* An action row that holds a labelled field (label above its input, e.g. "Gruppengröße" next to
   "Vorschau erstellen", or the board-order move): buttons align with the field, not with the middle
   of label plus field, which left them 9 px above it. */
:is(.form-actions, .work-actions):has(> label > :is(input:not([type="checkbox"], [type="radio"]), select), > .field) {
    align-items: flex-end;
}

/* Participant rows: "Bearbeiten" and the "Aktionen" menu side by side. Wrapped, they made every
   row 60 px high; on one line it is 45 px and the table still fits at 1366 px (the action column
   sticks to the right edge when the table scrolls). */
.participant-table td.row-actions {
    white-space: nowrap;
}

/* Region buttons next to the search field of the player directory: centred on the 32 px field
   instead of sitting 2 px low on its bottom edge. */
.directory-search-toolbar > .button-compact {
    margin-bottom: calc((var(--rl-control-height) - var(--rl-control-height-compact)) / 2);
}


/* ===================================================================================
   Scaling (UI pass 2026-11, package UM2). Measured in the browser host at 1920x1080, 1366x768,
   1100x700 and 960x540 (= 1920x1080 at 200 % DPI): no page overflows sideways, but
   - the status bar grew to two lines (33 px at 1366, 45 px at 960) because its long entries
     wrapped inside themselves, and
   - at 540 px height menu, toolbar, round band, status bar and page header left about a third of
     the window for the page itself.
   =================================================================================== */

/* One row: every entry keeps its text on one line; only the two long sentences give way and end
   in an ellipsis, with the full text in their tooltip. Below 960 px the bar still wraps whole
   entries onto a second row (rule further up), so nothing is lost on a very narrow window. */
.status-bar > * {
    flex-shrink: 0;
    white-space: nowrap;
}

/* The cloud hint gives way first (it repeats what the cloud page says); the release-candidate
   warning keeps as much of its text as the row allows. */
.status-bar > .status-attention,
.status-bar > .status-release-candidate {
    flex: 0 1 auto;
    min-width: 8em;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-release-candidate {
    letter-spacing: 0.02em;
}

.status-bar > .status-attention {
    flex-shrink: 4;
}

/* Sidebar hints ("Ausweise scannen", "Freigegeben") repeat what the page says. In the default
   190 px sidebar they squeezed the labels to "Meldeti…"; below 230 px of sidebar width they give
   their room to the label. Count badges (open results, participants) always stay. */
.navigation-sidebar {
    container-type: inline-size;
    container-name: rl-sidebar;
}

@container rl-sidebar (max-width: 230px) {
    .nav-hint {
        display: none;
    }
}

/* Tab labels such as "Stammdaten & Sektionen" broke onto two lines below about 1100 px, which
   made the strip twice as high and the labels hard to scan. A label stays on one line; when the
   strip runs out of room, whole tabs move to a second row. */
.workspace-tabs {
    flex-wrap: wrap;
}

.workspace-tabs a,
.workspace-tabs span {
    white-space: nowrap;
}

/* Low windows (a laptop at 150–200 %, 1366x768 at 125 %): the shell rows and the page header
   tighten so the page keeps more than half of the height. Nothing is hidden. */
@media (max-height: 640px) {
    .round-chip {
        padding-block: 2px;
        gap: 0;
    }

    .round-overview-next {
        padding-block: var(--rl-space-1);
    }

    .record-header {
        margin-bottom: var(--rl-space-2);
        padding-block: var(--rl-space-1) var(--rl-space-2);
    }

    .record-header h1 {
        font-size: 20px;
    }

    .record-header .breadcrumbs {
        margin-bottom: 0;
    }

    .workspace-tabs {
        margin-bottom: var(--rl-space-2);
    }
}


/* ===================================================================================
   Messages, one family (UI pass 2026-11, package UM3, finding CS-7). The notice, the work
   message, the round alert, the directory confirmation and the stale-data banner were four
   builds with 7–12 px padding, 0–4 px corners and two different warning styles (white with an
   orange edge, and orange text on orange). They now share one shape: 8/12 px padding, the small
   radius, a 3 px edge in the colour of the kind. Warnings and information keep body text in the
   primary text colour, because orange or blue running text on a tinted ground is hard to read.
   Margins stay with each family (they depend on where the message sits).
   =================================================================================== */
.notice,
.work-message,
.round-alert,
.directory-success,
.stale-warning-banner {
    padding: var(--rl-space-2) var(--rl-space-3);
    border: 1px solid var(--rl-border-strong);
    border-left-width: 3px;
    border-radius: var(--rl-radius-sm);
}

.notice-error,
.work-message-error,
.round-alert-error {
    border-color: var(--rl-danger-border);
    border-left-color: var(--rl-danger);
    background: var(--rl-danger-bg);
    color: var(--rl-danger);
}

.notice-success,
.round-alert-success,
.directory-success {
    border-color: var(--rl-success-border);
    border-left-color: var(--rl-success);
    background: var(--rl-success-bg);
    color: var(--rl-success);
}

.notice-warning,
.round-alert-warning,
.stale-warning-banner {
    border-color: var(--rl-warning-border);
    border-left-color: var(--rl-warning);
    background: var(--rl-warning-bg);
    color: var(--rl-text-primary);
}

.notice-info {
    border-color: var(--rl-info-border);
    border-left-color: var(--rl-info);
    background: var(--rl-info-bg);
    color: var(--rl-text-primary);
}


/* Empty and loading states, one look (CS-17): `inline-empty`, `empty-state`, `federation-empty`
   and `loading` used three paddings (9, 20, 24 px), two grounds and two alignments. All are now a
   dashed box in secondary text with the small radius; `loading` and `empty-state` stay centred
   (they stand for a whole panel), the inline kinds stay left-aligned (they sit in a form). */
.inline-empty,
.empty-state,
.federation-empty,
.loading {
    padding: var(--rl-space-3) var(--rl-space-4);
    border: 1px dashed var(--rl-border-strong);
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-hover);
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
}

/* ===================================================================================
   Motion feedback (UI pass 2026-11, package UM1)

   Rules for everything below:
   - Feedback, not decoration. A control answers hover and press, something that appears eases
     in, a step that just became due is pointed at once. Nothing loops except busy indicators.
   - Short: 80–260 ms from the --rl-motion-* tokens. Only opacity, transform, colours and shadows
     move — never width, height or position in the flow, so nothing shifts what the user aims at.
   - Never the only carrier of information: every state that moves also has text or a static style.
   - Windows "Animation effects" off (prefers-reduced-motion: reduce) switches all of it off; the
     block at the end of this section and the global rule above take care of that.
   =================================================================================== */

/* Controls answer hover, focus and press. */
.button-primary,
.button-secondary,
.button-danger,
.button-quiet,
.icon-button,
.button-link,
.toolbar-button,
.menu-command,
.menu-popup a,
.export-menu-popup button,
.file-picker,
.result-button,
.round-list-item,
.round-chip,
.sidebar-navigation a,
.workspace-tabs a,
.row-actions button,
.bracket-quick button,
.hall-stepper button,
.list-kind-tile,
.settings-navigation-card,
.desktop-menu > button {
    transition:
        background-color var(--rl-motion-fast) var(--rl-ease-standard),
        border-color var(--rl-motion-fast) var(--rl-ease-standard),
        color var(--rl-motion-fast) var(--rl-ease-standard),
        box-shadow var(--rl-motion-fast) var(--rl-ease-standard),
        opacity var(--rl-motion-fast) var(--rl-ease-standard),
        transform var(--rl-motion-instant) var(--rl-ease-standard);
}

input,
select,
textarea {
    transition:
        border-color var(--rl-motion-fast) var(--rl-ease-standard),
        background-color var(--rl-motion-fast) var(--rl-ease-standard),
        box-shadow var(--rl-motion-fast) var(--rl-ease-standard);
}

.data-table tbody tr {
    transition: background-color var(--rl-motion-instant) linear;
}

/* A press sinks the button by one pixel while the mouse is down: the click registered. */
:is(.button-primary, .button-secondary, .button-danger, .button-quiet, .icon-button, .toolbar-button,
    .file-picker, .result-button, .row-actions button, .bracket-quick button, .hall-stepper button):active:not(:disabled):not(.disabled) {
    transform: translateY(1px);
}

.round-list-item:active,
.settings-navigation-card:active,
.list-kind-tile:active:not(:disabled) {
    transform: scale(0.99);
}

/* Things that appear ease in. They animate only when Blazor inserts them, not on every render. */
@keyframes rl-enter {
    from { opacity: 0; transform: translateY(-4px); }
}

@keyframes rl-fade-in {
    from { opacity: 0; }
}

@keyframes rl-pop-in {
    from { opacity: 0; transform: translateY(-3px) scale(0.98); }
}

@keyframes rl-rise-in {
    from { opacity: 0; transform: translateY(8px); }
}

/* Messages: success, error and warning notices, the round alert and the inline status in a form. */
.notice,
.work-message,
.form-notice,
.round-alert,
.status-cell.status-error[role="alert"] {
    animation: rl-enter var(--rl-motion-medium) var(--rl-ease-out);
}

/* A page that opens fades in: only opacity, so fixed-position children of the page (dialogs,
   pop-ups) keep their place while it runs. */
.workspace > * {
    animation: rl-fade-in var(--rl-motion-medium) var(--rl-ease-out);
}

/* Drop-down menus of the menu bar, the export menu and the row menus. */
.menu-popup,
.export-menu-popup {
    transform-origin: top left;
    animation: rl-pop-in var(--rl-motion-fast) var(--rl-ease-out);
}

.export-menu-popup {
    transform-origin: top right;
}

/* The FIDE download card rises from the status bar it belongs to. */
.fide-background-download {
    animation: rl-rise-in var(--rl-motion-slow) var(--rl-ease-out);
}

/* "Saved 12:34:56": each save inserts a fresh badge (SaveStatus.razor keys it by the time), so the
   tick pops again even when the form was saved twice in a row. */
@keyframes rl-save-pop {
    0% { opacity: 0; transform: scale(0.92); }
    60% { opacity: 1; transform: scale(1.03); }
    100% { transform: scale(1); }
}

@keyframes rl-check-draw {
    from { opacity: 0; transform: scale(0.4) rotate(-20deg); }
}

.save-status {
    animation: rl-save-pop var(--rl-motion-slow) var(--rl-ease-out);
}

.save-status-icon {
    display: inline-block;
    animation: rl-check-draw var(--rl-motion-slow) var(--rl-ease-out) var(--rl-motion-instant) backwards;
}

/* The next-step button of the round band points at itself once when the step changes
   (RoundOverviewBar.razor keys it by the step): a ring that widens and fades. */
@keyframes rl-attention {
    0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--rl-primary) 55%, transparent); }
    100% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--rl-primary) 0%, transparent); }
}

.round-overview-next-action {
    animation: rl-attention 900ms var(--rl-ease-out) 200ms 2;
}

/* An entered result fills its button with a short settle, so the click visibly landed. */
@keyframes rl-settle {
    0% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

.result-button.active {
    animation: rl-settle var(--rl-motion-medium) var(--rl-ease-out);
}

/* The open tab and the marked sidebar entry slide their colour in instead of switching hard. */
.workspace-tabs a.active,
.sidebar-navigation a.active {
    transition-duration: var(--rl-motion-medium);
}


/* Loading: the text pulses gently while it waits, so a long load does not look frozen. It is a
   busy signal, the only looping animation besides the spinner, and the text says the same. */
@keyframes rl-loading-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}

.loading {
    animation: rl-loading-pulse 1.4s ease-in-out infinite;
}


/* Disclosures (advanced settings, explanations, help topics, panel groups): the content eases in
   when opened instead of appearing in one jump. Row and import menus open like the other pop-ups. */
details[open]:not(.menu-item, .export-menu, .tournament-import-menu, .table-actions-menu, .participant-action-menu) > :not(summary) {
    animation: rl-enter var(--rl-motion-medium) var(--rl-ease-out);
}

details:is(.tournament-import-menu, .table-actions-menu, .participant-action-menu)[open] > :not(summary) {
    transform-origin: top right;
    animation: rl-pop-in var(--rl-motion-fast) var(--rl-ease-out);
}

@media (prefers-reduced-motion: reduce) {
    :root:not([data-motion="full"]) .notice,
    :root:not([data-motion="full"]) .work-message,
    :root:not([data-motion="full"]) .form-notice,
    :root:not([data-motion="full"]) .round-alert,
    :root:not([data-motion="full"]) .status-cell.status-error[role="alert"],
    :root:not([data-motion="full"]) .workspace > *,
    :root:not([data-motion="full"]) .menu-popup,
    :root:not([data-motion="full"]) .export-menu-popup,
    :root:not([data-motion="full"]) .fide-background-download,
    :root:not([data-motion="full"]) .save-status,
    :root:not([data-motion="full"]) .save-status-icon,
    :root:not([data-motion="full"]) .round-overview-next-action,
    :root:not([data-motion="full"]) .result-button.active,
    :root:not([data-motion="full"]) .loading,
    :root:not([data-motion="full"]) details[open]:not(.menu-item, .export-menu, .tournament-import-menu, .table-actions-menu, .participant-action-menu) > :not(summary),
    :root:not([data-motion="full"]) details:is(.tournament-import-menu, .table-actions-menu, .participant-action-menu)[open] > :not(summary) {
        animation: none;
    }
}

:root[data-motion="reduced"] .notice,
:root[data-motion="reduced"] .work-message,
:root[data-motion="reduced"] .form-notice,
:root[data-motion="reduced"] .round-alert,
:root[data-motion="reduced"] .status-cell.status-error[role="alert"],
:root[data-motion="reduced"] .workspace > *,
:root[data-motion="reduced"] .menu-popup,
:root[data-motion="reduced"] .export-menu-popup,
:root[data-motion="reduced"] .fide-background-download,
:root[data-motion="reduced"] .save-status,
:root[data-motion="reduced"] .save-status-icon,
:root[data-motion="reduced"] .round-overview-next-action,
:root[data-motion="reduced"] .result-button.active,
:root[data-motion="reduced"] .loading,
:root[data-motion="reduced"] details[open]:not(.menu-item, .export-menu, .tournament-import-menu, .table-actions-menu, .participant-action-menu) > :not(summary),
:root[data-motion="reduced"] details:is(.tournament-import-menu, .table-actions-menu, .participant-action-menu)[open] > :not(summary) {
    animation: none;
}

@media (prefers-reduced-motion: reduce) {
    :root:not([data-motion="full"]) :is(.button-primary, .button-secondary, .button-danger, .button-quiet, .icon-button, .toolbar-button, .file-picker, .result-button, .row-actions button, .bracket-quick button, .hall-stepper button, .round-list-item, .settings-navigation-card, .list-kind-tile):active {
        transform: none;
    }
}

:root[data-motion="reduced"] :is(.button-primary, .button-secondary, .button-danger, .button-quiet, .icon-button, .toolbar-button, .file-picker, .result-button, .row-actions button, .bracket-quick button, .hall-stepper button, .round-list-item, .settings-navigation-card, .list-kind-tile):active {
    transform: none;
}

/* ===================================================================================
   Micro-interactions (UI pass 2026-11, package UM4)

   Same rules as the motion block above. Lists that are reordered, extended or trimmed by hand
   (rating lists, tie-breaks, board order, forbidden pairs) glide through rooklane-motion.js
   (AutoAnimate, opt-in with data-motion-list); everything here is CSS. Spring curves come from
   tokens.css (Open Props).
   =================================================================================== */

/* The keyboard focus ring opens outwards from the control instead of snapping on. */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
    animation: rl-focus-open var(--rl-motion-fast) var(--rl-ease-out);
}

@keyframes rl-focus-open {
    from { outline-offset: -1px; }
}

/* Check boxes and radio buttons give under the pointer and land with a small spring when the
   user ticks them (focus: the click that just happened, not every ticked box on page load). */
input:is([type="checkbox"], [type="radio"]) {
    transition: transform var(--rl-motion-instant) var(--rl-ease-standard);
}

input:is([type="checkbox"], [type="radio"]):active:not(:disabled) {
    transform: scale(0.86);
}

@keyframes rl-check-land {
    0% { transform: scale(0.78); }
    100% { transform: scale(1); }
}

input:is([type="checkbox"], [type="radio"]):checked:focus {
    animation: rl-check-land var(--rl-motion-slow) var(--rl-ease-spring);
}

/* A counter in the sidebar (participants, open results) that changes rolls its new value in:
   NavigationSidebar.razor keys the badge by its number, so entering a result visibly counts down. */
@keyframes rl-count-roll {
    0% { opacity: 0; transform: translateY(45%) scale(0.9); }
    100% { opacity: 1; transform: none; }
}

.nav-badge {
    animation: rl-count-roll var(--rl-motion-slow) var(--rl-ease-spring);
}

/* The arrow of a next-step button leans forward under the pointer: this button moves you on. */
.button-arrow {
    display: inline-block;
    transition: transform var(--rl-motion-fast) var(--rl-ease-overshoot);
}

:is(button, a):hover:not(:disabled) .button-arrow,
:is(button, a):focus-visible .button-arrow {
    transform: translateX(3px);
}

/* An error that appears answers "no" with a short sideways nudge (three pixels, once). Warnings
   and confirmations only ease in. */
@keyframes rl-nudge {
    0%, 100% { transform: none; }
    20% { transform: translateX(-3px); }
    45% { transform: translateX(3px); }
    70% { transform: translateX(-2px); }
}

.notice-error[role="alert"],
.status-cell.status-error[role="alert"] {
    animation:
        rl-enter var(--rl-motion-medium) var(--rl-ease-out),
        rl-nudge 320ms var(--rl-ease-standard) var(--rl-motion-medium);
}

/* Cards that open another page lift a little under the pointer. */
.settings-navigation-card,
.list-kind-tile,
.tournament-card {
    transition:
        background-color var(--rl-motion-fast) var(--rl-ease-standard),
        border-color var(--rl-motion-fast) var(--rl-ease-standard),
        box-shadow var(--rl-motion-fast) var(--rl-ease-standard),
        transform var(--rl-motion-fast) var(--rl-ease-standard);
}

:is(.settings-navigation-card, .list-kind-tile, .tournament-card):hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--rl-shadow-popover);
}

/* "Saved" and an entered result land with a spring instead of a plain ease. */
.save-status,
.result-button.active {
    animation-timing-function: var(--rl-ease-spring);
}

/* Motion off (setting "Bewegung" or the operating system): none of the above moves. The global
   rule further up already removes the transitions. */
@media (prefers-reduced-motion: reduce) {
    :root:not([data-motion="full"]) :is(button, input, select, textarea, a):focus-visible,
    :root:not([data-motion="full"]) :is(input[type="checkbox"], input[type="radio"]),
    :root:not([data-motion="full"]) .nav-badge,
    :root:not([data-motion="full"]) .notice-error[role="alert"],
    :root:not([data-motion="full"]) .status-cell.status-error[role="alert"] {
        animation: none;
    }

    :root:not([data-motion="full"]) :is(input[type="checkbox"], input[type="radio"]):active,
    :root:not([data-motion="full"]) :is(button, a):is(:hover, :focus-visible) .button-arrow,
    :root:not([data-motion="full"]) :is(.settings-navigation-card, .list-kind-tile, .tournament-card):hover {
        transform: none;
    }
}

:root[data-motion="reduced"] :is(button, input, select, textarea, a):focus-visible,
:root[data-motion="reduced"] :is(input[type="checkbox"], input[type="radio"]),
:root[data-motion="reduced"] .nav-badge,
:root[data-motion="reduced"] .notice-error[role="alert"],
:root[data-motion="reduced"] .status-cell.status-error[role="alert"] {
    animation: none;
}

:root[data-motion="reduced"] :is(input[type="checkbox"], input[type="radio"]):active,
:root[data-motion="reduced"] :is(button, a):is(:hover, :focus-visible) .button-arrow,
:root[data-motion="reduced"] :is(.settings-navigation-card, .list-kind-tile, .tournament-card):hover {
    transform: none;
}

/* ==========================================================================
   Empty work areas (UI pass 2026-11, package UM5)
   ========================================================================== */

/* An empty state is centred, so its button is too: the action rows inside it keep the left
   alignment of the workspace (.round-actions) only where buttons stand among other content.
   "Erste Runde auslosen" sat at the left edge of the centred text block. */
.empty-workspace > :is(.round-actions, .form-actions, .work-actions) {
    justify-content: center;
}

/* Before the first round the round page has no list to show beside the work area. */
.round-workspace-empty {
    grid-template-columns: minmax(0, 1fr);
}

/* The section card at the foot of the sidebar names the tournament and the section all pages work
   on, marked like the active page (accent edge), and switches to another section of the tournament
   on the same page (UM5). Long lists scroll inside the card. */
.sidebar-footer-card {
    border-left: 3px solid var(--rl-primary);
}

.sidebar-footer-tournament {
    overflow: hidden;
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-footer-card .sidebar-footer-name {
    overflow: hidden;
    font-size: var(--rl-font-ui);
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-section-switch-label {
    margin-top: var(--rl-space-2);
    padding-top: var(--rl-space-2);
    border-top: 1px solid var(--rl-border-subtle);
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-caption);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.sidebar-section-switch {
    display: grid;
    gap: 1px;
    max-height: 168px;
    margin: 2px calc(-1 * var(--rl-space-2)) 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
}

.sidebar-section-switch button {
    display: block;
    width: 100%;
    min-height: 28px;
    padding: 0 var(--rl-space-2);
    overflow: hidden;
    border: 0;
    border-radius: var(--rl-radius-sm);
    background: transparent;
    color: var(--rl-text-primary);
    font: inherit;
    font-size: var(--rl-font-small);
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.sidebar-section-switch button:hover:not(:disabled) {
    background: var(--rl-bg-hover);
}

.sidebar-section-switch button.current,
.sidebar-section-switch button:disabled {
    background: var(--rl-primary-soft);
    color: var(--rl-primary);
    font-weight: 700;
    cursor: default;
    opacity: 1;
}

/* Log of interventions: one line of introduction, the long explanation on demand, and an empty log
   as a plain line instead of a second box inside the panel (UM5). */
.regulation-event-log-about {
    margin: calc(-1 * var(--rl-space-1)) 0 var(--rl-space-2);
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
}

.regulation-event-log-about > summary {
    width: fit-content;
    color: var(--rl-primary);
}

.regulation-event-log-about > p {
    max-width: 90ch;
    margin: var(--rl-space-1) 0 0;
}

.regulation-event-log-empty {
    margin: 0;
    color: var(--rl-text-secondary);
}

/* Grouping tools of the participant page, above the list instead of below it (UM5). */
.participant-group-tools > summary {
    width: fit-content;
    font-weight: 600;
}

.participant-group-tools-body {
    display: grid;
    gap: var(--rl-space-2);
    margin-top: var(--rl-space-2);
}

.participant-group-tools-body > p {
    margin: 0;
    color: var(--rl-text-secondary);
}

.participant-group-split {
    padding-top: var(--rl-space-2);
    border-top: 1px solid var(--rl-border-subtle);
}

/* Tournament search at the right end of the quick-access toolbar (UM5). */
.tournament-quick-search {
    position: relative;
    display: flex;
    align-items: center;
    width: min(300px, 100%);
    margin-left: auto;
}

.tournament-quick-search-icon {
    position: absolute;
    left: var(--rl-space-2);
    color: var(--rl-text-secondary);
    pointer-events: none;
}

.tournament-quick-search input {
    width: 100%;
    min-height: 30px;
    padding-left: calc(var(--rl-space-2) + 18px);
}

.tournament-quick-search-results {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 40;
    width: max(100%, 340px);
    max-height: 360px;
    margin: 0;
    padding: var(--rl-space-1);
    overflow-y: auto;
    border: 1px solid var(--rl-border-strong);
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-surface);
    box-shadow: 0 8px 24px rgb(0 0 0 / 14%);
    list-style: none;
}

.tournament-quick-search-results > li[role="option"] {
    display: grid;
    gap: 1px;
    padding: var(--rl-space-1) var(--rl-space-2);
    border-radius: var(--rl-radius-sm);
    cursor: pointer;
}

.tournament-quick-search-results > li[role="option"]:hover,
.tournament-quick-search-results > li.active {
    background: var(--rl-primary-soft);
}

.tournament-quick-search-name {
    overflow: hidden;
    color: var(--rl-text-primary);
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tournament-quick-search-meta,
.tournament-quick-search-empty {
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
}

.tournament-quick-search-empty {
    padding: var(--rl-space-1) var(--rl-space-2);
}

/* Hall display, UI pass 2026-11 package UM5: headings stay while the list glides under them, the
   result of a running round can be entered at the screen, and a hint says when the hand scrolls. */
.hall-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--rl-bg-app, var(--rl-bg-surface));
}

.hall-result-button {
    min-width: 4.2em;
    padding: 0.05em 0.4em;
    border: 1px dashed var(--rl-border-strong);
    border-radius: var(--rl-radius-sm);
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.hall-result-button:hover:not(:disabled),
.hall-result-button[aria-expanded="true"] {
    border-style: solid;
    border-color: var(--rl-primary);
    background: var(--rl-primary-soft);
}

.hall-table tr.is-choosing td {
    background: var(--rl-primary-soft);
}

.hall-result-chooser td {
    height: auto;
    padding: 0.35em 0.5em 0.5em;
    white-space: normal;
    background: var(--rl-primary-soft);
}

.hall-result-choices {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.4em;
    font-size: 0.8em;
}

.hall-result-choices button {
    min-width: 4.5em;
    min-height: 1.9em;
    padding: 0 0.6em;
    border: 1px solid var(--rl-border-strong);
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-surface);
    color: var(--rl-text-primary);
    font: inherit;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
}

.hall-result-choices button:hover:not(:disabled),
.hall-result-choices button.is-current {
    border-color: var(--rl-primary);
    color: var(--rl-primary);
}

.hall-result-choices .hall-result-cancel {
    font-weight: 400;
}

.hall-manual-hint {
    display: none;
}

.hall[data-hall-manual] .hall-manual-hint {
    display: inline;
    color: var(--rl-primary);
}

.hall[data-hall-manual] .hall-entry-hint {
    display: none;
}

.hall-entry-hint {
    color: var(--rl-text-secondary);
}

:root:fullscreen .hall-entry-hint,
:root:fullscreen .hall-manual-hint {
    visibility: hidden;
}

/* Late entry at the check-in desk from the player database (UM5); typing by hand is the fallback. */
.checkin-walkin-section {
    max-width: 360px;
    margin-bottom: var(--rl-space-3);
}

.checkin-walkin-manual {
    margin-top: var(--rl-space-3);
    padding-top: var(--rl-space-3);
    border-top: 1px solid var(--rl-border-subtle);
}

.checkin-walkin-manual > summary {
    width: fit-content;
    color: var(--rl-primary);
}

/* Publishing page (UM5): Live, chess-results.com, then what was published. The chess-results panel
   reads as three steps; its choice of kind is two cards, its facts a compact row. */
.publishing-confirmed {
    display: flex;
    align-items: center;
    gap: var(--rl-space-2);
    margin: 0;
    color: var(--rl-success);
    font-weight: 600;
}

.publishing-confirmed-mark {
    display: inline-grid;
    width: 20px;
    height: 20px;
    place-items: center;
    border-radius: 50%;
    background: var(--rl-success-bg);
}

.publishing-fields {
    display: block;
    margin-top: var(--rl-space-1);
    color: var(--rl-text-secondary);
}

.publishing-empty {
    margin: 0;
    color: var(--rl-text-secondary);
}

.chess-results-intro {
    max-width: 80ch;
    color: var(--rl-text-secondary);
}

.chess-results-steps {
    display: flex;
    flex-wrap: wrap;
    gap: var(--rl-space-2);
    margin: 0 0 var(--rl-space-3);
    padding: 0;
    list-style: none;
    counter-reset: chess-results-step;
}

.chess-results-steps > li {
    display: inline-flex;
    align-items: center;
    gap: var(--rl-space-2);
    padding: 4px var(--rl-space-3) 4px 4px;
    border: 1px solid var(--rl-border);
    border-radius: 999px;
    color: var(--rl-text-secondary);
    font-size: var(--rl-font-small);
    counter-increment: chess-results-step;
}

.chess-results-steps > li::before {
    display: inline-grid;
    width: 22px;
    height: 22px;
    place-items: center;
    border-radius: 50%;
    background: var(--rl-bg-hover);
    content: counter(chess-results-step);
    font-weight: 700;
}

.chess-results-steps > li.is-current {
    border-color: var(--rl-primary);
    color: var(--rl-text-primary);
    font-weight: 600;
}

.chess-results-steps > li.is-current::before {
    background: var(--rl-primary);
    color: var(--rl-primary-contrast);
}

.chess-results-steps > li.is-done::before {
    background: var(--rl-success-bg);
    color: var(--rl-success);
    content: "✓";
}

.chess-results-panel .facts {
    display: flex;
    flex-wrap: wrap;
    gap: var(--rl-space-2) var(--rl-space-6);
    margin: 0 0 var(--rl-space-3);
}

.chess-results-panel .facts > div {
    display: grid;
    gap: 1px;
    min-width: 0;
}

.chess-results-choice {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--rl-space-2);
    border: 0;
    padding: 0;
}

.chess-results-choice > legend {
    margin-bottom: var(--rl-space-2);
    padding: 0;
    font-weight: 600;
}

.chess-results-choice > :not(.chess-results-choice-card) {
    grid-column: 1 / -1;
}

.chess-results-choice-card {
    align-items: flex-start;
    padding: var(--rl-space-3);
    border: 1px solid var(--rl-border);
    border-radius: var(--rl-radius-sm);
    background: var(--rl-bg-surface);
    cursor: pointer;
}

.chess-results-choice-card > span {
    display: grid;
    gap: 2px;
}

.chess-results-choice-card:has(input:checked) {
    border-color: var(--rl-primary);
    background: var(--rl-primary-soft);
}

.chess-results-panel #chess-results-auto {
    margin-top: var(--rl-space-4);
    padding: var(--rl-space-4) 0 0;
    border: 0;
    border-top: 1px solid var(--rl-border-subtle);
}

.chess-results-panel #chess-results-auto > legend {
    float: left;
    width: 100%;
    margin-bottom: var(--rl-space-1);
    padding: 0;
    font-size: var(--rl-font-ui);
    font-weight: 600;
}

/* Long introduction (UM5): a step whose target this window cannot show is explained in the middle. */
.setup-guide-callout.is-centered {
    top: 50%;
    left: 50%;
    width: min(440px, calc(100vw - 2 * var(--rl-space-3)));
    transform: translate(-50%, -50%);
}
