:root {
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #27354a;
    --bg-glass: rgba(30, 41, 59, 0.85);
    --border-color: #334155;
    --border-focus: #38bdf8;
    
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    
    --accent-primary: #38bdf8;
    --accent-btn: #2563eb;
    --accent-btn-hover: #1d4ed8;
    --accent-glow: rgba(37, 99, 235, 0.35);
    
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.15);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.15);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.15);
    --neutral-bg: rgba(148, 163, 184, 0.12);
    
    --gold: #eab308;
    --gold-glow: rgba(234, 179, 8, 0.3);
    
    --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========================================================================
   LIGHT THEME (SUN ☀️) & DARK THEME (MOON 🌙) SYSTEM
   ========================================================================= */

body[data-theme='light'] {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --bg-glass: rgba(255, 255, 255, 0.95);
    --border-color: #e2e8f0;
    --border-focus: #2563eb;
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --accent-primary: #0284c7;
    --accent-btn: #2563eb;
    --accent-btn-hover: #1d4ed8;
    --accent-glow: rgba(37, 99, 235, 0.2);
    --card-shadow: 0 4px 15px rgba(15, 23, 42, 0.06);
}

/* Base Light Mode Elements */
body[data-theme='light'] {
    background-color: #f8fafc !important;
    color: #0f172a !important;
}

body[data-theme='light'] .navbar {
    background: #ffffff !important;
    border-bottom: 1px solid #e2e8f0 !important;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04) !important;
}

body[data-theme='light'] .brand-title {
    color: #0f172a !important;
}

body[data-theme='light'] .brand-subtitle {
    color: #64748b !important;
}

/* Cards, Modals, Containers */
body[data-theme='light'] .card,
body[data-theme='light'] .kpi-card,
body[data-theme='light'] .subcard,
body[data-theme='light'] .stat-card,
body[data-theme='light'] .station-card,
body[data-theme='light'] .hist-stat-card,
body[data-theme='light'] .hist-filter-bar,
body[data-theme='light'] .trend-bars-container,
body[data-theme='light'] .info-card,
body[data-theme='light'] .modal-box {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
    color: #0f172a !important;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05) !important;
}

body[data-theme='light'] .station-card:hover,
body[data-theme='light'] .stat-card:hover,
body[data-theme='light'] .hist-stat-card:hover {
    border-color: #cbd5e1 !important;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08) !important;
}

body[data-theme='light'] .station-card.offline {
    background: #f8fafc !important;
    border-top: 3px solid #94a3b8 !important;
}

/* Inner Sub-boxes & Panels */
body[data-theme='light'] .current-app-box,
body[data-theme='light'] .date-selector-box,
body[data-theme='light'] .team-prod-banner,
body[data-theme='light'] .prod-strip,
body[data-theme='light'] .key-box,
body[data-theme='light'] .info-item,
body[data-theme='light'] .filter-select,
body[data-theme='light'] .form-control {
    background: #f8fafc !important;
    color: #0f172a !important;
    border-color: #e2e8f0 !important;
}

body[data-theme='light'] .key-box {
    color: #0284c7 !important;
    border-color: #cbd5e1 !important;
}

body[data-theme='light'] .current-app-name {
    color: #0284c7 !important;
}

body[data-theme='light'] .current-window-title {
    color: #475569 !important;
}

/* Typography & Headers */
body[data-theme='light'] .stat-val,
body[data-theme='light'] .hist-stat-val,
body[data-theme='light'] .station-name,
body[data-theme='light'] .modal-title,
body[data-theme='light'] .team-prod-val,
body[data-theme='light'] h2,
body[data-theme='light'] h3,
body[data-theme='light'] h4,
body[data-theme='light'] strong {
    color: #0f172a !important;
}

body[data-theme='light'] .stat-lbl,
body[data-theme='light'] .hist-stat-lbl,
body[data-theme='light'] .station-user,
body[data-theme='light'] .team-prod-label,
body[data-theme='light'] .station-meta-grid,
body[data-theme='light'] .hist-stat-card .stat-label,
body[data-theme='light'] .info-item p,
body[data-theme='light'] .info-item-desc,
body[data-theme='light'] .form-group label {
    color: #475569 !important;
}

body[data-theme='light'] .station-meta-val {
    color: #1e293b !important;
}

/* Tabs Bar */
body[data-theme='light'] .tabs-bar {
    background: #f1f5f9 !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

body[data-theme='light'] .tab-btn {
    color: #64748b !important;
}

body[data-theme='light'] .tab-btn:hover {
    color: #0f172a !important;
    background: #e2e8f0 !important;
    border-radius: 8px 8px 0 0 !important;
}

body[data-theme='light'] .tab-btn.active {
    background: #ffffff !important;
    color: #2563eb !important;
    border-bottom: 2px solid #2563eb !important;
    box-shadow: 0 -2px 6px rgba(15, 23, 42, 0.04) !important;
    border-radius: 8px 8px 0 0 !important;
}

/* =========================================================================
   ALL BUTTONS ADAPTATION (LIGHT & DARK MODES)
   ========================================================================= */

/* Default / Secondary Button */
body[data-theme='light'] .btn {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #1e293b !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

body[data-theme='light'] .btn:hover {
    background: #f1f5f9 !important;
    border-color: #94a3b8 !important;
    color: #0f172a !important;
}

/* Primary Button */
body[data-theme='light'] .btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
    border: 1px solid #1d4ed8 !important;
    color: #ffffff !important;
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.25) !important;
}

body[data-theme='light'] .btn-primary:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af) !important;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35) !important;
}

/* Warning Button (e.g. Agent Key, edit buttons) */
body[data-theme='light'] .btn-warning {
    background: #fef3c7 !important;
    border: 1px solid #fcd34d !important;
    color: #92400e !important;
    box-shadow: 0 1px 3px rgba(245, 158, 11, 0.12) !important;
    font-weight: 700 !important;
}

body[data-theme='light'] .btn-warning:hover {
    background: #fde68a !important;
    border-color: #f59e0b !important;
    color: #78350f !important;
}

/* Danger Button */
body[data-theme='light'] .btn-danger {
    background: #fee2e2 !important;
    border: 1px solid #fca5a5 !important;
    color: #b91c1c !important;
    font-weight: 700 !important;
}

body[data-theme='light'] .btn-danger:hover {
    background: #fecaca !important;
    color: #991b1b !important;
}

/* Success Button */
body[data-theme='light'] .btn-success {
    background: #dcfce7 !important;
    border: 1px solid #86efac !important;
    color: #15803d !important;
    font-weight: 700 !important;
}

body[data-theme='light'] .btn-success:hover {
    background: #bbf7d0 !important;
    color: #166534 !important;
}

/* Dropdown Buttons */
body[data-theme='light'] .nav-dropdown-btn {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

body[data-theme='light'] .nav-dropdown-btn:hover {
    border-color: #2563eb !important;
    background: #f8fafc !important;
}

body[data-theme='light'] .nav-dropdown-menu {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12) !important;
}

body[data-theme='light'] .nav-dropdown-item {
    color: #334155 !important;
}

body[data-theme='light'] .nav-dropdown-item:hover {
    background: #f1f5f9 !important;
    color: #0f172a !important;
}

body[data-theme='light'] .nav-dropdown-item.active {
    background: #e0f2fe !important;
    color: #0284c7 !important;
    font-weight: 700 !important;
}

/* Badges & Indicators */
body[data-theme='light'] .badge-online {
    background: #dcfce7 !important;
    color: #15803d !important;
    border: 1px solid #86efac !important;
}

body[data-theme='light'] .badge-idle {
    background: #fef3c7 !important;
    color: #92400e !important;
    border: 1px solid #fcd34d !important;
}

body[data-theme='light'] .badge-offline {
    background: #f1f5f9 !important;
    color: #475569 !important;
    border: 1px solid #cbd5e1 !important;
}

body[data-theme='light'] .company-badge {
    background: #e0f2fe !important;
    color: #0369a1 !important;
    border: 1px solid #7dd3fc !important;
}

body[data-theme='light'] .superadmin-badge {
    background: #fef3c7 !important;
    color: #92400e !important;
    border: 1px solid #fcd34d !important;
}

body[data-theme='light'] .live-indicator {
    background: #dcfce7 !important;
    color: #15803d !important;
    border: 1px solid #86efac !important;
}

/* Trophy Banner */
body[data-theme='light'] .trophy-banner {
    background: linear-gradient(135deg, #fffbeb, #fef3c7) !important;
    border: 1px solid #fde68a !important;
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.12) !important;
}

body[data-theme='light'] .trophy-name {
    color: #78350f !important;
}

body[data-theme='light'] .trophy-tag {
    color: #b45309 !important;
}

body[data-theme='light'] .trophy-score-box {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    color: #ffffff !important;
}

/* Tables */
body[data-theme='light'] .table-responsive {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04) !important;
}

body[data-theme='light'] .data-table {
    background: #ffffff !important;
}

body[data-theme='light'] .data-table th {
    background: #f8fafc !important;
    color: #475569 !important;
    font-weight: 700 !important;
    border-bottom: 2px solid #e2e8f0 !important;
}

body[data-theme='light'] .data-table td {
    color: #1e293b !important;
    border-bottom: 1px solid #f1f5f9 !important;
}

body[data-theme='light'] .data-table tr:hover td {
    background: #f8fafc !important;
    color: #0f172a !important;
}

/* Form Controls & Date Inputs */
body[data-theme='light'] .form-control {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
}

body[data-theme='light'] .form-control:focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15) !important;
}

body[data-theme='light'] .date-input {
    color: #0f172a !important;
    color-scheme: light !important;
}

body[data-theme='light'] .modal-close {
    color: #64748b !important;
}

body[data-theme='light'] .modal-close:hover {
    color: #0f172a !important;
}

/* Donut & Chart Elements */
body[data-theme='light'] .donut-center-lbl {
    fill: #64748b !important;
}

body[data-theme='light'] .donut-center-val {
    fill: #0284c7 !important;
}

body[data-theme='light'] .productivity-bar-wrap,
body[data-theme='light'] .bar-bg {
    background: #e2e8f0 !important;
}

/* Dropdowns (Theme & Language) */
.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropdown-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 7px 13px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
    user-select: none;
}

.nav-dropdown-btn:hover {
    border-color: var(--accent-primary);
    background: var(--bg-card-hover);
}

.nav-dropdown-menu {
    position: absolute;
    top: 100%;
    margin-top: 4px;
    right: 0;
    left: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.65);
    min-width: 190px;
    padding: 6px;
    z-index: 10000;
    display: none;
    flex-direction: column;
    gap: 2px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

/* Invisible bridge so mouse moving downwards never crosses a dead-zone gap */
.nav-dropdown-menu::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 12px;
    background: transparent;
    display: block;
}

.nav-dropdown-menu.show {
    display: flex !important;
    animation: dropFade 0.15s ease-out;
}

@keyframes dropFade {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.nav-dropdown-item {
    padding: 9px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition);
}

.lang-flag-img {
    width: 20px;
    height: 14px;
    border-radius: 2px;
    object-fit: cover;
    box-shadow: 0 1px 2px rgba(0,0,0,0.4);
    display: inline-block;
    vertical-align: middle;
}

.nav-dropdown-item:hover {
    background: var(--accent-btn);
    color: #ffffff !important;
}

.nav-dropdown-item.active {
    background: var(--accent-glow);
    color: var(--accent-primary);
    font-weight: 700;
}

.theme-swatch {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
    min-height: 100vh;
    padding-bottom: 50px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-main); }
::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #334155; }

/* Navbar */
.navbar {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 8px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
    min-height: 58px;
    box-sizing: border-box;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.brand-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
    display: block;
}

.brand-title {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.3px;
    color: #fff;
    white-space: nowrap;
}

.brand-title span {
    background: linear-gradient(135deg, #38bdf8, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: nowrap;
    margin-left: auto;
    justify-content: flex-end;
    flex-shrink: 0;
}

.company-badge {
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: #38bdf8;
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
}

.superadmin-badge {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #fbbf24;
}

/* User Profile Dropdown at Navbar right */
#userProfileDropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
}

#userProfileMenu .nav-dropdown-item {
    transition: all 0.15s ease;
}

#userProfileMenu .nav-dropdown-item.item-danger {
    color: #ef4444 !important;
}

#userProfileMenu .nav-dropdown-item.item-danger:hover {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #f87171 !important;
}

body[data-theme='light'] #userProfileMenu .nav-dropdown-item.item-danger {
    color: #dc2626 !important;
}

body[data-theme='light'] #userProfileMenu .nav-dropdown-item.item-danger:hover {
    background: #fee2e2 !important;
    color: #b91c1c !important;
}

/* Impersonation Banner */
.view-switch-banner {
    background: linear-gradient(90deg, #b45309, #d97706);
    color: #fff;
    padding: 10px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
}

.view-switch-banner button {
    background: #fff;
    color: #b45309;
    border: none;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.view-switch-banner button:hover {
    background: #fef3c7;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 7px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34d399;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--success);
    animation: pulse 1.5s infinite;
}

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

.date-selector-box {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #111827;
    border: 1px solid var(--border-color);
    padding: 5px 12px;
    border-radius: 8px;
}

.date-input {
    background: transparent;
    border: none;
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    color-scheme: dark;
}

/* Tabs Bar */
.tabs-bar {
    background: #0d121f;
    border-bottom: 1px solid var(--border-color);
    padding: 0 24px;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: #1e293b transparent;
}

.tabs-bar::-webkit-scrollbar {
    height: 4px;
}

.tabs-bar::-webkit-scrollbar-thumb {
    background: #1e293b;
    border-radius: 2px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    padding: 11px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 7px;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

/* Main Container */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px 24px;
    box-sizing: border-box;
}
    padding: 24px 28px;
}

/* Top Stats Cards Grid */
.stat-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
}

.stat-card:hover {
    border-color: #2e3c54;
    transform: translateY(-2px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-val {
    font-size: 26px;
    font-weight: 800;
    color: #fff;
    line-height: 1.1;
}

.stat-lbl {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 4px;
}

/* Stations Grid (Live) */
.stations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 18px;
}

.station-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.station-card:hover {
    border-color: #2e3c54;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.4);
}

.station-card.online {
    border-top: 3px solid var(--success);
}

.station-card.idle {
    border-top: 3px solid var(--warning);
}

.station-card.offline {
    border-top: 3px solid var(--text-muted);
    opacity: 0.85;
}

.station-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
}

.station-name {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.station-user {
    font-size: 12px;
    color: var(--accent-primary);
    font-weight: 600;
    margin-top: 2px;
}

.badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.badge-online {
    background: var(--success-bg);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-idle {
    background: var(--warning-bg);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-offline {
    background: var(--neutral-bg);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.current-app-box {
    background: #0d121f;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 14px;
}

.current-app-name {
    font-size: 13px;
    font-weight: 700;
    color: #38bdf8;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.current-window-title {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.station-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-size: 11px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
}

.station-meta-val {
    color: var(--text-secondary);
    font-weight: 600;
}

/* Best Performer Trophy Banner */
.trophy-banner {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(15, 23, 42, 0.8));
    border: 1px solid rgba(245, 158, 11, 0.4);
    border-radius: 14px;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    box-shadow: 0 4px 20px var(--gold-glow);
}

.trophy-left {
    display: flex;
    align-items: center;
    gap: 18px;
}

.trophy-icon {
    font-size: 44px;
    line-height: 1;
    filter: drop-shadow(0 2px 10px rgba(245, 158, 11, 0.5));
}

.trophy-tag {
    font-size: 11px;
    font-weight: 800;
    color: #fbbf24;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.trophy-name {
    font-size: 20px;
    font-weight: 800;
    color: #fff;
    margin-top: 2px;
}

.trophy-score-box {
    background: linear-gradient(135deg, #d97706, #b45309);
    color: #fff;
    padding: 10px 18px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.4);
}

.trophy-score-num {
    font-size: 26px;
    font-weight: 900;
    line-height: 1;
}

.trophy-score-lbl {
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

/* Progress bar for productivity */
.productivity-bar-wrap {
    height: 8px;
    background: #1e293b;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    margin: 12px 0;
}

.prod-seg-green { background: #10b981; }
.prod-seg-red { background: #ef4444; }
.prod-seg-gray { background: #64748b; }

/* Tables */
.table-responsive {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.data-table th {
    background: #0d121f;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-primary);
}

/* Buttons */
.btn {
    background: #1e293b;
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 8px 16px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.btn:hover {
    background: #283548;
    border-color: #3b4d66;
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border-color: #3b82f6;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    box-shadow: 0 0 15px var(--accent-glow);
}

.btn-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.4);
}

.btn-warning:hover {
    background: rgba(245, 158, 11, 0.35);
}

.btn-danger {
    background: var(--danger-bg);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

/* Key Display Code Box */
.key-box {
    background: #080d1a;
    border: 1px solid #1e293b;
    border-radius: 8px;
    padding: 12px 16px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 18px;
    font-weight: 700;
    color: #38bdf8;
    letter-spacing: 1px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 14px 0;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    width: 90%;
    max-width: 650px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

#modal-login .modal-box {
    overflow: visible !important;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    cursor: pointer;
}

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

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    background: #0d131f;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px;
    color: #fff;
    font-size: 14px;
    outline: none;
}

.form-control:focus {
    border-color: var(--accent-primary);
}

/* Category toggle button */
.cat-tag-btn {
    border: none;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.cat-tag-btn:hover {
    filter: brightness(1.2);
    transform: translateY(-1px);
}

/* Team Productivity Banner */
.team-prod-banner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
    background: #0d121f;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px;
}

.team-prod-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.team-prod-icon {
    font-size: 26px;
}

.team-prod-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.5px;
}

.team-prod-val {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-primary);
}

/* Donut Chart and Card Layout */
.card-content {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-top: 14px;
}

.card-donut-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 290px;
    min-width: 260px;
    flex: 0 0 290px;
    gap: 12px;
    margin: 0 auto;
}

.donut-box {
    display: flex;
    justify-content: center;
    align-items: center;
}

.donut path {
    transition: opacity 0.2s, transform 0.2s;
    cursor: pointer;
}

.donut path:hover {
    opacity: 0.85;
    filter: brightness(1.2);
}

.donut-center-lbl {
    fill: var(--text-muted);
    font-weight: 700;
}

.donut-center-val {
    fill: var(--accent-primary);
    font-weight: 800;
}

.table-box {
    flex: 1 1 500px;
    width: 100%;
    min-width: 0;
    overflow-x: auto;
}

.swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
}

.bar-bg {
    background: #1e293b;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 4px;
}

.bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}

.prod-strip {
    width: 100%;
    background: #090d16;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
}

.prod-breakdown-tags {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    font-size: 10.5px;
    font-weight: 700;
    margin-bottom: 7px;
    flex-wrap: wrap;
}

.prod-tag {
    flex: 1 1 auto;
    text-align: center;
    padding: 3px 5px;
    border-radius: 4px;
    white-space: nowrap;
}

.alias-edit-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    padding: 2px 4px;
    border-radius: 4px;
    transition: var(--transition);
}

.alias-edit-btn:hover {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
}

/* -------------------------------------------------------------------------
   DESKTOP PARITY: HISTORICAL STATS GRID & KPI CARDS
------------------------------------------------------------------------- */
.hist-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.hist-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: var(--transition);
    min-width: 0;
}

.hist-stat-card:hover {
    border-color: var(--border-focus);
    transform: translateY(-2px);
}

.hist-stat-icon, .hist-stat-card .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.hist-stat-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.hist-stat-val, .hist-stat-card .stat-val {
    font-size: 20px;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hist-stat-lbl, .hist-stat-card .stat-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 3px;
    line-height: 1.3;
}

/* Filters Bar */
.hist-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 16px;
    margin-bottom: 20px;
}

.filter-select {
    background: var(--bg-main);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    transition: var(--transition);
}

.filter-select:focus {
    border-color: var(--accent-primary);
}

/* Trend Bars Container */
.trend-bars-container {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 150px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px 14px 10px;
    margin-bottom: 24px;
    overflow-x: auto;
}

.trend-bar-col {
    flex: 1;
    min-width: 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}

.trend-bar-fill {
    width: 100%;
    max-width: 32px;
    border-radius: 4px 4px 0 0;
    background: linear-gradient(180deg, var(--accent-primary), var(--accent-btn));
    transition: height 0.3s ease;
    cursor: pointer;
    position: relative;
}

.trend-bar-fill:hover {
    filter: brightness(1.25);
    box-shadow: 0 0 10px var(--accent-glow);
}

.trend-bar-date {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 6px;
    font-weight: 600;
    white-space: nowrap;
}

.tab-badge {
    background: rgba(56, 189, 248, 0.2);
    color: var(--accent-primary);
    padding: 1px 7px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 700;
    margin-left: 6px;
}

/* Guide Info Card */
.info-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: var(--card-shadow);
}

.info-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-card-header {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}

.info-item {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: var(--transition);
}

.info-item:hover {
    border-color: var(--border-focus);
    transform: translateY(-2px);
}

.info-item-title {
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.3;
}

.info-item-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.info-icon {
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
}

.info-item strong {
    display: block;
    color: var(--text-primary);
    font-size: 12.5px;
    margin-bottom: 3px;
}

.info-item p {
    margin: 0;
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.45;
}

/* =========================================================================
   LOGIN CYBER WORLD MAP & INTERACTIVE CANVAS BACKGROUND
   ========================================================================= */
.login-cyber-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #040814 !important;
    overflow: hidden !important;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.cyber-map-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('/static/img/cyber_world_map.jpg?v=1.0');
    background-position: center center;
    background-size: cover;
    background-repeat: no-repeat;
    opacity: 0.72;
    filter: saturate(1.2) brightness(0.92);
    z-index: 1;
    pointer-events: none;
    transform: scale(1.02);
    transition: transform 0.5s ease-out;
}

.cyber-network-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.cyber-vignette-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(4, 8, 20, 0.25) 0%, rgba(4, 8, 20, 0.72) 70%, rgba(4, 8, 20, 0.94) 100%);
    z-index: 3;
    pointer-events: none;
}

.login-modal-box {
    position: relative;
    z-index: 10;
    max-width: 440px;
    width: 90%;
    text-align: center;
    background: rgba(15, 23, 42, 0.85) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(56, 189, 248, 0.45) !important;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85), 0 0 35px rgba(56, 189, 248, 0.28) !important;
    border-radius: 18px;
    padding: 26px 28px;
    animation: loginModalEntrance 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes loginModalEntrance {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Light mode adaptation for login card floating over the map */
body[data-theme='light'] .login-modal-box {
    background: rgba(255, 255, 255, 0.94) !important;
    border: 1px solid rgba(37, 99, 235, 0.35) !important;
    box-shadow: 0 25px 60px rgba(15, 23, 42, 0.25), 0 0 35px rgba(37, 99, 235, 0.15) !important;
    color: #0f172a !important;
}

body[data-theme='light'] .cyber-map-layer {
    opacity: 0.65;
    filter: saturate(1.1) brightness(0.95);
}

body[data-theme='light'] .cyber-vignette-overlay {
    background: radial-gradient(circle at center, rgba(248, 250, 252, 0.15) 0%, rgba(15, 23, 42, 0.6) 100%);
}

/* ============================================================ */
/* Responsive Layout Fixes for 100% Zoom and Desktop Monitors   */
/* ============================================================ */
@media (max-width: 1440px) {
    .navbar {
        padding: 8px 16px;
        gap: 8px;
    }
    .brand-subtitle {
        display: none; /* Hide subtitle to keep header on 1 line at 100% zoom */
    }
    .brand-title {
        font-size: 15px;
    }
    .tabs-bar {
        padding: 0 16px;
        gap: 4px;
    }
    .tab-btn {
        padding: 10px 12px;
        font-size: 12px;
    }
    .container {
        padding: 16px 18px;
    }
}

@media (max-width: 1200px) {
    .navbar {
        flex-wrap: wrap;
        min-height: auto;
        padding: 10px 16px;
    }
    .nav-actions {
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 6px;
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 8px 12px;
    }
    .brand-title {
        font-size: 14px;
    }
    .brand-title span {
        display: none;
    }
    .container {
        padding: 12px;
    }
}
