/* =============================================================================
   FDWC — Main Stylesheet
   Dark F1-inspired theme
   ============================================================================= */

/* =============================================================================
   1. CUSTOM PROPERTIES
   ============================================================================= */

:root {
    /* Backgrounds */
    --bg-0:        #0a0a0a;
    /* Alias so inline styles using --border-color also resolve */
    --border-color: #2a2a2a;
    --bg-1:        #111111;
    --bg-2:        #1a1a1a;
    --bg-3:        #242424;
    --bg-4:        #2e2e2e;

    /* Text */
    --text-primary:   #ffffff;
    --text-secondary: #a0a0a0;
    --text-muted:     #555555;

    /* Accents */
    --accent:         #e10600;
    --accent-hover:   #ff1a1a;
    --accent-orange:  #e87722;
    --accent-gold:    #d4af37;

    /* Semantic colours */
    --color-success:  #00c853;
    --color-warning:  #ff8f00;
    --color-danger:   #e10600;
    --color-info:     #0288d1;

    /* Borders */
    --border:         #2a2a2a;
    --border-light:   #3a3a3a;

    /* Level badge colours */
    --level-rookie:   #6c757d;
    --level-amateur:  #0288d1;
    --level-inter:    #7b1fa2;
    --level-semi-pro: #e87722;
    --level-pro:      #e10600;

    /* Layout */
    --container-max:  1200px;
    --nav-height:     64px;
    --radius:         4px;
    --radius-lg:      8px;
    --radius-pill:    999px;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI',
                 Roboto, Helvetica, Arial, sans-serif;
    --font-mono: 'Courier New', Courier, monospace;

    /* Transitions */
    --transition: 0.18s ease;

    /* Shadows */
    --shadow-sm: 0 1px 4px rgba(0,0,0,.4);
    --shadow:    0 2px 12px rgba(0,0,0,.5);
    --shadow-lg: 0 8px 32px rgba(0,0,0,.7);
}

/* =============================================================================
   2. RESET & BASE
   ============================================================================= */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    background-color: var(--bg-0);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9375rem;   /* 15px */
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

img, svg {
    display: block;
    max-width: 100%;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}

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

ul, ol {
    list-style: none;
}

button {
    cursor: pointer;
    font-family: inherit;
}

input, select, textarea, button {
    font-family: inherit;
    font-size: inherit;
}

/* =============================================================================
   3. TYPOGRAPHY
   ============================================================================= */

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.375rem, 3vw, 1.875rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.0625rem; }

p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

small { font-size: 0.8125rem; color: var(--text-secondary); }

.text-muted    { color: var(--text-muted); }
.text-secondary{ color: var(--text-secondary); }
.text-accent   { color: var(--accent); }
.text-success  { color: var(--color-success); }
.text-warning  { color: var(--color-warning); }
.text-danger   { color: var(--color-danger); }

.text-center { text-align: center; }
.text-right  { text-align: right; }

/* =============================================================================
   4. LAYOUT
   ============================================================================= */

.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 1.25rem;
}

.container--narrow {
    max-width: 680px;
}

.section {
    padding: 3rem 0;
}

.section--sm {
    padding: 1.5rem 0;
}

.grid {
    display: grid;
    gap: 1.5rem;
}

.grid--2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.flex          { display: flex; }
.flex-center   { display: flex; align-items: center; }
.flex-between  { display: flex; align-items: center; justify-content: space-between; }
.flex-col      { display: flex; flex-direction: column; }
.gap-sm        { gap: .5rem; }
.gap-md        { gap: 1rem; }
.gap-lg        { gap: 1.5rem; }

/* =============================================================================
   5. NAVIGATION
   ============================================================================= */

.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-1);
    border-bottom: 1px solid var(--border);
    height: var(--nav-height);
}

.nav::after {
    content: '';
    display: block;
    height: 3px;
    background: var(--accent);
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
}

.nav__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--nav-height);
}

/* Logo */
.nav__logo {
    display: flex;
    flex-direction: column;
    line-height: 1;
    text-decoration: none;
    flex-shrink: 0;
}

.nav__logo-main {
    font-size: 1.375rem;
    font-weight: 900;
    letter-spacing: 2px;
    color: var(--text-primary);
    text-transform: uppercase;
}

.nav__logo-sub {
    font-size: 0.6rem;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-top: 2px;
}

.nav__logo:hover .nav__logo-main { color: var(--accent); }

/* Desktop links */
.nav__links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav__link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    letter-spacing: 0.3px;
    transition: color var(--transition), background var(--transition);
    white-space: nowrap;
}

.nav__link:hover,
.nav__link--active {
    color: var(--text-primary);
    background: var(--bg-3);
}

.nav__link--cta {
    background: var(--accent);
    color: #fff !important;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-left: 0.5rem;
}

.nav__link--cta:hover {
    background: var(--accent-hover);
}

/* Hamburger */
.nav__hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
}

.nav__hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 2px;
    transition: transform var(--transition), opacity var(--transition);
}

.nav__hamburger[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.nav__hamburger[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}
.nav__hamburger[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Mobile menu */
.nav__mobile {
    display: none;
    flex-direction: column;
    background: var(--bg-2);
    border-top: 1px solid var(--border);
    padding: 0.75rem 1.25rem 1rem;
    gap: 0.25rem;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    box-shadow: var(--shadow);
}

.nav__mobile.is-open {
    display: flex;
}

.nav__mobile .nav__link {
    padding: 0.6rem 0.75rem;
    font-size: 0.9375rem;
}

/* =============================================================================
   6. HERO
   ============================================================================= */

.hero {
    background: linear-gradient(135deg, var(--bg-1) 0%, #1a0000 100%);
    border-bottom: 1px solid var(--border);
    padding: 4rem 0 3.5rem;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 100px,
        rgba(225,6,0,.03) 100px,
        rgba(225,6,0,.03) 101px
    );
    pointer-events: none;
}

.hero__eyebrow {
    font-size: 0.75rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.hero__title {
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: 900;
    letter-spacing: -0.5px;
    line-height: 1.1;
    margin-bottom: 1rem;
}

.hero__title span { color: var(--accent); }

.hero__subtitle {
    font-size: 1.0625rem;
    color: var(--text-secondary);
    max-width: 520px;
    margin-bottom: 2rem;
}

.hero__actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.hero__layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 3rem;
    align-items: start;
}

.hero__news-panel {
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
}

.hero__news-panel h3 {
    font-size: .7rem;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 700;
    margin-bottom: 1rem;
}

.hero-news-item {
    display: flex;
    gap: .75rem;
    padding: .75rem 0;
    border-bottom: 1px solid rgba(255,255,255,.07);
    text-decoration: none;
    color: inherit;
}
.hero-news-item:last-of-type { border-bottom: none; }
.hero-news-item:hover .hero-news-item__title { color: var(--accent); }

.hero-news-item__thumb {
    width: 56px;
    height: 42px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg-2);
}

.hero-news-item__thumb--placeholder {
    width: 56px;
    height: 42px;
    border-radius: 4px;
    background: var(--bg-2);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.hero-news-item__body { min-width: 0; }

.hero-news-item__title {
    font-size: .8125rem;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.35;
    margin-bottom: .2rem;
    transition: color var(--transition);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.hero-news-item__excerpt {
    font-size: .72rem;
    color: var(--text-muted);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
}

.hero-news-item__read-more {
    font-size: .7rem;
    color: var(--accent);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-top: .3rem;
    display: inline-block;
}

.hero__news-all {
    display: block;
    text-align: center;
    font-size: .75rem;
    color: var(--text-muted);
    padding-top: .75rem;
    margin-top: .5rem;
    border-top: 1px solid rgba(255,255,255,.07);
    text-decoration: none;
}
.hero__news-all:hover { color: var(--accent); }

/* =============================================================================
   7. BUTTONS
   ============================================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    border: 2px solid transparent;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--transition), color var(--transition),
                border-color var(--transition), transform var(--transition);
    white-space: nowrap;
    user-select: none;
}

.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; pointer-events: none; }

/* Primary */
.btn--primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.btn--primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
}

/* Secondary (outlined) */
.btn--secondary {
    background: transparent;
    color: var(--text-primary);
    border-color: var(--border-light);
}
.btn--secondary:hover {
    background: var(--bg-3);
    border-color: var(--text-muted);
    color: var(--text-primary);
}

/* Ghost */
.btn--ghost {
    background: transparent;
    color: var(--accent);
    border-color: transparent;
}
.btn--ghost:hover {
    background: rgba(225,6,0,.1);
    color: var(--accent-hover);
}

/* Danger */
.btn--danger {
    background: var(--color-danger);
    color: #fff;
    border-color: var(--color-danger);
}
.btn--danger:hover {
    background: #c00;
    border-color: #c00;
    color: #fff;
}

/* Sizes */
.btn--sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8125rem;
}

.btn--lg {
    padding: 0.85rem 2rem;
    font-size: 1rem;
    letter-spacing: 1px;
}

.btn--full { width: 100%; }

/* =============================================================================
   8. FORMS
   ============================================================================= */

.form-group {
    margin-bottom: 1.25rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.form-label--required::after {
    content: ' *';
    color: var(--accent);
}

.form-control {
    display: block;
    width: 100%;
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.9375rem;
    padding: 0.65rem 0.9rem;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    -webkit-appearance: none;
    appearance: none;
}

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

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(225,6,0,.18);
}

.form-control:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-control--error {
    border-color: var(--color-danger);
}

.form-control--error:focus {
    box-shadow: 0 0 0 3px rgba(225,6,0,.25);
}

select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23666' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.9rem center;
    padding-right: 2.5rem;
    cursor: pointer;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

.form-error {
    font-size: 0.8125rem;
    color: var(--color-danger);
    margin-top: 0.35rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.75rem;
}

/* =============================================================================
   9. CARDS
   ============================================================================= */

.card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card--accent {
    border-top: 3px solid var(--accent);
}

.card__header {
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.card__title {
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-primary);
}

.card__body {
    padding: 1.5rem;
}

.card__footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--bg-1);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Stat card */
.stat-card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    border-top: 3px solid var(--accent);
}

.stat-card__label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.stat-card__value {
    font-size: 2rem;
    font-weight: 900;
    color: var(--text-primary);
    line-height: 1;
}

.stat-card__sub {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 0.35rem;
}

/* =============================================================================
   10. TABLES
   ============================================================================= */

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table thead {
    background: var(--bg-1);
}

.table th {
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    user-select: none;
}

.table th:hover { color: var(--text-secondary); }

/* Sortable column header: unsorted indicator */
.table th[data-sort-key] {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.table th[data-sort-key]:hover { background: rgba(255,255,255,.04); }
.table th[data-sort-key]::after {
    content: ' ⇅';
    opacity: 0.25;
    font-size: 0.75em;
    font-weight: 400;
}

/* Active sorted column */
.table th.th-sort--active { color: var(--accent); }
.table th[data-sort-key][data-sort="asc"]::after  { content: ' ↑'; opacity: 1; color: var(--accent); }
.table th[data-sort-key][data-sort="desc"]::after { content: ' ↓'; opacity: 1; color: var(--accent); }

/* Sort button for list views (results page race list) */
.sort-btn--active { color: var(--accent) !important; font-weight: 600; }

.table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }

.table tbody tr:nth-child(even) { background: rgba(255,255,255,.02); }

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

/* Position column */
.table .col-pos {
    width: 48px;
    font-weight: 700;
    text-align: center;
    color: var(--text-secondary);
}

.table .col-pos--1 { color: var(--accent-gold); }
.table .col-pos--2 { color: #c0c0c0; }
.table .col-pos--3 { color: var(--accent-orange); }

/* Points column */
.table .col-pts {
    font-weight: 700;
    font-size: 1rem;
    white-space: nowrap;
}

/* Pilot name cell */
.pilot-cell {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    white-space: nowrap;
}

.pilot-cell__flag { font-size: 1.25rem; line-height: 1; }
.pilot-cell__name {
    display: flex;
    flex-direction: column;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
}

.pilot-name {
    display: block;
    font-weight: 600;
    color: #ffffff;
}
.pilot-bga {
    display: block;
    font-size: 0.75em;
    color: #999999;
    margin-top: 1px;
    font-weight: 400;
}

/* Pilot profile link — used in admin tables wherever a name is clickable */
a.pilot-link {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition);
}
a.pilot-link:hover {
    color: var(--accent);
}

/* =============================================================================
   11. BADGES
   ============================================================================= */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-pill);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    white-space: nowrap;
}

/* Level badges */
.badge--rookie    { background: rgba(108,117,125,.2); color: #adb5bd; border: 1px solid #6c757d; }
.badge--amateur   { background: rgba(2,136,209,.15);  color: #4fc3f7; border: 1px solid #0288d1; }
.badge--inter     { background: rgba(123,31,162,.2);  color: #ce93d8; border: 1px solid #7b1fa2; }
.badge--semi-pro  { background: rgba(232,119,34,.15); color: #ffb74d; border: 1px solid #e87722; }
.badge--pro       { background: rgba(225,6,0,.15);    color: #ef9a9a; border: 1px solid #e10600; }

/* Status badges */
.badge--pending  { background: rgba(255,143,0,.15);  color: #ffb74d; border: 1px solid #ff8f00; }
.badge--active   { background: rgba(0,200,83,.15);   color: #69f0ae; border: 1px solid #00c853; }
.badge--banned   { background: rgba(225,6,0,.15);    color: #ef9a9a; border: 1px solid #e10600; }
.badge--closed   { background: rgba(85,85,85,.2);    color: #888;    border: 1px solid #555;    }
.badge--validated{ background: rgba(0,200,83,.15);   color: #69f0ae; border: 1px solid #00c853; }

/* Race result tags */
.badge--dnf { background: rgba(225,6,0,.15);  color: #ef9a9a; border: 1px solid #e10600; }
.badge--dns { background: rgba(85,85,85,.2);  color: #888;    border: 1px solid #555;    }
.badge--wc           { background: rgba(212,175,55,.15);color:#f5cc5a; border: 1px solid #d4af37; }
.badge--registered   { background: rgba(0,176,255,.15);  color:#64d8ff; border: 1px solid #0094cc; }

/* =============================================================================
   12. ALERTS / FLASH MESSAGES
   ============================================================================= */

.alert {
    padding: 0.9rem 1.1rem;
    border-radius: var(--radius);
    border-left: 4px solid;
    margin-bottom: 1.25rem;
    font-size: 0.9375rem;
}

.alert--success {
    background: rgba(0,200,83,.1);
    border-color: var(--color-success);
    color: #69f0ae;
}

.alert--error {
    background: rgba(225,6,0,.1);
    border-color: var(--color-danger);
    color: #ef9a9a;
}

.alert--warning {
    background: rgba(255,143,0,.1);
    border-color: var(--color-warning);
    color: #ffb74d;
}

.alert--info {
    background: rgba(2,136,209,.1);
    border-color: var(--color-info);
    color: #4fc3f7;
}

/* =============================================================================
   13. AUTH PAGES (login, register, forgot/reset)
   ============================================================================= */

.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--nav-height));
    padding: 2rem 1.25rem;
    background: radial-gradient(ellipse at top, #1a0000 0%, var(--bg-0) 65%);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-top: 3px solid var(--accent);
    border-radius: var(--radius-lg);
    padding: 2.25rem;
    box-shadow: var(--shadow-lg);
}

.auth-card__logo {
    display: block;
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: 3px;
    color: var(--text-primary);
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.auth-card__sub {
    font-size: 0.7rem;
    letter-spacing: 2px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 2rem;
}

.auth-card__title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.75rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.auth-card__footer {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-align: center;
}

/* =============================================================================
   14. PAGE HEADER (inside admin/pilot pages)
   ============================================================================= */

.page-header {
    background: var(--bg-1);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 0;
    margin-bottom: 2rem;
}

.page-header__eyebrow,
.stat-eyebrow {
    font-size: 0.7rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.page-header__eyebrow {
    color: var(--accent);
}

.page-header__title {
    font-size: clamp(1.375rem, 3vw, 1.875rem);
    font-weight: 800;
}

.page-header__actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

/* =============================================================================
   15. SIDEBAR LAYOUT (admin)
   ============================================================================= */

.admin-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 0;
    min-height: calc(100vh - var(--nav-height));
}

.admin-sidebar {
    background: var(--bg-1);
    border-right: 1px solid var(--border);
    padding: 1.5rem 0;
    position: sticky;
    top: var(--nav-height);
    height: calc(100vh - var(--nav-height));
    overflow-y: auto;
}

.admin-sidebar__label {
    font-size: 0.65rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    padding: 0.75rem 1.25rem 0.4rem;
}

.admin-sidebar__link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 1.25rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: color var(--transition), background var(--transition),
                border-color var(--transition);
}

.admin-sidebar__link:hover {
    color: var(--text-primary);
    background: var(--bg-3);
}

.admin-sidebar__link--active {
    color: var(--text-primary);
    background: var(--bg-3);
    border-left-color: var(--accent);
    font-weight: 600;
}

.admin-content {
    padding: 2rem;
    max-width: 100%;
    overflow-x: hidden;
}

/* =============================================================================
   16. PAGINATION
   ============================================================================= */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 1.5rem 0;
    flex-wrap: wrap;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 0.5rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    background: var(--bg-2);
    border: 1px solid var(--border);
    transition: all var(--transition);
}

.page-btn:hover { background: var(--bg-3); color: var(--text-primary); }

.page-btn--active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    font-weight: 700;
}

.page-btn--disabled {
    opacity: 0.35;
    pointer-events: none;
}

/* =============================================================================
   17. PODIUM DISPLAY
   ============================================================================= */

.podium {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 0 0;
}

.podium__place {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.podium__flag    { font-size: 1.75rem; }
.podium__name    { font-size: 0.8rem; font-weight: 700; white-space: nowrap; }
.podium__points  { font-size: 0.75rem; color: var(--text-muted); }

.podium__block {
    width: 80px;
    border-radius: var(--radius) var(--radius) 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 900;
    color: rgba(255,255,255,.7);
}

.podium__place--1 .podium__block { height: 80px; background: linear-gradient(180deg, #b8860b, #d4af37); color: #fff; }
.podium__place--2 .podium__block { height: 60px; background: linear-gradient(180deg, #888, #b0b0b0); }
.podium__place--3 .podium__block { height: 48px; background: linear-gradient(180deg, #a0522d, #cd7f32); }

/* =============================================================================
   18. FOOTER
   ============================================================================= */

.footer {
    background: var(--bg-1);
    border-top: 1px solid var(--border);
    padding: 2rem 0;
    margin-top: auto;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.footer__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer__brand {
    font-weight: 700;
    letter-spacing: 2px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.footer__links {
    display: flex;
    gap: 1.25rem;
}

.footer__links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8125rem;
    transition: color var(--transition);
}

.footer__links a:hover { color: var(--text-primary); }

/* =============================================================================
   19. UTILITY CLASSES
   ============================================================================= */

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

.hidden { display: none !important; }

.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.5rem 0;
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
    vertical-align: middle;
}

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

/* =============================================================================
   20. RESPONSIVE
   ============================================================================= */

@media (max-width: 768px) {
    :root { --nav-height: 56px; }

    .nav__links { display: none; }
    .nav__hamburger { display: flex; }

    .admin-layout {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        position: static;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

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

    .hero { padding: 2.5rem 0 2rem; }

    .hero__layout { grid-template-columns: 1fr; gap: 1.5rem; }

    .section { padding: 2rem 0; }

    .footer__inner { flex-direction: column; text-align: center; }

    .auth-card { padding: 1.75rem 1.25rem; }

    .podium__block { width: 64px; }
    .podium__place--1 .podium__block { height: 64px; }
    .podium__place--2 .podium__block { height: 48px; }
    .podium__place--3 .podium__block { height: 36px; }
}

@media (max-width: 480px) {
    .btn--lg { padding: 0.75rem 1.25rem; font-size: 0.9375rem; }
    .card__body { padding: 1.1rem; }
    .admin-content { padding: 1.25rem; }
}

/* =============================================================================
   21. ADDITIONAL BADGE VARIANTS
   ============================================================================= */

/* Generic semantic badges used in results / import pages */
.badge--secondary {
    background: rgba(85,85,85,.2);
    color: #999;
    border: 1px solid #555;
}

.badge--danger {
    background: rgba(225,6,0,.15);
    color: #ef9a9a;
    border: 1px solid #e10600;
}

.badge--warning {
    background: rgba(255,143,0,.15);
    color: #ffb74d;
    border: 1px solid #ff8f00;
}

.badge--success {
    background: rgba(0,200,83,.15);
    color: #69f0ae;
    border: 1px solid #00c853;
}

/* =============================================================================
   22. CODE & PRE
   ============================================================================= */

code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background: var(--bg-3);
    color: var(--text-secondary);
    padding: 0.15em 0.45em;
    border-radius: 3px;
    border: 1px solid var(--border);
}

pre {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: inherit;
}

/* =============================================================================
   23. DETAILS / SUMMARY (import instructions accordion)
   ============================================================================= */

details > summary {
    cursor: pointer;
    user-select: none;
    list-style: none;
}

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

details > summary::before {
    content: '▶ ';
    font-size: .7em;
    color: var(--accent);
    transition: transform var(--transition);
    display: inline-block;
}

details[open] > summary::before {
    transform: rotate(90deg);
}

/* =============================================================================
   24. RESULT POSITION MEDAL COLOURS (standalone, for public pages)
   ============================================================================= */

.pos--gold   { color: var(--accent-gold); }
.pos--silver { color: #c0c0c0; }
.pos--bronze { color: var(--accent-orange); }

/* =============================================================================
   25. ADMIN SIDEBAR RESPONSIVE COLLAPSE
   ============================================================================= */

@media (max-width: 960px) {
    .admin-layout {
        grid-template-columns: 180px 1fr;
    }

    .admin-sidebar__label {
        font-size: .6rem;
        padding: 0.6rem 1rem 0.3rem;
    }

    .admin-sidebar__link {
        padding: 0.5rem 1rem;
        font-size: 0.8125rem;
    }
}

/* =============================================================================
   26. PUBLIC RESULTS / STANDINGS PAGE TWEAKS
   ============================================================================= */

/* Scrollable race list on mobile */
@media (max-width: 768px) {
    /* Stack the race list + detail into a single column */
    .grid--2 {
        grid-template-columns: 1fr;
    }
}

/* =============================================================================
   27. PRINT STYLES (standings / results)
   ============================================================================= */

@media print {
    .nav, .footer, .btn, form, .admin-sidebar { display: none !important; }

    body { background: #fff; color: #000; font-size: 12pt; }

    .card {
        border: 1px solid #ccc;
        box-shadow: none;
        background: #fff;
        page-break-inside: avoid;
    }

    .table th, .table td { border-color: #ccc; }

    .table thead { background: #f0f0f0; }
}

/* =============================================================================
   28. NUMBER INPUTS (race_edit stat tables)
   ============================================================================= */

input[type="number"] {
    margin: 0 2px;
    box-sizing: border-box;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    opacity: 1;
    width: 16px;
}
