/* stylelint-disable color-no-hex, function-disallowed-list -- the token blocks are the one place raw colours live */
:root {
    color-scheme: dark;
    --bg: #0a0e13;
    --surface: #121a22;
    --surface-2: #1a2530;
    --surface-3: #212f3c;
    /* --border is the strong divider/outline; --border-subtle is the quiet separation between cards/rows (see .row-list). */
    --border: #34475a;
    --border-subtle: #243342;
    /* Boundary of an interactive control (input/select/textarea): >= 3:1 against the surfaces (WCAG 1.4.11). */
    --border-control: #5b7389;
    --text: #dce6ec;
    --text-muted: #8aa3b5;
    --accent: #3fd0e0;
    --accent-strong: #8fe9f2;
    --on-accent: #05171a;
    --warning: #f5a623;
    --critical: #ff5468;
    --success: #5fd897;
    --info: #4da3ff;
    --neutral-status: #8aa3b5;
    /* Text/fill that sits on a solid --critical / --warning / white-surface background. */
    --on-critical: #1a0508;
    --on-warning: #1a1200;
    --qr-surface: #ffffff;
    /* Soft tints of each role for chip/badge/hover backgrounds, derived from the role color so a theme only defines the role. */
    --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
    --success-soft: color-mix(in srgb, var(--success) 14%, transparent);
    --warning-soft: color-mix(in srgb, var(--warning) 14%, transparent);
    --critical-soft: color-mix(in srgb, var(--critical) 14%, transparent);
    --scrim: rgba(0, 0, 0, 0.55);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 20px rgba(0, 0, 0, 0.35);
    /* Spacing scale — use these, not arbitrary pixel values. */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;
    /* Gap between stacked list rows (.row-table, .row-stack): thin enough to read as a divider line. */
    --row-gap: 2px;
    /* Readable measure for running text/hints and the column width of a settings form (docs/architecture/ui-kit.md). */
    --measure: 65ch;
    --measure-form: 720px;
    --radius-lg: 10px;
    /* Scales: the one place a size/radius/timing/layer is decided. Type: pick the nearest step; don't add a new px value to a component. */
    --fs-2xs: 10px;
    --fs-xs: 11px;
    --fs-sm: 12.5px;
    --fs-md: 13.5px;
    --fs-base: 15px;
    --fs-lg: 16px;
    --fs-xl: 18px;
    --fs-2xl: 24px;
    --fs-3xl: 32px;
    /* Radius: xs for tiny chips/swatches, sm for inner elements, --radius for
       controls, lg for cards/rows, pill for badges. */
    --radius-xs: calc(var(--radius) - 3px);
    --radius-sm: calc(var(--radius) - 2px);
    --radius-pill: 999px;
    /* Motion */
    --dur-fast: 0.12s;
    --dur-base: 0.15s;
    --dur-slow: 0.3s;
    /* Height of the sticky MainLayout topbar; other sticky page elements sit below it (MainLayout.razor.css). */
    --topbar-h: 54px;
    /* Stacking order — use a layer name, never a bare number. */
    --z-raised: 2;
    --z-sticky: 10;
    --z-dropdown: 20;
    --z-popover: 21;
    --z-overlay: 8000;
    --z-tour: 9000;
    --z-modal: 10000;
    --z-modal-top: 10001;
    --z-max: 10002;
    /* Radar canvas colors that have no general-purpose role (read by radar.js). */
    --radar-grid: #1a2530;
    --radar-runway: #c9d4dc;
    --radar-pavement: #2a2f36;
    --radar-pavement-stroke: #3a414a;
    --radar-taxiway: #4a525c;
    /* Ground picture (apt.dat import): fill per pavement surface, then a taxiway's edge casing, body and centreline. */
    --radar-surface-asphalt: #262c33;
    --radar-surface-concrete: #343b43;
    --radar-surface-grass: #1d2a22;
    --radar-surface-other: #2d2b27;
    --radar-taxiway-edge: #444c56;
    --radar-taxiway-surface: #2f353d;
    --radar-taxiway-centerline: #8a7424;
    /* Painted markings (apt.dat line types) and the runway strip body. */
    --radar-paint-yellow: #c9a227;
    --radar-paint-white: #cfd6dc;
    --radar-paint-border: #05080b;
    --radar-runway-surface: #444c56;
    /* Hues for the few categorical pills that aren't a status role. */
    --indigo: #b0b8fc;
    --violet: #d4b2fb;
    --gold: #f0c95c;
    --stripe-purple: #635bff;
    /* A violet distinct from --stripe-purple (reserved for Stripe): Open Feature roadmap items (green = Implemented, purple = open Feature, --warning = open Bug). */
    --feature-purple: #a78bfa;
    --radius: 6px;
    /* One focus indicator for every interactive element (WCAG 2.4.7); >= 3:1 against all surfaces in both themes. */
    --focus-ring: var(--accent);
    --font-display: 'IBM Plex Sans Condensed', 'Arial Narrow', sans-serif;
    --font-mono: 'IBM Plex Mono', 'Consolas', monospace;
    /* One height for every standalone form control and regular .btn. Excluded: textarea, checkboxes, range sliders, .btn-sm. */
    --control-height: 34px;
}

/* Light theme, set as data-theme on <html> by js/theme.js (loaded in <head>, before first paint). Accent text on white needs a darker teal, so --accent here is the deeper shade. */
:root[data-theme="light"] {
    color-scheme: light;
    --bg: #f2f6f8;
    --surface: #ffffff;
    --surface-2: #e9f0f4;
    --surface-3: #dce6ec;
    --border: #c3d1db;
    --border-subtle: #dbe5ec;
    --border-control: #6f8796;
    --text: #14212b;
    --text-muted: #496071;
    --accent: #076b78;
    --accent-strong: #065a65;
    --on-accent: #ffffff;
    --warning: #7d4a00;
    --critical: #a01c30;
    --success: #14653c;
    --info: #0b5fb8;
    --neutral-status: #546e7a;
    --on-warning: #ffffff;
    --on-critical: #ffffff;
    --feature-purple: #6d3fc7;
    --indigo: #3d46b0;
    --violet: #6a3399;
    --gold: #6e5300;
    --radar-grid: #cfdbe3;
    --radar-runway: #3b4a57;
    --radar-pavement: #dde3e8;
    --radar-pavement-stroke: #c3cbd3;
    --radar-taxiway: #b4bdc6;
    --radar-surface-asphalt: #cdd4da;
    --radar-surface-concrete: #e1e6ea;
    --radar-surface-grass: #cfe0d2;
    --radar-surface-other: #ddd8cc;
    --radar-taxiway-edge: #a9b3bd;
    --radar-taxiway-surface: #c4ccd3;
    --radar-taxiway-centerline: #a8841a;
    --radar-paint-yellow: #b58900;
    --radar-paint-white: #ffffff;
    --radar-paint-border: #5a6772;
    --radar-runway-surface: #9aa6b2;
    --scrim: rgba(20, 33, 43, 0.4);
    --shadow-sm: 0 1px 2px rgba(20, 33, 43, 0.08);
    --shadow-md: 0 6px 16px rgba(20, 33, 43, 0.12), 0 1px 3px rgba(20, 33, 43, 0.08);
    --shadow-lg: 0 8px 20px rgba(20, 33, 43, 0.16);
}
/* stylelint-enable color-no-hex, function-disallowed-list */

/* Touch uplift for touch devices: pointer: coarse tracks input capability (an iPad in landscape is wide), which a max-width breakpoint would miss.
   .btn-sm is used by nearly every compact control, so it is bumped here to the ~44px touch-target guideline. */
@media (pointer: coarse) {
    :root {
        --control-height: 44px;
    }

    .btn-sm {
        min-height: 44px;
        padding: var(--space-2) var(--space-3);
    }
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-display);
    font-size: var(--fs-base);
    line-height: 1.5;
    font-variant-numeric: tabular-nums;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-weight: 700;
    letter-spacing: 0.01em;
    margin: 0 0 var(--space-2);
}

/* Heading sizes sit on the type scale (UI-029); the browser's 2em/1.5em/1.17em defaults fall outside it. */
h1 { font-size: var(--fs-2xl); line-height: 1.25; }
h2 { font-size: var(--fs-xl); line-height: 1.3; }
h3 { font-size: var(--fs-lg); line-height: 1.35; }
h4 { font-size: var(--fs-base); }

h1:focus {
    outline: none;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: var(--fs-md);
    margin: calc(var(--space-3) * -1) 0 var(--space-4);
    max-width: 65ch;
}

a {
    color: var(--accent);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: calc(calc(var(--space-1) / 2) * -1);
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Set on <body> by js/dialog.js while a modal is open: the page behind must not scroll. */
body.modal-open {
    overflow: hidden;
}

/* Bypass block (WCAG 2.4.1): first focusable element, visible only while focused. */
.skip-link {
    position: absolute;
    left: var(--space-2);
    top: calc(-1 * var(--space-7));
    z-index: var(--z-max);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius);
    background: var(--accent);
    color: var(--on-accent);
    font-weight: 700;
    text-decoration: none;
}

.skip-link:focus {
    top: var(--space-2);
}

label,
.form-field-label {
    display: block;
    font-size: var(--fs-sm);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: var(--space-1);
}

input, select, textarea {
    font-family: var(--font-display);
    font-size: var(--fs-md);
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border-control);
    border-radius: var(--radius-sm);
    /* Top padding trimmed to 6px: a native <select> ignores author line-height, and 8px/8px left whitespace above the text while clipping descenders below. */
    padding: var(--space-1) var(--space-2) var(--space-2);
    width: 100%;
}

/* One height (--control-height) for every single-line field. Excluded: textarea (sized by rows), checkbox/range (own sizing rules below), and .ms-search-input (its parent .ms-input-row already sets min-height). */
input:not([type="checkbox"]):not([type="range"]):not(.ms-search-input), select {
    height: var(--control-height);
}

/* One focus ring everywhere: buttons, links, summaries, toggles and anything focusable by tabindex. */
:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--focus-ring);
    outline-offset: -1px;
    border-color: var(--focus-ring);
}

input[type=checkbox] {
    width: auto;
}

/* Slider look for on/off settings checkboxes (row-selection checkboxes should stay plain). Still a real checkbox underneath, so semantics, keyboard and @bind keep working. */
input[type=checkbox].toggle-switch {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    width: 38px;
    min-width: 38px;
    height: 21px;
    padding: 0;
    border-radius: var(--radius-pill);
    background: var(--surface-3);
    border: 1px solid var(--border);
    cursor: pointer;
    vertical-align: middle;
    transition: background-color var(--dur-base) ease, border-color var(--dur-base) ease;
}

input[type=checkbox].toggle-switch::after {
    content: "";
    position: absolute;
    top: 1px;
    left: 1px;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: transform var(--dur-base) ease, background-color var(--dur-base) ease;
}

input[type=checkbox].toggle-switch:checked {
    background: var(--accent);
    border-color: var(--accent);
}

input[type=checkbox].toggle-switch:checked::after {
    transform: translateX(17px);
    background: var(--on-accent);
}

input[type=checkbox].toggle-switch:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

input[type=checkbox].toggle-switch:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

input[type=range] {
    border: none;
    background: transparent;
    padding: var(--space-1) 0;
    accent-color: var(--accent);
}

/* Fields use the UI font; mono is for identifiers/codes/JSON only (.is-code). The legacy .mono-input below stays for pages not yet migrated to FormField. */
.is-code {
    font-family: var(--font-mono);
}

.mono-input {
    font-family: var(--font-mono);
    width: auto;
    flex: 1 1 auto;
}

.field {
    margin-bottom: var(--space-3);
}

/* One grid for every editor form row: 3 columns on desktop, folding to 2 then 1. Fixed track counts, not auto-fit, because auto-fit sized columns per row and made the same field-row differ across pages.
   A row with fewer than 3 fields leaves columns empty; more than 3 wraps. */
.field-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3);
}

/* Four fields that belong together on one line (a runway end: designator, latitude, longitude, ILS). */
.field-row.field-row-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 900px) {
    .field-row,
    .field-row.field-row-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .field-row,
    .field-row.field-row-4 {
        grid-template-columns: 1fr;
    }
}

/* .mono-input's width:auto (for compact flex rows) fights the fill-the-column rule inside a .field-row grid, so it is reset to 100% there only. */
.field-row > .field-span-2 {
    grid-column: span 2;
}

.field-row .mono-input {
    width: 100%;
}

/* One invalid look for every control: red border, no fill; after the focus rule so the border stays red while focused. */
input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
    border-color: var(--critical);
}

/* One field-error text: FormField's own, Blazor's ValidationMessage/ValidationSummary, and the account pages' text-danger. */
.form-field-error,
.validation-message,
.text-danger {
    display: block;
    margin: var(--space-1) 0 0;
    color: var(--critical);
    font-size: var(--fs-sm);
    font-weight: 600;
}

.field-hint {
    font-size: var(--fs-sm);
    font-weight: 400;
    max-width: var(--measure);
    text-transform: none;
    letter-spacing: normal;
    color: var(--text-muted);
}

/* HelpTip.razor: a "?" toggletip. The text shows while the details is open (tap/click), and on hover-capable devices also on hover;
   inside a .form-field the "?" is hidden there and hovering or focusing the field shows the text instead. The short show delay keeps
   tips from flashing while the pointer crosses a form. */
/* Label row of a .form-field (FormField.razor and the hand-built picker groups): the label and its HelpTip on one line. Global, not
   scoped, so hand-built groups get it too; .form-field is the tooltip's anchor. */
.form-field {
    position: relative;
}

.form-field-head {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    min-width: 0;
    margin-bottom: var(--space-1);
}

.form-field-head > .form-field-label {
    margin-bottom: 0;
}

.help-tip {
    position: relative;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}

.form-field .help-tip {
    position: static;
}

.help-tip-toggle > summary {
    list-style: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-muted);
    font-size: var(--fs-xs);
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.help-tip-toggle > summary::-webkit-details-marker {
    display: none;
}

.help-tip-toggle[open] > summary {
    border-color: var(--accent);
    color: var(--accent);
}

.help-tip-text {
    position: absolute;
    top: calc(100% + var(--space-1));
    left: 0;
    z-index: var(--z-popover);
    width: max-content;
    max-width: min(36ch, 80vw);
    padding: var(--space-2) var(--space-3);
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    color: var(--text);
    font-size: var(--fs-sm);
    font-weight: 400;
    letter-spacing: normal;
    text-transform: none;
    white-space: normal;
    visibility: hidden;
    opacity: 0;
    transition: opacity var(--dur-fast), visibility 0s var(--dur-fast);
}

.form-field .help-tip-text {
    top: auto;
    bottom: calc(100% + var(--space-1));
}

.help-tip:has(> .help-tip-toggle[open]) .help-tip-text {
    visibility: visible;
    opacity: 1;
    transition: opacity var(--dur-fast);
}

@media (hover: hover) {
    .form-field .help-tip-toggle {
        display: none;
    }

    .help-tip:hover .help-tip-text,
    .form-field:hover .help-tip-text,
    .form-field:focus-within .help-tip-text {
        visibility: visible;
        opacity: 1;
        transition: opacity var(--dur-fast) 400ms, visibility 0s 400ms;
    }
}

.field-hint-error {
    display: block;
    color: var(--critical);
    font-size: var(--fs-sm);
    margin-top: var(--space-1);
}

/* settings-table (Manage/Settings.razor): name | control | description, one row per user setting. */
.settings-table {
    display: flex;
    flex-direction: column;
}

.settings-table-row {
    display: grid;
    grid-template-columns: 200px auto 1fr;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border);
}

.settings-table-row:last-child {
    border-bottom: none;
}

.settings-table-name {
    font-size: var(--fs-md);
    font-weight: 600;
    color: var(--text);
    /* Set explicitly so a name rendered as a <span> (no input to label) looks identical to a <label>. */
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 0;
}

.settings-table-control {
    display: flex;
    align-items: center;
}

.settings-table-description {
    font-size: var(--fs-sm);
    color: var(--text-muted);
    line-height: 1.5;
}

@media (max-width: 640px) {
    .settings-table-row {
        grid-template-columns: 1fr;
        gap: var(--space-1);
    }
}

button, .btn {
    /* A <button> is inline-block by default, so <a class="btn"> would stay inline and ignore width:100%. inline-flex with centered content avoids relying on padding/line-height to center text. */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: var(--fs-md);
    letter-spacing: 0.02em;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: var(--space-2) var(--space-4);
    height: var(--control-height);
    cursor: pointer;
    text-decoration: none;
    transition: border-color var(--dur-fast), color var(--dur-fast), background var(--dur-fast);
}

button:hover, .btn:hover {
    border-color: var(--accent);
    color: var(--accent-strong);
}

button:disabled, .btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent);
    color: var(--on-accent);
    border-color: var(--accent);
}

.btn-primary:hover {
    color: var(--on-accent);
    background: var(--accent-strong);
    border-color: var(--accent-strong);
}

/* Button hierarchy (docs/architecture/ui-kit.md):
     primary   - the one main action of a view (filled accent)
     secondary - any other normal action (neutral raised; same family as a bare .btn)
     ghost     - low-emphasis / tertiary (no fill, no border until hover)
     danger    - destructive: outlined critical; .btn-danger-solid is the filled form for a destructive dialog's final confirm. */
.btn-secondary {
    background: var(--surface-3);
    border-color: var(--border);
    color: var(--text);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover {
    background: var(--surface-2);
    border-color: transparent;
    color: var(--text);
}

.btn-danger {
    background: transparent;
    border-color: var(--critical);
    color: var(--critical);
}

.btn-danger:hover {
    background: var(--critical-soft);
    border-color: var(--critical);
    color: var(--critical);
}

.btn-danger-solid {
    background: var(--critical);
    border-color: var(--critical);
    color: var(--on-critical);
}

.btn-danger-solid:hover {
    background: var(--critical);
    border-color: var(--critical);
    color: var(--on-critical);
    filter: brightness(1.1);
}

/* Icon-only trio (add above / add below / delete) on a repeatable form row (RowActionButtons.razor): a square at --control-height with a 2px colored border (accent for add, critical for delete).
   Scoped to .btn-icon so .btn-danger elsewhere keeps its look. */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--control-height);
    height: var(--control-height);
    padding: 0;
    min-width: 0;
    border-width: 2px;
}

.btn-icon.btn-accent {
    border-color: var(--accent);
    color: var(--accent);
}

/* Linked-account rows (ExternalLogins.razor, TwoFactorAuthentication.razor): icon + name on the left, a status pill or action button on the right in a fixed-width second column. */
.linked-account-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border);
}

.linked-account-row:last-child {
    border-bottom: none;
}

.linked-account-identity {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--fs-md);
    font-weight: 600;
    color: var(--text);
}

.linked-account-status {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 220px;
    justify-content: flex-end;
}

.pill-success {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--success) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--success) 40%, transparent);
    color: var(--success);
    font-size: var(--fs-sm);
    font-weight: 600;
    white-space: nowrap;
}

.pill-warning {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--warning) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--warning) 40%, transparent);
    color: var(--warning);
    font-size: var(--fs-sm);
    font-weight: 600;
    white-space: nowrap;
}

.pill-danger {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--critical) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--critical) 40%, transparent);
    color: var(--critical);
    font-size: var(--fs-sm);
    font-weight: 600;
    white-space: nowrap;
}

.pill-neutral {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-pill);
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: var(--fs-sm);
    font-weight: 600;
    white-space: nowrap;
}

.btn-icon.btn-accent:hover {
    border-color: var(--accent-strong);
    color: var(--accent-strong);
}

.btn-icon.btn-danger {
    border-color: var(--critical);
}

.btn-icon svg {
    display: block;
}

.btn-sm {
    padding: var(--space-1) var(--space-2);
    font-size: var(--fs-sm);
    /* Opts out of --control-height: row-action buttons in dense tables are deliberately more compact. */
    height: auto;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
}

.assignment-card + .assignment-card {
    margin-top: var(--space-4);
}

.panel-title {
    font-size: var(--fs-sm);
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 var(--space-3);
}

/* Section header sitting directly on the table/block below it: larger, with clear separation above and a tight gap below. */
.panel-title.section-title {
    font-size: var(--fs-base);
    margin: var(--space-6) 0 var(--space-1);
}

/* Tables scroll inside a <div class="table-scroll"> wrapper with the table left as display:table. Setting display:block on the <table> shrinks the anonymous table box for narrow content to its content width,
   ignoring width:100%; overflow-x:auto alone makes a wide table scroll the whole page. table-layout:fixed does not help. */
.table-scroll {
    overflow-x: auto;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: var(--fs-md);
}

th {
    text-align: left;
    font-family: var(--font-display);
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: var(--space-2) var(--space-2);
    border-bottom: 1px solid var(--border);
}

td {
    padding: var(--space-2) var(--space-2);
    border-bottom: 1px solid var(--border);
}

tr:hover td {
    background: var(--surface-2);
}

td.actions {
    text-align: right;
    white-space: nowrap;
}

td.actions button {
    margin-left: var(--space-1);
}

/* Row-action sizing for World Editor and Admin lists: same footprint regardless of label. Markup order is extra actions, Edit, Delete, so Delete ends up outermost with td.actions right-aligned. rem-based to respect text zoom. */
.btn-row-action {
    min-width: 4.5rem;
    text-align: center;
}

/* List rows (World Editor lists): one raised row per entity instead of a table. Identity first (.list-row-id + .list-row-title), facts as .list-row-sub, status as .badge-* chips, one visible action (Edit) with the rest behind a "..." menu.
   Use a real <table> only for dense, many-column, comparable data (Admin lists, logs). */
.row-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.list-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-4);
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}

.list-row:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
}

.list-row-id {
    min-width: 64px;
    padding: var(--space-2) var(--space-2);
    border-radius: var(--radius);
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-family: var(--font-mono);
    font-size: var(--fs-md);
    font-weight: 600;
    text-align: center;
}

.list-row-title {
    font-size: var(--fs-base);
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.list-row-sub {
    margin-top: calc(var(--space-1) / 2);
    font-size: var(--fs-sm);
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.list-row-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    justify-content: flex-end;
}

.list-row-meta .badge-published {
    margin-left: 0;
}

.list-row-actions {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

/* "..." overflow menu: details/summary, closed on outside click/pick by js/row-menu.js. */
.row-menu {
    position: relative;
}

.row-menu > summary {
    list-style: none;
    cursor: pointer;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-weight: 700;
    line-height: 1;
}

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

.row-menu > summary:hover,
.row-menu[open] > summary {
    background: var(--surface-2);
    color: var(--text);
}

.row-menu-panel {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: var(--z-dropdown);
    min-width: 150px;
    margin-top: var(--space-1);
    padding: var(--space-1);
    display: flex;
    flex-direction: column;
    gap: calc(var(--space-1) / 2);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.row-menu-panel button {
    width: 100%;
    justify-content: flex-start;
    text-align: left;
    background: transparent;
    border: none;
    font-weight: 600;
}

.row-menu-panel button:hover {
    background: var(--surface-3);
}

.row-menu-panel .btn-danger {
    color: var(--critical);
}

.row-menu-panel .btn-danger:hover {
    background: var(--critical-soft);
}

.list-row-no-id {
    grid-template-columns: minmax(0, 1fr) auto auto;
}

.list-row-wrap {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
}

.list-row-wrap .list-row-title,
.list-row-wrap .list-row-sub {
    white-space: normal;
    overflow-wrap: anywhere;
}

.log-exception {
    margin-top: var(--space-2);
    font-size: var(--fs-sm);
}

.log-exception pre {
    overflow-x: auto;
    padding: var(--space-3);
    background: var(--surface-2);
    border-radius: var(--radius-sm);
}

@media (max-width: 640px) {
    .list-row {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }

    .list-row-no-id {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .list-row-no-id .list-row-meta {
        grid-column: 1;
    }

    .list-row-meta {
        grid-column: 2 / -1;
        grid-row: 2;
        justify-content: flex-start;
    }
}

/* Page building blocks: PageHeader, Card, .page-grid (the one 12-column grid for dashboards), MasterDetail, EmptyState and .detail-* sections. */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
}

.page-header h1 {
    margin: 0;
}

.page-header .page-subtitle {
    margin: var(--space-1) 0 0;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.card-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.card-header .panel-title {
    margin: 0;
}

.card-link {
    font-size: var(--fs-sm);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.card-link:hover {
    text-decoration: underline;
}

/* Highlighted "do this next" card: a soft accent wash; the one filled element stays the button inside it. */
.card-accent {
    background: var(--accent-soft);
    border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}

.card-accent .panel-title {
    color: var(--accent-strong);
}

.page-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: var(--space-4);
    align-items: start;
}

.page-grid > .span-12 { grid-column: span 12; }
.page-grid > .span-8 { grid-column: span 8; }
.page-grid > .span-6 { grid-column: span 6; }
.page-grid > .span-4 { grid-column: span 4; }

@media (max-width: 900px) {
    .page-grid > .span-8,
    .page-grid > .span-6,
    .page-grid > .span-4 {
        grid-column: span 12;
    }
}

.badge-info {
    display: inline-block;
    padding: calc(var(--space-1) / 2) var(--space-2);
    border-radius: var(--radius-pill);
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.empty-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-6) var(--space-4);
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    text-align: center;
}

.empty-card-title {
    font-size: var(--fs-lg);
    font-weight: 600;
    color: var(--text);
}

.empty-card-body {
    max-width: 52ch;
    color: var(--text-muted);
    font-size: var(--fs-md);
}

/* Master/detail: list on the left (fixed width), sticky detail on the right. On narrow screens one shows at a time, with a Back button on the detail. */
.master-detail {
    display: grid;
    grid-template-columns: minmax(300px, 400px) minmax(0, 1fr);
    gap: var(--space-4);
    align-items: start;
}

.md-toolbar {
    grid-column: 1 / -1;
    min-width: 0;
}

.md-list {
    min-width: 0;
}

.md-detail {
    position: sticky;
    top: calc(var(--topbar-h) + var(--space-4));
    min-width: 0;
    max-height: calc(100vh - var(--topbar-h) - 2 * var(--space-4));
    overflow-y: auto;
}

.md-back {
    display: none;
    margin-bottom: var(--space-3);
}

.md-detail-alert {
    margin-bottom: var(--space-3);
}

.used-by {
    margin-top: var(--space-3);
}

.usage-summary {
    margin: var(--space-2) 0 0;
    padding-left: var(--space-4);
    font-size: var(--fs-md);
}

.usage-summary .usage-blocks .usage-heading,
.confirm-dialog-blocked {
    color: var(--critical);
}

@media (max-width: 900px) {
    .master-detail {
        grid-template-columns: minmax(0, 1fr);
    }

    .master-detail.has-selection .md-list {
        display: none;
    }

    .master-detail:not(.has-selection) .md-detail {
        display: none;
    }

    .md-detail {
        position: static;
        max-height: none;
    }

    .md-back {
        display: inline-flex;
    }
}

/* Selectable rows are <button>s, so undo the global button look (fixed height, centered, bold) that would squash the two-line row. */
.md-list .list-row {
    grid-template-columns: 5rem minmax(0, 1fr);
    cursor: pointer;
    text-align: left;
    width: 100%;
    height: auto;
    justify-content: normal;
    font-size: var(--fs-base);
    font-weight: 400;
    letter-spacing: normal;
    color: var(--text);
}

.list-row > div {
    min-width: 0;
}

/* The blue id badge is one fixed width in every list; long ids are cropped, never wrapped. */
.md-list .list-row-id {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.md-list .list-row-no-id,
.md-list .list-row:not(:has(> .list-row-id)),
.md-list .list-row-wrap {
    grid-template-columns: minmax(0, 1fr) auto;
}

.md-list .list-row.is-selected {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.detail-title {
    margin: 0;
    font-size: var(--fs-xl);
    color: var(--text);
}

.detail-sub {
    margin: var(--space-1) 0 0;
    color: var(--text-muted);
    font-size: var(--fs-md);
}

.detail-section {
    margin-top: var(--space-5);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-subtle);
}

.detail-section-title {
    margin: 0 0 var(--space-3);
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-3) var(--space-4);
    margin: 0;
}

.detail-grid dt {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    margin-bottom: calc(var(--space-1) / 2);
}

.detail-grid dd {
    margin: 0;
    font-size: var(--fs-md);
    color: var(--text);
    overflow-wrap: anywhere;
}

.detail-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
}

/* Compact list inside a detail section: one line each, name first, quiet secondary text, optional actions on the right. */
.detail-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.detail-list > li {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--border-subtle);
    font-size: var(--fs-md);
}

.detail-list > li:last-child {
    border-bottom: none;
}

.detail-list-main {
    flex: 1 1 auto;
    min-width: 0;
}

.detail-list-step {
    flex: 0 0 auto;
    min-width: 28px;
    padding: calc(var(--space-1) / 2) 0;
    border-radius: var(--radius-xs);
    background: var(--accent-soft);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    font-weight: 600;
    text-align: center;
}

.detail-list > li.detail-subpanel-item {
    display: block;
    padding: 0;
    border-bottom: none;
}

.detail-list-actions {
    display: flex;
    gap: var(--space-1);
    flex: 0 0 auto;
}

/* Title on the left, ownership chips at the top right: the same placement as the World Editor detail cards. */
.detail-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
}

.detail-head-end {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.detail-head > :first-child {
    flex: 1 1 auto;
    min-width: 0;
}

.detail-head > :last-child {
    flex: 0 0 auto;
}

/* On a phone the title gets the full width and the chips move under it. */
@media (max-width: 480px) {
    .detail-head {
        flex-wrap: wrap;
    }

    .detail-head > :first-child {
        flex-basis: 100%;
    }
}

/* SessionStartPanel: the one high-contrast block of the detail card, so the eye lands on how to start. */
.start-panel {
    margin-top: var(--space-4);
    padding: var(--space-4);
    border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--accent) 9%, var(--surface-2));
}

.start-panel-title {
    margin: 0 0 var(--space-3);
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--accent-strong);
}

.start-choice {
    margin: 0;
    padding: 0;
    border: none;
    min-width: 0;
}

.start-choice + .start-choice {
    margin-top: var(--space-3);
}

.start-choice-label {
    margin-bottom: var(--space-1);
    padding: 0;
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text-muted);
}

.start-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-2);
}

.start-tile {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 44px;
    margin: 0;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    /* The global label style is a small uppercase caption; a tile reads as a sentence. */
    font-size: var(--fs-base);
    font-weight: 400;
    letter-spacing: normal;
    text-transform: none;
    cursor: pointer;
    transition: border-color var(--dur-fast), background var(--dur-fast);
}

.start-tile:hover {
    border-color: color-mix(in srgb, var(--accent) 60%, var(--border));
}

.start-tile.is-selected {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 1px var(--accent);
}

.start-tile:has(input:focus-visible) {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

.start-tile.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.start-tile-icon {
    display: inline-flex;
    flex: 0 0 auto;
    color: var(--text-muted);
}

.start-tile.is-selected .start-tile-icon {
    color: var(--accent-strong);
}

.start-tile-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.start-tile-hint {
    font-size: var(--fs-sm);
    color: var(--text-muted);
}

.start-panel-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--space-2);
    margin-top: var(--space-4);
}

.detail-subpanel {
    margin: var(--space-2) 0 var(--space-3);
    padding: var(--space-3);
    background: var(--surface-2);
    border-radius: var(--radius);
}

.detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-4);
}

.danger-zone {
    border-color: color-mix(in srgb, var(--critical) 35%, transparent);
}

.danger-zone .detail-section-title {
    color: var(--critical);
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
}

/* Groups the filter input with the filter-popout toggle so the lone "+ New X" button is the only thing on the end side. */
.toolbar-filters {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex: 1 1 auto;
    min-width: 0;
}

.filter-input {
    flex: 1 1 240px;
    max-width: 320px;
    padding: var(--space-2) var(--space-2);
}

.filter-popout-wrap {
    position: relative;
    flex: 0 0 auto;
}

/* The <summary> renders as a .btn (FilterPopout.razor); same list-marker-hiding and custom chevron as MainLayout's account menu. */
.filter-toggle-btn {
    list-style: none;
}

.filter-toggle-btn::-webkit-details-marker {
    display: none;
}

.filter-toggle-btn::after {
    content: ' \25BE';
}

.filter-toggle-badge {
    display: inline-block;
    margin-left: var(--space-1);
    padding: calc(var(--space-1) / 2) var(--space-1);
    border-radius: var(--radius-pill);
    background: var(--accent);
    color: var(--on-accent);
    font-size: var(--fs-xs);
    font-weight: 700;
}

.filter-popout {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: var(--space-1);
    min-width: 260px;
    max-width: 320px;
    /* Fallback only: keeps a very tall popout from running off a short window. */
    max-height: 80vh;
    overflow-y: auto;
    padding: var(--space-2);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-dropdown);
}

.filter-popout-group-title {
    font-family: var(--font-display);
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: var(--space-1);
}

.filter-popout-clear {
    align-self: flex-start;
}

/* Per-group filterable multiselect: selected values render as removable pills inside the input, typing filters the remaining options. */
.ms-combobox {
    position: relative;
}

.ms-input-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1);
    min-height: var(--control-height);
    padding: var(--space-1) var(--space-1);
    /* Matches every plain input's background so MultiSelect looks right beside real <input>s in a .field-row. */
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: text;
}

.ms-input-row:focus-within {
    border-color: var(--accent);
}

.ms-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: calc(var(--space-1) / 2) var(--space-1) calc(var(--space-1) / 2) var(--space-2);
    background: var(--surface-3);
    border-radius: var(--radius-pill);
    font-size: var(--fs-sm);
    color: var(--text);
    white-space: nowrap;
}

.ms-pill-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: var(--fs-md);
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
}

.ms-pill-remove:hover {
    background: var(--border);
    color: var(--text);
}

.ms-search-input {
    flex: 1 1 60px;
    min-width: 60px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: var(--fs-md);
    padding: calc(var(--space-1) / 2) var(--space-1);
}

.ms-search-input:focus {
    outline: none;
}

.ms-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: calc(var(--space-1) / 2);
    /* ~10 rows before scrolling (~30px per row). */
    max-height: 320px;
    overflow-y: auto;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-popover);
}

/* Inside a FilterPopout an open dropdown sits in normal flow, so the popout grows to fit instead of the dropdown being clipped by .filter-popout's overflow:auto (a scrollbar inside a scrollbar).
   MultiSelectCoordinator keeps one dropdown open at a time. Standalone MultiSelects keep the overlay behavior. */
.filter-popout .ms-dropdown {
    position: static;
    margin-top: var(--space-1);
}

.ms-dropdown-option {
    padding: var(--space-1) var(--space-2);
    font-size: var(--fs-sm);
    cursor: pointer;
}

.ms-dropdown-option:hover {
    background: var(--surface-3);
}

.ms-dropdown-empty {
    padding: var(--space-1) var(--space-2);
    font-size: var(--fs-sm);
    color: var(--text-muted);
}

.form-card {
    margin-bottom: var(--space-4);
}

.sim-overrides-card {
    margin: var(--space-1) 0 var(--space-3);
    background: var(--surface-2);
}

.sim-overrides-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: var(--space-2) var(--space-4);
}

.sim-overrides-grid .field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    margin-bottom: 0;
    font-size: var(--fs-sm);
}

.sim-overrides-grid .field input[type="number"] {
    width: 80px;
    text-align: right;
}

/* Usually <div class="field checkbox-field"><label>; a checkbox inside a grid of <label class="field"> cells cannot add a wrapper without breaking the cell count, so label.checkbox-field is supported too. */
.checkbox-field label, label.checkbox-field {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    text-transform: none;
    letter-spacing: normal;
    font-size: var(--fs-md);
    color: var(--text);
}

/* EditorSection.razor: a titled block inside an editor form card. Same surface as the card, so only a border separates it. */
.editor-section {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
}

.editor-section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
}

.editor-section-title {
    margin: 0;
    font-size: var(--fs-base);
}

.editor-section-count {
    padding: 0 var(--space-2);
    border-radius: var(--radius-pill);
    background: var(--surface-3);
    color: var(--text-muted);
    font-size: var(--fs-xs);
    font-weight: 700;
}

.editor-section-head > .btn {
    margin-left: auto;
}

.editor-section-desc {
    margin: var(--space-1) 0 var(--space-3);
    color: var(--text-muted);
    font-size: var(--fs-sm);
}

/* Repeatable rows (spawn flows, legs, points, steps) as one table: column names once, rows --row-gap apart so the gap reads as a thin
   divider, only the table's outer corners rounded. The wrapper is the size container for the narrow-panel card layout below; no
   overflow scroll, which would also clip the header help tips. */
.row-table-wrap {
    container-type: inline-size;
}

.row-table {
    width: 100%;
    font-family: var(--font-display);
    border-collapse: separate;
    border-spacing: 0 var(--row-gap);
}

.row-table th {
    padding: 0 var(--space-2) var(--space-1);
    border: 0;
    text-align: left;
    vertical-align: bottom;
    font-size: var(--fs-sm);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.row-table th .help-tip {
    margin-left: var(--space-1);
}

/* Opens leftwards: a hidden tip still counts as overflow, and one hanging off the last column would make the card scroll sideways. */
.row-table th .help-tip-text {
    left: auto;
    right: 0;
}

.row-table-unit {
    text-transform: none;
    letter-spacing: normal;
    font-weight: 500;
}

.row-table td {
    padding: var(--space-2);
    border: 0;
    background: var(--surface-2);
    vertical-align: middle;
}

/* Never squeeze a field below a readable width. */
.row-table td > .input,
.row-table td > select {
    min-width: 4rem;
}

.row-table tbody tr:first-child td:first-child {
    border-top-left-radius: var(--radius-sm);
}

.row-table tbody tr:first-child td:last-child {
    border-top-right-radius: var(--radius-sm);
}

.row-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: var(--radius-sm);
}

.row-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: var(--radius-sm);
}

/* A multi-line cell stays one control high until dragged taller. */
.row-table textarea.input {
    min-height: var(--control-height);
    resize: vertical;
}

/* Column widths sit on the <th>: route-like pickers get the most room, short numbers a fixed width that follows the font size. */
.row-table .row-table-wide {
    width: 25%;
}

.row-table .row-table-mid {
    width: 15%;
}

.row-table .row-table-narrow {
    width: 5rem;
}

/* Altitude/speed constraints like "^5000" or "v250". */
.row-table .row-table-constraint {
    width: 8rem;
}

/* Row number for ordered lists (route legs, region points). */
.row-table .row-table-index {
    width: 2rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    text-align: right;
}

/* Fields that depend on another column's choice (lesson objective details), side by side inside one cell. */
.row-table-details {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.row-table-details > * {
    flex: 1 1 8rem;
    min-width: 0;
}

.row-table-cell-error {
    display: block;
    margin-top: var(--space-1);
    color: var(--critical);
    font-size: var(--fs-sm);
    font-weight: 600;
}

.row-table .row-table-actions {
    width: 1%;
    white-space: nowrap;
}

.row-table .row-actions {
    display: flex;
    gap: var(--space-1);
}

.row-table-inline {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.row-table-muted {
    color: var(--text-muted);
}

.row-table .row-error {
    padding: var(--space-1) var(--space-2);
    font-size: var(--fs-sm);
}

.row-table .row-table-error td,
.row-table .row-table-expand td {
    background: none;
    padding: 0 0 var(--space-2);
}

/* A narrow panel (phones, or the editor's detail pane on a small laptop): each row becomes a card with its fields stacked, labelled
   from data-label; the column header row is hidden. A container query, so it follows the panel's width, not the screen's. */
@container (max-width: 640px) {
    .row-table,
    .row-table tbody,
    .row-table tr,
    .row-table td {
        display: block;
        width: auto;
    }

    .row-table thead,
    .row-table .row-table-index {
        display: none;
    }

    .row-table .row-table-actions {
        width: auto;
    }

    .row-table .row-table-row {
        margin-bottom: var(--row-gap);
        padding: var(--space-2);
        background: var(--surface-2);
    }

    .row-table tbody tr:first-child {
        border-top-left-radius: var(--radius-sm);
        border-top-right-radius: var(--radius-sm);
    }

    .row-table tbody tr:last-child {
        border-bottom-left-radius: var(--radius-sm);
        border-bottom-right-radius: var(--radius-sm);
    }

    .row-table td,
    .row-table tbody tr td:first-child,
    .row-table tbody tr td:last-child {
        padding: var(--space-1) 0;
        background: none;
        border-radius: 0;
    }

    .row-table td[data-label]::before {
        content: attr(data-label);
        display: block;
        margin-bottom: var(--space-1);
        font-size: var(--fs-sm);
        font-weight: 600;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        color: var(--text-muted);
    }
}

.runways-title {
    margin-top: var(--space-4);
}

/* One physical runway, both ends: three stacked .field-row grids (End 1, End 2, Width/surface/lighting) in one card. */
.runway-row-group {
    padding: var(--space-2);
    background: var(--surface-2);
}

/* Multi-field records that do not fit a table row (runways), stacked like .row-table rows: 2px apart, only the outer corners rounded. */
.row-stack > * + * {
    margin-top: var(--row-gap);
}

.row-stack > :first-child {
    border-top-left-radius: var(--radius-sm);
    border-top-right-radius: var(--radius-sm);
}

.row-stack > :last-child {
    border-bottom-left-radius: var(--radius-sm);
    border-bottom-right-radius: var(--radius-sm);
}

.runway-row-group .field-row {
    margin-bottom: var(--space-2);
}

.runway-end-label {
    font-size: var(--fs-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: var(--space-1);
}

.form-actions {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-4);
}

.form-alert {
    margin-top: var(--space-3);
}

.chip {
    display: inline-block;
    font-family: var(--font-display);
    font-size: var(--fs-2xs);
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: calc(var(--space-1) / 2) var(--space-2);
    border-radius: var(--radius-pill);
    background: var(--surface-3);
    color: var(--text-muted);
}

.chip-error {
    background: color-mix(in srgb, var(--critical) 12%, transparent);
    color: var(--critical);
}

.chip-success {
    background: color-mix(in srgb, var(--success) 12%, transparent);
    color: var(--success);
}

.chip-accent {
    background: color-mix(in srgb, var(--accent) 15%, transparent);
    color: var(--accent-strong);
}

/* Generic pill badges, same shape as .badge-published, for statuses beyond "published". */
.badge-success {
    display: inline-block;
    padding: calc(var(--space-1) / 2) var(--space-2);
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--success) 15%, transparent);
    color: var(--success);
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-warning {
    display: inline-block;
    padding: calc(var(--space-1) / 2) var(--space-2);
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--warning) 15%, transparent);
    color: var(--warning);
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-danger {
    display: inline-block;
    padding: calc(var(--space-1) / 2) var(--space-2);
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--critical) 15%, transparent);
    color: var(--critical);
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* Muted variant for a closed/inactive status that is neither good nor bad (e.g. a Finished class). */
.badge-neutral {
    display: inline-block;
    padding: calc(var(--space-1) / 2) var(--space-2);
    border-radius: var(--radius-pill);
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-purple {
    display: inline-block;
    padding: calc(var(--space-1) / 2) var(--space-2);
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--feature-purple) 15%, transparent);
    color: var(--feature-purple);
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* Admin Users "Payments" pill for an active/trialing subscriber, in Stripe's brand color. */
.badge-stripe {
    display: inline-block;
    padding: calc(var(--space-1) / 2) var(--space-2);
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--stripe-purple) 15%, transparent);
    color: var(--stripe-purple);
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.alert {
    border-radius: var(--radius);
    padding: var(--space-2) var(--space-3);
    font-size: var(--fs-md);
    border: 1px solid transparent;
}

.alert-error, .alert-danger {
    background: color-mix(in srgb, var(--critical) 12%, transparent);
    border-color: color-mix(in srgb, var(--critical) 40%, transparent);
    color: var(--critical);
}

.alert-success {
    background: color-mix(in srgb, var(--success) 12%, transparent);
    border-color: color-mix(in srgb, var(--success) 40%, transparent);
    color: var(--success);
}

/* Full-sentence status pill (Home page empty states): a wide banner, not the tag-sized .badge-success, since it wraps a sentence with an inline link. */
.status-pill {
    display: block;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-pill);
    font-size: var(--fs-md);
    line-height: 1.5;
}

.status-pill-success {
    background: color-mix(in srgb, var(--success) 12%, transparent);
    color: var(--success);
}

/* ChangePassword.razor's password-age warning: warning-toned for "dated, not broken." */
.status-pill-warning {
    background: color-mix(in srgb, var(--warning) 12%, transparent);
    color: var(--warning);
}

/* ChangePassword.razor's always-shown password-age pill: plain informational, like .chip. */
.password-age-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.status-pill a {
    color: inherit;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Ownership pill (OwnershipBadge.razor): three blue/violet tints, one per OwnershipType, a hue family distinct from the status badges because it is a category, not a status. */
.badge-owner {
    display: inline-block;
    padding: calc(var(--space-1) / 2) var(--space-2);
    border-radius: var(--radius-pill);
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-owner-builtin {
    background: color-mix(in srgb, var(--accent) 15%, transparent);
    color: var(--accent-strong);
}

.badge-owner-organization {
    background: color-mix(in srgb, var(--indigo) 16%, transparent);
    color: var(--indigo);
}

.badge-owner-personal {
    background: color-mix(in srgb, var(--violet) 16%, transparent);
    color: var(--violet);
}

/* Curated is gold, not another step in the ownership family: it is a cross-cutting "official, locked" marker that can land on a Built-in original or a user's locked clone (see OwnershipBadge.razor's ShowsCurated). */
.badge-owner-curated {
    background: color-mix(in srgb, var(--gold) 16%, transparent);
    color: var(--gold);
}

.badge-published {
    display: inline-block;
    margin-left: var(--space-1);
    padding: calc(var(--space-1) / 2) var(--space-2);
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--success) 15%, transparent);
    color: var(--success);
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.alert-warning {
    background: color-mix(in srgb, var(--warning) 12%, transparent);
    border-color: color-mix(in srgb, var(--warning) 40%, transparent);
    color: var(--warning);
}

/* WorldEditorWorkspace.razor's workspace banner for OrgAdmins, tinted like .badge-owner-organization / .badge-owner-personal so both read as the same category. */
.alert-workspace {
    margin-bottom: var(--space-3);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
}

.alert-dismiss {
    flex: none;
    background: none;
    border: none;
    padding: 0 calc(var(--space-1) / 2);
    margin: calc(calc(var(--space-1) / 2) * -1) 0 0;
    font-size: var(--fs-xl);
    line-height: 1;
    color: inherit;
    opacity: 0.7;
    cursor: pointer;
}

.alert-dismiss:hover {
    opacity: 1;
}

.alert-workspace-organization {
    background: color-mix(in srgb, var(--indigo) 12%, transparent);
    border-color: color-mix(in srgb, var(--indigo) 40%, transparent);
    color: var(--indigo);
}

.alert-workspace-personal {
    background: color-mix(in srgb, var(--violet) 10%, transparent);
    border-color: color-mix(in srgb, var(--violet) 35%, transparent);
    color: var(--violet);
}

.alert a, .alert button.link-button {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
}

.link-button {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    cursor: pointer;
}

/* CSS-only hide, not @if removal: a static-SSR named form must stay in every render or its postback is rejected (see Login.razor). */
.auth-hidden {
    display: none;
}

.auth-heading {
    font-size: var(--fs-xl);
    font-weight: 700;
    margin: 0 0 var(--space-1);
}

.auth-subheading {
    color: var(--text-muted);
    font-size: var(--fs-sm);
    margin: 0 0 var(--space-5);
}

.auth-form .field {
    margin-bottom: var(--space-4);
}

.auth-checkbox-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: calc(var(--space-1) * -1) 0 var(--space-4);
    font-size: var(--fs-sm);
    color: var(--text-muted);
}

/* Passive-agreement notice under the Google/Microsoft buttons on Register.razor, where no checkbox moment exists. */
.auth-legal-notice {
    margin: var(--space-2) 0 0;
    font-size: var(--fs-sm);
    text-align: center;
    color: var(--text-muted);
}

/* PasskeySubmit.razor's sibling custom element is behavioral only; left in flow it counts as a flex item and shrinks the button by the gap width. display:none keeps its form-association and JS. */
passkey-submit {
    display: none;
}

.auth-checkbox-row input {
    width: auto;
}

.auth-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: var(--space-3);
    font-size: var(--fs-md);
}

.auth-submit:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.auth-submit-hint {
    display: none;
    margin-top: var(--space-2);
    text-align: center;
    font-size: var(--fs-sm);
    color: var(--text-muted);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin: var(--space-5) 0;
    color: var(--text-muted);
    font-size: var(--fs-xs);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.auth-divider::before, .auth-divider::after {
    content: "";
    flex: 1 1 auto;
    height: 1px;
    background: var(--border);
}

/* A row, not a column: a single provider's .auth-oauth-btn fills the row, two or more split it evenly and wrap only when they cannot fit. */
.auth-oauth-row {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.auth-oauth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    flex: 1 1 140px;
    padding: var(--space-2);
    font-size: var(--fs-md);
    font-weight: 600;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
}

.auth-oauth-btn:hover {
    background: var(--surface-3);
    border-color: var(--text-muted);
}

.auth-oauth-btn svg {
    flex: 0 0 auto;
}

.auth-footer {
    margin-top: var(--space-5);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    text-align: center;
    font-size: var(--fs-sm);
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--accent);
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.auth-turnstile {
    margin: var(--space-1) 0 var(--space-4);
    display: flex;
    justify-content: center;
}

.empty-state {
    color: var(--text-muted);
    text-align: center;
    padding: var(--space-6) var(--space-4);
    font-size: var(--fs-md);
}

/* LoadingSpinner.razor: same padding/color rhythm as .empty-state so swapping between loading and content does not jump. */
.loading-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    color: var(--text-muted);
    padding: var(--space-6) var(--space-4);
    font-size: var(--fs-md);
}

.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2.5px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spinner-rotate 0.7s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
    .spinner {
        animation-duration: 1.8s;
    }
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: var(--radius-xs);
}

.sim-shell {
    display: grid;
    /* --console-width is set inline by pages with a drag splitter next to .console-panel (Replay.razor); falls back to 320px. */
    grid-template-columns: 1fr var(--console-width, 320px);
    gap: var(--space-4);
    /* 100vh is the LARGEST iOS Safari viewport, so the shell overflows while browser chrome shows; 100dvh tracks the visible one. A browser without dvh ignores that line and keeps the vh value above. */
    height: calc(100vh - 54px - 48px);
    height: calc(100dvh - 54px - 48px);
    min-height: 600px;
}

/* Stacks the console below the radar on a narrow portrait screen (phones, iPad portrait); the simulator's scope keeps a minimum
   height there (Simulator.razor.css). --console-width is inert once the grid is one column. */
@media (max-width: 900px) and (orientation: portrait) {
    .sim-shell {
        grid-template-columns: 1fr;
        /* Same vh-then-dvh pattern as .sim-shell's height above. */
        grid-template-rows: minmax(50vh, 1fr) auto;
        grid-template-rows: minmax(50dvh, 1fr) auto;
        height: auto;
        min-height: auto;
    }

}

/* A phone in landscape: radar and console side by side, the shell one screen tall (the page header scrolls away) and the console
   scrolling on its own. */
@media (orientation: landscape) and (max-height: 600px) {
    .sim-shell {
        grid-template-columns: 1fr minmax(240px, 38%);
        gap: var(--space-2);
        height: 100vh;
        height: 100dvh;
        min-height: 0;
    }
}

.radar-panel {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    min-width: 0;
}

/* Wraps onto a second row on a narrow screen instead of squeezing the join code group into a column. */
.radar-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--border);
    flex: 0 0 auto;
}

/* Phones and tablets: the tool row (Simulator, Replay) scrolls sideways instead of running out of the clipped radar panel, and its
   dropdowns open as a sheet along the bottom of the screen, since a dropdown inside a scrolling row would be cut off. */
/* A phone keeps the session row (pause, clock, mute, Share, End) on one line. */
@media (max-width: 480px) {
    .radar-toolbar {
        gap: var(--space-2);
        padding: var(--space-2);
    }

    .end-session-word {
        display: none;
    }
}

@media (max-width: 900px), (pointer: coarse) {
    .sim-toolbar {
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
    }

    .sim-toolbar > * {
        flex-shrink: 0;
    }

    .sim-toolbar .settings-menu-wrap > .settings-menu {
        position: fixed;
        top: auto;
        left: var(--space-2);
        right: var(--space-2);
        bottom: var(--space-2);
        width: auto;
        min-width: 0;
        max-width: none;
        max-height: 70vh;
        max-height: 70dvh;
        overflow-y: auto;
        z-index: var(--z-overlay);
    }
}

.sim-clock {
    font-family: var(--font-mono);
    font-size: var(--fs-base);
    font-weight: 700;
    color: var(--accent-strong);
    margin-left: auto;
}

.conn-status {
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-pill);
}

.conn-status.connected {
    color: var(--success);
    background: color-mix(in srgb, var(--success) 14%, transparent);
}

.conn-status.disconnected {
    color: var(--warning);
    background: color-mix(in srgb, var(--warning) 14%, transparent);
}

#radar-canvas {
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    min-height: 0;
    display: block;
    cursor: crosshair;
}

/* Map overlays (simulator, replay and every World Editor map): the pan pad and zoom stack sit in the map's bottom-right corner and
   take their size from the map width (cqw of the map wrapper, an inline-size container) capped by the screen height (svh, for a
   short landscape screen): 28px buttons on a desktop map, up to 44px touch targets on a large touch screen, down to 20px on a
   small one, so they never cover more than a corner of it. Not cqmin: a flex-sized container reports no height to cq units. */
.radar-canvas-wrap,
.editor-preview-canvas-wrap,
.library-preview-map-wrap {
    container-type: inline-size;
}

.pan-controls,
.zoom-controls {
    --map-ctl: clamp(20px, min(7cqw, 4svh), 28px);
    --map-inset: clamp(4px, 2cqw, 12px);
    --map-pad: clamp(2px, 1cqw, var(--space-1));
    position: absolute;
    bottom: var(--map-inset);
    z-index: var(--z-raised);
    gap: calc(var(--map-pad) / 2);
    padding: var(--map-pad);
    background: color-mix(in srgb, var(--surface) 85%, transparent);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: blur(2px);
}

@media (pointer: coarse) {
    .pan-controls,
    .zoom-controls {
        --map-ctl: clamp(20px, min(11cqw, 7svh), 44px);
    }
}

.zoom-controls {
    right: var(--map-inset);
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Left of the zoom stack: its width is one button plus padding and border. */
.pan-controls {
    right: calc(2 * var(--map-inset) + var(--map-ctl) + 2 * var(--map-pad) + 2px);
    display: grid;
    grid-template-columns: repeat(3, var(--map-ctl));
    grid-template-rows: repeat(3, var(--map-ctl));
    grid-template-areas:
        ".    up    ."
        "left .     right"
        ".    down  .";
}

/* A <button>'s default min-size overrides a grid item's stretch, so the size is set on the button itself. */
.pan-btn,
.zoom-btn {
    width: var(--map-ctl);
    height: var(--map-ctl);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: calc(var(--map-ctl) * 0.55);
    font-weight: 700;
    line-height: 1;
}

.pan-up { grid-area: up; }
.pan-left { grid-area: left; }
.pan-right { grid-area: right; }
.pan-down { grid-area: down; }

.zoom-range {
    padding: calc(var(--map-pad) / 2) 0;
    font-family: var(--font-mono);
    font-size: var(--fs-2xs);
    color: var(--text-muted);
    white-space: nowrap;
}

.zoom-btn-reset {
    margin-bottom: calc(var(--map-pad) / 2);
    font-size: calc(var(--map-ctl) * 0.45);
    color: var(--text-muted);
}

.zoom-btn-reset:hover {
    color: var(--accent);
}

.console-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-y: auto;
}

.strip-bay {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    margin-bottom: var(--space-4);
}

.strip {
    display: grid;
    grid-template-columns: 1.4fr 0.8fr 0.6fr 0.6fr 0.8fr;
    gap: var(--space-1);
    align-items: center;
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: var(--space-2) var(--space-2);
    cursor: pointer;
}

.strip:hover {
    border-color: var(--accent);
    background: var(--surface-2);
}

.strip.selected {
    border-left-color: var(--accent-strong);
    background: var(--surface-2);
    outline: 1px solid var(--accent-strong);
}

.strip.conflict {
    border-left-color: var(--critical);
}

.strip.conflict .strip-callsign {
    color: var(--critical);
}

.strip-callsign {
    font-weight: 700;
    color: var(--text);
}

.strip-type, .strip-alt, .strip-speed {
    color: var(--text-muted);
}

.strip-ctl {
    font-size: var(--fs-2xs);
    color: var(--text-muted);
    text-transform: uppercase;
    text-align: right;
}

.blazor-error-boundary {
    background: var(--critical);
    padding: var(--space-4) var(--space-4) var(--space-4) var(--space-4);
    color: var(--on-critical);
    border-radius: var(--radius);
    margin: var(--space-4);
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

#blazor-error-ui {
    background: var(--critical);
    color: var(--on-critical);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--space-3) var(--space-4);
    display: none;
}

#blazor-error-ui .reload {
    color: var(--on-critical);
    text-decoration: underline;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    float: right;
}

/* Created via raw DOM (tutorial.js), outside Blazor's render tree, so scoped component CSS cannot reach it.
   Deliberately does not dim the page (it made the UI hard to read). pointer-events stays none so a click meant for the highlighted element reaches it. tutorial.js keeps the box glued to the target on resize/scroll. */
.atc-tutorial-ring {
    position: fixed;
    z-index: var(--z-modal);
    border-radius: var(--radius-lg);
    border: 3px solid var(--accent);
    background: transparent;
    pointer-events: none;
    transition: top var(--dur-base) ease, left var(--dur-base) ease, width var(--dur-base) ease, height var(--dur-base) ease;
    box-shadow: 0 0 14px 2px color-mix(in srgb, var(--accent) 45%, transparent);
    animation: atc-tutorial-pulse 1.6s ease-in-out infinite;
}

/* Target-less "intro" steps have nothing to ring; the callout is still visible. */
.atc-tutorial-ring.atc-tutorial-ring-full {
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    animation: none;
}

@keyframes atc-tutorial-pulse {
    0%, 100% {
        box-shadow: 0 0 10px 1px color-mix(in srgb, var(--accent) 45%, transparent);
        border-color: var(--accent);
    }
    50% {
        box-shadow: 0 0 20px 4px color-mix(in srgb, var(--accent) 65%, transparent);
        border-color: color-mix(in srgb, var(--accent) 60%, white);
    }
}

@media (prefers-reduced-motion: reduce) {
    .atc-tutorial-ring {
        animation: none;
        box-shadow: 0 0 12px 2px color-mix(in srgb, var(--accent) 40%, transparent);
    }
}

/* Same dim-backdrop language as the tutorial ring: a plain overlay div built via raw DOM, outside Blazor's render tree. */
.idle-timeout-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal-top);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--scrim);
}

.idle-timeout-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-5);
    max-width: 380px;
    box-shadow: var(--shadow-lg);
}

.idle-timeout-card p {
    margin: var(--space-2) 0;
    font-size: var(--fs-md);
    line-height: 1.5;
}

/* Not a blocking overlay: a small pill in the topbar (#signoff-pill-slot, MainLayout.razor). In fullscreen only the fullscreened element is visible, so sign-off-timer.js re-homes the pill onto it as a floating overlay. */
.signoff-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-pill);
    background: var(--warning);
    color: var(--on-warning);
    font-size: var(--fs-sm);
    font-weight: 700;
    white-space: nowrap;
}

/* z-index sits below the Report dialog's .modal-overlay (9000) so they never fight if both are open. */
.signoff-pill-overlay {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: var(--z-overlay);
    box-shadow: var(--shadow-lg);
}

/* Same dim-backdrop language as the tutorial ring/idle-timeout overlay, but plain Blazor markup: it opens and closes within the normal render lifecycle. */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-tour);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--scrim);
    padding: var(--space-4);
}

.modal-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 720px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    /* Flexbug hardening: a flex item's default min-width/min-height is auto, which with a fixed-size canvas plus absolutely-positioned descendants (LibraryPreviewMap) can contribute to runaway canvas dimensions (see radar.js MAX_SANE_CANVAS_DIM_CSS_PX). Harmless for other modals. */
    min-width: 0;
    min-height: 0;
}

.modal-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-4);
    border-bottom: 1px solid var(--border);
}

.modal-card-header .panel-title {
    margin: 0;
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: var(--fs-2xl);
    line-height: 1;
    cursor: pointer;
    padding: 0 var(--space-1);
}

.modal-close-btn:hover {
    color: var(--text);
}

.modal-card-body {
    padding: var(--space-4) var(--space-4);
    overflow-y: auto;
    min-width: 0;
    min-height: 0;
}

.modal-card-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--border);
}

/* Same .modal-card as the Report dialog, narrower. */
.delete-confirm-card {
    max-width: 420px;
}

/* Same .modal-card as the Report dialog, wider: hosts a preview map plus a content list. */
.library-clone-dialog-card {
    max-width: 820px;
}

.library-clone-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-3);
    margin: 0 0 var(--space-3);
    font: var(--fs-sm)/1.3 var(--font-mono);
    color: var(--text-muted);
}

/* Read-only spec sheet (Shared/Editor/Specs): dense label/value tiles, 4 columns, 2 on a phone; nothing in it looks editable. */
.spec-sheet {
    display: grid;
    gap: var(--space-3);
    margin-top: var(--space-3);
    min-width: 0;
}

.spec-group {
    display: grid;
    gap: var(--space-1);
    min-width: 0;
}

.spec-group-title {
    margin: 0;
    font: 600 var(--fs-xs)/1 var(--font-mono);
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.spec-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    /* stylelint-disable-next-line declaration-property-unit-disallowed-list -- the 1px gap is the hairline between cells */
    gap: 1px;
    margin: 0;
    background: var(--border-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.spec-cell {
    display: grid;
    align-content: start;
    gap: var(--space-1);
    min-width: 0;
    padding: var(--space-1) var(--space-2);
    background: var(--surface-2);
}

.spec-cell-wide {
    grid-column: span 2;
}


.spec-cell dt {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.spec-cell dd {
    margin: 0;
    font: 500 var(--fs-md)/1.25 var(--font-mono);
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.spec-unit {
    margin-left: var(--space-1);
    font-size: var(--fs-xs);
    color: var(--text-muted);
}

.spec-empty {
    color: var(--text-muted);
}

.spec-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
}

.spec-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: var(--space-1);
    border-radius: var(--radius-xs);
    vertical-align: -1px;
}

/* Tables inside a spec group span the whole grid and scroll inside the dialog or card. */
.spec-table-wrap {
    max-height: 260px;
    overflow: auto;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
}

.spec-table {
    width: 100%;
    margin: 0;
    font: var(--fs-sm)/1.3 var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.spec-table td,
.spec-table th {
    white-space: nowrap;
}

.spec-details summary {
    cursor: pointer;
    font-size: var(--fs-md);
    color: var(--text-muted);
}

.spec-point-list {
    columns: 3 10ch;
    margin: var(--space-2) 0 0;
    font: var(--fs-sm)/1.5 var(--font-mono);
}

@media (max-width: 520px) {
    .spec-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* The ruleset-override picker at the top of a report dialog, above ScoreBreakdownView's content. */
.report-ruleset-picker {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--border);
}

.report-ruleset-picker label {
    margin-bottom: 0;
}

.report-ruleset-picker select {
    width: auto;
}

.report-student-section {
    margin-top: var(--space-5);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border);
}

/* Delete sits at the far end of a form card's action row, away from Save/Cancel. */
.form-actions-end {
    margin-left: auto;
}

/* Where an item came from (Built-in / Curated / Owned) sits in the top-right corner of the detail card at title size, seen first without interrupting the fields. */
.form-card {
    position: relative;
}

.form-card > .list-row-meta {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    z-index: 1;
    flex-wrap: nowrap;
    justify-content: flex-end;
    margin: 0;
}

.form-card > .list-row-meta .badge-owner,
.form-card > .list-row-meta .badge-published {
    font-size: var(--fs-sm);
}

/* Left menu with titled groups: My Account (ManageLayout) and the player area (SideNav in MainLayout). */
.account-shell {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: var(--space-5);
    align-items: start;
}

.account-sidebar {
    position: sticky;
    top: calc(var(--topbar-h) + 16px);
}

/* The player area's left menu and page sit centred instead of at the left edge of a wide screen. */
.side-shell {
    max-width: 1100px;
    margin-inline: auto;
}

.side-content {
    min-width: 0;
}

.account-nav-group {
    display: flex;
    flex-direction: column;
    gap: calc(var(--space-1) / 2);
}

.account-nav-group + .account-nav-group {
    margin-top: var(--space-4);
}

.account-nav-group-title {
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 var(--space-1) var(--space-1);
}

/* Plain text at rest, a rounded pill for the active page, links indented under their group title. */
.account-nav-link {
    display: block;
    margin-left: var(--space-4);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-pill);
    color: var(--text);
    text-decoration: none;
    font-size: var(--fs-md);
}

.account-nav-link:hover {
    background: var(--surface-2);
}

.account-nav-link.active {
    background: var(--surface-3);
    color: var(--accent-strong);
    font-weight: 600;
}

@media (max-width: 720px) {
    .account-shell {
        grid-template-columns: 1fr;
    }

    .account-sidebar {
        position: static;
    }
}
