:root {
    /* ===== Timing-tower dark palette -- the whole app runs on this, no light mode. =====
       Real timing-tower/broadcast software (WEC/IMSA/F1 timing screens) runs on a near-black
       background so data pops, with brighter accent/status colors than a print-style light UI
       would use for the same hues -- these values are the same brand hues as before, tuned for
       contrast against --bg/--surface instead of white. */
    --bg: #0b0d10;
    --surface: #161a20;
    --surface-raised: #1f242c;
    --border: #2a3038;
    --text: #f2f4f6;
    --text-muted: #9aa4b2;

    /* Deep enough that white text (used everywhere today -- card headers, buttons) stays readable
       on it, per existing convention; --accent below is the separate, brighter "pop" color for
       new dark-native elements (live timing cards, live indicators) where text color isn't inherited from
       an existing text-white/text-dark class. */
    --brand-orange: #c8570f;
    --brand-orange-hover: #de6416;
    --brand-orange-border: #9c4209;
    --accent: #ff8a2b;

    /* Status colors -- one definition per meaning (danger/warning/success/neutral), reused
       everywhere something is "hot"/an error, "hold"/a caution, or "clear"/good, instead of each
       place picking its own slightly-different shade of red/amber/green. Brighter than a
       light-mode palette would use, so they still read clearly against --bg/--surface. */
    --status-danger: #ff4d4d;
    --status-danger-text: #2a0a0a;
    --status-warning: #ffc857;
    --status-warning-text: #3a2a00;
    --status-success: #3ddc84;
    --status-success-text: #06280f;
    --status-neutral: #2a3038;
    --accent-fastest-lap: #a06bff;

    /* Mobile heading scale -- h1/h2/h5 already had ad hoc overrides in the mobile media query
       below; named here and extended to h3/h4/h6 so every heading level shrinks consistently on
       a small screen instead of only some of them. */
    --fs-h1: 1.5rem;
    --fs-h2: 1.3rem;
    --fs-h3: 1.2rem;
    --fs-h4: 1.15rem;
    --fs-h5: 1.1rem;
    --fs-h6: 1rem;

    /* Spacing scale -- mirrors Bootstrap's own spacer steps (0.25/0.5/1/1.5/3rem) so this file's
       handful of custom rules stay on the same rhythm as the Bootstrap utility classes already
       used throughout the markup, instead of introducing their own one-off numbers. */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 1rem;
    --space-4: 1.5rem;
    --space-5: 3rem;
}

.text-warning{
    color: var(--status-warning) !important;
    font-weight: bold;
}

html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text);
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: var(--brand-orange);
}

a:hover, .btn-link:hover {
    color: var(--brand-orange-hover);
}

.bg-primary {
    background-color: var(--brand-orange) !important;
}

.btn-primary {
    color: #fff;
    background-color: var(--brand-orange);
    border-color: var(--brand-orange-hover);
    font-weight: 600;
}

.btn-primary:hover {
    color: #fff;
    background-color: var(--brand-orange-hover);
    border-color: var(--brand-orange-border);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem var(--bg), 0 0 0 0.25rem rgba(255, 138, 43, 0.5);
}

/* Brand Orange Toggle Switch */
.form-check-input:checked {
    background-color: var(--brand-orange);
    border-color: var(--brand-orange-border);
}

/* Readable search input -- a themed-dark box inside a colored card header, instead of the old
   stark-white-on-anything hack, so it reads as part of the dark system rather than a bright hole
   punched in it. */
.search-input-white {
    background-color: var(--surface-raised) !important;
    color: var(--text) !important;
}

.search-input-white::placeholder {
    color: var(--text-muted) !important;
}

.content {
    padding-top: 1.1rem;
}

/* ===== Card-header semantic tiers -- two meanings only, instead of bg-primary/secondary/
   success/danger/dark picked per page with no consistent rule. The single most-live/important
   card on a page gets card-header-primary; every other card gets card-header-secondary. Actual
   status meaning (hot/hold/clear, badges) stays on --status-*, never borrowed for card chrome. */
.card-header-primary {
    background-color: var(--brand-orange);
    color: #fff;
    border-color: var(--brand-orange-border);
}

.card-header-secondary {
    background-color: var(--surface-raised);
    color: var(--text);
    border-color: var(--border);
}

/* ===== Status badges -- so a badge and TrackStatusBanner/live-dot are the same red/amber/green
   instead of raw Bootstrap bg-success/bg-danger/bg-warning rendering a different literal shade. */
.badge-status-danger { background-color: var(--status-danger); color: var(--status-danger-text); }
.badge-status-warning { background-color: var(--status-warning); color: var(--status-warning-text); }
.badge-status-success { background-color: var(--status-success); color: var(--status-success-text); }

/* ===== Podium treatment -- gold/silver/bronze gradient chips, one definition reused everywhere a
   leaderboard shows position (FinishedResultsTable/Cards, Championship standings) instead of each
   picking its own flat bg-warning/bg-secondary/bg-success. */
.podium-gold {
    background: linear-gradient(135deg, #ffe08a, #d4a017);
    color: #3a2a00;
}
.podium-silver {
    background: linear-gradient(135deg, #e7ebef, #a7b0b8);
    color: #23272b;
}
.podium-bronze {
    background: linear-gradient(135deg, #d8975a, #9a5a24);
    color: #2a1608;
}

/* ===== Championship standings (Championship.razor) -- each class gets its own <table> in its own
   CollapsibleCard so classes can be collapsed independently, but that means each table's columns
   were auto-sized from only that class's own content, leaving column boundaries misaligned from
   one class's table to the next when scanning down the page. table-layout: fixed + matching
   explicit widths pins every class's table to the same boundaries; Rounds (last column) is left
   unconstrained to absorb whatever's left. */
.standings-table {
    table-layout: fixed;
}
.standings-table th:nth-child(1), .standings-table td:nth-child(1) { width: 4.5rem; }
.standings-table th:nth-child(2), .standings-table td:nth-child(2) { width: 4.5rem; }
.standings-table th:nth-child(3), .standings-table td:nth-child(3) {
    width: 9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.standings-table th:nth-child(4), .standings-table td:nth-child(4) { width: 5rem; }
.standings-table th:nth-child(5), .standings-table td:nth-child(5) { width: 4rem; }
.standings-table th:nth-child(6), .standings-table td:nth-child(6) { width: 5rem; }

/* Rounds (7th column, unconstrained width) never wraps -- it grows the whole table wider instead
   (see table.standings-table below), and the table's own table-responsive wrapper scrolls it
   horizontally as one unit, same as any other wide table in this app. An inner per-cell scroll was
   tried first and dropped -- it read as a second, hidden scrollbar buried inside the row instead of
   just using the page's own horizontal scroll like everything else. */
.standings-table th:nth-child(7), .standings-table td:nth-child(7) {
    white-space: nowrap;
}

/* Bootstrap's own .table sets width: 100%, which -- combined with table-layout: fixed -- forces
   Rounds's "whatever's left" share to be squeezed to fit inside the container no matter how long
   its content actually is, instead of the table growing to fit it. Plain `width: auto` was tried
   first and made things WORSE: each class gets its own <table> (own CollapsibleCard), so on a wide
   desktop card `auto` shrink-wrapped every table down to only as much as ITS OWN Rounds needed --
   a class with a short Rounds list rendered far narrower than one with a long list, so Pos/Car#/
   Driver/Points no longer lined up between them at all, the exact misalignment table-layout: fixed
   exists to prevent (see this rule block's own opening comment).
   width: max-content with min-width: 100% is the fix: min-width keeps every table at the full card
   width (and thus aligned with its siblings) whenever content fits, which is the common case: only
   when Rounds' actual content is wider than that 100% does max-content win out and grow the table
   past it -- table-responsive's overflow-x: auto (Championship.razor's wrapping div) is what turns
   THAT into a scrollbar, still with no per-cell scroll inside the row. */
table.standings-table {
    width: max-content;
    min-width: 100%;
}

/* Wins/Podiums (nth-child 5/6) are hidden below md (Championship.razor's d-none d-md-table-cell).
   Columns 1-4's widths above were sized assuming a full 7-column desktop table; shrinking them on a
   narrow phone keeps the visible columns from eating the whole screen before Rounds even starts. */
@media (max-width: 768px) {
    .standings-table th:nth-child(1), .standings-table td:nth-child(1) { width: 3rem; }
    .standings-table th:nth-child(2), .standings-table td:nth-child(2) { width: 3rem; }
    .standings-table th:nth-child(3), .standings-table td:nth-child(3) { width: 6rem; }
    .standings-table th:nth-child(4), .standings-table td:nth-child(4) { width: 3.5rem; }
}

/* ===== Tabular/monospace timing data -- real timing towers always do this so digits don't
   jitter column widths as they update live. Deliberately system-font-only, no webfont CDN
   dependency (this app runs trackside on event WiFi/cell signal). */
.tt-numeric {
    font-family: ui-monospace, 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
}

/* ===== Dark-theme overrides for Bootstrap primitives used throughout the app. Bootstrap's own
   components assume a light page by default; rather than reskin every component from scratch,
   override just the surface/border/text colors so `.card`, `.table`, form controls, alerts,
   modals, and list groups render correctly on the dark background everywhere they're used. */
.card {
    background-color: var(--surface);
    border-color: var(--border);
    color: var(--text);
}

.card-header {
    border-color: var(--border);
}

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

.table > :not(caption) > * > * {
    background-color: transparent;
    color: var(--text);
    border-bottom-color: var(--border);
    box-shadow: none;
}

.table-hover > tbody > tr:hover > * {
    background-color: var(--surface-raised);
    color: var(--text);
}

/* Bootstrap's own .table-striped rule sets `color: var(--bs-table-striped-color)` directly on the
   <tr> (a near-black #212529 by default) -- that's inherited by the <td>s beneath it, so a plain
   `color: inherit` on the cell rule above was a no-op here (it just re-affirmed the dark value
   inherited from the row). Override the CSS variable itself so nothing downstream can pick up
   Bootstrap's light-mode default. */
.table-striped {
    --bs-table-striped-color: var(--text);
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(255, 255, 255, 0.03);
}

.table-warning, .table-warning > * {
    background-color: rgba(255, 200, 87, 0.18) !important;
    color: var(--text) !important;
}

.table-secondary, .table-secondary > * {
    background-color: rgba(255, 255, 255, 0.06) !important;
    color: var(--text) !important;
}

.form-control, .form-select {
    background-color: var(--surface-raised);
    border-color: var(--border);
    color: var(--text);
}

.form-control:focus, .form-select:focus {
    background-color: var(--surface-raised);
    color: var(--text);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control:disabled, .form-select:disabled {
    background-color: var(--surface);
    color: var(--text-muted);
}

.form-check-input {
    background-color: var(--surface-raised);
    border-color: var(--border);
}

/* Bootstrap's unchecked switch knob is a translucent BLACK circle baked into an inline SVG
   (rgba(0,0,0,.25)) -- meant to sit on a light track on a light page. On this app's dark theme
   that's a near-black knob on a dark track on a dark card: effectively invisible in its "off"
   state everywhere a toggle appears (Group by Class, mph, etc.). Swap in a light knob instead,
   and brighten the track's border so the whole control reads clearly even before you look at the
   knob position. */
.form-switch .form-check-input {
    border-color: var(--text-muted);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%239aa4b2'/%3e%3c/svg%3e");
}

.input-group-text {
    background-color: var(--surface-raised);
    border-color: var(--border);
    color: var(--text-muted);
}

.alert-info {
    background-color: rgba(93, 169, 255, 0.12);
    border-color: rgba(93, 169, 255, 0.35);
    color: #9cc8ff;
}

.alert-warning {
    background-color: rgba(255, 200, 87, 0.14);
    border-color: rgba(255, 200, 87, 0.4);
    color: var(--status-warning);
}

.alert-success {
    background-color: rgba(61, 220, 132, 0.12);
    border-color: rgba(61, 220, 132, 0.35);
    color: var(--status-success);
}

.alert-danger {
    background-color: rgba(255, 77, 77, 0.12);
    border-color: rgba(255, 77, 77, 0.35);
    color: var(--status-danger);
}

.modal-content {
    background-color: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.modal-header, .modal-footer {
    border-color: var(--border);
}

.modal-backdrop.show {
    opacity: 0.7;
}

.list-group-item {
    background-color: var(--surface);
    border-color: var(--border);
    color: var(--text);
}

.list-group-item-action:hover, .list-group-item-action:focus {
    background-color: var(--surface-raised);
    color: var(--text);
}

.btn-outline-secondary {
    color: var(--text-muted);
    border-color: var(--border);
}

.btn-outline-secondary:hover {
    background-color: var(--surface-raised);
    color: var(--text);
    border-color: var(--border);
}

.btn-light {
    background-color: var(--surface-raised);
    border-color: var(--border);
    color: var(--text);
}

.btn-light:hover {
    background-color: var(--border);
    color: var(--text);
}

.text-muted {
    color: var(--text-muted) !important;
}

code {
    background-color: var(--surface-raised);
    padding: 0.1rem 0.3rem;
    border-radius: 0.25rem;
}

@media (max-width: 768px) {
    .w-mobile-100 {
        width: 100% !important;
    }
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    background: var(--status-warning);
    color: var(--status-warning-text);
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, var(--status-danger);
    padding: var(--space-3) var(--space-3) var(--space-3) 3.7rem;
    color: var(--status-danger-text);
}

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

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: var(--brand-orange);
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: #ff79b0;
}

.table-scroll-container {
    max-height: 500px;
    overflow-y: auto;
    position: relative;
}

.table-scroll-container thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: var(--surface-raised);
    color: var(--text);
}

/* Header labels ("Sector 1", "Car #", etc.) are short but were still wrapping mid-word on narrow
   mobile viewports where a table's columns get squeezed -- the horizontal-scroll container these
   tables already sit in exists precisely so columns don't have to shrink that far; let them scroll
   instead of wrapping. */
.table-responsive thead th {
    white-space: nowrap;
}

@media (max-width: 768px) {
    .table-scroll-container {
        max-height: 350px;
    }

    h1 { font-size: var(--fs-h1); }
    h2 { font-size: var(--fs-h2); }
    h3 { font-size: var(--fs-h3); }
    h4 { font-size: var(--fs-h4); }
    h5 { font-size: var(--fs-h5); }
    h6 { font-size: var(--fs-h6); }

    .content {
        padding-top: var(--space-2);
    }
}

@media (max-width: 576px) {
    .btn-group-sm > .btn {
        padding: 0.25rem 0.4rem;
        font-size: 0.75rem;
    }

    .table td, .table th {
        padding: 0.5rem 0.3rem;
        font-size: 0.85rem;
    }

    .start-line-countdown-value {
        font-size: 3rem;
    }
}

/* Track status banner (#3) */
.track-status-banner {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.85rem 1.25rem;
    border-radius: 0.6rem;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 0.02em;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.track-status-banner i {
    font-size: 1.35rem;
}

/* Track flag colors -- hot=green, hold=yellow, clear=red, matching the physical flag an on-course
   marshal would show and the box's own RGB LED. Class names stay tied to the STATE (hot/hold/clear),
   not the color, so nothing else needs to know which color a state currently means -- only these
   three rules do. */
.track-status-hot {
    background-color: var(--status-success);
    color: var(--status-success-text);
}

.track-status-hold {
    background-color: var(--status-warning);
    color: var(--status-warning-text);
}

.track-status-clear {
    background-color: var(--status-danger);
    color: var(--status-danger-text);
}

.track-status-hot-pulse {
    animation: track-status-glow 1.8s ease-in-out infinite;
}

@keyframes track-status-glow {
    0%, 100% { box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12), 0 0 0 rgba(61, 220, 132, 0); }
    50% { box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12), 0 0 22px rgba(61, 220, 132, 0.6); }
}

/* Start Line's launch countdown -- the only thing on that page the TrackStatusBanner above it
   doesn't already show, so it gets to be the one big, unmissable number on the page instead of a
   plain <h1>. Uses the same green as track-status-hot since it only ever shows while hot. */
.start-line-countdown-label {
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.9rem;
    font-weight: 600;
}

.start-line-countdown-value {
    font-size: 4.5rem;
    font-weight: 700;
    line-height: 1;
    color: var(--status-success);
}

.track-status-reconnecting {
    color: #eee;
    background: repeating-linear-gradient(
        45deg,
        #6c757d,
        #6c757d 12px,
        #5a6268 12px,
        #5a6268 24px
    );
    background-size: 200% 200%;
    animation: track-status-pulse 1.6s ease-in-out infinite;
}

@keyframes track-status-pulse {
    0% { opacity: 0.75; }
    50% { opacity: 1; }
    100% { opacity: 0.75; }
}

/* ===== Live Timing overview cards (LAPS COMPLETED/CARS ON LEAD LAP or ON TRACK/FINISHED, plus
   FASTEST/TOP SPEED) at the top of the busiest live pages -- RaceControl and the public
   Competitors page, rendered by LiveTimingCards.razor. Reuses data already on the page, no new
   fetches. */
.live-timing-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: var(--space-2);
}

.live-timing-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.6rem var(--space-3);
    text-align: center;
}

.live-timing-card-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 700;
}

.live-timing-card-value {
    font-size: 1.85rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--text);
}

.live-timing-card-value-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    min-height: 1.1em;
}

.live-timing-card-live .live-timing-card-value {
    color: var(--accent);
    animation: track-status-pulse 1.6s ease-in-out infinite;
}

/* ===== Branded login screen -- the previous version was bare RemoteAuthenticatorView chrome, no
   logo/card/dark treatment at all despite being the first thing any admin sees. */
.auth-hero {
    min-height: 70vh;
    text-align: center;
}

.auth-hero-logo {
    max-width: 220px;
    height: auto;
}

.auth-hero-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: var(--space-4);
    min-width: 20rem;
    max-width: 90vw;
}

/* "Happening Today" gets real visual weight (elevated/bordered), not just colored label text --
   it's the single most important thing EventSelect communicates. Past is dimmed further so the
   three tiers (Today/Upcoming/Past) are distinguishable without reading each row's date. */
.event-today-item {
    border: 2px solid var(--accent) !important;
    background: rgba(255, 138, 43, 0.08) !important;
}

.event-select-past-label {
    color: var(--text-muted);
    opacity: 0.65;
}

/* "Happening Today" live indicator on EventSelect */
.live-dot {
    display: inline-block;
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background-color: var(--status-danger);
    animation: track-status-pulse 1.6s ease-in-out infinite;
}

/* Toast host (#4) */
.toast-host-container {
    max-width: 92vw;
}

.toast-host-container .toast {
    min-width: 260px;
}

/* Toasts previously applied Bootstrap's "show" class statically in markup, so its own fade
   transition (which needs a separate "fade" class + a later JS-driven class toggle) never
   actually played -- this replaces it with a plain CSS entrance animation that fires once per
   toast when its DOM node is first created (keyed by toast.Id so it doesn't replay on unrelated
   re-renders), no JS interop needed. */
.toast-enter {
    animation: toast-enter-anim 0.25s ease-out;
}

@keyframes toast-enter-anim {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* A "fade in new rows" animation on .table-scroll-container tbody tr / .list-group-flush items was
   tried here and reverted -- verified via a settled (4s-later) screenshot that it kept re-triggering
   on rows containing a LiveDuration (which ticks every second), leaving running-car rows stuck at
   low opacity indefinitely instead of a one-time entrance effect. Not worth chasing the exact
   Blazor-diffing mechanism under time pressure -- correctness on the most-viewed live pages beats
   the cosmetic flourish. The toast-enter animation below doesn't have this problem since toasts
   aren't tied to a ticking timer. */

/* Subtle hover-lift for a tactile, premium feel -- cards and buttons rise slightly rather than
   just recoloring. */
.card {
    transition: box-shadow 0.15s ease-out;
}

/* Shadow-only lift -- deliberately no `transform` here. Modals (DriverDetailModal, RunActions'
   mobile action modal) render as plain DOM descendants of whatever .card contains the row/button
   that opens them (Blazor doesn't portal them to <body>), and the mouse is still hovering that
   ancestor .card at the exact moment a click opens one. A `transform` on a fixed-position element's
   ancestor creates a new containing block for it, so the modal would collapse from full-viewport
   sizing down to that .card's own (much smaller) content box -- reproduced via getComputedStyle():
   .modal's height dropped from the viewport to ~294px, sized to the .card, with the rest of the
   modal's real content (still present in the DOM) invisibly clipped. Box-shadow alone still reads
   as "lifted" without touching layout/positioning context. */
.card:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.btn {
    transition: transform 0.1s ease-out, box-shadow 0.1s ease-out, background-color 0.15s ease-out;
}

.btn:not(:disabled):hover {
    transform: translateY(-1px);
}

/* Run action buttons (#5) - bigger, spaced-out touch targets */
.run-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.run-actions .btn {
    min-width: 3rem;
    min-height: 2.75rem;
    padding: var(--space-2) 0.9rem;
    font-size: 0.95rem;
}

@media (max-width: 576px) {
    .run-actions .btn {
        min-height: 3rem;
        padding: 0.55rem 0.85rem;
        font-size: 1rem;
    }
}

/* ===== Leaflet track map ===== */
.leaflet-track-map {
    width: 100%;
    height: 520px;
}

.track-map-legend {
    background: var(--surface-raised);
    color: var(--text);
}

.track-map-legend .legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.9rem;
}

.track-map-legend .legend-swatch {
    display: inline-block;
    width: 18px;
    height: 8px;
    border-radius: 4px;
}

.track-map-legend .legend-start { background-color: var(--status-success); }
.track-map-legend .legend-split { background-color: var(--brand-orange); }
.track-map-legend .legend-finish { background-color: var(--text); }

/* Numbered gate labels (Leaflet divIcon) */
.leaflet-div-icon.track-gate-label {
    background: transparent;
    border: none;
}

/* Draggable trap pin on the track builder map (Leaflet divIcon) -- see trackbuilder.js */
.leaflet-div-icon.track-builder-badge {
    background: transparent;
    border: none;
}

/* Rover position dot on the track builder map's "use rover position" picker -- see trackbuilder.js */
.leaflet-div-icon.track-builder-rover {
    background: transparent;
    border: none;
}

.track-gate-label span {
    display: inline-block;
    min-width: 20px;
    padding: 1px 6px;
    border-radius: 10px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
    white-space: nowrap;
    box-shadow: 0 0 0 2px #fff;
}

/* Collapsible card header -- dedicated toggle button on the left so header buttons/switches/search
   boxes (bg-* text-white headers especially) stay clickable without also collapsing the card. */
.collapsible-card-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.collapsible-card-header-content {
    flex: 1 1 auto;
    min-width: 0;
}

.card-collapse-toggle {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    background: transparent;
    border: none;
    border-radius: 0.25rem;
    color: inherit;
    padding: 0;
    line-height: 1;
}

.card-collapse-toggle:hover,
.card-collapse-toggle:focus {
    color: inherit;
    background: rgba(255, 255, 255, 0.1);
}

.card-header.card-header-primary .card-collapse-toggle:hover,
.card-header.card-header-primary .card-collapse-toggle:focus {
    background: rgba(0, 0, 0, 0.12);
}

/* ===== Mobile: pin leading identity columns while scrolling wide tables ===== */
@media (max-width: 767.98px) {
    .table-scroll-container th.stick-left,
    .table-scroll-container td.stick-left {
        position: sticky;
        left: 0;
        z-index: 1;
    }

    /* Second pinned column (e.g. Car # after Pos on the results table). */
    .table-scroll-container th.stick-left-2,
    .table-scroll-container td.stick-left-2 {
        position: sticky;
        left: 3.25rem; /* width of the stick-pos-w column */
        z-index: 1;
    }

    /* Fixed width for the first pinned column so the second's offset is deterministic. */
    .table-scroll-container th.stick-pos-w,
    .table-scroll-container td.stick-pos-w {
        min-width: 3.25rem;
        max-width: 3.25rem;
    }

    /* Pinned body cells need an opaque background so scrolled cells don't show through. */
    .table-scroll-container tbody td.stick-left,
    .table-scroll-container tbody td.stick-left-2 {
        background-color: var(--surface);
    }
    .table-scroll-container tbody tr.table-warning td.stick-left,
    .table-scroll-container tbody tr.table-warning td.stick-left-2 {
        background-color: #3a2f14;
    }
    .table-scroll-container tbody tr.table-secondary td.stick-left,
    .table-scroll-container tbody tr.table-secondary td.stick-left-2 {
        background-color: var(--surface-raised);
    }

    /* Pinned header cells must sit ABOVE the other sticky-top headers (z-index 2), which are opaque
       and later in the DOM, or they paint over the pinned header as you scroll horizontally. */
    .table-scroll-container thead th.stick-left,
    .table-scroll-container thead th.stick-left-2 {
        z-index: 3;
        background-color: var(--surface-raised);
    }
}
