/* PitBox – True black, neon red accents, bright white, Eurostyle Extended for main titles */

/* Eurostyle Extended: add .woff2 to static/fonts/ or use local install */
@font-face {
    font-family: 'Eurostyle Extended';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: local('Eurostyle Extended'), local('EurostyleExtended'), local('Eurostyle'),
         url('/fonts/eurostyle-extended.woff2') format('woff2'),
         url('/fonts/eurostyle-extended.woff') format('woff');
}

:root {
    /* Single red across entire controller UI: #FF0000. No other reds. */
    --color-red-primary: #FF0000;
    --color-red-hover: #FF0000;
    --color-red-active: #FF0000;
    --color-red-soft: rgba(255, 0, 0, 0.12);
    --color-red-glow: rgba(255, 0, 0, 0.45);
    --color-red-rgb: 255, 0, 0;
    --bg-black: #000000;
    --bg-dark: #000000;
    --bg-panel: #0d0d0d;
    --bg-sidebar: #000000;
    --bg-page: #000000;
    --text-white: #ffffff;
    --text-gray: #ffffff;
    --text-muted: #f0f0f0;
    --border-gray: #1a1a1a;
    --success-green: #22c55e;
    --idle-blue: #3b82f6;
    --session-yellow: #eab308;
    --offline-gray: #6b7280;
    --font-title: 'Eurostyle Extended', 'Oxanium', 'Segoe UI', sans-serif;
    --font-sans: 'Oxanium', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-mono: ui-monospace, 'Cascadia Code', 'Consolas', monospace;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 10px;
}

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

body {
    background: var(--bg-black);
    color: var(--text-white);
    font-family: var(--font-sans);
    font-weight: 400;
    min-height: 100vh;
    display: flex;
}

/* Sidebar */
.sidebar {
    width: 260px;
    min-height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-gray);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
.sidebar-header {
    padding: 20px 16px 16px;
    border-bottom: 1px solid var(--border-gray);
}
.sidebar-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-white);
    letter-spacing: 0.02em;
}
.sidebar-footer {
    padding: 16px 12px 20px;
    border-top: 1px solid var(--border-gray);
    margin-top: auto;
}
.update-available-badge {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-red-primary);
    background: var(--color-red-soft);
    padding: 6px 10px;
    border-radius: 6px;
    text-align: center;
    display: block;
}
.update-available-badge.hidden { display: none; }
/* Sidebar collapse toggle button */
.sidebar-toggle-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    margin-top: 10px;
    padding: 7px 10px;
    background: transparent;
    border: 1px solid var(--border-gray);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.sidebar-toggle-btn:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-white);
}
.sidebar-toggle-btn svg { flex-shrink: 0; transition: transform 0.2s; }
/* Collapsed state */
.sidebar--collapsed {
    width: 60px;
}
.sidebar--collapsed .nav-label,
.sidebar--collapsed .sidebar-logo,
.sidebar--collapsed .sidebar-toggle-label,
.sidebar--collapsed .update-available-badge {
    display: none;
}
.sidebar--collapsed .nav-link {
    justify-content: center;
    padding: 10px;
}
.sidebar--collapsed .sidebar-toggle-btn {
    justify-content: center;
    padding: 7px;
}
.sidebar--collapsed .sidebar-toggle-btn svg {
    transform: rotate(180deg);
}

.sidebar-nav {
    flex: 1;
    padding: 12px 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.sidebar-nav .nav-link {
    border-radius: 10px;
}
.sidebar-nav .nav-link.active {
    background: var(--color-red-primary);
    color: #fff;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-gray);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-white);
}

.nav-link.active {
    background: var(--color-red-primary);
    color: #fff;
    border-left: none;
    margin-left: 0;
    padding-left: 16px;
    border-radius: 10px;
}

.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    opacity: 0.95;
}
.nav-icon svg {
    width: 18px;
    height: 18px;
    display: block;
}


/* Main content */
.main-content {
    flex: 1;
    min-width: 0;
    min-height: 0;
    padding: 24px 32px 32px;
    display: flex;
    flex-direction: column;
}

.page-header {
    margin-bottom: 24px;
}

.page-title {
    font-family: var(--font-title);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-white);
    margin-bottom: 4px;
}

.page-subtitle {
    font-size: 0.9rem;
    color: var(--text-gray);
}

.server-scoped-empty {
    background: var(--bg-panel);
    border: 1px solid var(--border-gray);
    border-radius: 8px;
    padding: 24px;
    margin-top: 16px;
    max-width: 480px;
}
.server-scoped-empty p { margin: 0 0 12px 0; color: var(--text-gray); }
.server-scoped-empty p:last-of-type { margin-bottom: 0; }
.server-scoped-select-label { display: block; font-size: 0.9rem; color: var(--text-gray); margin-bottom: 6px; }
.server-scoped-select {
    min-width: 200px;
    padding: 8px 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border-gray);
    border-radius: 4px;
    color: var(--text-white);
    font-size: 0.95rem;
}
.nav-link-inline { color: var(--color-red-primary); text-decoration: none; }
.nav-link-inline:hover { text-decoration: underline; }

/* Stats row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-gray);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: var(--bg-dark);
    color: var(--text-muted);
}

.stat-icon-online {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success-green);
}

.stat-icon-running {
    background: rgba(var(--color-red-rgb), 0.15);
    color: var(--color-red-primary);
}

.stat-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-white);
}

.stat-online {
    color: var(--success-green);
}

.stat-value-running {
    color: var(--color-red-primary);
}

/* Connection banner */
.connection-banner {
    background: rgba(var(--color-red-rgb), 0.1);
    border: 1px solid var(--color-red-primary);
    border-radius: 6px;
    padding: 12px 20px;
    margin-bottom: 24px;
    color: var(--text-white);
    font-size: 0.9rem;
}

.connection-banner code {
    background: var(--bg-panel);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
}

.connection-banner.hidden {
    display: none;
}

/* Remote-access-disabled banner (no employee_password set, remote client) */
.remote-access-banner {
    background: rgba(234, 179, 8, 0.1);
    border: 1px solid var(--session-yellow);
    border-radius: 6px;
    padding: 12px 20px;
    margin-bottom: 24px;
    color: var(--text-white);
    font-size: 0.9rem;
}
.remote-access-banner strong {
    color: var(--session-yellow);
}
.remote-access-banner code {
    background: var(--bg-panel);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
    font-family: var(--font-mono);
}
.remote-access-banner-link {
    color: var(--session-yellow);
    font-weight: 600;
    text-decoration: underline;
}
.remote-access-banner.hidden { display: none; }
.pitbox-operator-login-banner .pitbox-operator-banner-msg {
    margin-right: 4px;
}

a.pitbox-operator-banner-signin {
    display: inline-block;
    margin-left: 8px;
    padding: 6px 14px;
    border-radius: 6px;
    font-weight: 600;
    text-decoration: none;
    background: var(--color-red-primary);
    color: #fff;
}

a.pitbox-operator-banner-signin:hover {
    filter: brightness(1.08);
    color: #fff;
}

/* Enrollment Mode toggle + countdown */
.enrollment-settings-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.enrollment-settings-wrap .enrollment-toggle-wrap {
    margin: 0;
}
.enrollment-section {
    background: var(--bg-panel);
    border: 1px solid var(--border-gray);
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 20px;
}
.enrollment-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 8px;
}
.enrollment-toggle-wrap {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}
.enrollment-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-white);
}
.enrollment-toggle {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.enrollment-switch {
    display: inline-block;
    width: 44px;
    height: 24px;
    background: var(--bg-dark);
    border: 1px solid var(--border-gray);
    border-radius: 12px;
    position: relative;
    transition: background 0.2s, border-color 0.2s;
}
.enrollment-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: transform 0.2s, background 0.2s;
}
.enrollment-toggle:checked + .enrollment-switch {
    background: var(--accent-green);
    border-color: var(--accent-green);
}
.enrollment-toggle:checked + .enrollment-switch::after {
    transform: translateX(20px);
    background: #fff;
}
.enrollment-countdown {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-green);
    font-variant-numeric: tabular-nums;
}
.enrollment-countdown.hidden {
    display: none;
}
.enrollment-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}
.enrollment-hint code {
    background: var(--bg-dark);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
}

/* Discover sims on LAN (enrollment) */
.discovery-section {
    background: var(--bg-panel);
    border: 1px solid var(--border-gray);
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 20px;
}
.discovery-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.discovery-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-white);
    margin: 0;
}
.discovery-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
    flex: 1;
    min-width: 200px;
}
.discovery-hint code {
    background: var(--bg-dark);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
}
.discovered-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.discovered-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border-gray);
    border-radius: 6px;
    font-size: 0.9rem;
}
.discovered-item .agent-id { font-weight: 600; color: var(--text-white); }
.discovered-item .agent-host { color: var(--text-gray); }
.discovered-item .btn-add-agent {
    padding: 4px 10px;
    font-size: 0.8rem;
}

/* Only the active content page is visible; others are hidden (!important overrides ID rules) */
.content-page.hidden {
    display: none !important;
}
.content-page:not(.hidden) {
    display: flex !important;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.config-page-body {
    margin-top: 1rem;
    max-width: 720px;
}
.config-path {
    font-size: 0.9rem;
    color: var(--text-gray);
    margin-bottom: 0.5rem;
}
.config-path code {
    color: var(--color-red-primary);
}
.config-version {
    font-size: 0.9rem;
    color: var(--text-gray);
    margin-bottom: 0.5rem;
}
.updates-notes-wrap {
    margin: 1rem 0;
}
.updates-notes {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
    padding: 12px;
    background: var(--bg-dark);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-gray);
}
.updates-error {
    color: var(--color-red-primary);
    font-size: 0.9rem;
    margin: 0.5rem 0;
}
.updates-apply-btn {
    margin-top: 1rem;
}
.updates-unable {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0.5rem 0;
}
.updates-latest-known {
    color: var(--text-muted);
    font-size: 0.9em;
}
.settings-tabs {
    display: flex;
    gap: 0;
    margin: 1rem 0;
    border-bottom: 1px solid var(--border-gray);
}
.settings-tab {
    padding: 8px 16px;
    background: transparent;
    border: none;
    color: var(--text-gray);
    font-size: 0.9rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.settings-tab:hover {
    color: var(--text-white);
}
.settings-tab.settings-tab-active {
    color: var(--color-red-primary);
    border-bottom-color: var(--color-red-primary);
}
.settings-panel {
    margin-top: 1rem;
    max-width: 720px;
}
.settings-config-main .config-form-row {
    margin-bottom: 1rem;
}
.settings-config-main .config-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-gray);
    margin-bottom: 0.35rem;
}
.settings-config-main .config-input {
    width: 100%;
    max-width: 12rem;
    padding: 6px 10px;
    font-size: 0.9rem;
    background: var(--bg-panel);
    border: 1px solid var(--border-gray);
    border-radius: var(--radius-sm);
    color: var(--text-white);
}
.settings-config-main .config-input-num { max-width: 6rem; }
.settings-config-main .config-input-wide { max-width: 100%; }
.settings-config-main .config-save-btn {
    margin-top: 0.25rem;
}
.settings-config-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
}
.config-section {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-gray);
}
.config-section:last-child { border-bottom: none; margin-bottom: 16px; }
.config-section-heading {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin: 0 0 12px 0;
}
.config-hint-inline {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}
.settings-access-segmented {
    display: inline-flex;
    border: 1px solid var(--border-gray);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.settings-access-opt {
    padding: 6px 14px;
    font-size: 0.9rem;
    background: var(--bg-panel);
    border: none;
    color: var(--text-gray);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.settings-access-opt:hover {
    color: var(--text-white);
    background: rgba(255, 255, 255, 0.06);
}
.settings-access-opt.settings-access-opt-active {
    background: var(--color-red-primary);
    color: var(--text-white);
}
.settings-advanced-wrap {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-gray);
}
.settings-advanced-toggle {
    background: none;
    border: none;
    color: var(--text-gray);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 4px 0;
    display: flex;
    align-items: center;
    gap: 4px;
}
.settings-advanced-toggle:hover {
    color: var(--text-white);
}
.settings-advanced-chevron {
    font-size: 0.75rem;
    transition: transform 0.2s;
}
.settings-advanced-content {
    margin-top: 0.75rem;
}
.settings-advanced-content .config-form-row {
    margin-bottom: 1rem;
}
.settings-advanced-content .config-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-gray);
    margin-bottom: 0.35rem;
}
.settings-advanced-content .config-input {
    width: 100%;
    max-width: 100%;
    padding: 6px 10px;
    font-size: 0.9rem;
    background: var(--bg-panel);
    border: 1px solid var(--border-gray);
    border-radius: var(--radius-sm);
    color: var(--text-white);
}
.settings-updates-main {
    margin-top: 0.5rem;
}
.settings-updates-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}
.settings-updates-label {
    min-width: 7rem;
    color: var(--text-muted);
}
.settings-updates-muted {
    font-size: 0.85em;
    color: var(--text-muted);
}
.settings-updates-meta {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0.25rem 0;
}
.settings-updates-hint {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}
.pill-up-to-date,
.pill-update-available {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}
.pill-up-to-date {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success-green, #22c55e);
    border: 1px solid rgba(34, 197, 94, 0.4);
}
.pill-update-available {
    background: rgba(var(--color-red-rgb), 0.12);
    color: var(--color-red-primary);
    border: 1px solid var(--color-red-glow);
}
.updates-status-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.updates-versions {
    font-size: 0.95rem;
    color: var(--text-gray);
}
.updates-actions {
    margin-bottom: 1rem;
}
.updates-actions .updates-apply-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.updates-dev-pull-area {
    margin-top: 1.5rem;
    padding-top: 1rem;
}
.updates-dev-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}
.updates-dev-divider::before,
.updates-dev-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-gray);
}
.updates-dev-pull-btn {
    width: 100%;
}
.updates-dev-repo-row {
    margin-bottom: 0.5rem;
}
.updates-push-agents-area {
    margin-top: 1.5rem;
    padding-top: 1rem;
}
.updates-push-agents-result {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.updates-push-agents-result.hidden { display: none; }
.push-agents-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.85rem;
    padding: 0.3rem 0;
    border-bottom: 1px solid var(--border-gray);
}
.push-agents-row:last-child { border-bottom: none; }
.push-agents-icon { font-weight: 700; width: 1rem; flex-shrink: 0; }
.push-agents-ok .push-agents-icon { color: #4ade80; }
.push-agents-err .push-agents-icon { color: var(--color-red-primary, #ef4444); }
.push-agents-id { font-weight: 600; min-width: 5rem; flex-shrink: 0; }
.push-agents-msg { color: var(--text-muted); flex: 1; }
.push-agents-none { font-size: 0.85rem; color: var(--text-muted); margin: 0; }
/* ── Sim update status table ─────────────────────────────────── */
.updates-sim-status-table {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0;
    font-size: 0.85rem;
    border: 1px solid var(--border-gray);
    border-radius: 6px;
    overflow: hidden;
}
.updates-sim-status-table.hidden { display: none; }
/* ── Agent Updates section controls ──────────────────────────── */
.updates-agent-updates-area { margin-top: 1rem; }
.updates-version-selector-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}
.updates-version-label { font-size: 0.85rem; color: var(--text-muted); flex-shrink: 0; }
.updates-version-select {
    flex: 1;
    min-width: 10rem;
    max-width: 22rem;
    padding: 0.3rem 0.5rem;
    background: var(--bg-secondary, #1e2028);
    border: 1px solid var(--border-gray);
    border-radius: 4px;
    color: var(--text-primary, #f0f0f0);
    font-size: 0.85rem;
}
.updates-releases-hint { font-size: 0.78rem; color: var(--text-muted); }
.updates-agent-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.6rem;
    align-items: center;
}
/* ── Sim update status table ─────────────────────────────────── */
.sim-upd-row {
    display: grid;
    grid-template-columns: 1.5rem 7rem 8rem 7rem 1fr;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.6rem;
    border-bottom: 1px solid var(--border-gray);
}
.sim-upd-row:last-child { border-bottom: none; }
.sim-upd-header {
    background: var(--bg-secondary, #1e2028);
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
}
.sim-upd-col { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sim-upd-col-chk { display: flex; align-items: center; justify-content: center; }
.sim-upd-col-rig { font-weight: 600; display: flex; align-items: center; gap: 0.35rem; }
.sim-upd-col-ver { color: var(--text-muted); }
.sim-upd-col-info { color: var(--text-muted); font-size: 0.8rem; }
.sim-upd-target { color: var(--accent-primary, #7c6af5); font-weight: 600; }
.sim-upd-err-text { color: var(--color-red-primary, #ef4444); font-size: 0.78rem; }
.sim-upd-dot {
    width: 0.5rem; height: 0.5rem;
    border-radius: 50%;
    flex-shrink: 0;
}
.sim-upd-dot-online  { background: #4ade80; }
.sim-upd-dot-offline { background: var(--text-muted); }
/* Status badge */
.sim-upd-badge {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 3px;
    font-size: 0.76rem;
    font-weight: 600;
    white-space: nowrap;
}
.sim-upd-idle    { background: rgba(74,222,128,.12); color: #4ade80; }
.sim-upd-pending { background: rgba(251,191,36,.14); color: #fbbf24; }
.sim-upd-busy    { background: rgba(124,106,245,.14); color: var(--accent-primary, #7c6af5); }
.sim-upd-failed  { background: rgba(239,68,68,.13); color: var(--color-red-primary, #ef4444); }
.sim-upd-offline { background: rgba(100,100,120,.13); color: var(--text-muted); }
/* Small buttons */
.btn-xs, .btn-secondary-xs {
    padding: 0.15rem 0.55rem;
    font-size: 0.78rem;
    border-radius: 3px;
    border: 1px solid var(--border-gray);
    cursor: pointer;
    font-weight: 500;
    background: var(--bg-secondary, #1e2028);
    color: var(--text-muted);
    white-space: nowrap;
}
.btn-xs:hover, .btn-secondary-xs:hover { border-color: var(--accent-primary, #7c6af5); color: var(--text-primary, #f0f0f0); }
.btn-xs:disabled, .btn-secondary-xs:disabled { opacity: .5; cursor: default; }
.btn-warn {
    background: rgba(251,191,36,.15);
    border-color: rgba(251,191,36,.4);
    color: #fbbf24;
}
.btn-warn:hover { background: rgba(251,191,36,.28); }
.btn-warn:disabled { opacity: .5; cursor: default; }
.btn-warn-outline {
    padding: 0.3rem 0.9rem;
    font-size: 0.85rem;
    border-radius: 5px;
    border: 1px solid rgba(251,191,36,.45);
    background: transparent;
    color: #fbbf24;
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
}
.btn-warn-outline:hover { background: rgba(251,191,36,.12); }
.btn-warn-outline:disabled { opacity: .5; cursor: default; }
.input-error {
    border-color: var(--color-red-primary, #ef4444) !important;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.25);
}
.updates-progress {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-gray);
}
.updates-progress p {
    margin: 0.25rem 0;
}
.updates-check-info {
    margin-bottom: 1rem;
}
.updates-error-box {
    background: rgba(234, 179, 8, 0.1);
    border: 1px solid rgba(234, 179, 8, 0.4);
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
}
.updates-error-box-title {
    font-weight: 600;
    color: var(--session-yellow, #eab308);
    margin: 0 0 0.5rem 0;
    font-size: 0.95rem;
}
.updates-error-box-body {
    font-size: 0.9rem;
    color: var(--text-gray);
    margin: 0 0 0.5rem 0;
    white-space: pre-wrap;
    word-break: break-word;
}
.updates-error-box-footer {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}
.updates-release-wrap {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-gray);
}
.updates-release-meta {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}
.updates-release-meta a {
    color: var(--color-red-primary);
    text-decoration: none;
}
.updates-release-meta a:hover {
    text-decoration: underline;
}
.updates-notes-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-gray);
    margin: 0.5rem 0 0.25rem 0;
}
.updates-notes-wrap .updates-notes {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
    padding: 12px;
    background: var(--bg-dark);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-gray);
    margin: 0;
}
.cc-pill-update {
    background: rgba(var(--color-red-rgb), 0.12);
    color: var(--color-red-primary);
    text-decoration: none;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
}
.cc-pill-update:hover {
    background: rgba(var(--color-red-rgb), 0.2);
}
.config-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}
.config-json {
    background: var(--bg-panel);
    border: 1px solid var(--border-gray);
    border-radius: 6px;
    padding: 1rem;
    font-size: 0.8rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--text-gray);
}

/* ========== Server Config (CM-style: left presets, right editor) ========== */
#page-server-config:not(.hidden) {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}
.sc-instance-select-hidden {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}
.sc-server-config-wrap {
    display: flex;
    flex-direction: row;
    flex: 1;
    min-height: 0;
    gap: 0;
}
.sc-presets-sidebar {
    width: 220px;
    min-width: 180px;
    flex-shrink: 0;
    background: var(--bg-panel);
    border: 1px solid var(--border-gray);
    border-radius: 8px;
    margin-right: 16px;
    padding: 8px 0 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.sc-presets-sidebar-title {
    font-family: var(--font-title);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin: 0 16px 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-gray);
}
.sc-presets-list {
    overflow-y: auto;
    padding: 0 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}
.sc-preset-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s;
    position: relative;
}
.sc-preset-item:hover {
    background: rgba(255, 255, 255, 0.06);
}
.sc-preset-item:focus-visible {
    outline: 2px solid var(--color-red-primary);
    outline-offset: 1px;
}
.sc-preset-item.sc-preset-item-active {
    background: rgba(var(--color-red-rgb), 0.15);
    border-color: var(--color-red-primary);
    color: var(--text-white);
}
.sc-preset-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
    margin-left: auto;
}
.sc-preset-dot.running { background: var(--color-red-primary); }
.sc-preset-dot.stopped { background: rgba(255,255,255,0.18); }
.sc-preset-status-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    flex-shrink: 0;
    min-width: 3.2em;
}
.sc-preset-item.running .sc-preset-status-label { color: var(--color-red-primary); }
.sc-preset-name { flex: 1; min-width: 0; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-preset-gear {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background 0.15s;
}
.sc-preset-gear:hover {
    color: var(--text-white);
    background: rgba(255, 255, 255, 0.1);
}
.sc-preset-item-dragging { opacity: 0.6; }
.sc-preset-item-drag-over { background: rgba(var(--color-red-rgb), 0.2); border-color: var(--color-red-primary); }
.sc-presets-footer {
    border-top: 1px solid var(--border-gray);
    padding: 8px 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}
.sc-presets-count {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.sc-presets-footer-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.sc-sidebar-btn {
    flex: 1 1 auto;
    padding: 5px 6px;
    font-size: 0.72rem;
    font-family: var(--font-title);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border-gray);
    border-radius: 3px;
    color: var(--text-gray);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.sc-sidebar-btn:hover { background: rgba(255,255,255,0.12); color: var(--text-white); }

.sc-server-config-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.sc-top-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px 20px;
    padding: 10px 0 14px;
    border-bottom: 1px solid var(--border-gray);
    flex-shrink: 0;
    background: var(--bg-page);
}
.sc-top-bar .sc-server-name { margin: 0; font-size: 1.2rem; }
.sc-top-bar-actions { display: flex; gap: 10px; }
.sc-tabs-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin-left: auto;
}
.sc-tabs-inline .sc-tab { padding: 6px 10px; font-size: 0.8rem; }
.sc-server-config-main .sc-loaded-path { margin: 6px 0 0 0; flex-shrink: 0; }
.sc-server-config-main .sc-manager-area { margin-top: 12px; }

/* MAIN panel: track selection hero (only the image is clickable) */
.sc-main-track-hero {
    margin-bottom: 24px;
    padding: 20px;
    background: var(--bg-panel);
    border: 1px solid var(--border-gray);
    border-radius: 10px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    align-items: stretch;
    min-height: 0;
}
.sc-main-track-hero.sc-track-hero-has-outline {
    grid-template-columns: 1fr minmax(180px, 42%);
}
.sc-track-hero-content {
    display: flex;
    gap: 24px;
    min-width: 0;
    min-height: 0;
}
.sc-track-hero-left {
    flex: 0 1 auto;
    min-width: 0;
}
.sc-track-hero-image-btn {
    display: block;
    width: 100%;
    max-width: 300px;
    padding: 0;
    margin: 0 0 12px 0;
    border: none;
    background: none;
    font: inherit;
    color: inherit;
    cursor: pointer;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    transition: filter 0.18s ease, box-shadow 0.18s ease;
}
.sc-track-hero-image-btn:hover {
    filter: brightness(1.06);
}
.sc-track-hero-image-btn:hover .sc-track-hero-image-overlay {
    opacity: 1;
}
.sc-track-hero-image-btn:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}
.sc-track-hero-image-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    color: var(--text-white);
    font-size: 0.95rem;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.18s ease;
    pointer-events: none;
}
.sc-track-hero-image-wrap {
    display: block;
    width: 100%;
    aspect-ratio: 16/9;
    background: var(--bg-dark);
    border: 1px solid var(--border-gray);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}
.sc-track-hero-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    z-index: 0;
}
.sc-track-hero-img[src=""] { display: none; }
.sc-track-hero-fallback {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--text-muted);
    background: var(--bg-dark);
}
.sc-track-hero-map {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    pointer-events: none;
    z-index: 2;
}
.sc-track-hero-map[src=""],
.sc-track-hero-map:not([src]) { display: none !important; }
.sc-track-hero-layouts {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.sc-track-hero-layouts .sc-track-layout-thumb {
    width: 48px;
    height: 32px;
    background: var(--bg-dark);
    border: 1px solid var(--border-gray);
    border-radius: 4px;
    cursor: pointer;
    overflow: hidden;
}
.sc-track-hero-layouts .sc-track-layout-thumb.active { border-color: var(--color-red-primary); }
.sc-track-hero-layouts .sc-track-layout-thumb img { width: 100%; height: 100%; object-fit: contain; }
.sc-track-hero-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-white);
    margin: 0;
}
.sc-track-hero-info {
    flex: 1;
    min-width: 180px;
    max-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 8px 0;
}
.sc-track-hero-outline-wrap {
    display: none;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}
.sc-track-hero-outline-wrap.sc-track-hero-outline-visible {
    display: flex;
}
.sc-track-hero-outline {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
    opacity: 0.9;
}
.sc-track-hero-info-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sc-track-hero-info-heading {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin: 0;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-gray);
}
.sc-track-hero-info-rows {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.sc-track-hero-info-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: baseline;
}
.sc-track-hero-info-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    min-width: 5em;
    flex-shrink: 0;
}
.sc-track-hero-info-value {
    font-size: 0.95rem;
    color: var(--text-white);
}
.sc-track-hero-info-mono {
    font-family: var(--font-mono), monospace;
    font-size: 0.85rem;
    color: var(--text-gray);
}
.sc-track-hero-info-description {
    font-size: 0.9rem;
    color: var(--text-gray);
    line-height: 1.45;
    margin: 0;
    word-break: break-word;
}
.sc-track-hero-info-description .sc-track-hero-info-para {
    margin: 0 0 0.5em;
}
.sc-track-hero-info-description .sc-track-hero-info-para:last-child {
    margin-bottom: 0;
}
.sc-track-hero-info-section.sc-track-hero-info-hidden {
    display: none;
}
@media (max-width: 900px) {
    .sc-main-track-hero.sc-track-hero-has-outline {
        grid-template-columns: 1fr minmax(160px, 32%);
    }
}
@media (max-width: 700px) {
    .sc-main-track-hero.sc-track-hero-has-outline {
        grid-template-columns: 1fr;
    }
    .sc-track-hero-outline-wrap.sc-track-hero-outline-visible {
        min-height: 180px;
        max-height: 240px;
    }
}
.sc-car-hero-panel {
    flex: 0 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}
.sc-car-hero-image-wrap {
    position: relative;
    width: 260px;
    max-width: 100%;
    height: 140px;
    background: rgba(0,0,0,0.3);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-gray);
    margin-bottom: 10px;
}
.sc-car-hero-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.sc-car-hero-img[src=""] { display: none; }
.sc-car-hero-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.82rem;
    pointer-events: none;
}
.sc-car-hero-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-white);
    margin: 0;
    max-width: 260px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sc-capacity-field { flex-direction: column; align-items: flex-start !important; }
.sc-capacity-field label { min-width: unset !important; }
.sc-capacity-field .sc-slider { width: 100%; }
.sc-capacity-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.sc-field-file-row {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    flex-wrap: wrap;
}
.sc-field-file-row .sc-input { flex: 1; min-width: 0; }
.sc-inline-btn {
    padding: 6px 10px;
    font-size: 0.8rem;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border-gray);
    border-radius: 4px;
    color: var(--text-gray);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}
.sc-inline-btn:hover { background: rgba(255,255,255,0.12); color: var(--text-white); }
.sc-cm-server-status { margin-top: 12px; }
.sc-cm-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    border: 1px solid;
}
.sc-cm-status-stopped { background: rgba(255,255,255,0.04); border-color: var(--border-gray); color: var(--text-muted); }
.sc-cm-status-running { background: rgba(34,197,94,0.12); border-color: rgba(34,197,94,0.5); color: #22c55e; }

.sc-main-section-compact .sc-section-title { margin-bottom: 12px; }
.sc-main-section-compact .sc-main-two-col { gap: 20px 32px; }

/* Track picker modal (CM-style: detail left, list right) */
.sc-track-picker-panel {
    position: relative;
    z-index: 1001;
    width: 90vw;
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-panel);
    border: 1px solid var(--border-gray);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
.sc-track-picker-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-gray);
}
.sc-track-picker-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.sc-track-picker-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-white);
    margin: 0;
}
.sc-track-picker-server {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}
.sc-track-picker-current-track {
    font-size: 0.85rem;
    color: var(--text-gray);
}
.sc-track-picker-warning {
    font-size: 0.85rem;
    background: rgba(255, 193, 7, 0.2);
    border: 1px solid rgba(255, 193, 7, 0.5);
    color: #ffc107;
    padding: 8px 10px;
    border-radius: 4px;
    margin-top: 8px;
}
.sc-track-picker-warning.hidden { display: none; }
.sc-track-picker-filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}
.sc-track-picker-filter-label { font-size: 0.85rem; color: var(--text-gray); }
.sc-track-picker-filter-select, .sc-track-picker-search {
    background: var(--bg-dark);
    border: 1px solid var(--border-gray);
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 0.85rem;
    color: var(--text-white);
}
.sc-track-picker-search { width: 160px; }
.sc-track-picker-country { min-width: 120px; }
.sc-track-picker-body {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.sc-track-picker-detail {
    width: 42%;
    min-width: 280px;
    padding: 16px;
    border-right: 1px solid var(--border-gray);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.sc-track-picker-detail-image-wrap {
    width: 100%;
    aspect-ratio: 16/9;
    background: var(--bg-dark);
    border: 1px solid var(--border-gray);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}
.sc-track-picker-detail-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.sc-track-picker-detail-img[src=""] { display: none; }
.sc-track-picker-detail-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.sc-track-picker-detail-layouts { display: flex; gap: 6px; flex-wrap: wrap; }
.sc-track-picker-detail-layouts .sc-track-layout-thumb {
    width: 56px; height: 36px; background: var(--bg-dark); border: 1px solid var(--border-gray);
    border-radius: 4px; cursor: pointer; overflow: hidden;
}
.sc-track-picker-detail-layouts .sc-track-layout-thumb.active { border-color: var(--color-red-primary); }
.sc-track-picker-detail-layouts .sc-track-layout-thumb img { width: 100%; height: 100%; object-fit: contain; }
.sc-track-picker-detail-info {
    margin-top: 12px;
    font-size: 0.9rem;
}
.sc-track-picker-detail-info .sc-track-hero-info-section { margin-top: 10px; }
.sc-track-picker-detail-info .sc-track-hero-info-section:first-child { margin-top: 0; }
.sc-track-picker-detail-info .sc-track-hero-info-description { max-height: 120px; overflow-y: auto; }
.sc-track-picker-list-wrap {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.sc-track-picker-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    overflow-y: auto;
    padding: 6px;
}
.sc-track-picker-item {
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-white);
    transition: background 0.15s;
}
.sc-track-picker-item:hover { background: rgba(255, 255, 255, 0.08); }
.sc-track-picker-item.sc-track-picker-item-active {
    background: rgba(var(--color-red-rgb), 0.25);
    color: var(--text-white);
}
.sc-track-picker-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--border-gray);
}
.sc-track-picker-detail-map {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}
.sc-track-picker-detail-map[src=""] { display: none; }
.sc-track-picker-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.sc-track-picker-tag {
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(255,255,255,0.08);
    color: var(--text-gray);
    border: 1px solid rgba(255,255,255,0.15);
    text-transform: capitalize;
    white-space: nowrap;
}
.sc-track-picker-list-search {
    display: flex;
    gap: 8px;
    padding: 10px 10px 8px;
    border-bottom: 1px solid var(--border-gray);
    align-items: center;
    flex-shrink: 0;
}
.sc-track-picker-list-search .sc-track-picker-search { flex: 1; min-width: 0; width: auto; }
.sc-track-picker-meta {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 3px 12px;
    font-size: 0.82rem;
    margin-bottom: 8px;
    align-items: baseline;
}
.sc-track-picker-meta-label {
    color: var(--text-muted);
    white-space: nowrap;
    font-size: 0.78rem;
}
.sc-track-picker-meta-value {
    color: var(--text-white);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sc-track-picker-description {
    font-size: 0.82rem;
    color: var(--text-gray);
    line-height: 1.5;
    max-height: 80px;
    overflow-y: auto;
    white-space: pre-line;
}
.sc-main-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px 32px;
}
@media (max-width: 900px) { .sc-main-two-col { grid-template-columns: 1fr; } }
.sc-main-col { min-width: 0; }

/* Server config page: sticky toolbar (legacy) */
.sc-page-toolbar {
    padding: 12px 0 10px;
    border-bottom: 1px solid var(--border-gray);
    flex-shrink: 0;
    background: var(--bg-page);
}
.sc-toolbar-sticky {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--bg-page);
    padding-top: 12px;
    padding-bottom: 10px;
    margin-bottom: 0;
}
.sc-toolbar-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
}
.sc-toolbar-preset {
    display: flex;
    align-items: center;
    gap: 10px;
}
.sc-toolbar-label {
    font-size: 0.85rem;
    color: var(--text-gray);
    margin: 0;
    white-space: nowrap;
}
.sc-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.sc-loaded-path {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 6px 0 0 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sc-loaded-path-error { color: var(--color-red-primary); }

/* Legacy (kept for any other refs) */
.sc-pitbox-header { padding: 12px 0 16px; border-bottom: 1px solid var(--border-gray); flex-shrink: 0; }
.sc-pitbox-header-left { min-width: 0; }
.sc-pitbox-title { font-family: var(--font-title); font-size: 1.35rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-white); margin: 0 0 2px 0; }
.sc-pitbox-subtitle { font-size: 0.8rem; color: var(--text-muted); margin: 0; }
.sc-pitbox-header-right { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.sc-instance-select, .sc-header-btn {
    background: var(--bg-panel);
    color: var(--text-white);
    border: 1px solid var(--border-gray);
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 0.85rem;
}
.sc-instance-select:hover, .sc-header-btn:hover { border-color: var(--color-red-primary); }
.sc-header-btn-primary { background: var(--color-red-primary); border-color: var(--color-red-primary); }

.sc-status-pill {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.sc-status-stopped { background: var(--bg-panel); color: var(--text-muted); border: 1px solid var(--border-gray); }
.sc-status-running { background: rgba(34, 197, 94, 0.2); color: var(--success-green); }

.sc-manager-area {
    flex: 1;
    min-height: 0;
    margin-top: 16px;
    background: var(--bg-dark);
    border: 1px solid var(--border-gray);
    border-radius: 10px;
    padding: 20px 24px 48px;
    position: relative;
    overflow: auto;
}

.sc-manager-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

/* Sticky tab bar when scrolling inside manager area */
.sc-tabs-sticky {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-dark);
    padding: 4px 0 0 0;
    margin: 0 0 16px 0;
    border-bottom: 1px solid var(--border-gray);
}

.sc-server-name {
    font-family: var(--font-title);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-white);
    margin: 0;
}

.sc-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    border: none;
    background: none;
}
.sc-tab {
    background: none;
    border: none;
    color: var(--text-gray);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.sc-tab:hover { color: var(--text-white); }
.sc-tab-active { color: var(--text-white); background: var(--color-red-soft); border-bottom-color: var(--color-red-primary); }

.sc-watermark {
    position: absolute;
    left: 50%;
    top: 45%;
    transform: translate(-50%, -50%);
    font-size: 4rem;
    font-weight: 800;
    letter-spacing: 0.2em;
    color: rgba(255,255,255,0.04);
    pointer-events: none;
    border: 1px solid rgba(var(--color-red-rgb), 0.15);
    padding: 0.2em 0.4em;
}

.sc-panels { position: relative; z-index: 1; }
.sc-panel { display: block; }
.sc-panel.hidden { display: none; }
.sc-placeholder { color: var(--text-muted); font-size: 0.9rem; margin: 12px 0; }

/* LOG panel: acServer console output */
.sc-log-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex-shrink: 0;
}
.sc-log-caption { font-size: 0.85rem; color: var(--text-muted); }
.sc-log-content {
  margin: 0;
  padding: 12px 14px;
  font-family: ui-monospace, "Cascadia Code", "Consolas", "Monaco", monospace;
  font-size: 0.8rem;
  line-height: 1.4;
  background: #1a1a1a;
  color: #e0e0e0;
  border: 1px solid var(--border-gray);
  border-radius: 6px;
  overflow: auto;
  max-height: 70vh;
  min-height: 200px;
  white-space: pre-wrap;
  word-break: break-all;
}

.sc-section-title {
    font-family: var(--font-title);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-white);
    margin: 0 0 12px 0;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-gray);
}

.sc-field { margin-bottom: 12px; }
.sc-field label { display: block; font-size: 0.85rem; color: var(--text-gray); margin-bottom: 4px; }
.sc-input, .sc-select, .sc-textarea {
    width: 100%;
    max-width: 280px;
    background: var(--bg-panel);
    border: 1px solid var(--border-gray);
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 0.9rem;
    color: var(--text-white);
}
.sc-input:focus, .sc-select:focus, .sc-textarea:focus {
    outline: none;
    border-color: var(--color-red-primary);
}
.sc-input-num { max-width: 100px; }
.sc-textarea { min-height: 60px; resize: vertical; }

.sc-field-slider { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.sc-field-slider label { margin-bottom: 0; flex: 0 0 auto; min-width: 160px; }
.sc-slider {
    flex: 1;
    min-width: 120px;
    max-width: 240px;
    height: 8px;
    background: var(--bg-panel);
    border-radius: 4px;
    accent-color: var(--color-red-primary);
}

.sc-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-white);
    margin-bottom: 10px;
    cursor: pointer;
}
.sc-checkbox input { accent-color: var(--color-red-primary); width: 18px; height: 18px; }

/* Cars picker: chips + add button opening modal */
.sc-field-cars .sc-field label { margin-bottom: 0; }
.sc-cars-label-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.sc-cars-label-row label { margin-bottom: 0; }
.sc-cars-add-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--border-gray);
    border-radius: 4px;
    background: var(--bg-panel);
    color: var(--text-white);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sc-cars-add-btn:hover {
    border-color: var(--color-red-primary);
    color: var(--color-red-primary);
}
.sc-cars-picker { max-width: 420px; }
.sc-cars-on-entry-list { margin-bottom: 16px; }
.sc-cars-selected-hidden { display: none !important; }
.sc-cars-selected {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 24px;
}
.sc-cars-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-panel);
    border: 1px solid var(--border-gray);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.8rem;
    color: var(--text-white);
}
.sc-cars-chip-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 2px;
    font-size: 1rem;
    line-height: 1;
}
.sc-cars-chip-remove:hover { color: var(--color-red-primary); }

/* Modal: Add Cars popup (CM-style) */
.modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}
.modal.hidden { display: none; }
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    cursor: pointer;
}
.modal-panel {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    background: #2b2b2b;
    border: 1px solid var(--color-red-primary);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-gray);
}
.modal-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-white);
}
.modal-close {
    background: var(--bg-panel);
    border: 1px solid var(--border-gray);
    border-radius: 4px;
    color: var(--text-white);
    padding: 6px 12px;
    font-size: 0.85rem;
    cursor: pointer;
}
.modal-close:hover { border-color: var(--color-red-primary); }

/* Preview/info panel above tabs (CM-style) */
.sc-cars-modal-preview {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-gray);
    background: rgba(0, 0, 0, 0.2);
}
.sc-cars-modal-preview-imgwrap {
    position: relative;
    flex-shrink: 0;
    width: 120px;
    height: 68px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--bg-panel);
}
.sc-cars-modal-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.sc-cars-modal-preview-img[src=""] { display: none; }
.sc-cars-modal-preview-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--text-muted);
}
.sc-cars-modal-preview-meta {
    flex: 1;
    min-width: 0;
}
.sc-cars-modal-preview-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-white);
}
.sc-cars-modal-preview-line {
    font-size: 0.85rem;
    color: var(--text-gray);
    margin-top: 4px;
}

.modal-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border-gray);
}
.modal-tab {
    background: transparent;
    border: none;
    color: var(--text-gray);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 4px;
}
.modal-tab:hover { color: var(--text-white); }
.modal-tab.active {
    background: rgba(var(--color-red-rgb), 0.2);
    color: var(--color-red-primary);
}
.modal-controls {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.modal-controls label { margin: 0; font-size: 0.85rem; color: var(--text-gray); }
.modal-filter-input {
    flex: 1;
    min-width: 0;
    max-width: 320px;
    background: var(--bg-dark);
    border: 1px solid var(--border-gray);
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 0.9rem;
    color: var(--text-white);
}
.modal-filter-input:focus {
    outline: none;
    border-color: var(--color-red-primary);
}
.modal-list {
    flex: 1;
    min-height: 200px;
    max-height: 360px;
    overflow-y: auto;
    padding: 0;
}
.modal-list:empty::after {
    content: "Loading cars…";
    display: block;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.sc-cars-modal-empty {
    padding: 20px;
    color: var(--text-gray);
    font-size: 0.9rem;
    line-height: 1.5;
}
.sc-cars-modal-empty code {
    background: var(--bg-panel);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
}
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-gray);
}
.sc-cars-modal-selected-count {
    margin-right: auto;
    font-size: 0.85rem;
    color: var(--text-gray);
}
.modal-footer .btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.modal-footer .btn, .modal-footer .btn-primary {
    padding: 8px 16px;
    font-size: 0.9rem;
    border-radius: 4px;
    cursor: pointer;
}
.modal-footer .btn-primary {
    background: var(--color-red-primary);
    border: 1px solid var(--color-red-primary);
    color: var(--text-white);
}
.modal-footer .btn {
    background: var(--bg-panel);
    border: 1px solid var(--border-gray);
    color: var(--text-white);
}
.modal-footer .btn:hover { border-color: var(--color-red-primary); }

/* Modal car rows */
.car-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    cursor: pointer;
    transition: background 0.12s;
    border-left: 3px solid transparent;
}
.car-row:last-child { border-bottom: none; }
.car-row:hover { background: rgba(255,255,255,0.06); }
.car-row.active {
    outline: 1px solid rgba(255,255,255,0.25);
    outline-offset: -1px;
}
.car-row.active.selected { outline-color: var(--color-red-primary); }
.car-row.selected {
    background: rgba(var(--color-red-rgb), 0.15);
    border-left-color: var(--color-red-primary);
}
.car-row .car-thumb,
.car-row .car-thumb-fallback {
    flex-shrink: 0;
    width: 64px;
    height: 36px;
    border-radius: 4px;
    object-fit: cover;
}
.car-row .car-thumb-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-panel);
    font-size: 0.75rem;
    color: var(--text-muted);
}
.car-row .car-meta {
    flex: 1;
    min-width: 0;
}
.car-row .car-name {
    font-weight: 700;
    color: var(--text-white);
    font-size: 0.9rem;
}
.car-row .car-class {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.car-row .car-specs {
    font-size: 0.75rem;
    color: var(--text-gray);
    margin-top: 2px;
}
.car-row .car-icon {
    flex-shrink: 0;
    font-size: 1rem;
    opacity: 0.7;
}

/* MAIN panel: grouped sections for easier editing */
.sc-main-sections {
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 720px;
}
.sc-main-section {
    background: var(--bg-panel);
    border: 1px solid var(--border-gray);
    border-radius: 8px;
    padding: 16px 20px;
}
.sc-main-section .sc-section-title {
    margin-top: 0;
    margin-bottom: 14px;
}
.sc-main-section-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.sc-main-section-fields.sc-main-fields-row {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}
.sc-main-fields-row .sc-field { margin-bottom: 0; }

.sc-main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px 32px;
    margin-bottom: 20px;
}
@media (max-width: 800px) { .sc-main-grid { grid-template-columns: 1fr; } }
.sc-main-left, .sc-main-right { min-width: 0; }
.sc-main-extra { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 16px; }

.sc-rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
}
.sc-rules-section { min-width: 0; }

.sc-status-intro, .sc-advanced-intro {
    font-size: 0.9rem;
    color: var(--text-muted);
    max-width: 52rem;
    line-height: 1.45;
    margin-bottom: 16px;
}
.sc-status-intro a, .sc-advanced-intro a { color: var(--accent, #6ab0ff); }
.sc-status-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.sc-status-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.sc-status-running { background: rgba(46, 160, 67, 0.25); color: #7dffb3; border: 1px solid rgba(46, 160, 67, 0.5); }
.sc-status-stopped { background: rgba(128, 128, 128, 0.2); color: var(--text-muted); border: 1px solid var(--border-gray); }
.sc-status-muted { background: rgba(180, 120, 40, 0.2); color: #e8c070; border: 1px solid rgba(180, 120, 40, 0.4); }
.sc-status-detail { font-size: 0.85rem; color: var(--text-gray); }
.sc-status-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.sc-details-toolbar { margin-bottom: 10px; }
.sc-details-raw {
    margin: 0;
    padding: 14px 16px;
    max-height: min(70vh, 520px);
    overflow: auto;
    font-size: 0.78rem;
    line-height: 1.4;
    background: var(--bg-dark);
    border: 1px solid var(--border-gray);
    border-radius: 8px;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text-gray);
}

.sc-conditions-grid { max-width: 400px; }
.sc-conditions-grid .sc-section-title { margin-top: 16px; }

.sc-sessions-grid { display: flex; flex-wrap: wrap; gap: 24px; }
.sc-sessions-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    max-width: 900px;
}
.sc-sessions-left, .sc-sessions-right {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.sc-sessions-left .sc-section-title,
.sc-sessions-right .sc-section-title {
    margin-top: 8px;
    margin-bottom: 4px;
}
.sc-sessions-left .sc-section-title:first-child,
.sc-sessions-right .sc-section-title:first-child { margin-top: 0; }
.sc-checkbox-muted { color: var(--text-muted); }
.sc-checkbox-muted input:disabled { opacity: 0.7; }
.sc-field-inline { display: flex; align-items: center; gap: 8px; }
.sc-field-inline label { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.sc-field-inline .sc-input-num { width: 60px; }
.sc-sessions-two-col .hidden { display: none !important; }
.sc-session-block {
    background: var(--bg-panel);
    border: 1px solid var(--border-gray);
    border-radius: 8px;
    padding: 16px;
    min-width: 200px;
}

.sc-entry-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 0.85rem; color: var(--text-gray); margin-bottom: 12px; }
.sc-entry-meta .sc-header-btn { margin: 0; }
.sc-entry-table-wrap { overflow-x: auto; border: 1px solid var(--border-gray); border-radius: 6px; }
.sc-entry-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.sc-entry-table th, .sc-entry-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border-gray); }
.sc-entry-table th { background: var(--bg-panel); color: var(--text-muted); font-weight: 600; }
.sc-entry-table td { color: var(--text-white); }
.sc-entry-table input, .sc-entry-table select {
    background: var(--bg-dark);
    border: 1px solid var(--border-gray);
    color: var(--text-white);
    padding: 6px 10px;
    font-size: 0.85rem;
    width: 100%;
    max-width: 140px;
}
.sc-entry-model-cell { vertical-align: middle; min-width: 240px; }
.sc-entry-model-wrap { position: relative; }
.sc-entry-model-display {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 2em;
  line-height: 2em;
  padding: 4px 0;
  cursor: text;
}
.sc-entry-model-wrap .sc-entry-model { display: none; margin-top: 0; max-width: 280px; }
.sc-entry-model-wrap.edit-mode .sc-entry-model-display { display: none; }
.sc-entry-model-wrap.edit-mode .sc-entry-model { display: block; }
.sc-entry-model.sc-entry-model-unknown { border-color: #e09020; box-shadow: 0 0 0 1px #e09020; }
.sc-entry-table .sc-entry-actions { white-space: nowrap; }
.sc-entry-table .sc-entry-actions button { padding: 4px 10px; font-size: 0.8rem; margin-right: 4px; }

.sc-entry-skin-cell { vertical-align: middle; }
.sc-entry-livery-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sc-entry-livery {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border: 1px solid var(--border-gray);
    border-radius: 4px;
    flex-shrink: 0;
}
.sc-entry-livery-wrap .sc-entry-skin { flex: 1; min-width: 80px; }
.sc-entry-livery-wrap .sc-entry-skin-select { max-width: 120px; }

/* z-index so buttons stay above .sc-panels (z-index:1); otherwise panels intercept clicks after config save/reflow */
.sc-server-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.sc-server-actions .sc-header-btn { min-width: 80px; }

.sc-servers-list-wrap {
    margin-bottom: 16px;
    padding: 14px 18px;
    background: var(--bg-panel);
    border: 1px solid var(--border-gray);
    border-radius: 8px;
}
.sc-servers-list-head {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.sc-servers-list-wrap .sc-section-title { margin-top: 0; margin-bottom: 0; }
.sc-servers-list-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}
.sc-servers-list-strip .sc-servers-list-inner {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
}
.sc-servers-list-strip .sc-server-row {
    flex: 0 0 auto;
    min-width: 200px;
}
.sc-servers-list-inner { display: flex; flex-direction: column; gap: 8px; }
.sc-server-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-page);
    border: 1px solid var(--border-gray);
    border-radius: 6px;
}
.sc-server-row-name { font-weight: 600; min-width: 120px; }
.sc-server-row-ports, .sc-server-row-pid { font-family: var(--font-mono); font-size: 0.9rem; color: var(--text-muted); }
.sc-server-row-actions { margin-left: auto; }

.sc-status-bar {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--success-green);
    z-index: 2;
}
.sc-status-bar.sc-status-stopped { color: var(--text-muted); }
.sc-status-bar .sc-status-dot.stopped { background: var(--text-muted); animation: none; }
.sc-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success-green);
    animation: sc-pulse 2s ease-in-out infinite;
}
@keyframes sc-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* Toolbar row */
.toolbar-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.section-title {
    font-family: var(--font-title);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-white);
    margin-bottom: 16px;
}

.rig-selector-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.rig-selector-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg-panel);
    border: 1px solid var(--border-gray);
    border-radius: 6px;
}

.rig-selector-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--color-red-primary);
}

.rig-selector-item .rig-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.rig-dot.idle { background: var(--success-green); }
.rig-dot.session { background: var(--session-yellow); }
.rig-dot.offline { background: var(--offline-gray); }

.rig-selector-item .rig-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-white);
}

.bulk-row {
    margin-bottom: 20px;
}

.bulk-group-title {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--color-red-primary);
    margin-bottom: 10px;
}

.bulk-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.dropdown {
    background: var(--bg-dark);
    color: var(--text-white);
    border: 1px solid var(--border-gray);
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 0.9rem;
    min-width: 160px;
    cursor: pointer;
}

.dropdown:focus {
    outline: none;
    border-color: var(--color-red-primary);
}

/* Buttons */
button {
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

button:hover {
    opacity: 0.9;
}

button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
/* Dirty-state indicator for Save buttons */
.btn-dirty {
    box-shadow: 0 0 0 2px var(--color-red-primary);
    animation: btnDirtyPulse 2s ease-in-out infinite;
}
@keyframes btnDirtyPulse {
    0%, 100% { box-shadow: 0 0 0 2px rgba(255,0,0,0.7); }
    50%       { box-shadow: 0 0 0 4px rgba(255,0,0,0.25); }
}

.btn-primary {
    background: var(--color-red-primary);
    color: var(--text-white);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 1px solid var(--color-red-primary);
}
.btn-primary:hover:not(:disabled) {
    background: var(--color-red-hover);
    border-color: var(--color-red-hover);
}
.btn-primary:active:not(:disabled) {
    background: var(--color-red-active);
    border-color: var(--color-red-active);
}

.btn-secondary {
    background: var(--bg-panel);
    color: var(--text-white);
    border: 1px solid var(--border-gray);
}

.btn-danger {
    background: var(--color-red-active);
    color: var(--text-white);
}

.btn-bulk {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-icon {
    font-size: 1rem;
}

.status-text {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-left: 8px;
}

/* Rig cards section – large tactile cards */
.rig-cards-section {
    margin-top: 8px;
}

.sim-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
}

.sim-card {
    background: var(--bg-panel);
    border: 2px solid var(--border-gray);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 320px;
    cursor: pointer;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.sim-card:hover {
    border-color: var(--text-muted);
}
.sim-card:focus-visible {
    outline: 2px solid var(--color-red-primary);
    outline-offset: 2px;
    border-color: var(--color-red-primary);
}

.sim-card-selected {
    border-color: var(--color-red-primary);
    box-shadow: 0 0 0 2px var(--color-red-primary), 0 0 20px rgba(var(--color-red-rgb), 0.5);
}

.sim-card-selected:hover {
    border-color: var(--color-red-primary);
    box-shadow: 0 0 0 2px var(--color-red-primary), 0 0 24px rgba(var(--color-red-rgb), 0.6);
}

.sim-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.sim-card-batch-status {
    font-size: 0.8rem;
    padding: 4px 8px;
    border-radius: 6px;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.sim-card-batch-status.hidden {
    display: none;
}
.sim-card-batch-pending {
    background: rgba(234, 179, 8, 0.15);
    color: var(--session-yellow);
}
.sim-card-batch-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: sim-card-batch-spin 0.6s linear infinite;
}
@keyframes sim-card-batch-spin {
    to { transform: rotate(360deg); }
}
.sim-card-batch-ok {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success-green);
}
.sim-card-batch-check { font-weight: 700; }
.sim-card-batch-failed {
    background: var(--color-red-soft);
    color: var(--color-red-primary);
}
.sim-card-batch-fail { font-weight: 700; }

.sim-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-white);
    letter-spacing: 0.5px;
}

/* Status pill: Idle / In Session / Error–Offline */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-pill-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-pill-idle {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success-green);
}
.status-pill-idle .status-pill-dot { background: var(--success-green); }

.status-pill-session {
    background: rgba(234, 179, 8, 0.2);
    color: var(--session-yellow);
}
.status-pill-session .status-pill-dot { background: var(--session-yellow); }

.status-pill-offline {
    background: var(--color-red-soft);
    color: var(--color-red-primary);
}
.status-pill-offline .status-pill-dot { background: var(--color-red-primary); }
/* Lost-contact: was online, now unreachable — amber with pulsing dot */
.status-pill-lost {
    background: rgba(234, 179, 8, 0.15);
    color: var(--session-yellow);
}
.status-pill-lost .status-pill-dot {
    background: var(--session-yellow);
    animation: status-dot-pulse 1.4s ease-in-out infinite;
}
@keyframes status-dot-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.35; transform: scale(0.7); }
}

/* Car thumbnail placeholder */
.sim-card-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-dark);
    border: 1px solid var(--border-gray);
}

.sim-card-thumb-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--border-gray) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sim-card-thumb-placeholder::after {
    content: '';
    width: 48px;
    height: 48px;
    background: var(--border-gray);
    border-radius: 8px;
    opacity: 0.5;
}

/* Launch status overlay (inside sim-card-thumb during CM/AC launch) */
.sim-card-launch-overlay {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.75);
    color: var(--text-muted, #aaa);
    font-size: .82rem;
    font-weight: 600;
    letter-spacing: .06em;
    border-radius: 8px;
    animation: pb-pulse 1.8s ease-in-out infinite;
}
.sim-card-launch-overlay--running {
    color: #22c55e;
    background: rgba(0, 0, 0, 0.65);
    animation: none;
}
.sim-card-launch-overlay--stopping {
    color: #ff6060;
    background: rgba(30, 0, 0, 0.82);
    animation: pb-pulse 1s ease-in-out infinite;
}
@keyframes pb-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}

/* Server panel (inside sim-card-thumb) */
.sim-card-thumb .pb-panel {
    width: 100%;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: #0b0b0d;
    border-radius: 6px;
    border: 1px solid var(--border-gray);
    padding: 10px 12px;
    overflow: hidden;
}

.pb-panel__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.pb-panel__title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.pb-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.pb-panel[data-state="CONNECTED"] .pb-dot { background: var(--success-green); box-shadow: 0 0 6px var(--success-green); }
.pb-panel[data-state="DISCONNECTED"] .pb-dot { background: var(--text-muted); }
.pb-panel[data-state="UNAVAILABLE"] .pb-dot { background: var(--color-red-primary); }

.pb-panel__badge {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 2px 6px;
    border-radius: 4px;
}

.pb-badge--pitbox {
    color: var(--color-red-primary);
    border: 1px solid var(--color-red-primary);
    box-shadow: 0 0 8px rgba(var(--color-red-rgb), 0.25);
}

/* Session card badges: Single = red, Online = green (from race.ini [REMOTE] ACTIVE=0/1). Header = opposite "LAST SESSION". */
.pb-session-badge-header.pb-session-badge--single,
.pb-session-badge-overlay.pb-session-badge--single {
    color: var(--color-red-primary);
    border: 1px solid var(--color-red-primary);
}
.pb-session-badge-header.pb-session-badge--online,
.pb-session-badge-overlay.pb-session-badge--online {
    color: #22c55e;
    border: 1px solid #22c55e;
}

.pb-session-badge-header {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.pb-badge--external {
    color: #f59e0b;
    border: 1px solid #f59e0b;
}

.pb-badge--unknown {
    color: var(--text-muted);
    border: 1px solid var(--border-gray);
}

.pb-panel__main {
    flex: 1;
    min-height: 0;
}

.pb-serverName {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pb-subLine {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.pb-serverId, .pb-track { font-weight: 500; }
.pb-sep { margin: 0 6px; color: var(--text-muted); opacity: 0.8; }

.pb-panel__footer {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-gray);
    flex-shrink: 0;
}

.pb-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    margin-bottom: 4px;
}

.pb-metric {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.pb-metric .pb-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.pb-metric .pb-value {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-white);
}

.pb-endpoint {
    font-size: 0.7rem;
    font-family: ui-monospace, monospace;
    color: var(--text-muted);
}

.pb-panel__note {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.3;
}

/* Session card (car + track in black box, reference style) */
.pb-panel--session-card .pb-panel__main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 56px;
}

.pb-panel--session-images .pb-panel__main {
    min-height: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    overflow: hidden;
}

.pb-session-images-main {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    gap: 6px;
}

/* Image box: track left, car right, both fill; badge overlay */
.pb-session-images-box {
    position: relative;
    display: flex;
    flex-direction: row;
    flex: 1;
    min-height: 80px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.5);
}

.pb-session-track-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-width: 0;
    position: relative;
}

.pb-session-track-preview-wrap {
    position: relative;
    width: 100%;
    height: 100%;
}

.pb-session-track-preview-wrap .pb-session-track-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    z-index: 0;
}

.pb-session-track-map {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    pointer-events: none;
    z-index: 1;
}
.pb-session-track-map[src=""],
.pb-session-track-map:not([src]) { display: none !important; }

.pb-session-car-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-width: 0;
}

.pb-session-car-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.pb-session-placeholder {
    font-size: 0.85rem;
    color: var(--text-muted);
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
}

.pb-session-badge-overlay {
    position: absolute;
    top: 2px;
    right: 2px;
    z-index: 2;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.65);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
}

.pb-session-names {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 8px;
    padding: 4px 0 0;
    min-height: 0;
}

.pb-session-names .pb-session-track-name,
.pb-session-names .pb-session-car-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-white);
    white-space: normal;
    word-break: break-word;
    overflow: visible;
    text-overflow: unset;
    flex: 1;
    min-width: 0;
    text-align: center;
    line-height: 1.3;
}

.pb-session-names .pb-session-car-name {
    font-weight: 500;
    color: var(--text-gray);
}

.pb-session-card-main {
    gap: 4px;
}

.pb-session-car {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-white);
    letter-spacing: 0.02em;
    line-height: 1.25;
}

.pb-session-track {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    line-height: 1.3;
}

.pb-session-server {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.pb-session-bar {
    margin-top: auto;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    border: none;
    border-top: 1px solid var(--border-gray);
}

.pb-session-bar-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* Track + driver */
.sim-card-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sim-card-track {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-white);
}

/* Last session (from race.ini) */
.sim-card-last-session {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sim-card-last-session-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.sim-card-last-session-car {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-white);
}

.sim-card-last-session-track {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.sim-card-last-session-server {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.sim-card-info-empty {
    font-size: 0.95rem;
    color: var(--text-muted);
}

.sim-card-driver {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Collapsed view: show summary, hide controls. Expanded: show controls, hide summary. */
.sim-card-summary {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border-gray);
    font-size: 0.85rem;
    color: var(--text-muted);
}
.sim-card.sim-card-expanded .sim-card-summary {
    display: none;
}
.sim-card-summary-content {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    line-height: 1.4;
}
.sim-card-pill {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 4px 8px;
    font-size: 0.8rem;
    border-radius: 999px;
    border: 1px solid var(--border-gray);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-white);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sim-card-pill-muted {
    color: var(--text-muted);
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
}
.sim-card-summary-hint {
    margin-top: 8px;
    font-size: 0.75rem;
    opacity: 0.8;
}
.sim-card:not(.sim-card-expanded) .sim-card-controls {
    display: none;
}

/* Per-card controls */
.sim-card-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border-gray);
}

.sim-card-controls--locked {
    opacity: 0.88;
}

.sim-card-dropdown {
    width: 100%;
    background: var(--bg-dark);
    color: var(--text-white);
    border: 1px solid var(--border-gray);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.85rem;
    cursor: pointer;
}

.sim-card-dropdown:focus {
    outline: none;
    border-color: var(--color-red-primary);
}

.sim-card-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.sim-card-online-row {
    margin-bottom: 8px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.sim-card-online-row .sim-card-dropdown {
    width: 100%;
}

.sim-card-server-select-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.sim-card-server-select-wrap .sim-card-dropdown {
    flex: 1;
    min-width: 120px;
}

.sim-card-server-source {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

.sim-card-server-source--favorite {
    color: var(--session-yellow);
    background: rgba(234, 179, 8, 0.15);
}

.sim-card-server-source--preset {
    color: var(--text-muted);
    background: var(--color-red-soft);
}

.sim-card-car-picker-wrap {
    margin-bottom: 8px;
}

.sim-card-car-picker {
    min-height: 44px;
    border: 1px solid var(--border-gray);
    border-radius: 6px;
    background: var(--bg-dark);
    padding: 8px;
}

.sim-card-car-picker-msg {
    display: block;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.sim-card-car-picker-error {
    color: var(--color-red-primary);
}

.sim-card-online-error {
    font-size: 0.75rem;
    color: var(--color-red-primary);
    margin: 4px 0 8px;
    min-height: 1.2em;
}

.sim-card-online-error.hidden {
    display: none;
}

.car-tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 6px;
    max-height: 160px;
    overflow-y: auto;
}

.car-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px;
    border: 2px solid transparent;
    border-radius: 6px;
    background: rgba(255,255,255,0.05);
    color: var(--text-white);
    font-size: 0.7rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.car-tile:hover:not(:disabled) {
    background: rgba(255,255,255,0.1);
}

.car-tile:disabled,
.car-tile.car-tile-taken {
    opacity: 0.5;
    cursor: not-allowed;
    color: var(--text-muted);
}

.car-tile:disabled .car-tile-name,
.car-tile.car-tile-taken .car-tile-name {
    color: var(--text-muted);
}

.car-tile.car-tile-selected {
    border-color: var(--color-red-primary);
    box-shadow: 0 0 0 1px var(--color-red-primary);
}

.car-tile-thumb-wrap {
    position: relative;
    width: 48px;
    height: 32px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.car-tile-img {
    max-width: 48px;
    max-height: 32px;
    object-fit: contain;
}

.car-tile-placeholder {
    width: 48px;
    height: 32px;
    background: rgba(255,255,255,0.08);
    border-radius: 4px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.car-tile-thumb-wrap .car-tile-placeholder {
    position: absolute;
    inset: 0;
    margin: 0;
}

.car-tile-name {
    text-align: center;
    line-height: 1.2;
    word-break: break-word;
}

.car-tile-taken-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.car-combobox-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.car-combobox-filter {
    width: 100%;
    padding: 6px 8px;
    font-size: 0.8rem;
    background: var(--bg-dark);
    color: var(--text-white);
    border: 1px solid var(--border-gray);
    border-radius: 4px;
}

.car-combobox-filter:focus {
    outline: none;
    border-color: var(--color-red-primary);
}

.car-combobox-wrap .car-combobox-select {
    width: 100%;
}

/* Grey out car options when 0/N (no slots left) */
.sim-card-car-select option:disabled,
.sim-card-car-select option.car-option-no-slots {
    color: #6b7280 !important;
    background-color: var(--bg-panel);
}

/* ===== REDESIGNED SIM CARD CONTROLS (v2.6 — reference match) ===== */

/* ===== v2.6: Mode tabs ===== */
.sim-card-session-row {
    display: flex;
    gap: 0;
    border: 1px solid #1e1e1e;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 0;
}
.sim-card-session-pill {
    flex: 1;
    padding: 9px 10px;
    background: transparent;
    border: none;
    color: #555;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    position: relative;
}
.sim-card-session-pill + .sim-card-session-pill {
    border-left: 1px solid #1e1e1e;
}
.sim-card-session-pill--active {
    background: rgba(255,255,255,0.06);
    color: var(--text-white);
}
.sim-card-session-pill--active .sim-card-session-pill-icon {
    color: #22c55e;
}
.sim-card-session-pill:disabled { opacity: 0.4; cursor: not-allowed; }
.sim-card-session-pill-icon {
    font-size: 0.85rem;
    color: #444;
    transition: color 0.15s;
}

/* ===== v2.6: Hero area (full-width track+car image) ===== */
.sim-card-hero {
    position: relative;
    width: 100%;
    background: #080808;
    overflow: hidden;
    border-radius: 0;
    flex-shrink: 0;
}
.sim-card-hero-images {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 140px;
    overflow: hidden;
}
.sim-card-hero-track {
    flex: 1;
    position: relative;
    overflow: hidden;
    min-width: 0;
}
.sim-card-hero-track-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    z-index: 0;
    opacity: 0.55;
}
.sim-card-hero-track-map {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    z-index: 1;
    pointer-events: none;
}
.sim-card-hero-track-map[src=''],
.sim-card-hero-track-map:not([src]) { display: none !important; }
.sim-card-hero-car {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-width: 0;
    background: linear-gradient(135deg, #0a0a0a 0%, #111 100%);
}
.sim-card-hero-car-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}
.sim-card-hero-names {
    padding: 8px 12px 6px;
    background: #0a0a0a;
}
.sim-card-hero-track-name {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-white);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sim-card-hero-track-layout {
    font-size: 0.72rem;
    color: #666;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sim-card-hero-empty {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #2a2a2a;
}
/* Running overlay on hero */
.sim-card-hero-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.55);
    z-index: 5;
    pointer-events: none;
}
.sim-card-hero-overlay-text {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #22c55e;
}
.sim-card-hero-live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 8px #22c55e;
    animation: pb-pulse 1.4s ease-in-out infinite;
}

/* ===== v2.6: Info rows (Car / Server / Driver) ===== */
.sim-card-info-rows {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-bottom: 1px solid #111;
}
.sim-card-info-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-top: 1px solid #111;
    min-height: 0;
}
.sim-card-info-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #444;
    font-size: 0.85rem;
}
.sim-card-info-icon svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.sim-card-info-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    flex: 1;
}
.sim-card-info-label {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #555;
    line-height: 1;
}
.sim-card-info-value {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.sim-card-info-value--empty { color: #333; }
/* Driver row: value is an editable input */
.sim-card-info-driver-input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-white);
    font-size: 0.82rem;
    font-weight: 500;
    font-family: var(--font-sans);
    width: 100%;
    padding: 0;
    min-width: 0;
}
.sim-card-info-driver-input::placeholder { color: #333; }
.sim-card-info-driver-input:focus { color: var(--text-white); }

/* ===== v2.6: Settings row (Steering / Shifting / Timer) ===== */
.sim-card-settings-row {
    display: flex;
    flex-direction: row;
    gap: 0;
    border-bottom: 1px solid #111;
}
.sim-card-setting {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    position: relative;
    cursor: pointer;
    min-width: 0;
    transition: background 0.12s;
}
.sim-card-setting + .sim-card-setting {
    border-left: 1px solid #111;
}
.sim-card-setting:hover:not(.sim-card-setting--disabled) { background: #0d0d0d; }
.sim-card-setting--disabled { opacity: 0.4; cursor: not-allowed; }
.sim-card-setting-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
}
.sim-card-setting-icon svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.sim-card-setting-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    flex: 1;
}
.sim-card-setting-label {
    font-size: 0.56rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #555;
    line-height: 1;
}
.sim-card-setting-value {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-red-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
/* Hidden native select — value store only; display handled by custom dropdown */
.sim-card-setting-select {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: -1 !important;
    border: none !important;
    padding: 0 !important;
}

/* ===== Custom dropdown panel (Steering / Shifting) ===== */
.sim-card-custom-dropdown {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    min-width: 100%;
    width: max-content;
    max-width: 220px;
    background: #111;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.7);
    z-index: 200;
    overflow: hidden;
    display: none;
    flex-direction: column;
}
.sim-card-custom-dropdown.open { display: flex; }
.sim-card-custom-dropdown.drop-up {
    top: auto;
    bottom: calc(100% + 2px);
}
.sim-card-custom-dropdown-item {
    padding: 9px 14px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #aaa;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.1s, color 0.1s;
    font-family: var(--font-sans);
}
.sim-card-custom-dropdown-item:hover {
    background: #1a1a1a;
    color: #fff;
}
.sim-card-custom-dropdown-item.selected {
    color: var(--color-red-primary);
    font-weight: 600;
}
.sim-card-custom-dropdown-item.selected:hover {
    background: #1a1a1a;
    color: var(--color-red-primary);
}
/* Timer: click-to-edit inline input */
.sim-card-timer-display {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-red-primary);
    cursor: text;
    min-width: 24px;
    white-space: nowrap;
}
.sim-card-timer-input {
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--color-red-primary);
    outline: none;
    color: var(--color-red-primary);
    font-size: 0.78rem;
    font-weight: 600;
    font-family: var(--font-sans);
    width: 48px;
    padding: 0;
    display: none;
}
.sim-card-timer-input.editing { display: inline-block; }
.sim-card-timer-display.hidden { display: none; }

/* ===== v2.6: Settings tiles row (kept for backward compat, hidden) ===== */
.sim-card-settings-tiles { display: none !important; }
.sim-card-tile { display: none !important; }
.sim-card-tile-label { display: none !important; }
.sim-card-tile-value { display: none !important; }
.sim-card-tile-chevron { display: none !important; }
.sim-card-tile-select { display: none !important; }
.sim-card-timer-custom-wrap { display: none !important; }
.sim-card-timer-custom-label { display: none !important; }
.sim-card-timer-custom-row { display: none !important; }
.sim-card-timer-custom-ok { display: none !important; }

/* ===== v2.6: Driver name row (kept for backward compat, hidden) ===== */
.sim-card-driver-row-v2 { display: none !important; }

/* ===== v2.6: Primary action row ===== */
.sim-card-primary-action {
    margin-top: 0;
    display: flex;
    gap: 0;
    align-items: stretch;
    position: relative;
    padding: 10px 12px;
}
.btn-card-primary {
    flex: 1;
    padding: 12px 16px;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    border: none;
    border-radius: 6px 0 0 6px;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: background 0.15s, opacity 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-card-primary-arrow {
    font-size: 0.9rem;
    opacity: 0.8;
}
.btn-card-primary--launch {
    background: var(--color-red-primary);
    color: #fff;
}
.btn-card-primary--launch:hover:not(:disabled) { background: #cc0000; }
.btn-card-primary--end {
    background: rgba(239,68,68,0.15);
    color: #f87171;
    border: 1px solid rgba(239,68,68,0.35);
}
.btn-card-primary--end:hover:not(:disabled) { background: rgba(239,68,68,0.25); color: #fff; }
.btn-card-primary:disabled { opacity: 0.4; cursor: not-allowed; }

/* MORE button — right-side companion to primary */
.btn-card-more {
    padding: 12px 14px;
    background: #1a1a1a;
    border: none;
    border-left: 1px solid #2a2a2a;
    border-radius: 0 6px 6px 0;
    color: #888;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: color 0.12s, background 0.12s;
    flex-shrink: 0;
    position: relative;
    display: flex;
    align-items: center;
    gap: 5px;
}
.btn-card-more:hover { color: var(--text-white); background: #222; }
.btn-card-more:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-card-more-dots {
    font-size: 1rem;
    letter-spacing: 0.05em;
    line-height: 1;
}

/* MORE dropdown panel */
.sim-card-more-menu {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    right: 0;
    min-width: 180px;
    background: #111;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.7);
    z-index: 100;
    overflow: hidden;
}
.sim-card-more-menu.open { display: block; }
.sim-card-more-menu-item {
    display: block;
    width: 100%;
    padding: 10px 14px;
    background: transparent;
    border: none;
    color: var(--text-white);
    font-size: 0.8rem;
    font-family: var(--font-sans);
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background 0.1s;
    white-space: nowrap;
}
.sim-card-more-menu-item:hover { background: #1a1a1a; }
.sim-card-more-menu-item--danger { color: #f87171; }
.sim-card-more-menu-item--danger:hover { background: rgba(239,68,68,0.12); }
.sim-card-more-menu-item:disabled { opacity: 0.4; cursor: not-allowed; }
.sim-card-more-menu-sep { height: 1px; background: #1e1e1e; margin: 2px 0; }
.sim-card-more-confirm {
    padding: 8px 14px 10px;
    background: #0d0d0d;
    border-top: 1px solid #1e1e1e;
    display: none;
}
.sim-card-more-confirm.open { display: block; }
.sim-card-more-confirm-msg {
    font-size: 0.75rem;
    color: #ccc;
    margin-bottom: 8px;
    display: block;
}
.sim-card-more-confirm-btns { display: flex; gap: 6px; }
.sim-card-more-confirm-ok {
    flex: 1;
    padding: 6px 10px;
    background: var(--color-red-primary);
    border: none;
    color: #fff;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font-sans);
}
.sim-card-more-confirm-ok:hover { background: #cc0000; }
.sim-card-more-confirm-cancel {
    flex: 1;
    padding: 6px 10px;
    background: transparent;
    border: 1px solid #333;
    color: #888;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    font-family: var(--font-sans);
}
.sim-card-more-confirm-cancel:hover { color: #fff; border-color: #555; }

/* Launch confirmation row (inline below primary button) */
.sim-card-launch-confirm {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.sim-card-launch-confirm.hidden { display: none; }

/* v2.6: sim-card-controls used as thin wrappers — override padding via inline style */
.sim-card-controls[style*="padding:0"] { padding: 0 !important; border-top: none !important; margin-top: 0 !important; }
.sim-card-controls[style*="padding:10px"] { padding: 10px 12px 0 !important; border-top: none !important; margin-top: 0 !important; }

/* Old rows: kept as hidden stubs so any stale references don't break */
.sim-card-config-row-1,
.sim-card-config-row-2,
.sim-card-action-row-1,
.sim-card-action-row-2 { display: none !important; }

/* Legacy classes - kept for backward compatibility */
.sim-card-presets-row { display: none; }
.sim-card-preset-col { display: none; }
.sim-card-buttons { display: none; }

/* Countdown badge next to status pill in header */
.sim-card-header-status-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
/* Driver Screen toggle pill — sits in the card header next to the status pill */
.driver-screen-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    border: none;
    outline: none;
    transition: opacity 0.15s, transform 0.1s;
}
.driver-screen-pill:hover { opacity: 0.85; }
.driver-screen-pill:active { transform: scale(0.96); }
.driver-screen-pill:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.driver-screen-pill-on {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success-green);
}
.driver-screen-pill-on .status-pill-dot { background: var(--success-green); }
.driver-screen-pill-off {
    background: var(--color-red-soft);
    color: var(--color-red-primary);
}
.driver-screen-pill-off .status-pill-dot { background: var(--color-red-primary); }

.sim-card-countdown-badge {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
    min-width: 3.5em;
    text-align: center;
}
.sim-card-countdown-badge.hidden {
    display: none;
}
.sim-card-countdown-badge.badge-running {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success-green);
}
.sim-card-countdown-badge.badge-ending-soon {
    background: rgba(234, 179, 8, 0.25);
    color: #f59e0b;
}
.sim-card-countdown-badge.badge-final {
    background: rgba(239, 68, 68, 0.25);
    color: var(--color-red-primary);
}
.sim-card-countdown-badge.badge-final.status-pill-flash {
    animation: countdown-flash 1s ease-in-out infinite;
}
@keyframes countdown-flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Status pill variants for countdown (Running = green, Ending Soon = orange, Final = red) */
.status-pill-running {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success-green);
}
.status-pill-running .status-pill-dot { background: var(--success-green); }

.status-pill-ending-soon {
    background: rgba(234, 179, 8, 0.25);
    color: #f59e0b;
}
.status-pill-ending-soon .status-pill-dot { background: #f59e0b; }

.status-pill-final {
    background: rgba(239, 68, 68, 0.25);
    color: var(--color-red-primary);
}
.status-pill-final .status-pill-dot { background: var(--color-red-primary); }
.status-pill-final.status-pill-flash {
    animation: countdown-flash 1s ease-in-out infinite;
}

.sim-card-driver-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Legacy driver input — overridden by v2.6 .sim-card-info-driver-input */
.sim-card-driver-input {
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
    background: var(--bg-dark);
    color: var(--text-white);
    border: 1px solid var(--border-gray);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.85rem;
}
.sim-card-driver-input:focus {
    outline: none;
    border-color: var(--color-red-primary);
}
.sim-card-driver-input::placeholder {
    color: var(--text-muted);
}
/* v2.6 override: when the driver input is inside an info row, use transparent inline style */
.sim-card-info-row .sim-card-driver-input,
.sim-card-info-row .sim-card-info-driver-input {
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    font-size: 0.82rem !important;
    font-weight: 500 !important;
    color: var(--text-white) !important;
    width: 100% !important;
    min-width: 0 !important;
    outline: none !important;
    font-family: var(--font-sans) !important;
}
.sim-card-info-row .sim-card-driver-input::placeholder,
.sim-card-info-row .sim-card-info-driver-input::placeholder { color: #333 !important; }

.btn-driver-reset {
    flex-shrink: 0;
    padding: 8px 12px;
    font-size: 0.8rem;
}

.sim-card-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sim-card-buttons button {
    flex: 1;
    min-width: 100px;
    padding: 8px 12px;
    font-size: 0.8rem;
}

.btn-card-launch { }
.btn-card-end { }
.btn-card-reset { }

/* Toast */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 380px;
    /* Empty container must never absorb taps; individual toasts re-enable
       pointer-events so they remain clickable. Without this the (often empty)
       container blocks the hamburger / sidebar links on mobile, where the
       responsive rule below stretches it full-width. */
    pointer-events: none;
}
.toast-container > * { pointer-events: auto; }

.toast {
    background: var(--bg-panel);
    border: 1px solid var(--border-gray);
    border-radius: 6px;
    padding: 14px 18px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    animation: slideIn 0.25s ease-out;
}

.toast.success { border-left: 4px solid var(--success-green); }
.toast.error { border-left: 4px solid var(--color-red-primary); }
.toast.warning { border-left: 4px solid #f59e0b; }

.toast.error a.pitbox-signin-link {
    color: var(--session-yellow);
    font-weight: 600;
    text-decoration: underline;
}

.toast.removing {
    animation: slideOut 0.25s ease-in forwards;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}
/* Toast layout: message + dismiss button */
.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.toast-message { flex: 1; min-width: 0; }
.toast-close {
    flex-shrink: 0;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
    margin-top: -1px;
    opacity: 0.7;
    transition: opacity 0.15s;
}
.toast-close:hover { opacity: 1; color: var(--text-white); }
/* Highlight duplicate toast instead of stacking */
@keyframes toastHighlight {
    0%   { box-shadow: 0 0 0 0 rgba(255,255,255,0.35); }
    50%  { box-shadow: 0 0 0 4px rgba(255,255,255,0.15); }
    100% { box-shadow: 0 4px 12px rgba(0,0,0,0.4); }
}
.toast-highlight { animation: toastHighlight 0.6s ease-out; }
/* Rename toast-fade-out to toast-removing for consistency */
.toast-fade-out { animation: slideOut 0.25s ease-in forwards; }

@media (max-width: 1200px) {
    .rig-selector-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ============================================================
   Mobile shell -- off-canvas sidebar drawer (<= 768px)
   ============================================================
   The desktop layout is body{display:flex} with a fixed 260px
   sidebar to the left of .main-content. On phones we:
     * Switch body to block layout so .main-content is full-width.
     * Pin .sidebar to the viewport and translate it off-canvas.
     * Add a hamburger button (.mobile-nav-toggle) inside the
       page header strip and a backdrop (.mobile-nav-backdrop).
     * Toggling body.mobile-nav-open slides the drawer in and
       reveals the backdrop. JS handles the toggle + close-on-
       nav-link-click / backdrop tap / Escape.
*/
.mobile-nav-toggle {
    display: none; /* shown via @media below */
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 12px;
    background: var(--bg-panel);
    border: 1px solid var(--border-gray);
    border-radius: var(--radius-md, 8px);
    color: var(--text-white);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
}
.mobile-nav-toggle:hover { background: rgba(255,255,255,0.08); }
.mobile-nav-toggle:focus-visible {
    outline: 2px solid var(--color-red-primary);
    outline-offset: 2px;
}
.mobile-nav-toggle svg { width: 20px; height: 20px; display: block; }
.mobile-nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 90;
    -webkit-tap-highlight-color: transparent;
}

@media (max-width: 768px) {
    body { display: block; }

    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: min(84vw, 320px);
        min-width: 0;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        box-shadow: 4px 0 18px rgba(0,0,0,0.55);
        will-change: transform;
        overflow-y: auto;
    }
    /* Override the desktop rule that pins width:260px regardless. */
    .sidebar:not(.sidebar--collapsed) { width: min(84vw, 320px); min-width: 0; }

    body.mobile-nav-open .sidebar { transform: translateX(0); }
    body.mobile-nav-open .mobile-nav-backdrop { display: block; }
    body.mobile-nav-open { overflow: hidden; } /* prevent background scroll */

    .main-content {
        width: 100%;
        min-height: 100vh;
        padding: 14px 14px 24px;
    }

    .mobile-nav-toggle { display: inline-flex; }

    /* Touch-friendly nav rows */
    .sidebar-nav { padding: 16px 12px; gap: 6px; }
    .sidebar-nav .nav-link,
    .nav-link { padding: 14px 16px; font-size: 0.95rem; }
    .sidebar-header { padding: 18px 16px; }
    .sidebar-logo { font-size: 1.2rem; }

    /* Page headers / titles */
    .page-title { font-size: 1.2rem; }
    .page-header { margin-bottom: 16px; }
    .cc-title { font-size: 1.2rem; }
    .cc-subtitle { font-size: 0.82rem; }

    /* Garage / dashboard cards stack and breathe on mobile */
    .cc-header { flex-direction: column; align-items: stretch; gap: 10px; }
    .cc-header-right {
        width: 100%;
        flex-wrap: wrap;
        gap: 10px;
        justify-content: flex-start;
    }
    .cc-select { flex: 1 1 160px; min-width: 0; }
    .cc-kpi-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .cc-kpi-tile { padding: 12px; }
    .cc-kpi-value { font-size: 1.05rem; }
    .cc-main-row { grid-template-columns: 1fr; }
    .cc-control-buttons .cc-btn { flex: 1 1 100px; min-width: 0; }

    /* Stats / dashboards */
    .stats-row { grid-template-columns: 1fr; gap: 12px; }
    .rig-selector-grid { grid-template-columns: repeat(2, 1fr); }

    /* Tables -- always horizontally scrollable, never break the page */
    .dashboard-sim-list { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .dashboard-table { min-width: 640px; }

    /* Modals: nearly full-bleed on phones */
    .modal-content { width: 94vw; max-width: 94vw; max-height: 90vh; overflow-y: auto; }

    /* Toasts shouldn't pin-out off-screen. Reset top so the container is
       bottom-anchored only (otherwise top:20px + bottom:12px stretches it
       full-viewport-height and -- before pointer-events:none -- it absorbed
       every tap on the page). */
    .toast-container { top: auto; left: 12px; right: 12px; bottom: 12px; }

    /* Live Timing leaderboard / cards stack */
    .lt-grid,
    .lt-cards-row { grid-template-columns: 1fr !important; }
    .lt-header-row { flex-wrap: wrap; gap: 8px; }

    /* Booking admin filter bars wrap */
    .ba-filters,
    .ba-toolbar { flex-wrap: wrap; gap: 8px; }

    /* Server config two-column already breaks via its own 900px query;
       just make sure the preset sidebar doesn't pin itself open here. */
    .sc-presets-sidebar { max-width: 100%; }
}

@media (max-width: 480px) {
    .cc-kpi-row { grid-template-columns: 1fr; }
    .rig-selector-grid { grid-template-columns: 1fr; }
    .main-content { padding: 12px 12px 24px; }
}

/* ========== Command Center Dashboard ========== */
.command-center-dashboard {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    max-width: 1200px;
}
.cc-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
}
.cc-header-left { display: flex; flex-direction: column; gap: 4px; }
.cc-title { font-size: 1.5rem; font-weight: 700; letter-spacing: 0.02em; color: var(--text-white); }
.cc-subtitle { font-size: 0.9rem; color: var(--text-muted); }
.cc-header-right {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-md);
}
.cc-server-label { font-size: 0.8rem; text-transform: uppercase; color: var(--text-muted); }
.cc-select {
    min-width: 160px;
    padding: 8px 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border-gray);
    border-radius: var(--radius-md);
    color: var(--text-white);
    font-size: 0.9rem;
}
.cc-status-pills { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cc-pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border: 1px solid var(--border-gray);
    background: rgba(255,255,255,0.06);
}
.cc-pill-muted { color: var(--text-muted); }
.cc-pill-ok { color: var(--success-green); border-color: rgba(34,197,94,0.4); background: rgba(34,197,94,0.1); }
.cc-pill-warn { color: var(--session-yellow); border-color: rgba(234,179,8,0.4); background: rgba(234,179,8,0.1); }

.cc-glass-card {
    background: linear-gradient(145deg, rgba(26,26,26,0.95) 0%, rgba(17,17,17,0.98) 100%);
    border: 1px solid var(--border-gray);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    box-shadow: 0 4px 24px rgba(0,0,0,0.3);
}
.cc-kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-md);
}
.cc-kpi-tile {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.cc-kpi-heading {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}
.cc-kpi-value {
    font-size: 1.25rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text-white);
}
.cc-muted { color: var(--text-muted); font-weight: 500; }

.cc-main-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
}
@media (max-width: 900px) {
    .cc-main-row { grid-template-columns: 1fr; }
    .cc-kpi-row { grid-template-columns: repeat(2, 1fr); }
}
.cc-card-heading {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: var(--space-md);
}
.cc-hero-track, .cc-hero-layout { display: flex; flex-direction: column; gap: 2px; }
.cc-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; }
.cc-hero-value { font-size: 1.1rem; font-weight: 600; color: var(--text-white); }

.cc-callout {
    padding: 10px 12px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    margin-bottom: var(--space-md);
}
.cc-callout.hidden { display: none; }
.cc-callout-warning {
    background: rgba(234,179,8,0.12);
    border: 1px solid rgba(234,179,8,0.4);
    color: var(--session-yellow);
}
.cc-control-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: var(--space-sm);
}
.cc-btn {
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.cc-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.cc-btn-primary {
    background: var(--color-red-primary);
    border-color: var(--color-red-primary);
    color: var(--text-white);
}
.cc-btn-primary:hover:not(:disabled) {
    background: var(--color-red-hover);
    border-color: var(--color-red-hover);
}
.cc-btn-secondary {
    background: var(--bg-panel);
    border-color: var(--border-gray);
    color: var(--text-gray);
}
.cc-btn-secondary:hover:not(:disabled) {
    border-color: var(--text-muted);
    color: var(--text-white);
}
.cc-btn-danger-outline {
    background: transparent;
    border-color: var(--color-red-primary);
    color: var(--color-red-primary);
}
.cc-btn-danger-outline:hover:not(:disabled) {
    background: rgba(var(--color-red-rgb),0.15);
}
.cc-server-status { font-size: 0.85rem; margin-top: 8px; }

/* ========== Dashboard (sim status overview) ========== */
.dashboard-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.dashboard-sim-list {
    overflow-x: auto;
}
.dashboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.dashboard-table th,
.dashboard-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-gray);
}
.dashboard-th {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
}
.dashboard-cell-sim .dashboard-sim-name {
    font-weight: 600;
    color: var(--text-white);
}
.dashboard-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}
.dashboard-status-running {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success-green);
}
.dashboard-status-idle {
    background: rgba(59, 130, 246, 0.2);
    color: var(--idle-blue);
}
.dashboard-status-offline {
    background: rgba(107, 114, 128, 0.3);
    color: var(--offline-gray);
}
.dashboard-cell-track,
.dashboard-cell-car,
.dashboard-cell-mode,
.dashboard-cell-server {
    color: var(--text-gray);
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dashboard-cell-session-time,
.dashboard-cell-time-left {
    font-variant-numeric: tabular-nums;
    color: var(--text-gray);
}
.dashboard-empty {
    color: var(--text-muted);
    padding: 24px;
    text-align: center;
}
.dashboard-error {
    color: var(--color-red-primary);
}

/* ========== Admin Portal (Fastest-Lap-Hub: Bookings, Schedule, Check-in) ========== */
.admin-portal {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    background: var(--bg-black);
}
.admin-portal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 24px;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border-gray);
    flex-shrink: 0;
}
.admin-portal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-white);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}
.admin-portal-nav {
    display: flex;
    gap: 4px;
}
.admin-portal-tab {
    padding: 8px 16px;
    font-size: 0.9rem;
    color: var(--text-gray);
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.admin-portal-tab:hover {
    color: var(--text-white);
    background: rgba(255,255,255,0.06);
}
.admin-portal-tab.active {
    color: var(--text-white);
    background: var(--color-red-primary);
}
.admin-portal-content {
    flex: 1;
    overflow: auto;
    padding: 24px;
}
.admin-portal-panel {
    min-height: 200px;
}
.admin-portal-panel.hidden {
    display: none !important;
}
/* System Logs page */
.logs-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    margin-bottom: 16px;
}
.logs-filter-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
}
.logs-filter-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.logs-filter-select {
    background: var(--bg-dark);
    color: var(--text-white);
    border: 1px solid var(--border-gray);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.85rem;
}
.logs-search-input {
    min-width: 180px;
    background: var(--bg-dark);
    color: var(--text-white);
    border: 1px solid var(--border-gray);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.85rem;
}
.logs-table-wrap {
    overflow-x: auto;
    margin-bottom: 16px;
}
.logs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.logs-table th,
.logs-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-gray);
}
.logs-table thead {
    background: var(--bg-panel);
}
.logs-th-time { width: 160px; }
.logs-th-rig { width: 80px; }
.logs-th-cat { width: 90px; }
.logs-th-msg { min-width: 200px; }
.logs-th-level { width: 70px; }
.logs-row {
    cursor: pointer;
}
.logs-row:hover {
    background: var(--bg-panel);
}
.logs-level-error {
    color: var(--color-red-primary);
}
.logs-level-warn {
    color: var(--text-warning, #e6b800);
}
.logs-error-cell {
    color: var(--text-muted);
    padding: 16px;
}
.logs-pinned {
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg-panel);
    border: 1px solid var(--border-gray);
    border-radius: 6px;
}
.logs-pinned.hidden {
    display: none;
}
.logs-pinned-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-white);
    margin: 0 0 8px 0;
}
.logs-pinned-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.logs-pinned-item {
    font-size: 0.8rem;
    color: var(--color-red-primary);
}
.logs-pinned-time {
    color: var(--text-muted);
    margin-right: 8px;
}
.logs-pinned-rig {
    margin-right: 8px;
}
.logs-detail {
    padding: 16px;
    background: var(--bg-panel);
    border: 1px solid var(--border-gray);
    border-radius: 6px;
    font-size: 0.85rem;
}
.logs-detail.hidden {
    display: none;
}
.logs-detail-title {
    margin: 0 0 10px 0;
    font-size: 0.95rem;
    color: var(--text-white);
}
.logs-detail-row {
    margin: 6px 0;
    color: var(--text-muted);
}
.logs-detail-row strong {
    color: var(--text-white);
    margin-right: 8px;
}
.logs-detail-json {
    margin: 10px 0 0 0;
    padding: 12px;
    background: var(--bg-dark);
    border-radius: 4px;
    overflow-x: auto;
    font-size: 0.8rem;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ========== Mumble Admin Page ========== */
.mumble-wrap {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0 24px 24px;
    gap: 16px;
    overflow-y: auto;
}
.mumble-push-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.mumble-push-result {
    font-size: .8rem;
    color: var(--text-muted);
    margin-top: 4px;
    width: 100%;
}
.mumble-main {
    display: flex;
    gap: 16px;
    flex: 1 1 auto;
    min-height: 280px;
}
.mumble-panel {
    flex: 1 1 0;
    background: var(--card-bg, #18191c);
    border: 1px solid var(--border-color, #2a2b2f);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.mumble-panel-title {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 10px 14px 6px;
    border-bottom: 1px solid var(--border-color, #2a2b2f);
    margin: 0;
}
.mumble-channel-list,
.mumble-user-list {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 8px 0;
}
.mumble-placeholder {
    color: var(--text-muted);
    font-size: .8rem;
    padding: 12px 14px;
    margin: 0;
}
.mumble-channel-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    font-size: .85rem;
    cursor: default;
    transition: background .1s, outline .1s;
}
.mumble-channel-item:hover {
    background: var(--hover-bg, #22232a);
}
.mumble-channel-item.mumble-drag-over {
    background: rgba(72,187,120,.12);
    outline: 2px dashed var(--accent-green, #48bb78);
    outline-offset: -2px;
    border-radius: 4px;
}
.mumble-channel-name {
    flex: 1;
    font-weight: 500;
}
.mumble-channel-sub {
    padding-left: 28px;
}
.mumble-user-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    font-size: .85rem;
    cursor: grab;
}
.mumble-user-row:hover {
    background: var(--hover-bg, #22232a);
}
.mumble-user-row.mumble-dragging {
    opacity: .45;
    cursor: grabbing;
}
.mumble-user-name {
    flex: 1;
    font-weight: 500;
}
.mumble-user-channel {
    font-size: .75rem;
    color: var(--text-muted);
    flex: 0 0 auto;
}
.mumble-user-icons {
    display: flex;
    gap: 4px;
    align-items: center;
}
.mumble-icon-muted {
    color: #e53e3e;
    font-size: .7rem;
    font-weight: 700;
    background: rgba(229,62,62,.15);
    border-radius: 3px;
    padding: 1px 4px;
}
.mumble-user-actions {
    display: flex;
    gap: 4px;
}
.mumble-user-actions button {
    font-size: .7rem;
    padding: 2px 8px;
    border: 1px solid var(--border-color, #2a2b2f);
    background: transparent;
    color: var(--text-muted);
    border-radius: 4px;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.mumble-user-actions button:hover {
    background: var(--hover-bg, #22232a);
    color: var(--text-primary, #fff);
}
.mumble-user-actions .btn-mute-active {
    border-color: #e53e3e;
    color: #e53e3e;
}
.mumble-user-actions .btn-kick {
    border-color: #e53e3e;
}
.mumble-user-actions .btn-kick:hover {
    background: rgba(229,62,62,.15);
    color: #e53e3e;
}
.mumble-message-row {
    border-top: 1px solid var(--border-color, #2a2b2f);
    padding-top: 12px;
}
.mumble-message-fields {
    display: flex;
    gap: 8px;
    align-items: center;
}
.mumble-msg-select {
    min-width: 140px;
}
.mumble-config-section {
    border: 1px solid var(--border-color, #2a2b2f);
    border-radius: 6px;
    padding: 0;
    margin-top: 4px;
}
.mumble-config-summary {
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    padding: 10px 14px;
    list-style: none;
    user-select: none;
}
.mumble-config-summary::-webkit-details-marker { display: none; }
.mumble-config-form {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ── Discord-style channel tree ─────────────────────────────────── */
.mbl-tree {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 6px 0;
    user-select: none;
}
.mbl-ch-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 10px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    margin: 1px 4px;
    transition: background .1s, color .1s;
}
.mbl-ch-header:hover {
    background: var(--hover-bg, #22232a);
    color: var(--text-primary, #e0e0e0);
}
.mbl-ch-header.mbl-drag-over {
    background: rgba(229,62,62,.12);
    outline: 2px dashed #e53e3e;
    outline-offset: -2px;
    color: #e53e3e;
}
.mbl-ch-toggle {
    font-size: .6rem;
    width: 12px;
    flex-shrink: 0;
    text-align: center;
    transition: transform .15s;
    color: var(--text-muted);
}
.mbl-ch.mbl-collapsed > .mbl-ch-header .mbl-ch-toggle {
    transform: rotate(-90deg);
}
.mbl-ch-icon {
    font-size: .8rem;
    flex-shrink: 0;
    opacity: .7;
}
.mbl-ch-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mbl-ch-count {
    font-size: .68rem;
    font-weight: 600;
    color: var(--accent-green, #48bb78);
    flex-shrink: 0;
}
.mbl-ch-actions {
    display: flex;
    gap: 3px;
    opacity: 0;
    transition: opacity .12s;
    flex-shrink: 0;
}
.mbl-ch-header:hover .mbl-ch-actions {
    opacity: 1;
}
.mbl-ch-actions button {
    font-size: .62rem;
    padding: 1px 5px;
    border: 1px solid var(--border-color, #2a2b2f);
    background: transparent;
    color: var(--text-muted);
    border-radius: 3px;
    cursor: pointer;
    white-space: nowrap;
}
.mbl-ch-actions button:hover {
    background: var(--hover-bg, #22232a);
    color: var(--text-primary, #e0e0e0);
}
.mbl-ch.mbl-collapsed > .mbl-ch-users {
    display: none;
}
.mbl-ch.mbl-collapsed > .mbl-ch-children {
    display: none;
}
.mbl-user {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .82rem;
    cursor: grab;
    border-radius: 4px;
    margin: 1px 4px;
    padding: 3px 8px;
    transition: background .1s;
    color: var(--text-primary, #e0e0e0);
}
.mbl-user:hover {
    background: var(--hover-bg, #22232a);
}
.mbl-user.mbl-dragging {
    opacity: .35;
    cursor: grabbing;
}
.mbl-user-icon {
    font-size: .75rem;
    flex-shrink: 0;
    opacity: .55;
}
.mbl-user.mbl-talking .mbl-user-icon {
    opacity: 1;
}
.mbl-user.mbl-talking .mbl-mic-icon {
    stroke: #ef4444;
    filter: drop-shadow(0 0 3px rgba(239,68,68,.5));
}
.mbl-user-name {
    flex: 1;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color .15s;
}
.mbl-user.mbl-talking .mbl-user-name {
    color: #ef4444;
    font-weight: 600;
}
.mbl-user-muted {
    font-size: .6rem;
    font-weight: 700;
    border-radius: 2px;
    padding: 1px 3px;
    flex-shrink: 0;
}
.mbl-user-muted.mbl-self-mute {
    background: rgba(229,62,62,.12);
    color: #e53e3e;
}
.mbl-user-muted.mbl-server-mute {
    background: rgba(229,100,30,.12);
    color: #e5641e;
}
.mbl-user-actions {
    display: flex;
    gap: 3px;
    opacity: 0;
    transition: opacity .12s;
    flex-shrink: 0;
}
.mbl-user:hover .mbl-user-actions {
    opacity: 1;
}
.mbl-user-actions button {
    font-size: .62rem;
    padding: 1px 6px;
    border: 1px solid var(--border-color, #2a2b2f);
    background: transparent;
    color: var(--text-muted);
    border-radius: 3px;
    cursor: pointer;
    white-space: nowrap;
}
.mbl-user-actions button:hover {
    background: var(--hover-bg, #22232a);
    color: var(--text-primary, #e0e0e0);
}
.mbl-user-actions .mbl-btn-mute-active {
    border-color: #e53e3e;
    color: #e53e3e;
}
.mbl-user-actions .mbl-btn-kick {
    border-color: rgba(229,62,62,.35);
}
.mbl-user-actions .mbl-btn-kick:hover {
    background: rgba(229,62,62,.12);
    color: #e53e3e;
}

/* ===== SERVER PICKER MODAL ===== */
.sp-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.72);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.sp-overlay.hidden { display: none !important; }
.sp-modal {
    background: var(--bg-panel, #0d0d0d);
    border: 1px solid var(--border-gray, #1a1a1a);
    border-radius: 10px;
    width: min(860px, 100%);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.sp-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 18px 20px 12px;
    border-bottom: 1px solid var(--border-gray, #1a1a1a);
    flex-shrink: 0;
}
.sp-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-white, #fff);
    letter-spacing: .05em;
    text-transform: uppercase;
}
.sp-subtitle {
    font-size: .75rem;
    color: var(--text-muted, #888);
    margin-top: 2px;
}
.sp-close {
    background: transparent;
    border: 1px solid var(--border-gray, #1a1a1a);
    color: var(--text-muted, #888);
    border-radius: 5px;
    padding: 4px 10px;
    font-size: .8rem;
    cursor: pointer;
    transition: color .15s, border-color .15s;
    flex-shrink: 0;
}
.sp-close:hover { color: var(--text-white, #fff); border-color: #555; }
.sp-mode-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-gray, #1a1a1a);
    flex-shrink: 0;
}
.sp-mode-tab {
    flex: 1;
    padding: 11px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted, #888);
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .06em;
    cursor: pointer;
    transition: color .15s, border-color .15s;
    font-family: var(--font-sans);
}
.sp-mode-tab.active {
    color: var(--color-red-primary, #FF0000);
    border-bottom-color: var(--color-red-primary, #FF0000);
}
.sp-mode-tab:hover:not(.active) { color: var(--text-white, #fff); }
.sp-panel {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
/* --- Online/LAN panel --- */
.sp-online-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.sp-server-list-col {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-gray, #1a1a1a);
    min-height: 0;
}
.sp-search-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px 8px;
    border-bottom: 1px solid var(--border-gray, #1a1a1a);
    flex-shrink: 0;
}
.sp-search-icon { color: var(--text-muted, #888); font-size: .9rem; }
.sp-search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-white, #fff);
    font-size: .85rem;
    font-family: var(--font-sans);
}
.sp-search-input::placeholder { color: var(--text-muted, #888); }
.sp-search-status { font-size: .72rem; color: var(--text-muted, #888); white-space: nowrap; }
.sp-filter-tabs {
    display: flex;
    gap: 0;
    padding: 6px 14px;
    border-bottom: 1px solid var(--border-gray, #1a1a1a);
    flex-shrink: 0;
}
.sp-filter-tab {
    background: transparent;
    border: 1px solid var(--border-gray, #1a1a1a);
    color: var(--text-muted, #888);
    padding: 4px 12px;
    font-size: .75rem;
    font-weight: 600;
    cursor: pointer;
    transition: color .15s, background .15s;
    letter-spacing: .04em;
    font-family: var(--font-sans);
}
.sp-filter-tab:first-child { border-radius: 4px 0 0 4px; }
.sp-filter-tab:last-child { border-radius: 0 4px 4px 0; }
.sp-filter-tab:not(:first-child) { border-left: none; }
.sp-filter-tab.active {
    background: var(--color-red-primary, #FF0000);
    border-color: var(--color-red-primary, #FF0000);
    color: #fff;
}
.sp-filter-tab:hover:not(.active) { color: var(--text-white, #fff); background: rgba(255,255,255,.04); }
.sp-server-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}
.sp-server-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    cursor: pointer;
    transition: background .12s;
    border-left: 2px solid transparent;
}
.sp-server-row:hover { background: rgba(255,255,255,.04); }
.sp-server-row.selected {
    background: rgba(255,0,0,.08);
    border-left-color: var(--color-red-primary, #FF0000);
}
.sp-server-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.sp-server-dot.online { background: #22c55e; }
.sp-server-dot.lan { background: #3b82f6; }
.sp-server-dot.offline { background: #555; }
.sp-server-info { flex: 1; min-width: 0; }
.sp-server-name {
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-white, #fff);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sp-server-meta {
    font-size: .7rem;
    color: var(--text-muted, #888);
    margin-top: 1px;
}
.sp-server-badge {
    font-size: .65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    flex-shrink: 0;
    letter-spacing: .04em;
}
.sp-server-badge.fav { background: rgba(237,137,54,.18); color: #ed8936; }
.sp-server-badge.lan { background: rgba(59,130,246,.18); color: #3b82f6; }
.sp-server-badge.preset { background: rgba(74,222,128,.15); color: #4ade80; }
.sp-server-empty {
    padding: 24px 14px;
    text-align: center;
    color: var(--text-muted, #888);
    font-size: .8rem;
}
/* Detail panel */
.sp-detail-col {
    display: flex;
    flex-direction: column;
    padding: 16px;
    overflow-y: auto;
    min-height: 0;
}
.sp-detail-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted, #888);
    font-size: .82rem;
    text-align: center;
    height: 100%;
}
.sp-detail-content { display: flex; flex-direction: column; gap: 10px; }
.sp-detail-track-img {
    width: 100%;
    height: 100px;
    background: rgba(255,255,255,.04);
    border-radius: 6px;
    border: 1px solid var(--border-gray, #1a1a1a);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted, #888);
    font-size: .75rem;
    overflow: hidden;
}
.sp-detail-track-img img { width: 100%; height: 100%; object-fit: cover; }
.sp-detail-server-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-white, #fff);
}
.sp-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 12px;
}
.sp-detail-item { display: flex; flex-direction: column; gap: 2px; }
.sp-detail-label { font-size: .65rem; color: var(--text-muted, #888); text-transform: uppercase; letter-spacing: .05em; }
.sp-detail-value { font-size: .82rem; color: var(--text-white, #fff); font-weight: 600; }
.sp-detail-cars-label { font-size: .65rem; color: var(--text-muted, #888); text-transform: uppercase; letter-spacing: .05em; margin-top: 4px; }
.sp-detail-cars { display: flex; flex-wrap: wrap; gap: 5px; }
.sp-car-chip {
    font-size: .7rem;
    padding: 3px 8px;
    border-radius: 3px;
    background: rgba(255,255,255,.06);
    color: var(--text-muted, #888);
    border: 1px solid var(--border-gray, #1a1a1a);
}
.sp-car-chip.assigned {
    background: rgba(255,0,0,.15);
    color: var(--color-red-primary, #FF0000);
    border-color: var(--color-red-primary, #FF0000);
}
/* --- Solo session panel --- */
.sp-solo-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.sp-solo-left {
    border-right: 1px solid var(--border-gray, #1a1a1a);
    overflow-y: auto;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.sp-solo-right {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.sp-session-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    padding: 8px 12px 0;
    border-bottom: 1px solid var(--border-gray, #1a1a1a);
    flex-shrink: 0;
}
.sp-session-tab {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted, #888);
    padding: 6px 10px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .05em;
    cursor: pointer;
    transition: color .15s, border-color .15s;
    white-space: nowrap;
    font-family: var(--font-sans);
}
.sp-session-tab.active {
    color: var(--color-red-primary, #FF0000);
    border-bottom-color: var(--color-red-primary, #FF0000);
}
.sp-session-tab:hover:not(.active) { color: var(--text-white, #fff); }
.sp-session-opts {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
/* Shared form elements */
.sp-section-title {
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .08em;
    color: var(--text-muted, #888);
    text-transform: uppercase;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border-gray, #1a1a1a);
}
.sp-field-group { display: flex; flex-direction: column; gap: 4px; }
.sp-label { font-size: .7rem; color: var(--text-muted, #888); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.sp-select {
    background: var(--bg-dark, #000);
    border: 1px solid var(--border-gray, #1a1a1a);
    border-radius: 4px;
    color: var(--text-white, #fff);
    font-size: .8rem;
    padding: 5px 8px;
    font-family: var(--font-sans);
    width: 100%;
}
.sp-select:focus { outline: none; border-color: var(--color-red-primary, #FF0000); }
.sp-picker-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-dark, #000);
    border: 1px solid var(--border-gray, #1a1a1a);
    border-radius: 4px;
    color: var(--text-white, #fff);
    font-size: .8rem;
    padding: 5px 8px;
    font-family: var(--font-sans);
    width: 100%;
    cursor: pointer;
    text-align: left;
    transition: border-color .15s;
}
.sp-picker-btn:hover { border-color: var(--color-red-primary, #FF0000); }
.sp-picker-btn:focus { outline: none; border-color: var(--color-red-primary, #FF0000); }
.sp-picker-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-picker-arrow { font-size: .6rem; color: var(--text-muted, #888); margin-left: 6px; flex-shrink: 0; }
.sp-slider-row { display: flex; align-items: center; gap: 8px; }
.sp-slider { flex: 1; accent-color: var(--color-red-primary, #FF0000); }
.sp-slider-val { font-size: .75rem; color: var(--text-white, #fff); white-space: nowrap; min-width: 60px; text-align: right; }
.sp-checkbox-row { display: flex; flex-wrap: wrap; gap: 10px; }
.sp-checkbox-label { display: flex; align-items: center; gap: 5px; font-size: .78rem; color: var(--text-white, #fff); cursor: pointer; }
.sp-checkbox-label input[type=checkbox] { accent-color: var(--color-red-primary, #FF0000); }
/* Footer */
.sp-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 20px;
    border-top: 1px solid var(--border-gray, #1a1a1a);
    flex-shrink: 0;
}
.sp-btn-cancel {
    background: transparent;
    border: 1px solid var(--border-gray, #1a1a1a);
    color: var(--text-muted, #888);
    border-radius: 5px;
    padding: 7px 18px;
    font-size: .82rem;
    cursor: pointer;
    transition: color .15s, border-color .15s;
    font-family: var(--font-sans);
}
.sp-btn-cancel:hover { color: var(--text-white, #fff); border-color: #555; }
.sp-btn-assign {
    background: var(--color-red-primary, #FF0000);
    border: none;
    color: #fff;
    border-radius: 5px;
    padding: 7px 20px;
    font-size: .82rem;
    font-weight: 700;
    letter-spacing: .05em;
    cursor: pointer;
    transition: background .15s, opacity .15s;
    font-family: var(--font-sans);
}
.sp-btn-assign:disabled { opacity: .4; cursor: not-allowed; }
.sp-btn-assign:not(:disabled):hover { background: #cc0000; }
/* Assign & Launch button — uses green to distinguish from plain assign */
.sp-btn-assign-launch {
    background: #16a34a !important;
}
.sp-btn-assign-launch:not(:disabled):hover { background: #15803d !important; }
/* ===== MULTI-STEP MODAL ADDITIONS ===== */

/* Breadcrumb */
.sp-breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 20px 0;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.sp-bc-step {
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .04em;
    color: var(--text-muted, #888);
    text-transform: uppercase;
    padding: 2px 0;
    transition: color .15s;
}
.sp-bc-step--active { color: var(--text-white, #fff); }
.sp-bc-step--done { color: #22c55e; }
.sp-bc-sep { font-size: .65rem; color: var(--text-muted, #888); margin: 0 2px; }

/* Step containers */
.sp-step { flex: 1; overflow: hidden; display: flex; flex-direction: column; min-height: 0; }

/* Step 1: two-column layout reusing existing classes */
.sp-step-1-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Step 2: full-width server details */
.sp-details-full {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 0;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.sp-details-full-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 20px 16px;
    border-right: 1px solid var(--border-gray, #1a1a1a);
    gap: 10px;
    overflow-y: auto;
}
.sp-details2-track-img {
    width: 100%;
    aspect-ratio: 4/3;
    background: rgba(255,255,255,.04);
    border-radius: 8px;
    border: 1px solid var(--border-gray, #1a1a1a);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.sp-details2-track-img img { width: 100%; height: 100%; object-fit: contain; }
.sp-details2-track-name {
    font-size: .85rem;
    font-weight: 700;
    color: var(--text-white, #fff);
    text-align: center;
    word-break: break-word;
}
.sp-details-full-right {
    display: flex;
    flex-direction: column;
    padding: 20px 18px;
    gap: 12px;
    overflow-y: auto;
}
.sp-details2-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-white, #fff);
    word-break: break-word;
}
.sp-details2-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
}
.sp-details2-item { display: flex; flex-direction: column; gap: 2px; }
.sp-details2-label { font-size: .65rem; color: var(--text-muted, #888); text-transform: uppercase; letter-spacing: .05em; }
.sp-details2-value { font-size: .85rem; color: var(--text-white, #fff); font-weight: 600; }
.sp-details2-cars-label { font-size: .65rem; color: var(--text-muted, #888); text-transform: uppercase; letter-spacing: .05em; margin-top: 4px; }
.sp-details2-cars { display: flex; flex-wrap: wrap; gap: 5px; }

/* Step 3: Car grid */
.sp-car-select-header {
    padding: 12px 18px 8px;
    border-bottom: 1px solid var(--border-gray, #1a1a1a);
    flex-shrink: 0;
}
.sp-car-select-title {
    font-size: .82rem;
    font-weight: 700;
    color: var(--text-white, #fff);
}
.sp-car-select-sub {
    font-size: .7rem;
    color: var(--text-muted, #888);
    margin-top: 2px;
}
.sp-car-grid-wrap {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px;
}
.sp-car-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}
.sp-car-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 8px 8px;
    background: rgba(255,255,255,.03);
    border: 1.5px solid var(--border-gray, #1a1a1a);
    border-radius: 7px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    text-align: center;
}
.sp-car-tile:hover { border-color: #555; background: rgba(255,255,255,.06); }
.sp-car-tile--selected {
    border-color: var(--color-red-primary, #FF0000);
    background: rgba(255,0,0,.08);
}
.sp-car-tile-img-wrap {
    width: 100%;
    aspect-ratio: 16/9;
    background: rgba(0,0,0,.3);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sp-car-tile-img { width: 100%; height: 100%; object-fit: contain; }
.sp-car-tile-no-img {
    width: 100%; height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: var(--text-muted, #888);
}
.sp-car-tile-name {
    font-size: .68rem;
    color: var(--text-white, #fff);
    font-weight: 600;
    word-break: break-word;
    line-height: 1.3;
}
.sp-car-grid-loading,
.sp-car-grid-empty {
    padding: 32px;
    text-align: center;
    color: var(--text-muted, #888);
    font-size: .82rem;
    grid-column: 1 / -1;
}

/* Step 4: Confirm */
.sp-confirm-layout {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 0;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.sp-confirm-track-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 14px;
    border-right: 1px solid var(--border-gray, #1a1a1a);
    gap: 10px;
    overflow-y: auto;
}
.sp-confirm-track-img {
    width: 100%;
    aspect-ratio: 4/3;
    background: rgba(255,255,255,.04);
    border-radius: 8px;
    border: 1px solid var(--border-gray, #1a1a1a);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.sp-confirm-track-img img { width: 100%; height: 100%; object-fit: contain; }
.sp-confirm-track-name {
    font-size: .8rem;
    font-weight: 700;
    color: var(--text-white, #fff);
    text-align: center;
    word-break: break-word;
}
.sp-confirm-info-col {
    display: flex;
    flex-direction: column;
    padding: 20px 18px;
    gap: 8px;
    overflow-y: auto;
}
.sp-confirm-section-label {
    font-size: .62rem;
    font-weight: 700;
    letter-spacing: .08em;
    color: var(--text-muted, #888);
    text-transform: uppercase;
}
.sp-confirm-server-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-white, #fff);
    word-break: break-word;
}
.sp-confirm-car-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.sp-confirm-car-img-wrap {
    width: 80px;
    height: 45px;
    background: rgba(0,0,0,.3);
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sp-confirm-car-img { width: 100%; height: 100%; object-fit: contain; }
.sp-confirm-car-name {
    font-size: .9rem;
    font-weight: 700;
    color: var(--text-white, #fff);
    word-break: break-word;
}
.sp-confirm-warnings {
    margin-top: 8px;
    border-radius: 5px;
    font-size: .75rem;
}
.sp-confirm-warning {
    padding: 6px 12px;
    background: rgba(237,137,54,.12);
    border: 1px solid rgba(237,137,54,.3);
    border-radius: 5px;
    color: #ed8936;
    margin-bottom: 4px;
}
.sp-confirm-warning:last-child { margin-bottom: 0; }

/* Footer back/next buttons */
.sp-btn-back {
    background: transparent;
    border: 1px solid var(--border-gray, #1a1a1a);
    color: var(--text-muted, #888);
    border-radius: 5px;
    padding: 7px 18px;
    font-size: .82rem;
    cursor: pointer;
    transition: color .15s, border-color .15s;
    font-family: var(--font-sans);
    margin-right: auto;
}
.sp-btn-back:hover { color: var(--text-white, #fff); border-color: #555; }
.sp-btn-next {
    background: var(--color-red-primary, #FF0000);
    border: none;
    color: #fff;
    border-radius: 5px;
    padding: 7px 20px;
    font-size: .82rem;
    font-weight: 700;
    letter-spacing: .05em;
    cursor: pointer;
    transition: background .15s, opacity .15s;
    font-family: var(--font-sans);
}
.sp-btn-next:disabled { opacity: .4; cursor: not-allowed; }
.sp-btn-next:not(:disabled):hover { background: #cc0000; }

/* ===== END MULTI-STEP MODAL ADDITIONS ===== */

/* ===== POST-ASSIGNMENT SIM CARD ===== */

/* ASSIGNED banner in session status row */
.sim-card-session-status {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 5px;
    min-height: 0;
    font-size: .78rem;
    overflow: hidden;
    min-width: 0;
}
.sim-card-assigned-badge {
    display: inline-flex;
    align-items: center;
    background: rgba(0,200,80,.15);
    color: #00c850;
    border: 1px solid rgba(0,200,80,.35);
    border-radius: 3px;
    padding: 2px 7px;
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .06em;
    flex-shrink: 0;
}
.sim-card-assigned-server {
    color: var(--text-white, #fff);
    font-weight: 600;
    font-size: .78rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1 1 0;
    max-width: 130px;
}
.sim-card-assigned-sep {
    color: var(--text-muted, #888);
    font-size: .72rem;
    flex-shrink: 0;
}
.sim-card-assigned-car {
    color: var(--text-muted, #aaa);
    font-size: .75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex-shrink: 1;
    max-width: 110px;
}
.sim-card-assigned-track {
    color: var(--text-muted, #aaa);
    font-size: .73rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex-shrink: 1;
}
.sim-card-assigned-car-label {
    color: var(--text-muted, #666);
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .04em;
    flex-shrink: 0;
}
.sim-card-change-btn {
    background: transparent;
    border: 1px solid var(--border-gray, #1a1a1a);
    color: var(--text-muted, #888);
    border-radius: 3px;
    padding: 2px 9px;
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .05em;
    cursor: pointer;
    transition: color .12s, border-color .12s;
    font-family: var(--font-sans);
    flex-shrink: 0;
    margin-left: auto;
}
.sim-card-change-btn:hover { color: var(--text-white, #fff); border-color: #555; }
.sim-card-change-btn:disabled { opacity: .4; cursor: not-allowed; }

/* Three-button action group (Change Car / Change Server / Clear) */
.sim-card-action-btns {
    display: flex;
    gap: 4px;
    margin-left: auto;
    flex-shrink: 0;
    align-items: center;
    flex-wrap: wrap;
}
.sim-card-change-car-btn,
.sim-card-change-server-btn,
.sim-card-clear-btn {
    background: transparent;
    border: 1px solid var(--border-gray, #1a1a1a);
    color: var(--text-muted, #888);
    border-radius: 3px;
    padding: 2px 7px;
    font-size: .62rem;
    font-weight: 700;
    letter-spacing: .04em;
    cursor: pointer;
    transition: color .12s, border-color .12s;
    font-family: var(--font-sans);
    white-space: nowrap;
}
.sim-card-change-car-btn:hover,
.sim-card-change-server-btn:hover { color: var(--text-white, #fff); border-color: #555; }
.sim-card-clear-btn:hover { color: #f87171; border-color: #f87171; }
.sim-card-change-car-btn:disabled,
.sim-card-change-server-btn:disabled,
.sim-card-clear-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ===== END POST-ASSIGNMENT SIM CARD ===== */
/* ===== END SERVER PICKER MODAL ===== */

/* Sim card server picker button */
.sim-card-server-picker-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
    padding: 6px 10px;
    background: var(--bg-dark, #000);
    border: 1px solid var(--border-gray, #1a1a1a);
    border-radius: 4px;
    color: var(--text-white, #fff);
    font-size: 0.85rem;
    font-family: var(--font-sans);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, background 0.15s;
}
.sim-card-server-picker-btn:hover:not(:disabled) {
    border-color: var(--color-red-primary, #FF0000);
    background: rgba(255,0,0,0.04);
}
.sim-card-server-picker-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.sim-card-server-picker-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sim-card-server-picker-arrow {
    font-size: 0.65rem;
    color: var(--text-muted, #888);
    flex-shrink: 0;
}

/* ---- Sim card session pills (ONLINE / SINGLE PLAYER) ---- */
/* Legacy session row/pill — fully overridden by v2.6 rules above; kept only for non-sim-card usage */
.sim-card-session-row {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
}
/* v2.6 override: inside a sim card, use the new tab strip design */
.sim-card .sim-card-session-row {
    gap: 0 !important;
    border: 1px solid #1e1e1e !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    margin-bottom: 0 !important;
}
.sim-card .sim-card-session-pill {
    flex: 1 !important;
    padding: 9px 10px !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    color: #555 !important;
    font-size: 0.7rem !important;
    font-family: var(--font-sans) !important;
    font-weight: 700 !important;
    letter-spacing: 0.06em !important;
    cursor: pointer !important;
    text-align: center !important;
    transition: all 0.15s !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    white-space: nowrap !important;
}
.sim-card .sim-card-session-pill + .sim-card-session-pill {
    border-left: 1px solid #1e1e1e !important;
}
.sim-card .sim-card-session-pill--active {
    background: rgba(255,255,255,0.06) !important;
    color: var(--text-white) !important;
    border-color: transparent !important;
}
.sim-card .sim-card-session-pill--active .sim-card-session-pill-icon { color: #22c55e !important; }
.sim-card .sim-card-session-pill:hover:not(:disabled) { background: rgba(255,255,255,0.04) !important; }
.sim-card .sim-card-session-pill:disabled { opacity: 0.4 !important; cursor: not-allowed !important; }
.sim-card-session-status {
    font-size: 0.78rem;
    color: var(--text-muted, #888);
    margin-bottom: 8px;
    min-height: 1.2em;
    overflow: hidden;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 5px;
}
.sim-card-server-source--lan {
    color: var(--idle-blue, #3b82f6);
    background: rgba(59, 130, 246, 0.15);
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}


/* ===== ONLINE SERVERS ADMIN PAGE ===== */

#page-online-servers .os-layout {
    display: flex;
    height: calc(100vh - 120px);
    gap: 0;
    overflow: hidden;
}

/* Sidebar */
#page-online-servers .os-sidebar {
    width: 280px;
    min-width: 220px;
    max-width: 320px;
    border-right: 1px solid var(--border-gray);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

#page-online-servers .os-sidebar-header {
    display: flex;
    gap: 8px;
    padding: 12px 12px 10px 12px;
    border-bottom: 1px solid var(--border-gray);
    flex-shrink: 0;
}

#page-online-servers .os-btn-new,
#page-online-servers .os-btn-import {
    flex: 1;
    padding: 7px 10px;
    border-radius: 5px;
    border: 1px solid var(--border-gray);
    background: #111;
    color: var(--text-white);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: background 0.15s;
}
#page-online-servers .os-btn-new:hover { background: #1a1a1a; }
#page-online-servers .os-btn-import:hover { background: #1a1a1a; }

#page-online-servers .os-preset-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}

#page-online-servers .os-preset-empty {
    padding: 20px 16px;
    color: #666;
    font-size: 0.82rem;
    text-align: center;
}

#page-online-servers .os-preset-row {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #111;
    transition: background 0.1s;
}
#page-online-servers .os-preset-row:hover { background: #111; }
#page-online-servers .os-preset-row.active {
    background: #1a0a0a;
    border-left: 3px solid var(--color-red-primary);
}

#page-online-servers .os-preset-row-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-white);
    display: flex;
    align-items: center;
    gap: 6px;
}
#page-online-servers .os-preset-row-meta {
    font-size: 0.75rem;
    color: #888;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Editor */
#page-online-servers .os-editor {
    flex: 1;
    overflow-y: auto;
    padding: 0 24px 32px 24px;
}

#page-online-servers .os-editor-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #666;
    font-size: 0.9rem;
}

#page-online-servers .os-editor-form {
    max-width: 720px;
    padding-top: 20px;
}

#page-online-servers .os-editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    gap: 12px;
    flex-wrap: wrap;
}

#page-online-servers .os-editor-title {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-white);
}

#page-online-servers .os-editor-toolbar-actions {
    display: flex;
    gap: 8px;
}

#page-online-servers .os-btn-validate,
#page-online-servers .os-btn-duplicate,
#page-online-servers .os-btn-delete {
    padding: 6px 12px;
    border-radius: 5px;
    border: 1px solid var(--border-gray);
    background: #111;
    color: var(--text-white);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: background 0.15s;
}
#page-online-servers .os-btn-validate:hover { background: #1a1a1a; }
#page-online-servers .os-btn-duplicate:hover { background: #1a1a1a; }
#page-online-servers .os-btn-delete { border-color: #5a2025; color: #f5c2c7; }
#page-online-servers .os-btn-delete:hover { background: #2a0e10; }

/* Validation result */
#page-online-servers .os-validation-result {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #0d0d0d;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 0.82rem;
}
#page-online-servers .os-val-ok { color: #4ade80; }
#page-online-servers .os-val-warn { color: #fbbf24; }
#page-online-servers .os-val-error { color: #f87171; }
#page-online-servers .os-val-info { color: #93c5fd; }
#page-online-servers .os-val-loading { color: #888; }

/* Form sections */
#page-online-servers .os-form-section {
    border: 1px solid #1a1a1a;
    border-radius: 8px;
    padding: 14px 16px 16px 16px;
    margin-bottom: 16px;
    background: #0a0a0a;
}

#page-online-servers .os-form-section-heading {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #888;
    margin: 0 0 12px 0;
}

#page-online-servers .os-form-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
#page-online-servers .os-form-row:last-child { margin-bottom: 0; }

#page-online-servers .os-form-row--ports {
    flex-wrap: nowrap;
    gap: 6px;
}

#page-online-servers .os-form-label {
    min-width: 100px;
    font-size: 0.78rem;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

#page-online-servers .os-form-input {
    flex: 1;
    background: #111;
    border: 1px solid #2a2a2a;
    border-radius: 5px;
    color: var(--text-white);
    font-size: 0.85rem;
    padding: 6px 10px;
    min-width: 0;
}
#page-online-servers .os-form-input:focus {
    outline: none;
    border-color: var(--color-red-primary);
}
#page-online-servers .os-form-input--port {
    width: 80px;
    flex: 0 0 80px;
}

#page-online-servers .os-form-select {
    flex: 1;
    background: #111;
    border: 1px solid #2a2a2a;
    border-radius: 5px;
    color: var(--text-white);
    font-size: 0.85rem;
    padding: 6px 10px;
}
#page-online-servers .os-form-select:focus {
    outline: none;
    border-color: var(--color-red-primary);
}

#page-online-servers .os-form-hint {
    font-size: 0.75rem;
    color: #666;
    flex: 1;
}

/* Toggle switch */
#page-online-servers .os-toggle-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
}
#page-online-servers .os-toggle {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
#page-online-servers .os-toggle-switch {
    width: 36px;
    height: 20px;
    background: #333;
    border-radius: 10px;
    position: relative;
    transition: background 0.2s;
}
#page-online-servers .os-toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}
#page-online-servers .os-toggle:checked + .os-toggle-switch {
    background: var(--color-red-primary);
}
#page-online-servers .os-toggle:checked + .os-toggle-switch::after {
    transform: translateX(16px);
}

/* Inferred badge */
.os-inferred-badge {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #fbbf24;
    background: rgba(251,191,36,0.12);
    border: 1px solid rgba(251,191,36,0.3);
    border-radius: 4px;
    padding: 1px 5px;
    white-space: nowrap;
    cursor: help;
}

/* Cars editor */
#page-online-servers .os-cars-list {
    margin-bottom: 8px;
}
#page-online-servers .os-cars-empty {
    color: #666;
    font-size: 0.82rem;
    padding: 6px 0;
}
#page-online-servers .os-car-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}
#page-online-servers .os-car-input {
    flex: 1;
    min-width: 0;
}
#page-online-servers .os-car-id { flex: 2; }
#page-online-servers .os-car-skin { flex: 1.5; }
#page-online-servers .os-car-label { flex: 2; }
#page-online-servers .os-car-remove {
    background: none;
    border: none;
    color: #f87171;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    flex-shrink: 0;
}
#page-online-servers .os-car-remove:hover { color: #ff4444; }
#page-online-servers .os-btn-add-car {
    background: none;
    border: 1px dashed #333;
    border-radius: 5px;
    color: #888;
    font-size: 0.8rem;
    padding: 5px 12px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}
#page-online-servers .os-btn-add-car:hover { border-color: #666; color: #ccc; }

/* Editor footer */
#page-online-servers .os-editor-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #1a1a1a;
}
#page-online-servers .os-btn-save {
    padding: 8px 20px;
    background: var(--color-red-primary);
    border: none;
    border-radius: 5px;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: opacity 0.15s;
}
#page-online-servers .os-btn-save:hover { opacity: 0.85; }
#page-online-servers .os-btn-cancel {
    padding: 8px 16px;
    background: #111;
    border: 1px solid #2a2a2a;
    border-radius: 5px;
    color: #aaa;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s;
}
#page-online-servers .os-btn-cancel:hover { background: #1a1a1a; }
#page-online-servers .os-save-status {
    font-size: 0.8rem;
    margin-left: 4px;
}
#page-online-servers .os-save-status--ok { color: #4ade80; }
#page-online-servers .os-save-status--error { color: #f87171; }

/* Import modal */
.os-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
}
.os-modal {
    background: #111;
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    width: 480px;
    max-width: 95vw;
    overflow: hidden;
}
.os-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #1a1a1a;
}
.os-modal-title {
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-white);
}
.os-modal-close {
    background: none;
    border: none;
    color: #888;
    font-size: 1.3rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}
.os-modal-close:hover { color: #fff; }
.os-modal-body {
    padding: 18px;
}
.os-modal-hint {
    font-size: 0.82rem;
    color: #888;
    margin: 0 0 14px 0;
}
.os-modal-hint code {
    background: #1a1a1a;
    padding: 1px 4px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.8rem;
    color: #ccc;
}
.os-modal-footer {
    display: flex;
    gap: 10px;
    padding: 14px 18px;
    border-top: 1px solid #1a1a1a;
}
.os-file-input {
    flex: 1;
    background: #0d0d0d;
    border: 1px solid #2a2a2a;
    border-radius: 5px;
    color: #ccc;
    font-size: 0.82rem;
    padding: 5px 8px;
}
.os-import-warnings {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.8rem;
}

/* Server picker — Save as Preset button on LAN rows */
.sp-save-preset-btn {
    background: none;
    border: 1px solid #2a2a2a;
    border-radius: 4px;
    color: #888;
    font-size: 0.7rem;
    padding: 2px 7px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: color 0.15s, border-color 0.15s;
}
.sp-save-preset-btn:hover {
    color: #ccc;
    border-color: #555;
}

/* ===== END ONLINE SERVERS ADMIN PAGE ===== */

/* ===== Inline car grid (one-screen assignment flow) ===== */
.sp-inline-car-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 2px;
}
.sp-inline-car-grid .sp-car-tile {
    padding: 7px 6px 6px;
}
.sp-inline-car-grid .sp-car-tile-name {
    font-size: .62rem;
}
.sp-inline-car-grid .sp-car-grid-loading,
.sp-inline-car-grid .sp-car-grid-empty {
    padding: 16px;
    font-size: .78rem;
    grid-column: 1 / -1;
}
