/* ═══════════════════════════════════════════════════════════════
   RACE STRATEGY — Organic Futuristic Motorsport Interface
   Layered glass depth, gradient energy, precision data typography
   ═══════════════════════════════════════════════════════════════ */

/* ── Driver Color Palette ─────────────────────── */

.rs-page {
    --rs-d0: #60a5fa;
    --rs-d1: #f07030;
    --rs-d2: #34d399;
    --rs-d3: #a78bfa;
    --rs-d4: #fbbf24;
    --rs-d5: #f87171;
    --rs-glow-spread: 40px;
    --rs-card-bg: rgba(14, 17, 24, 0.65);
    --rs-card-border: rgba(255, 255, 255, 0.06);
    --rs-card-hover: rgba(255, 255, 255, 0.10);
    --rs-inner-bg: rgba(0, 0, 0, 0.25);
    --rs-section-gap: 1.25rem;
}

:root[data-theme="light"] .rs-page {
    --rs-d0: #2563eb;
    --rs-d1: #e05a1a;
    --rs-d2: #059669;
    --rs-d3: #7c3aed;
    --rs-d4: #d97706;
    --rs-d5: #dc2626;
    --rs-card-bg: rgba(255, 255, 255, 0.55);
    --rs-card-border: rgba(0, 0, 0, 0.06);
    --rs-card-hover: rgba(0, 0, 0, 0.10);
    --rs-inner-bg: rgba(0, 0, 0, 0.04);
}

/* ── Page-Level Atmosphere ────────────────────── */

.rs-page {
    position: relative;
}

.rs-page::before {
    content: '';
    position: fixed;
    top: -50%;
    right: -20%;
    width: clamp(280px, 50vw, 600px);
    aspect-ratio: 1 / 1;
    background: radial-gradient(circle, rgba(240, 112, 48, 0.04) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    animation: rs-ambient-drift 20s ease-in-out infinite alternate;
}

.rs-page > * {
    position: relative;
    z-index: 1;
}

@keyframes rs-ambient-drift {
    0%   { transform: translate(0, 0) scale(1); opacity: 0.6; }
    100% { transform: translate(-80px, 60px) scale(1.15); opacity: 0.3; }
}

/* ── Section Headers — Gradient Underline Energy ── */

.rs-page .page-header h1 {
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.rs-page .section h2,
.rs-form-section > h2 {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--text-primary);
    padding-left: 0.85rem;
    position: relative;
    margin-bottom: 1rem;
}

.rs-page .section h2::before,
.rs-form-section > h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.15em;
    bottom: 0.15em;
    width: 3px;
    border-radius: 3px;
    background: linear-gradient(180deg, var(--accent) 0%, var(--rs-d2) 100%);
    box-shadow: 0 0 8px rgba(240, 112, 48, 0.3);
}

/* ── Status Badges — Glowing Indicators ──────── */

.rs-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.2rem 0.7rem;
    border-radius: var(--radius-pill);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border: 1px solid transparent;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.rs-status::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.rs-status-draft {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
}
.rs-status-draft::before { background: var(--text-muted); }

.rs-status-ready {
    background: rgba(96, 165, 250, 0.08);
    border-color: rgba(96, 165, 250, 0.2);
    color: var(--blue);
}
.rs-status-ready::before {
    background: var(--blue);
    box-shadow: 0 0 8px var(--blue);
}

.rs-status-live {
    background: rgba(52, 211, 153, 0.08);
    border-color: rgba(52, 211, 153, 0.25);
    color: var(--green);
}
.rs-status-live::before {
    background: var(--green);
    box-shadow: 0 0 10px var(--green);
    animation: rs-led-pulse 1.5s ease-in-out infinite;
}

.rs-status-finished {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}
.rs-status-finished::before {
    background: var(--text-muted);
    opacity: 0.5;
}

/* ── Live Hero Banner (Index Page) ────────────── */

.rs-live-hero {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    border: 1px solid rgba(52, 211, 153, 0.2);
    border-radius: var(--radius-lg);
    padding: 1.5rem 1.75rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, rgba(52, 211, 153, 0.06) 0%, var(--rs-card-bg) 50%, rgba(96, 165, 250, 0.04) 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 32px rgba(52, 211, 153, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.rs-live-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(52, 211, 153, 0.5), rgba(96, 165, 250, 0.3), transparent);
}

.rs-live-hero::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: clamp(160px, 25vw, 300px);
    aspect-ratio: 1 / 1;
    background: radial-gradient(circle, rgba(52, 211, 153, 0.08) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    animation: rs-ambient-drift 8s ease-in-out infinite alternate;
}

.rs-live-badge {
    background: linear-gradient(135deg, var(--green) 0%, #059669 100%);
    color: #000;
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-sm);
    font-weight: 800;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    animation: rs-led-pulse 1.5s ease-in-out infinite;
    box-shadow: 0 2px 12px rgba(52, 211, 153, 0.35), 0 0 20px rgba(52, 211, 153, 0.15);
    position: relative;
    z-index: 1;
}

.rs-live-info { flex: 1; position: relative; z-index: 1; }
.rs-live-info h2 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    padding-left: 0;
}
.rs-live-info h2::before { display: none; }
.rs-live-meta {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

/* ── Shared Card Treatment — Layered Glass ────── */

.rs-detail-card,
.rs-live-card,
.rs-stat-card,
.rs-form-section {
    background: var(--rs-card-bg);
    border: 1px solid var(--rs-card-border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    position: relative;
    overflow: hidden;
    transition: border-color 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.rs-detail-card::before,
.rs-live-card::before,
.rs-form-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    pointer-events: none;
}

.rs-detail-card:hover,
.rs-live-card:hover,
.rs-form-section:hover {
    border-color: rgba(240, 112, 48, 0.2);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2), 0 0 var(--rs-glow-spread) rgba(240, 112, 48, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transform: translateY(-1px);
}

/* ── Detail Page Grid ─────────────────────────── */

.rs-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(200px, 28vw, 300px), 1fr));
    gap: var(--rs-section-gap);
    margin-bottom: 1.5rem;
}

.rs-detail-card {
    padding: 1.25rem 1.5rem;
}

.rs-detail-card h3 {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 0.85rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.rs-kv {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    padding: 0.3rem 0;
}

.rs-kv-label {
    color: var(--text-secondary);
}

.rs-kv span:last-child {
    font-family: var(--font-mono);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}

.rs-detail-actions {
    display: flex;
    gap: var(--space-sm);
    margin: 1.5rem 0;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

/* ── Config Form — Stepped Sections ──────────── */

.rs-config-form {
    max-width: 920px;
}

.rs-form-section {
    padding: 1.5rem 1.75rem;
    margin-bottom: var(--rs-section-gap);
}

.rs-form-section:hover {
    transform: translateY(-1px);
}

/* Inner field containers — recessed data wells */
.rs-form-section .form-row {
    display: flex;
    gap: var(--space-md);
    margin-bottom: 0.75rem;
}

.rs-form-section .form-group label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
    margin-bottom: 0.35rem;
    display: block;
}

.rs-form-section input[type="text"],
.rs-form-section input[type="number"],
.rs-form-section select {
    width: 100%;
    background: var(--rs-inner-bg);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.88rem;
    font-weight: 500;
    padding: 0.55rem 0.75rem;
    font-variant-numeric: tabular-nums;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.rs-form-section input:focus,
.rs-form-section select:focus {
    outline: none;
    border-color: rgba(240, 112, 48, 0.5);
    box-shadow: 0 0 0 3px rgba(240, 112, 48, 0.1), 0 0 16px rgba(240, 112, 48, 0.06);
    background: rgba(0, 0, 0, 0.35);
}

.rs-form-section input::placeholder {
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-weight: 400;
    font-size: 0.82rem;
}

/* Checkbox styling */
.rs-form-section input[type="checkbox"] {
    width: auto;
    accent-color: var(--accent);
    margin-right: 0.4rem;
}

.rs-form-section label:has(input[type="checkbox"]) {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    background: var(--rs-inner-bg);
    border: 1px solid rgba(255, 255, 255, 0.04);
    transition: background 0.2s ease, border-color 0.2s ease;
}

.rs-form-section label:has(input[type="checkbox"]):hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}

.rs-hint {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 0.85rem;
    padding-left: 0.85rem;
}

.rs-form-actions {
    display: flex;
    gap: var(--space-sm);
    justify-content: flex-end;
    margin-top: 1.75rem;
    padding-top: 1.25rem;
}

/* ── Driver Rows — Color-Coded Cards ─────────── */

.rs-driver-row {
    border: 1px solid var(--rs-card-border);
    border-left: 3px solid var(--rs-d0);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 0.65rem;
    background: rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
    transition: border-color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.rs-driver-row::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 60px;
    background: linear-gradient(90deg, rgba(96, 165, 250, 0.06) 0%, transparent 100%);
    pointer-events: none;
}

.rs-driver-row:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.rs-driver-row:nth-child(2) { border-left-color: var(--rs-d1); }
.rs-driver-row:nth-child(2)::before { background: linear-gradient(90deg, rgba(240, 112, 48, 0.06) 0%, transparent 100%); }
.rs-driver-row:nth-child(3) { border-left-color: var(--rs-d2); }
.rs-driver-row:nth-child(3)::before { background: linear-gradient(90deg, rgba(52, 211, 153, 0.06) 0%, transparent 100%); }
.rs-driver-row:nth-child(4) { border-left-color: var(--rs-d3); }
.rs-driver-row:nth-child(4)::before { background: linear-gradient(90deg, rgba(167, 139, 250, 0.06) 0%, transparent 100%); }
.rs-driver-row:nth-child(5) { border-left-color: var(--rs-d4); }
.rs-driver-row:nth-child(5)::before { background: linear-gradient(90deg, rgba(251, 191, 36, 0.06) 0%, transparent 100%); }
.rs-driver-row:nth-child(6) { border-left-color: var(--rs-d5); }
.rs-driver-row:nth-child(6)::before { background: linear-gradient(90deg, rgba(248, 113, 113, 0.06) 0%, transparent 100%); }

.rs-driver-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
}

.rs-driver-header strong {
    font-size: 0.85rem;
    letter-spacing: 0.02em;
}

.rs-constraints-toggle { margin-top: 0.65rem; }
.rs-constraints-toggle summary {
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
    margin-bottom: 0.5rem;
    padding: 0.35rem 0.6rem;
    border-radius: var(--radius-sm);
    background: var(--rs-inner-bg);
    display: inline-block;
    transition: color 0.2s ease, background 0.2s ease;
}
.rs-constraints-toggle summary:hover {
    color: var(--accent);
    background: rgba(240, 112, 48, 0.06);
}

/* ── Stint Timeline ───────────────────────────── */

.rs-timeline-wrap {
    border: 1px solid var(--rs-card-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    background: var(--rs-card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.rs-timeline-bar {
    display: flex;
    height: 48px;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 0.85rem;
    background: var(--rs-inner-bg);
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.rs-timeline-stint {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
    color: #fff;
    min-width: 28px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    letter-spacing: 0.03em;
    transition: filter 0.2s ease;
}

.rs-timeline-stint:hover {
    filter: brightness(1.15);
}

.rs-timeline-pit {
    width: 2px;
    background: var(--bg-primary);
    flex-shrink: 0;
}

.rs-timeline-legend {
    display: flex;
    gap: var(--space-lg);
    font-size: 0.78rem;
    flex-wrap: wrap;
    color: var(--text-secondary);
}

.rs-legend-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    margin-right: 6px;
    vertical-align: middle;
    box-shadow: 0 0 6px currentColor;
}

/* Driver colors */
.rs-driver-0 { background: var(--rs-d0); }
.rs-driver-1 { background: var(--rs-d1); }
.rs-driver-2 { background: var(--rs-d2); }
.rs-driver-3 { background: var(--rs-d3); }
.rs-driver-4 { background: var(--rs-d4); }
.rs-driver-5 { background: var(--rs-d5); }

.rs-legend-swatch.rs-driver-0 { color: var(--rs-d0); }
.rs-legend-swatch.rs-driver-1 { color: var(--rs-d1); }
.rs-legend-swatch.rs-driver-2 { color: var(--rs-d2); }
.rs-legend-swatch.rs-driver-3 { color: var(--rs-d3); }
.rs-legend-swatch.rs-driver-4 { color: var(--rs-d4); }
.rs-legend-swatch.rs-driver-5 { color: var(--rs-d5); }

/* ── Violations / Warnings — Alert Panels ────── */

.rs-violations {
    border: 1px solid rgba(248, 113, 113, 0.25);
    border-left: 3px solid var(--red);
    border-radius: var(--radius);
    padding: 0.85rem 1.15rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, rgba(248, 113, 113, 0.06) 0%, rgba(248, 113, 113, 0.02) 100%);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.rs-violations h4 {
    color: var(--red);
    margin: 0 0 0.35rem;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.rs-violations ul { margin: 0; padding-left: 1.25rem; font-size: 0.85rem; }

.rs-warnings {
    border: 1px solid rgba(251, 191, 36, 0.25);
    border-left: 3px solid var(--yellow);
    border-radius: var(--radius);
    padding: 0.85rem 1.15rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.06) 0%, rgba(251, 191, 36, 0.02) 100%);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.rs-warnings h4 {
    color: var(--yellow);
    margin: 0 0 0.35rem;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.rs-warnings ul { margin: 0; padding-left: 1.25rem; font-size: 0.85rem; }

/* ── Qualifying Details Toggle ────────────────── */

details.rs-form-section > summary {
    cursor: pointer;
    list-style: none;
    padding: 0;
}
details.rs-form-section > summary::-webkit-details-marker { display: none; }
details.rs-form-section > summary h2 {
    display: inline;
}
details.rs-form-section > summary::before {
    content: '▶';
    font-size: 0.65rem;
    margin-right: 0.5rem;
    color: var(--text-muted);
    transition: transform 0.25s ease;
    display: inline-block;
}
details[open].rs-form-section > summary::before {
    transform: rotate(90deg);
}

/* ═══════════════════════════════════════════════
   LIVE DASHBOARD
   ═══════════════════════════════════════════════ */

/* 3-column grid for top row, full-width below */
.rs-live-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(280px, 30vw, 400px), 1fr));
    gap: var(--rs-section-gap);
    margin-bottom: 1.25rem;
}

.rs-live-grid.rs-vertical {
    grid-template-columns: 1fr;
}

.rs-live-card {
    padding: 1.15rem 1.35rem;
}

.rs-live-card.rs-full {
    grid-column: 1 / -1;
}

.rs-live-card h3 {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 0.85rem;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

/* ── 1. Race Timer ────────────────────────────── */

.rs-timer-display {
    font-family: var(--font-mono);
    font-size: 3.2rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: center;
    letter-spacing: 0.04em;
    color: var(--green);
    line-height: 1.1;
    text-shadow: 0 0 30px rgba(52, 211, 153, 0.3), 0 0 60px rgba(52, 211, 153, 0.1);
    transition: color 0.5s, text-shadow 0.5s;
}

.rs-timer-remaining {
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
    font-variant-numeric: tabular-nums;
}

.rs-timer-progress {
    height: 6px;
    border-radius: 3px;
    background: var(--rs-inner-bg);
    margin-top: 0.85rem;
    overflow: hidden;
}

.rs-timer-progress-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 1s linear, background-color 0.5s;
    box-shadow: 0 0 8px currentColor;
}

/* Connection status dot */
.rs-connection-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    vertical-align: middle;
    margin-left: 6px;
    box-shadow: 0 0 6px var(--green);
    animation: rs-led-pulse 1.5s ease-in-out infinite;
}

.rs-connection-dot.disconnected {
    background: var(--red);
    box-shadow: 0 0 6px var(--red);
    animation: none;
}

/* ── 2. Fuel & Ballast ────────────────────────── */

.rs-fuel-bar-wrap {
    height: 28px;
    border-radius: var(--radius-sm);
    background: var(--rs-inner-bg);
    border: 1px solid rgba(255, 255, 255, 0.04);
    overflow: hidden;
    margin: 0.5rem 0;
}

.rs-fuel-bar {
    height: 100%;
    border-radius: var(--radius-sm);
    transition: width 1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    color: #000;
}

.rs-fuel-ok   {
    background: linear-gradient(90deg, var(--green), #059669);
    box-shadow: 0 0 12px rgba(52, 211, 153, 0.25);
}
.rs-fuel-low  {
    background: linear-gradient(90deg, var(--yellow), #d97706);
    box-shadow: 0 0 12px rgba(251, 191, 36, 0.25);
}
.rs-fuel-critical {
    background: linear-gradient(90deg, var(--red), #dc2626);
    box-shadow: 0 0 12px rgba(248, 113, 113, 0.25);
    animation: rs-fuel-flash 0.8s ease-in-out infinite;
}

/* ── 2b. Fuel Gauge & Ballast Decomposition ───── */

.rs-fuel-gauge-bar {
    height: 1.5rem;
    border-radius: 0.5rem;
    overflow: hidden;
    background: var(--rs-inner-bg);
    border: 1px solid rgba(255, 255, 255, 0.04);
    position: relative;
    margin: 0.5rem 0;
}

.rs-fuel-gauge-fill {
    height: 100%;
    transition: width 1s ease;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    color: #000;
    min-width: fit-content;
    padding: 0 0.5rem;
}

.rs-fuel-gauge-fill.rs-fuel-gauge-green {
    background: linear-gradient(90deg, #22c55e, #059669);
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.25);
}
.rs-fuel-gauge-fill.rs-fuel-gauge-yellow {
    background: linear-gradient(90deg, #f59e0b, #d97706);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.25);
}
.rs-fuel-gauge-fill.rs-fuel-gauge-red {
    background: linear-gradient(90deg, #ef4444, #dc2626);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.25);
    animation: rs-fuel-flash 0.8s ease-in-out infinite;
}

.rs-ballast-decomp {
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.rs-ballast-base {
    color: var(--text-secondary, #94a3b8);
    font-size: 0.85rem;
    font-family: var(--font-mono);
}

.rs-ballast-fuel-offset {
    color: var(--accent-warning, #f59e0b);
    font-size: 0.85rem;
    font-family: var(--font-mono);
}

.rs-ballast-total {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary, #f8fafc);
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.rs-ballast-equals {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.rs-ballast-plus {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.rs-com-badge {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 0.25rem;
    background: var(--rs-inner-bg, #334155);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--text-secondary, #94a3b8);
    font-family: var(--font-mono);
    font-weight: 600;
    letter-spacing: 0.03em;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.rs-pit-speed-badge {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 0.25rem;
    background: linear-gradient(135deg, var(--blue, #3b82f6) 0%, #2563eb 100%);
    color: white;
    font-family: var(--font-mono);
    font-weight: 700;
    letter-spacing: 0.03em;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.2);
}

.rs-next-ballast {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    font-family: var(--font-mono);
}

.rs-stint-fuel-icon {
    display: inline-block;
    font-size: 0.75rem;
    margin-left: 0.35rem;
    vertical-align: middle;
    opacity: 0.7;
}

.rs-stint-fuel-icon.rs-refueled {
    color: var(--green, #22c55e);
    opacity: 1;
}

.rs-stint-fuel-icon.rs-no-refuel {
    color: var(--text-muted);
}

/* ── 3. Active Driver ─────────────────────────── */

.rs-active-driver {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
    letter-spacing: -0.01em;
}

.rs-next-driver {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.rs-next-driver strong { color: var(--text-primary); }

/* ── 4. Stint Timeline (Live) ─────────────────── */

.rs-stint-timeline {
    display: flex;
    gap: 2px;
    height: 40px;
    margin-bottom: 0.6rem;
}

.rs-stint-block {
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    transition: filter 0.2s ease, transform 0.2s ease;
}

.rs-stint-block:hover {
    filter: brightness(1.15);
    transform: scaleY(1.05);
}

.rs-stint-block.rs-stint-planned { opacity: 0.25; }
.rs-stint-block.rs-stint-active {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: -1px;
    animation: rs-led-pulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.15);
}
.rs-stint-block.rs-stint-completed { opacity: 0.75; }

/* ── 5. Stint Log Table ───────────────────────── */

.rs-stint-log {
    width: 100%;
    font-size: 0.85rem;
    border-collapse: separate;
    border-spacing: 0;
}

.rs-stint-log th {
    text-align: left;
    padding: 0.5rem 0.7rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.rs-stint-log td {
    padding: 0.5rem 0.7rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-variant-numeric: tabular-nums;
    font-family: var(--font-mono);
    font-size: 0.82rem;
}

/* Driver color swatch in stint log */
.rs-driver-swatch {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Enhanced active row */
.rs-stint-log tr.rs-active-row {
    background: rgba(96, 165, 250, 0.08);
    box-shadow: inset 3px 0 0 var(--blue);
}

/* Delta coloring */
.rs-delta-positive { color: var(--red); }
.rs-delta-negative { color: var(--green); }

.rs-stint-log tr.rs-completed-row {
    opacity: 0.45;
}

/* ── 6. Driver Bars (Summary) ─────────────────── */

.rs-driver-bars {
    margin-bottom: 0;
}

.rs-driver-bar-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 0.45rem;
}

.rs-driver-bar-name {
    width: 95px;
    font-size: 0.82rem;
    font-weight: 700;
    text-align: right;
    letter-spacing: 0.01em;
}

.rs-driver-bar-track {
    flex: 1;
    height: 20px;
    background: var(--rs-inner-bg);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.rs-driver-bar-fill {
    height: 100%;
    border-radius: var(--radius-sm);
    transition: width 1s ease;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.05);
}

.rs-driver-bar-time {
    width: 58px;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

/* ── 7. TeamTalk ──────────────────────────────── */

.rs-chat-log {
    max-height: 240px;
    overflow-y: auto;
    margin-bottom: 0.7rem;
    font-size: 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: var(--radius);
    padding: 0.75rem;
    background: var(--rs-inner-bg);
}

.rs-chat-log::-webkit-scrollbar { width: 4px; }
.rs-chat-log::-webkit-scrollbar-track { background: transparent; }
.rs-chat-log::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 4px; }

.rs-chat-row {
    padding: 0.3rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}
.rs-chat-row:last-child { border-bottom: none; }

.rs-chat-cat {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-xs);
    background: rgba(255, 255, 255, 0.04);
}

.rs-chat-time {
    float: right;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.rs-chat-input {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.rs-chat-input input,
.rs-chat-input select {
    background: var(--rs-inner-bg);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    padding: 0.45rem 0.65rem;
    transition: border-color 0.2s ease;
}

.rs-chat-input input:focus,
.rs-chat-input select:focus {
    outline: none;
    border-color: rgba(240, 112, 48, 0.4);
}

/* ── 8. Weather Card ──────────────────────────── */

#rs-weather-card .rs-kv {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
    font-size: 0.85rem;
}

#rs-weather-card .rs-kv span:last-child {
    font-family: var(--font-mono);
    font-weight: 600;
}

/* Forecast bar */
.rs-forecast-bar {
    display: flex;
    height: 16px;
    gap: 1px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 0.7rem;
    background: var(--rs-inner-bg);
}

.rs-forecast-hour {
    min-width: 4px;
    border-radius: 2px;
    transition: opacity 0.3s ease;
}

.rs-forecast-hour:hover {
    opacity: 0.8;
}

/* Radar */
#rs-radar-wrap {
    background: var(--rs-inner-bg);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: var(--radius);
}

/* ── Live Action Buttons — Gradient Energy ────── */

.rs-live-actions {
    display: flex;
    gap: var(--space-sm);
    margin: 1.5rem 0;
}

.btn-end-stint,
.btn-reoptimize,
.btn-finish-race {
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0.65rem 1.85rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    letter-spacing: 0.02em;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s ease,
                filter 0.2s ease;
}

.btn-end-stint:active,
.btn-reoptimize:active,
.btn-finish-race:active {
    transform: translateY(0) scale(0.98);
}

.btn-end-stint {
    background: linear-gradient(135deg, var(--red) 0%, #b91c1c 100%);
    color: #fff;
    box-shadow: 0 2px 12px rgba(248, 113, 113, 0.3), 0 0 24px rgba(248, 113, 113, 0.1);
}
.btn-end-stint:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(248, 113, 113, 0.4), 0 0 40px rgba(248, 113, 113, 0.15);
    filter: brightness(1.08);
}

.btn-reoptimize {
    background: linear-gradient(135deg, var(--blue) 0%, #1d4ed8 100%);
    color: #fff;
    box-shadow: 0 2px 12px rgba(96, 165, 250, 0.3), 0 0 24px rgba(96, 165, 250, 0.1);
}
.btn-reoptimize:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(96, 165, 250, 0.4), 0 0 40px rgba(96, 165, 250, 0.15);
    filter: brightness(1.08);
}

.btn-finish-race {
    background: var(--rs-card-bg);
    color: var(--text-primary);
    border: 1px solid var(--rs-card-border);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.btn-finish-race:hover {
    border-color: rgba(240, 112, 48, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* ── Layout Toggle ────────────────────────────── */

.rs-layout-toggle {
    display: flex;
    border: 1px solid var(--rs-card-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: var(--rs-inner-bg);
}

.rs-toggle-btn {
    background: transparent;
    border: none;
    padding: 0.35rem 0.75rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
    cursor: pointer;
    letter-spacing: 0.02em;
    transition: background 0.2s ease, color 0.2s ease;
}

.rs-toggle-btn:hover { background: rgba(255, 255, 255, 0.04); }
.rs-toggle-btn.rs-toggle-active {
    background: linear-gradient(135deg, var(--accent) 0%, #c85a22 100%);
    color: #fff;
    box-shadow: 0 0 10px rgba(240, 112, 48, 0.2);
}

/* ── Pit Window Banner ────────────────────────── */

.rs-pit-banner {
    text-align: center;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    margin-top: 0.7rem;
}

.rs-pit-banner-before { background: rgba(255, 255, 255, 0.04); color: var(--text-muted); }
.rs-pit-banner-open   {
    background: rgba(52, 211, 153, 0.1);
    color: var(--green);
    border: 1px solid rgba(52, 211, 153, 0.2);
    box-shadow: 0 0 12px rgba(52, 211, 153, 0.08);
}
.rs-pit-banner-closing {
    background: rgba(251, 191, 36, 0.1);
    color: var(--yellow);
    border: 1px solid rgba(251, 191, 36, 0.2);
    animation: rs-led-pulse 1s ease-in-out infinite;
}
.rs-pit-banner-closed  {
    background: rgba(248, 113, 113, 0.08);
    color: var(--red);
    border: 1px solid rgba(248, 113, 113, 0.2);
}

/* ═══════════════════════════════════════════════
   SUMMARY PAGE
   ═══════════════════════════════════════════════ */

.rs-summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(120px, 15vw, 180px), 1fr));
    gap: var(--rs-section-gap);
    margin-bottom: 1.75rem;
}

.rs-stat-card {
    text-align: center;
    padding: 1.15rem 0.85rem;
    position: relative;
}

.rs-stat-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    right: 20%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(240, 112, 48, 0.15), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.rs-stat-card:hover::after {
    opacity: 1;
}

.rs-stat-value {
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.rs-stat-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ═══════════════════════════════════════════════
   INDEX PAGE — TABLE ENHANCEMENTS
   ═══════════════════════════════════════════════ */

.rs-page .data-table tbody tr.clickable-row {
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.rs-page .data-table tbody tr.clickable-row:hover {
    background: rgba(240, 112, 48, 0.04);
    box-shadow: inset 3px 0 0 var(--accent);
}

/* ═══════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════ */

@keyframes rs-led-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes rs-fuel-flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.65; }
}

/* ── Stagger Load Animation ──────────────────── */

.rs-form-section,
.rs-live-card,
.rs-stat-card,
.rs-detail-card {
    animation: rs-card-appear 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes rs-card-appear {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rs-form-section:nth-child(1) { animation-delay: 0.05s; }
.rs-form-section:nth-child(2) { animation-delay: 0.1s; }
.rs-form-section:nth-child(3) { animation-delay: 0.15s; }
.rs-form-section:nth-child(4) { animation-delay: 0.2s; }
.rs-form-section:nth-child(5) { animation-delay: 0.25s; }
.rs-form-section:nth-child(6) { animation-delay: 0.3s; }

.rs-live-card:nth-child(1) { animation-delay: 0.05s; }
.rs-live-card:nth-child(2) { animation-delay: 0.1s; }
.rs-live-card:nth-child(3) { animation-delay: 0.15s; }
.rs-live-card:nth-child(4) { animation-delay: 0.2s; }
.rs-live-card:nth-child(5) { animation-delay: 0.25s; }
.rs-live-card:nth-child(6) { animation-delay: 0.3s; }

.rs-stat-card:nth-child(1) { animation-delay: 0.05s; }
.rs-stat-card:nth-child(2) { animation-delay: 0.08s; }
.rs-stat-card:nth-child(3) { animation-delay: 0.11s; }
.rs-stat-card:nth-child(4) { animation-delay: 0.14s; }
.rs-stat-card:nth-child(5) { animation-delay: 0.17s; }
.rs-stat-card:nth-child(6) { animation-delay: 0.2s; }

/* ── Stint Plan Detail — Fuel Toggles & Ballast ── */

.rs-stint-log tr.rs-stint-row-violation {
    background: rgba(248, 113, 113, 0.08);
    box-shadow: inset 3px 0 0 var(--red);
}

.rs-stint-log tr.rs-stint-row-warning {
    background: rgba(251, 191, 36, 0.06);
    box-shadow: inset 3px 0 0 var(--yellow);
}

.rs-stint-log td.rs-fuel-negative {
    color: var(--red);
    font-weight: 700;
}

.rs-ballast-total {
    font-size: 0.88rem;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.rs-ballast-detail {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.rs-stint-log tr.rs-pit-row {
    background: var(--rs-inner-bg);
    border-top: 1px dashed rgba(255, 255, 255, 0.06);
    border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
}

.rs-stint-log .rs-pit-row td {
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
}

.rs-fuel-toggle,
.rs-pit-type-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    vertical-align: middle;
    margin: 0 0.15rem;
}

.rs-fuel-toggle.rs-fuel-on {
    background: rgba(52, 211, 153, 0.12);
    border-color: rgba(52, 211, 153, 0.3);
    color: var(--green);
}

.rs-fuel-toggle.rs-fuel-on:hover {
    background: rgba(52, 211, 153, 0.2);
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.15);
}

.rs-fuel-toggle.rs-fuel-off {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
}

.rs-fuel-toggle.rs-fuel-off:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.rs-pit-type-toggle.rs-pit-type-full {
    background: rgba(96, 165, 250, 0.1);
    border-color: rgba(96, 165, 250, 0.25);
    color: var(--blue);
}

.rs-pit-type-toggle.rs-pit-type-full:hover {
    background: rgba(96, 165, 250, 0.18);
    box-shadow: 0 0 8px rgba(96, 165, 250, 0.12);
}

.rs-pit-type-toggle.rs-pit-type-quick {
    background: rgba(251, 191, 36, 0.1);
    border-color: rgba(251, 191, 36, 0.25);
    color: var(--yellow);
}

.rs-pit-type-toggle.rs-pit-type-quick:hover {
    background: rgba(251, 191, 36, 0.18);
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.12);
}

.rs-import-plan {
    margin: 0.75rem 0 0.5rem;
}

/* ── Window Status Bar ─────────────────────── */
.rs-window-status-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    grid-column: 1 / -1;
}
.rs-window-card {
    padding: 0.75rem;
    border-radius: 6px;
    text-align: center;
    border: 2px solid transparent;
    transition: all 0.3s;
}
.rs-window-card-type {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}
.rs-window-card-status {
    font-weight: 600;
    font-size: 0.95rem;
}
.rs-window-card-countdown {
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
    margin-top: 0.15rem;
}
.rs-window-none {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-color: var(--border);
}
.rs-window-before {
    background: rgba(255, 200, 50, 0.1);
    color: #ffc832;
    border-color: #ffc832;
}
.rs-window-open {
    background: rgba(126, 231, 135, 0.1);
    color: #7ee787;
    border-color: #7ee787;
}
.rs-window-closing {
    background: rgba(255, 166, 87, 0.15);
    color: #ffa657;
    border-color: #ffa657;
    animation: rs-window-pulse 1s infinite;
}
.rs-window-closed {
    background: rgba(248, 81, 73, 0.1);
    color: #f85149;
    border-color: #f85149;
}
@keyframes rs-window-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ── Responsive ───────────────────────────────── */

@media (max-width: 900px) {
    .rs-timer-display {
        font-size: 2.4rem;
    }
    .rs-form-section {
        padding: 1.25rem;
    }
}

@media (max-width: 600px) {
    .rs-timer-display {
        font-size: 1.8rem;
    }
    .rs-stat-value {
        font-size: 1.5rem;
    }
    .rs-live-actions {
        flex-direction: column;
    }
    .rs-form-section {
        padding: 1rem;
    }
    .rs-form-section .form-row {
        flex-direction: column;
        gap: var(--space-xs);
    }
}

/* ── Compact Pit Wall Mode ─────────────────── */
.rs-live-grid.rs-compact {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}
.rs-live-grid.rs-compact > .rs-live-card.rs-full,
.rs-live-grid.rs-compact > #rs-weather-card,
.rs-live-grid.rs-compact > #rs-radar-card {
    display: none;
}
.rs-live-grid.rs-compact > .rs-window-status-bar {
    grid-column: 1 / -1;
    display: grid;
}
.rs-live-grid.rs-compact > .rs-live-card {
    grid-column: span 1;
}

/* ── Fullscreen ────────────────────────────── */
:fullscreen .rs-page-live {
    padding: 1rem;
    background: var(--bg-primary);
}
:fullscreen .page-header h1 {
    font-size: 1.2rem;
}
:fullscreen .rs-live-grid.rs-compact .rs-live-card {
    min-height: auto;
}

/* ── Neutralization (Safety Car) ────────────── */

.rs-btn-sc {
    padding: 0.35rem 0.8rem;
    border: 1px solid rgba(255, 200, 50, 0.3);
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.rs-btn-sc:hover { background: rgba(255, 200, 50, 0.1); }

.rs-btn-sc.rs-btn-sc-active {
    background: rgba(255, 200, 50, 0.2);
    border-color: #ffc832;
    color: #ffc832;
    animation: rs-sc-pulse 1.5s ease-in-out infinite;
}

@keyframes rs-sc-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 200, 50, 0.3); }
    50% { box-shadow: 0 0 12px 4px rgba(255, 200, 50, 0.15); }
}

.rs-sc-banner {
    background: linear-gradient(90deg, rgba(255, 200, 50, 0.15) 0%, rgba(255, 200, 50, 0.08) 100%);
    border: 1px solid rgba(255, 200, 50, 0.3);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    text-align: center;
    font-weight: 700;
    color: #ffc832;
    animation: rs-sc-banner-pulse 2s ease-in-out infinite;
}

@keyframes rs-sc-banner-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.rs-sc-icon {
    display: inline-block;
    background: #ffc832;
    color: #000;
    border-radius: 4px;
    padding: 0 0.4rem;
    margin-right: 0.5rem;
    font-size: 0.85rem;
}

/* ── Intelligence Row ───────────────────────── */

.rs-live-card.rs-intel-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 1rem;
}

.rs-intel-card {
    background: var(--rs-inner-bg);
    border-radius: 8px;
    padding: 0.75rem 1rem;
}

.rs-intel-card h4 {
    margin: 0 0 0.4rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.rs-intel-metric {
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    margin-bottom: 0.25rem;
}

.rs-intel-detail {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.rs-page .rs-ahead { color: var(--green); }
.rs-page .rs-behind { color: var(--red); }
.rs-page .rs-on-plan { color: var(--text-secondary); }
.rs-page .rs-fuel-critical { color: var(--red); font-weight: 700; }
.rs-page .rs-fuel-warning { color: var(--yellow); }

/* ── Alert Toast Strip ──────────────────────── */

.rs-alert-strip {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.rs-alert-toast {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    animation: rs-toast-slide 0.3s ease-out, rs-toast-glow 1.5s ease-out;
    cursor: default;
}

.rs-alert-toast.rs-alert-high {
    background: rgba(248, 81, 73, 0.15);
    border: 1px solid rgba(248, 81, 73, 0.3);
    border-left: 3px solid var(--red);
    color: var(--red);
}

.rs-alert-toast.rs-alert-medium {
    background: rgba(210, 169, 34, 0.15);
    border: 1px solid rgba(210, 169, 34, 0.3);
    border-left: 3px solid var(--yellow);
    color: var(--yellow);
}

.rs-alert-toast.rs-alert-low {
    background: rgba(126, 231, 135, 0.15);
    border: 1px solid rgba(126, 231, 135, 0.3);
    border-left: 3px solid var(--green);
    color: var(--green);
}

/* Dismiss button */
.rs-toast-dismiss {
    margin-left: auto;
    background: none;
    border: none;
    color: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.6;
    transition: opacity 0.15s;
    line-height: 1;
}

.rs-toast-dismiss:hover {
    opacity: 1;
}

@keyframes rs-toast-slide {
    from { transform: translateY(-8px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes rs-toast-glow {
    0% { box-shadow: 0 0 12px rgba(255, 255, 255, 0.15); }
    100% { box-shadow: none; }
}

/* ── Notification Bell ──────────────────────── */

.rs-btn-bell {
    padding: 0.35rem 0.6rem;
    border: 1px solid var(--rs-card-border);
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.85rem;
    transition: opacity 0.2s;
}

.rs-btn-bell.muted { opacity: 0.4; }

/* ── Rival Tracker Panel ────────────────────── */

.rs-rival-add {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    align-items: center;
}

.rs-rival-card {
    background: var(--rs-inner-bg);
    border: 1px solid var(--rs-card-border);
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.5rem;
}

.rs-rival-header {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.2rem;
}

.rs-rival-stats {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.rs-rival-actions {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.rs-page .rs-rival-del {
    color: var(--red);
    margin-left: auto;
}

.btn-xs {
    padding: 0.15rem 0.4rem;
    font-size: 0.7rem;
}

/* ── Alert History ──────────────────────────── */

.rs-alert-history {
    max-height: 200px;
    overflow-y: auto;
    font-size: 0.8rem;
}

/* ── Compact Mode Overrides ─────────────────── */

.rs-live-grid.rs-compact .rs-rivals-panel,
.rs-live-grid.rs-compact .rs-live-card.rs-intel-row,
.rs-live-grid.rs-compact .rs-alert-strip,
.rs-live-grid.rs-compact #rs-alert-history-panel {
    display: none;
}

/* ── Intelligence Row Responsive ────────────── */

@media (max-width: 768px) {
    .rs-live-card.rs-intel-row {
        grid-template-columns: 1fr;
    }
}

/* ── Alert Badge ────────────────────────────── */

.rs-badge {
    display: inline-block;
    background: var(--red, #f85149);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    border-radius: 8px;
    padding: 0 0.3rem;
    min-width: 14px;
    text-align: center;
    vertical-align: top;
    margin-left: 2px;
}

.rs-alert-history-entry {
    display: flex;
    gap: 0.5rem;
    padding: 0.2rem 0;
    border-bottom: 1px solid var(--rs-card-border);
    font-size: 0.8rem;
}

/* ── ChartFrame inside live cards ──────────────── */

.rs-live-card .chart-frame {
    border: none;
    background: transparent;
    margin-top: 0.5rem;
}

.rs-live-card .chart-frame__header {
    padding: 0;
    border-bottom: none;
}

.rs-live-card .chart-frame__title {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.rs-live-card .chart-frame__body {
    min-height: 40px;
}

@media (max-width: 600px) {
    .rs-live-card .chart-frame {
        margin: 0 -0.5rem;
    }
}
