/* CSS Updated - Dec 26, 2025 - 11:45 AM */
:root {
    /* Default to dark theme (original dark palette) */
    --color-muted: #b4b4d0;
    --color-text-main: #e8e8f5;
    --color-heading: #f5f5ff;
    --color-bg: #1a1a2e;
    --color-card-bg: #252538;
    --color-border-soft: #3a3a4e;
    --color-accent: #5865f2;
    --color-purple: #8b5cf6;
    --color-purple-dark: #7c3aed;
    --sidebar-width: 280px;
    --bg-gradient-start: #16161f;
    --bg-gradient-mid: #1a1a2e;
    --bg-gradient-end: #1e1e33;
    --sidebar-gradient-start: #1f1f2e;
    --sidebar-gradient-end: #16161f;
}

body {
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-mid) 50%, var(--bg-gradient-end) 100%);
}

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

body {
    font-family: "Poppins", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-mid) 50%, var(--bg-gradient-end) 100%);
    color: var(--color-text-main);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    transition: background 0.3s ease, color 0.3s ease;
}
body.modal-open {
    overflow: hidden;
}

.shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
    width: 100%;
}
.main-wrap {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* Sidebar Navigation */
.sidebar {
    background: linear-gradient(180deg, var(--sidebar-gradient-start) 0%, var(--sidebar-gradient-end) 100%);
    border-right: 1px solid var(--color-border-soft);
    padding: 32px 24px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    transition: background 0.3s ease;
    z-index: 30;
}

.sidebar-header {
    margin-bottom: 40px;
}

.sidebar-logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-heading);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--color-accent) 0%, #6366f1 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}

.sidebar-subtitle {
    font-size: 12px;
    color: var(--color-muted);
    font-weight: 500;
}

/* Top Status Bar */
.status-bar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-border-soft);
    padding: 20px 40px;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s ease, border-color 0.3s ease;
}

body.dark-mode .status-bar {
    background: rgba(37, 37, 56, 0.95);
}

.status-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--color-heading);
}

.status-subtitle {
    font-size: 13px;
    font-weight: 700;
    color: #f87171;
    margin-top: 2px;
}

/* Digital Date/Time Display */
.digital-datetime {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(59, 75, 255, 0.08) 0%, rgba(99, 102, 241, 0.08) 100%);
    border-radius: 10px;
    border: 1px solid var(--color-border-soft);
    min-width: 140px;
    transition: background 0.3s ease, border-color 0.3s ease;
}

body.dark-mode .digital-datetime {
    background: linear-gradient(135deg, rgba(88, 101, 242, 0.15) 0%, rgba(99, 102, 241, 0.15) 100%);
}

.digital-time {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-heading);
    letter-spacing: 0.5px;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.digital-date {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-bar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.status-meta {
    font-size: 12px;
    color: var(--color-muted);
    background: var(--color-bg);
    padding: 8px 16px;
    border-radius: 999px;
    transition: background 0.3s ease;
}

/* Live Indicator */
.live-indicator {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 1px solid #ef4444;
    border-radius: 999px;
    animation: live-pulse 2s ease-in-out infinite;
}

.live-indicator.active {
    display: flex;
}

@keyframes live-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.live-indicator-dot {
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    animation: dot-blink 1.5s ease-in-out infinite;
}

@keyframes dot-blink {
    0%, 100% { 
        transform: scale(1); 
        opacity: 1;
    }
    50% { 
        transform: scale(1.3); 
        opacity: 0.6;
    }
}

.live-indicator-text {
    font-size: 11px;
    font-weight: 700;
    color: #ef4444;
    letter-spacing: 0.5px;
}

/* Documentation Button */
.doc-button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--color-card-bg);
    border: 1px solid var(--color-border-soft);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.doc-button:hover {
    background: linear-gradient(135deg, var(--color-accent) 0%, #6366f1 100%);
    border-color: var(--color-accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 75, 255, 0.3);
}

body.dark-mode .doc-button:hover {
    box-shadow: 0 4px 12px rgba(88, 101, 242, 0.5);
}

.doc-button:hover .doc-button-text {
    color: #ffffff;
}

.doc-button-icon {
    font-size: 16px;
}

.doc-button-text {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-main);
    transition: color 0.2s ease;
}

/* Overall Health Status Indicator */
.overall-status {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-radius: 12px;
    background: var(--color-card-bg);
    border: 2px solid var(--color-border-soft);
    transition: all 0.3s ease;
    margin-bottom: 24px;
}

.overall-status-indicator {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    position: relative;
    animation: pulse-status 2s ease-in-out infinite;
}

@keyframes pulse-status {
    0%, 100% { 
        transform: scale(1); 
        opacity: 1; 
    }
    50% { 
        transform: scale(1.15); 
        opacity: 0.85; 
    }
}

.overall-status-indicator::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid currentColor;
    opacity: 0.3;
}

.overall-status-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.overall-status-title {
    font-size: 11px;
    font-weight: 500;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.overall-status-text {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* Status color variants */
.overall-status.status-excellent {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border-color: #10b981;
}

.overall-status.status-excellent .overall-status-indicator {
    background: #10b981;
    color: #10b981;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
}

.overall-status.status-excellent .overall-status-text {
    color: #059669;
}

.overall-status.status-good {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-color: #22c55e;
}

.overall-status.status-good .overall-status-indicator {
    background: #22c55e;
    color: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.2);
}

.overall-status.status-good .overall-status-text {
    color: #16a34a;
}

.overall-status.status-stable {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-color: #f59e0b;
}

.overall-status.status-stable .overall-status-indicator {
    background: #f59e0b;
    color: #f59e0b;
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.2);
}

.overall-status.status-stable .overall-status-text {
    color: #d97706;
}

.overall-status.status-warning {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-color: #f97316;
}

.overall-status.status-warning .overall-status-indicator {
    background: #f97316;
    color: #f97316;
    box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.2);
}

.overall-status.status-warning .overall-status-text {
    color: #ea580c;
}

.overall-status.status-critical {
    background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
    border-color: #ef4444;
}

.overall-status.status-critical .overall-status-indicator {
    background: #ef4444;
    color: #ef4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.2);
}

.overall-status.status-critical .overall-status-text {
    color: #dc2626;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #eef0ff;
    font-size: 11px;
    font-weight: 500;
    color: var(--color-text-main);
    margin-left: 8px;
    transition: background 0.3s ease;
}

body.dark-mode .badge {
    background: rgba(88, 101, 242, 0.2);
}

/* Main Content Area */
.main-content {
    overflow: visible;
    height: auto;
    width: 100%;
    margin: 0;
    padding: 0;
}

.content-wrap {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px;
}

.app-shell {
    padding: 32px 40px 60px;
    max-width: 1600px;
    margin: 0 auto;
}

.top-tabs {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: transparent;
    border: none;
    padding: 0;
    margin-bottom: 0;
}

.top-tabs button {
    border-radius: 10px;
    border: 1px solid var(--color-border-soft);
    padding: 14px 18px;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-main);
    background: var(--color-card-bg);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.top-tabs button:hover {
    border-color: var(--color-accent);
    transform: translateX(4px);
}

.top-tabs button.active {
    background: linear-gradient(135deg, var(--color-accent) 0%, #6366f1 100%);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(59, 75, 255, 0.3);
    border-color: transparent;
}

/* Hide mobile tabs and mobile status on desktop */
.mobile-tabs,
.mobile-overall-status {
    display: none;
}

.section-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 16px;
}
.section-refresh {
    margin-left:auto;
    background:#111827;
    color:#e2e8f0;
    border:1px solid #1f2937;
    border-radius:10px;
    padding:8px 12px;
    cursor:pointer;
    font-weight:700;
    display:flex;
    align-items:center;
    gap:6px;
}
.section-refresh.loading { opacity:0.7; position:relative; }
.section-refresh.loading::after { content:''; position:absolute; top:50%; right:8px; width:12px; height:12px; margin-top:-6px; border:2px solid #e2e8f0; border-top-color:transparent; border-radius:50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }


.section-heading-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--color-accent) 0%, #6366f1 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(59, 75, 255, 0.25);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
    align-items: start;
    width: 100%;
}

.metric-card {
    position: relative;
    background: var(--color-card-bg);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--color-border-soft);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    overflow: hidden;
}
.metric-card.metric-card--wide {
    min-height: 320px;
}
.zone-list {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
}
.zone-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border: 1px solid var(--color-border-soft);
    border-radius: 12px;
    background: rgba(255,255,255,0.02);
}
.zone-name { font-weight:700; color: var(--color-heading); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; margin-right:8px; }
.zone-count { font-weight:700; color: var(--color-muted); }
.zone-empty { color: var(--color-muted); font-size:13px; }


.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(15, 14, 83, 0.12);
}

.metric-card--compact {
    min-height: 120px;
    padding: 20px;
}

.metric-card--table {
    min-height: 200px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.metric-card__status-dot {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: #d2d5e8;
    box-shadow: 0 0 0 3px rgba(210, 213, 232, 0.3);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.metric-card__status-dot.status-good {
    background: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.3);
}

.metric-card__status-dot.status-ok {
    background: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3);
}

.metric-card__status-dot.status-bad {
    background: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3);
}

.metric-card__weather-icon {
    position: absolute;
    top: 18px;
    right: 40px;
    font-size: 14px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.metric-card__weather-icon:hover {
    opacity: 1;
}

.metric-card__weather-icon--small {
    position: static;
    font-size: 11px;
    margin-left: 4px;
    opacity: 0.6;
}

/* ========== WEATHER CANVAS ========== */

.weather-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    opacity: 1;
}

/* ========== WEATHER CONTROLS ========== */

.weather-controls {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
    background: rgba(255, 255, 255, 0.98);
    border: 2px solid var(--color-border);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(15px);
    min-width: 220px;
    pointer-events: auto;
}

.weather-controls-header {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-muted);
    text-align: center;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.weather-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 8px;
}

.weather-btn {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 8px 6px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-align: center;
    user-select: none;
}

.weather-btn:hover {
    background: var(--color-accent);
    color: white;
    border-color: var(--color-accent);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.weather-btn:active {
    transform: translateY(0);
}

.weather-btn-reset {
    background: #e8f4fd;
    color: #0066cc;
    border-color: #0066cc;
}

.weather-btn-reset:hover {
    background: #0066cc;
    color: white;
    border-color: #0066cc;
}

.weather-note {
    font-size: 10px;
    color: var(--color-muted);
    text-align: center;
    font-style: italic;
}

/* ========== GENERAL UTILITY CLASSES ========== */

.hidden {
    display: none !important;
}

/* ========== THEME TOGGLE SWITCH ========== */

.theme-toggle-container {
    display: flex;
    align-items: center;
    margin-left: 8px;
}

.theme-toggle {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
    cursor: pointer;
}

.theme-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #ffd93d 0%, #ff9b3d 100%);
    border-radius: 30px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    border: 2px solid var(--color-border-soft);
}

.theme-toggle-slider::before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.theme-toggle input:checked + .theme-toggle-slider {
    background: linear-gradient(135deg, #2d3561 0%, #1a1d3a 100%);
}

.theme-toggle input:checked + .theme-toggle-slider::before {
    transform: translateX(30px);
}

.theme-toggle-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    transition: opacity 0.3s ease;
}

.theme-toggle-icon.sun {
    left: 6px;
    opacity: 1;
}

.theme-toggle-icon.moon {
    right: 6px;
    opacity: 0;
}

.theme-toggle input:checked ~ .theme-toggle-slider .sun {
    opacity: 0;
}

.theme-toggle input:checked ~ .theme-toggle-slider .moon {
    opacity: 1;
}

.theme-toggle:hover .theme-toggle-slider {
    box-shadow: 0 3px 10px rgba(59, 75, 255, 0.3);
    transform: translateY(-1px);
}

/* ========== WEATHER TOGGLE BUTTON ========== */

.weather-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--color-border-soft);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    margin-left: 8px;
}

body.dark-mode .weather-toggle {
    background: var(--color-card-bg);
}

.weather-toggle:hover {
    background: linear-gradient(135deg, var(--color-accent) 0%, #6366f1 100%);
    border-color: var(--color-accent);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(59, 75, 255, 0.3);
}

.weather-toggle:active {
    transform: scale(0.95);
}



.metric-card__label {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-muted);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 11px;
}

.metric-card__values {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    overflow: hidden;
}

.metric-card__percent {
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--color-heading);
    line-height: 1;
}

.metric-card__count {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-muted);
    text-align: right;
}

.metric-card__rule {
    border: none;
    border-top: 1px solid var(--color-border-soft);
    margin: 12px 0;
}

.metric-card__baseline {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 12px;
    padding: 8px 12px;
    background: var(--color-bg);
    border-radius: 8px;
    transition: background 0.3s ease;
}

body.dark-mode .metric-card__baseline {
    background: rgba(26, 26, 46, 0.5);
}

.metric-card__baseline-label {
    color: var(--color-muted);
    font-weight: 500;
}

.metric-card__baseline-value {
    font-weight: 600;
    color: var(--color-text-main);
}

.metric-card--clickable {
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

/* Animated glow border for clickable cards */
.metric-card--clickable::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    padding: 2px;
    background: linear-gradient(
        135deg,
        var(--color-accent),
        #667eea,
        var(--color-accent),
        #667eea
    );
    background-size: 300% 300%;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.5;
    animation: borderGlow 3s ease infinite;
    pointer-events: none;
}

@keyframes borderGlow {
    0%, 100% {
        background-position: 0% 50%;
        opacity: 0.4;
    }
    50% {
        background-position: 100% 50%;
        opacity: 0.7;
    }
}

.metric-card--clickable:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(15, 14, 83, 0.15);
    border-color: var(--color-accent);
}

.metric-card--clickable:hover::before {
    opacity: 1;
    animation: borderGlow 1.5s ease infinite;
}

/* Dark mode adjustments */
body.dark-mode .metric-card--clickable::before {
    background: linear-gradient(
        135deg,
        #667eea,
        #764ba2,
        #667eea,
        #764ba2
    );
    background-size: 300% 300%;
}

body.dark-mode .metric-card--clickable:hover {
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.3);
}

/* Modal */
.modal.hidden {
    display: none;
}

.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(2px);
}

body.dark-mode .modal-backdrop {
    background: rgba(0, 0, 0, 0.6);
}

.modal-content {
    position: relative;
    background: #ffffff;
    border-radius: 18px;
    padding: 20px 24px;
    max-width: 1200px;
    width: 96vw;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(15, 14, 83, 0.28);
    z-index: 1;
    display: flex;
    flex-direction: column;
    transition: background 0.3s ease;
}

body.dark-mode .modal-content {
    background: var(--color-card-bg);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}


.modal-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 4px;
    color: var(--color-heading);
}

.modal-subtitle {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-muted);
    margin-left: 6px;
}

/* Center all modal text/content */
.modal-content,
.modal-title,
.modal-subtitle,
.modal-body,
.modal-table th,
.modal-table td {
    text-align: center;
}

.modal-close {
    position: absolute;
    right: 12px;
    top: 8px;
    border: none;
    background: none;
    font-size: 20px;
    cursor: pointer;
    color: #888;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: #333;
}

body.dark-mode .modal-close {
    color: var(--color-muted);
}

body.dark-mode .modal-close:hover {
    color: var(--color-heading);
}

.modal-body {
    padding: 0 24px 24px;
    overflow-y: auto;       /* allow vertical scroll within the modal body */
}

.modal-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--color-border-soft);
    padding-bottom: 0;
}

.modal-tab {
    background: none;
    border: none;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    margin-bottom: -1px;
}

.modal-tab:hover {
    color: var(--color-text-main);
    background: rgba(59, 75, 255, 0.05);
}

body.dark-mode .modal-tab:hover {
    background: rgba(88, 101, 242, 0.15);
}

.modal-tab.active {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
    background: rgba(59, 75, 255, 0.08);
}

body.dark-mode .modal-tab.active {
    background: rgba(88, 101, 242, 0.2);
}

/* the table area scrolls instead of the whole page */
.modal-table-wrapper {
    border-radius: 12px;
    border: 1px solid var(--color-border-soft);
    max-height: 70vh;
    overflow-y: auto;
    overflow-x: auto; /* Allow horizontal scroll when needed */
    margin: 0 auto;
    width: 100%;
    background: var(--color-card-bg);
    transition: background 0.3s ease, border-color 0.3s ease;
}

body.dark-mode .modal-table-wrapper {
    background: rgba(26, 26, 46, 0.5);
}

/* Allow horizontal scroll on mobile only */
@media (max-width: 768px) {
    .modal-table-wrapper {
        overflow-x: auto;
    }
    
    .modal-table {
        table-layout: auto;
        min-width: 600px;
    }
}

.modal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: auto; /* Changed from fixed to auto for responsive columns */
}

.modal-table thead {
    background: linear-gradient(135deg, #f8f9ff 0%, #eef0f7 100%);
    position: sticky;
    top: 0;
    z-index: 1;
    transition: background 0.3s ease;
}

body.dark-mode .modal-table thead {
    background: linear-gradient(135deg, rgba(31, 31, 46, 1) 0%, rgba(22, 22, 31, 1) 100%);
}

.modal-table th,
.modal-table td {
    padding: 12px 16px;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word; /* Better word breaking */
    border-bottom: 1px solid var(--color-border-soft);
    text-align: left;
}

/* Columns that should never wrap - headers and specific data */
.modal-table th.nowrap,
.modal-table td.nowrap {
    white-space: nowrap;
}

.modal-table th {
    font-weight: 600;
    color: var(--color-heading);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
    white-space: nowrap; /* Headers should not wrap */
}

.modal-table tbody tr {
    transition: background-color 0.2s ease;
}

.modal-table tbody tr:hover {
    background: rgba(59, 75, 255, 0.05);
}

body.dark-mode .modal-table tbody tr:hover {
    background: rgba(88, 101, 242, 0.15);
}

.modal-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

.modal-table th.sortable:hover {
    background-color: #f0f4ff;
}

.modal-table th.sortable.active {
    background-color: #e3f2fd;
    color: var(--color-accent);
    font-weight: 600;
}

.modal-table th.sortable .sort-indicator {
    font-size: 0.8em;
    opacity: 0.5;
    margin-left: 4px;
}

.modal-table th.sortable.active .sort-indicator {
    opacity: 1;
    color: var(--color-accent);
    font-weight: 600;
}

.sort-reset-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--color-bg);
    border: 1px solid var(--color-border-soft);
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--color-text-main);
}

.sort-reset-btn:hover {
    background: var(--color-accent);
    color: white;
    border-color: var(--color-accent);
}


.modal-table tbody tr:nth-child(even) {
    background: rgba(248, 249, 255, 0.5);
}

body.dark-mode .modal-table tbody tr:nth-child(even) {
    background: rgba(31, 31, 46, 0.3);
}

/* Modal table message styles */
.modal-table-message {
    padding: 8px 0;
    text-align: center;
}

.modal-table-message.error {
    color: #ef4444;
}

body.dark-mode .modal-table-message.error {
    color: #f87171;
}

.modal-table-message.empty {
    color: var(--color-muted);
}

.modal-table-message.loading {
    color: var(--color-muted);
}

/* Modal Search Bar Styling */
.modal-search-container {
    margin-bottom: 16px;
    position: relative;
}

.modal-search-input {
    width: 100%;
    padding: 12px 16px;
    padding-left: 44px;
    border: 2px solid var(--color-border-soft);
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    background: var(--color-bg);
    color: var(--color-text-main);
    transition: all 0.3s ease;
    outline: none;
}

.modal-search-input:focus {
    border-color: var(--color-accent);
    background: var(--color-card-bg);
    box-shadow: 0 0 0 4px rgba(59, 75, 255, 0.1);
}

body.dark-mode .modal-search-input:focus {
    box-shadow: 0 0 0 4px rgba(88, 101, 242, 0.2);
}

.modal-search-input::placeholder {
    color: var(--color-muted);
    font-weight: 400;
}

.modal-search-container::before {
    content: "🔍";
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    opacity: 0.6;
    pointer-events: none;
}

/* Job outcome info boxes */
.job-outcome-info-box {
    margin-bottom: 12px;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.job-outcome-info-box-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.job-outcome-info-box-icon {
    font-size: 16px;
    margin-right: 6px;
}

.job-outcome-info-box-title {
    margin: 0;
    color: var(--color-heading);
    font-size: 13px;
    font-weight: 600;
}

.job-outcome-info-box-text {
    font-size: 11px;
    color: var(--color-text-main);
}

/* Completed jobs - green */
.job-outcome-info-box.completed {
    background: linear-gradient(135deg, #e8f5e8 0%, #f1f8e9 100%);
    border-color: rgba(76, 175, 80, 0.2);
}

body.dark-mode .job-outcome-info-box.completed {
    background: rgba(76, 175, 80, 0.15);
    border-color: rgba(76, 175, 80, 0.3);
}

/* Cancelled jobs - red */
.job-outcome-info-box.cancelled {
    background: linear-gradient(135deg, #ffebee 0%, #fce4ec 100%);
    border-color: rgba(244, 67, 54, 0.2);
}

body.dark-mode .job-outcome-info-box.cancelled {
    background: rgba(244, 67, 54, 0.15);
    border-color: rgba(244, 67, 54, 0.3);
}

/* No fare jobs - orange */
.job-outcome-info-box.nofare {
    background: linear-gradient(135deg, #fff3e0 0%, #fce4ec 100%);
    border-color: rgba(255, 152, 0, 0.2);
}

body.dark-mode .job-outcome-info-box.nofare {
    background: rgba(255, 152, 0, 0.15);
    border-color: rgba(255, 152, 0, 0.3);
}

/* Other outcome jobs - purple */
.job-outcome-info-box.other {
    background: linear-gradient(135deg, #f3e5f5 0%, #fce4ec 100%);
    border-color: rgba(156, 39, 176, 0.2);
}

body.dark-mode .job-outcome-info-box.other {
    background: rgba(156, 39, 176, 0.15);
    border-color: rgba(156, 39, 176, 0.3);
}

/* Documentation Modal Styles */
.documentation-modal-content {
    max-width: 900px;
    max-height: 85vh;
}

.documentation-body {
    padding: 0 !important;
}

.doc-section {
    padding: 24px;
    border-bottom: 1px solid var(--color-border-soft);
    transition: border-color 0.3s ease;
}

.doc-section:last-child {
    border-bottom: none;
}

.doc-section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-heading);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.doc-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--color-text-main);
    margin-bottom: 16px;
}

.doc-status-examples {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.doc-status-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--color-text-main);
}

.status-badge {
    padding: 6px 16px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    min-width: 140px;
    text-align: center;
}

.status-badge.status-excellent {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    color: #059669;
    border: 2px solid #10b981;
}

.status-badge.status-good {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    color: #16a34a;
    border: 2px solid #22c55e;
}

.status-badge.status-stable {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    color: #d97706;
    border: 2px solid #f59e0b;
}

.status-badge.status-warning {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    color: #ea580c;
    border: 2px solid #f97316;
}

.status-badge.status-critical {
    background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
    color: #dc2626;
    border: 2px solid #ef4444;
}

.doc-metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.doc-metric {
    padding: 16px;
    background: var(--color-bg);
    border-radius: 12px;
    border: 1px solid var(--color-border-soft);
    transition: background 0.3s ease, border-color 0.3s ease;
}

body.dark-mode .doc-metric {
    background: rgba(26, 26, 46, 0.5);
}

.doc-metric strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-heading);
    margin-bottom: 6px;
}

.doc-metric p {
    font-size: 13px;
    line-height: 1.5;
    color: var(--color-muted);
    margin: 0;
}

.doc-note {
    margin-top: 12px;
    padding: 12px;
    background: #fffbeb;
    border-left: 3px solid #f59e0b;
    border-radius: 6px;
    font-size: 13px;
    color: #92400e;
}

.doc-info-box {
    padding: 16px;
    background: #f0f9ff;
    border-left: 3px solid var(--color-accent);
    border-radius: 8px;
    margin-top: 12px;
    transition: background 0.3s ease;
}

body.dark-mode .doc-info-box {
    background: rgba(88, 101, 242, 0.15);
}

.doc-info-box strong {
    display: block;
    font-size: 14px;
    color: var(--color-heading);
    margin-bottom: 8px;
}

.doc-info-box p {
    font-size: 13px;
    line-height: 1.6;
    color: var(--color-text-main);
    margin: 4px 0;
}

.doc-info-box ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
}

.doc-info-box li {
    font-size: 13px;
    line-height: 1.8;
    color: var(--color-text-main);
}

.doc-example {
    font-style: italic;
    color: var(--color-muted);
}

.doc-list {
    list-style: none;
    padding: 0;
    margin: 16px 0 0 0;
}

.doc-list li {
    padding: 10px 12px;
    margin-bottom: 8px;
    background: var(--color-bg);
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--color-text-main);
    transition: background 0.3s ease;
}

body.dark-mode .doc-list li {
    background: rgba(26, 26, 46, 0.5);
}

.doc-list li strong {
    color: var(--color-heading);
}

/* Table inside cards */
.metric-card table {
    width: 100%;
    font-size: 12px;
    border-collapse: collapse;
    table-layout: auto;
}

.metric-card table thead {
    border-bottom: 2px solid var(--color-border-soft);
}

.metric-card table th {
    padding: 8px 8px;
    text-align: left;
    font-weight: 600;
    color: var(--color-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.metric-card table td {
    padding: 8px 8px;
    color: var(--color-text-main);
    border-bottom: 1px solid rgba(229, 229, 238, 0.5);
    white-space: nowrap;
}

body.dark-mode .metric-card table td {
    border-bottom: 1px solid rgba(58, 58, 78, 0.5);
}

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

.metric-card table tbody tr:hover {
    background: rgba(59, 75, 255, 0.03);
}

body.dark-mode .metric-card table tbody tr:hover {
    background: rgba(88, 101, 242, 0.15);
}

.divider {
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, var(--color-border-soft) 50%, transparent 100%);
    margin: 32px 0;
}

.footer-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 40px;
    padding: 24px;
    background: var(--color-card-bg);
    border-radius: 16px;
    border: 1px solid var(--color-border-soft);
    box-shadow: 0 4px 20px rgba(15, 14, 83, 0.08);
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

body.dark-mode .footer-bar {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.refresh-btn {
    border: none;
    border-radius: 12px;
    padding: 12px 24px;
    font-size: 13px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--color-accent) 0%, #6366f1 100%);
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(59,75,255,0.3);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.refresh-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59,75,255,0.4);
}

.refresh-btn.is-refreshing,
.refresh-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 10px rgba(59,75,255,0.2);
}

body.dark-mode .refresh-btn {
    box-shadow: 0 4px 16px rgba(88, 101, 242, 0.5);
}

body.dark-mode .refresh-btn:hover {
    box-shadow: 0 6px 20px rgba(88, 101, 242, 0.6);
}

.metric-card__refresh {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid var(--color-border-soft);
    background: rgba(255,255,255,0.9);
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.metric-card:hover .metric-card__refresh {
    opacity: 1;
}

.metric-card__refresh:hover {
    background: var(--color-surface);
    transform: translateY(-1px);
}

.metric-card__refresh.is-refreshing,
.metric-card__refresh:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

body.dark-mode .metric-card__refresh {
    background: rgba(25,25,35,0.9);
    color: var(--color-text);
    border-color: var(--color-border-soft);
}

body.dark-mode .metric-card__refresh:hover {
    background: rgba(35,35,50,0.9);
}

.refresh-btn span {
    font-size: 16px;
}

.pill {
    border-radius: 999px;
    padding: 8px 16px;
    background: var(--color-bg);
    color: var(--color-text-main);
    font-size: 12px;
    font-weight: 500;
    border: 1px solid var(--color-border-soft);
    transition: background 0.3s ease, border-color 0.3s ease;
}

/* Responsive Design */
@media (min-width: 1400px) {
    .card-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
}

@media (max-width: 1024px) {
    :root {
        --sidebar-width: 0px;
    }
    
    .shell {
        grid-template-columns: 1fr;
    }
    
    /* Hide sidebar on mobile */
    .sidebar {
        display: none;
    }
    
    /* Show mobile overall status, hide desktop one */
    .mobile-overall-status {
        display: flex !important;
    }
    
    .status-bar {
        display: grid;
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    /* Show mobile tabs */
    .mobile-tabs {
        display: flex !important;
        flex-direction: row;
        gap: 8px;
        width: 100%;
    }
    
    .mobile-tabs button {
        flex: 1;
        text-align: center;
        padding: 10px 16px;
        font-size: 12px;
        border-radius: 8px;
    }
    
    .mobile-tabs button:hover {
        transform: none;
    }
    
    .status-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        padding: 16px 24px;
    }
    
    .card-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
    
    .app-shell {
        padding: 24px;
    }
}

@media (max-width: 768px) {
    .card-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 16px;
    }
    
    .metric-card {
        padding: 20px;
        min-height: 120px;
    }
    
    .metric-card__percent {
        font-size: 28px;
    }
    
    .app-shell {
        padding: 20px;
    }
    
    .status-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 12px 16px;
    }
    
    .status-bar-actions {
        width: 100%;
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 8px;
    }
    
    .status-title {
        font-size: 18px;
    }
    
    .status-subtitle {
        font-size: 12px;
    }
    
    .doc-button-text {
        display: none;
    }
    
    .doc-button {
        padding: 8px 12px;
    }
    
    .weather-toggle {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    .status-meta {
        font-size: 11px;
        padding: 6px 12px;
    }
    
    .live-indicator {
        padding: 6px 12px;
        font-size: 10px;
    }
    
    .live-indicator-dot {
        width: 6px;
        height: 6px;
    }
    
    .section-heading {
        font-size: 14px;
    }
    
    .section-heading-icon {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    
    /* Better mobile overall status */
    .mobile-overall-status {
        padding: 10px 16px;
    }
    
    .overall-status-title {
        font-size: 10px;
    }
    
    .overall-status-text {
        font-size: 13px;
    }
    
    .overall-status-indicator {
        width: 14px;
        height: 14px;
    }
    
    /* Digital date/time on mobile */
    .digital-datetime {
        padding: 6px 12px;
        min-width: 120px;
    }
    
    .digital-time {
        font-size: 18px;
    }
    
    .digital-date {
        font-size: 10px;
    }
    
    /* Theme toggle on tablet */
    .theme-toggle {
        width: 54px;
        height: 28px;
    }
    
    .theme-toggle-slider::before {
        height: 20px;
        width: 20px;
    }
    
    .theme-toggle input:checked + .theme-toggle-slider::before {
        transform: translateX(26px);
    }
}

@media (max-width: 600px) {
    .card-grid {
        grid-template-columns: 1fr;
    }
    
    .metric-card {
        padding: 16px;
        min-height: 100px;
    }
    
    .metric-card--compact {
        min-height: 90px;
    }
    
    .metric-card__percent {
        font-size: 24px;
    }
    
    .metric-card__count {
        font-size: 13px;
    }
    
    .metric-card__label {
        font-size: 10px;
    }
    
    .app-shell {
        padding: 16px;
    }
    
    .status-bar {
        padding: 12px;
    }
    
    .status-title {
        font-size: 16px;
    }
    
    .status-subtitle {
        font-size: 11px;
    }
    
    .top-tabs {
        width: 100%;
        justify-content: stretch;
    }
    
    .top-tabs button {
        flex: 1;
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .footer-bar {
        flex-direction: column;
        gap: 16px;
        padding: 16px;
    }
    
    .refresh-btn {
        padding: 10px 20px;
        font-size: 12px;
    }
    
    .pill {
        font-size: 11px;
        padding: 6px 12px;
    }
    
    .card-grid.card-grid--stack-mobile .metric-card {
        grid-column: 1 / -1;
    }
    
    /* Make status bar actions stack better on small screens */
    .status-bar-actions {
        gap: 6px;
    }
    
    .doc-button-icon {
        font-size: 14px;
    }
    
    /* Make modal tables more readable on mobile */
    .modal-content {
        width: 98vw;
        max-height: 92vh;
        padding: 16px 12px;
    }
    
    .modal-title {
        font-size: 16px;
    }
    
    .modal-subtitle {
        font-size: 11px;
    }
    
    .modal-body {
        padding: 0 12px 12px;
    }
    
    .modal-table {
        font-size: 12px;
    }
    
    .modal-table th,
    .modal-table td {
        padding: 8px 6px;
        font-size: 11px;
    }
    
    /* Digital date/time on small phones */
    .digital-datetime {
        padding: 6px 10px;
        min-width: 110px;
    }
    
    .digital-time {
        font-size: 16px;
    }
    
    .digital-date {
        font-size: 9px;
    }
    
    /* Theme toggle on small phones */
    .theme-toggle {
        width: 50px;
        height: 26px;
    }
    
    .theme-toggle-slider::before {
        height: 18px;
        width: 18px;
    }
    
    .theme-toggle input:checked + .theme-toggle-slider::before {
        transform: translateX(24px);
    }
    
    .theme-toggle-icon {
        font-size: 12px;
    }
}

/* Historical Mode Styles */
body.historical-mode {
    background: linear-gradient(135deg, #fff5e1 0%, #ffe4b5 50%, #ffd39b 100%) !important;
}

body.dark-mode.historical-mode {
    background: linear-gradient(135deg, #2a2416 0%, #3a2d1a 50%, #4a3620 100%) !important;
}

/* Keep sidebar visible in historical mode but hide non-tab content */
body.historical-mode .sidebar > *:not(.top-tabs) {
    display: none;
}

/* Hide the Historical Data tab when already in historical mode */
body.historical-mode .top-tabs button[data-view="historical"] {
    display: none;
}

/* Show Return to Dashboard button only in historical mode */
.exit-historical-btn {
    display: none !important;
}

body.historical-mode .exit-historical-btn {
    display: flex !important;
    align-items: center;
    gap: 8px;
    margin: 16px 16px 0 16px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
}

body.historical-mode .exit-historical-btn:hover {
    background: linear-gradient(135deg, #ff8555 0%, #ffa03e 100%);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4);
    transform: translateY(-1px);
}

body.historical-mode .exit-historical-btn span {
    font-size: 18px;
}

/* Don't change grid in historical mode - keep sidebar visible for tabs */
/* body.historical-mode .shell {
    grid-template-columns: 1fr;
} */

/* Historical Back Bar (Fixed at top) */
.historical-back-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 32px;
    background: linear-gradient(135deg, #ff8c00 0%, #ffa500 100%);
    box-shadow: 0 4px 20px rgba(255, 140, 0, 0.3);
    margin-bottom: 32px;
}

.historical-back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    color: #ff8c00;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.historical-back-btn:hover {
    background: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.historical-back-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
}

.historical-back-icon {
    font-size: 24px;
}

/* Historical Selection Screen */
.historical-selection-screen {
    max-width: 700px;
    margin: 0 auto;
    padding: 40px 20px;
}

.historical-welcome {
    text-align: center;
    margin-bottom: 48px;
}

.historical-welcome-icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.historical-welcome-title {
    font-size: 36px;
    font-weight: 700;
    color: #ff8c00;
    margin-bottom: 12px;
}

.historical-welcome-subtitle {
    font-size: 18px;
    color: var(--color-muted);
}

.historical-selector-card {
    background: var(--color-card-bg);
    border-radius: 20px;
    border: 3px solid #ff8c00;
    box-shadow: 0 10px 40px rgba(255, 140, 0, 0.2);
    overflow: hidden;
    margin-bottom: 24px;
}

.historical-selector-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 32px;
    background: linear-gradient(135deg, #fff9e6 0%, #ffe8cc 100%);
    border-bottom: 2px solid #ff8c00;
}

body.dark-mode .historical-selector-header {
    background: linear-gradient(135deg, #3a2d1a 0%, #4a3620 100%);
}

.selector-icon {
    font-size: 28px;
}

.historical-selector-header h3 {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-heading);
    margin: 0;
}

.historical-selector-body {
    padding: 32px;
}

.historical-snapshot-select {
    width: 100%;
    padding: 18px 20px;
    border: 3px solid #ff8c00;
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    font-weight: 500;
    background: var(--color-bg);
    color: var(--color-text-main);
    cursor: pointer;
    outline: none;
    margin-bottom: 20px;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff8c00' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 24px;
    padding-right: 50px;
    transition: all 0.3s ease;
}

.historical-snapshot-select:hover {
    border-color: #ffa500;
    box-shadow: 0 0 0 4px rgba(255, 140, 0, 0.1);
}

.historical-snapshot-select:focus {
    border-color: #ffa500;
    box-shadow: 0 0 0 6px rgba(255, 140, 0, 0.2);
}

.historical-load-btn {
    width: 100%;
    padding: 18px 32px;
    background: linear-gradient(135deg, #ff8c00 0%, #ffa500 100%);
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(255, 140, 0, 0.4);
}

.historical-load-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(255, 140, 0, 0.5);
}

.historical-load-btn:active {
    transform: translateY(-1px);
}

.historical-save-section {
    text-align: center;
}

.historical-save-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.historical-save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

/* Historical Dashboard View */
.historical-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 32px;
    padding: 0 32px;
}

.historical-tab {
    flex: 1;
    padding: 16px 24px;
    background: var(--color-card-bg);
    border: 3px solid #ff8c00;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-main);
    cursor: pointer;
    transition: all 0.3s ease;
}

.historical-tab:hover {
    background: linear-gradient(135deg, #fff9e6 0%, #ffe8cc 100%);
    transform: translateY(-2px);
}

body.dark-mode .historical-tab:hover {
    background: linear-gradient(135deg, #3a2d1a 0%, #4a3620 100%);
}

.historical-tab.active {
    background: linear-gradient(135deg, #ff8c00 0%, #ffa500 100%);
    color: #ffffff;
    border-color: #ff8c00;
    box-shadow: 0 4px 16px rgba(255, 140, 0, 0.4);
}

#historical-content {
    padding: 0 32px;
}

.historical-banner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: linear-gradient(135deg, #fff3cd 0%, #ffe69c 100%);
    border: 2px solid #ffb347;
    border-radius: 16px;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(255, 179, 71, 0.3);
}

body.dark-mode .historical-banner {
    background: linear-gradient(135deg, #3a2d1a 0%, #4a3620 100%);
    border-color: #ff8c00;
    box-shadow: 0 4px 20px rgba(255, 140, 0, 0.3);
}

.historical-banner-icon {
    font-size: 40px;
    line-height: 1;
}

.historical-banner-content {
    flex: 1;
}

.historical-banner-title {
    font-size: 20px;
    font-weight: 700;
    color: #8b4513;
    margin-bottom: 4px;
}

body.dark-mode .historical-banner-title {
    color: #ffb347;
}

.historical-banner-subtitle {
    font-size: 14px;
    font-weight: 500;
    color: #a0522d;
}

body.dark-mode .historical-banner-subtitle {
    color: #ff9c5a;
}

.historical-controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.historical-card {
    background: var(--color-card-bg);
    border-radius: 16px;
    border: 2px solid var(--color-border-soft);
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(15, 14, 83, 0.08);
    transition: all 0.3s ease;
}

.historical-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(255, 140, 0, 0.15);
    border-color: #ff8c00;
}

.historical-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    background: linear-gradient(135deg, #fff9e6 0%, #ffe8cc 100%);
    border-bottom: 2px solid rgba(255, 140, 0, 0.2);
}

body.dark-mode .historical-card-header {
    background: linear-gradient(135deg, #3a2d1a 0%, #4a3620 100%);
    border-bottom-color: rgba(255, 140, 0, 0.3);
}

.historical-card-icon {
    font-size: 24px;
    line-height: 1;
}

.historical-card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-heading);
    margin: 0;
}

.historical-card-body {
    padding: 24px;
}

.historical-card-description {
    font-size: 13px;
    color: var(--color-muted);
    margin-bottom: 16px;
}

.date-picker-wrapper {
    margin-bottom: 16px;
}

.date-picker-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-main);
    margin-bottom: 8px;
}

.historical-date-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--color-border-soft);
    border-radius: 12px;
    font-size: 15px;
    font-family: inherit;
    font-weight: 500;
    background: var(--color-bg);
    color: var(--color-text-main);
    transition: all 0.3s ease;
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff8c00' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
    padding-right: 40px;
}

.historical-date-input:hover {
    border-color: #ff8c00;
    background-color: var(--color-card-bg);
}

.historical-date-input:focus {
    border-color: #ff8c00;
    background-color: var(--color-card-bg);
    box-shadow: 0 0 0 4px rgba(255, 140, 0, 0.15);
}

.historical-date-input option {
    padding: 10px;
    background: var(--color-card-bg);
    color: var(--color-text-main);
}

.historical-actions-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.historical-btn {
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, #ff8c00 0%, #ff9c5a 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(255, 140, 0, 0.3);
}

.historical-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 140, 0, 0.4);
}

.historical-btn:active {
    transform: translateY(0);
}

.historical-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.historical-btn-primary {
    background: linear-gradient(135deg, #ff8c00 0%, #ff9c5a 100%);
    box-shadow: 0 4px 12px rgba(255, 140, 0, 0.3);
    font-size: 15px;
    padding: 16px 24px;
}

.historical-btn-primary:hover {
    box-shadow: 0 6px 20px rgba(255, 140, 0, 0.5);
}

.historical-btn-save {
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.historical-btn-save:hover {
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.historical-btn-exit {
    background: linear-gradient(135deg, #6b7280 0%, #9ca3af 100%);
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.3);
}

.historical-btn-exit:hover {
    box-shadow: 0 6px 20px rgba(107, 114, 128, 0.4);
}

.btn-icon {
    font-size: 18px;
    line-height: 1;
}

@media (max-width: 768px) {
    .historical-controls-grid {
        grid-template-columns: 1fr;
    }
    
    .historical-card-body {
        padding: 20px;
    }
    
    .historical-actions-group {
        gap: 10px;
    }
    
    .historical-btn {
        padding: 12px 16px;
        font-size: 13px;
    }
    
    .historical-btn-primary {
        padding: 14px 20px;
        font-size: 14px;
    }
}

/* Loading Spinner Styles */
.metric-card__loader {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 3px solid rgba(102, 126, 234, 0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: cardSpin 0.8s linear infinite;
}

.metric-card__loader--small {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

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

/* Loading state for metric cards */
.metric-card.loading .metric-card__percent,
.metric-card.loading .metric-card__count {
    opacity: 0;
}

.metric-card__percent.loading,
.metric-card__count.loading {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Skeleton loading animation */
@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.skeleton {
    display: inline-block;
    min-width: 40px;
    background: linear-gradient(90deg, #f0f0f0 0px, #f8f8f8 40px, #f0f0f0 80px);
    background-size: 200px 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
    color: transparent !important;
}

body.dark-mode .skeleton {
    background: linear-gradient(90deg, #2a2a3e 0px, #35354a 40px, #2a2a3e 80px);
    background-size: 200px 100%;
}

/* Fade in animation when data loads */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.metric-card__percent.loaded,
.metric-card__count.loaded {
    animation: fadeIn 0.4s ease-out;
}

/* Large modal for high-value jobs */
.modal-content--large {
    max-width: 1400px;
    width: 98vw;
}

/* Pagination buttons */
.pagination-btn {
    transition: all 0.2s ease;
}

.pagination-btn:not(:disabled):hover {
    background: var(--color-accent-hover) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.pagination-btn:active:not(:disabled) {
    transform: translateY(0);
}

body.dark-mode .pagination-btn {
    background: var(--color-accent);
}

body.dark-mode .pagination-btn:disabled {
    background: #555;
    color: #888;
}

/* Search input styling */
#high-value-jobs-search {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#high-value-jobs-search:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

body.dark-mode #high-value-jobs-search {
    background: var(--color-bg-card);
    border-color: #444;
    color: var(--color-text-main);
}

body.dark-mode #high-value-jobs-search::placeholder {
    color: #888;
}

body.dark-mode #high-value-jobs-search:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

/* Sortable table headers */
#high-value-jobs-modal th[data-column] {
    transition: background-color 0.2s ease;
    position: relative;
}

#high-value-jobs-modal th[data-column]:hover {
    background-color: rgba(79, 70, 229, 0.05);
}

body.dark-mode #high-value-jobs-modal th[data-column]:hover {
    background-color: rgba(79, 70, 229, 0.1);
}

#high-value-jobs-modal th.sorted-asc,
#high-value-jobs-modal th.sorted-desc {
    background-color: rgba(79, 70, 229, 0.1);
    font-weight: 600;
}

body.dark-mode #high-value-jobs-modal th.sorted-asc,
body.dark-mode #high-value-jobs-modal th.sorted-desc {
    background-color: rgba(79, 70, 229, 0.15);
}

#high-value-jobs-modal .sort-arrow {
    font-size: 10px;
    margin-left: 4px;
    color: var(--color-accent);
}

/* Stacked metrics card - matches height of earnings table */
.metric-card--stacked {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.metric-card--stacked .metric-card__label {
    font-weight: 600;
    margin-bottom: 4px;
}

/* Ensure both cards in the grid have same height */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 12px;
    align-items: stretch;
}

/* Sortable headers for Live Drivers modal */
.sortable-header {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

.sortable-header:hover {
    background-color: rgba(79, 70, 229, 0.05);
}

body.dark-mode .sortable-header:hover {
    background-color: rgba(79, 70, 229, 0.1);
}

.sortable-header:active {
    background-color: rgba(79, 70, 229, 0.1);
}

body.dark-mode .sortable-header:active {
    background-color: rgba(79, 70, 229, 0.15);
}

/* ====================================
   ANALYTICS VIEW
   ==================================== */

/* Analytics filters */
.analytics-filters {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: var(--color-card-bg);
    border-radius: 8px;
    border: 1px solid var(--color-border);
    flex-wrap: wrap;
}

.analytics-filter-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-right: 4px;
}

.analytics-filter-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.analytics-filter-btn {
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    color: var(--color-text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.analytics-filter-btn:hover {
    background: var(--color-card-bg);
    border-color: #4f46e5;
    color: var(--color-text-primary);
}

.analytics-filter-btn.active {
    background: #4f46e5;
    border-color: #4f46e5;
    color: white;
    font-weight: 600;
}

.analytics-filter-btn:active {
    transform: scale(0.98);
}

/* Dark mode filter buttons */
body.dark-mode .analytics-filter-btn {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .analytics-filter-btn:hover {
    background: rgba(79, 70, 229, 0.2);
    border-color: #6366f1;
}

body.dark-mode .analytics-filter-btn.active {
    background: #6366f1;
    border-color: #6366f1;
}

/* Analytics zone grid - responsive grid layout */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    width: 100%;
}

/* Analytics zone card styling */
.analytics-zone-card {
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Performance indicators */
.analytics-positive {
    color: #4CAF50;
}

.analytics-negative {
    color: #f44336;
}

.analytics-neutral {
    color: var(--color-text-secondary);
}

/* Responsive breakpoints for analytics grid */
@media (max-width: 1400px) {
    .analytics-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

@media (max-width: 1024px) {
    .analytics-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 12px;
    }
}

@media (max-width: 768px) {
    .analytics-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 10px;
    }
}

@media (max-width: 768px) {
    .analytics-filters {
        padding: 10px 12px;
    }
    
    .analytics-filter-label {
        width: 100%;
        margin-bottom: 4px;
    }
    
    .analytics-filter-buttons {
        width: 100%;
    }
    
    .analytics-filter-btn {
        flex: 1;
        min-width: 0;
        font-size: 11px;
        padding: 6px 8px;
    }
}

@media (max-width: 480px) {
    .analytics-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .analytics-filter-buttons {
        flex-direction: column;
    }
    
    .analytics-filter-btn {
        width: 100%;
    }
}

/* ====================================
   WELCOME SCREEN
   ==================================== */

#view-welcome {
    min-height: calc(100vh - 200px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.welcome-container {
    max-width: 1200px;
    width: 100%;
    text-align: center;
}

.welcome-header {
    margin-bottom: 48px;
    animation: fadeInDown 0.6s ease-out;
}

.welcome-icon {
    font-size: 64px;
    margin-bottom: 16px;
    animation: pulse 2s ease-in-out infinite;
}

.welcome-title {
    font-size: 42px;
    font-weight: 700;
    color: var(--color-text-primary);
    margin: 0 0 12px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

body.dark-mode .welcome-title {
    background: linear-gradient(135deg, #818cf8 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-subtitle {
    font-size: 18px;
    color: var(--color-text-secondary);
    margin: 0;
}

.welcome-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
    animation: fadeInUp 0.8s ease-out;
}

.welcome-card {
    background: var(--color-card-bg);
    border: 2px solid var(--color-border);
    border-radius: 16px;
    padding: 32px 24px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.welcome-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.welcome-card:hover::before {
    opacity: 1;
}

.welcome-card:hover {
    transform: translateY(-8px);
    border-color: #667eea;
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.3);
}

body.dark-mode .welcome-card:hover {
    border-color: #818cf8;
    box-shadow: 0 12px 40px rgba(129, 140, 248, 0.3);
}

.welcome-card:active {
    transform: translateY(-4px);
}

.welcome-card-icon {
    font-size: 48px;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
}

.welcome-card-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.welcome-card-description {
    font-size: 14px;
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
    min-height: 48px;
    position: relative;
    z-index: 1;
}

.welcome-card-footer {
    position: relative;
    z-index: 1;
}

.welcome-card-badge {
    display: inline-block;
    padding: 6px 14px;
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

body.dark-mode .welcome-card-badge {
    background: rgba(129, 140, 248, 0.15);
    color: #818cf8;
}

.welcome-footer {
    animation: fadeIn 1s ease-out 0.4s both;
}

.welcome-hint {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin: 0;
    font-style: italic;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Responsive welcome screen */
@media (max-width: 1024px) {
    .welcome-title {
        font-size: 36px;
    }
    
    .welcome-cards {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 768px) {
    #view-welcome {
        padding: 30px 16px;
    }
    
    .welcome-header {
        margin-bottom: 32px;
    }
    
    .welcome-icon {
        font-size: 48px;
    }
    
    .welcome-title {
        font-size: 32px;
    }
    
    .welcome-subtitle {
        font-size: 16px;
    }
    
    .welcome-cards {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .welcome-card {
        padding: 24px 20px;
    }
}

@media (max-width: 480px) {
    .welcome-title {
        font-size: 28px;
    }
    
    .welcome-card-icon {
        font-size: 40px;
    }
    
    .welcome-card-title {
        font-size: 20px;
    }
}

/* ====================================
   HISTORICAL SNAPSHOT DATE PICKER
   ==================================== */

.snapshot-date-picker {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: 0;
    transition: none;
    box-shadow: none;
}

.snapshot-date-picker:hover {
    /* No hover effect */
}

.snapshot-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-main);
    white-space: nowrap;
    letter-spacing: 0;
    text-transform: none;
    display: inline;
}

.snapshot-select {
    padding: 6px 12px;
    font-size: 14px;
    font-weight: 400;
    color: var(--color-text-main);
    background: var(--color-card-bg);
    border: 1px solid var(--color-border-soft);
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.2s ease;
    min-width: 200px;
    box-shadow: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23666' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}

.snapshot-select:hover {
    border-color: var(--color-accent);
}

.snapshot-select:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px rgba(59, 75, 255, 0.1);
}

.snapshot-select:active {
    transform: scale(0.99);
}

/* Premium dropdown styling */
.snapshot-select option {
    padding: 14px 20px;
    font-weight: 600;
    font-size: 14px;
    background: var(--color-card-bg);
    color: var(--color-text-primary);
    border-radius: 8px;
}

.snapshot-select option:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
}

.snapshot-select option:checked {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    font-weight: 700;
}

/* Dark mode */
body.dark-mode .snapshot-select {
    background: var(--color-card-bg);
    border-color: var(--color-border-soft);
    color: var(--color-text-main);
}

body.dark-mode .snapshot-select:hover {
    border-color: var(--color-accent);
}

body.dark-mode .snapshot-select:focus {
    border-color: var(--color-accent);
}

body.dark-mode .snapshot-select option {
    background: var(--color-card-bg);
    color: var(--color-text-main);
}

/* Live Mode - No special styling */
.snapshot-date-picker.live-mode {
    /* Keep it simple */
}

.snapshot-date-picker.live-mode .snapshot-label {
    /* No special styling */
}

body.dark-mode .snapshot-date-picker.live-mode {
    /* No special styling */
}

/* ====================================
   HISTORICAL DATA BANNER
   ==================================== */

.historical-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    animation: slideDown 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 14px 24px;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
    z-index: 100;
    position: relative;
}

body.dark-mode .historical-banner {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
}

.historical-banner-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.historical-banner-icon {
    font-size: 22px;
}

.historical-banner-text {
    font-size: 15px;
    font-weight: 600;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.3px;
}

.historical-banner-close {
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.25);
    color: white;
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.historical-banner-close:hover {
    background: rgba(255, 255, 255, 0.35);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.historical-banner-close:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .snapshot-date-picker {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    
    .snapshot-select {
        width: 100%;
        min-width: auto;
    }
    
    .historical-banner {
        padding: 10px 16px;
    }
    
    .historical-banner-content {
        flex-direction: column;
        gap: 8px;
    }
    
    .historical-banner-close {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .snapshot-label {
        font-size: 11px;
    }
    
    .snapshot-select {
        font-size: 12px;
        padding: 5px 10px;
    }
}

/* ====================================
   HIDE TABS ON WELCOME SCREEN
   ==================================== */

/* Disable tabs when welcome screen is active */
body.welcome-screen-active .top-tabs {
    opacity: 0.3;
    pointer-events: none;
    user-select: none;
}

/* ====================================
   HISTORICAL MODE CARD STYLING
   ==================================== */

/* Purple tint for cards when viewing historical data */
/* Historical mode - FORCE NO PURPLE BORDERS */
body.historical-mode .metric-card {
    border: none !important;
    border-left: none !important;
    background: var(--color-card-bg) !important;
}

body.historical-mode .metric-card:hover {
    border: none !important;
    border-left: none !important;
}

body.historical-mode .live-metric-card {
    border: none !important;
    border-left: none !important;
    background: var(--color-card-bg) !important;
}

/* Force remove any purple styling globally */
.metric-card {
    border-left: none !important;
}

.live-metric-card {
    border-left: none !important;
}

/* Main content smooth transition */
.main-content {
    transition: opacity 0.3s ease;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 25;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    margin: 0 auto 20px auto;
    width: 100%;
    max-width: 1400px;
    background: var(--color-card-bg);
    border: 2px solid var(--color-border-soft);
    border-radius: 14px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.4);
    backdrop-filter: blur(6px);
}
.app-header-title {
    display:flex;
    align-items:center;
    gap:12px;
    font-size:18px;
    font-weight:800;
    color: var(--color-heading);
}
.app-header-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(88,101,242,0.2), rgba(99,102,241,0.2));
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:16px;
    border:1px solid var(--color-border-soft);
}
.app-header-text { display:flex; flex-direction:column; gap:2px; }
.app-header-heading { font-size:16px; font-weight:800; color: var(--color-heading); }
.app-header-sub { font-size:12px; font-weight:600; color: var(--color-muted); }
.app-header-meta {
    font-size:12px;
    color: var(--color-muted);
    font-weight:700;
}

/* Disabled tab styling */
.top-tabs button:disabled,
.top-tabs button.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.top-tabs button:disabled:hover,
.top-tabs button.disabled:hover {
    background: transparent;
    color: var(--color-text-secondary);
}

/* Sidebar Navigation Links */
.sidebar-nav {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--color-muted);
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
}

.sidebar-nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-text-main);
    text-decoration: none;
}

.sidebar-nav-item.active {
    background: rgba(59, 75, 255, 0.15);
    color: var(--color-accent);
    font-weight: 600;
}

.sidebar-nav-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

.sidebar-nav-text {
    flex: 1;
}

/* Sidebar Footer - Admin Link */
.sidebar-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--color-border-soft);
}

/* Admin Icon Button */
.admin-icon-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.admin-icon-button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.admin-icon-button.active {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.admin-icon {
    font-size: 24px;
}

/* Admin Popup Menu */
/* Simple Admin Button */
.admin-btn {
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.admin-btn:hover {
    background: rgba(99, 102, 241, 0.3);
}

/* Simple Popup Menu */
.popup-menu {
    display: none;
    position: fixed;
    top: 70px;
    right: 20px;
    background: #111827;
    border: 1px solid #1f2937;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    min-width: 200px;
    z-index: 9999;
}

.popup-menu.show {
    display: block;
}

.popup-menu a {
    display: block;
    padding: 12px 16px;
    color: #e5e7eb;
    text-decoration: none;
    border-bottom: 1px solid #1f2937;
}

.popup-menu a:last-child {
    border-bottom: none;
}

.popup-menu a:hover {
    background: #0f172a;
    color: #3b4bff;
}


/* Actions Button and Dropdown Styles */
.actions-button-container {
    position: relative;
    display: inline-block;
}

.actions-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, var(--color-purple) 0%, var(--color-purple-dark) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3), 0 1px 3px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

.actions-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.actions-button:hover::before {
    left: 100%;
}

.actions-button:hover {
    background: linear-gradient(135deg, var(--color-purple-dark) 0%, #6d28d9 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4), 0 2px 6px rgba(0,0,0,0.15);
}

.actions-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(139, 92, 246, 0.3);
}

.actions-button-icon {
    font-size: 18px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}

.actions-button-text {
    font-size: 14px;
    letter-spacing: 0.3px;
}

.actions-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12), 0 2px 6px rgba(0,0,0,0.08);
    min-width: 260px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.actions-dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.actions-dropdown-header {
    padding: 14px 18px 10px;
    font-size: 12px;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    background: linear-gradient(to bottom, #f9fafb, #f3f4f6);
    border-bottom: 2px solid #e5e7eb;
}

.actions-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 18px;
    background: white;
    border: none;
    border-bottom: 1px solid #f3f4f6;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 14px;
    color: #1f2937;
}

.actions-dropdown-item:last-child {
    border-bottom: none;
}

.actions-dropdown-item:hover {
    background: linear-gradient(to right, #f0f4ff, #e0e7ff);
    border-left: 3px solid var(--color-purple);
    padding-left: 15px;
}

.actions-dropdown-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
}

.actions-dropdown-text {
    flex: 1;
    font-weight: 600;
    letter-spacing: 0.2px;
}

/* Driver Message Modal Specific Styles */
#driver-message-modal .modal-content {
    max-width: 500px;
}

#driver-preview {
    border-left: 4px solid var(--color-purple);
}

#driver-list {
    font-family: "Monaco", "Consolas", monospace;
    font-size: 13px;
    line-height: 1.4;
}

.driver-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid var(--color-border-light);
}

.driver-item:last-child {
    border-bottom: none;
}

.driver-callsign {
    font-weight: 600;
    color: var(--color-purple);
}

.driver-name {
    color: var(--color-text-main);
}

.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--color-border-light);
    border-top: 2px solid var(--color-purple);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive adjustments for Actions button */
@media (max-width: 768px) {
    .actions-button-text {
        display: none;
    }
    
    .actions-button {
        padding: 8px;
    }
    
    .actions-dropdown-menu {
        right: -8px;
        min-width: 200px;
    }
}

/* Dark mode adjustments for Actions button */
[data-theme="dark"] .actions-dropdown-menu {
    background: #1f2937;
    border-color: #374151;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3), 0 2px 6px rgba(0,0,0,0.2);
}

[data-theme="dark"] .actions-dropdown-header {
    background: linear-gradient(to bottom, #111827, #1f2937);
    border-bottom-color: #374151;
    color: #9ca3af;
}

[data-theme="dark"] .actions-dropdown-item {
    background: #1f2937;
    border-bottom-color: #374151;
    color: #f3f4f6;
}

[data-theme="dark"] .actions-dropdown-item:hover {
    background: linear-gradient(to right, #312e81, #4338ca);
    border-left-color: #8b5cf6;
}

/* Driver Message Modal Theme Improvements */
#driver-message-modal .modal-body label {
    color: var(--color-text-main);
}

#driver-message-modal select,
#driver-message-modal input,
#driver-message-modal textarea {
    background: var(--color-bg-main);
    color: var(--color-text-main);
    border: 1px solid var(--color-border);
}

#driver-message-modal select:focus,
#driver-message-modal input:focus,
#driver-message-modal textarea:focus {
    border-color: var(--color-purple);
    outline: none;
    box-shadow: 0 0 0 2px rgba(139, 69, 255, 0.1);
}

#driver-preview {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-purple);
}

#driver-list {
    color: var(--color-text-main);
}

.driver-item {
    border-bottom: 1px solid var(--color-border);
}

/* Message error styling */
#message-error {
    background: var(--color-bg-error, #fee);
    border: 1px solid var(--color-border-error, #fcc);
    color: var(--color-text-error, #c33);
}

[data-theme="dark"] #message-error {
    background: rgba(220, 38, 127, 0.15);
    border: 1px solid rgba(220, 38, 127, 0.3);
    color: #ff6b9d;
}

/* Character counter styling */
#char-count {
    color: var(--color-muted);
}

#char-count.warning {
    color: var(--color-warning, #f59e0b);
}

#char-count.error {
    color: var(--color-error, #dc2626);
}
/* ===== PREMIUM DRIVER MESSAGE MODAL ===== */

.driver-message-modal-content {
    max-width: 600px !important;
    border-radius: 16px;
    overflow: hidden;
}

/* Enhanced Modal Header */
.driver-message-modal-content .modal-header {
    background: linear-gradient(135deg, var(--color-purple) 0%, var(--color-purple-dark) 100%);
    padding: 24px 28px;
    border-bottom: none;
}

[data-theme="dark"] .driver-message-modal-content .modal-header {
    background: linear-gradient(135deg, #8b45ff 0%, #6a2dd4 100%);
}

.modal-header-content {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.modal-icon {
    width: 48px;
    height: 48px;
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    backdrop-filter: blur(10px);
}

.driver-message-modal-content .modal-header h3 {
    color: white;
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.modal-subtitle {
    color: rgba(255,255,255,0.85);
    font-size: 13px;
    margin: 4px 0 0 0;
    font-weight: 400;
}

.driver-message-modal-content .modal-close {
    color: white;
    opacity: 0.9;
    transition: all 0.2s ease;
    width: 36px;
    height: 36px;
    border-radius: 8px;
}

.driver-message-modal-content .modal-close:hover {
    opacity: 1;
    background: rgba(255,255,255,0.15);
    transform: scale(1.05);
}

/* Modal Body */
.driver-message-modal-body {
    padding: 28px;
    background: var(--color-bg-main);
}

.message-section {
    margin-bottom: 24px;
}

.message-section:last-child {
    margin-bottom: 0;
}

/* Labels */
.message-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-heading);
    margin-bottom: 12px;
}

.label-icon {
    font-size: 16px;
    opacity: 0.9;
}

.label-hint {
    font-size: 12px;
    font-weight: 400;
    color: var(--color-muted);
    margin-left: auto;
}

/* Preset Buttons Grid */
.preset-buttons-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.preset-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    background: var(--color-bg-secondary);
    border: 2px solid var(--color-border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-main);
    text-align: left;
}

.preset-button:hover {
    border-color: var(--color-purple);
    background: var(--color-bg-main);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 69, 255, 0.15);
}

.preset-button:active {
    transform: translateY(0);
}

.preset-icon {
    font-size: 18px;
    flex-shrink: 0;
}

/* Message Textarea */
.message-input-wrapper {
    position: relative;
}

.message-textarea {
    width: 100%;
    padding: 14px 16px;
    padding-bottom: 36px;
    border: 2px solid var(--color-border);
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    font-family: inherit;
    background: var(--color-bg-main);
    color: var(--color-text-main);
    transition: all 0.2s ease;
    min-height: 120px;
}

.message-textarea:focus {
    border-color: var(--color-purple);
    outline: none;
    box-shadow: 0 0 0 3px rgba(139, 69, 255, 0.1);
}

.message-textarea::placeholder {
    color: var(--color-muted);
}

.char-counter-wrapper {
    position: absolute;
    bottom: 12px;
    right: 16px;
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 12px;
    font-weight: 600;
    pointer-events: none;
}

.char-count {
    color: var(--color-purple);
    font-weight: 700;
}

.char-count.warning {
    color: #f59e0b;
}

.char-count.error {
    color: #dc2626;
}

.char-limit {
    color: var(--color-muted);
    font-weight: 500;
}

/* Callsigns Input */
.callsigns-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--color-border);
    border-radius: 10px;
    font-size: 14px;
    font-family: 'Monaco', 'Consolas', monospace;
    background: var(--color-bg-main);
    color: var(--color-text-main);
    transition: all 0.2s ease;
}

.callsigns-input:focus {
    border-color: var(--color-purple);
    outline: none;
    box-shadow: 0 0 0 3px rgba(139, 69, 255, 0.1);
}

.callsigns-input::placeholder {
    color: var(--color-muted);
    font-family: inherit;
}

/* Driver Preview Panel */
.driver-preview-panel {
    background: var(--color-bg-secondary);
    border: 2px solid var(--color-purple);
    border-radius: 12px;
    padding: 16px;
    margin-top: 20px;
}

.preview-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border);
}

.preview-icon {
    font-size: 18px;
}

.preview-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--color-heading);
}

.driver-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.driver-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--color-bg-main);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.driver-item:hover {
    border-color: var(--color-purple);
    transform: translateX(4px);
}

.driver-callsign {
    font-weight: 700;
    font-size: 14px;
    color: var(--color-purple);
    font-family: 'Monaco', 'Consolas', monospace;
}

.driver-name {
    font-size: 14px;
    color: var(--color-text-main);
}

/* Loading State */
.message-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    background: var(--color-bg-secondary);
    border-radius: 12px;
    color: var(--color-text-main);
    font-size: 14px;
    font-weight: 500;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-purple);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Error Message */
.message-error {
    padding: 14px 16px;
    background: rgba(220, 38, 127, 0.1);
    border: 2px solid rgba(220, 38, 127, 0.3);
    border-radius: 10px;
    color: #dc2626;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
}

[data-theme="dark"] .message-error {
    background: rgba(220, 38, 127, 0.15);
    border-color: rgba(220, 38, 127, 0.4);
    color: #ff6b9d;
}

/* Modal Footer */
.driver-message-footer {
    background: var(--color-bg-secondary);
    padding: 20px 28px;
    border-top: 1px solid var(--color-border);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Premium Buttons */
.btn-modal {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 20px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.btn-modal:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-icon {
    font-size: 16px;
}

.btn-cancel {
    background: var(--color-bg-main);
    color: var(--color-text-main);
    border: 2px solid var(--color-border);
}

.btn-cancel:hover:not(:disabled) {
    background: var(--color-bg-secondary);
    border-color: var(--color-heading);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.12);
}

.btn-validate {
    background: linear-gradient(135deg, #8b45ff 0%, #6a2dd4 100%);
    color: white;
}

.btn-validate:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(139, 69, 255, 0.35);
}

.btn-send {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.btn-send:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35);
}

.btn-modal:active:not(:disabled) {
    transform: translateY(0);
}

/* Responsive */
@media (max-width: 640px) {
    .preset-buttons-grid {
        grid-template-columns: 1fr;
    }
    
.driver-message-modal-content {
    max-width: 520px;
    width: 90vw;
    border-radius: 16px;
    overflow: hidden;
}
    
    .driver-message-modal-body {
        padding: 20px;
    }
    
    .driver-message-footer {
        padding: 16px 20px;
        flex-wrap: wrap;
    }
    
    .btn-modal {
        flex: 1;
        justify-content: center;
        min-width: 120px;
    }
}

/* ===== CLEAN PREMIUM MESSAGE MODAL ===== */

.message-composer-clean {
    padding: 0;
}

.message-label-clean {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
    letter-spacing: -0.01em;
}

[data-theme="dark"] .message-label-clean {
    color: #e5e7eb;
}

.message-input-wrapper-clean {
    position: relative;
}

.message-textarea-clean {
    width: 100%;
    padding: 16px;
    border: 2px solid #9ca3af;
    border-radius: 12px;
    font-size: 15px;
    font-family: inherit;
    line-height: 1.6;
    resize: none;
    transition: all 0.2s ease;
    background: #fafafa;
    color: #1f2937;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);
}

.message-textarea-clean:focus {
    outline: none;
    border-color: var(--color-purple);
    background: white;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15), inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.message-textarea-clean::placeholder {
    color: #9ca3af;
}

[data-theme="dark"] .message-textarea-clean {
    background: #1f2937;
    border-color: #4b5563;
    color: #f3f4f6;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .message-textarea-clean:focus {
    background: #111827;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.2), 0 1px 3px rgba(0, 0, 0, 0.3);
}

.char-counter-clean {
    margin-top: 8px;
    text-align: right;
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

[data-theme="dark"] .char-counter-clean {
    color: #9ca3af;
}

.char-counter-clean .char-count {
    font-weight: 600;
    color: #374151;
}

[data-theme="dark"] .char-counter-clean .char-count {
    color: #e5e7eb;
}

.message-error-clean {
    margin-top: 16px;
    padding: 12px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #991b1b;
    font-size: 14px;
    font-weight: 500;
}

[data-theme="dark"] .message-error-clean {
    background: rgba(220, 38, 127, 0.15);
    border-color: rgba(220, 38, 127, 0.3);
    color: #ff6b9d;
}

.message-loading-clean {
    margin-top: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px;
    color: #6b7280;
    font-size: 14px;
}

.spinner-clean {
    width: 20px;
    height: 20px;
    border: 3px solid #e5e7eb;
    border-top-color: var(--color-purple);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.driver-message-footer-clean {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 20px 28px;
    background: transparent;
    border-top: none;
}

[data-theme="dark"] .driver-message-footer-clean {
    background: transparent;
    border-top: none;
}

.btn-cancel-clean,
.btn-send-clean {
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: -0.01em;
}

.btn-cancel-clean {
    background: white;
    color: #6b7280;
    border: 2px solid #e5e7eb;
}

.btn-cancel-clean:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    color: #374151;
}

[data-theme="dark"] .btn-cancel-clean {
    background: #374151;
    border-color: #4b5563;
    color: #d1d5db;
}

[data-theme="dark"] .btn-cancel-clean:hover {
    background: #4b5563;
    color: #f3f4f6;
}

.btn-send-clean {
    background: linear-gradient(135deg, var(--color-purple) 0%, var(--color-purple-dark) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.btn-send-clean:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.4);
}

.btn-send-clean:active {
    transform: translateY(0);
}

.btn-send-clean:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Notification animations */
@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

/* =====================================================
   HOURLY VOLUME BAR CHARTS
   ===================================================== */

.hourly-chart-section {
  margin-bottom: 32px;
}

.hourly-chart-section:last-child {
  margin-bottom: 0;
}

.hourly-chart-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-heading);
  margin-bottom: 16px;
  padding-left: 4px;
}

.hourly-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 200px;
  padding: 20px 10px 60px 10px;
  background: linear-gradient(145deg, rgba(26,26,46,0.6), rgba(30,30,51,0.6));
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.05);
  position: relative;
  overflow-x: auto;
  gap: 4px;
}

.hourly-bar-wrapper {
  flex: 1;
  min-width: 28px;
  max-width: 40px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end; /* Align children to bottom */
  align-items: center;
  position: relative;
  height: 100%;
}

.hourly-bar {
  width: 100%;
  background: linear-gradient(to top, #3b82f6, #60a5fa);
  border-radius: 4px 4px 0 0;
  transition: opacity 0.2s ease;
  min-height: 2px;
  max-height: 100%;
  position: relative;
  cursor: pointer;
  margin-top: auto; /* Push to bottom */
}

.hourly-bar:hover {
  opacity: 0.8;
}

.hourly-bar-previous {
  background: linear-gradient(to top, #6b7280, #9ca3af);
}

/* Live hourly chart bar colors */
.hourly-bar-today {
  background: linear-gradient(to top, #3b82f6, #60a5fa);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.3);
}

.hourly-bar-yesterday {
  background: linear-gradient(to top, #4b5563, #6b7280);
  opacity: 0.6;
}

.hourly-bar-lastyear {
  background: linear-gradient(to top, #f59e0b, #fbbf24);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.2);
}

.hourly-bar-label {
  position: absolute;
  bottom: -24px;
  font-size: 9px;
  color: var(--color-muted);
  white-space: nowrap;
  transform: rotate(-45deg);
  transform-origin: center;
}

.hourly-bar-value {
  position: absolute;
  bottom: 100%;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #4ade80;
  background: rgba(0, 0, 0, 0.75);
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
  white-space: nowrap;
  pointer-events: none;
  text-shadow: 0 0 8px rgba(74, 222, 128, 0.5);
}

.hourly-bar:hover .hourly-bar-value {
  opacity: 1;
}

/* Chart legend */
.hourly-legend {
  display: flex;
  gap: 24px;
  margin-top: 16px;
  padding-left: 4px;
}

.hourly-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--color-text-main);
}

.hourly-legend-color {
  width: 16px;
  height: 16px;
  border-radius: 3px;
}

.hourly-legend-color.current {
  background: linear-gradient(to bottom, #60a5fa, #3b82f6);
}

.hourly-legend-color.previous {
  background: linear-gradient(to bottom, #9ca3af, #6b7280);
}

.hourly-legend-color.hourly-today {
  background: linear-gradient(to bottom, #60a5fa, #3b82f6);
}

.hourly-legend-color.hourly-yesterday {
  background: linear-gradient(to bottom, #6b7280, #4b5563);
  opacity: 0.6;
}

.hourly-legend-color.hourly-lastyear {
  background: linear-gradient(to bottom, #fbbf24, #f59e0b);
}

/* Mobile adjustments */
/* Admin Menu Responsive */
@media (min-width: 769px) {
  .admin-button-mobile,
  .admin-popup-menu-mobile {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .admin-menu-button,
  .admin-popup-menu {
    display: none !important;
  }

  .hourly-chart {
    height: 160px;
    padding: 16px 6px 50px 6px;
    gap: 2px;
  }
  
  .hourly-bar-wrapper {
    min-width: 20px;
  }
  
  .hourly-bar-label {
    font-size: 8px;
    bottom: -20px;
  }
  
  .hourly-chart-title {
    font-size: 13px;
  }
}

