:root{--bg-primary:#0c0f1a;--bg-secondary:#141829;--bg-card:rgba(255,255,255,0.03);--border:rgba(255,255,255,0.06);--border-hover:rgba(255,255,255,0.12);--text-primary:#e2e8f0;--text-secondary:#94a3b8;--text-muted:#64748b;--text-dim:#475569;--accent:#f59e0b;--accent-glow:rgba(245,158,11,0.15);--fp:#a855f7;--great:#22c55e;--fair:#f59e0b;--poor:#dc2626;--fant:#3b82f6;--shell-max:1800px;}
[data-theme="light"]{--bg-primary:#f1f5f9;--bg-secondary:#ffffff;--bg-card:rgba(0,0,0,0.02);--border:rgba(0,0,0,0.08);--border-hover:rgba(0,0,0,0.15);--text-primary:#1e293b;--text-secondary:#475569;--text-muted:#64748b;--text-dim:#94a3b8;--accent:#d97706;--accent-glow:rgba(217,119,6,0.1);}
[data-theme="light"] body{background:var(--bg-primary)!important;}
[data-theme="light"] .topbar{background:rgba(255,255,255,0.9);backdrop-filter:blur(24px);}
[data-theme="light"] .login-overlay{background:var(--bg-primary);}
[data-theme="light"] th{background:rgba(241,245,249,0.95);}
[data-theme="light"] tr:hover td{background:rgba(245,158,11,0.04);}
[data-theme="light"] tr.ev td{background:rgba(0,0,0,0.015);}
[data-theme="light"] .fselect option{background:#fff;}
[data-theme="light"] .dsp-card{background:linear-gradient(135deg,rgba(217,119,6,0.08),rgba(249,115,22,0.04));border-color:rgba(217,119,6,0.2);}
.theme-toggle{background:none;border:1px solid var(--border-hover);border-radius:8px;padding:5px 10px;cursor:pointer;font-size:14px;color:var(--text-primary);transition:all 0.2s;line-height:1;}
.theme-toggle:hover{border-color:var(--accent);background:var(--accent-glow);}
.login-overlay{position:fixed;inset:0;background:var(--bg-primary);z-index:9999;display:flex;align-items:center;justify-content:center;}
.login-box{background:var(--bg-secondary);border:1px solid var(--border-hover);border-radius:20px;padding:40px;width:380px;max-width:90vw;text-align:center;}
.login-box .logo{width:60px;height:60px;border-radius:16px;background:linear-gradient(135deg,var(--accent),#f97316);display:flex;align-items:center;justify-content:center;font-weight:800;font-size:24px;color:#fff;margin:0 auto 16px;}
.login-box h2{font-size:20px;font-weight:800;margin-bottom:4px;}
.login-box p{font-size:13px;color:var(--text-muted);margin-bottom:24px;}
.login-box input{width:100%;background:rgba(255,255,255,0.06);border:1px solid var(--border-hover);border-radius:10px;padding:12px 16px;color:var(--text-primary);font-family:inherit;font-size:14px;outline:none;margin-bottom:12px;text-align:center;letter-spacing:1px;}
.login-box input:focus{border-color:var(--accent);background:rgba(245,158,11,0.06);}
.login-box .login-btn{width:100%;background:linear-gradient(135deg,var(--accent),#f97316);border:none;border-radius:10px;padding:12px;color:#fff;font-family:inherit;font-size:15px;font-weight:700;cursor:pointer;transition:all 0.2s;}
.login-box .login-btn:hover{transform:translateY(-1px);box-shadow:0 4px 20px rgba(245,158,11,0.3);}
.login-error{color:#f87171;font-size:12px;margin-bottom:12px;display:none;}
.logout-btn{background:rgba(239,68,68,0.15);color:#f87171;border:1px solid rgba(239,68,68,0.3);padding:5px 12px;border-radius:6px;font-size:11px;font-weight:700;cursor:pointer;font-family:inherit;}
.role-badge{font-size:10px;padding:3px 8px;border-radius:4px;font-weight:700;text-transform:uppercase;letter-spacing:0.05em;}
.role-admin{background:rgba(245,158,11,0.15);color:var(--accent);}
.role-viewer{background:rgba(59,130,246,0.15);color:#60a5fa;}
*{margin:0;padding:0;box-sizing:border-box;}
body{font-family:'DM Sans',-apple-system,sans-serif;background:linear-gradient(135deg,var(--bg-primary),var(--bg-secondary),var(--bg-primary));color:var(--text-primary);min-height:100vh;}
.topbar{background:rgba(15,23,42,0.85);backdrop-filter:blur(24px);border-bottom:1px solid var(--border);padding:14px 28px;display:flex;align-items:center;justify-content:space-between;position:sticky;top:0;z-index:100;}
.topbar-left{display:flex;align-items:center;gap:14px;}.topbar-logo{width:38px;height:38px;border-radius:10px;background:linear-gradient(135deg,var(--accent),#f97316);display:flex;align-items:center;justify-content:center;font-weight:800;font-size:17px;color:#fff;}
.topbar-title{font-weight:700;font-size:16px;}.topbar-sub{font-size:11px;color:var(--text-muted);letter-spacing:0.05em;text-transform:uppercase;}
.topbar-right{display:flex;align-items:center;gap:8px;}.badge{font-size:12px;padding:6px 14px;border-radius:8px;font-weight:600;}.badge-accent{color:var(--accent);background:var(--accent-glow);}.badge-muted{color:var(--text-secondary);background:rgba(255,255,255,0.05);}
.main{max-width:1500px;margin:0 auto;padding:24px 28px;}
.depot-switcher{position:relative;display:inline-flex;align-items:center;}
.depot-btn{background:rgba(255,255,255,0.06);border:1px solid var(--border-hover);border-radius:8px;padding:6px 14px;color:var(--text-primary);font-family:inherit;font-size:13px;font-weight:600;cursor:pointer;display:flex;align-items:center;gap:8px;transition:all 0.2s;}
.depot-btn:hover{border-color:var(--accent);background:var(--accent-glow);}
.depot-btn .arrow{font-size:10px;opacity:0.5;transition:transform 0.2s;}.depot-btn.open .arrow{transform:rotate(180deg);}
.depot-dropdown{position:absolute;top:calc(100% + 6px);left:0;background:var(--bg-secondary);border:1px solid var(--border-hover);border-radius:10px;min-width:260px;box-shadow:0 12px 40px rgba(0,0,0,0.5);z-index:200;display:none;overflow:hidden;}.depot-dropdown.show{display:block;}
.depot-dropdown-item{padding:10px 16px;cursor:pointer;font-size:13px;display:flex;align-items:center;justify-content:space-between;transition:background 0.15s;border-bottom:1px solid var(--border);}
.depot-dropdown-item:hover{background:rgba(255,255,255,0.05);}.depot-dropdown-item:last-child{border:none;}.depot-dropdown-item.active{background:var(--accent-glow);color:var(--accent);}.depot-dropdown-item .check{color:var(--accent);font-weight:700;}
.depot-dropdown-footer{padding:8px 16px;border-top:1px solid var(--border);background:rgba(255,255,255,0.02);}
.depot-dropdown-footer button{width:100%;background:none;border:1px dashed var(--border-hover);border-radius:6px;padding:8px;color:var(--text-muted);font-family:inherit;font-size:12px;cursor:pointer;transition:all 0.2s;}
.depot-dropdown-footer button:hover{border-color:var(--accent);color:var(--accent);}
.upload-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-bottom:18px;}@media(max-width:768px){.upload-grid{grid-template-columns:1fr;}}
.upload-zone{background:var(--bg-card);border:2px dashed var(--border-hover);border-radius:14px;padding:28px;text-align:center;cursor:pointer;transition:all 0.25s;}
.upload-zone:hover{border-color:var(--accent);background:var(--accent-glow);}.upload-zone.dragover{border-color:var(--accent);}.upload-zone.uploaded{border-color:var(--fp);border-style:solid;background:rgba(16,185,129,0.06);}
.upload-zone .icon{font-size:2.5rem;margin-bottom:10px;}.upload-zone h3{font-size:15px;font-weight:700;margin-bottom:4px;}.upload-zone p{font-size:12px;color:var(--text-muted);margin-bottom:14px;}
.file-tag{display:none;background:rgba(34,197,94,0.15);color:#4ade80;padding:5px 12px;border-radius:6px;font-size:12px;font-weight:600;margin-top:10px;}.upload-zone.uploaded .file-tag{display:inline-block;}
.opt-tag{background:rgba(245,158,11,0.15);color:var(--accent);font-size:10px;padding:2px 8px;border-radius:4px;font-weight:700;vertical-align:middle;margin-left:6px;}
.btn{border:none;border-radius:10px;padding:10px 22px;font-family:inherit;font-size:14px;font-weight:700;cursor:pointer;transition:all 0.2s;display:inline-flex;align-items:center;gap:8px;}
.btn:hover{transform:translateY(-1px);}.btn:disabled{opacity:0.4;cursor:not-allowed;transform:none;}
.btn-primary{background:linear-gradient(135deg,var(--accent),#f97316);color:#fff;}.btn-secondary{background:rgba(255,255,255,0.06);color:var(--text-primary);border:1px solid var(--border-hover);}
.btn-danger{background:rgba(239,68,68,0.15);color:#f87171;border:1px solid rgba(239,68,68,0.3);}
.btn-sm{padding:6px 12px;font-size:12px;border-radius:6px;}.btn-process{display:block;width:100%;max-width:420px;margin:0 auto 24px;padding:14px 28px;font-size:16px;}
.loading{display:none;text-align:center;padding:48px 0;}.loading.active{display:block;}
.spinner{width:44px;height:44px;border:3px solid var(--border);border-top-color:var(--accent);border-radius:50%;animation:spin 0.8s linear infinite;margin:0 auto 14px;}@keyframes spin{to{transform:rotate(360deg);}}
.error-box{background:rgba(239,68,68,0.1);border:1px solid rgba(239,68,68,0.3);color:#fca5a5;border-radius:10px;padding:14px 18px;margin-bottom:16px;font-size:14px;display:none;}.error-box.active{display:block;}
.tabs{display:flex;gap:4px;margin-bottom:20px;background:rgba(255,255,255,0.02);border-radius:12px;padding:4px;border:1px solid var(--border);flex-wrap:wrap;}
.tab{padding:10px 16px;border-radius:8px;font-size:13px;font-weight:700;cursor:pointer;color:var(--text-muted);transition:all 0.2s;text-align:center;min-width:80px;}
.tab:hover{color:var(--text-primary);}.tab.active{background:var(--accent-glow);color:var(--accent);border:1px solid rgba(245,158,11,0.3);}
.tab-panel{display:none;}.tab-panel.active{display:block;}
.stats-row{display:grid;grid-template-columns:repeat(6,1fr);gap:10px;margin-bottom:20px;}@media(max-width:900px){.stats-row{grid-template-columns:repeat(3,1fr);}}
.stat-card{background:var(--bg-card);border:1px solid var(--border);border-radius:12px;padding:16px;text-align:center;}
.stat-num{font-size:2rem;font-weight:800;line-height:1;}.stat-label{font-size:11px;color:var(--text-muted);text-transform:uppercase;letter-spacing:0.08em;margin-top:4px;}
.dsp-section{display:grid;grid-template-columns:280px 1fr;gap:16px;margin-bottom:20px;}@media(max-width:900px){.dsp-section{grid-template-columns:1fr;}}
.dsp-card{background:linear-gradient(135deg,rgba(245,158,11,0.1),rgba(249,115,22,0.06));border:1px solid rgba(245,158,11,0.25);border-radius:16px;padding:28px;text-align:center;}
.dsp-big{font-size:3.5rem;font-weight:800;font-family:'JetBrains Mono',monospace;line-height:1;}
.dsp-rank{font-size:13px;color:var(--text-secondary);margin-top:6px;}
.mbars{background:var(--bg-card);border:1px solid var(--border);border-radius:14px;padding:20px;}
.mbar-row{display:flex;align-items:center;gap:10px;margin-bottom:8px;}.mbar-lbl{font-size:12px;font-weight:700;width:40px;color:var(--text-secondary);}
.mbar-track{flex:1;height:8px;background:rgba(255,255,255,0.05);border-radius:4px;overflow:hidden;}.mbar-fill{height:100%;border-radius:4px;transition:width 0.6s ease;}
.mbar-val{font-size:11px;font-weight:600;width:65px;text-align:right;font-family:'JetBrains Mono',monospace;}
.alerts-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-bottom:20px;}@media(max-width:768px){.alerts-grid{grid-template-columns:1fr;}}
.acard{border-radius:14px;padding:18px;}.acard h4{font-size:13px;font-weight:700;margin-bottom:12px;}
.a-danger{background:rgba(239,68,68,0.08);border:1px solid rgba(239,68,68,0.2);}.a-danger h4{color:#f87171;}
.a-warn{background:rgba(245,158,11,0.08);border:1px solid rgba(245,158,11,0.2);}.a-warn h4{color:#fbbf24;}
.a-ok{background:rgba(34,197,94,0.08);border:1px solid rgba(34,197,94,0.2);}.a-ok h4{color:#4ade80;}
.a-info{background:rgba(59,130,246,0.08);border:1px solid rgba(59,130,246,0.2);}.a-info h4{color:#60a5fa;}
.a-item{font-size:13px;padding:6px 0;border-bottom:1px solid rgba(255,255,255,0.03);display:flex;justify-content:space-between;align-items:center;}.a-item:last-child{border:none;}.a-item .n{font-weight:600;}.a-item .v{font-family:'JetBrains Mono',monospace;font-size:12px;font-weight:700;}
.controls{display:flex;align-items:center;gap:10px;margin-bottom:14px;flex-wrap:wrap;}
.sinput{background:rgba(255,255,255,0.05);border:1px solid var(--border-hover);border-radius:8px;padding:8px 14px;color:var(--text-primary);font-family:inherit;font-size:13px;width:200px;outline:none;}.sinput:focus{border-color:var(--accent);}
.fselect{background:rgba(255,255,255,0.05);border:1px solid var(--border-hover);border-radius:8px;padding:8px 12px;color:var(--text-primary);font-family:inherit;font-size:13px;outline:none;}.fselect option{background:#1e293b;}
.cright{margin-left:auto;display:flex;gap:6px;}
.twrap{background:var(--bg-card);border:1px solid var(--border);border-radius:14px;overflow:hidden;}.tscroll{overflow-x:auto;max-height:600px;overflow-y:auto;}
table{width:100%;border-collapse:collapse;font-size:13px;}
th{padding:10px;text-align:left;font-size:11px;font-weight:700;color:var(--text-muted);text-transform:uppercase;letter-spacing:0.06em;background:rgba(15,23,42,0.95);border-bottom:1px solid var(--border);cursor:pointer;user-select:none;white-space:nowrap;position:sticky;top:0;z-index:2;}
th:hover{color:var(--accent);}th .sa{font-size:10px;margin-left:3px;opacity:0.4;}th.sorted .sa{opacity:1;color:var(--accent);}
td{padding:8px 10px;border-bottom:1px solid rgba(255,255,255,0.02);vertical-align:middle;}tr:hover td{background:rgba(245,158,11,0.03);}tr.ev td{background:rgba(255,255,255,0.008);}
.mv{font-weight:600;display:block;}.mp{font-size:10px;color:var(--fp);font-family:'JetBrains Mono',monospace;}.mn{color:var(--text-dim);font-style:italic;}
.tier{padding:3px 10px;border-radius:6px;font-size:11px;font-weight:700;white-space:nowrap;}
.tier-fp{background:rgba(168,85,247,0.15);color:#c084fc;}.tier-f{background:rgba(59,130,246,0.15);color:#60a5fa;}.tier-g{background:rgba(34,197,94,0.15);color:#4ade80;}.tier-fa{background:rgba(245,158,11,0.15);color:#fbbf24;}.tier-p{background:rgba(220,38,38,0.15);color:#f87171;}
.sb{font-size:18px;font-weight:800;font-family:'JetBrains Mono',monospace;}.s-fp{color:var(--fp);}.s-f{color:var(--fant);}.s-g{color:var(--great);}.s-fa{color:var(--fair);}.s-p{color:var(--poor);}
.dn{font-weight:600;white-space:nowrap;}.di{font-size:10px;color:var(--text-dim);font-family:'JetBrains Mono',monospace;}
.bf{color:#c084fc;}.bg{color:#4ade80;}.bfa{color:#fbbf24;}.bp{color:#f87171;}
.wu{color:var(--fp);font-size:11px;font-weight:700;}.wd{color:var(--poor);font-size:11px;font-weight:700;}.ws{color:var(--text-dim);font-size:11px;}
.mbg{display:none;position:fixed;inset:0;background:rgba(0,0,0,0.75);z-index:200;justify-content:center;align-items:center;backdrop-filter:blur(4px);}.mbg.active{display:flex;}
.mdl{background:var(--bg-secondary);border:1px solid var(--border-hover);border-radius:16px;padding:28px;max-width:720px;width:92%;max-height:88vh;overflow-y:auto;position:relative;}
.mc{position:absolute;top:14px;right:14px;background:rgba(239,68,68,0.2);color:#f87171;border:none;width:30px;height:30px;border-radius:8px;cursor:pointer;font-size:16px;display:flex;align-items:center;justify-content:center;}
.mdl h3{font-size:16px;margin-bottom:16px;color:var(--accent);}
.dt{width:100%;border-collapse:collapse;font-size:13px;}.dt th{background:rgba(255,255,255,0.04);padding:8px 10px;}.dt td{padding:8px 10px;border-bottom:1px solid var(--border);}
.dsum{background:linear-gradient(135deg,var(--accent-glow),rgba(249,115,22,0.1));border:1px solid rgba(245,158,11,0.3);border-radius:10px;padding:18px;text-align:center;margin-top:16px;}.dsum .big{font-size:2.4rem;font-weight:800;color:var(--accent);}
.pnote{background:rgba(239,68,68,0.1);border:1px solid rgba(239,68,68,0.25);color:#fca5a5;padding:10px 14px;border-radius:8px;margin-top:12px;font-size:13px;}
.nnote{background:rgba(59,130,246,0.08);border:1px solid rgba(59,130,246,0.2);color:#93c5fd;padding:10px 14px;border-radius:8px;margin-top:12px;font-size:13px;}
.settings-panel{background:var(--bg-card);border:1px solid var(--border);border-radius:14px;padding:20px;margin-bottom:20px;}
.settings-panel h3{font-size:15px;font-weight:700;color:var(--accent);margin-bottom:16px;}
.s-group{margin-bottom:18px;}.s-group-title{font-size:12px;font-weight:700;color:var(--text-secondary);text-transform:uppercase;letter-spacing:0.08em;margin-bottom:10px;padding-bottom:6px;border-bottom:1px solid var(--border);}
.s-row{display:flex;align-items:center;gap:12px;margin-bottom:8px;flex-wrap:wrap;}
.s-label{font-size:13px;font-weight:600;width:130px;color:var(--text-primary);}
.s-slider-wrap{flex:1;min-width:150px;display:flex;align-items:center;gap:10px;}
.s-slider{-webkit-appearance:none;width:100%;height:6px;border-radius:3px;background:rgba(255,255,255,0.1);outline:none;}
.s-slider::-webkit-slider-thumb{-webkit-appearance:none;width:18px;height:18px;border-radius:50%;background:var(--accent);cursor:pointer;border:2px solid rgba(255,255,255,0.3);}
.s-slider::-moz-range-thumb{width:18px;height:18px;border-radius:50%;background:var(--accent);cursor:pointer;border:2px solid rgba(255,255,255,0.3);}
.s-val{font-family:'JetBrains Mono',monospace;font-size:13px;font-weight:700;color:var(--accent);min-width:45px;text-align:right;}
.s-preview{display:grid;grid-template-columns:repeat(5,1fr);gap:8px;margin-top:14px;padding:14px;background:rgba(255,255,255,0.02);border-radius:10px;border:1px solid var(--border);}
.s-prev-card{text-align:center;padding:10px;border-radius:8px;}.s-prev-cnt{font-size:1.6rem;font-weight:800;}.s-prev-lbl{font-size:10px;color:var(--text-muted);text-transform:uppercase;margin-top:2px;}
.s-reset{background:rgba(239,68,68,0.15);color:#f87171;border:1px solid rgba(239,68,68,0.3);padding:6px 14px;border-radius:6px;font-size:12px;font-weight:700;cursor:pointer;}.s-reset:hover{background:rgba(239,68,68,0.25);}
.depot-manager{background:var(--bg-card);border:1px solid var(--border);border-radius:14px;padding:20px;margin-bottom:20px;}
.depot-card{background:rgba(255,255,255,0.02);border:1px solid var(--border);border-radius:10px;padding:14px 18px;margin-bottom:10px;display:flex;align-items:center;justify-content:space-between;transition:all 0.2s;flex-wrap:wrap;gap:8px;}
.depot-card:hover{border-color:var(--border-hover);}.depot-card.active-depot{border-color:rgba(245,158,11,0.4);background:var(--accent-glow);}
.depot-card-info{display:flex;align-items:center;gap:12px;}
.depot-code{font-family:'JetBrains Mono',monospace;font-weight:700;font-size:14px;color:var(--accent);background:rgba(245,158,11,0.12);padding:4px 10px;border-radius:6px;}
.depot-name{font-size:14px;font-weight:600;}.depot-actions{display:flex;gap:6px;}
.depot-form{background:rgba(255,255,255,0.02);border:1px solid var(--border);border-radius:10px;padding:16px;margin-bottom:10px;}
.depot-form-row{display:flex;gap:10px;align-items:center;flex-wrap:wrap;}
.depot-form-row input{background:rgba(255,255,255,0.05);border:1px solid var(--border-hover);border-radius:6px;padding:8px 12px;color:var(--text-primary);font-family:inherit;font-size:13px;outline:none;}
.depot-form-row input:focus{border-color:var(--accent);}
.target-table{width:100%;border-collapse:collapse;font-size:13px;}
.target-table th{padding:10px;font-size:11px;font-weight:700;color:var(--text-muted);text-transform:uppercase;background:rgba(15,23,42,0.6);border-bottom:1px solid var(--border);cursor:default;}
.target-table td{padding:8px 10px;border-bottom:1px solid rgba(255,255,255,0.03);}
.target-table input{width:80px;background:rgba(255,255,255,0.06);border:1px solid var(--border);border-radius:6px;padding:6px 8px;color:var(--text-primary);font-family:'JetBrains Mono',monospace;font-size:12px;text-align:center;outline:none;}
.target-table input:focus{border-color:var(--accent);background:rgba(245,158,11,0.08);}
.history-list{display:flex;flex-direction:column;gap:8px;}
.history-item{background:rgba(255,255,255,0.02);border:1px solid var(--border);border-radius:10px;padding:14px 18px;display:flex;align-items:center;justify-content:space-between;cursor:pointer;transition:all 0.2s;flex-wrap:wrap;gap:8px;}
.history-item:hover{border-color:var(--accent);background:var(--accent-glow);}
.history-info{display:flex;flex-direction:column;gap:2px;}.history-date{font-size:12px;color:var(--text-muted);}.history-label{font-size:14px;font-weight:600;}
.history-meta{display:flex;gap:12px;align-items:center;}.history-score{font-family:'JetBrains Mono',monospace;font-size:18px;font-weight:800;}.history-drivers{font-size:11px;color:var(--text-muted);}
.toast{position:fixed;bottom:24px;right:24px;background:var(--bg-secondary);border:1px solid var(--great);color:#4ade80;padding:12px 20px;border-radius:10px;font-size:13px;font-weight:600;z-index:300;transform:translateY(80px);opacity:0;transition:all 0.3s;pointer-events:none;}.toast.show{transform:translateY(0);opacity:1;}
.data-tab-hidden{display:none !important;}
#recentCards::-webkit-scrollbar{height:4px;}#recentCards::-webkit-scrollbar-track{background:transparent;}#recentCards::-webkit-scrollbar-thumb{background:var(--border-hover);border-radius:2px;}
@media(max-width:600px){.topbar{padding:10px 14px;flex-wrap:wrap;gap:8px;}.main{padding:14px;}.stats-row{grid-template-columns:repeat(2,1fr);}.dsp-section{grid-template-columns:1fr;}}

/* ============ MOBILE RESPONSIVE ============ */
@media(max-width:768px){
    .topbar{padding:10px 14px;flex-wrap:wrap;gap:8px;}
    .topbar-left{gap:8px;}.topbar-title{font-size:14px;}.topbar-sub{font-size:9px;}
    .topbar-right{gap:4px;flex-wrap:wrap;justify-content:flex-end;}
    .topbar-right .badge{padding:4px 8px;font-size:10px;}
    .topbar-right a{font-size:10px;}
    .main{padding:12px 10px;}
    .upload-grid{grid-template-columns:1fr;gap:10px;}
    .upload-zone{padding:18px 14px;}
    .upload-zone .icon{font-size:1.8rem;margin-bottom:6px;}
    .upload-zone h3{font-size:13px;}.upload-zone p{font-size:11px;margin-bottom:10px;}
    .btn-process{font-size:14px;padding:12px 20px;}
    .stats-row{grid-template-columns:repeat(3,1fr);gap:6px;}
    .stat-card{padding:10px 6px;}.stat-num{font-size:1.4rem;}.stat-label{font-size:9px;}
    /* DSP Score Section */
    #panel-overview > div:nth-child(2){grid-template-columns:1fr!important;gap:10px!important;}
    .dsp-card{padding:18px 14px;}.dsp-big{font-size:2.4rem;}
    .mbars{padding:14px;}
    /* Health Dashboard */
    #healthGrid{grid-template-columns:repeat(2,1fr)!important;gap:6px!important;}
    #healthMetrics{grid-template-columns:1fr!important;}
    /* Alerts */
    .alerts-grid{grid-template-columns:1fr;}
    /* Driver Table - Card Mode */
    .tscroll{max-height:none;overflow-x:auto;}
    table{font-size:11px;}
    th,td{padding:6px 5px;}
    .dn{font-size:12px;max-width:100px;overflow:hidden;text-overflow:ellipsis;}
    .di{display:none;}
    .sb{font-size:14px;}.mp{display:none;}
    .btn-sm{padding:3px 6px;font-size:9px;}
    .tier{font-size:9px;padding:2px 6px;}
    /* WoW */
    #wowContent > div:first-child{grid-template-columns:1fr!important;gap:8px!important;}
    /* Tabs */
    .tabs{gap:2px;padding:3px;}.tab{padding:7px 8px;font-size:11px;min-width:50px;}
    /* Settings */
    .settings-panel{padding:14px;}
    .s-grid{grid-template-columns:1fr!important;}
    /* Modals */
    .mdl{width:96%;padding:18px;max-height:92vh;}
    /* Controls */
    .controls{gap:6px;}.sinput{width:100%;}.cright{margin-left:0;width:100%;justify-content:flex-end;}
    /* Recent Strip */
    #recentCards{gap:6px;}
    #recentCards > div{min-width:100px!important;padding:10px!important;}
    /* History */
    .history-item{padding:10px!important;gap:8px!important;}
    .depot-dropdown{min-width:200px;}
}

@media(max-width:480px){
    .stats-row{grid-template-columns:repeat(2,1fr);}
    #healthGrid{grid-template-columns:1fr!important;}
    .topbar-logo{width:30px;height:30px;font-size:14px;border-radius:8px;}
    .tabs{flex-wrap:wrap;}
    .tab{flex:1 1 auto;}
}

/* ================================================================
   GSSL SCORECARD V6 — Login Redesign (Split-screen with animations)
   ================================================================ */
.login-overlay {
    position: fixed;
    inset: 0;
    background: #0a0e1a;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.login-split {
    width: 100%;
    height: 100%;
    max-width: 1100px;
    max-height: 720px;
    display: grid;
    grid-template-columns: 1.25fr 1fr;
    background: #0a0e1a;
    overflow: hidden;
    box-shadow: 0 25px 70px rgba(0,0,0,0.6);
}
@media (min-width: 1000px) {
    .login-split {
        border-radius: 16px;
        margin: 20px;
    }
}
.login-left {
    position: relative;
    background: linear-gradient(135deg, #0f1729 0%, #1a1f3a 60%, #1a1429 100%);
    padding: 36px 32px;
    overflow: hidden;
    color: white;
}
.left-grid-bg { position: absolute; inset: 0; opacity: 0.12; pointer-events: none; }
.left-blob { position: absolute; border-radius: 50%; pointer-events: none; filter: blur(20px); }
.left-blob.blob1 {
    top: -80px; left: -80px; width: 320px; height: 320px;
    background: radial-gradient(circle, rgba(245,158,11,0.32) 0%, transparent 70%);
    animation: blobFloat1 9s ease-in-out infinite;
}
.left-blob.blob2 {
    bottom: -120px; right: -120px; width: 380px; height: 380px;
    background: radial-gradient(circle, rgba(99,102,241,0.28) 0%, transparent 70%);
    animation: blobFloat2 11s ease-in-out infinite;
}
@keyframes blobFloat1 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(40px,60px) scale(1.1); } }
@keyframes blobFloat2 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-50px,-40px) scale(1.15); } }

.left-content { position: relative; z-index: 2; height: 100%; display: flex; flex-direction: column; justify-content: space-between; gap: 18px; }
.left-header, .mobile-logo { display: flex; align-items: center; gap: 12px; }
.mobile-logo { display: none; margin-bottom: 24px; }
.left-logo {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; color: white; font-size: 19px;
    box-shadow: 0 4px 14px rgba(245,158,11,0.4);
}
.left-logo-title { color: white; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.left-logo-sub { color: rgba(255,255,255,0.5); font-size: 11px; font-family: 'JetBrains Mono', monospace; margin-top: 2px; }

.left-hero { margin: 8px 0; }
.left-headline { color: white; font-size: 30px; font-weight: 600; line-height: 1.12; letter-spacing: -0.02em; margin-bottom: 10px; }
.left-sub { color: rgba(255,255,255,0.55); font-size: 13px; line-height: 1.55; max-width: 360px; }

.left-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.left-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 11px; padding: 13px;
    backdrop-filter: blur(10px);
}
.left-card-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.pulse-dot { width: 6px; height: 6px; border-radius: 50%; animation: dotPulse 2s ease-in-out infinite; }
.pulse-green { background: #22c55e; box-shadow: 0 0 8px #22c55e; }
.pulse-amber { background: #f59e0b; box-shadow: 0 0 8px #f59e0b; }
@keyframes dotPulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(1.5); } }
.left-card-label { color: rgba(255,255,255,0.6); font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em; font-weight: 500; }
.left-card-value { color: white; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.left-card-sub { color: rgba(255,255,255,0.5); font-size: 11px; margin-top: 2px; }
.spark { width: 100%; height: 20px; margin-top: 6px; }
.tier-bars { display: flex; gap: 3px; margin-top: 9px; }
.tier-bar { flex: 1; height: 4px; border-radius: 2px; }
.fill-green { background: #22c55e; }
.fill-amber { background: #f59e0b; }
.fill-empty { background: rgba(255,255,255,0.1); }

.left-chart { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08); border-radius: 11px; padding: 14px; }
.chart-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.chart-title { color: rgba(255,255,255,0.7); font-size: 12px; font-weight: 500; }
.chart-delta { color: #22c55e; font-size: 11px; font-family: 'JetBrains Mono', monospace; font-weight: 500; }
.chart-svg { width: 100%; height: 56px; }
.chart-axis { display: flex; justify-content: space-between; margin-top: 4px; font-size: 9px; color: rgba(255,255,255,0.35); font-family: 'JetBrains Mono', monospace; }

.left-stats { display: flex; gap: 16px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.06); }
.stat-item { flex: 1; }
.stat-num { color: white; font-size: 18px; font-weight: 600; letter-spacing: -0.02em; }
.stat-num small { font-size: 12px; opacity: 0.6; font-weight: 500; }
.stat-lbl { color: rgba(255,255,255,0.45); font-size: 10px; margin-top: 1px; }
.stat-sep { width: 1px; background: rgba(255,255,255,0.08); }

.login-right { background: #0d1322; display: flex; align-items: center; justify-content: center; padding: 36px 32px; overflow-y: auto; }
.login-right-inner { width: 100%; max-width: 340px; }
.login-welcome { margin-bottom: 22px; }
.login-welcome-title { color: white; font-size: 22px; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 4px; }
.login-welcome-sub { color: rgba(255,255,255,0.5); font-size: 13px; }

.login-error {
    display: none;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: #fca5a5; font-size: 12px;
    padding: 10px 12px; margin-bottom: 14px; line-height: 1.4;
}

.field-group { margin-bottom: 14px; }
.field-label { display: block; color: rgba(255,255,255,0.55); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 7px; }
.field-input {
    width: 100%; box-sizing: border-box;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 9px; padding: 12px 14px;
    color: white; font-size: 14px; font-family: inherit;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    outline: none;
}
.field-input::placeholder { color: rgba(255,255,255,0.3); }
.field-input:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.18); }
.field-input:focus { background: rgba(255,255,255,0.07); border-color: rgba(245,158,11,0.6); box-shadow: 0 0 0 3px rgba(245,158,11,0.12); }

.login-btn {
    width: 100%;
    background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    border: none; border-radius: 9px; padding: 13px;
    color: white; font-weight: 600; font-size: 14px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    font-family: inherit;
    box-shadow: 0 4px 14px rgba(245,158,11,0.3);
    transition: transform 0.1s, box-shadow 0.15s, opacity 0.15s;
    margin-bottom: 18px;
}
.login-btn:hover { box-shadow: 0 6px 20px rgba(245,158,11,0.42); }
.login-btn:active { transform: scale(0.985); }
.login-btn:disabled { opacity: 0.6; cursor: wait; }


.login-footer { text-align: center; color: rgba(255,255,255,0.3); font-size: 10px; font-family: 'JetBrains Mono', monospace; display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.login-footer i { font-size: 11px; vertical-align: -1px; }
.dot-sep { opacity: 0.5; }

@media (max-width: 900px) {
    .login-split { grid-template-columns: 1fr; max-width: 480px; max-height: none; margin: 0; border-radius: 0; }
    .login-left { display: none; }
    .mobile-logo { display: flex; }
    .login-right { padding: 24px 22px; }
}
@media (max-height: 720px) and (min-width: 901px) {
    .left-headline { font-size: 24px; }
    .left-card-value { font-size: 19px; }
    .login-left, .login-right { padding: 24px; }
}

/* ============================================================
   Login V6 enhancements — appended for cache bump v57
   - Remember me checkbox
   - Caps Lock warning
   - Login button spinner / loading state
   - Shake animation on auth failure
   - Chart hover tooltip + axis active state
   - Trend hotspot (transparent click target)
   - Live pill indicator
   - Tier pill stagger entrance
   - Background grid shimmer
   ============================================================ */

/* === Remember me checkbox === */
.remember-row { margin: -4px 0 16px; }
.remember-check {
    display: inline-flex; align-items: center; gap: 9px;
    cursor: pointer; user-select: none;
    color: rgba(226,232,240,0.66); font-size: 12.5px;
    transition: color 0.18s ease;
    padding: 4px 2px;
}
.remember-check:hover { color: rgba(255,255,255,0.92); }
.remember-check input[type="checkbox"] {
    position: absolute; opacity: 0; pointer-events: none;
    width: 1px; height: 1px;
}
.remember-box {
    width: 17px; height: 17px;
    border-radius: 5px;
    border: 1.5px solid rgba(255,255,255,0.22);
    background: rgba(255,255,255,0.04);
    display: inline-flex; align-items: center; justify-content: center;
    color: transparent;
    transition: all 0.16s ease;
    flex-shrink: 0;
}
.remember-check:hover .remember-box { border-color: rgba(245,158,11,0.55); }
.remember-check input:focus-visible ~ .remember-box {
    outline: 2px solid rgba(245,158,11,0.45); outline-offset: 2px;
}
.remember-check input:checked ~ .remember-box {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 14px rgba(245,158,11,0.32);
}

/* === Caps Lock warning === */
.caps-lock-warn {
    display: none;
    align-items: center; gap: 6px;
    margin-top: 8px;
    padding: 6px 10px;
    border-radius: 7px;
    background: rgba(245,158,11,0.10);
    border: 1px solid rgba(245,158,11,0.30);
    color: #fbbf24;
    font-size: 11px; font-weight: 600;
    letter-spacing: 0.01em;
    animation: capsIn 0.22s ease;
}
.caps-lock-warn.visible { display: inline-flex; }
.caps-lock-warn i { font-size: 13px; }
@keyframes capsIn {
    from { opacity: 0; transform: translateY(-3px); }
    to   { opacity: 1; transform: none; }
}

/* === Login button: loading state + spinner === */
.login-btn.is-loading {
    background: linear-gradient(135deg, #b45309 0%, #991b1b 100%);
    cursor: wait;
}
.btn-spinner {
    width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: btnSpin 0.7s linear infinite;
    display: inline-block;
}
@keyframes btnSpin { to { transform: rotate(360deg); } }

/* === Shake animation on auth failure === */
.login-right.shake,
.mig-card.shake { animation: shakeX 0.42s cubic-bezier(.36,.07,.19,.97); }
@keyframes shakeX {
    10%, 90%   { transform: translateX(-1px); }
    20%, 80%   { transform: translateX(2px); }
    30%, 50%, 70% { transform: translateX(-6px); }
    40%, 60%   { transform: translateX(6px); }
}

/* === Chart tooltip (handler exists in index.php, styles were missing) === */
.trend-tooltip {
    position: absolute;
    transform: translate(-50%, -130%);
    background: rgba(8,12,24,0.96);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 8px;
    padding: 7px 11px;
    color: #fff;
    font-size: 11px;
    line-height: 1.2;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.14s ease;
    white-space: nowrap;
    box-shadow: 0 12px 28px rgba(0,0,0,0.45);
    z-index: 5;
}
.trend-tooltip.show { opacity: 1; }
.trend-tooltip b {
    display: block;
    font-size: 14px;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
    color: #fbbf24;
    margin-bottom: 1px;
}
.trend-tooltip span {
    color: rgba(255,255,255,0.55);
    font-size: 10px;
}

/* Invisible larger click target around each data point — makes hovering
   tiny 3.6px circles forgiving without changing the chart visuals. */
.trend-hotspot {
    fill: transparent;
    cursor: pointer;
}
.trend-point .trend-dot {
    transition: r 0.18s ease, stroke-width 0.18s ease;
}
.trend-point:hover .trend-dot { r: 5.5; stroke-width: 2; }

/* Highlight the X-axis label for the currently hovered point */
.chart-axis span {
    transition: color 0.18s ease;
}
.chart-axis span.active {
    color: #fbbf24;
    font-weight: 700;
}

/* === Live pill (small "Live" badge next to Scorecard label) === */
.live-pill {
    display: none;
    margin-left: auto;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(34,197,94,0.16);
    border: 1px solid rgba(34,197,94,0.34);
    color: #4ade80;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.10em;
    text-transform: uppercase;
}
.live-pill.visible { display: inline-flex; align-items: center; }
.live-pill::before {
    content: '';
    width: 5px; height: 5px;
    border-radius: 50%;
    background: #4ade80;
    margin-right: 4px;
    animation: liveDot 1.8s ease-in-out infinite;
}
@keyframes liveDot {
    0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(74,222,128,0.55); }
    50%      { opacity: 0.6; transform: scale(1.18); box-shadow: 0 0 0 5px rgba(74,222,128,0); }
}

/* === Tier pill stagger entrance (active state retained from JS) === */
.tier-chip.active {
    background: rgba(168,85,247,0.18);
    border-color: rgba(168,85,247,0.38);
    box-shadow: 0 0 18px rgba(168,85,247,0.14);
}
.login-overlay.animate-in .tier-chip {
    opacity: 0;
    transform: translateY(6px);
    animation: pillIn 0.42s cubic-bezier(.2,.9,.2,1) forwards;
}
.login-overlay.animate-in .tier-chip:nth-child(1) { animation-delay: 120ms; }
.login-overlay.animate-in .tier-chip:nth-child(2) { animation-delay: 200ms; }
.login-overlay.animate-in .tier-chip:nth-child(3) { animation-delay: 280ms; }
.login-overlay.animate-in .tier-chip:nth-child(4) { animation-delay: 360ms; }
.login-overlay.animate-in .tier-chip:nth-child(5) { animation-delay: 440ms; }
@keyframes pillIn {
    to { opacity: 1; transform: none; }
}

/* === Subtle background grid shimmer — slow, 14s cycle === */
.login-overlay { position: relative; }
.login-overlay > svg.login-grid-bg,
.login-overlay svg[class*="loginGrid"] { animation: gridShimmer 14s ease-in-out infinite; }
@keyframes gridShimmer {
    0%, 100% { opacity: 0.20; }
    50%      { opacity: 0.34; }
}

/* Make .left-blob respond smoothly to mouse parallax (set by JS) */
.left-blob { transition: transform 0.55s cubic-bezier(.2,.9,.2,1); will-change: transform; }

/* Accessibility — respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    .login-right.shake,
    .login-overlay.animate-in .tier-chip,
    .login-overlay > svg.login-grid-bg,
    .live-pill::before,
    .caps-lock-warn { animation: none !important; }
    .left-blob { transition: none !important; }
}

/* ============================================================
   First-time help (A + B): contextual hint + modal
   Replaces the older .login-tutorial expandable box.
   ============================================================ */

/* === A) Inline contextual hint under Username field === */
.login-hint-contextual {
    display: none;
    align-items: flex-start;
    gap: 8px;
    margin-top: 9px;
    padding: 10px 12px;
    border-radius: 9px;
    background: linear-gradient(180deg, rgba(245,158,11,0.10), rgba(245,158,11,0.04));
    border: 1px solid rgba(245,158,11,0.28);
    color: rgba(255,255,255,0.82);
    font-size: 12px;
    line-height: 1.45;
    animation: hintIn 0.22s ease;
}
.login-hint-contextual.visible { display: flex; }
.login-hint-contextual i {
    color: #fbbf24;
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 1px;
}
.login-hint-contextual strong { color: #fff; font-weight: 700; }
@keyframes hintIn {
    from { opacity: 0; transform: translateY(-3px); }
    to   { opacity: 1; transform: none; }
}

/* === Subtle "First time signing in?" link (replaces the box) === */
.login-help-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 12px 0 4px;
    padding: 4px 0;
    color: rgba(226,232,240,0.55);
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.16s ease, gap 0.16s ease;
    cursor: pointer;
}
.login-help-link:hover,
.login-help-link:focus-visible {
    color: #fbbf24;
    gap: 9px;
    outline: none;
}
.login-help-link:focus-visible { text-decoration: underline; text-underline-offset: 3px; }
.help-link-arrow {
    font-size: 13px;
    transition: transform 0.16s ease;
}
.login-help-link:hover .help-link-arrow { transform: translateX(2px); }

/* === B) Help modal === */
.help-modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(4,7,15,0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center; justify-content: center;
    padding: 24px;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.22s ease;
}
.help-modal-backdrop.open {
    display: flex;
    opacity: 1;
    animation: backdropIn 0.22s ease;
}
@keyframes backdropIn { from { opacity: 0; } to { opacity: 1; } }

.help-modal {
    position: relative;
    width: min(480px, 100%);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    background: linear-gradient(180deg, #131826 0%, #0c1120 100%);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 20px;
    padding: 30px 30px 24px;
    box-shadow: 0 32px 80px rgba(0,0,0,0.55), 0 0 60px rgba(245,158,11,0.08);
    animation: modalIn 0.32s cubic-bezier(.2,.9,.2,1) both;
}
@keyframes modalIn {
    from { opacity: 0; transform: translateY(14px) scale(.97); }
    to   { opacity: 1; transform: none; }
}

.help-modal-close {
    position: absolute;
    top: 14px; right: 14px;
    width: 32px; height: 32px;
    border-radius: 10px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.10);
    color: rgba(255,255,255,0.65);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s ease;
}
.help-modal-close:hover {
    background: rgba(239,68,68,0.14);
    border-color: rgba(239,68,68,0.34);
    color: #fff;
}

.help-modal-header {
    display: flex; gap: 14px; align-items: flex-start;
    margin-bottom: 22px;
    padding-right: 36px;
}
.help-modal-icon {
    flex-shrink: 0;
    width: 44px; height: 44px;
    border-radius: 13px;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 10px 24px rgba(245,158,11,0.32);
}
.help-modal-header h3 {
    margin: 0;
    color: #fff;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}
.help-modal-header p {
    margin: 5px 0 0;
    color: rgba(226,232,240,0.58);
    font-size: 12.5px;
    line-height: 1.45;
}

/* === Numbered steps === */
.help-steps {
    list-style: none;
    margin: 0 0 20px;
    padding: 0;
    display: flex; flex-direction: column;
    gap: 14px;
}
.help-step {
    display: flex; gap: 14px;
    padding: 14px;
    background: rgba(255,255,255,0.025);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 12px;
}
.help-step-num {
    flex-shrink: 0;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: rgba(245,158,11,0.14);
    border: 1px solid rgba(245,158,11,0.36);
    color: #fbbf24;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.help-step-body { flex: 1; min-width: 0; }
.help-step-body strong {
    display: block;
    color: #fff;
    font-size: 13.5px;
    font-weight: 700;
    margin-bottom: 4px;
}
.help-step-body p {
    margin: 0;
    color: rgba(226,232,240,0.65);
    font-size: 12px;
    line-height: 1.5;
}

.help-step-creds {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 9px;
}
.cred-pill {
    padding: 4px 10px;
    border-radius: 7px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 700;
}
.cred-pill.cred-admin {
    background: rgba(168,85,247,0.14);
    border: 1px solid rgba(168,85,247,0.34);
    color: #c084fc;
}
.cred-pill.cred-viewer {
    background: rgba(96,165,250,0.14);
    border: 1px solid rgba(96,165,250,0.34);
    color: #93c5fd;
}
.cred-or {
    color: rgba(255,255,255,0.40);
    font-size: 11px;
    font-weight: 600;
}
.cred-plus {
    color: rgba(226,232,240,0.72);
    font-size: 11.5px;
}

/* === Modal footer === */
.help-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.help-shield {
    color: rgba(226,232,240,0.50);
    font-size: 11px;
    line-height: 1.4;
    flex: 1;
    min-width: 200px;
}
.help-modal-cta {
    padding: 10px 22px;
    border: none;
    border-radius: 9px;
    background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 6px 18px rgba(245,158,11,0.32);
    transition: transform 0.1s ease, box-shadow 0.15s ease;
}
.help-modal-cta:hover { box-shadow: 0 8px 24px rgba(245,158,11,0.44); }
.help-modal-cta:active { transform: scale(0.97); }

/* Reduced-motion: drop animations, keep functional state */
@media (prefers-reduced-motion: reduce) {
    .help-modal-backdrop, .help-modal,
    .login-hint-contextual { animation: none !important; }
}

/* Hide the now-deleted .login-tutorial just in case any cached copy
   of the HTML still references it (defensive — fresh deploys won't
   render that block). */
.login-tutorial { display: none !important; }

/* ============================================================
   Legacy migration card — same design language as splash login
   Replaces the older .login-box variant inside #migrationOverlay
   ============================================================ */

.mig-card {
    position: relative;
    width: min(560px, 100%);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    padding: 32px 34px 22px;
    border-radius: 22px;
    border: 1px solid rgba(255,255,255,0.10);
    background:
        radial-gradient(circle at 0% 0%, rgba(245,158,11,0.10), transparent 38%),
        radial-gradient(circle at 100% 100%, rgba(99,102,241,0.10), transparent 38%),
        linear-gradient(180deg, rgba(18,24,40,0.96), rgba(10,15,30,0.98));
    box-shadow: 0 40px 100px rgba(0,0,0,0.62), 0 0 70px rgba(245,158,11,0.06), inset 0 1px 0 rgba(255,255,255,0.06);
    backdrop-filter: blur(24px) saturate(130%);
    -webkit-backdrop-filter: blur(24px) saturate(130%);
    animation: migCardIn 0.42s cubic-bezier(.2,.9,.2,1) both;
}
@keyframes migCardIn {
    from { opacity: 0; transform: translateY(16px) scale(.97); }
    to   { opacity: 1; transform: none; }
}

/* Back link — centered text-link style below the submit button.
   Stripe/Linear pattern: primary CTA → secondary cancel directly
   beneath, so the "what if I want out" affordance lives next to
   the commit action, not floating in a corner. */
.mig-back {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0 auto 10px;
    padding: 8px 14px;
    background: transparent;
    border: none;
    color: rgba(226,232,240,0.55);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: color 0.16s ease, background 0.16s ease;
    width: auto;
}
.mig-back svg {
    flex-shrink: 0;
    transition: transform 0.16s ease;
}
.mig-back:hover,
.mig-back:focus-visible {
    color: #fff;
    background: rgba(255,255,255,0.04);
    outline: none;
}
.mig-back:hover svg,
.mig-back:focus-visible svg { transform: translateX(-3px); }
.mig-back:active { transform: scale(0.97); }

/* Verified pill — confirms password check passed */
.mig-verified {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 18px;
    padding: 5px 11px 5px 8px;
    border-radius: 999px;
    background: rgba(34,197,94,0.12);
    border: 1px solid rgba(34,197,94,0.30);
    color: #4ade80;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.mig-verified svg { flex-shrink: 0; }
.mig-verified strong { color: #fff; font-weight: 800; }

/* Header block */
.mig-header { margin-bottom: 22px; }
.mig-icon {
    width: 52px; height: 52px;
    border-radius: 15px;
    background: linear-gradient(135deg, #f59e0b 0%, #fb923c 50%, #ef4444 100%);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 14px 32px rgba(245,158,11,0.32), inset 0 1px 0 rgba(255,255,255,0.20);
    margin-bottom: 14px;
}
.mig-title {
    margin: 0 0 5px;
    color: #fff;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1.15;
    text-align: left;
    background: none;
}
.mig-sub {
    margin: 0;
    color: rgba(226,232,240,0.62);
    font-size: 13px;
    line-height: 1.5;
    text-align: left;
}

/* Error banner */
.mig-error {
    display: none;
    margin-bottom: 14px;
    padding: 10px 12px;
    border-radius: 9px;
    background: rgba(239,68,68,0.10);
    border: 1px solid rgba(239,68,68,0.30);
    color: #fca5a5;
    font-size: 12px;
    line-height: 1.4;
    text-align: left;
}

/* Form grid — 2 columns desktop, stacks on small screens */
.mig-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 14px;
    margin-bottom: 16px;
}
.mig-field { display: flex; flex-direction: column; gap: 6px; }
.mig-field-full { grid-column: 1 / -1; }

.mig-label {
    color: rgba(255,255,255,0.55);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-align: left;
}
.mig-input {
    width: 100%;
    box-sizing: border-box;
    padding: 11px 13px;
    border-radius: 9px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.04);
    color: #fff;
    font-size: 13.5px;
    font-family: inherit;
    font-weight: 600;
    text-align: left;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    outline: none;
    /* Override the inline-styled width/padding from login-v3.css */
    min-height: 44px;
}
.mig-input::placeholder { color: rgba(255,255,255,0.32); font-weight: 500; }
.mig-input:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.18); }
.mig-input:focus {
    background: rgba(255,255,255,0.07);
    border-color: rgba(245,158,11,0.65);
    box-shadow: 0 0 0 3px rgba(245,158,11,0.14);
}

.mig-pw-hint {
    margin: -2px 0 6px;
    color: rgba(226,232,240,0.45);
    font-size: 11px;
    line-height: 1.4;
    text-align: left;
    padding: 0 2px;
}

/* Role note — populated by JS, tinted info panel */
.mig-role {
    margin: 0 0 18px;
    padding: 12px 14px 12px 40px;
    position: relative;
    border-radius: 11px;
    border: 1px solid rgba(34,197,94,0.20);
    background: linear-gradient(180deg, rgba(34,197,94,0.09), rgba(34,197,94,0.04));
    color: rgba(226,232,240,0.78);
    font-size: 12px;
    line-height: 1.5;
    text-align: left;
}
.mig-role:before {
    content: "✓";
    position: absolute;
    left: 13px; top: 12px;
    width: 19px; height: 19px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: rgba(34,197,94,0.18);
    color: #4ade80;
    font-weight: 900;
    font-size: 12px;
}
.mig-role strong { color: #fff; font-weight: 700; }
.mig-role:empty { display: none; }

/* Security reassurance block — placed right before the submit so it's
   the last visual element the user sees before committing to a new
   password. Cyan/blue tint to differentiate from the green role note. */
.mig-security {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 0 0 18px;
    padding: 13px 15px;
    border-radius: 12px;
    border: 1px solid rgba(96,165,250,0.22);
    background: linear-gradient(180deg, rgba(96,165,250,0.09), rgba(99,102,241,0.05));
}
.mig-security-icon {
    flex-shrink: 0;
    width: 36px; height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(96,165,250,0.18), rgba(99,102,241,0.18));
    border: 1px solid rgba(96,165,250,0.30);
    color: #93c5fd;
    display: flex; align-items: center; justify-content: center;
}
.mig-security-text {
    flex: 1;
    color: rgba(226,232,240,0.78);
    font-size: 11.5px;
    line-height: 1.55;
    text-align: left;
}
.mig-security-text strong {
    display: block;
    color: #fff;
    font-size: 12.5px;
    font-weight: 700;
    margin-bottom: 3px;
}
.mig-security-mono {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(96,165,250,0.16);
    border: 1px solid rgba(96,165,250,0.30);
    color: #93c5fd;
    font-weight: 700;
}

/* Submit button — full-width gradient, matches splash style */
.mig-submit {
    width: 100%;
    min-height: 50px;
    margin: 0 0 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14.5px;
    font-weight: 800;
    letter-spacing: 0.01em;
}
.mig-arrow {
    font-size: 16px;
    transition: transform 0.18s ease;
}
.mig-submit:hover .mig-arrow { transform: translateX(3px); }

.mig-footer-note {
    text-align: center;
    color: rgba(226,232,240,0.45);
    font-size: 11px;
    line-height: 1.4;
    padding-top: 4px;
}
.mig-shield { margin-right: 4px; }

/* Mobile: stack form, tighter padding */
@media (max-width: 540px) {
    .mig-card { padding: 24px 20px 18px; border-radius: 18px; }
    .mig-form { grid-template-columns: 1fr; }
    .mig-title { font-size: 22px; }
}

/* When the migration modal is open, override login-v3.css legacy
   layout overrides so our new card lays out cleanly. */
#migrationOverlay { align-items: center !important; padding: clamp(18px, 3.2vw, 48px) !important; }
@media (max-width: 540px) {
    #migrationOverlay { align-items: flex-start !important; padding: 20px !important; }
}

/* ============================================================
   POST-LOGIN APP CHROME — unified design system
   ============================================================

   Shared across home.php and (eventually) every other logged-in
   page. Same dark + amber gradient palette as the splash login,
   adapted for content-heavy screens. The splash uses huge type
   and lots of negative space; the app chrome is denser but keeps
   the same colour story so users feel they're in one product.
   ============================================================ */

.app-body {
    /* Background mirrors the splash but at lower intensity so it
       doesn't compete with foreground data. The two radial gradients
       sit in opposite corners; the linear base does the rest. */
    margin: 0;
    min-height: 100vh;
    color: rgba(255,255,255,0.92);
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background:
        radial-gradient(900px circle at 0% 0%,    rgba(245,158,11,0.07), transparent 50%),
        radial-gradient(900px circle at 100% 100%, rgba(99,102,241,0.07), transparent 50%),
        linear-gradient(180deg, #070b14 0%, #0a0f1e 60%, #060912 100%);
    background-attachment: fixed;
}

/* ===== Topbar =================================================== */
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(8,12,22,0.78);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.app-topbar-inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Brand */
.app-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    text-decoration: none;
    color: inherit;
    flex-shrink: 0;
}
.app-brand-logo {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #f59e0b 0%, #fb923c 50%, #ef4444 100%);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 900;
    font-size: 18px;
    box-shadow: 0 8px 24px rgba(245,158,11,0.30), inset 0 1px 0 rgba(255,255,255,0.25);
}
.app-brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.app-brand-title { font-size: 14px; font-weight: 800; letter-spacing: -0.01em; }
.app-brand-sub   { font-size: 10px; font-weight: 600; color: rgba(255,255,255,0.45); letter-spacing: 0.04em; text-transform: uppercase; }

/* Primary nav */
.app-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: 12px;
    flex: 1;
}
.app-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 12px;
    border-radius: 9px;
    color: rgba(255,255,255,0.62);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
}
.app-nav-link svg { opacity: 0.75; transition: opacity 0.15s ease; }
.app-nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.04);
}
.app-nav-link:hover svg { opacity: 1; }
.app-nav-link.is-active {
    color: #fff;
    background: linear-gradient(180deg, rgba(245,158,11,0.18), rgba(239,68,68,0.10));
    border: 1px solid rgba(245,158,11,0.28);
    padding: 7px 11px; /* offset border so total size matches non-active */
}
.app-nav-link.is-active svg { opacity: 1; color: #fbbf24; }

/* Right cluster */
.app-topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

/* Depot indicator pill (single-scope users — read-only) */
.app-depot-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 11px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: rgba(99,102,241,0.10);
    border: 1px solid rgba(99,102,241,0.25);
    color: #a5b4fc;
}
.app-depot-badge svg { flex-shrink: 0; }
.app-depot-badge strong { color: #fff; font-weight: 800; }
.app-depot-badge-single {
    background: rgba(245,158,11,0.10);
    border-color: rgba(245,158,11,0.30);
    color: #fbbf24;
}

/* ===== Depot picker (multi-scope users) =====
   Same anchor/transitions as the user menu but visually distinct so
   the two dropdowns in the topbar don't look like duplicates. Picker
   trigger uses the amber/indigo combination from the splash; user
   menu stays neutral white. */
.app-depot-picker { position: relative; }
.app-depot-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 11px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(245,158,11,0.10), rgba(99,102,241,0.06));
    border: 1px solid rgba(245,158,11,0.22);
    color: #fbbf24;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    max-width: 240px;
}
.app-depot-trigger:hover,
.app-depot-picker.is-open .app-depot-trigger {
    background: linear-gradient(180deg, rgba(245,158,11,0.16), rgba(99,102,241,0.10));
    border-color: rgba(245,158,11,0.40);
    color: #fde68a;
}
.app-depot-trigger > svg:first-child { flex-shrink: 0; color: #fbbf24; }
.app-depot-trigger-label {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    min-width: 0;
}
.app-depot-trigger-label strong { color: #fff; font-weight: 800; }
.app-depot-trigger-name {
    color: rgba(255,255,255,0.55);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
}
.app-depot-trigger-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: rgba(255,255,255,0.10);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
}

/* Dropdown menu */
.app-depot-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 280px;
    max-height: 70vh;
    overflow-y: auto;
    padding: 6px;
    border-radius: 12px;
    background: rgba(18,22,38,0.96);
    border: 1px solid rgba(255,255,255,0.10);
    box-shadow: 0 20px 60px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.05);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    animation: appMenuIn 0.16s ease;
    z-index: 200;
}
.app-depot-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 11px;
    border-radius: 8px;
    color: rgba(255,255,255,0.82);
    font-family: inherit;
    text-decoration: none;
    transition: all 0.12s ease;
}
.app-depot-item:hover, .app-depot-item:focus-visible {
    background: rgba(255,255,255,0.05);
    color: #fff;
    outline: none;
}
.app-depot-item.is-active {
    background: linear-gradient(180deg, rgba(245,158,11,0.10), rgba(245,158,11,0.04));
    border: 1px solid rgba(245,158,11,0.22);
    padding: 8px 10px; /* offset border so total size matches non-active */
}
.app-depot-item-icon {
    flex-shrink: 0;
    width: 32px; height: 32px;
    border-radius: 8px;
    background: rgba(99,102,241,0.14);
    color: #a5b4fc;
    display: flex; align-items: center; justify-content: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: -0.02em;
}
.app-depot-item-icon-all {
    background: linear-gradient(135deg, rgba(245,158,11,0.18), rgba(239,68,68,0.14));
    color: #fbbf24;
}
.app-depot-item.is-active .app-depot-item-icon {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: #fff;
}
.app-depot-item-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.app-depot-item-name {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 6px;
}
.app-depot-item-home {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: rgba(245,158,11,0.16);
    color: #fbbf24;
    border: 1px solid rgba(245,158,11,0.30);
    flex-shrink: 0;
}
.app-depot-item-sub {
    font-size: 10.5px;
    font-weight: 600;
    color: rgba(255,255,255,0.45);
    letter-spacing: 0.02em;
}
.app-depot-item-check {
    flex-shrink: 0;
    color: #fbbf24;
}
.app-depot-divider {
    height: 1px;
    margin: 4px 8px;
    background: rgba(255,255,255,0.06);
}

/* Mobile: trigger gets more compact, menu takes more width */
@media (max-width: 900px) {
    .app-depot-trigger { max-width: 160px; padding: 5px 9px; font-size: 11.5px; }
    .app-depot-trigger-name { display: none; }
    .app-depot-menu { right: -8px; min-width: 260px; }
}

/* User menu */
.app-user { position: relative; }
.app-user-trigger {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 5px 10px 5px 5px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
    color: inherit;
    font-family: inherit;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.app-user-trigger:hover {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.16);
}
.app-user.is-open .app-user-trigger {
    background: rgba(255,255,255,0.07);
    border-color: rgba(245,158,11,0.30);
}
.app-user-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800;
    font-size: 12.5px;
    box-shadow: 0 4px 12px rgba(245,158,11,0.25), inset 0 1px 0 rgba(255,255,255,0.25);
}
.app-user-meta { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.app-user-name { font-size: 12.5px; font-weight: 700; color: #fff; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-user-role { font-size: 10px; font-weight: 600; color: rgba(255,255,255,0.45); text-transform: uppercase; letter-spacing: 0.05em; }

.app-user-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 200px;
    padding: 6px;
    border-radius: 12px;
    background: rgba(18,22,38,0.96);
    border: 1px solid rgba(255,255,255,0.10);
    box-shadow: 0 20px 60px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.05);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    animation: appMenuIn 0.16s ease;
}
@keyframes appMenuIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: none; }
}
.app-user-menu-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 9px 11px;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.82);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.12s ease;
}
.app-user-menu-item:hover, .app-user-menu-item:focus-visible {
    background: rgba(255,255,255,0.05);
    color: #fff;
    outline: none;
}
.app-user-menu-item svg { flex-shrink: 0; opacity: 0.75; }
.app-user-menu-item-danger { color: #fca5a5; }
.app-user-menu-item-danger:hover { background: rgba(239,68,68,0.10); color: #fecaca; }

/* Defensive [hidden] rules. The HTML `hidden` attribute uses the UA
   stylesheet's `display: none` which can be overridden by any
   authored `display:` rule on the same element. Keep these explicit
   so future styling changes don't break the dropdowns. */
.app-user-menu[hidden],
.app-depot-menu[hidden] { display: none; }

/* Mobile topbar adjustments — nav becomes scroll strip, user shows
   avatar only, brand subtitle hides. */
@media (max-width: 900px) {
    .app-topbar-inner { padding: 10px 14px; gap: 12px; }
    .app-brand-sub { display: none; }
    .app-nav {
        gap: 0; overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        order: 3;
        flex-basis: 100%;
        margin: 6px 0 0;
    }
    .app-nav::-webkit-scrollbar { display: none; }
    .app-nav-link { padding: 7px 10px; font-size: 12.5px; flex-shrink: 0; }
    .app-user-meta { display: none; }
    .app-user-trigger { padding: 4px; }
}

/* ===== Main content shell ===================================== */
.app-main {
    max-width: 1440px;
    margin: 0 auto;
    padding: 28px 24px 56px;
}
@media (max-width: 720px) {
    .app-main { padding: 18px 14px 44px; }
}

/* ===== Welcome row ============================================ */
.app-welcome {
    margin-bottom: 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
}
.app-welcome h1 {
    margin: 0 0 4px;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: #fff;
}
.app-welcome p {
    margin: 0;
    color: rgba(255,255,255,0.55);
    font-size: 14px;
    font-weight: 500;
}
.app-welcome strong { color: rgba(255,255,255,0.85); font-weight: 700; }

/* ===== KPI cards ============================================== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
    margin-bottom: 22px;
}
@media (max-width: 1280px) { .kpi-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px)  { .kpi-grid { grid-template-columns: 1fr; } }

.kpi-card {
    position: relative;
    padding: 18px 20px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.07);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0)),
        rgba(15,20,34,0.55);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 18px 40px rgba(0,0,0,0.30), inset 0 1px 0 rgba(255,255,255,0.04);
    overflow: hidden;
    transition: transform 0.18s ease, border-color 0.18s ease;
}
.kpi-card:hover { transform: translateY(-2px); border-color: rgba(255,255,255,0.14); }
.kpi-card::before {
    /* Subtle accent shimmer along the top edge */
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(245,158,11,0.45), transparent);
    opacity: 0.6;
}
.kpi-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.52);
    text-transform: uppercase;
    margin-bottom: 10px;
    display: flex; align-items: center; gap: 6px;
}
.kpi-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.05;
    color: #fff;
    display: flex; align-items: baseline; gap: 7px;
}
.kpi-value-unit { font-size: 13px; color: rgba(255,255,255,0.5); font-weight: 600; }
.kpi-foot {
    display: flex; align-items: center; gap: 8px;
    margin-top: 10px;
    font-size: 12px;
    color: rgba(255,255,255,0.55);
    font-weight: 600;
}
.kpi-delta {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 2px 6px;
    border-radius: 5px;
    font-size: 11.5px;
    font-weight: 700;
}
.kpi-delta.is-up   { color: #4ade80; background: rgba(34,197,94,0.13); border: 1px solid rgba(34,197,94,0.25); }
.kpi-delta.is-down { color: #fca5a5; background: rgba(239,68,68,0.13); border: 1px solid rgba(239,68,68,0.25); }
.kpi-delta.is-flat { color: rgba(255,255,255,0.55); background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08); }

/* Tier colour hints for KPI numerics. We also have to neutralise
   the background from the global `.tier-X` rules (defined near
   the top of this file for tier pills) — without `background:none`,
   it bleeds onto the full width of the .kpi-value div and shows up
   as an unwanted coloured bar behind the number. */
.kpi-value.tier-fp { color: #c084fc; background: none; }
.kpi-value.tier-f  { color: #60a5fa; background: none; }
.kpi-value.tier-g  { color: #4ade80; background: none; }
.kpi-value.tier-fa { color: #fbbf24; background: none; }
.kpi-value.tier-p  { color: #fca5a5; background: none; }

/* ===== Generic content card =================================== */
.app-card {
    padding: 20px 22px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.07);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0)),
        rgba(15,20,34,0.55);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 18px 40px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.04);
}
/* Stacked card spacing — applies universally, scoped to consecutive
   siblings so it doesn't affect cards inside grids (which use their
   parent's gap) or the first card after a heading/row. */
.app-card + .app-card { margin-top: 22px; }
.app-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}
.app-card-title {
    margin: 0;
    font-size: 13px;
    font-weight: 800;
    color: rgba(255,255,255,0.85);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    display: flex; align-items: center; gap: 8px;
}
.app-card-action {
    font-size: 12px;
    font-weight: 700;
    color: #fbbf24;
    text-decoration: none;
    transition: color 0.15s ease;
}
.app-card-action:hover { color: #fde68a; }

/* Empty state inside any card */
.app-empty {
    padding: 28px 12px;
    text-align: center;
    color: rgba(255,255,255,0.45);
    font-size: 13px;
}
.app-empty svg {
    display: block;
    margin: 0 auto 10px;
    opacity: 0.55;
}

/* ===== Grid layouts for sections ============================== */
.app-grid-2-1 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}
.app-grid-1-1 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}
@media (max-width: 900px) {
    .app-grid-2-1, .app-grid-1-1 { grid-template-columns: 1fr; }
}

/* ===== Quick actions strip ==================================== */
.qa-strip {
    display: grid;
    /* Adaptive: 3-5 tiles depending on the user's upload grants */
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    margin: 0 0 18px;
}
@media (max-width: 720px) { .qa-strip { grid-template-columns: repeat(2, 1fr); } }

.qa-tile {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(15,20,34,0.55);
    color: rgba(255,255,255,0.85);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.16s ease;
}
.qa-tile:hover {
    background: rgba(245,158,11,0.07);
    border-color: rgba(245,158,11,0.30);
    color: #fff;
    transform: translateY(-1px);
}
.qa-tile-icon {
    width: 32px; height: 32px;
    border-radius: 9px;
    background: rgba(245,158,11,0.14);
    color: #fbbf24;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: all 0.16s ease;
}
.qa-tile:hover .qa-tile-icon {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: #fff;
}

/* ===== Tier pill (reused across pages) ======================== */
.tier-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px solid;
}
.tier-pill.tier-fp { background: rgba(192,132,252,0.12); color: #c084fc; border-color: rgba(192,132,252,0.30); }
.tier-pill.tier-f  { background: rgba(96,165,250,0.12); color: #60a5fa; border-color: rgba(96,165,250,0.30); }
.tier-pill.tier-g  { background: rgba(34,197,94,0.12);  color: #4ade80; border-color: rgba(34,197,94,0.30); }
.tier-pill.tier-fa { background: rgba(251,191,36,0.12); color: #fbbf24; border-color: rgba(251,191,36,0.30); }
.tier-pill.tier-p  { background: rgba(239,68,68,0.12);  color: #fca5a5; border-color: rgba(239,68,68,0.30); }

/* ===== List rows (top drivers, recent activity, alerts) ====== */
.app-row {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 4px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.app-row:last-child { border-bottom: none; }
/* .app-row-rank styled by the unified rank-pill block further down */

.app-row-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: rgba(99,102,241,0.18);
    color: #c7d2fe;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px;
    font-weight: 800;
    flex-shrink: 0;
}
.app-row-main { flex: 1; min-width: 0; }
.app-row-name { font-size: 13px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-row-meta { font-size: 11px; font-weight: 500; color: rgba(255,255,255,0.50); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Score-on-row tier pill — slightly bigger than the meta-line tier
   pill (which is 10.5px) so the right-side score reads as the row's
   primary numeric value. Applied as .tier-pill.app-row-score-pill */
.tier-pill.app-row-score-pill {
    font-size: 12.5px;
    padding: 4px 10px;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: -0.01em;
    text-transform: none;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

/* ===== Inline trend chart ==================================== */
.trend-chart {
    width: 100%;
    height: 220px;
    display: block;
    overflow: visible;
}
.trend-chart .trend-line { fill: none; stroke: url(#trendGrad); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.trend-chart .trend-area { fill: url(#trendArea); opacity: 0.4; }
.trend-chart .trend-dot  { fill: #fbbf24; stroke: #0a0f1e; stroke-width: 2; }
.trend-chart .trend-axis { stroke: rgba(255,255,255,0.06); stroke-width: 1; }
.trend-chart .trend-label { fill: rgba(255,255,255,0.45); font-size: 10px; font-weight: 600; font-family: 'DM Sans', system-ui, sans-serif; }
.trend-chart .trend-week  { fill: rgba(255,255,255,0.55); font-size: 11px; font-weight: 700; font-family: 'JetBrains Mono', monospace; }

/* ============================================================
   SCORECARDS PAGE
   ============================================================ */

.sc-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.sc-page-header h1 {
    margin: 0 0 4px;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: #fff;
}
.sc-page-header p {
    margin: 0;
    color: rgba(255,255,255,0.55);
    font-size: 13px;
    font-weight: 500;
}

.sc-page-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Week picker — custom dropdown, mirrors the depot-picker pattern
   but with tier-coloured score pills and a search input at the top. */
.sc-week-picker { position: relative; }

.sc-week-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 11px 7px 13px;
    border-radius: 9px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.85);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}
.sc-week-trigger > svg:first-child { color: rgba(255,255,255,0.55); flex-shrink: 0; }
.sc-week-trigger:hover,
.sc-week-picker.is-open .sc-week-trigger {
    background: rgba(255,255,255,0.07);
    border-color: rgba(245,158,11,0.30);
}
.sc-week-trigger:hover > svg:first-child,
.sc-week-picker.is-open .sc-week-trigger > svg:first-child { color: #fbbf24; }

.sc-week-trigger-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #fff;
    font-weight: 700;
}
.sc-week-trigger-label strong { color: #fbbf24; font-weight: 800; }
.sc-week-trigger-year { color: rgba(255,255,255,0.55); font-weight: 600; }

.sc-week-trigger-score {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 5px;
    background: rgba(255,255,255,0.06);
    color: #fff;
}
.sc-week-trigger-score.tier-fp { background: rgba(192,132,252,0.16); color: #c084fc; }
.sc-week-trigger-score.tier-f  { background: rgba(96,165,250,0.16); color: #60a5fa; }
.sc-week-trigger-score.tier-g  { background: rgba(34,197,94,0.16);  color: #4ade80; }
.sc-week-trigger-score.tier-fa { background: rgba(251,191,36,0.16); color: #fbbf24; }
.sc-week-trigger-score.tier-p  { background: rgba(239,68,68,0.16);  color: #fca5a5; }

/* Dropdown panel */
.sc-week-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 320px;
    max-width: min(420px, 92vw);
    padding: 6px;
    border-radius: 12px;
    background: rgba(18,22,38,0.96);
    border: 1px solid rgba(255,255,255,0.10);
    box-shadow: 0 20px 60px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.05);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    animation: appMenuIn 0.16s ease;
    z-index: 200;
}
.sc-week-menu[hidden] { display: none; }

/* Search row at the top of the dropdown */
.sc-week-search-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    margin-bottom: 4px;
    border-radius: 8px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
}
.sc-week-search-row svg { flex-shrink: 0; color: rgba(255,255,255,0.45); }
.sc-week-search-row input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-family: inherit;
    font-size: 12.5px;
}
.sc-week-search-row input::placeholder { color: rgba(255,255,255,0.32); }

.sc-week-search-hint {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9.5px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Scrollable list of weeks */
.sc-week-list {
    max-height: min(440px, 60vh);
    overflow-y: auto;
    /* Slim scrollbar — Firefox + WebKit */
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.18) transparent;
}
.sc-week-list::-webkit-scrollbar { width: 6px; }
.sc-week-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
.sc-week-list::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.28); }

/* Each week row */
.sc-week-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 11px;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.82);
    font-family: inherit;
    text-align: left;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.12s ease;
}
.sc-week-item:hover,
.sc-week-item:focus-visible {
    background: rgba(255,255,255,0.05);
    color: #fff;
    outline: none;
}
.sc-week-item.is-active {
    background: linear-gradient(180deg, rgba(245,158,11,0.10), rgba(245,158,11,0.04));
    border: 1px solid rgba(245,158,11,0.25);
    padding: 8px 10px; /* offset for border */
}
.sc-week-item-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 2px;
}
.sc-week-item-label {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
}
.sc-week-item-label strong { color: #fbbf24; font-weight: 800; }
.sc-week-item-year { color: rgba(255,255,255,0.55); font-weight: 600; }
.sc-week-item-meta {
    font-size: 10.5px;
    font-weight: 600;
    color: rgba(255,255,255,0.45);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sc-week-item-score {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 800;
    padding: 4px 9px;
    border-radius: 6px;
    background: rgba(255,255,255,0.06);
    color: #fff;
    flex-shrink: 0;
    letter-spacing: -0.01em;
}
.sc-week-item-score.tier-fp { background: rgba(192,132,252,0.16); color: #c084fc; border: 1px solid rgba(192,132,252,0.28); }
.sc-week-item-score.tier-f  { background: rgba(96,165,250,0.16); color: #60a5fa; border: 1px solid rgba(96,165,250,0.28); }
.sc-week-item-score.tier-g  { background: rgba(34,197,94,0.16);  color: #4ade80; border: 1px solid rgba(34,197,94,0.28); }
.sc-week-item-score.tier-fa { background: rgba(251,191,36,0.16); color: #fbbf24; border: 1px solid rgba(251,191,36,0.28); }
.sc-week-item-score.tier-p  { background: rgba(239,68,68,0.16);  color: #fca5a5; border: 1px solid rgba(239,68,68,0.28); }

.sc-week-item-check {
    flex-shrink: 0;
    color: #fbbf24;
}

.sc-week-empty {
    padding: 24px 12px;
    text-align: center;
    color: rgba(255,255,255,0.40);
    font-size: 12px;
    font-weight: 600;
}
.sc-week-empty[hidden] { display: none; }

@media (max-width: 540px) {
    .sc-week-menu { right: 0; left: 0; min-width: 0; max-width: none; }
}

/* Upload button — gradient like the splash CTA but compact */
.sc-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: 9px;
    border: none;
    background: linear-gradient(135deg, #f59e0b 0%, #fb923c 50%, #ef4444 100%);
    color: #fff;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 800;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(245,158,11,0.30), inset 0 1px 0 rgba(255,255,255,0.22);
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.sc-upload-btn:hover { transform: translateY(-1px); filter: brightness(1.06); box-shadow: 0 12px 28px rgba(245,158,11,0.40), inset 0 1px 0 rgba(255,255,255,0.25); }
.sc-upload-btn:active { transform: scale(0.97); }

/* ===== Aggregate-mode depot grid ===== */
/* Each card is now a rich panel: hero score + sparkline + fleet bar
   + top driver. Grid sized for ~340px cards so all that content has
   room to breathe; falls back to 1-col on narrow viewports. */
.sc-depot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 14px;
}
.sc-depot-card {
    display: block;
    padding: 18px 20px 16px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.07);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0)),
        rgba(15,20,34,0.55);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    text-decoration: none;
    color: inherit;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
    position: relative;
    overflow: hidden;
}
.sc-depot-card.is-empty { opacity: 0.65; }
.sc-depot-card:hover {
    transform: translateY(-3px);
    border-color: rgba(245,158,11,0.32);
    background:
        linear-gradient(180deg, rgba(245,158,11,0.05), rgba(255,255,255,0)),
        rgba(15,20,34,0.70);
    box-shadow: 0 20px 40px rgba(0,0,0,0.30), 0 0 24px rgba(245,158,11,0.06);
}

/* Top row: code · home badge · spacer · week meta on the right.
   The week label sits at the head now (not at the foot) so the eye
   pairs depot ↔ week before parsing the score. */
.sc-depot-card-head {
    display: flex; align-items: center; gap: 7px;
    margin-bottom: 4px;
}
.sc-depot-card-week {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    font-weight: 700;
    color: rgba(255,255,255,0.45);
    letter-spacing: 0.02em;
}
.sc-depot-card-week strong { color: #fbbf24; font-weight: 800; }

.sc-depot-code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #fbbf24;
}
.sc-depot-card-name {
    font-size: 12px;
    font-weight: 700;
    color: rgba(255,255,255,0.65);
    margin-bottom: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Hero block: big score + tier pill on the left, WoW delta chip on
   the right. Treat as a horizontal flex with the WoW chip pushed
   to the end. */
.sc-depot-card-hero {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}
.sc-depot-card-score-row {
    display: flex; align-items: center; gap: 10px;
}
.sc-depot-score {
    font-family: 'JetBrains Mono', monospace;
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1;
    color: #fff;
}

/* WoW delta chip — colour-coded by direction. Up = green, down = red,
   flat = neutral grey. Icon + signed number in mono. */
.sc-depot-wow {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 4px 9px;
    border-radius: 999px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    border: 1px solid;
    white-space: nowrap;
}
.sc-depot-wow-up   { color: #4ade80; background: rgba(34,197,94,0.12); border-color: rgba(34,197,94,0.30); }
.sc-depot-wow-down { color: #fca5a5; background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.30); }
.sc-depot-wow-flat { color: rgba(255,255,255,0.55); background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.10); }

/* Sparkline — tier-coloured currentColor with a soft gradient fill
   underneath. Sized 220×38, scales to card width via preserveAspectRatio
   = none on the svg attribute. */
.sc-depot-spark {
    width: 100%;
    height: 42px;
    display: block;
    margin-bottom: 4px;
    color: rgba(255,255,255,0.55);
}
.sc-depot-spark-fp { color: #c084fc; }
.sc-depot-spark-f  { color: #60a5fa; }
.sc-depot-spark-g  { color: #4ade80; }
.sc-depot-spark-fa { color: #fbbf24; }
.sc-depot-spark-p  { color: #f87171; }
.sc-depot-spark-axis {
    display: flex; justify-content: space-between;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9.5px;
    font-weight: 600;
    color: rgba(255,255,255,0.30);
    margin-bottom: 14px;
    letter-spacing: 0.02em;
}

/* Fleet split mini-bar — stacked horizontal segments, total ≤ 100%.
   Each segment coloured by tier. Tooltip-friendly: width is computed
   server-side from tier counts. */
.sc-depot-fleet { margin-bottom: 12px; }
.sc-depot-fleet-bar {
    display: flex;
    width: 100%;
    height: 6px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255,255,255,0.04);
    margin-bottom: 6px;
}
.sc-depot-fleet-seg { display: block; height: 100%; }
.sc-depot-fleet-seg-fp { background: linear-gradient(90deg, #a855f7, #c084fc); }
.sc-depot-fleet-seg-f  { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.sc-depot-fleet-seg-g  { background: linear-gradient(90deg, #22c55e, #4ade80); }
.sc-depot-fleet-seg-fa { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.sc-depot-fleet-seg-p  { background: linear-gradient(90deg, #dc2626, #f87171); }
.sc-depot-fleet-meta {
    display: flex; align-items: center; justify-content: space-between;
    font-family: 'DM Sans', sans-serif;
    font-size: 11px;
    color: rgba(255,255,255,0.55);
}
.sc-depot-fleet-meta strong { color: #fff; font-weight: 800; }
.sc-depot-fleet-pct {
    color: #4ade80;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
}

/* Top driver chip — small horizontal row with trophy emoji, label,
   name, score. Reads as a meta-line under the fleet bar. */
.sc-depot-topdrv {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 12px;
    border-radius: 10px;
    background: rgba(255,255,255,0.025);
    border: 1px solid rgba(255,255,255,0.06);
    font-size: 12px;
}
.sc-depot-topdrv-icon { font-size: 13px; line-height: 1; }
.sc-depot-topdrv-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    color: rgba(255,255,255,0.40);
}
.sc-depot-topdrv-name {
    flex: 1;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.sc-depot-topdrv-score {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: -0.01em;
    flex-shrink: 0;
}

.sc-depot-card-empty {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255,255,255,0.40);
    padding: 24px 0 8px;
    text-align: center;
}

/* ===== Score summary banner ===== */
.sc-summary {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 24px;
    padding: 24px 28px;
    margin-bottom: 16px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.07);
    background:
        radial-gradient(circle at 0% 0%, rgba(245,158,11,0.06), transparent 40%),
        radial-gradient(circle at 100% 100%, rgba(99,102,241,0.06), transparent 45%),
        linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0)),
        rgba(15,20,34,0.55);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 18px 40px rgba(0,0,0,0.30), inset 0 1px 0 rgba(255,255,255,0.04);
}
@media (max-width: 720px) {
    .sc-summary { grid-template-columns: 1fr; padding: 18px; }
}
.sc-summary-week {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.52);
    text-transform: uppercase;
    margin-bottom: 12px;
    display: flex; align-items: center; gap: 6px;
}
.sc-summary-week strong { color: #fbbf24; font-weight: 800; }
.sc-summary-score-row {
    display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap;
}
.sc-summary-score {
    font-family: 'JetBrains Mono', monospace;
    font-size: 72px;
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 0.9;
    color: #fff;
}
.sc-summary-tier-block {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
    padding-bottom: 6px;
}
.sc-summary-stats {
    display: flex;
    align-items: center;
    gap: 24px;
}
.sc-mini-stat {
    text-align: right;
}
.sc-mini-stat-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
    color: #fff;
}
.sc-mini-stat-label {
    font-size: 10.5px;
    font-weight: 700;
    color: rgba(255,255,255,0.50);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 5px;
}

/* ===== Tier filter chips ===== */
.sc-tier-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 14px;
}
.sc-tier-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.03);
    color: rgba(255,255,255,0.70);
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}
.sc-tier-chip:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sc-tier-chip.is-active {
    background: rgba(245,158,11,0.12);
    border-color: rgba(245,158,11,0.35);
    color: #fbbf24;
}
.sc-tier-chip.is-active.tier-fp { background: rgba(192,132,252,0.14); border-color: rgba(192,132,252,0.35); color: #c084fc; }
.sc-tier-chip.is-active.tier-f  { background: rgba(96,165,250,0.14);  border-color: rgba(96,165,250,0.35);  color: #60a5fa; }
.sc-tier-chip.is-active.tier-g  { background: rgba(34,197,94,0.14);   border-color: rgba(34,197,94,0.35);   color: #4ade80; }
.sc-tier-chip.is-active.tier-fa { background: rgba(251,191,36,0.14);  border-color: rgba(251,191,36,0.35);  color: #fbbf24; }
.sc-tier-chip.is-active.tier-p  { background: rgba(239,68,68,0.14);   border-color: rgba(239,68,68,0.35);   color: #fca5a5; }
.sc-tier-chip-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px; height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    color: inherit;
    font-size: 11px;
    font-weight: 800;
}

/* ===== Drivers table ===== */
.sc-drivers-card { padding: 16px 18px; }
.sc-drivers-card .app-card-header { margin-bottom: 10px; }

.sc-search {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 11px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.65);
    transition: border-color 0.15s ease, background 0.15s ease;
}
.sc-search:focus-within {
    border-color: rgba(245,158,11,0.40);
    background: rgba(255,255,255,0.06);
}
.sc-search input {
    background: transparent;
    border: none;
    color: #fff;
    font-family: inherit;
    font-size: 12.5px;
    width: 180px;
    outline: none;
}
.sc-search input::placeholder { color: rgba(255,255,255,0.32); }

.sc-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.sc-table {
    width: 100%;
    border-collapse: collapse;
}
.sc-table thead th {
    text-align: left;
    padding: 10px 12px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.45);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sc-table tbody td {
    padding: 11px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    vertical-align: middle;
}
.sc-table tbody tr:hover td {
    background: rgba(255,255,255,0.02);
}
.sc-col-rank { width: 50px; }
.sc-col-tier { width: 130px; }
.sc-col-score, .sc-col-del { width: 110px; text-align: right; }
.sc-table thead .sc-col-score, .sc-table thead .sc-col-del { text-align: right; }

.sc-rank {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    color: rgba(255,255,255,0.35);
}
.sc-rank.is-top.is-1 { color: #fde68a; }
.sc-rank.is-top.is-2 { color: #e5e7eb; }
.sc-rank.is-top.is-3 { color: #fdba74; }

.sc-driver { display: flex; align-items: center; gap: 10px; }
.sc-driver-name { font-size: 13px; font-weight: 700; color: #fff; }
.sc-driver-id {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    font-weight: 600;
    color: rgba(255,255,255,0.40);
    margin-top: 1px;
}

.sc-score-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}

.sc-table-foot {
    padding: 12px 4px 2px;
    font-size: 12px;
    color: rgba(255,255,255,0.50);
    font-weight: 600;
    text-align: right;
}
.sc-table-foot strong { color: #fff; font-weight: 800; }

@media (max-width: 720px) {
    .sc-col-del { display: none; }
    .sc-driver-id { display: none; }
    .sc-summary-score { font-size: 56px; }
    .sc-summary-stats { gap: 18px; }
    .sc-mini-stat-value { font-size: 22px; }
    .sc-search input { width: 130px; }
}

/* ===== Upload progress overlay ===== */
.sc-upload-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(7,11,20,0.78);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
/* The HTML 'hidden' attribute relies on the UA stylesheet rule
   `[hidden] { display: none }`. Authoring CSS like `display: flex`
   above (higher specificity than UA styles) overrides it, which
   meant the overlay rendered on page load instead of waiting for
   the upload to start. Explicit override keeps `hidden` working. */
.sc-upload-overlay[hidden] { display: none; }
.sc-upload-card {
    padding: 32px 40px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(18,22,38,0.96);
    text-align: center;
    box-shadow: 0 40px 100px rgba(0,0,0,0.5);
    max-width: 380px;
}
.sc-upload-spinner {
    width: 36px; height: 36px;
    margin: 0 auto 16px;
    border-radius: 50%;
    border: 3px solid rgba(245,158,11,0.18);
    border-top-color: #fbbf24;
    animation: scSpin 0.8s linear infinite;
}
@keyframes scSpin { to { transform: rotate(360deg); } }
.sc-upload-msg {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
}
.sc-upload-sub {
    font-size: 12px;
    color: rgba(255,255,255,0.55);
}

/* ============================================================
   SCORECARDS — metric breakdown grid
   ============================================================ */

.sc-metrics-card { margin-bottom: 16px; padding: 18px 20px; }
.sc-metric-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 10px;
}
@media (max-width: 1100px) { .sc-metric-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 540px)  { .sc-metric-grid { grid-template-columns: repeat(2, 1fr); } }

.sc-metric-tile {
    padding: 12px 13px;
    border-radius: 11px;
    border: 1px solid rgba(255,255,255,0.07);
    background: rgba(255,255,255,0.02);
    transition: border-color 0.15s ease, background 0.15s ease;
}
.sc-metric-tile:hover { border-color: rgba(255,255,255,0.16); background: rgba(255,255,255,0.04); }

/* Tier-tinted accent on the left edge — subtle, doesn't overpower */
.sc-metric-tile.tier-f  { border-left: 2px solid #60a5fa; }
.sc-metric-tile.tier-g  { border-left: 2px solid #4ade80; }
.sc-metric-tile.tier-fa { border-left: 2px solid #fbbf24; }
.sc-metric-tile.tier-p  { border-left: 2px solid #f87171; }

.sc-metric-tile-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 8px;
}
.sc-metric-abbr {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: rgba(255,255,255,0.62);
    text-transform: uppercase;
}
/* Small amber dot next to the metric abbrev when this depot uses a
   customized target (different from Amazon's default). Lets the user
   see at a glance which metrics are tuned for this site. */
.sc-metric-custom {
    display: inline-block;
    margin-left: 4px;
    color: #fbbf24;
    font-size: 14px;
    line-height: 0;
    vertical-align: middle;
}
.sc-metric-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    display: inline-block;
}
.sc-metric-dot.tier-f  { background: #60a5fa; box-shadow: 0 0 6px rgba(96,165,250,0.55); }
.sc-metric-dot.tier-g  { background: #4ade80; box-shadow: 0 0 6px rgba(74,222,128,0.55); }
.sc-metric-dot.tier-fa { background: #fbbf24; box-shadow: 0 0 6px rgba(251,191,36,0.55); }
.sc-metric-dot.tier-p  { background: #f87171; box-shadow: 0 0 6px rgba(248,113,113,0.55); }

.sc-metric-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
    color: #fff;
    margin-bottom: 8px;
}
.sc-metric-foot {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 10px;
    font-weight: 600;
    color: rgba(255,255,255,0.42);
}
.sc-metric-direction { font-style: italic; }
.sc-metric-target {
    font-family: 'JetBrains Mono', monospace;
    color: rgba(255,255,255,0.50);
}

/* ============================================================
   SCORECARDS — wide drivers table (with metric columns)
   ============================================================ */

.sc-drivers-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sc-export-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 11px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.75);
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}
.sc-export-btn:hover {
    background: rgba(245,158,11,0.10);
    border-color: rgba(245,158,11,0.30);
    color: #fbbf24;
}
.sc-export-btn:active { transform: scale(0.97); }
.sc-export-btn svg { flex-shrink: 0; opacity: 0.75; }

/* Wide-mode table — tighter columns, smaller font, metric tier
   coloring on each metric cell. */
.sc-table-wide { font-size: 12.5px; }
.sc-table-wide thead th { padding: 9px 10px; font-size: 10px; }
.sc-table-wide tbody td { padding: 9px 10px; }
.sc-col-metric {
    width: 64px;
    text-align: right;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    color: rgba(255,255,255,0.85);
}
.sc-table-wide thead .sc-col-metric { text-align: right; }

/* Per-metric tier cell tinting — same palette as tier-pill, much
   lower opacity so reading the number is still easy. Using a flat
   background colour rather than a border to keep the table grid
   visually clean. */
/* Tier-coloured metric cells. Strategy: leave Fantastic and Great
   cells with a NEUTRAL background (no tint) so the entire table doesn't
   read as one giant blue rectangle. Only Fair and Poor get a tinted
   background — those are the cells the eye should land on. Text colour
   still carries the tier info on all rows, so the encoding isn't lost.

   Why this matters: at Fantastic-dominated depots like DPE2 every cell
   was painted blue (rgba(96,165,250,0.10)) and the table looked
   washed-out. Now the good rows read as clean text and the problem
   rows pop. */
.sc-col-metric.metric-f  { color: #93c5fd; }
.sc-col-metric.metric-g  { color: #86efac; }
.sc-col-metric.metric-fa { background: rgba(251,191,36,0.10); color: #fcd34d; }
.sc-col-metric.metric-p  { background: rgba(239,68,68,0.10);  color: #fca5a5; }
.sc-col-metric.metric-empty { color: rgba(255,255,255,0.30); }

.sc-table-hint {
    display: inline-block;
    margin-right: 12px;
    color: rgba(255,255,255,0.35);
    font-weight: 600;
    font-size: 11px;
}

/* Highlight the entire row on hover, but keep the metric tints
   visible underneath by using a subtle outer rather than overriding
   the cell colors. */
.sc-table tbody tr:hover td.sc-col-metric { background-color: rgba(255,255,255,0.03); }
.sc-table tbody tr:hover td.sc-col-metric.metric-fa { background-color: rgba(251,191,36,0.16); }
.sc-table tbody tr:hover td.sc-col-metric.metric-p  { background-color: rgba(239,68,68,0.16); }

@media (max-width: 900px) {
    .sc-drivers-actions { gap: 6px; }
    .sc-search input { width: 110px; }
    .sc-export-btn span { display: none; }
}

/* ============================================================
   SETTINGS PAGE
   ============================================================ */

/* Immutability reassurance banner — placed prominently at top of
   the settings page. Green/teal palette (security/trust) to
   differentiate from amber action affordances elsewhere. */
.settings-immutable {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
    padding: 14px 18px;
    border-radius: 12px;
    border: 1px solid rgba(45,212,191,0.25);
    background: linear-gradient(180deg, rgba(45,212,191,0.10), rgba(45,212,191,0.04));
}
.settings-immutable-icon {
    flex-shrink: 0;
    width: 38px; height: 38px;
    border-radius: 10px;
    background: rgba(45,212,191,0.16);
    border: 1px solid rgba(45,212,191,0.32);
    color: #5eead4;
    display: flex; align-items: center; justify-content: center;
}
.settings-immutable-text {
    flex: 1;
    color: rgba(226,232,240,0.82);
    font-size: 12.5px;
    line-height: 1.55;
}
.settings-immutable-text strong {
    display: block;
    color: #fff;
    font-size: 13.5px;
    font-weight: 800;
    margin-bottom: 2px;
}
.settings-immutable-text em {
    font-style: italic;
    color: #5eead4;
}

/* Settings card — same chrome as .app-card but with looser internal
   padding to give the table room to breathe. */
.settings-card { padding: 14px 18px 18px; }

/* Targets table — wide table, tabular numeric input columns */
.settings-targets-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.settings-targets-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}
.settings-targets-table thead th {
    text-align: left;
    padding: 11px 12px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.50);
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.settings-targets-table .st-col-num,
.settings-targets-table .st-col-weight { text-align: right; }
.settings-targets-table .st-col-status { width: 90px; }

.settings-targets-table tbody td {
    padding: 11px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    vertical-align: middle;
}
.settings-targets-table tbody tr:hover td { background: rgba(255,255,255,0.02); }

.st-metric-name { display: flex; flex-direction: column; gap: 2px; }
.st-metric-abbr {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: #fff;
}
.st-metric-full {
    font-size: 10.5px;
    font-weight: 600;
    color: rgba(255,255,255,0.45);
}

.st-direction {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    border: 1px solid;
}
.st-direction.is-higher { color: #4ade80; background: rgba(34,197,94,0.10); border-color: rgba(34,197,94,0.25); }
.st-direction.is-lower  { color: #60a5fa; background: rgba(96,165,250,0.10); border-color: rgba(96,165,250,0.25); }

/* Input fields */
.st-input-wrap {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 8px;
    padding: 2px 6px 2px 8px;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.st-input-wrap:focus-within {
    border-color: rgba(245,158,11,0.45);
    background: rgba(255,255,255,0.07);
    box-shadow: 0 0 0 3px rgba(245,158,11,0.10);
}
.st-input {
    width: 80px;
    padding: 7px 4px;
    background: transparent;
    border: none;
    color: #fff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    text-align: right;
    outline: none;
    /* hide the spinner arrows; keyboard arrows still work */
    -moz-appearance: textfield;
}
.st-input::-webkit-outer-spin-button,
.st-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.st-unit {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.40);
    pointer-events: none;
}

.st-row-status { display: inline-flex; align-items: center; }
.st-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid;
}
.st-pill-custom { color: #fbbf24; background: rgba(245,158,11,0.10); border-color: rgba(245,158,11,0.30); }
.st-pill-ok     { color: #4ade80; background: rgba(34,197,94,0.12);  border-color: rgba(34,197,94,0.30); }
.st-pill-warn   { color: #fca5a5; background: rgba(239,68,68,0.12);  border-color: rgba(239,68,68,0.30); }

.settings-targets-table tfoot td {
    padding: 14px 12px 4px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.st-foot-label {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
}
.st-foot-label small {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: rgba(255,255,255,0.45);
    margin-top: 2px;
}
.st-weight-sum {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 800;
    color: #fff;
}
.st-sum-status { display: inline-flex; align-items: center; }

/* Action bar at the bottom of the form */
.settings-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.settings-action-msg {
    flex: 1;
    font-size: 12.5px;
    font-weight: 600;
    color: rgba(255,255,255,0.55);
    transition: color 0.15s ease;
}
.settings-action-msg.is-ok      { color: #4ade80; }
.settings-action-msg.is-error   { color: #fca5a5; }
.settings-action-msg.is-pending { color: #fbbf24; }
.settings-action-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.settings-reset-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 14px;
    border-radius: 9px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.03);
    color: rgba(255,255,255,0.70);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}
.settings-reset-btn:hover {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.18);
    color: #fff;
}
.settings-reset-btn svg { opacity: 0.75; flex-shrink: 0; }

.settings-save-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 18px;
    border-radius: 9px;
    border: none;
    background: linear-gradient(135deg, #f59e0b 0%, #fb923c 50%, #ef4444 100%);
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(245,158,11,0.30), inset 0 1px 0 rgba(255,255,255,0.22);
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease, opacity 0.15s ease;
}
.settings-save-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    filter: brightness(1.06);
    box-shadow: 0 14px 30px rgba(245,158,11,0.40), inset 0 1px 0 rgba(255,255,255,0.25);
}
.settings-save-btn:active:not(:disabled) { transform: scale(0.97); }
.settings-save-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.settings-save-btn.is-loading { cursor: progress; }
.settings-save-btn.is-loading svg { animation: stSpin 0.8s linear infinite; }
@keyframes stSpin { to { transform: rotate(360deg); } }

@media (max-width: 720px) {
    .settings-action-bar { flex-direction: column; align-items: stretch; }
    .settings-action-buttons { justify-content: space-between; }
    .st-input { width: 64px; font-size: 12.5px; }
    .st-metric-full { display: none; }
}

/* ============================================================
   SETTINGS — Custom sliders (tier cut-offs + penalties)
   ============================================================
   Native <input type=range> styled to match the dark theme.
   The thumb + active track are coloured via a --st-pct CSS var
   that JS updates on each input event, so the filled portion
   visually tracks the value.
*/

.st-slider-group {
    padding: 14px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.st-slider-group:last-of-type { border-bottom: none; padding-bottom: 4px; }
.st-slider-group:first-of-type { padding-top: 6px; }

.st-slider-group-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.st-slider-group-title {
    margin: 0;
    color: #fff;
    font-size: 13.5px;
    font-weight: 800;
    letter-spacing: 0.02em;
}
.st-slider-group-sub {
    color: rgba(255,255,255,0.50);
    font-size: 12px;
    font-weight: 600;
}

.st-slider-row {
    display: grid;
    grid-template-columns: 180px 1fr 130px;
    align-items: center;
    gap: 16px;
    padding: 10px 4px;
    border-radius: 8px;
    transition: background 0.15s ease;
}
.st-slider-row:hover { background: rgba(255,255,255,0.02); }

@media (max-width: 720px) {
    .st-slider-row { grid-template-columns: 1fr; gap: 8px; padding: 12px 4px; }
}

.st-slider-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: rgba(255,255,255,0.82);
}
.st-slider-help {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.50);
    font-size: 11px;
    font-weight: 700;
    cursor: help;
}
.st-slider-help:hover { background: rgba(245,158,11,0.16); color: #fbbf24; }

/* Slider control + min/max labels under the track */
.st-slider-control {
    position: relative;
    padding: 4px 0 14px;
}

/* Tier-tinted accent colour per row — falls back to amber for
   penalties (no .tier-* class). Set via custom property so the
   range track gradient picks it up. */
.st-slider-row { --st-accent: #fbbf24; --st-accent-soft: rgba(251,191,36,0.18); }
.st-slider-row.tier-fp { --st-accent: #c084fc; --st-accent-soft: rgba(192,132,252,0.20); }
.st-slider-row.tier-f  { --st-accent: #60a5fa; --st-accent-soft: rgba(96,165,250,0.20); }
.st-slider-row.tier-g  { --st-accent: #4ade80; --st-accent-soft: rgba(74,222,128,0.20); }
.st-slider-row.tier-fa { --st-accent: #fbbf24; --st-accent-soft: rgba(251,191,36,0.20); }

/* Range input — custom styled track + thumb */
.st-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 999px;
    /* Active portion (0% → --st-pct) is tier-coloured; rest is dim.
       JS sets --st-pct on each input event. */
    background: linear-gradient(to right,
        var(--st-accent) 0%,
        var(--st-accent) var(--st-pct, 50%),
        rgba(255,255,255,0.08) var(--st-pct, 50%),
        rgba(255,255,255,0.08) 100%);
    outline: none;
    cursor: pointer;
    margin: 0;
}

/* WebKit thumb */
.st-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--st-accent);
    border: 3px solid #0a0f1e;
    box-shadow: 0 0 0 1px var(--st-accent), 0 4px 12px rgba(0,0,0,0.4);
    cursor: grab;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.st-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 0 0 1px var(--st-accent), 0 0 0 6px var(--st-accent-soft), 0 4px 12px rgba(0,0,0,0.4);
}
.st-slider:active::-webkit-slider-thumb { cursor: grabbing; transform: scale(1.05); }

/* Firefox thumb + track */
.st-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--st-accent);
    border: 3px solid #0a0f1e;
    box-shadow: 0 0 0 1px var(--st-accent), 0 4px 12px rgba(0,0,0,0.4);
    cursor: grab;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.st-slider::-moz-range-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 0 0 1px var(--st-accent), 0 0 0 6px var(--st-accent-soft), 0 4px 12px rgba(0,0,0,0.4);
}
.st-slider::-moz-range-track {
    height: 6px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
}
.st-slider::-moz-range-progress {
    height: 6px;
    border-radius: 999px;
    background: var(--st-accent);
}

.st-slider:focus { outline: none; }
.st-slider:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 1px var(--st-accent), 0 0 0 6px var(--st-accent-soft), 0 4px 12px rgba(0,0,0,0.4);
}
.st-slider:focus::-moz-range-thumb {
    box-shadow: 0 0 0 1px var(--st-accent), 0 0 0 6px var(--st-accent-soft), 0 4px 12px rgba(0,0,0,0.4);
}

/* Min/max labels under the track */
.st-slider-track-min,
.st-slider-track-max {
    position: absolute;
    bottom: 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    color: rgba(255,255,255,0.35);
}
.st-slider-track-min { left: 0; }
.st-slider-track-max { right: 0; }

/* Value pill on the right side of the row */
.st-slider-value {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}
.st-slider-output {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 800;
    color: var(--st-accent);
    min-width: 56px;
    text-align: right;
    padding: 4px 9px;
    border-radius: 7px;
    background: var(--st-accent-soft);
    border: 1px solid rgba(255,255,255,0.06);
    letter-spacing: -0.01em;
}
.st-slider-pill {
    min-width: 0;
}
.st-slider-pill:empty { display: none; }

@media (max-width: 720px) {
    .st-slider-value { justify-content: flex-start; padding-left: 0; }
    .st-slider-output { min-width: 0; }
}

/* ============================================================
   SCORECARDS — admin points layout (stacked: value + points)
   ============================================================
   Each metric cell shows the raw metric value on top, with the
   points contribution shown below in a smaller monospace label
   for admins. Both visible at once — no toggle. Matches the old
   admin UI pattern (.mv + .mp).
*/

.sc-col-metric {
    line-height: 1.2;
    vertical-align: middle;
    /* Slightly tighter padding to give the two-line layout room
       without making rows too tall. */
    padding-top: 8px;
    padding-bottom: 8px;
}

.sc-cell-value {
    display: block;
    font-weight: 700;
}

/* ----------------------------------------------------------------
   Per-metric points readout — small "17.8/17.8" pair under the
   metric value. Tier-tinted text colour matches the pts-* scale
   so a quick scan tells you both "what value" (the big number)
   and "how well it scored" (colour of the small number).

   Compact format on purpose: no plus prefix, no spaces around the
   slash, mono font for column-aligned digits, nowrap so it never
   wraps the way the older "+17.8 / 17.8" did on narrow columns.
   Full breakdown (X / Y pts · NN% of max) lives in the cell title
   attribute on hover.
   ---------------------------------------------------------------- */
.sc-cell-pts {
    display: block;
    margin-top: 3px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
    white-space: nowrap;
    opacity: 0.85;
}
.sc-cell-pts-sep {
    color: rgba(255,255,255,0.30);
    margin: 0 1px;
    font-weight: 600;
}
.sc-cell-pts.pts-f  { color: #93c5fd; }
.sc-cell-pts.pts-g  { color: #86efac; }
.sc-cell-pts.pts-fa { color: #fcd34d; }
.sc-cell-pts.pts-p  { color: #fca5a5; }
.sc-cell-pts.pts-null {
    color: rgba(255,255,255,0.28);
    font-style: italic;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* Legacy bar viz CSS — kept so cached pages don't render an
   unstyled empty bar. New markup uses .sc-cell-pts above. */
.sc-cell-bar {
    display: block;
    height: 3px;
    margin-top: 5px;
    background: rgba(255,255,255,0.06);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}
.sc-cell-bar-fill {
    display: block;
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease, background 0.2s ease;
    background: rgba(255,255,255,0.30);
}
.sc-cell-bar.bar-f  .sc-cell-bar-fill { background: linear-gradient(90deg, #60a5fa, #93c5fd); }
.sc-cell-bar.bar-g  .sc-cell-bar-fill { background: linear-gradient(90deg, #22c55e, #86efac); }
.sc-cell-bar.bar-fa .sc-cell-bar-fill { background: linear-gradient(90deg, #f59e0b, #fcd34d); }
.sc-cell-bar.bar-p  .sc-cell-bar-fill { background: linear-gradient(90deg, #dc2626, #fca5a5); }
.sc-cell-bar.bar-null { background: transparent; height: auto; margin-top: 3px; }
.sc-cell-bar-null-text {
    display: inline-block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    color: rgba(255,255,255,0.30);
    font-style: italic;
}

/* PDF button — uses the same sc-export-btn class but with a red
   accent on hover to distinguish it from CSV at a glance. */
.sc-pdf-btn { text-decoration: none; }
.sc-pdf-btn:hover {
    border-color: rgba(239,68,68,0.35);
    color: #fca5a5;
}
.sc-pdf-btn:hover svg { color: #fca5a5; }

/* ============================================================
   HOME — Fleet Health & WoW Movers
   ============================================================
   Pulled in from the legacy dashboard.php which is being retired —
   tier distribution bar + week-over-week mover lists.
*/

/* Fleet health card — explicit margin-bottom for consistent rhythm
   with the other home-page sections (KPI row, Yearly Champions row,
   Last Week recap, etc.). Without this the fleet card hugged the
   next section because .app-card has no default margin. */
.fleet-card { padding: 16px 18px 14px; margin-bottom: 18px; }
.fleet-total {
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    color: rgba(255,255,255,0.65);
    letter-spacing: -0.01em;
}

.fleet-bar {
    display: flex;
    height: 32px;
    border-radius: 8px;
    overflow: hidden;
    margin: 10px 0 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
}
.fleet-bar-seg {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0a0f1e;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
    font-weight: 800;
    transition: filter 0.15s ease;
    overflow: hidden;
    min-width: 0;
}
.fleet-bar-seg:hover { filter: brightness(1.10); }
.fleet-bar-seg.tier-fp { background: linear-gradient(180deg, #c084fc, #a855f7); }
.fleet-bar-seg.tier-f  { background: linear-gradient(180deg, #60a5fa, #3b82f6); }
.fleet-bar-seg.tier-g  { background: linear-gradient(180deg, #4ade80, #22c55e); }
.fleet-bar-seg.tier-fa { background: linear-gradient(180deg, #fbbf24, #f59e0b); }
.fleet-bar-seg.tier-p  { background: linear-gradient(180deg, #f87171, #dc2626); }
.fleet-bar-seg-label {
    text-shadow: 0 1px 1px rgba(0,0,0,0.18);
}

.fleet-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    padding-top: 4px;
}
.fleet-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255,255,255,0.72);
}
.fleet-legend-item.is-zero { opacity: 0.30; }
.fleet-legend-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
}
.fleet-legend-dot.tier-fp { background: #a855f7; }
.fleet-legend-dot.tier-f  { background: #3b82f6; }
.fleet-legend-dot.tier-g  { background: #22c55e; }
.fleet-legend-dot.tier-fa { background: #f59e0b; }
.fleet-legend-dot.tier-p  { background: #dc2626; }
.fleet-legend-label { color: #fff; }
.fleet-legend-count {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 800;
    color: #fff;
}
.fleet-legend-pct {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: rgba(255,255,255,0.45);
}

/* WoW Movers card — split into two columns (Improved / Declined) */
.movers-card { padding: 20px 22px; }
.movers-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}
@media (max-width: 720px) {
    .movers-grid { grid-template-columns: 1fr; gap: 8px; }
}
.movers-col {
    display: flex;
    flex-direction: column;
}
.movers-col-head {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    align-self: flex-start;
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}
.movers-col-head.movers-up {
    color: #4ade80;
    background: rgba(34,197,94,0.10);
    border: 1px solid rgba(34,197,94,0.28);
}
.movers-col-head.movers-down {
    color: #fca5a5;
    background: rgba(239,68,68,0.10);
    border: 1px solid rgba(239,68,68,0.28);
}

/* Movers row — matches .app-row geometry so both cards visually pair */
.movers-row {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 4px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: background 0.12s ease;
}
.movers-row:last-child { border-bottom: none; }
.movers-row:hover { background: rgba(255,255,255,0.03); }
.movers-avatar {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.78);
    /* width/height/font-size inherited from .app-row-avatar */
}
.movers-row-main {
    flex: 1;
    min-width: 0;
}
.movers-row-name {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.movers-row-meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.50);
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}
.movers-delta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 800;
    flex-shrink: 0;
    padding: 4px 10px;
    border-radius: 7px;
}
.movers-delta-up {
    color: #4ade80;
    background: rgba(34,197,94,0.10);
    border: 1px solid rgba(34,197,94,0.24);
}
.movers-delta-down {
    color: #fca5a5;
    background: rgba(239,68,68,0.10);
    border: 1px solid rgba(239,68,68,0.24);
}

.movers-empty {
    padding: 18px 8px;
    text-align: center;
    color: rgba(255,255,255,0.40);
    font-size: 11.5px;
    font-style: italic;
}

/* ============================================================
   RANKING PAGE
   ============================================================ */

/* Week group divider inside the week-picker dropdown — labels the
   "Year to date" vs "By week" sections. */
.rk-week-group {
    padding: 10px 11px 4px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.32);
    border-top: 1px solid rgba(255,255,255,0.06);
    margin-top: 4px;
}
.rk-week-group:first-child { border-top: none; margin-top: 0; }

/* Podium — three slots, ordered visually 2-1-3 so 1st sits centre */
.rk-podium-card { padding: 16px 18px 22px; }
.rk-podium {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
    align-items: end;
}
@media (max-width: 720px) {
    .rk-podium { grid-template-columns: 1fr; }
    .rk-podium-slot { order: initial !important; }
}
.rk-podium-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 12px 18px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.02);
    text-align: center;
    transition: transform 0.15s ease, border-color 0.15s ease;
}
.rk-podium-slot:hover { transform: translateY(-2px); border-color: rgba(255,255,255,0.16); }

/* Tinted accents on the three slots — gold / silver / bronze */
.rk-podium-slot.is-1 {
    border-color: rgba(251,191,36,0.32);
    background: linear-gradient(180deg, rgba(251,191,36,0.10), rgba(251,191,36,0.02));
    padding-top: 22px;
    padding-bottom: 22px;
    box-shadow: 0 12px 28px rgba(251,191,36,0.10);
}
.rk-podium-slot.is-2 {
    border-color: rgba(203,213,225,0.24);
    background: linear-gradient(180deg, rgba(203,213,225,0.06), rgba(203,213,225,0.01));
}
.rk-podium-slot.is-3 {
    border-color: rgba(245,158,11,0.20);
    background: linear-gradient(180deg, rgba(245,158,11,0.05), rgba(245,158,11,0.01));
}

.rk-podium-medal { font-size: 36px; line-height: 1; margin-bottom: 8px; }
.rk-podium-slot.is-1 .rk-podium-medal { font-size: 44px; }

.rk-podium-score {
    font-family: 'JetBrains Mono', monospace;
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
}
.rk-podium-slot.is-1 .rk-podium-score { font-size: 36px; }

.rk-podium-code {
    margin-top: 4px;
    font-size: 14px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.01em;
}
.rk-podium-name {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.55);
}
.rk-podium-meta {
    margin-top: 8px;
    font-size: 10.5px;
    font-weight: 600;
    color: rgba(255,255,255,0.40);
}
.rk-podium-extra {
    margin-top: 6px;
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(255,255,255,0.04);
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    font-weight: 600;
    color: rgba(255,255,255,0.55);
}

/* Full ranking table — reuses .sc-table chrome but tightens a few
   bits and adds depot-cell two-line layout. */
.rk-table tbody tr.rk-row td { vertical-align: middle; }
.rk-depot-name { font-size: 13.5px; font-weight: 800; color: #fff; }
.rk-depot-sub  { font-size: 10.5px; font-weight: 600; color: rgba(255,255,255,0.45); margin-top: 2px; }

.rk-avg-tag {
    margin-left: 4px;
    font-size: 10px;
    font-weight: 600;
    color: rgba(255,255,255,0.45);
    text-transform: lowercase;
}

.rk-wow {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
    font-weight: 800;
    border: 1px solid;
}
.rk-wow-up   { color: #4ade80; background: rgba(34,197,94,0.10); border-color: rgba(34,197,94,0.25); }
.rk-wow-down { color: #fca5a5; background: rgba(239,68,68,0.10); border-color: rgba(239,68,68,0.25); }
.rk-wow-flat { color: rgba(255,255,255,0.40); background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.06); }

.rk-spark svg { display: block; }
.rk-minmax {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
    font-weight: 700;
}
.rk-minmax-min { color: #fca5a5; }
.rk-minmax-max { color: #4ade80; }
.rk-minmax-sep { color: rgba(255,255,255,0.30); }

/* Trend legend below the multi-line chart */
.rk-trend-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.rk-trend-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
}
.rk-trend-legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.rk-trend-legend-name {
    color: #fff;
    font-weight: 700;
}
.rk-trend-legend-score {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 800;
}
.rk-trend-legend-delta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 700;
}

/* Difficulty analysis — one card per depot, metric-by-metric bars */
.rk-diff-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}
.rk-diff-card {
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    background: rgba(255,255,255,0.02);
    padding: 14px 16px;
    transition: border-color 0.15s ease, transform 0.15s ease;
}
.rk-diff-card:hover {
    border-color: rgba(255,255,255,0.16);
    transform: translateY(-2px);
}
.rk-diff-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.rk-diff-code {
    font-size: 14px;
    font-weight: 800;
    color: #fff;
}
.rk-diff-badge {
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid;
}
.rk-diff-badge.is-easy   { color: #4ade80; background: rgba(34,197,94,0.12);  border-color: rgba(34,197,94,0.28); }
.rk-diff-badge.is-med    { color: #60a5fa; background: rgba(96,165,250,0.12); border-color: rgba(96,165,250,0.28); }
.rk-diff-badge.is-hard   { color: #fbbf24; background: rgba(251,191,36,0.12); border-color: rgba(251,191,36,0.28); }
.rk-diff-badge.is-brutal { color: #fca5a5; background: rgba(239,68,68,0.12);  border-color: rgba(239,68,68,0.28); }

.rk-diff-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11.5px;
    font-weight: 600;
    padding-top: 6px;
    color: rgba(255,255,255,0.65);
}
.rk-diff-row-name { letter-spacing: 0.01em; }
.rk-diff-row-val {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
}
.rk-diff-row-val.is-good { color: #4ade80; }
.rk-diff-row-val.is-bad  { color: #fca5a5; }
.rk-diff-row-bar {
    height: 4px;
    background: rgba(255,255,255,0.04);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 4px;
    margin-bottom: 2px;
}
.rk-diff-row-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.4s ease;
}
.rk-diff-row-fill.is-good { background: #4ade80; }
.rk-diff-row-fill.is-bad  { background: #fca5a5; }

/* Metric comparison — one card per metric, depots ranked inside */
.rk-mc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}
.rk-mc-card {
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    background: rgba(255,255,255,0.02);
    padding: 14px 16px;
}
.rk-mc-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.rk-mc-head strong {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: #fff;
}
.rk-mc-dir {
    font-size: 10.5px;
    font-weight: 700;
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.rk-mc-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 600;
    padding-top: 6px;
    color: rgba(255,255,255,0.78);
}
.rk-mc-row-name { display: inline-flex; align-items: center; gap: 4px; }
.rk-mc-medal { color: #fbbf24; font-size: 11px; }
.rk-mc-row-val {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 12.5px;
}
.rk-mc-row-bar {
    height: 4px;
    background: rgba(255,255,255,0.04);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 4px;
    margin-bottom: 2px;
}
.rk-mc-row-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.4s ease;
}

/* ============================================================
   HISTORY PAGE
   ============================================================ */

/* Year filter pills — appear in the page actions row, work as a
   single-select tab strip. Click navigates with ?year= param. */
.hist-year-pills {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
}
.hist-year-pill {
    padding: 6px 12px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 700;
    color: rgba(255,255,255,0.55);
    text-decoration: none;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.01em;
    transition: color 0.12s ease, background 0.12s ease;
    line-height: 1;
}
.hist-year-pill:hover {
    color: #fff;
    background: rgba(255,255,255,0.04);
}
.hist-year-pill.is-active {
    color: #0c0f1a;
    background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%);
    box-shadow: 0 4px 10px rgba(251,191,36,0.25);
}

/* Year section divider inside the timeline card */
.hist-timeline-card { padding-bottom: 8px; }
.hist-year-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 4px 10px;
    margin-bottom: 4px;
}
.hist-year-row:first-of-type { padding-top: 6px; }
.hist-year-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 15px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.01em;
}
.hist-year-count {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255,255,255,0.40);
}
.hist-year-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(255,255,255,0.10), transparent);
}

/* Individual timeline entry — full-row clickable link */
.hist-entry {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 11px;
    border: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.02);
    text-decoration: none;
    color: inherit;
    margin-bottom: 8px;
    transition: border-color 0.12s ease, background 0.12s ease, transform 0.12s ease;
}
.hist-entry:hover {
    border-color: rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.04);
    transform: translateX(2px);
}

/* Week-number badge on the left — tier-coloured */
.hist-week-pill {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 11px;
    font-family: 'JetBrains Mono', monospace;
    border: 1px solid;
}
.hist-week-pill.tier-fp { color: #c084fc; background: rgba(168,85,247,0.12); border-color: rgba(168,85,247,0.30); }
.hist-week-pill.tier-f  { color: #60a5fa; background: rgba(96,165,250,0.12); border-color: rgba(96,165,250,0.30); }
.hist-week-pill.tier-g  { color: #4ade80; background: rgba(34,197,94,0.12);  border-color: rgba(34,197,94,0.30); }
.hist-week-pill.tier-fa { color: #fbbf24; background: rgba(251,191,36,0.12); border-color: rgba(251,191,36,0.30); }
.hist-week-pill.tier-p  { color: #fca5a5; background: rgba(239,68,68,0.12);  border-color: rgba(239,68,68,0.30); }
.hist-week-pre {
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.72;
    line-height: 1;
}
.hist-week-num {
    font-size: 19px;
    font-weight: 800;
    line-height: 1;
    margin-top: 2px;
}

/* Main info column — title + meta line */
.hist-entry-main { flex: 1; min-width: 0; }
.hist-entry-title {
    font-size: 13.5px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hist-entry-meta {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    font-size: 11.5px;
    font-weight: 600;
    color: rgba(255,255,255,0.50);
}
.hist-entry-dot { color: rgba(255,255,255,0.20); font-weight: 700; }

/* Right side — score + action icons */
.hist-entry-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.hist-entry-score {
    font-family: 'JetBrains Mono', monospace;
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.01em;
    min-width: 56px;
    text-align: right;
}
.hist-icon-btn {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.02);
    color: rgba(255,255,255,0.65);
    cursor: pointer;
    transition: all 0.12s ease;
    padding: 0;
}
.hist-icon-btn:hover {
    border-color: rgba(255,255,255,0.20);
    background: rgba(255,255,255,0.06);
    color: #fff;
}
.hist-icon-btn-danger:hover {
    border-color: rgba(239,68,68,0.35);
    background: rgba(239,68,68,0.10);
    color: #fca5a5;
}

/* ============================================================
   USERS / TEAM PAGE
   ============================================================ */

/* Tab strip for Users / Audit log (dev only) */
.users-tab-strip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    margin-bottom: 16px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 11px;
}
.users-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 700;
    color: rgba(255,255,255,0.55);
    text-decoration: none;
    transition: color 0.12s ease, background 0.12s ease;
    line-height: 1;
}
.users-tab:hover { color: #fff; background: rgba(255,255,255,0.04); }
.users-tab.is-active {
    color: #0c0f1a;
    background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%);
    box-shadow: 0 4px 10px rgba(251,191,36,0.20);
}
.users-tab-badge {
    margin-left: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(168,85,247,0.18);
    border: 1px solid rgba(168,85,247,0.35);
    color: #c084fc;
    font-size: 9.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.users-tab.is-active .users-tab-badge {
    background: rgba(12,15,26,0.18);
    border-color: rgba(12,15,26,0.30);
    color: rgba(12,15,26,0.78);
}

/* Legacy-accounts banner above the user list */
.users-legacy-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px 16px;
    margin-bottom: 14px;
    border-radius: 11px;
    background: rgba(251,191,36,0.06);
    border: 1px solid rgba(251,191,36,0.20);
    color: rgba(255,255,255,0.78);
    font-size: 12.5px;
    line-height: 1.5;
}
.users-legacy-banner svg { color: #fbbf24; margin-top: 2px; }
.users-legacy-banner strong { color: #fbbf24; }

/* User list — rows inside the .app-card */
.users-list-card .users-row:first-of-type { margin-top: 4px; }
.users-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 14px;
    border-radius: 11px;
    border: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.02);
    margin-bottom: 8px;
    transition: border-color 0.12s ease, background 0.12s ease;
}
.users-row:hover { border-color: rgba(255,255,255,0.14); background: rgba(255,255,255,0.04); }
.users-row.is-legacy { border-color: rgba(251,191,36,0.22); background: rgba(251,191,36,0.04); }
.users-row.is-disabled { opacity: 0.55; }

/* Role-coloured avatar */
.users-row-avatar {
    flex-shrink: 0;
    width: 40px; height: 40px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 15px;
    font-weight: 800;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.04);
}
.users-row-avatar.role-dev {
    color: #c084fc;
    background: linear-gradient(135deg, rgba(168,85,247,0.20), rgba(168,85,247,0.06));
    border-color: rgba(168,85,247,0.32);
}
.users-row-avatar.role-admin {
    color: #60a5fa;
    background: linear-gradient(135deg, rgba(96,165,250,0.20), rgba(96,165,250,0.06));
    border-color: rgba(96,165,250,0.32);
}
.users-row-avatar.role-viewer {
    color: #94a3b8;
    background: rgba(255,255,255,0.03);
}

.users-row-main { flex: 1; min-width: 0; }
.users-row-name {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}
.users-row-self {
    font-size: 10.5px;
    font-weight: 600;
    color: rgba(255,255,255,0.40);
    text-transform: lowercase;
    letter-spacing: 0;
}
.users-row-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 600;
    color: rgba(255,255,255,0.50);
}
.users-row-username {
    font-family: 'JetBrains Mono', monospace;
    color: rgba(255,255,255,0.65);
}
.users-row-email { color: rgba(255,255,255,0.45); }
.users-row-login { color: rgba(255,255,255,0.42); }
.users-row-sep { color: rgba(255,255,255,0.20); font-weight: 700; }

/* Role pill — purple/blue/grey per role */
.role-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border: 1px solid;
}
.role-pill-dev    { color: #c084fc; background: rgba(168,85,247,0.14); border-color: rgba(168,85,247,0.34); }
.role-pill-admin  { color: #60a5fa; background: rgba(96,165,250,0.14); border-color: rgba(96,165,250,0.32); }
.role-pill-viewer { color: rgba(255,255,255,0.65); background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.10); }

/* Status badges (legacy / migrated / disabled / must-change-pw) */
.users-row-badge {
    padding: 2px 7px;
    border-radius: 5px;
    font-size: 9.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border: 1px solid;
}
.users-row-badge-legacy   { color: #fbbf24; background: rgba(251,191,36,0.14); border-color: rgba(251,191,36,0.30); }
.users-row-badge-disabled { color: #fca5a5; background: rgba(239,68,68,0.10);  border-color: rgba(239,68,68,0.25); }
.users-row-badge-migrated { color: #4ade80; background: rgba(34,197,94,0.10);  border-color: rgba(34,197,94,0.25); }
.users-row-badge-warn     { color: #fbbf24; background: rgba(251,191,36,0.10); border-color: rgba(251,191,36,0.25); }

.users-row-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ----------------------------------------------------------------
   Modals — used for create/edit and password reset.
   Backdrop fades; box scales up on open.
   ---------------------------------------------------------------- */
.users-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0,0,0,0.62);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.18s ease;
}
/* CRITICAL: without this, the `display: flex` above overrides the
   browser's UA default for `[hidden]` (which is `display: none`),
   leaving an invisible (`opacity: 0`) but fully sized overlay on top
   of the page that swallows every click. Must come AFTER the base
   rule so it wins on specificity tie + source order. */
.users-modal-overlay[hidden] { display: none; }
.users-modal-overlay.is-open { opacity: 1; }

.users-modal-box {
    width: 100%;
    max-width: 480px;
    background: linear-gradient(180deg, #1a1d2e 0%, #14172a 100%);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 16px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.55);
    transform: scale(0.96);
    transition: transform 0.18s ease;
    overflow: hidden;
}
.users-modal-overlay.is-open .users-modal-box { transform: scale(1); }
.users-modal-box-sm { max-width: 420px; }

.users-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.users-modal-title {
    font-size: 16px;
    font-weight: 800;
    color: #fff;
    margin: 0;
}
.users-modal-close {
    width: 28px; height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.55);
    cursor: pointer;
    padding: 0;
    transition: all 0.12s ease;
}
.users-modal-close:hover { border-color: rgba(255,255,255,0.20); color: #fff; background: rgba(255,255,255,0.04); }

.users-modal-body { padding: 18px 20px; }
.users-modal-foot {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 14px 20px 18px;
    border-top: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.01);
}

.users-modal-msg {
    margin-bottom: 14px;
    padding: 10px 12px;
    border-radius: 9px;
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.24);
    color: #fca5a5;
    font-size: 12.5px;
    font-weight: 600;
}

/* Form rows inside the modal */
.users-form-row { margin-bottom: 14px; }
.users-form-row:last-child { margin-bottom: 0; }
.users-form-row label {
    display: block;
    margin-bottom: 6px;
    font-size: 11.5px;
    font-weight: 700;
    color: rgba(255,255,255,0.78);
    letter-spacing: 0.01em;
}
.users-form-optional {
    color: rgba(255,255,255,0.40);
    font-weight: 500;
    text-transform: none;
}
.users-form-row input,
.users-form-row select {
    width: 100%;
    padding: 10px 12px;
    background: rgba(0,0,0,0.30);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 9px;
    color: #fff;
    font-size: 13.5px;
    font-family: 'DM Sans', sans-serif;
    transition: border-color 0.12s ease, background 0.12s ease;
    box-sizing: border-box;
}
.users-form-row input:focus,
.users-form-row select:focus {
    outline: none;
    border-color: rgba(251,191,36,0.50);
    background: rgba(0,0,0,0.40);
}
.users-form-row input:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.users-form-hint {
    margin-top: 5px;
    font-size: 10.5px;
    font-weight: 600;
    color: rgba(255,255,255,0.42);
}

/* ----------------------------------------------------------------
   Audit log tab (dev only)
   ---------------------------------------------------------------- */
.users-audit-filter {
    padding: 7px 10px;
    background: rgba(0,0,0,0.30);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 8px;
    color: rgba(255,255,255,0.78);
    font-size: 12px;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
}
.users-audit-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 6px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 12px;
}
.users-audit-row:last-child { border-bottom: none; }
.users-audit-dot {
    flex-shrink: 0;
    width: 7px; height: 7px;
    border-radius: 50%;
    margin-top: 6px;
}
.users-audit-body { flex: 1; min-width: 0; }
.users-audit-action {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 2px;
}
.users-audit-detail {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.45);
    word-break: break-word;
}
.users-audit-ip {
    font-family: 'JetBrains Mono', monospace;
    color: rgba(255,255,255,0.32);
}
.users-audit-when {
    flex-shrink: 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    font-weight: 600;
    color: rgba(255,255,255,0.35);
    white-space: nowrap;
}

/* Lock indicator for rows where the current admin has no available
   actions. Just a small icon — the full explanation lives in the
   `title` attribute (native tooltip on hover). The previous version
   embedded the text label inline, which truncated awkwardly on most
   widths and competed with the row's main content for space. */
.users-row-lock {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px dashed rgba(255,255,255,0.10);
    background: transparent;
    color: rgba(255,255,255,0.40);
    cursor: help;
    flex-shrink: 0;
}
.users-row-lock svg { opacity: 0.75; }
/* Old inline label is no longer rendered (we removed the markup
   but keep the rule so any cached pages don't show stray text). */
.users-row-lock-label { display: none; }

/* ============================================================
   KPI ROW — was missing entirely, causing kpi-card blocks to
   stack vertically full-width on every page that used it
   (ranking, history, users). Defined here as a 4-col grid
   matching the older .kpi-grid pattern used on the home page.

   Both class names exist for backward compat; new pages can
   use either.
   ============================================================ */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}
@media (max-width: 1100px) { .kpi-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px)  { .kpi-row { grid-template-columns: 1fr; } }

/* ============================================================
   KPI ACCENT VARIANTS
   The `.kpi-card::before` rule above paints a thin amber line
   across the top of every KPI card. That works fine on most
   pages where each KPI is conceptually similar, but on the Team
   page the four KPIs measure very different things (count vs
   activity vs admins vs legacy warnings). Letting each card
   show its own accent colour helps the eye parse them faster.

   These variants override the ::before gradient with the colour
   of the relevant tier. Apply with `<div class="kpi-card kpi-accent-g">`
   etc. Used on the Team page; safe to use anywhere.
   ============================================================ */
.kpi-card.kpi-accent-g::before  { background: linear-gradient(90deg, transparent, rgba(74,222,128,0.55), transparent); }
.kpi-card.kpi-accent-f::before  { background: linear-gradient(90deg, transparent, rgba(96,165,250,0.55), transparent); }
.kpi-card.kpi-accent-fp::before { background: linear-gradient(90deg, transparent, rgba(192,132,252,0.55), transparent); }
.kpi-card.kpi-accent-fa::before { background: linear-gradient(90deg, transparent, rgba(251,191,36,0.65), transparent); }
.kpi-card.kpi-accent-p::before  { background: linear-gradient(90deg, transparent, rgba(252,165,165,0.55), transparent); }

/* Subtle hover glow tinted to the accent for a touch more polish */
.kpi-card.kpi-accent-g:hover  { box-shadow: 0 18px 40px rgba(0,0,0,0.30), 0 6px 18px rgba(74,222,128,0.06),  inset 0 1px 0 rgba(255,255,255,0.04); }
.kpi-card.kpi-accent-f:hover  { box-shadow: 0 18px 40px rgba(0,0,0,0.30), 0 6px 18px rgba(96,165,250,0.06), inset 0 1px 0 rgba(255,255,255,0.04); }
.kpi-card.kpi-accent-fp:hover { box-shadow: 0 18px 40px rgba(0,0,0,0.30), 0 6px 18px rgba(192,132,252,0.06),inset 0 1px 0 rgba(255,255,255,0.04); }
.kpi-card.kpi-accent-fa:hover { box-shadow: 0 18px 40px rgba(0,0,0,0.30), 0 6px 18px rgba(251,191,36,0.08), inset 0 1px 0 rgba(255,255,255,0.04); }
.kpi-card.kpi-accent-p:hover  { box-shadow: 0 18px 40px rgba(0,0,0,0.30), 0 6px 18px rgba(252,165,165,0.06),inset 0 1px 0 rgba(255,255,255,0.04); }

/* ============================================================
   PROFILE PAGE
   ============================================================ */

/* Account overview card — large display name with avatar + a
   2x2 grid of read-only fields below. Visually distinct from the
   form cards beneath so the user immediately sees "this is me". */
.profile-overview-card { padding: 22px 24px; }
.profile-overview-head {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 18px;
    margin-bottom: 18px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.profile-overview-avatar {
    flex-shrink: 0;
    width: 56px; height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.04);
}
/* Same role tints as the Team page avatars */
.profile-overview-avatar.role-dev {
    color: #c084fc;
    background: linear-gradient(135deg, rgba(168,85,247,0.22), rgba(168,85,247,0.06));
    border-color: rgba(168,85,247,0.36);
}
.profile-overview-avatar.role-admin {
    color: #60a5fa;
    background: linear-gradient(135deg, rgba(96,165,250,0.22), rgba(96,165,250,0.06));
    border-color: rgba(96,165,250,0.36);
}
.profile-overview-avatar.role-viewer {
    color: #94a3b8;
    background: rgba(255,255,255,0.03);
}

.profile-overview-name { flex: 1; min-width: 0; }
.profile-overview-display {
    font-size: 20px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.01em;
    margin-bottom: 4px;
}
.profile-overview-handle {
    display: inline-flex;
    align-items: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12.5px;
    font-weight: 600;
    color: rgba(255,255,255,0.55);
}

.profile-overview-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px 24px;
}
@media (max-width: 540px) {
    .profile-overview-grid { grid-template-columns: 1fr; }
}
.profile-overview-field {}
.profile-overview-label {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.42);
    margin-bottom: 5px;
}
.profile-overview-value {
    font-size: 13.5px;
    font-weight: 600;
    color: #fff;
}

/* Status message colours for the profile forms — reusing the
   .users-modal-msg base but supporting success state too. The
   modal usage only needed an error pill; here we want both. */
.profile-msg-error {
    background: rgba(239,68,68,0.08);
    border-color: rgba(239,68,68,0.24);
    color: #fca5a5;
}
.profile-msg-success {
    background: rgba(34,197,94,0.10);
    border-color: rgba(34,197,94,0.28);
    color: #4ade80;
}

/* Password input — needs the same chrome as the .users-form-row
   text inputs but type="password" wasn't in the original selector. */
.users-form-row input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    background: rgba(0,0,0,0.30);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 9px;
    color: #fff;
    font-size: 13.5px;
    font-family: 'DM Sans', sans-serif;
    letter-spacing: 0.04em;
    transition: border-color 0.12s ease, background 0.12s ease;
    box-sizing: border-box;
}
.users-form-row input[type="password"]:focus {
    outline: none;
    border-color: rgba(251,191,36,0.50);
    background: rgba(0,0,0,0.40);
}

/* ============================================================
   DRIVER TABLE TIER PILLS — make them pop a bit harder than the
   default .tier-pill so they read as the primary classification
   indicator on the row. Slightly stronger background, a soft
   inner glow, and a subtle inset highlight. Same tier colours,
   just more "badge-y". Scoped to the .sc-col-tier cell only so
   the smaller pills used elsewhere (history meta, podium etc.)
   keep their lighter look.
   ============================================================ */
.sc-col-tier .tier-pill {
    padding: 4px 11px;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 0.06em;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}
.sc-col-tier .tier-pill.tier-fp {
    background: linear-gradient(180deg, rgba(192,132,252,0.22), rgba(192,132,252,0.10));
    border-color: rgba(192,132,252,0.45);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.10), 0 0 12px rgba(192,132,252,0.18);
}
.sc-col-tier .tier-pill.tier-f {
    background: linear-gradient(180deg, rgba(96,165,250,0.22), rgba(96,165,250,0.10));
    border-color: rgba(96,165,250,0.45);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.10), 0 0 12px rgba(96,165,250,0.18);
}
.sc-col-tier .tier-pill.tier-g {
    background: linear-gradient(180deg, rgba(34,197,94,0.22), rgba(34,197,94,0.10));
    border-color: rgba(34,197,94,0.45);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.10), 0 0 12px rgba(34,197,94,0.16);
}
.sc-col-tier .tier-pill.tier-fa {
    background: linear-gradient(180deg, rgba(251,191,36,0.22), rgba(251,191,36,0.10));
    border-color: rgba(251,191,36,0.48);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.10), 0 0 12px rgba(251,191,36,0.18);
}
.sc-col-tier .tier-pill.tier-p {
    background: linear-gradient(180deg, rgba(239,68,68,0.22), rgba(239,68,68,0.10));
    border-color: rgba(239,68,68,0.45);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.10), 0 0 12px rgba(239,68,68,0.18);
}

/* ============================================================
   DRIVERS PAGE
   ============================================================ */

/* Driver rows — mirror the users.php / Team page row pattern with
   an avatar block, primary name line, and meta line. Same chrome
   classes (.dr-row-avatar, .dr-row-main, .dr-row-actions) but
   prefixed .dr- so the two pages can diverge without cross-talk. */
.dr-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 11px;
    border: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.02);
    margin-bottom: 7px;
    transition: border-color 0.12s ease, background 0.12s ease;
}
.dr-row:hover { border-color: rgba(255,255,255,0.14); background: rgba(255,255,255,0.04); }

/* Unnamed drivers — still show as transporter IDs, get a subtle
   amber-tinted border so the eye finds them quickly when the admin
   wants to bulk-enrich. */
.dr-row.is-unnamed { border-color: rgba(96,165,250,0.18); background: rgba(96,165,250,0.03); }
.dr-row.is-inactive { opacity: 0.65; }
.dr-row.is-terminated { opacity: 0.50; }

.dr-row-avatar {
    flex-shrink: 0;
    width: 38px; height: 38px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.04);
}
/* Reuse the role-* scheme from Team avatars — "admin" colour for
   named drivers (full record), "viewer" colour for unnamed (less
   info yet). */
.dr-row-avatar.role-admin {
    color: #60a5fa;
    background: linear-gradient(135deg, rgba(96,165,250,0.20), rgba(96,165,250,0.06));
    border-color: rgba(96,165,250,0.32);
}
.dr-row-avatar.role-viewer {
    color: rgba(255,255,255,0.55);
    background: rgba(255,255,255,0.03);
}

.dr-row-main { flex: 1; min-width: 0; }
.dr-row-name {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 13.5px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 3px;
}
.dr-row-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 600;
    color: rgba(255,255,255,0.50);
}
.dr-row-tid {
    font-family: 'JetBrains Mono', monospace;
    color: rgba(255,255,255,0.55);
    letter-spacing: 0.01em;
}
.dr-row-email { color: rgba(255,255,255,0.45); }

.dr-row-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* Pagination — rows past the initial batch get .is-paged-out which
   we hide via display:none. Search override also toggles the same
   class so the show/hide logic stays in one place. */
.dr-row.is-paged-out { display: none; }

/* "Show more" footer button — sits below the visible list. Subtle
   dashed border so it reads as a meta-control, not a primary CTA.
   Counter on the right tracks "Showing N of M". */
.dr-load-more {
    width: 100%;
    margin-top: 12px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border: 1px dashed rgba(255,255,255,0.10);
    border-radius: 11px;
    background: rgba(255,255,255,0.02);
    color: rgba(255,255,255,0.65);
    cursor: pointer;
    transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 700;
}
.dr-load-more:hover {
    border-color: rgba(251,191,36,0.30);
    background: rgba(251,191,36,0.04);
    color: #fbbf24;
}
.dr-load-more:hover svg { color: #fbbf24; }
.dr-load-more-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.dr-load-more-count {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.42);
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
}
.dr-load-more:hover .dr-load-more-count {
    color: rgba(251,191,36,0.78);
    border-color: rgba(251,191,36,0.20);
    background: rgba(251,191,36,0.06);
}
.dr-load-more svg {
    color: rgba(255,255,255,0.45);
    transition: color 0.12s ease;
}

/* ============================================================
   HOME — YEARLY CHAMPIONS + LAST WEEK SCORECARDS
   ============================================================ */

/* Yearly leader / worst — two cards side by side, each a coloured
   accent header followed by a depot identity block + score. Hover
   adds a subtle glow that nudges them as clickable links. */
.yearly-card {
    padding: 18px 20px;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.yearly-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255,255,255,0.20);
}
.yearly-leader:hover {
    border-color: rgba(251,191,36,0.40);
    box-shadow: 0 18px 40px rgba(0,0,0,0.30), 0 0 22px rgba(251,191,36,0.12);
}
.yearly-worst:hover {
    border-color: rgba(239,68,68,0.40);
    box-shadow: 0 18px 40px rgba(0,0,0,0.30), 0 0 22px rgba(239,68,68,0.12);
}

.yearly-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.yearly-card-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid;
}
.yearly-card-icon-leader {
    color: #fbbf24;
    background: linear-gradient(135deg, rgba(251,191,36,0.18), rgba(251,191,36,0.04));
    border-color: rgba(251,191,36,0.32);
    box-shadow: 0 0 18px rgba(251,191,36,0.12);
}
.yearly-card-icon-worst {
    color: #fca5a5;
    background: linear-gradient(135deg, rgba(239,68,68,0.16), rgba(239,68,68,0.04));
    border-color: rgba(239,68,68,0.30);
}
.yearly-card-label {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.55);
    margin-bottom: 3px;
}
.yearly-card-sub {
    font-size: 11.5px;
    font-weight: 600;
    color: rgba(255,255,255,0.42);
    font-family: 'JetBrains Mono', monospace;
}

.yearly-card-body { padding-left: 4px; }
.yearly-card-code {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.02em;
    line-height: 1.1;
}
.yearly-card-name {
    font-size: 12.5px;
    font-weight: 600;
    color: rgba(255,255,255,0.55);
    margin-top: 2px;
    margin-bottom: 12px;
}
.yearly-card-score-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.yearly-card-score {
    font-family: 'JetBrains Mono', monospace;
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1;
}
.yearly-card-spread {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.45);
}
.yearly-card-spread strong { color: #fff; font-weight: 700; }
.yearly-card-spread-sep { color: rgba(255,255,255,0.22); }

/* Last week scorecards — single-card list of rows, one per depot.
   Top 3 get medal emoji ranks; the rest get a small #N badge.
   Score on the right with a tier-coloured pill. */
.lw-list { padding-top: 4px; }
.lw-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 4px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: background 0.12s ease;
}
.lw-row:last-child { border-bottom: 0; }
.lw-row:hover { background: rgba(255,255,255,0.025); }

/* Top-3 get a subtle left-edge accent stripe + faint tier-coloured
   row tint. Avoids the heavy bordered-card-row look while still
   keeping medal positions visually distinct. */
.lw-row.lw-rank-1 {
    background: linear-gradient(90deg, rgba(251,191,36,0.06), transparent 60%);
    box-shadow: inset 3px 0 0 rgba(251,191,36,0.55);
}
.lw-row.lw-rank-2 {
    background: linear-gradient(90deg, rgba(203,213,225,0.04), transparent 60%);
    box-shadow: inset 3px 0 0 rgba(203,213,225,0.45);
}
.lw-row.lw-rank-3 {
    background: linear-gradient(90deg, rgba(245,158,11,0.03), transparent 60%);
    box-shadow: inset 3px 0 0 rgba(253,186,116,0.45);
}

/* .lw-rank styled by the unified rank-pill block further down */

.lw-main { flex: 1; min-width: 0; }
.lw-code {
    font-size: 14px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.01em;
    line-height: 1.2;
}
.lw-name {
    font-size: 11.5px;
    font-weight: 600;
    color: rgba(255,255,255,0.50);
    margin-top: 2px;
}

.lw-score-block {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.lw-score {
    font-family: 'JetBrains Mono', monospace;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.01em;
    min-width: 56px;
    text-align: right;
}

/* ============================================================
   CUSTOM TOOLTIPS — `.has-tip` with data-tip-* attributes
   ============================================================
   Pure CSS tooltip — no JS. Position fixed at top of trigger,
   appears on hover, smooth fade. Three-part layout:
     - data-tip-title    bold first line ("DCR — Delivery Completion Rate")
     - data-tip-body     explanatory paragraph (60–120 chars typically)
     - data-tip-target   target threshold pill at the bottom

   Used on metric tiles + metric column headers in scorecards.php.
   Keeps the page accessible to people who don't know what DPMO,
   PSB or CDF mean without forcing them to leave the page. */
.has-tip { position: relative; cursor: help; }
.has-tip::before,
.has-tip::after {
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.14s ease, transform 0.14s ease;
}
.has-tip:hover::before,
.has-tip:hover::after,
.has-tip:focus-within::before,
.has-tip:focus-within::after { opacity: 1; }

/* Tooltip body */
.has-tip::after {
    content: attr(data-tip-title) "\A\A" attr(data-tip-body) "\A\A Target: " attr(data-tip-target);
    white-space: pre-line;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    width: max-content;
    max-width: 280px;
    padding: 10px 13px;
    border-radius: 9px;
    background: rgba(15,20,34,0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.10);
    color: #fff;
    font-family: 'DM Sans', sans-serif;
    font-size: 11.5px;
    font-weight: 500;
    line-height: 1.5;
    letter-spacing: 0;
    text-align: left;
    z-index: 200;
    box-shadow: 0 16px 40px rgba(0,0,0,0.50);
}
.has-tip:hover::after,
.has-tip:focus-within::after { transform: translateX(-50%) translateY(0); }

/* Variant: when no target threshold is provided (table headers etc.),
   the trailing " Target: " line still appears. To suppress it we'd
   need an empty data-tip-target attribute; we set it to empty string
   on the header markup and CSS still concatenates fine. */
.has-tip[data-tip-target=""]::after {
    content: attr(data-tip-title) "\A\A" attr(data-tip-body);
}

/* Tooltip arrow */
.has-tip::before {
    content: "";
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    border: 6px solid transparent;
    border-top-color: rgba(15,20,34,0.96);
    z-index: 201;
}
.has-tip:hover::before,
.has-tip:focus-within::before { transform: translateX(-50%) translateY(0); }

/* ============================================================
   DRIVER DETAIL PAGE — enterprise redesign
   ============================================================
   Designed to feel like a high-end CRM contact card crossed with a
   trading dashboard: tier-driven colour everywhere, generous breathing
   room, sparing use of borders, gradients used for depth not decoration.

   Tier colour palette (shared across the app):
     fp  Fantastic+   #c084fc  purple
     f   Fantastic    #60a5fa  blue
     g   Great        #4ade80  green
     fa  Fair         #fbbf24  amber
     p   Poor         #f87171  red
   ============================================================ */

/* Generic tier background helper — used by avatar ring, metric dots,
   tier strip segments, and progress bars. Keeps colour decisions
   centralised so a palette tweak ripples through everything. */
.tier-bg-fp { background: #c084fc; }
.tier-bg-f  { background: #60a5fa; }
.tier-bg-g  { background: #4ade80; }
.tier-bg-fa { background: #fbbf24; }
.tier-bg-p  { background: #f87171; }

/* === HERO CARD === */
.driver-hero {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
    gap: 22px;
    padding: 26px 28px;
    border: 1px solid rgba(255,255,255,0.06);
}
/* Subtle tier-coloured wash on the card backdrop — visible but never
   competing with content. Layered behind everything via the .driver-
   hero-aura element (z-index 0) so text stays crisp on top. */
.driver-hero-aura {
    position: absolute;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(circle at 8% 30%, rgba(255,255,255,0.04), transparent 35%),
        linear-gradient(135deg, rgba(255,255,255,0.025) 0%, transparent 60%);
    pointer-events: none;
}
.driver-hero.has-tier-fp .driver-hero-aura {
    background:
        radial-gradient(circle at 8% 30%, rgba(192,132,252,0.16), transparent 40%),
        linear-gradient(135deg, rgba(192,132,252,0.04) 0%, transparent 60%);
}
.driver-hero.has-tier-f .driver-hero-aura {
    background:
        radial-gradient(circle at 8% 30%, rgba(96,165,250,0.14), transparent 40%),
        linear-gradient(135deg, rgba(96,165,250,0.04) 0%, transparent 60%);
}
.driver-hero.has-tier-g .driver-hero-aura {
    background:
        radial-gradient(circle at 8% 30%, rgba(74,222,128,0.14), transparent 40%),
        linear-gradient(135deg, rgba(74,222,128,0.04) 0%, transparent 60%);
}
.driver-hero.has-tier-fa .driver-hero-aura {
    background:
        radial-gradient(circle at 8% 30%, rgba(251,191,36,0.14), transparent 40%),
        linear-gradient(135deg, rgba(251,191,36,0.04) 0%, transparent 60%);
}
.driver-hero.has-tier-p .driver-hero-aura {
    background:
        radial-gradient(circle at 8% 30%, rgba(248,113,113,0.14), transparent 40%),
        linear-gradient(135deg, rgba(248,113,113,0.04) 0%, transparent 60%);
}

/* Avatar — 76px, tier-ringed with a soft glow. Inner span carries the
   initials so we can use border + outer box-shadow on the parent
   without it leaking into the text. */
.driver-hero-avatar {
    position: relative; z-index: 1;
    flex-shrink: 0;
    width: 76px; height: 76px;
    border-radius: 18px;
    border: 2px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.04);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 24px rgba(0,0,0,0.30);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.driver-hero-avatar span {
    font-family: 'JetBrains Mono', monospace;
    font-size: 26px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.01em;
}
.driver-hero-avatar.tier-ring-fp { border-color: rgba(192,132,252,0.50); box-shadow: 0 0 0 4px rgba(192,132,252,0.10), 0 6px 24px rgba(192,132,252,0.18); }
.driver-hero-avatar.tier-ring-fp span { color: #c084fc; }
.driver-hero-avatar.tier-ring-f  { border-color: rgba(96,165,250,0.50);  box-shadow: 0 0 0 4px rgba(96,165,250,0.10),  0 6px 24px rgba(96,165,250,0.18); }
.driver-hero-avatar.tier-ring-f  span { color: #93c5fd; }
.driver-hero-avatar.tier-ring-g  { border-color: rgba(74,222,128,0.50);  box-shadow: 0 0 0 4px rgba(74,222,128,0.10),  0 6px 24px rgba(74,222,128,0.18); }
.driver-hero-avatar.tier-ring-g  span { color: #86efac; }
.driver-hero-avatar.tier-ring-fa { border-color: rgba(251,191,36,0.50);  box-shadow: 0 0 0 4px rgba(251,191,36,0.10),  0 6px 24px rgba(251,191,36,0.18); }
.driver-hero-avatar.tier-ring-fa span { color: #fbbf24; }
.driver-hero-avatar.tier-ring-p  { border-color: rgba(248,113,113,0.50); box-shadow: 0 0 0 4px rgba(248,113,113,0.10), 0 6px 24px rgba(248,113,113,0.18); }
.driver-hero-avatar.tier-ring-p  span { color: #fca5a5; }

/* Main column: identity + meta + notes */
.driver-hero-main { flex: 1; min-width: 0; position: relative; z-index: 1; }
.driver-hero-row1 {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
    margin-bottom: 6px;
}
.driver-hero-name {
    margin: 0;
    font-family: 'DM Sans', sans-serif;
    font-size: 26px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.015em;
    line-height: 1.15;
}
.driver-hero-tier-pill {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 4px 11px;
    border-radius: 999px;
    font-family: 'DM Sans', sans-serif;
    font-size: 11.5px;
    font-weight: 800;
    letter-spacing: 0.03em;
    border: 1px solid;
    background: rgba(255,255,255,0.02);
}
.driver-hero-tier-pill.tier-fp { color: #c084fc; border-color: rgba(192,132,252,0.40); background: rgba(192,132,252,0.08); }
.driver-hero-tier-pill.tier-f  { color: #93c5fd; border-color: rgba(96,165,250,0.40);  background: rgba(96,165,250,0.08); }
.driver-hero-tier-pill.tier-g  { color: #86efac; border-color: rgba(74,222,128,0.40);  background: rgba(74,222,128,0.08); }
.driver-hero-tier-pill.tier-fa { color: #fbbf24; border-color: rgba(251,191,36,0.40);  background: rgba(251,191,36,0.08); }
.driver-hero-tier-pill.tier-p  { color: #fca5a5; border-color: rgba(248,113,113,0.40); background: rgba(248,113,113,0.08); }
.driver-hero-tier-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 8px currentColor;
}

.driver-hero-meta {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 12.5px;
    font-weight: 600;
    color: rgba(255,255,255,0.55);
}
.driver-hero-sep {
    width: 3px; height: 3px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
}
.driver-hero-tid {
    font-family: 'JetBrains Mono', monospace;
    color: rgba(255,255,255,0.68);
    letter-spacing: 0.02em;
    padding: 2px 8px;
    border-radius: 5px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
}
.driver-hero-depot {
    display: inline-flex; align-items: center; gap: 5px;
    color: rgba(255,255,255,0.55);
}
.driver-hero-depot svg { color: #fbbf24; }
.driver-hero-depot strong { color: #fbbf24; font-weight: 800; }

.driver-hero-notes {
    display: flex; align-items: flex-start; gap: 8px;
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(255,255,255,0.025);
    border: 1px solid rgba(255,255,255,0.05);
    border-left: 3px solid rgba(255,255,255,0.18);
    font-family: 'DM Sans', sans-serif;
    font-size: 12.5px;
    color: rgba(255,255,255,0.72);
    font-style: italic;
    line-height: 1.5;
}
.driver-hero-notes svg {
    flex-shrink: 0;
    margin-top: 3px;
    color: rgba(255,255,255,0.35);
}

/* Right-aligned current-score block on the hero — large, monospaced,
   tier-coloured. The headline number, immediately readable. */
.driver-hero-score {
    position: relative; z-index: 1;
    flex-shrink: 0;
    text-align: right;
    padding-left: 22px;
    border-left: 1px solid rgba(255,255,255,0.06);
    align-self: stretch;
    display: flex; flex-direction: column; justify-content: center;
}
.driver-hero-score-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 44px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.025em;
    color: #fff;
}
.driver-hero-score-num.tier-fp { color: #c084fc; }
.driver-hero-score-num.tier-f  { color: #93c5fd; }
.driver-hero-score-num.tier-g  { color: #86efac; }
.driver-hero-score-num.tier-fa { color: #fbbf24; }
.driver-hero-score-num.tier-p  { color: #fca5a5; }
.driver-hero-score-cap {
    margin-top: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    font-weight: 700;
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

@media (max-width: 720px) {
    .driver-hero { flex-wrap: wrap; padding: 20px; gap: 16px; }
    .driver-hero-score { border-left: none; padding-left: 0; width: 100%; align-items: flex-start; text-align: left; }
    .driver-hero-name { font-size: 22px; }
    .driver-hero-score-num { font-size: 36px; }
}

/* === TREND CHART === */
.driver-trend-card { padding-bottom: 18px; }
.driver-trend {
    width: 100%;
    height: 260px;
    display: block;
    margin-top: 4px;
    /* preserveAspectRatio="none" on the SVG itself lets the line stretch
       to full card width. Vertical scaling stays correct via the fixed
       height — only the X axis stretches. */
}
/* tier-line-* drives the gradient stop colour AND the line stroke via
   currentColor, so the area fill and line always match the heros tier. */
.driver-trend.tier-line-fp { color: #c084fc; }
.driver-trend.tier-line-f  { color: #60a5fa; }
.driver-trend.tier-line-g  { color: #4ade80; }
.driver-trend.tier-line-fa { color: #fbbf24; }
.driver-trend.tier-line-p  { color: #f87171; }

.dt-axis  { stroke: rgba(255,255,255,0.05); stroke-width: 1; stroke-dasharray: 2 4; vector-effect: non-scaling-stroke; }
.dt-label {
    fill: rgba(255,255,255,0.35);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
}
.dt-area  { /* fill comes from inline url(#dr-trend-grad) using currentColor */ }
.dt-line  { stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; filter: drop-shadow(0 0 6px currentColor); }

.dt-dot {
    stroke: rgba(15,20,34,0.95);
    stroke-width: 2.5;
    vector-effect: non-scaling-stroke;
    transition: r 0.15s ease;
}
.dt-dot:hover { r: 7; }
.dt-dot.tier-fp { fill: #c084fc; filter: drop-shadow(0 0 4px rgba(192,132,252,0.55)); }
.dt-dot.tier-f  { fill: #60a5fa; filter: drop-shadow(0 0 4px rgba(96,165,250,0.55)); }
.dt-dot.tier-g  { fill: #4ade80; filter: drop-shadow(0 0 4px rgba(74,222,128,0.55)); }
.dt-dot.tier-fa { fill: #fbbf24; filter: drop-shadow(0 0 4px rgba(251,191,36,0.55)); }
.dt-dot.tier-p  { fill: #f87171; filter: drop-shadow(0 0 4px rgba(248,113,113,0.55)); }

/* === TIER STRIP === Below the chart: continuous segmented bar, one
   segment per week, tier-coloured. Reads as a career heatmap. */
.driver-tier-strip {
    display: flex;
    gap: 2px;
    height: 14px;
    margin-top: 18px;
    border-radius: 7px;
    overflow: hidden;
}
.dt-strip-seg {
    flex: 1;
    min-width: 4px;
    transition: transform 0.12s ease, filter 0.12s ease;
    cursor: help;
}
.dt-strip-seg:hover {
    transform: scaleY(1.4);
    filter: brightness(1.18);
}
.driver-tier-strip-axis {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    padding: 0 2px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    font-weight: 700;
    color: rgba(255,255,255,0.35);
    letter-spacing: 0.03em;
}

/* === METRIC TILES === Tier-coloured value, target indicator,
   progress bar showing distance to Fantastic threshold. */
.driver-metric-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding-top: 6px;
}
@media (max-width: 900px) { .driver-metric-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .driver-metric-grid { grid-template-columns: 1fr; } }
.driver-metric-tile {
    position: relative;
    padding: 14px 16px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.02);
    border-left: 3px solid rgba(255,255,255,0.10);
    transition: border-color 0.15s ease, background 0.15s ease;
}
.driver-metric-tile:hover { background: rgba(255,255,255,0.035); }
.driver-metric-tile.tile-tier-fp { border-left-color: #c084fc; }
.driver-metric-tile.tile-tier-f  { border-left-color: #60a5fa; }
.driver-metric-tile.tile-tier-g  { border-left-color: #4ade80; }
.driver-metric-tile.tile-tier-fa { border-left-color: #fbbf24; }
.driver-metric-tile.tile-tier-p  { border-left-color: #f87171; }

.driver-metric-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px;
    margin-bottom: 2px;
}
.driver-metric-abbr {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12.5px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.04em;
}
.driver-metric-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    box-shadow: 0 0 6px currentColor;
}
.driver-metric-full {
    font-family: 'DM Sans', sans-serif;
    font-size: 10.5px;
    font-weight: 600;
    color: rgba(255,255,255,0.45);
    margin-bottom: 10px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}
.driver-metric-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.02em;
    line-height: 1;
    margin-bottom: 10px;
}
.driver-metric-val.tier-fp { color: #c084fc; }
.driver-metric-val.tier-f  { color: #93c5fd; }
.driver-metric-val.tier-g  { color: #86efac; }
.driver-metric-val.tier-fa { color: #fbbf24; }
.driver-metric-val.tier-p  { color: #fca5a5; }

.driver-metric-progress {
    height: 4px;
    border-radius: 3px;
    background: rgba(255,255,255,0.05);
    overflow: hidden;
    margin-bottom: 8px;
}
.driver-metric-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
    box-shadow: 0 0 8px currentColor;
}

.driver-metric-foot {
    display: flex; justify-content: space-between; align-items: center;
    gap: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    color: rgba(255,255,255,0.40);
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.driver-metric-target { color: rgba(251,191,36,0.65); }

/* === COACHING LOG === */
.coaching-add-form { margin-bottom: 14px; }
.coaching-add-row {
    display: flex; gap: 8px; align-items: center;
}
.coaching-kind-select {
    flex-shrink: 0;
    padding: 10px 12px;
    background: rgba(0,0,0,0.30);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 9px;
    color: #fff;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    min-width: 140px;
    transition: border-color 0.12s ease;
}
.coaching-kind-select:focus { outline: none; border-color: rgba(251,191,36,0.40); }
.coaching-add-row input[type=text] {
    flex: 1;
    padding: 10px 14px;
    background: rgba(0,0,0,0.30);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 9px;
    color: #fff;
    font-size: 13px;
    font-family: 'DM Sans', sans-serif;
    transition: border-color 0.12s ease;
}
.coaching-add-row input[type=text]::placeholder { color: rgba(255,255,255,0.32); }
.coaching-add-row input[type=text]:focus { outline: none; border-color: rgba(251,191,36,0.40); }

.coaching-list { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
.coaching-entry {
    display: flex;
    gap: 13px;
    padding: 13px 16px;
    border-radius: 11px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-left: 3px solid rgba(255,255,255,0.10);
    transition: background 0.12s ease;
}
.coaching-entry:hover { background: rgba(255,255,255,0.035); }
.coaching-entry.coaching-kind-note     { border-left-color: rgba(255,255,255,0.20); }
.coaching-entry.coaching-kind-praise   { border-left-color: #fbbf24; }
.coaching-entry.coaching-kind-coaching { border-left-color: #60a5fa; }
.coaching-entry.coaching-kind-warning  { border-left-color: #f87171; }
.coaching-entry.coaching-kind-incident { border-left-color: #ef4444; background: rgba(239,68,68,0.04); }

.coaching-entry-icon {
    font-size: 18px;
    flex-shrink: 0;
    line-height: 1;
    padding-top: 1px;
}
.coaching-entry-main { flex: 1; min-width: 0; }
.coaching-entry-head {
    display: flex; flex-wrap: wrap; align-items: center; gap: 7px;
    font-size: 11px;
    color: rgba(255,255,255,0.50);
    margin-bottom: 5px;
}
.coaching-entry-kind {
    font-weight: 800;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 10px;
}
.coaching-entry-when { font-family: 'JetBrains Mono', monospace; font-weight: 600; }
.coaching-entry-week { font-family: 'JetBrains Mono', monospace; color: #fbbf24; font-weight: 700; }
.coaching-entry-note {
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    color: rgba(255,255,255,0.88);
    line-height: 1.55;
    word-wrap: break-word;
}
.coaching-entry-actions { flex-shrink: 0; margin: 0; }

/* ============================================================
   DRIVERS — STATUS FILTER TABS
   ============================================================
   Row of pill buttons above the roster card. One per status with
   a count badge. Active tab gets the amber accent treatment. */
.dr-status-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.dr-status-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 13px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.02);
    color: rgba(255,255,255,0.65);
    font-family: 'DM Sans', sans-serif;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.dr-status-tab:hover { border-color: rgba(255,255,255,0.20); color: #fff; }
.dr-status-tab.is-active {
    border-color: rgba(251,191,36,0.40);
    background: rgba(251,191,36,0.10);
    color: #fbbf24;
}
.dr-status-tab.dr-status-tab-warn.is-active {
    border-color: rgba(251,191,36,0.40);
    background: rgba(251,191,36,0.10);
    color: #fbbf24;
}
.dr-status-tab.dr-status-tab-danger.is-active {
    border-color: rgba(239,68,68,0.40);
    background: rgba(239,68,68,0.10);
    color: #fca5a5;
}
.dr-status-tab-count {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
    color: inherit;
    opacity: 0.85;
}
.dr-status-tab.is-active .dr-status-tab-count {
    background: rgba(0,0,0,0.20);
    opacity: 1;
}

/* ============================================================
   HISTORY — CLIENT-SIDE FILTERS
   ============================================================
   Filter bar above the timeline: search input + tier pills + score
   range + reset. All three filters combine; year is server-side
   via the pill nav further up the page.

   Layout: horizontal flex with each filter as a "group" so they
   wrap cleanly on narrow viewports. Last item is a counter showing
   "N of M shown" when any filter is active. */
.hist-filters {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    padding: 12px 16px;
}
.hist-filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}
.hist-filter-label {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 800;
    color: rgba(255,255,255,0.45);
    margin: 0;
}
.hist-filter-search {
    flex: 1 1 240px;
    min-width: 180px;
    color: rgba(255,255,255,0.55);
}
.hist-filter-search input {
    flex: 1;
    padding: 7px 12px;
    background: rgba(0,0,0,0.30);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 9px;
    color: #fff;
    font-size: 12.5px;
    font-family: 'DM Sans', sans-serif;
}
.hist-filter-search input:focus { outline: none; border-color: rgba(251,191,36,0.40); }

/* Tier pill row — small variant of the depot tabs */
.hist-tier-pills { display: flex; gap: 4px; }
.hist-tier-pill {
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.02);
    color: rgba(255,255,255,0.55);
    font-family: 'DM Sans', sans-serif;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.hist-tier-pill:hover { border-color: rgba(255,255,255,0.20); color: #fff; }
.hist-tier-pill.is-active {
    border-color: rgba(251,191,36,0.40);
    background: rgba(251,191,36,0.10);
    color: #fbbf24;
}
/* When a tier-specific pill is active, recolour to that tiers shade */
.hist-tier-pill.is-active[data-tier="fp"] { border-color: rgba(192,132,252,0.40); background: rgba(192,132,252,0.10); color: #c084fc; }
.hist-tier-pill.is-active[data-tier="f"]  { border-color: rgba(96,165,250,0.40);  background: rgba(96,165,250,0.10);  color: #60a5fa; }
.hist-tier-pill.is-active[data-tier="g"]  { border-color: rgba(34,197,94,0.40);   background: rgba(34,197,94,0.10);   color: #4ade80; }
.hist-tier-pill.is-active[data-tier="fa"] { border-color: rgba(251,191,36,0.40);  background: rgba(251,191,36,0.10);  color: #fbbf24; }
.hist-tier-pill.is-active[data-tier="p"]  { border-color: rgba(239,68,68,0.40);   background: rgba(239,68,68,0.10);   color: #fca5a5; }

/* Score range mini-inputs */
.hist-range-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.hist-range-row input {
    width: 64px;
    padding: 5px 8px;
    background: rgba(0,0,0,0.30);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 7px;
    color: #fff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
    text-align: center;
}
.hist-range-row input:focus { outline: none; border-color: rgba(251,191,36,0.40); }
.hist-range-row input::-webkit-outer-spin-button,
.hist-range-row input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.hist-range-sep { color: rgba(255,255,255,0.30); }

.hist-filter-reset {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.02);
    color: rgba(255,255,255,0.55);
    font-family: 'DM Sans', sans-serif;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.12s ease, color 0.12s ease;
}
.hist-filter-reset:hover { border-color: rgba(239,68,68,0.30); color: #fca5a5; }

.hist-filter-count {
    margin-left: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    color: #fbbf24;
}

/* ============================================================
   DRIVER DETAIL — CAREER SNAPSHOT, SPARKLINES, HISTORY TABLE
   ============================================================ */

/* === Career snapshot card === */
.driver-career { padding-bottom: 22px; }
.career-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 18px;
}
@media (max-width: 900px) { .career-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .career-grid { grid-template-columns: 1fr; } }

.career-stat {
    padding: 13px 16px;
    border-radius: 11px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
}
.career-stat-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    color: rgba(255,255,255,0.42);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 8px;
}
.career-stat-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 26px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.02em;
    line-height: 1;
}
.career-stat-value.tier-fp { color: #c084fc; }
.career-stat-value.tier-f  { color: #93c5fd; }
.career-stat-value.tier-g  { color: #86efac; }
.career-stat-value.tier-fa { color: #fbbf24; }
.career-stat-value.tier-p  { color: #fca5a5; }
.career-stat-year {
    margin-left: 4px;
    font-size: 14px;
    font-weight: 600;
    color: rgba(255,255,255,0.45);
    letter-spacing: 0;
}
.career-stat-suffix {
    margin-left: 3px;
    font-size: 14px;
    font-weight: 600;
    opacity: 0.65;
}
.career-stat-foot {
    margin-top: 6px;
    font-family: 'DM Sans', sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.50);
}

/* === Tier distribution stacked bar === */
.career-tier-bar-wrap {
    padding: 14px 16px;
    border-radius: 11px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
}
.career-tier-bar-head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px;
}
.career-tier-bar-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    font-weight: 800;
    color: rgba(255,255,255,0.55);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.career-tier-bar-total {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    color: rgba(255,255,255,0.40);
}
.career-tier-bar {
    display: flex;
    height: 22px;
    border-radius: 7px;
    overflow: hidden;
    gap: 1px;
    background: rgba(0,0,0,0.30);
}
.career-tier-seg {
    height: 100%;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    cursor: help;
    transition: filter 0.15s ease;
}
.career-tier-seg:hover { filter: brightness(1.18); }
.career-tier-seg-pct {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 800;
    color: rgba(0,0,0,0.65);
    letter-spacing: 0.02em;
}
.career-tier-legend {
    display: flex; flex-wrap: wrap; gap: 12px;
    margin-top: 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 11.5px;
    font-weight: 600;
    color: rgba(255,255,255,0.55);
}
.career-tier-leg {
    display: inline-flex; align-items: center; gap: 6px;
}
.career-tier-leg-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    box-shadow: 0 0 6px currentColor;
}
.career-tier-leg strong {
    color: #fff;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
}

/* === Sparklines inside metric tiles === */
.driver-metric-tile { padding-bottom: 14px; }
.driver-metric-spark {
    width: 100%;
    height: 24px;
    display: block;
    margin: 6px 0 10px;
    opacity: 0.85;
}
.driver-metric-spark.tier-line-fp { color: #c084fc; }
.driver-metric-spark.tier-line-f  { color: #93c5fd; }
.driver-metric-spark.tier-line-g  { color: #86efac; }
.driver-metric-spark.tier-line-fa { color: #fbbf24; }
.driver-metric-spark.tier-line-p  { color: #fca5a5; }

.driver-metric-extremes {
    display: flex;
    gap: 10px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed rgba(255,255,255,0.06);
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    color: rgba(255,255,255,0.50);
}
.driver-metric-ext {
    display: inline-flex; align-items: center; gap: 4px;
    cursor: help;
}
.driver-metric-ext-best  { color: #86efac; }
.driver-metric-ext-worst { color: #fca5a5; }

/* === Weekly history table === */
.driver-history-card { padding: 0; overflow: hidden; }
.driver-history-details { width: 100%; }
.driver-history-summary {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: background 0.12s ease;
}
.driver-history-summary::-webkit-details-marker { display: none; }
.driver-history-summary:hover { background: rgba(255,255,255,0.02); }
.driver-history-summary-main {
    display: flex; align-items: center; gap: 8px;
    color: #fff;
}
.driver-history-summary-main .app-card-title { margin: 0; }
.driver-history-caret {
    color: rgba(255,255,255,0.45);
    transition: transform 0.2s ease;
}
details[open] .driver-history-caret { transform: rotate(90deg); }

.driver-history-table-wrap {
    overflow-x: auto;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.driver-history-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'DM Sans', sans-serif;
    font-size: 12.5px;
}
.driver-history-table thead th {
    text-align: left;
    padding: 11px 12px;
    background: rgba(0,0,0,0.20);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    font-weight: 800;
    color: rgba(255,255,255,0.55);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}
.driver-history-table tbody td {
    padding: 9px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.78);
    white-space: nowrap;
}
.driver-history-table tbody tr:hover td { background: rgba(255,255,255,0.025); }
.driver-history-table tbody tr:last-child td { border-bottom: none; }

.dht-col-wk { width: 78px; }
.dht-week {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 800;
    color: #fff;
    font-size: 13px;
}
.dht-year {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    color: rgba(255,255,255,0.40);
    margin-left: 4px;
}
.dht-col-score { width: 70px; text-align: right; }
.dht-score {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: -0.01em;
}
.dht-score.tier-fp { color: #c084fc; }
.dht-score.tier-f  { color: #93c5fd; }
.dht-score.tier-g  { color: #86efac; }
.dht-score.tier-fa { color: #fbbf24; }
.dht-score.tier-p  { color: #fca5a5; }
.dht-col-tier { width: 110px; }
.dht-col-del {
    width: 70px;
    text-align: right;
    font-family: 'JetBrains Mono', monospace;
    color: rgba(255,255,255,0.55);
    font-size: 12px;
}
.dht-col-metric {
    text-align: right;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    color: rgba(255,255,255,0.65);
}
.dht-col-metric.tier-cell-fp { color: #c084fc; }
.dht-col-metric.tier-cell-f  { color: #93c5fd; }
.dht-col-metric.tier-cell-g  { color: #86efac; }
.dht-col-metric.tier-cell-fa { color: #fbbf24; }
.dht-col-metric.tier-cell-p  { color: #fca5a5; }


/* Driver-name link styling — keeps the inline text-look (no underline
   leaking from the browser default), inherits row colour, and gives
   a subtle amber-tinted affordance on hover only. Used on:
     - scorecards.php detail table (.sc-driver-link)
     - home.php Top Performers / WoW Movers / Alerts (.app-row-link) */
.sc-driver-link,
.app-row-link {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color 0.12s ease, border-color 0.12s ease;
}
.sc-driver-link:hover,
.app-row-link:hover {
    color: #fbbf24;
    border-bottom-color: rgba(251,191,36,0.40);
}
.app-row-link { display: inline-block; }

/* ============================================================
   COMPANY SCORE CARD (home aggregate scope)
   ============================================================
   Tenant-wide performance headline. Big tier-coloured score on the
   left, sparkline on the right showing the last 12 weeks. Context
   strip below with last-week / YTD / all-time / depots-reporting.

   Visual rhyme with the driver-page hero — same tier aura pattern,
   same big monospace score, same tier-coloured dot indicator. So the
   "Company" page and the "Driver" page feel like siblings, not
   strangers. */
.company-score-card {
    position: relative;
    overflow: hidden;
    padding: 0;
    border: 1px solid rgba(255,255,255,0.06);
}
.company-score-aura {
    position: absolute;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(circle at 6% 30%, rgba(255,255,255,0.04), transparent 40%),
        linear-gradient(135deg, rgba(255,255,255,0.025) 0%, transparent 60%);
    pointer-events: none;
}
.company-score-card.has-tier-fp .company-score-aura { background: radial-gradient(circle at 6% 30%, rgba(192,132,252,0.18), transparent 45%), linear-gradient(135deg, rgba(192,132,252,0.05) 0%, transparent 60%); }
.company-score-card.has-tier-f  .company-score-aura { background: radial-gradient(circle at 6% 30%, rgba(96,165,250,0.16),  transparent 45%), linear-gradient(135deg, rgba(96,165,250,0.04)  0%, transparent 60%); }
.company-score-card.has-tier-g  .company-score-aura { background: radial-gradient(circle at 6% 30%, rgba(74,222,128,0.16),  transparent 45%), linear-gradient(135deg, rgba(74,222,128,0.04)  0%, transparent 60%); }
.company-score-card.has-tier-fa .company-score-aura { background: radial-gradient(circle at 6% 30%, rgba(251,191,36,0.16),  transparent 45%), linear-gradient(135deg, rgba(251,191,36,0.04)  0%, transparent 60%); }
.company-score-card.has-tier-p  .company-score-aura { background: radial-gradient(circle at 6% 30%, rgba(248,113,113,0.16), transparent 45%), linear-gradient(135deg, rgba(248,113,113,0.04) 0%, transparent 60%); }

/* Top row: headline + sparkline */
.company-score-head {
    position: relative; z-index: 1;
    display: flex; align-items: center; gap: 24px;
    padding: 22px 26px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.company-score-headline { flex: 1; min-width: 0; }
.company-score-eyebrow {
    display: inline-flex; align-items: center; gap: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    font-weight: 800;
    color: rgba(255,255,255,0.50);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 12px;
}
.company-score-eyebrow svg { color: #fbbf24; }
.company-score-row {
    display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap;
}
.company-score-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 56px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.035em;
    color: #fff;
    text-shadow: 0 0 30px currentColor;
}
.company-score-num.tier-fp { color: #c084fc; }
.company-score-num.tier-f  { color: #93c5fd; }
.company-score-num.tier-g  { color: #86efac; }
.company-score-num.tier-fa { color: #fbbf24; }
.company-score-num.tier-p  { color: #fca5a5; }

.company-score-side {
    display: flex; flex-direction: column; gap: 7px;
    padding-bottom: 4px;
}
.company-score-tier {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 5px 12px;
    border-radius: 999px;
    font-family: 'DM Sans', sans-serif;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.03em;
    border: 1px solid;
}
.company-score-tier.tier-fp { color: #c084fc; border-color: rgba(192,132,252,0.45); background: rgba(192,132,252,0.10); }
.company-score-tier.tier-f  { color: #93c5fd; border-color: rgba(96,165,250,0.45);  background: rgba(96,165,250,0.10); }
.company-score-tier.tier-g  { color: #86efac; border-color: rgba(74,222,128,0.45);  background: rgba(74,222,128,0.10); }
.company-score-tier.tier-fa { color: #fbbf24; border-color: rgba(251,191,36,0.45);  background: rgba(251,191,36,0.10); }
.company-score-tier.tier-p  { color: #fca5a5; border-color: rgba(248,113,113,0.45); background: rgba(248,113,113,0.10); }
.company-score-tier-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 8px currentColor;
}
.company-score-delta {
    display: inline-flex; align-items: center; gap: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12.5px;
    font-weight: 800;
    letter-spacing: -0.01em;
}
.company-score-delta.is-up   { color: #86efac; }
.company-score-delta.is-down { color: #fca5a5; }
.company-score-delta.is-flat { color: rgba(255,255,255,0.45); }
.company-score-caption {
    font-family: 'DM Sans', sans-serif;
    font-size: 11.5px;
    font-weight: 600;
    color: rgba(255,255,255,0.45);
}

/* Sparkline on the right */
.company-score-spark {
    flex-shrink: 0;
    width: 380px;
    max-width: 50%;
    height: 96px;
    display: block;
}
.company-score-spark.tier-line-fp { color: #c084fc; }
.company-score-spark.tier-line-f  { color: #93c5fd; }
.company-score-spark.tier-line-g  { color: #86efac; }
.company-score-spark.tier-line-fa { color: #fbbf24; }
.company-score-spark.tier-line-p  { color: #fca5a5; }
.company-score-spark-dot.tier-fill-fp { fill: #c084fc; }
.company-score-spark-dot.tier-fill-f  { fill: #60a5fa; }
.company-score-spark-dot.tier-fill-g  { fill: #4ade80; }
.company-score-spark-dot.tier-fill-fa { fill: #fbbf24; }
.company-score-spark-dot.tier-fill-p  { fill: #f87171; }

@media (max-width: 800px) {
    .company-score-head { flex-direction: column; align-items: stretch; gap: 16px; padding: 18px 20px 14px; }
    .company-score-spark { width: 100%; max-width: 100%; height: 80px; }
    .company-score-num { font-size: 44px; }
}

/* Context strip below */
.company-score-strip {
    position: relative; z-index: 1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: rgba(255,255,255,0.05);
}
.company-score-stat {
    padding: 14px 18px;
    background: rgba(255,255,255,0.01);
    transition: background 0.12s ease;
}
.company-score-stat:hover { background: rgba(255,255,255,0.03); }
.company-score-stat-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 800;
    color: rgba(255,255,255,0.40);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 6px;
}
.company-score-stat-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.02em;
    line-height: 1;
}
.company-score-stat-val.tier-fp { color: #c084fc; }
.company-score-stat-val.tier-f  { color: #93c5fd; }
.company-score-stat-val.tier-g  { color: #86efac; }
.company-score-stat-val.tier-fa { color: #fbbf24; }
.company-score-stat-val.tier-p  { color: #fca5a5; }
.company-score-stat-foot {
    margin-top: 5px;
    font-family: 'DM Sans', sans-serif;
    font-size: 10.5px;
    font-weight: 600;
    color: rgba(255,255,255,0.45);
}

@media (max-width: 700px) {
    .company-score-strip { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   CUSTOM SCROLLBARS — match the dark theme
   ============================================================
   Default browser scrollbars (especially Windows Chrome/Edge) are
   wide, light-gray, and stick out painfully on a dark UI. Native
   `overflow: auto` should hide them when content fits, but Windows
   often shows a stub bar anyway due to sub-pixel rounding.

   Fix: thin, near-invisible scrollbars by default; subtly brighten
   on hover to confirm they're there. Applies globally so every
   scrollable container in the app (tables, modals, panels) reads
   consistently.

   - Firefox: scrollbar-width + scrollbar-color
   - WebKit: ::-webkit-scrollbar pseudo-elements
*/

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.10) transparent;
}

/* WebKit / Blink — Chrome, Safari, Edge, modern Opera */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.08);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: content-box;
    transition: background-color 0.15s ease;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.22);
    background-clip: content-box;
}
::-webkit-scrollbar-corner {
    background: transparent;
}

/* Inside data tables (scorecards drivers, driver history, settings
   targets) the scrollbar adds visual clutter without earning its
   pixels — even when content fits, Windows often shows a stub bar
   from sub-pixel rounding.

   Approach: hide the scrollbar completely. Scrolling still works
   via touch swipe, shift+wheel, horizontal trackpad gesture, and
   keyboard arrows. The table footer text "Scroll → for all metrics"
   provides the explicit affordance for users who'd otherwise miss
   the gestural cue.

   When content actually overflows, a soft mask-image fade on the
   right edge tells the eye there's more — only visible when content
   actually extends past the wrap's right boundary (since mask is a
   render-time effect, not a positioned overlay, it doesn't move
   with horizontal scroll). */
.sc-table-wrap,
.driver-history-table-wrap,
.settings-targets-wrap,
.tscroll {
    scrollbar-width: none;          /* Firefox */
}
.sc-table-wrap::-webkit-scrollbar,
.driver-history-table-wrap::-webkit-scrollbar,
.settings-targets-wrap::-webkit-scrollbar,
.tscroll::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;                  /* Chrome / Safari / Edge */
}

/* Soft right-edge fade — pure render-time effect via mask-image.
   When the user scrolls all the way to the right end, the fade
   covers the empty padding (invisible). When there's more content
   to the right, the fade hints at it by softening the last column.
   When content fits the wrap exactly, the fade sits over the right
   padding and reads as a gentle vignette — never wrong. */
.sc-table-wrap,
.driver-history-table-wrap {
    -webkit-mask-image: linear-gradient(to right, black 0%, black calc(100% - 24px), rgba(0,0,0,0.5) 100%);
    mask-image:         linear-gradient(to right, black 0%, black calc(100% - 24px), rgba(0,0,0,0.5) 100%);
}

/* ============================================================
   ANOMALY BANNER (home aggregate) — compact tabbed version
   ============================================================
   Two tabs: "Action needed" (critical + warning) and "Recognition"
   (positives). Default tab is Action so what-needs-fixing gets the
   foreground; positives are a click away.

   Rows are dense (10px padding, 12px font) so 5 fit in a comfortable
   ~280px tall block. Anything past 5 hidden with "Show all N" affordance.
   ============================================================ */
.anomaly-card { padding: 0; overflow: hidden; }
.anomaly-details { width: 100%; }

.anomaly-summary {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 18px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    gap: 12px;
    flex-wrap: wrap;
    transition: background 0.12s ease;
}
.anomaly-summary::-webkit-details-marker { display: none; }
.anomaly-summary:hover { background: rgba(255,255,255,0.02); }
.anomaly-summary-left { display: flex; align-items: center; gap: 9px; }
.anomaly-summary-title {
    font-family: 'DM Sans', sans-serif;
    font-size: 13.5px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.005em;
}
.anomaly-caret {
    color: rgba(255,255,255,0.45);
    transition: transform 0.2s ease;
}
.anomaly-details[open] .anomaly-caret { transform: rotate(90deg); }

.anomaly-summary-counts {
    display: flex; gap: 5px; flex-wrap: wrap;
}
.anomaly-count-pill {
    display: inline-flex; align-items: center;
    padding: 2px 9px;
    border-radius: 999px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 1px solid;
}
.anomaly-count-pill.is-critical { color: #fca5a5; border-color: rgba(248,113,113,0.45); background: rgba(248,113,113,0.10); }
.anomaly-count-pill.is-warning  { color: #fbbf24; border-color: rgba(251,191,36,0.45); background: rgba(251,191,36,0.10); }
.anomaly-count-pill.is-positive { color: #86efac; border-color: rgba(74,222,128,0.45); background: rgba(74,222,128,0.10); }

.anomaly-body {
    border-top: 1px solid rgba(255,255,255,0.06);
    padding: 12px 18px 14px;
}

/* Tab pill row */
.anomaly-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
}
.anomaly-tab {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.02);
    color: rgba(255,255,255,0.60);
    font-family: 'DM Sans', sans-serif;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.anomaly-tab:hover { border-color: rgba(255,255,255,0.20); color: #fff; }
.anomaly-tab.is-active {
    border-color: rgba(251,191,36,0.45);
    background: rgba(251,191,36,0.10);
    color: #fbbf24;
}
.anomaly-tab[data-tab="recognition"].is-active {
    border-color: rgba(74,222,128,0.45);
    background: rgba(74,222,128,0.10);
    color: #86efac;
}
.anomaly-tab-count {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
}
.anomaly-tab.is-active .anomaly-tab-count {
    background: rgba(0,0,0,0.25);
}

/* Panes — only the active one is visible */
.anomaly-pane { display: none; }
.anomaly-pane.is-active { display: block; }

.anomaly-list { display: flex; flex-direction: column; gap: 2px; }

/* Rows — dense and link-like.
   Tied to <a> so the whole row is clickable; the right-side chevron
   is decorative. Subtle severity tint on the left border, no full
   row background tint (would compete with the dashboards visual
   focus). */
.anomaly-row {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 12px;
    border-radius: 8px;
    border-left: 2.5px solid transparent;
    text-decoration: none;
    color: inherit;
    transition: background 0.12s ease;
}
.anomaly-row:hover { background: rgba(255,255,255,0.025); }
.anomaly-row.is-overflow { display: none; }
.anomaly-sev-critical { border-left-color: #f87171; }
.anomaly-sev-warning  { border-left-color: #fbbf24; }
.anomaly-sev-positive { border-left-color: #4ade80; }

.anomaly-row-icon {
    flex-shrink: 0;
    width: 24px; height: 24px;
    border-radius: 7px;
    display: inline-flex; align-items: center; justify-content: center;
}
.anomaly-sev-critical .anomaly-row-icon { color: #fca5a5; background: rgba(248,113,113,0.10); }
.anomaly-sev-warning  .anomaly-row-icon { color: #fbbf24; background: rgba(251,191,36,0.10); }
.anomaly-sev-positive .anomaly-row-icon { color: #86efac; background: rgba(74,222,128,0.10); }

.anomaly-row-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
    overflow: hidden;
}
.anomaly-row-title {
    font-family: 'DM Sans', sans-serif;
    font-size: 12.5px;
    font-weight: 700;
    color: #fff;
    line-height: 1.35;
    /* Single-line on desktop with ellipsis so dense rows stay calm */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.anomaly-row-body {
    font-family: 'DM Sans', sans-serif;
    font-size: 11px;
    font-weight: 500;
    color: rgba(255,255,255,0.50);
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.anomaly-row-arrow {
    flex-shrink: 0;
    color: rgba(255,255,255,0.30);
    transition: color 0.12s ease, transform 0.12s ease;
}
.anomaly-row:hover .anomaly-row-arrow {
    color: #fbbf24;
    transform: translateX(2px);
}

.anomaly-show-more {
    display: inline-flex; align-items: center; gap: 5px;
    margin-top: 8px;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.08);
    background: transparent;
    color: rgba(255,255,255,0.62);
    font-family: 'DM Sans', sans-serif;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.12s ease, color 0.12s ease, background 0.12s ease;
}
.anomaly-show-more:hover {
    border-color: rgba(251,191,36,0.35);
    color: #fbbf24;
    background: rgba(251,191,36,0.06);
}

/* Mobile: row text wraps, arrow drops below, tabs scroll horizontally */
@media (max-width: 700px) {
    .anomaly-summary { padding: 11px 14px; }
    .anomaly-body { padding: 10px 14px 12px; }
    .anomaly-tabs { overflow-x: auto; scrollbar-width: none; }
    .anomaly-tabs::-webkit-scrollbar { display: none; }
    .anomaly-tab { flex-shrink: 0; }
    .anomaly-row-title, .anomaly-row-body { white-space: normal; }
}

/* ============================================================
   NOTIFICATION BELL (topbar)
   ============================================================
   Replaces the inline anomaly banner. Lives next to the depot
   picker; tier-coloured badge shows action-item count. Click
   opens a dropdown panel anchored to the bell. Visible on every
   page, not just home. */
.app-bell {
    position: relative;
    display: flex;
    align-items: center;
}
.app-bell-trigger {
    position: relative;
    width: 38px; height: 38px;
    border-radius: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.70);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.app-bell-trigger:hover,
.app-bell.is-open .app-bell-trigger {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.16);
    color: #fff;
}
.app-bell-trigger.has-warning { color: #fbbf24; }
.app-bell-trigger.has-critical { color: #fca5a5; }
.app-bell-trigger.has-critical:hover { color: #fca5a5; }

/* Badge — top-right corner, monospaced number */
.app-bell-badge {
    position: absolute;
    top: -4px; right: -4px;
    min-width: 18px; height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #fbbf24;
    color: #0a0e1a;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 8px rgba(251,191,36,0.45), 0 0 0 2px #0a0e1a;
    letter-spacing: -0.02em;
}
.app-bell-badge.is-critical {
    background: #f87171;
    color: #fff;
    box-shadow: 0 2px 8px rgba(248,113,113,0.5), 0 0 0 2px #0a0e1a;
}
/* Green dot when only positives — quiet "all clear with high-fives" */
.app-bell-dot {
    position: absolute;
    top: 6px; right: 6px;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 6px #4ade80, 0 0 0 2px #0a0e1a;
}

/* === Dropdown panel ===
   IMPORTANT: the `display: flex` below would override the browser's
   default `display: none` for [hidden] elements, so we explicitly
   restore the hide rule with higher specificity. Without this the
   panel renders open on every page load, regardless of what the
   `hidden` attribute and our JS think the state is. */
.app-bell-panel[hidden] { display: none !important; }

.app-bell-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: min(440px, calc(100vw - 32px));
    max-height: 70vh;
    border-radius: 14px;
    background: rgba(13, 19, 33, 0.98);
    border: 1px solid rgba(255,255,255,0.10);
    box-shadow: 0 20px 60px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.03);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 200;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: bellFadeIn 0.16s ease;
}
@keyframes bellFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.app-bell-panel-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.app-bell-panel-title {
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.005em;
}
.app-bell-panel-close {
    width: 26px; height: 26px;
    border-radius: 7px;
    background: transparent;
    border: 1px solid transparent;
    color: rgba(255,255,255,0.45);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.app-bell-panel-close:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
    border-color: rgba(255,255,255,0.08);
}

.app-bell-panel-body {
    padding: 12px 14px 14px;
    overflow-y: auto;
    /* In flex columns the default min-height: auto on the child sizes
       it to content, so overflow-y: auto has no overflow to handle and
       the panel grows past max-height. Setting min-height: 0 lets the
       child shrink and scroll properly. */
    min-height: 0;
    flex: 1 1 auto;
}

/* === Header actions: Mark all read + Close === */
.app-bell-panel-head-actions {
    display: flex; align-items: center; gap: 4px;
}
.app-bell-mark-all {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 9px;
    border-radius: 7px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.55);
    font-family: 'DM Sans', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.app-bell-mark-all:hover {
    border-color: rgba(74,222,128,0.35);
    background: rgba(74,222,128,0.08);
    color: #86efac;
}

/* === Per-row dismiss button + wrap === */
.anomaly-row-wrap {
    position: relative;
    transition: opacity 0.16s ease, transform 0.16s ease;
}
.anomaly-row-wrap.is-overflow { display: none; }
.anomaly-row-wrap.is-dismissed { display: none; }

.anomaly-row-dismiss {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    width: 22px; height: 22px;
    border-radius: 6px;
    background: transparent;
    border: 1px solid transparent;
    color: rgba(255,255,255,0.35);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    opacity: 0;
    transition: opacity 0.12s ease, color 0.12s ease, background 0.12s ease, border-color 0.12s ease;
    z-index: 1;
}
.anomaly-row-wrap:hover .anomaly-row-dismiss,
.anomaly-row-dismiss:focus-visible {
    opacity: 1;
}
.anomaly-row-dismiss:hover {
    color: #fca5a5;
    background: rgba(248,113,113,0.10);
    border-color: rgba(248,113,113,0.25);
}
/* When the dismiss button is hovered, dim the chevron so users dont
   misread which one theyre clicking. */
.anomaly-row-wrap:hover .anomaly-row-arrow { opacity: 0.4; }

/* Empty state when a tab has nothing left to read */
.anomaly-empty {
    padding: 28px 16px;
    text-align: center;
    color: rgba(255,255,255,0.40);
    font-family: 'DM Sans', sans-serif;
    font-size: 12.5px;
    font-weight: 600;
}

/* Tab pills inside the panel — same look as before, just inside
   the popover now (smaller padding, tighter spacing) */
.app-bell-panel .anomaly-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
}
.app-bell-panel .anomaly-tab {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 6px 11px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.02);
    color: rgba(255,255,255,0.60);
    font-family: 'DM Sans', sans-serif;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.app-bell-panel .anomaly-tab:hover { border-color: rgba(255,255,255,0.20); color: #fff; }
.app-bell-panel .anomaly-tab.is-active {
    border-color: rgba(251,191,36,0.45);
    background: rgba(251,191,36,0.10);
    color: #fbbf24;
}
.app-bell-panel .anomaly-tab[data-bell-tab="recognition"].is-active {
    border-color: rgba(74,222,128,0.45);
    background: rgba(74,222,128,0.10);
    color: #86efac;
}
.app-bell-panel .anomaly-tab-count {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
}
.app-bell-panel .anomaly-tab.is-active .anomaly-tab-count {
    background: rgba(0,0,0,0.25);
}

/* Show-more button — full width in the panel context */
.app-bell-panel .anomaly-show-more {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-top: 8px;
    padding: 7px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.08);
    background: transparent;
    color: rgba(255,255,255,0.62);
    font-family: 'DM Sans', sans-serif;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.12s ease, color 0.12s ease, background 0.12s ease;
}
.app-bell-panel .anomaly-show-more:hover {
    border-color: rgba(251,191,36,0.35);
    color: #fbbf24;
    background: rgba(251,191,36,0.06);
}

/* Mobile: panel becomes full-width drawer-style anchored at top right */
@media (max-width: 720px) {
    .app-bell-panel {
        position: fixed;
        top: 64px;
        right: 12px;
        left: 12px;
        width: auto;
        max-height: calc(100vh - 80px);
    }
    .app-bell-trigger { width: 36px; height: 36px; }
}

/* Smaller topbar variant: lose the bell text label if any */
.app-bell-trigger svg { display: block; }

/* ============================================================
   DRIVER MILESTONES — achievement badge grid
   ============================================================
   Tier-coloured tiles surface volume, tenure, performance,
   consistency, and trend achievements. Sit between Career
   Snapshot and the trend chart on driver.php.

   Tier palette:
     bronze    earthy/copper       common achievement
     silver    cool grey-blue      meaningful effort
     gold      warm amber/yellow   real distinction
     platinum  prismatic violet    rare excellence
*/
.driver-milestones-card { padding: 18px 20px; margin-bottom: 14px; }
.driver-milestones-head {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
}
.driver-milestones-title {
    display: inline-flex; align-items: center; gap: 8px;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 800;
    color: rgba(255,255,255,0.85);
    letter-spacing: 0.01em;
    text-transform: uppercase;
}
.driver-milestones-title svg { color: #fbbf24; }
.driver-milestones-count {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(251,191,36,0.10);
    color: #fbbf24;
    border: 1px solid rgba(251,191,36,0.30);
}

/* Trend pill (sits on the right of the head) */
.driver-trend-pill {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 5px 11px;
    border-radius: 999px;
    border: 1px solid;
    font-family: 'DM Sans', sans-serif;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.01em;
}
.driver-trend-pill .driver-trend-delta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    font-weight: 800;
    opacity: 0.85;
}
.driver-trend-up   { color: #86efac; border-color: rgba(74,222,128,0.40); background: rgba(74,222,128,0.08); }
.driver-trend-down { color: #fca5a5; border-color: rgba(248,113,113,0.40); background: rgba(248,113,113,0.08); }
.driver-trend-flat { color: rgba(255,255,255,0.65); border-color: rgba(255,255,255,0.18); background: rgba(255,255,255,0.04); }

/* Grid — responsive auto-fill, 220-260px tiles */
.driver-milestones-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}

.driver-milestone {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px;
    border-radius: 11px;
    border: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.015);
    position: relative;
    overflow: hidden;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.driver-milestone:hover {
    transform: translateY(-1px);
    background: rgba(255,255,255,0.03);
}

/* Subtle gradient sheen behind the icon, tier-coloured */
.driver-milestone::before {
    content: "";
    position: absolute;
    top: 0; left: 0;
    width: 60%; height: 100%;
    pointer-events: none;
    opacity: 0.55;
    z-index: 0;
}

.driver-milestone-icon {
    flex-shrink: 0;
    width: 38px; height: 38px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid;
    z-index: 1;
}
.driver-milestone-icon svg { width: 17px; height: 17px; }

.driver-milestone-main {
    flex: 1;
    min-width: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.driver-milestone-label {
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
    letter-spacing: -0.005em;
}
.driver-milestone-sub {
    font-family: 'DM Sans', sans-serif;
    font-size: 11px;
    font-weight: 500;
    color: rgba(255,255,255,0.50);
    line-height: 1.3;
}

/* Tier palettes — colour the icon + border + gradient */
.driver-milestone-bronze {
    border-color: rgba(180, 100, 60, 0.30);
}
.driver-milestone-bronze .driver-milestone-icon {
    color: #d4906c;
    background: rgba(180, 100, 60, 0.12);
    border-color: rgba(180, 100, 60, 0.30);
}
.driver-milestone-bronze::before {
    background: radial-gradient(ellipse at 0% 50%, rgba(180, 100, 60, 0.10), transparent 70%);
}

.driver-milestone-silver {
    border-color: rgba(180, 200, 220, 0.18);
}
.driver-milestone-silver .driver-milestone-icon {
    color: #cbd5e1;
    background: rgba(180, 200, 220, 0.10);
    border-color: rgba(180, 200, 220, 0.30);
}
.driver-milestone-silver::before {
    background: radial-gradient(ellipse at 0% 50%, rgba(180, 200, 220, 0.10), transparent 70%);
}

.driver-milestone-gold {
    border-color: rgba(251, 191, 36, 0.30);
}
.driver-milestone-gold .driver-milestone-icon {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.12);
    border-color: rgba(251, 191, 36, 0.35);
    box-shadow: 0 0 12px rgba(251, 191, 36, 0.15);
}
.driver-milestone-gold::before {
    background: radial-gradient(ellipse at 0% 50%, rgba(251, 191, 36, 0.14), transparent 70%);
}
.driver-milestone-gold .driver-milestone-label {
    color: #fef3c7;
}

.driver-milestone-platinum {
    border-color: rgba(168, 85, 247, 0.35);
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.05), rgba(96, 165, 250, 0.04));
}
.driver-milestone-platinum .driver-milestone-icon {
    color: #c084fc;
    background: rgba(168, 85, 247, 0.14);
    border-color: rgba(168, 85, 247, 0.40);
    box-shadow: 0 0 14px rgba(168, 85, 247, 0.25);
}
.driver-milestone-platinum::before {
    background: radial-gradient(ellipse at 0% 50%, rgba(168, 85, 247, 0.18), transparent 70%);
}
.driver-milestone-platinum .driver-milestone-label {
    color: #f3e8ff;
    background: linear-gradient(90deg, #c084fc 0%, #93c5fd 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Mobile: single column, slightly tighter padding */
@media (max-width: 700px) {
    .driver-milestones-card { padding: 16px; }
    .driver-milestones-head { gap: 8px; }
    .driver-milestones-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .driver-milestone { padding: 10px 12px; }
    .driver-milestone-icon { width: 34px; height: 34px; }
    .driver-milestone-icon svg { width: 15px; height: 15px; }
}

/* ============================================================
   CHAT AI WIDGET
   ============================================================
   Floating bubble bottom-right, expanding into a chat panel.
   On every logged-in page when Groq API is configured. */

.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    font-family: 'DM Sans', sans-serif;
}

/* === Floating action button === */
.chat-fab {
    position: relative;
    width: 56px; height: 56px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #0a0e1a;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 10px 30px rgba(251,191,36,0.30), 0 0 0 1px rgba(255,255,255,0.10), 0 4px 12px rgba(0,0,0,0.40);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.chat-fab:hover {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 14px 36px rgba(251,191,36,0.40), 0 0 0 1px rgba(255,255,255,0.16), 0 6px 16px rgba(0,0,0,0.50);
}
.chat-fab:active { transform: translateY(0) scale(1); }
.chat-fab svg { position: relative; z-index: 2; }
.chat-fab-glow {
    position: absolute; inset: -4px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(251,191,36,0.30), transparent 70%);
    z-index: 1;
    animation: chatFabPulse 2.4s ease-in-out infinite;
    pointer-events: none;
}
@keyframes chatFabPulse {
    0%, 100% { opacity: 0.35; transform: scale(1); }
    50%      { opacity: 0.70; transform: scale(1.15); }
}

/* === Panel === */
.chat-panel[hidden] { display: none !important; }
.chat-panel {
    position: absolute;
    bottom: calc(100% + 12px);
    right: 0;
    width: 380px;
    height: 580px;
    max-height: calc(100vh - 100px);
    border-radius: 16px;
    background: rgba(13, 19, 33, 0.98);
    border: 1px solid rgba(255,255,255,0.10);
    box-shadow: 0 24px 60px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.04);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: chatPanelIn 0.20s cubic-bezier(.2,.9,.3,1);
}
@keyframes chatPanelIn {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* === Panel head === */
.chat-panel-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.chat-panel-title {
    display: flex; align-items: center; gap: 10px;
}
.chat-panel-avatar {
    width: 32px; height: 32px;
    border-radius: 9px;
    background: linear-gradient(135deg, rgba(251,191,36,0.20), rgba(245,158,11,0.10));
    border: 1px solid rgba(251,191,36,0.30);
    color: #fbbf24;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.chat-panel-title-main {
    font-size: 13.5px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.005em;
}
.chat-panel-title-sub {
    font-size: 11px;
    font-weight: 500;
    color: rgba(255,255,255,0.45);
    margin-top: 1px;
}
.chat-panel-close {
    width: 26px; height: 26px;
    border-radius: 7px;
    background: transparent;
    border: 1px solid transparent;
    color: rgba(255,255,255,0.45);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.chat-panel-close:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
    border-color: rgba(255,255,255,0.08);
}

/* === Panel body (scrollable messages) === */
.chat-panel-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Welcome state */
.chat-welcome.is-hidden { display: none; }
.chat-welcome {
    padding: 8px 4px;
}
.chat-welcome-title {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}
.chat-welcome-sub {
    font-size: 12px;
    color: rgba(255,255,255,0.55);
    margin-bottom: 14px;
}
.chat-suggestions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.chat-suggestion {
    text-align: left;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.02);
    color: rgba(255,255,255,0.75);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease, transform 0.12s ease;
}
.chat-suggestion:hover {
    border-color: rgba(251,191,36,0.40);
    background: rgba(251,191,36,0.06);
    color: #fbbf24;
    transform: translateX(2px);
}

/* === Bubbles === */
.chat-bubble {
    padding: 10px 14px;
    border-radius: 13px;
    font-size: 13px;
    line-height: 1.45;
    max-width: 86%;
    word-wrap: break-word;
    animation: chatBubbleIn 0.16s ease;
}
@keyframes chatBubbleIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.chat-bubble-user {
    align-self: flex-end;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #0a0e1a;
    font-weight: 600;
    border-bottom-right-radius: 4px;
}
.chat-bubble-assistant {
    align-self: flex-start;
    background: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.90);
    border: 1px solid rgba(255,255,255,0.06);
    border-bottom-left-radius: 4px;
}
.chat-bubble-assistant strong { color: #fff; font-weight: 700; }
.chat-bubble-assistant code {
    background: rgba(251,191,36,0.10);
    color: #fbbf24;
    padding: 1px 5px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
}
.chat-bubble-error {
    align-self: flex-start;
    background: rgba(248,113,113,0.10);
    color: #fca5a5;
    border: 1px solid rgba(248,113,113,0.30);
    font-size: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    max-width: 86%;
}

/* Typing indicator (three dots) */
.chat-typing {
    display: inline-flex; gap: 4px;
    padding: 4px 0;
}
.chat-typing span {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.50);
    animation: chatTyping 1.2s ease-in-out infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.30s; }
@keyframes chatTyping {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30%           { transform: translateY(-4px); opacity: 1; }
}

/* === Input row === */
.chat-panel-input {
    display: flex;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.chat-input {
    flex: 1;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.04);
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: border-color 0.12s ease, background 0.12s ease;
}
.chat-input::placeholder { color: rgba(255,255,255,0.40); }
.chat-input:focus {
    border-color: rgba(251,191,36,0.45);
    background: rgba(255,255,255,0.06);
}
.chat-input:disabled { opacity: 0.55; }
.chat-send {
    width: 38px; height: 38px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #0a0e1a;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    flex-shrink: 0;
}
.chat-send:hover {
    transform: scale(1.06);
    box-shadow: 0 4px 12px rgba(251,191,36,0.40);
}
.chat-send:active { transform: scale(0.96); }
.chat-send:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }

/* === Mobile: panel becomes full-screen drawer === */
@media (max-width: 540px) {
    .chat-widget { bottom: 16px; right: 16px; }
    .chat-fab { width: 50px; height: 50px; }
    .chat-panel {
        position: fixed;
        bottom: 0; right: 0; left: 0;
        width: 100%;
        height: 90vh;
        max-height: 90vh;
        border-radius: 18px 18px 0 0;
        animation: chatPanelInMobile 0.22s cubic-bezier(.2,.9,.3,1);
    }
    @keyframes chatPanelInMobile {
        from { transform: translateY(20px); opacity: 0; }
        to   { transform: translateY(0); opacity: 1; }
    }
}

/* ═══════════════════════════════════════════════════════════════════
   All Metrics page — Enterprise redesign
   ═══════════════════════════════════════════════════════════════════

   Uses the existing design system tokens (--bg-*, --accent, --fp/
   --fant/--great/--fair/--poor) for full visual consistency with
   the login screen and the rest of the app.

   Architecture:
   - Hero header: title + sub + pill period selector + tier legend
   - Each depot is a glass card with summary chips in the header
   - CSS Grid for the data matrix (no <table>, no rowspan gotchas)
   - Subtle elevation, soft shadows, generous border-radius
*/

/* ────────────────────────────────────────────────────────────────
   1. Hero header
   ──────────────────────────────────────────────────────────────── */

.metrics-hero {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 28px 32px;
    margin-bottom: 26px;
    border: 1px solid var(--border-hover);
    border-radius: 22px;
    background:
        radial-gradient(circle at 12% 18%, rgba(245,158,11,0.10), transparent 38%),
        radial-gradient(circle at 88% 82%, rgba(99,102,241,0.08), transparent 42%),
        linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.005));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 8px 30px rgba(0,0,0,0.18);
    overflow: hidden;
}

.metrics-hero-text { max-width: 720px; }
.metrics-hero-title {
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -0.035em;
    color: var(--text-primary);
    margin: 0 0 6px;
    line-height: 1.05;
}
.metrics-hero-sub {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.55;
}

.metrics-hero-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 28px;
    align-items: center;
}
.metrics-control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}
.metrics-control-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ── Period pills ─────────────────────────────────────────────── */
.metrics-pills {
    display: inline-flex;
    padding: 4px;
    background: rgba(0,0,0,0.25);
    border: 1px solid var(--border);
    border-radius: 11px;
}
.metrics-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    padding: 7px 14px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    transition: color 0.15s, background 0.15s;
    font-variant-numeric: tabular-nums;
}
.metrics-pill:hover { color: var(--text-primary); }
.metrics-pill.is-active {
    background: linear-gradient(135deg, var(--accent), #f97316);
    color: #fff;
    box-shadow: 0 4px 14px rgba(245,158,11,0.32);
}

/* ── Tier legend chips ────────────────────────────────────────── */
.metrics-legend {
    display: inline-flex;
    gap: 6px;
    flex-wrap: wrap;
}
.kpi-legend-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 7px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
    border: 1px solid transparent;
}

/* ────────────────────────────────────────────────────────────────
   2. Depot card block
   ──────────────────────────────────────────────────────────────── */

.kpi-block {
    margin: 22px 0;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.022), rgba(255,255,255,0.006));
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 6px 24px rgba(0,0,0,0.22);
    overflow: hidden;
}

.kpi-block-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(255,255,255,0.015), transparent);
}

.kpi-block-ident {
    display: flex;
    align-items: center;
    gap: 14px;
}
.kpi-block-badge {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #fff;
    background: linear-gradient(135deg, var(--accent), #f97316);
    padding: 6px 12px;
    border-radius: 9px;
    box-shadow: 0 4px 14px rgba(245,158,11,0.28);
    font-family: 'JetBrains Mono', monospace;
}
.kpi-block-titles { display: flex; flex-direction: column; gap: 2px; }
.kpi-block-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.015em;
}
.kpi-block-sub {
    font-size: 11.5px;
    color: var(--text-muted);
    margin: 0;
    letter-spacing: 0.02em;
}

.kpi-block-stats {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.kpi-block-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}
.kpi-block-stat-label {
    font-size: 9.5px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.kpi-block-stat-value {
    font-size: 19px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -0.01em;
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
}

.kpi-trend {
    font-size: 11px;
    font-weight: 700;
    font-family: 'DM Sans', sans-serif;
    padding: 2px 6px;
    border-radius: 5px;
}
.kpi-trend-up   { background: rgba(34,197,94,0.15);  color: #4ade80; }
.kpi-trend-down { background: rgba(220,38,38,0.15);  color: #f87171; }

/* ────────────────────────────────────────────────────────────────
   3. CSS Grid data matrix
   ──────────────────────────────────────────────────────────────── */

.km-wrap {
    overflow-x: auto;
    max-width: 100%;
    scrollbar-width: thin;
    scrollbar-color: var(--border-hover) transparent;
}
.km-wrap::-webkit-scrollbar { height: 8px; }
.km-wrap::-webkit-scrollbar-track { background: transparent; }
.km-wrap::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 4px; }

.km-grid {
    display: flex;
    flex-direction: column;
    width: max-content;
    min-width: 100%;
    color: var(--text-primary);
}

.km-row {
    display: grid;
    grid-template-columns: var(--km-cols);
    border-bottom: 1px solid rgba(255,255,255,0.025);
}
.km-row:last-child { border-bottom: 0; }

.km-cell {
    padding: 9px 10px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    font-size: 12.5px;
    min-height: 38px;
}

/* ── Top header (week numbers) ────────────────────────────────── */
.km-header-row {
    background: rgba(0,0,0,0.18);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 4;
}
.km-th {
    color: var(--text-muted);
    font-weight: 700;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 11px 8px;
    flex-direction: column;
    gap: 1px;
}
.kpi-week-num {
    font-size: 12.5px;
    text-transform: none;
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: -0.01em;
}
.kpi-week-year {
    font-size: 9.5px;
    color: var(--text-dim);
    font-weight: 500;
}

/* ── Sticky metric column ─────────────────────────────────────── */
.km-metric-col {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
}
.km-header-row .km-metric-col {
    z-index: 5;
    background: rgba(20,24,41,0.96);
}

.km-metric-label {
    justify-content: flex-start;
    padding-left: 22px;
    text-align: left;
    font-weight: 600;
    font-size: 12.5px;
    color: var(--text-primary);
    letter-spacing: -0.005em;
}

/* ── Section header row ───────────────────────────────────────── */
.km-section {
    grid-column: 1 / -1;
    background: linear-gradient(90deg, rgba(245,158,11,0.07), transparent 60%);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-weight: 800;
    text-align: left;
    padding: 11px 22px;
    color: var(--accent);
    position: sticky;
    left: 0;
    width: max-content;
    min-width: 100%;
    box-sizing: border-box;
}
.km-section::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 12px;
    background: var(--accent);
    border-radius: 2px;
    margin-right: 10px;
    vertical-align: middle;
}

/* ── Data cells (tier-colored) ────────────────────────────────── */
.km-data {
    transition: filter 0.15s, transform 0.1s;
    border-radius: 0;
}
.km-data:hover:not(.kpi-cell-empty) {
    filter: brightness(1.15);
    z-index: 1;
}

.kpi-cell-empty {
    color: rgba(255,255,255,0.15);
    font-weight: 400;
    font-size: 11px;
}

/* Tier colors — matches existing .tier-* classes (line 91) but
   slightly stronger alpha (0.20) for the bigger grid cells */
.kpi-cell-tier-fp { background: rgba(168,85,247,0.22); color: #d8b4fe; font-weight: 700; }
.kpi-cell-tier-f  { background: rgba(59,130,246,0.22); color: #93c5fd; font-weight: 700; }
.kpi-cell-tier-g  { background: rgba(34,197,94,0.22); color: #86efac; font-weight: 700; }
.kpi-cell-tier-fa { background: rgba(245,158,11,0.22); color: #fcd34d; font-weight: 700; }
.kpi-cell-tier-p  { background: rgba(220,38,38,0.24); color: #fca5a5; font-weight: 800; }

/* Legend chips use slightly stronger borders to define them */
.kpi-legend-chip.kpi-cell-tier-fp { border-color: rgba(168,85,247,0.35); }
.kpi-legend-chip.kpi-cell-tier-f  { border-color: rgba(59,130,246,0.35); }
.kpi-legend-chip.kpi-cell-tier-g  { border-color: rgba(34,197,94,0.35);  }
.kpi-legend-chip.kpi-cell-tier-fa { border-color: rgba(245,158,11,0.35); }
.kpi-legend-chip.kpi-cell-tier-p  { border-color: rgba(220,38,38,0.40);  }

/* ── Footnote ─────────────────────────────────────────────────── */
.kpi-footnote {
    margin-top: 20px;
    padding: 14px 18px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
}
.kpi-cell-empty-inline {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 4px;
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.3);
    font-size: 11px;
}

/* ────────────────────────────────────────────────────────────────
   4. Responsive
   ──────────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
    .metrics-hero { padding: 22px 22px; gap: 18px; }
    .metrics-hero-title { font-size: 26px; }
    .metrics-hero-controls { flex-direction: column; align-items: flex-start; gap: 16px; }
    .kpi-block-header { padding: 14px 16px; gap: 12px; }
    .kpi-block-stats { width: 100%; }
}
@media (max-width: 720px) {
    .km-cell { padding: 7px 8px; font-size: 11px; min-height: 32px; }
    .km-metric-label { padding-left: 14px; }
    .km-section { padding: 9px 14px; font-size: 9px; }
    .metrics-legend { gap: 4px; }
    .kpi-legend-chip { font-size: 10px; padding: 3px 8px; }
}

/* ═══════════════════════════════════════════════════════════════════
   All Metrics — Network Pulse + Insights + Trend (v11)
   ═══════════════════════════════════════════════════════════════════ */

/* ── Network Pulse section ──────────────────────────────────── */
.pulse-section {
    margin: 0 0 28px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.005));
    border: 1px solid var(--border-hover);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 8px 28px rgba(0,0,0,0.22);
}

.pulse-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 20px 24px 14px;
    border-bottom: 1px solid var(--border);
    background:
        radial-gradient(circle at 100% 0%, rgba(245,158,11,0.08), transparent 50%);
}
.pulse-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.015em;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.pulse-title::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 12px rgba(245,158,11,0.6);
    animation: pulseDot 2s ease-in-out infinite;
}
@keyframes pulseDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.5; transform: scale(0.85); }
}
.pulse-sub {
    font-size: 11.5px;
    color: var(--text-muted);
    margin: 4px 0 0;
    letter-spacing: 0.02em;
}

.pulse-grid-wrap {
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-hover) transparent;
}
.pulse-grid-wrap::-webkit-scrollbar { height: 8px; }
.pulse-grid-wrap::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 4px; }

.pulse-grid {
    display: flex;
    flex-direction: column;
    width: max-content;
    min-width: 100%;
    color: var(--text-primary);
}

.pulse-row {
    display: grid;
    grid-template-columns: var(--pulse-cols);
    border-bottom: 1px solid rgba(255,255,255,0.025);
}
.pulse-row:last-child { border-bottom: 0; }
.pulse-row-header { background: rgba(0,0,0,0.18); border-bottom: 1px solid var(--border); }

.pulse-cell {
    padding: 11px 12px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    font-size: 13px;
    min-height: 40px;
    gap: 4px;
}

.pulse-th {
    font-weight: 700;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}
.pulse-depot-code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: none;
}
.pulse-th-home {
    background: linear-gradient(180deg, rgba(245,158,11,0.08), rgba(245,158,11,0.02));
    border-bottom: 2px solid var(--accent);
}

.pulse-metric-col {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    justify-content: flex-start;
    padding-left: 22px;
    text-align: left;
    font-weight: 600;
}
.pulse-row-header .pulse-metric-col { background: rgba(20,24,41,0.96); z-index: 3; }
.pulse-metric-label { font-size: 12.5px; color: var(--text-primary); }

.pulse-section-header {
    grid-column: 1 / -1;
    background: linear-gradient(90deg, rgba(245,158,11,0.08), transparent 60%);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-weight: 800;
    text-align: left;
    padding: 9px 22px;
    color: var(--accent);
    position: sticky;
    left: 0;
    width: max-content;
    min-width: 100%;
    box-sizing: border-box;
}
.pulse-section-header::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 10px;
    background: var(--accent);
    border-radius: 2px;
    margin-right: 10px;
    vertical-align: middle;
}

.pulse-leader {
    position: relative;
    box-shadow: inset 0 0 0 2px rgba(245,158,11,0.55);
}
.pulse-leader-star {
    color: #fbbf24;
    font-size: 11px;
    text-shadow: 0 0 8px rgba(251,191,36,0.7);
}

.pulse-cell-home {
    position: relative;
    box-shadow: inset 3px 0 0 var(--accent);
}

.pulse-leader-col {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding-left: 16px;
    background: rgba(0,0,0,0.15);
    border-left: 1px solid var(--border);
}
.pulse-leader-name {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
}
.pulse-leader-gap {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0;
}
.pulse-leader-empty { color: var(--text-dim); }

/* ── Insights strip per depot card ─────────────────────────── */
.kpi-insights-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 22px;
    border-bottom: 1px solid var(--border);
    background: rgba(0,0,0,0.12);
}
.kpi-insight {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px 8px 12px;
    background: rgba(255,255,255,0.025);
    border: 1px solid var(--border-hover);
    border-radius: 11px;
    transition: border-color 0.15s, transform 0.15s;
}
.kpi-insight:hover { border-color: var(--accent); transform: translateY(-1px); }
.kpi-insight-icon { font-size: 14px; line-height: 1; }
.kpi-insight-text { display: flex; flex-direction: column; gap: 1px; }
.kpi-insight-label {
    font-size: 9.5px;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.kpi-insight-detail {
    font-size: 12px;
    color: var(--text-primary);
    font-weight: 500;
}

.kpi-insight-leader     { border-color: rgba(245,158,11,0.4); background: rgba(245,158,11,0.06); }
.kpi-insight-leader .kpi-insight-label { color: var(--accent); }
.kpi-insight-risk       { border-color: rgba(245,158,11,0.4); background: rgba(245,158,11,0.06); }
.kpi-insight-risk .kpi-insight-label { color: #fbbf24; }
.kpi-insight-improving  { border-color: rgba(34,197,94,0.35); background: rgba(34,197,94,0.05); }
.kpi-insight-improving .kpi-insight-label { color: #4ade80; }
.kpi-insight-declining  { border-color: rgba(220,38,38,0.4); background: rgba(220,38,38,0.05); }
.kpi-insight-declining .kpi-insight-label { color: #f87171; }
.kpi-insight-stable     { border-color: rgba(148,163,184,0.25); }
.kpi-insight-stable .kpi-insight-label { color: var(--text-secondary); }
.kpi-insight-weak       { border-color: rgba(220,38,38,0.35); background: rgba(220,38,38,0.04); }
.kpi-insight-weak .kpi-insight-label { color: #f87171; }

/* ── Trend column at end of grid rows ──────────────────────── */
.km-trend-th { font-size: 9.5px !important; letter-spacing: 0.1em; }
.km-trend-cell {
    flex-direction: column;
    gap: 1px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(0,0,0,0.15);
    border-left: 1px solid var(--border);
}
.km-trend-icon { font-size: 13px; font-weight: 800; line-height: 1; }
.km-trend-text { font-size: 10px; font-weight: 500; opacity: 0.85; }
.km-trend-up   { color: #4ade80; background: rgba(34,197,94,0.06); }
.km-trend-down { color: #f87171; background: rgba(220,38,38,0.06); }
.km-trend-flat { color: var(--text-muted); }

/* Mobile tweaks for new components */
@media (max-width: 900px) {
    .pulse-header { padding: 16px 18px 12px; flex-direction: column; align-items: flex-start; gap: 6px; }
    .pulse-title { font-size: 16px; }
    .kpi-insights-strip { padding: 12px 16px; gap: 8px; }
    .kpi-insight { padding: 6px 12px 6px 10px; }
    .kpi-insight-detail { font-size: 11px; }
}

/* ── Pulse view toggle (Latest vs Period avg) ──────────────── */
.pulse-view-toggle {
    display: inline-flex;
    padding: 3px;
    background: rgba(0,0,0,0.28);
    border: 1px solid var(--border);
    border-radius: 10px;
    flex-shrink: 0;
}
.pulse-toggle-pill {
    padding: 6px 14px;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 7px;
    transition: color 0.15s, background 0.15s;
    letter-spacing: 0.01em;
    white-space: nowrap;
}
.pulse-toggle-pill:hover { color: var(--text-primary); }
.pulse-toggle-pill.is-active {
    background: linear-gradient(135deg, var(--accent), #f97316);
    color: #fff;
    box-shadow: 0 3px 10px rgba(245,158,11,0.28);
}

/* ═══════════════════════════════════════════════════════════════════
   Ranking page — table & legend refinement
   ═══════════════════════════════════════════════════════════════════

   Issues Alex flagged: rows too tight, cells not aligned, sparkline
   SVG floating at top of its cell instead of centered, score trends
   legend cramped. Fixes scoped to .rk-table and .rk-trend-legend so
   no impact on other tables using .sc-table chrome.
*/

/* ── Full ranking row — more breathing room & cell alignment ── */
.rk-table { table-layout: auto; }
.rk-table tbody tr.rk-row td {
    padding: 14px 14px;
    vertical-align: middle;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.rk-table tbody tr.rk-row:last-child td { border-bottom: 0; }
.rk-table thead th {
    padding: 13px 14px 11px;
}
.rk-table tbody tr.rk-row:hover td {
    background: rgba(255,255,255,0.025);
}

/* Sparkline wrapper — flex-center the SVG vertically in its cell.
   Without this the SVG (display:block) sits at the top of the cell
   while the other cells (text/pills) are middle-aligned, giving the
   row a wonky baseline. */
.rk-table td.rk-spark {
    width: 130px;
    padding: 14px 12px;
}
.rk-table td.rk-spark svg {
    display: block;
    width: 110px;
    height: 32px;
    margin: 0 auto;
}

/* ── Unified rank-pill component ───────────────────────────────────
   Same visual treatment everywhere a row needs a "#N" badge:
     - Ranking table (.sc-rank)        — ranking.php, scorecards.php
     - Top Performers (.app-row-rank)  — home.php
     - Last Week scorecards (.lw-rank) — home.php
   Top 3 get gold / silver / bronze gradient pills.  4+ get a subtle
   dim pill.  All same dimensions so rows line up across pages.
*/
.sc-rank,
.app-row-rank,
.lw-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 26px;
    width: auto;
    padding: 0 9px;
    border-radius: 7px;
    font-size: 12.5px;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.55);
    border: 1px solid rgba(255,255,255,0.06);
    letter-spacing: -0.02em;
    line-height: 1;
    flex-shrink: 0;
}
.sc-rank.is-top.is-1,
.app-row-rank.is-1,
.lw-rank.is-1 {
    color: #fde68a;
    background: linear-gradient(135deg, rgba(251,191,36,0.18), rgba(245,158,11,0.10));
    border-color: rgba(251,191,36,0.30);
    box-shadow: 0 0 0 1px rgba(251,191,36,0.10), 0 2px 8px rgba(245,158,11,0.18);
}
.sc-rank.is-top.is-2,
.app-row-rank.is-2,
.lw-rank.is-2 {
    color: #e5e7eb;
    background: linear-gradient(135deg, rgba(229,231,235,0.14), rgba(148,163,184,0.08));
    border-color: rgba(229,231,235,0.22);
}
.sc-rank.is-top.is-3,
.app-row-rank.is-3,
.lw-rank.is-3 {
    color: #fdba74;
    background: linear-gradient(135deg, rgba(253,186,116,0.16), rgba(234,88,12,0.06));
    border-color: rgba(253,186,116,0.26);
}

/* Score value — bolder presence, mono, slightly bigger */
.rk-table .sc-score-val {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

/* Depot two-line cell — tighter line stack */
.rk-depot-name { line-height: 1.2; font-size: 14px; }
.rk-depot-sub  { line-height: 1.2; }

/* Drivers column — bigger numeral, subdued styling consistent w/ score */
.rk-table .sc-col-meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 700;
    color: rgba(255,255,255,0.78);
    letter-spacing: -0.01em;
}

/* WoW pill — slightly more breathable */
.rk-wow {
    padding: 4px 10px;
    font-size: 12px;
    letter-spacing: -0.01em;
    border-radius: 8px;
}

/* ── Score trends legend — proper pill items, not bare text ── */
.rk-trend-legend {
    gap: 8px;
    padding-top: 16px;
    margin-top: 16px;
}
.rk-trend-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 10px;
    background: rgba(255,255,255,0.025);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 9px;
    font-size: 12px;
    font-weight: 600;
    transition: border-color 0.15s, background 0.15s;
}
.rk-trend-legend-item:hover {
    border-color: rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.04);
}
.rk-trend-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.rk-trend-legend-code {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.02em;
}
.rk-trend-legend-val {
    color: rgba(255,255,255,0.55);
    font-variant-numeric: tabular-nums;
}
.rk-trend-legend-delta {
    font-size: 11px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    padding: 2px 6px;
    border-radius: 5px;
}
.rk-trend-legend-delta.is-up   { color: #4ade80; background: rgba(34,197,94,0.12); }
.rk-trend-legend-delta.is-down { color: #fca5a5; background: rgba(239,68,68,0.12); }
.rk-trend-legend-delta.is-flat { color: rgba(255,255,255,0.40); background: rgba(255,255,255,0.04); }

/* ── Top KPI row on Ranking — same .kpi-card chrome — make stat
      values consistent with the rest of the app and reduce visual
      weight of the small foot text */
.kpi-row .kpi-card { padding: 16px 18px; }
.kpi-row .kpi-value { font-size: 28px; }
.kpi-row .kpi-foot { margin-top: 8px; font-size: 11px; letter-spacing: 0.02em; }

@media (max-width: 720px) {
    .rk-table tbody tr.rk-row td { padding: 11px 10px; }
    .rk-depot-name { font-size: 13px; }
    .rk-table .sc-score-val { font-size: 15px; }
    .rk-table td.rk-spark svg { width: 80px; height: 28px; }
}

/* ════════════════════════════════════════════════════════════════════
   Reliability page — capacity reliability dashboard
   ════════════════════════════════════════════════════════════════════ */

/* Clickable KPI card — used for the Reliability card on Home that
   links into reliability.php. Keeps the .kpi-card chrome but adds
   subtle hover affordance. */
.kpi-card-link {
    cursor: pointer;
    transition: transform 0.16s ease, border-color 0.16s ease;
    color: inherit;
    display: block;
}
.kpi-card-link:hover {
    transform: translateY(-1px);
    border-color: rgba(251,191,36,0.30);
    text-decoration: none;
}

/* Pulse-dot accent next to "Network Reliability Pulse" title */
.rel-pulse-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #fbbf24;
    margin-right: 4px;
    box-shadow: 0 0 0 3px rgba(251,191,36,0.18);
    animation: relPulse 2s ease-in-out infinite;
}
@keyframes relPulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(251,191,36,0.18); opacity: 1; }
    50%      { box-shadow: 0 0 0 6px rgba(251,191,36,0.05); opacity: 0.7; }
}

/* ── Pulse grid — depot rows × week columns + leader column ──
   CSS Grid because <table> rowspan was unstable with sticky headers
   (same pain as All Metrics — we abandoned <table> there too). */
.rel-pulse-wrap {
    margin-top: 14px;
    overflow-x: auto;
    border-radius: 10px;
    /* Padding-bottom to leave room for the scrollbar without clipping cell hover scale */
    padding-bottom: 2px;
}
.rel-pulse-grid {
    display: grid;
    gap: 4px;
    align-items: stretch;
    min-width: 720px;
}

/* Three density modes — auto-applied by the PHP renderer based on the
   visible column count. Each mode keeps cells readable at its scale:
     ≤ 8 columns  → is-full     (score + STN sub-line, big cells)
     9-16 columns → is-compact  (just score + ★, no STN)
     17+ columns  → is-dense    (heatmap-style, score in smaller mono) */
.rel-pulse-grid.is-full    { grid-template-columns: 180px repeat(var(--rel-cols, 12), minmax(72px, 1fr)) 160px; }
.rel-pulse-grid.is-compact { grid-template-columns: 160px repeat(var(--rel-cols, 12), minmax(54px, 1fr)) 140px; }
.rel-pulse-grid.is-dense   { grid-template-columns: 140px repeat(var(--rel-cols, 12), minmax(42px, 1fr)) 120px; }

/* Sticky depot column (left) + leader column (right) so labels stay
   visible during horizontal scroll on wide views. Solid card-coloured
   background ensures cells underneath don't bleed through. */
.rel-pulse-th-depot,
.rel-pulse-depot {
    position: sticky;
    left: 0;
    z-index: 3;
    background: #0c1018;
    box-shadow: 4px 0 12px rgba(0,0,0,0.45);
}
.rel-pulse-th-leader,
.rel-pulse-leader-cell {
    position: sticky;
    right: 0;
    z-index: 3;
    background: #0c1018;
    box-shadow: -4px 0 12px rgba(0,0,0,0.45);
}
.rel-pulse-depot.is-home {
    /* Keep gradient bg but layer over the solid sticky background */
    background: linear-gradient(90deg, rgba(251,191,36,0.10), rgba(12,16,24,1) 70%);
}
.rel-pulse-th-leader {
    background: linear-gradient(90deg, rgba(12,16,24,1) 30%, rgba(251,191,36,0.08));
}

/* ── Compact mode adjustments — smaller cells, tighter padding ── */
.rel-pulse-grid.is-compact .rel-pulse-cell {
    min-height: 38px;
    padding: 4px 2px;
}
.rel-pulse-grid.is-compact .rel-pulse-cell-score {
    font-size: 11px;
}
.rel-pulse-grid.is-compact .rel-pulse-depot {
    padding: 8px 10px;
}
.rel-pulse-grid.is-compact .rel-pulse-depot-code { font-size: 12px; }
.rel-pulse-grid.is-compact .rel-pulse-depot-name { font-size: 9.5px; }
.rel-pulse-grid.is-compact .rel-pulse-th { padding: 6px 4px; }
.rel-pulse-grid.is-compact .rel-pulse-th-wk { font-size: 11px; }

/* ── Dense mode adjustments — heatmap-style ── */
.rel-pulse-grid.is-dense .rel-pulse-cell {
    min-height: 30px;
    padding: 2px 1px;
    border-radius: 4px;
    border-width: 1px;
}
.rel-pulse-grid.is-dense .rel-pulse-cell-score {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: -0.02em;
}
.rel-pulse-grid.is-dense .rel-pulse-star { font-size: 9px; }
.rel-pulse-grid.is-dense .rel-pulse-depot {
    padding: 6px 8px;
}
.rel-pulse-grid.is-dense .rel-pulse-depot-code { font-size: 11.5px; }
.rel-pulse-grid.is-dense .rel-pulse-depot-name {
    /* Hide depot name in dense mode — code alone is enough */
    display: none;
}
.rel-pulse-grid.is-dense .rel-pulse-th { padding: 4px 2px; }
.rel-pulse-grid.is-dense .rel-pulse-th-wk { font-size: 10px; }
.rel-pulse-grid.is-dense .rel-pulse-th-yr { display: none; }
/* In dense mode, lean harder on tier colour intensity since text shrinks */
.rel-pulse-grid.is-dense .rel-pulse-cell.tier-fp { background: rgba(192,132,252,0.28); }
.rel-pulse-grid.is-dense .rel-pulse-cell.tier-f  { background: rgba(96,165,250,0.26);  }
.rel-pulse-grid.is-dense .rel-pulse-cell.tier-g  { background: rgba(34,197,94,0.26);   }
.rel-pulse-grid.is-dense .rel-pulse-cell.tier-fa { background: rgba(251,191,36,0.24);  }
.rel-pulse-grid.is-dense .rel-pulse-cell.tier-p  { background: rgba(239,68,68,0.26);   }
/* Tighter leader cell in dense mode */
.rel-pulse-grid.is-dense .rel-pulse-leader-cell {
    padding: 6px 8px;
    gap: 4px;
}
.rel-pulse-grid.is-dense .rel-pulse-leader-internal { font-size: 10px; }
.rel-pulse-grid.is-dense .rel-pulse-station-tag { font-size: 9px; padding: 2px 5px; }

/* Header row (top) */
.rel-pulse-th {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 6px;
    padding: 8px 10px;
    text-align: center;
    font-size: 10.5px;
    font-weight: 700;
    color: rgba(255,255,255,0.55);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
}
.rel-pulse-th-depot { text-align: left; align-items: flex-start; padding-left: 14px; }
.rel-pulse-th-leader {
    background: rgba(251,191,36,0.06);
    border-color: rgba(251,191,36,0.18);
    color: #fbbf24;
}
.rel-pulse-th-wk { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: #fff; font-weight: 800; }
.rel-pulse-th-yr { font-size: 9px; color: rgba(255,255,255,0.40); font-weight: 600; letter-spacing: 0.04em; margin-top: 1px; }

/* Depot row label (left column body) */
.rel-pulse-depot {
    background: rgba(255,255,255,0.025);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 6px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
}
.rel-pulse-depot.is-home {
    border-color: rgba(251,191,36,0.32);
    background: linear-gradient(90deg, rgba(251,191,36,0.05), rgba(255,255,255,0.015));
}
.rel-pulse-depot-code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.02em;
}
.rel-pulse-depot-name {
    font-size: 10px;
    color: rgba(255,255,255,0.45);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Data cells (tier-coloured backgrounds already exist via .tier-X) */
.rel-pulse-cell {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 6px;
    padding: 8px 6px;
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    color: rgba(255,255,255,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 38px;
    position: relative;
    transition: transform 0.12s ease;
}
.rel-pulse-cell:hover { transform: scale(1.04); z-index: 2; }
.rel-pulse-cell.tier-fp { background: rgba(192,132,252,0.18); color: #e9d5ff; border-color: rgba(192,132,252,0.30); }
.rel-pulse-cell.tier-f  { background: rgba(96,165,250,0.16);  color: #dbeafe; border-color: rgba(96,165,250,0.28); }
.rel-pulse-cell.tier-g  { background: rgba(34,197,94,0.16);   color: #d1fae5; border-color: rgba(34,197,94,0.28); }
.rel-pulse-cell.tier-fa { background: rgba(251,191,36,0.14);  color: #fef3c7; border-color: rgba(251,191,36,0.28); }
.rel-pulse-cell.tier-p  { background: rgba(239,68,68,0.14);   color: #fecaca; border-color: rgba(239,68,68,0.28); }
.rel-pulse-cell-empty { color: rgba(255,255,255,0.20); font-weight: 500; }

.rel-pulse-cell.rel-pulse-leader {
    box-shadow: inset 0 0 0 2px rgba(251,191,36,0.55), 0 0 12px rgba(251,191,36,0.15);
}
.rel-pulse-cell.rel-pulse-cell-home { outline: 1px dashed rgba(255,255,255,0.18); outline-offset: -2px; }
.rel-pulse-star {
    font-size: 8px;
    color: #fbbf24;
    margin-right: 1px;
}

/* Leader column (right) — shows latest-week status per depot */
.rel-pulse-leader-cell {
    background: rgba(255,255,255,0.025);
    border: 1px solid rgba(251,191,36,0.18);
    border-radius: 6px;
    padding: 8px 12px;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: rgba(255,255,255,0.65);
    font-family: 'JetBrains Mono', monospace;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-wrap: wrap;
    line-height: 1.3;
}
.rel-pulse-leader-tag {
    background: linear-gradient(135deg, rgba(251,191,36,0.20), rgba(245,158,11,0.10));
    color: #fde68a;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 10px;
    letter-spacing: 0.06em;
    font-weight: 800;
}
.rel-pulse-leader-gap {
    color: #4ade80;
    font-size: 10.5px;
    font-weight: 800;
}

/* ── Trend chart ── */
.rel-trend-svg {
    width: 100%;
    height: 280px;
    display: block;
    margin-top: 10px;
}
.rel-trend-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.rel-trend-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 10px;
    background: rgba(255,255,255,0.025);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 9px;
    font-size: 12px;
    font-weight: 600;
}
.rel-trend-legend-item.is-home {
    border-color: rgba(251,191,36,0.28);
    background: rgba(251,191,36,0.06);
}
.rel-trend-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.rel-trend-legend-code {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 800;
    letter-spacing: 0.02em;
}
.rel-trend-legend-val {
    color: rgba(255,255,255,0.65);
    font-variant-numeric: tabular-nums;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
}

/* ── Daily breakdown ── */
.rel-daily-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
    margin-top: 6px;
}
@media (max-width: 720px) {
    .rel-daily-grid { grid-template-columns: repeat(2, 1fr); }
}
.rel-daily-card {
    padding: 14px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.02);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: transform 0.12s ease, border-color 0.12s ease;
}
.rel-daily-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255,255,255,0.14);
}
.rel-daily-card.tier-fp { border-color: rgba(192,132,252,0.30); background: linear-gradient(180deg, rgba(192,132,252,0.10), rgba(255,255,255,0.01)); }
.rel-daily-card.tier-f  { border-color: rgba(96,165,250,0.28);  background: linear-gradient(180deg, rgba(96,165,250,0.08),  rgba(255,255,255,0.01)); }
.rel-daily-card.tier-g  { border-color: rgba(34,197,94,0.28);   background: linear-gradient(180deg, rgba(34,197,94,0.08),   rgba(255,255,255,0.01)); }
.rel-daily-card.tier-fa { border-color: rgba(251,191,36,0.28);  background: linear-gradient(180deg, rgba(251,191,36,0.08),  rgba(255,255,255,0.01)); }
.rel-daily-card.tier-p  { border-color: rgba(239,68,68,0.28);   background: linear-gradient(180deg, rgba(239,68,68,0.08),   rgba(255,255,255,0.01)); }

.rel-daily-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.rel-daily-day {
    font-size: 10.5px;
    font-weight: 800;
    color: rgba(255,255,255,0.55);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.rel-daily-date {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: rgba(255,255,255,0.40);
    font-weight: 600;
}
.rel-daily-score {
    font-family: 'JetBrains Mono', monospace;
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.02em;
    margin: 2px 0;
}
.rel-daily-meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    color: rgba(255,255,255,0.40);
    font-weight: 600;
}

/* ── Recent uploads — uses existing .app-row chrome, just card spacing ── */
.rel-uploads { margin-top: 6px; }

/* ── Welcome row sub text helper (used in reliability welcome) ── */
.app-welcome-sub {
    color: rgba(255,255,255,0.55);
    font-size: 14px;
    margin-top: 4px;
}

/* ── Reliability empty state — feature preview / marketing card ── */
.rel-empty-card { padding: 0 !important; overflow: hidden; }
.rel-empty-hero {
    padding: 60px 40px 44px;
    text-align: center;
    background:
        radial-gradient(ellipse at top, rgba(251,191,36,0.06), transparent 60%),
        linear-gradient(180deg, rgba(255,255,255,0.015), transparent);
}
.rel-empty-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 22px;
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(251,191,36,0.22), rgba(245,158,11,0.10));
    border: 1px solid rgba(251,191,36,0.30);
    color: #fbbf24;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 6px rgba(251,191,36,0.06), 0 12px 32px rgba(245,158,11,0.20);
}
.rel-empty-title {
    font-size: 24px;
    font-weight: 800;
    color: #fff;
    margin: 0 0 8px;
    letter-spacing: -0.02em;
}
.rel-empty-sub {
    max-width: 480px;
    margin: 0 auto 24px;
    color: rgba(255,255,255,0.62);
    font-size: 14px;
    line-height: 1.55;
}
.rel-empty-sub strong {
    color: #fbbf24;
    font-weight: 700;
}
.rel-empty-cta {
    /* Inherits .btn .btn-primary base styles; just tune padding for hero */
    padding: 14px 28px !important;
    font-size: 15px !important;
    text-decoration: none !important;
    box-shadow: 0 8px 22px rgba(245,158,11,0.30), 0 2px 6px rgba(245,158,11,0.18);
}
.rel-empty-cta:hover {
    box-shadow: 0 12px 28px rgba(245,158,11,0.40), 0 4px 8px rgba(245,158,11,0.22);
}
.rel-empty-hint {
    margin-top: 12px;
    font-size: 11.5px;
    color: rgba(255,255,255,0.42);
    font-weight: 500;
    letter-spacing: 0.02em;
}

.rel-empty-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
    margin: 0;
}

.rel-empty-features-head {
    padding: 28px 40px 16px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
.rel-empty-features-head h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.rel-empty-features-head span {
    font-size: 11.5px;
    color: rgba(255,255,255,0.40);
    font-weight: 500;
}

.rel-empty-features {
    padding: 0 40px 40px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 28px;
}
@media (max-width: 720px) {
    .rel-empty-hero { padding: 44px 22px 32px; }
    .rel-empty-features-head { padding: 22px 22px 12px; }
    .rel-empty-features { padding: 0 22px 32px; grid-template-columns: 1fr; gap: 12px; }
    .rel-empty-title { font-size: 20px; }
}

.rel-empty-feature {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 4px 0;
}
.rel-empty-check {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: linear-gradient(135deg, rgba(34,197,94,0.18), rgba(22,163,74,0.10));
    border: 1px solid rgba(34,197,94,0.32);
    color: #4ade80;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    margin-top: 1px;
}
.rel-empty-feature-title {
    font-size: 13.5px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 2px;
    letter-spacing: -0.01em;
}
.rel-empty-feature-sub {
    font-size: 11.5px;
    color: rgba(255,255,255,0.50);
    line-height: 1.45;
    font-weight: 500;
}

/* ── Pulse cell with score + station-rank sub-line ────────────────── */
.rel-pulse-cell {
    /* Override the inherited flex centering — we now have 2 stacked lines */
    flex-direction: column;
    gap: 2px;
    padding: 6px 4px 4px;
    min-height: 50px;
}
.rel-pulse-cell-score {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    display: flex;
    align-items: center;
    gap: 3px;
}
.rel-pulse-cell-srank {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9.5px;
    font-weight: 800;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.55);
    letter-spacing: 0.02em;
}
.rel-pulse-cell-srank.is-top {
    background: rgba(34,197,94,0.18);
    color: #4ade80;
}
.rel-pulse-cell-srank.is-bottom {
    background: rgba(239,68,68,0.15);
    color: #fca5a5;
}

/* ── Leader column now has 2 stacked lines: internal + station ───── */
.rel-pulse-leader-cell {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 8px 10px;
    text-align: center;
}
.rel-pulse-leader-internal {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-wrap: wrap;
    font-size: 11px;
}
.rel-pulse-leader-station {
    border-top: 1px solid rgba(255,255,255,0.06);
    padding-top: 6px;
}
.rel-pulse-station-tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 5px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.65);
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
}
.rel-pulse-station-tag.rel-pulse-station-tag-1 {
    background: linear-gradient(135deg, rgba(251,191,36,0.20), rgba(245,158,11,0.10));
    border-color: rgba(251,191,36,0.32);
    color: #fde68a;
}
.rel-pulse-station-tag.rel-pulse-station-tag-2 {
    background: linear-gradient(135deg, rgba(229,231,235,0.16), rgba(148,163,184,0.08));
    border-color: rgba(229,231,235,0.24);
    color: #e5e7eb;
}
.rel-pulse-station-tag.rel-pulse-station-tag-3 {
    background: linear-gradient(135deg, rgba(253,186,116,0.16), rgba(234,88,12,0.06));
    border-color: rgba(253,186,116,0.28);
    color: #fdba74;
}

/* ── Dual rank card (KPI strip — internal | station side by side) ─ */
.rel-rank-dual {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 4px;
}
.rel-rank-dual-side {
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
}
.rel-rank-dual-side-station {
    background: rgba(99,102,241,0.06);
    border-color: rgba(99,102,241,0.18);
}
.rel-rank-dual-label {
    font-size: 9.5px;
    font-weight: 800;
    color: rgba(255,255,255,0.45);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 4px;
}
.rel-rank-dual-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    line-height: 1.1;
    letter-spacing: -0.02em;
}
.rel-rank-dual-value span {
    font-size: 11px;
    color: rgba(255,255,255,0.45);
    font-weight: 600;
    margin-left: 4px;
}
.rel-rank-dual-station.is-1 { color: #fde68a; }
.rel-rank-dual-station.is-2 { color: #e5e7eb; }
.rel-rank-dual-station.is-3 { color: #fdba74; }

/* Network leader KPI — pill-style score inline next to depot code */
.rel-net-leader-score {
    display: inline-flex;
    align-items: center;
    margin-left: 10px;
    padding: 4px 10px;
    border-radius: 7px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: -0.01em;
    vertical-align: middle;
    border: 1px solid;
}
.rel-net-leader-score.tier-fp { background: rgba(192,132,252,0.18); color: #c084fc; border-color: rgba(192,132,252,0.32); }
.rel-net-leader-score.tier-f  { background: rgba(96,165,250,0.18);  color: #60a5fa; border-color: rgba(96,165,250,0.32); }
.rel-net-leader-score.tier-g  { background: rgba(34,197,94,0.18);   color: #4ade80; border-color: rgba(34,197,94,0.32); }
.rel-net-leader-score.tier-fa { background: rgba(251,191,36,0.18);  color: #fbbf24; border-color: rgba(251,191,36,0.32); }
.rel-net-leader-score.tier-p  { background: rgba(239,68,68,0.18);   color: #fca5a5; border-color: rgba(239,68,68,0.32); }

/* ════════════════════════════════════════════════════════════════════
   Reliability Trend — interactive layer
   ════════════════════════════════════════════════════════════════════ */

.rel-trend-wrap {
    position: relative;
    /* tooltip anchors to this */
}
.rel-trend-svg { cursor: crosshair; }
.rel-trend-hover-zone { cursor: crosshair; }

/* Depot group transitions for smooth hover-focus animation */
.rel-trend-depot-g {
    transition: opacity 0.18s ease;
}

/* Crosshair — already styled inline via SVG attrs; container hint only */
.rel-trend-crosshair { pointer-events: none; }

/* ── Floating tooltip ── */
.rel-trend-tooltip {
    position: absolute;
    z-index: 50;
    min-width: 220px;
    max-width: 320px;
    padding: 12px 14px;
    background: rgba(12, 15, 26, 0.96);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 10px;
    box-shadow: 0 18px 48px rgba(0,0,0,0.50), 0 4px 12px rgba(0,0,0,0.30);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    pointer-events: none;
    font-size: 12px;
    color: #fff;
    transition: opacity 0.08s ease, left 0.08s ease, top 0.08s ease;
}
.rel-trend-tooltip[hidden] {
    display: none;
}
.rel-trend-tt-head {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
    font-weight: 800;
    color: #fbbf24;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    letter-spacing: 0.04em;
}
.rel-trend-tt-rows {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.rel-trend-tt-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 6px;
    border-radius: 5px;
    transition: background 0.12s ease, opacity 0.12s ease;
}
.rel-trend-tt-row.is-home {
    background: rgba(251,191,36,0.07);
}
.rel-trend-tt-row.is-focus {
    background: rgba(255,255,255,0.10) !important;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18);
    transform: scale(1.02);
}
.rel-trend-tt-row.is-dimmed {
    opacity: 0.32;
}
.rel-trend-tt-rank {
    flex-shrink: 0;
    width: 24px;
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 800;
    color: rgba(255,255,255,0.50);
    background: rgba(255,255,255,0.05);
    border-radius: 3px;
    padding: 2px 4px;
}
.rel-trend-tt-rank-empty {
    background: transparent;
    color: rgba(255,255,255,0.20);
}
.rel-trend-tt-dot {
    flex-shrink: 0;
    width: 9px;
    height: 9px;
    border-radius: 50%;
}
.rel-trend-tt-code {
    flex: 1;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 800;
    font-size: 12px;
    letter-spacing: 0.02em;
}
.rel-trend-tt-score {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 800;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}
.rel-trend-tt-stn {
    flex-shrink: 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9.5px;
    font-weight: 700;
    color: rgba(255,255,255,0.40);
    background: rgba(255,255,255,0.04);
    padding: 2px 5px;
    border-radius: 3px;
    letter-spacing: 0.02em;
    margin-left: 2px;
}
.rel-trend-tt-empty {
    color: rgba(255,255,255,0.20);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

/* Make circles feel interactive — pointer cursor + smooth size transition */
.rel-trend-pt {
    cursor: pointer;
    transition: r 0.12s ease, opacity 0.12s ease;
}

/* ── Legend (now interactive buttons) ── */
.rel-trend-legend-item {
    /* Inherits .rel-trend-legend-item base styles. Re-declare for button reset */
    cursor: pointer;
    background: rgba(255,255,255,0.025);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 9px;
    padding: 6px 12px 6px 10px;
    color: inherit;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s, transform 0.12s, opacity 0.15s;
    user-select: none;
}
.rel-trend-legend-item:hover {
    border-color: rgba(255,255,255,0.18);
    background: rgba(255,255,255,0.05);
    transform: translateY(-1px);
}
.rel-trend-legend-item.is-hidden {
    opacity: 0.35;
    background: rgba(255,255,255,0.015);
}
.rel-trend-legend-item.is-hidden .rel-trend-legend-code,
.rel-trend-legend-item.is-hidden .rel-trend-legend-val {
    text-decoration: line-through;
}
.rel-trend-legend-item.is-hidden .rel-trend-legend-dot {
    opacity: 0.35;
}
.rel-trend-legend-hint {
    margin-left: auto;
    font-size: 10.5px;
    color: rgba(255,255,255,0.30);
    font-weight: 500;
    align-self: center;
    letter-spacing: 0.02em;
}

@media (max-width: 720px) {
    .rel-trend-tooltip { min-width: 180px; font-size: 11px; padding: 10px 12px; }
    .rel-trend-legend-hint { display: none; }
}

/* "Stale" leader cell — depot has no data for latest visible week but
   we know it reported earlier. Shown instead of generic 'no data' so
   the user can tell 'temporarily missing' from 'never existed'. */
.rel-pulse-stale {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 10px;
    color: rgba(255,255,255,0.45);
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0.02em;
}
.rel-pulse-stale strong {
    color: rgba(255,255,255,0.65);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 800;
}
.rel-pulse-stale-score {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    color: rgba(255,255,255,0.55);
    font-size: 10.5px;
}

/* Period cap notice in welcome subtitle — appears when user requests more
   weeks than the DB has uploaded. Subtle amber, not alarming. */
.rel-weeks-cap {
    color: rgba(251,191,36,0.75);
    font-size: 12.5px;
}
.rel-weeks-cap strong {
    color: #fbbf24;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
}

/* Period pill above available data count — dim but still clickable */
.metrics-pill.is-dim {
    opacity: 0.42;
    cursor: help;
}
.metrics-pill.is-dim:hover { opacity: 0.65; }
.metrics-pill.is-dim.is-active { opacity: 1; }

/* ── Ultra mode (25+ columns, year-scale view) ─────────────────────
   Goal: turn the grid into a pure pattern map. No weekly numbers,
   just tier-colour intensity. Score and STN visible via cell title
   tooltip only. Designed for spotting streaks, dips, and seasonality
   across an entire year (52w). At this scale individual numbers
   become noise — the colour pattern carries the story. */
.rel-pulse-grid.is-ultra {
    grid-template-columns: 110px repeat(var(--rel-cols, 12), minmax(22px, 1fr)) 100px;
    gap: 2px;
}
.rel-pulse-grid.is-ultra .rel-pulse-cell {
    min-height: 22px;
    padding: 0;
    border-radius: 2px;
    border-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Pure tier colours at higher saturation — no text means the colour
   has to carry more visual weight than in dense mode. */
.rel-pulse-grid.is-ultra .rel-pulse-cell.tier-fp { background: rgba(192,132,252,0.42); }
.rel-pulse-grid.is-ultra .rel-pulse-cell.tier-f  { background: rgba(96,165,250,0.40);  }
.rel-pulse-grid.is-ultra .rel-pulse-cell.tier-g  { background: rgba(34,197,94,0.38);   }
.rel-pulse-grid.is-ultra .rel-pulse-cell.tier-fa { background: rgba(251,191,36,0.36);  }
.rel-pulse-grid.is-ultra .rel-pulse-cell.tier-p  { background: rgba(239,68,68,0.40);   }
.rel-pulse-grid.is-ultra .rel-pulse-cell-empty {
    background: rgba(255,255,255,0.015);
    color: transparent;
}
/* Leader star: small, no text, just the icon */
.rel-pulse-grid.is-ultra .rel-pulse-star-ultra {
    font-size: 9px;
    color: #fde68a;
    text-shadow: 0 0 4px rgba(251,191,36,0.6);
    line-height: 1;
}
/* Quarter dividers — thin vertical line in front of cells that mark
   the start of Q2/Q3/Q4. Helps the eye chunk the year into 4 segments. */
.rel-pulse-grid.is-ultra [data-q-divider="1"] {
    position: relative;
    border-left: 1px solid rgba(251,191,36,0.30);
    margin-left: 2px;
}
.rel-pulse-grid.is-ultra .rel-pulse-th[data-q-divider="1"] {
    border-left: 1px solid rgba(251,191,36,0.40);
}
/* Header row in ultra: tight, only every 4th week labelled */
.rel-pulse-grid.is-ultra .rel-pulse-th {
    padding: 4px 1px;
    background: transparent;
    border-color: transparent;
    border-radius: 0;
}
.rel-pulse-grid.is-ultra .rel-pulse-th-wk { font-size: 9px; font-weight: 700; color: rgba(255,255,255,0.45); }
.rel-pulse-grid.is-ultra .rel-pulse-th-yr { display: none; }
/* Depot label in ultra: very compact, code only */
.rel-pulse-grid.is-ultra .rel-pulse-depot {
    padding: 4px 8px;
    border-radius: 4px;
}
.rel-pulse-grid.is-ultra .rel-pulse-depot-code { font-size: 11px; }
.rel-pulse-grid.is-ultra .rel-pulse-depot-name { display: none; }
/* Leader cell in ultra: just enough to show dual rank */
.rel-pulse-grid.is-ultra .rel-pulse-leader-cell {
    padding: 4px 6px;
    border-radius: 4px;
    gap: 2px;
}
.rel-pulse-grid.is-ultra .rel-pulse-leader-internal { font-size: 9.5px; }
.rel-pulse-grid.is-ultra .rel-pulse-leader-station { padding-top: 3px; }
.rel-pulse-grid.is-ultra .rel-pulse-station-tag { font-size: 8.5px; padding: 1px 4px; }
.rel-pulse-grid.is-ultra .rel-pulse-stale { font-size: 8.5px; }
/* Hover lift effect — cells are tiny so a subtle scale + outline reads */
.rel-pulse-grid.is-ultra .rel-pulse-cell:hover {
    transform: scale(1.6);
    z-index: 4;
    outline: 1px solid rgba(255,255,255,0.4);
    border-radius: 3px;
}

/* ==========================================================================
   SIDEBAR NAVIGATION  (.nav-side-*)
   --------------------------------------------------------------------------
   Replaces the previous in-topbar horizontal nav. The sidebar is the
   primary navigation surface on desktop; on mobile it becomes a drawer
   that slides in over the page (toggled by .app-topbar-burger).

   Visual language matches the existing app chrome:
     - Dark blue-black surface (rgba(8,12,22,*))
     - Orange/red gradient accents (#f59e0b → #fb923c → #ef4444)
     - 1px subtle borders rgba(255,255,255,0.06)

   Class prefix: .nav-side-  (avoids collision with .app-, .kpi-, .card-)

   States (toggled on <body>):
     .is-sidebar-collapsed  desktop, sidebar shrunk to icons only
     .is-sidebar-open       mobile, drawer is visible
   ========================================================================== */

.nav-side {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 220px;
    background: rgba(8,12,22,0.95);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border-right: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
    padding: 14px 10px 8px;
    z-index: 110;
    transition: width 0.18s ease, transform 0.22s ease;
    overflow: hidden;
}

/* Body must reserve space for the fixed sidebar on desktop. */
body { padding-left: 220px; transition: padding-left 0.18s ease; }
body.is-sidebar-collapsed { padding-left: 56px; }
body.is-sidebar-collapsed .nav-side { width: 56px; }

/* Brand at the top of the sidebar */
.nav-side-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 6px 6px 14px;
    margin-bottom: 6px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.nav-side-brand-logo {
    width: 32px; height: 32px;
    border-radius: 9px;
    background: linear-gradient(135deg, #f59e0b 0%, #fb923c 50%, #ef4444 100%);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 900;
    font-size: 16px;
    box-shadow: 0 6px 18px rgba(245,158,11,0.30), inset 0 1px 0 rgba(255,255,255,0.25);
    flex-shrink: 0;
}
.nav-side-brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.nav-side-brand-title { font-size: 13px; font-weight: 800; letter-spacing: -0.01em; white-space: nowrap; }
.nav-side-brand-sub   { font-size: 10px; font-weight: 600; color: rgba(255,255,255,0.45); letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; }

/* Scrollable nav region between brand and collapse button */
.nav-side-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    margin: 0 -4px;
    padding: 0 4px;
    /* Subtle scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.12) transparent;
}
.nav-side-nav::-webkit-scrollbar { width: 6px; }
.nav-side-nav::-webkit-scrollbar-track { background: transparent; }
.nav-side-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.10); border-radius: 3px; }
.nav-side-nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }

.nav-side-group { margin: 12px 0 4px; }
.nav-side-group:first-child { margin-top: 6px; }
.nav-side-group-label {
    font-size: 10px;
    font-weight: 700;
    color: rgba(255,255,255,0.32);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 4px 11px 8px;
    white-space: nowrap;
}

/* Link/span rows */
.nav-side-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 8px 11px;
    border-radius: 9px;
    color: rgba(255,255,255,0.62);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
    margin-bottom: 1px;
    white-space: nowrap;
    border: 1px solid transparent;
}
.nav-side-link svg { flex-shrink: 0; opacity: 0.78; transition: opacity 0.15s ease; }
.nav-side-link-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.nav-side-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.04);
}
.nav-side-link:hover svg { opacity: 1; }

.nav-side-link.is-active {
    color: #fff;
    background: linear-gradient(180deg, rgba(245,158,11,0.18), rgba(239,68,68,0.10));
    border-color: rgba(245,158,11,0.28);
}
.nav-side-link.is-active svg { opacity: 1; color: #fbbf24; }

/* Placeholder "Soon" rows — non-interactive */
.nav-side-link.is-soon {
    color: rgba(255,255,255,0.36);
    cursor: not-allowed;
}
.nav-side-link.is-soon:hover {
    background: transparent;
    color: rgba(255,255,255,0.36);
}
.nav-side-link.is-soon svg { opacity: 0.5; }
.nav-side-soon-badge {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.55);
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.10);
    padding: 2px 7px;
    border-radius: 999px;
    flex-shrink: 0;
}

/* Collapse button — bottom of sidebar (desktop only) */
.nav-side-collapse {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 11px;
    margin-top: 8px;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.4);
    font-size: 12px;
    font-weight: 600;
    border-radius: 9px;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: all 0.15s ease;
    flex-shrink: 0;
}
.nav-side-collapse:hover { color: #fff; background: rgba(255,255,255,0.04); }
.nav-side-collapse svg { flex-shrink: 0; transition: transform 0.18s ease; }
body.is-sidebar-collapsed .nav-side-collapse svg { transform: rotate(180deg); }
.nav-side-collapse-text { flex: 1; }

/* === Collapsed mode (desktop, icons only) ============================== */
body.is-sidebar-collapsed .nav-side-brand-text,
body.is-sidebar-collapsed .nav-side-link-text,
body.is-sidebar-collapsed .nav-side-soon-badge,
body.is-sidebar-collapsed .nav-side-group-label,
body.is-sidebar-collapsed .nav-side-collapse-text {
    display: none;
}
body.is-sidebar-collapsed .nav-side-brand { justify-content: center; padding: 6px 0 14px; }
body.is-sidebar-collapsed .nav-side-link { justify-content: center; padding: 8px 0; }
body.is-sidebar-collapsed .nav-side-group { margin: 8px 0 2px; }
body.is-sidebar-collapsed .nav-side-group::before {
    content: "";
    display: block;
    height: 1px;
    background: rgba(255,255,255,0.06);
    margin: 6px 12px;
}
body.is-sidebar-collapsed .nav-side-group:first-child::before { display: none; }
body.is-sidebar-collapsed .nav-side-collapse { justify-content: center; padding: 8px 0; }

/* === Backdrop (mobile drawer only) ===================================== */
.nav-side-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 105;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}
body.is-sidebar-open .nav-side-backdrop {
    opacity: 1;
    pointer-events: auto;
}

/* ==========================================================================
   TOPBAR ADJUSTMENTS  for sidebar coexistence
   The .app-topbar* classes from earlier are still used for the slim header;
   we add the new mobile-only burger / brand / spacer and tighten padding.
   ========================================================================== */

.app-topbar-burger {
    display: none; /* desktop hides this */
    align-items: center;
    justify-content: center;
    width: 38px; height: 38px;
    border-radius: 9px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
    color: rgba(255,255,255,0.85);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
}
.app-topbar-burger:hover { background: rgba(255,255,255,0.07); color: #fff; }
.app-topbar-burger[aria-expanded="true"] {
    background: linear-gradient(180deg, rgba(245,158,11,0.18), rgba(239,68,68,0.10));
    border-color: rgba(245,158,11,0.28);
    color: #fff;
}

.app-topbar-brand-mobile {
    display: none; /* desktop hides this */
    align-items: center;
    gap: 9px;
    text-decoration: none;
    color: inherit;
    flex-shrink: 0;
}
.app-topbar-brand-mobile-logo {
    width: 28px; height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, #f59e0b 0%, #fb923c 50%, #ef4444 100%);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 900;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(245,158,11,0.30), inset 0 1px 0 rgba(255,255,255,0.25);
}
.app-topbar-brand-mobile-title {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.app-topbar-spacer { flex: 1; min-width: 0; }

/* ==========================================================================
   MOBILE BREAKPOINT  (< 1024px)
   Sidebar becomes a drawer; topbar shows burger + brand.
   ========================================================================== */

@media (max-width: 1023px) {
    body { padding-left: 0; }

    .nav-side {
        transform: translateX(-100%);
        box-shadow: 8px 0 32px rgba(0,0,0,0.40);
    }
    body.is-sidebar-open .nav-side { transform: translateX(0); }

    /* On mobile, sidebar is always full width (no collapsed state) */
    body.is-sidebar-collapsed .nav-side { width: 220px; }
    body.is-sidebar-collapsed { padding-left: 0; }
    body.is-sidebar-collapsed .nav-side-brand-text,
    body.is-sidebar-collapsed .nav-side-link-text,
    body.is-sidebar-collapsed .nav-side-soon-badge,
    body.is-sidebar-collapsed .nav-side-group-label,
    body.is-sidebar-collapsed .nav-side-collapse-text { display: flex; }
    body.is-sidebar-collapsed .nav-side-brand { justify-content: flex-start; padding: 6px 6px 14px; }
    body.is-sidebar-collapsed .nav-side-link { justify-content: flex-start; padding: 8px 11px; }
    body.is-sidebar-collapsed .nav-side-group::before { display: none; }

    /* Collapse button is desktop-only */
    .nav-side-collapse { display: none; }

    /* Mobile-only topbar elements visible */
    .app-topbar-burger { display: inline-flex; }
    .app-topbar-brand-mobile { display: inline-flex; }

    /* Tighter padding on small screens */
    .app-topbar-inner { padding: 10px 14px; gap: 12px; }

    /* Lock body scroll when drawer is open */
    body.is-sidebar-open { overflow: hidden; }
}

/* Very narrow screens — hide the brand text, keep just the logo + burger */
@media (max-width: 419px) {
    .app-topbar-brand-mobile-title { display: none; }
}

/* ==========================================================================
   SIDEBAR + TOPBAR  v2 — visual polish overrides
   --------------------------------------------------------------------------
   Tighter hierarchy, more breathing room, accent on active state,
   purple-tinted "soon" badges so the OPERATIONS section reads as
   "coming soon" rather than "disabled grey wasteland". Adds the
   breadcrumb visible in the topbar's previously-empty left area.

   All rules override the corresponding earlier .nav-side-* / .app-
   declarations by later-position in the cascade — no class renames
   were necessary.
   ========================================================================== */

/* Sidebar shell — slightly cooler tint than the topbar so the two
   surfaces read as distinct layers. */
.nav-side {
    background: rgba(6,10,20,0.96);
    border-right: 1px solid rgba(255,255,255,0.08);
    padding: 16px 12px 10px;
}

/* Brand */
.nav-side-brand {
    padding: 4px 6px 16px;
    margin-bottom: 10px;
    gap: 12px;
}
.nav-side-brand-logo {
    width: 34px; height: 34px;
    font-size: 17px;
}
.nav-side-brand-title { font-size: 14px; }
.nav-side-brand-sub {
    font-size: 9.5px;
    letter-spacing: 0.09em;
    color: rgba(255,255,255,0.42);
}

/* Group separation — give each section room to breathe */
.nav-side-group { margin: 18px 0 2px; }
.nav-side-group:first-child { margin-top: 4px; }

/* Group labels — brighter, with a tiny accent dot for visual anchor */
.nav-side-group-label {
    font-size: 10.5px;
    font-weight: 700;
    color: rgba(255,255,255,0.50);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 4px 11px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.nav-side-group-label::before {
    content: "";
    display: block;
    width: 4px; height: 4px;
    border-radius: 50%;
    background: rgba(245,158,11,0.55);
    flex-shrink: 0;
}

/* Links — slightly more vertical room */
.nav-side-link {
    padding: 8.5px 11px;
    margin-bottom: 2px;
    position: relative;
}

/* Active state — keep gradient, add 3px left accent bar for stronger anchor */
.nav-side-link.is-active {
    padding-left: 14px;
}
.nav-side-link.is-active::before {
    content: "";
    position: absolute;
    left: 3px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 18px;
    border-radius: 3px;
    background: linear-gradient(180deg, #f59e0b, #ef4444);
    box-shadow: 0 0 8px rgba(245,158,11,0.45);
}

/* Soon rows — purple tint instead of gray-on-gray. Reads as "queued"
   not "disabled". Pictogram stays muted but takes the same tint. */
.nav-side-link.is-soon {
    color: rgba(196,181,253,0.46);
}
.nav-side-link.is-soon svg {
    color: rgba(167,139,250,0.55);
    opacity: 0.85;
}
.nav-side-soon-badge {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #c4b5fd;
    background: rgba(167,139,250,0.10);
    border: 1px solid rgba(167,139,250,0.22);
    padding: 2px 7px;
}

/* Collapse button — pull it visually away from the link list */
.nav-side-collapse {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.05);
    border-radius: 0;
    padding-left: 11px;
    padding-right: 11px;
}
.nav-side-collapse:hover {
    background: transparent;
    color: rgba(255,255,255,0.85);
}

/* Collapsed-mode tweaks — center the accent bar too */
body.is-sidebar-collapsed .nav-side-link.is-active { padding-left: 0; }
body.is-sidebar-collapsed .nav-side-link.is-active::before {
    left: 50%;
    transform: translate(-50%, -50%);
    top: -8px;
    width: 18px;
    height: 3px;
}
body.is-sidebar-collapsed .nav-side-group-label::before { display: none; }

/* ==========================================================================
   TOPBAR BREADCRUMB
   ========================================================================== */

.app-topbar-crumb {
    display: flex;
    align-items: center;
    gap: 9px;
    padding-left: 4px;
    min-width: 0;
    flex-shrink: 1;
    overflow: hidden;
}
.app-topbar-crumb-section {
    font-size: 12.5px;
    font-weight: 600;
    color: rgba(255,255,255,0.42);
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.app-topbar-crumb-sep {
    color: rgba(255,255,255,0.25);
    flex-shrink: 0;
}
.app-topbar-crumb-page {
    font-size: 14px;
    font-weight: 700;
    color: rgba(255,255,255,0.92);
    letter-spacing: -0.005em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* On narrow screens, drop the section prefix and keep just the page */
@media (max-width: 1199px) {
    .app-topbar-crumb-section,
    .app-topbar-crumb-sep { display: none; }
}
@media (max-width: 1023px) {
    /* On mobile, the burger+brand-mobile already provide context */
    .app-topbar-crumb { display: none; }
}

/* ==========================================================================
   LAYOUT WIDTH  v3 — use the wide-monitor real estate
   --------------------------------------------------------------------------
   The previous max-widths (1440/1500px) were tuned for the pre-sidebar
   era. With a 220px sidebar pinned on the left, content on 1920px+
   monitors had ~300-900px of dead space on the right. Bump every shell
   container to var(--shell-max) (1800px) so the layout actually fills
   modern monitors. CSS variable lets us tune in one place later.
   ========================================================================== */

.app-topbar-inner,
.app-main,
.main {
    max-width: var(--shell-max);
}

/* On ultrawide monitors (≥2200px viewport, ≥1980px after sidebar) the
   1800px content area starts to feel orphaned in the center. Lift the
   ceiling a notch so the layout grows with the screen but doesn't run
   wild. */
@media (min-width: 2200px) {
    :root { --shell-max: 2000px; }
}

/* ==========================================================================
   SIDEBAR WIDTH  v3 — bump to modern dashboard sidebar width
   --------------------------------------------------------------------------
   The initial 220px was carried over from a sketch when the sidebar
   still shared a row with the topbar nav. Standalone vertical sidebars
   in modern apps sit around 240–260px (Linear 240, Stripe 248, Slack
   260). 248px gives the section labels and link rows proper visual
   weight without eating too much of the content area.
   ========================================================================== */

:root { --side-w: 248px; }

.nav-side { width: var(--side-w); }

/* Desktop layout: body padding-left makes room for the fixed sidebar.
   On mobile (<= 1023px) the sidebar becomes a drawer and the body
   padding is reset to 0 — see the matching @media block above. The
   previous version had this declaration outside any media query,
   which (because of source order) silently re-applied 248px of left
   padding on mobile and pushed every page's content off-screen. */
@media (min-width: 1024px) {
    body { padding-left: var(--side-w); }
}

@media (max-width: 1023px) {
    /* Mobile drawer still uses the same width — overrides the older
       hard-coded 220px in the mobile media block above. */
    body.is-sidebar-collapsed .nav-side { width: var(--side-w); }
}

/* ==========================================================================
   DAILY REPORT  (.daily-*)
   --------------------------------------------------------------------------
   Per-station daily ops dashboard. Uploader, week-grouped day cards, and
   the day-detail view with per-driver totals + RTS/DNR/POD/CC tabs.
   ========================================================================== */

/* Page header (shared between daily.php and daily_view.php) */
.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin: 8px 0 24px;
    flex-wrap: wrap;
}
.page-title {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.015em;
    margin: 0 0 6px;
    color: #fff;
}
.page-sub {
    font-size: 13px;
    color: rgba(255,255,255,0.55);
    margin: 0;
    line-height: 1.5;
}
.page-sub strong { color: rgba(255,255,255,0.85); font-weight: 700; }
.page-header-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(245,158,11,0.18), rgba(239,68,68,0.10));
    border: 1px solid rgba(245,158,11,0.28);
    color: #fbbf24;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.05em;
}
.page-back {
    margin-bottom: 6px;
}
.page-back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: rgba(255,255,255,0.55);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.15s ease;
}
.page-back-link:hover { color: #fbbf24; }

/* Flash messages (success/error after upload) */
.daily-flash {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid;
}
.daily-flash-success {
    background: rgba(34,197,94,0.08);
    border-color: rgba(34,197,94,0.25);
    color: #86efac;
}
.daily-flash-error {
    background: rgba(220,38,38,0.10);
    border-color: rgba(220,38,38,0.30);
    color: #fca5a5;
}
.daily-flash-icon { flex-shrink: 0; padding-top: 2px; }
.daily-flash-title { font-weight: 700; font-size: 14px; margin-bottom: 2px; }
.daily-flash-detail { font-size: 12.5px; opacity: 0.85; line-height: 1.5; }

/* Empty-state card (no depot picked OR no reports) */
.daily-empty {
    text-align: center;
    padding: 48px 24px;
}
.daily-empty-icon {
    width: 56px; height: 56px;
    border-radius: 14px;
    background: rgba(255,255,255,0.04);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    color: rgba(255,255,255,0.45);
}
.daily-empty-title {
    font-size: 18px;
    font-weight: 700;
    color: rgba(255,255,255,0.85);
    margin: 0 0 8px;
}
.daily-empty-body {
    font-size: 13.5px;
    color: rgba(255,255,255,0.55);
    line-height: 1.6;
    max-width: 460px;
    margin: 0 auto;
}

/* === Uploader === */
.daily-upload-card { padding: 0; overflow: hidden; }
.daily-upload { display: flex; flex-direction: column; }

.daily-upload-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 24px;
    border: 1.5px dashed rgba(255,255,255,0.14);
    border-radius: 12px;
    margin: 16px;
    background: rgba(255,255,255,0.015);
    cursor: pointer;
    text-align: center;
    transition: all 0.18s ease;
}
.daily-upload-drop:hover,
.daily-upload-drop.is-dragover {
    border-color: rgba(245,158,11,0.5);
    background: rgba(245,158,11,0.06);
}
.daily-upload-drop-icon {
    color: rgba(245,158,11,0.7);
}
.daily-upload-drop.is-dragover .daily-upload-drop-icon { color: #fbbf24; }
.daily-upload-drop-text { display: flex; flex-direction: column; gap: 4px; }
.daily-upload-drop-text strong {
    font-size: 14px;
    font-weight: 700;
    color: rgba(255,255,255,0.92);
    letter-spacing: -0.005em;
}
.daily-upload-drop-text span {
    font-size: 12px;
    color: rgba(255,255,255,0.50);
}

.daily-upload-staged {
    padding: 0 16px 16px;
}
.daily-upload-staged-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 4px 10px;
    font-size: 12px;
    color: rgba(255,255,255,0.55);
    font-weight: 600;
}
.daily-upload-clear {
    background: none;
    border: none;
    color: rgba(255,255,255,0.45);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
    padding: 2px 6px;
}
.daily-upload-clear:hover { color: #fbbf24; }
.daily-upload-staged-list {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
    max-height: 160px;
    overflow-y: auto;
}
.daily-staged-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 12px;
    background: rgba(255,255,255,0.025);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 8px;
    margin-bottom: 4px;
    font-size: 12.5px;
}
.daily-staged-name { color: rgba(255,255,255,0.85); font-weight: 500; }
.daily-staged-size { color: rgba(255,255,255,0.40); font-size: 11px; font-variant-numeric: tabular-nums; }

.daily-upload-submit {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 18px;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: transform 0.12s ease, opacity 0.15s ease;
    align-self: flex-start;
    box-shadow: 0 4px 16px rgba(245,158,11,0.25);
}
.daily-upload-submit:hover { transform: translateY(-1px); }
.daily-upload-submit:disabled { opacity: 0.6; cursor: wait; transform: none; }

/* === Week-grouped report cards === */
.daily-weeks { display: flex; flex-direction: column; gap: 28px; }
.daily-week-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 0 4px;
}
.daily-week-title {
    font-size: 14px;
    font-weight: 800;
    color: rgba(255,255,255,0.88);
    margin: 0;
    letter-spacing: -0.005em;
}
.daily-week-range {
    font-size: 11.5px;
    color: rgba(255,255,255,0.42);
    font-weight: 600;
}
.daily-week-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.daily-day-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: all 0.15s ease;
}
.daily-day-card:hover {
    border-color: rgba(245,158,11,0.32);
    background: rgba(245,158,11,0.04);
    transform: translateY(-1px);
}
.daily-day-card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}
.daily-day-weekday {
    font-size: 14px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.005em;
}
.daily-day-date {
    font-size: 11.5px;
    color: rgba(255,255,255,0.45);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.daily-day-card-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 8px;
}
.daily-stat {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    color: rgba(255,255,255,0.65);
    padding: 2px 7px;
    background: rgba(255,255,255,0.04);
    border-radius: 6px;
    font-variant-numeric: tabular-nums;
}
.daily-stat-rts { color: #fbbf24; }
.daily-stat-dnr { color: #f87171; }
.daily-stat-pod { color: #a78bfa; }
.daily-stat-cc  { color: #60a5fa; }
.daily-day-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    color: rgba(255,255,255,0.55);
}
.daily-day-total { font-size: 11.5px; font-weight: 600; }

/* === Day detail view === */
.daily-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.daily-kpi {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 18px;
}
.daily-kpi-label {
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
    margin-bottom: 6px;
}
.daily-kpi-value {
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    line-height: 1;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}
.daily-kpi-sub {
    font-size: 11.5px;
    color: rgba(255,255,255,0.42);
}

/* Driver totals table */
.daily-driver-card { margin-bottom: 20px; }
.daily-driver-table-wrap { overflow-x: auto; }
.daily-driver-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.daily-driver-table thead th {
    text-align: left;
    padding: 10px 12px;
    font-size: 10.5px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.42);
    font-weight: 700;
    border-bottom: 1px solid var(--border);
}
.daily-driver-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    font-variant-numeric: tabular-nums;
}
.daily-driver-table tbody tr:hover td { background: rgba(255,255,255,0.02); }
.daily-driver-name { font-weight: 600; color: rgba(255,255,255,0.92); }
.daily-driver-name.is-unmapped { color: rgba(255,255,255,0.55); font-style: italic; }
.daily-driver-tid { font-size: 10.5px; color: rgba(255,255,255,0.35); font-family: var(--font-mono, monospace); margin-top: 2px; }
.daily-num { text-align: right; }
.daily-zero { color: rgba(255,255,255,0.18); }
.daily-total-cell strong { color: #fbbf24; font-weight: 800; }

/* Tabs */
.daily-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: 16px;
    background: rgba(255,255,255,0.03);
    border-radius: 10px;
    width: max-content;
}
.daily-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: transparent;
    border: none;
    border-radius: 7px;
    color: rgba(255,255,255,0.55);
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: all 0.15s ease;
}
.daily-tab:hover { color: #fff; }
.daily-tab.is-active {
    background: rgba(255,255,255,0.06);
    color: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.20);
}
.daily-tab-count {
    font-size: 10.5px;
    padding: 1px 6px;
    background: rgba(255,255,255,0.08);
    border-radius: 999px;
    color: rgba(255,255,255,0.65);
    font-variant-numeric: tabular-nums;
}
.daily-tab.is-active .daily-tab-count {
    background: rgba(245,158,11,0.20);
    color: #fbbf24;
}

.daily-pane { display: none; }
.daily-pane.is-active { display: block; }
.daily-pane-empty {
    text-align: center;
    padding: 32px 24px;
    color: rgba(255,255,255,0.48);
    font-size: 13px;
}

.daily-detail-table-wrap { overflow-x: auto; }
.daily-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}
.daily-detail-table thead th {
    text-align: left;
    padding: 9px 12px;
    font-size: 10.5px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.42);
    font-weight: 700;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.daily-detail-table tbody td {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    vertical-align: middle;
}
.daily-detail-table tbody tr:hover td { background: rgba(255,255,255,0.02); }
.daily-detail-table code {
    font-size: 11.5px;
    color: rgba(255,255,255,0.65);
    background: rgba(255,255,255,0.04);
    padding: 1px 5px;
    border-radius: 4px;
    font-family: var(--font-mono, monospace);
}

/* ==========================================================================
   DAILY DRIVER TABLE  v2 — severity coloring, status pills, clean toggle
   --------------------------------------------------------------------------
   Replaces the v1 "every number looks the same" treatment with proper
   visual hierarchy: severity-coded metrics, prominent total column,
   left-edge accent for problem drivers, and a collapsed section for
   the (usually majority) drivers that had a clean day.
   ========================================================================== */

/* Row-level accent — left border + subtle tint. Without this the eye
   can't pick problem drivers out of a stack of similar rows. */
.daily-row { position: relative; }
.daily-row td:first-child {
    border-left: 3px solid transparent;
    padding-left: 14px;
}
.daily-row-low    td:first-child { border-left-color: rgba(96,165,250,0.35); }
.daily-row-warn   td:first-child { border-left-color: rgba(251,191,36,0.55); }
.daily-row-bad    td:first-child {
    border-left-color: #ef4444;
    box-shadow: inset 4px 0 12px rgba(239,68,68,0.06);
}
.daily-row-bad td { background: rgba(239,68,68,0.025); }

/* Per-cell metric chip — coloured pill, tabular numerals */
.daily-metric {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    border: 1px solid transparent;
}
.daily-metric-zero {
    color: rgba(255,255,255,0.18);
    background: transparent;
    font-size: 14px;
    font-weight: 400;
    min-width: 0;
    padding: 0;
}
.daily-metric-low {
    color: #93c5fd;
    background: rgba(59,130,246,0.10);
    border-color: rgba(59,130,246,0.22);
}
.daily-metric-warn {
    color: #fbbf24;
    background: rgba(245,158,11,0.10);
    border-color: rgba(245,158,11,0.28);
}
.daily-metric-bad {
    color: #fca5a5;
    background: rgba(220,38,38,0.14);
    border-color: rgba(220,38,38,0.38);
}

/* Total column — bigger, bolder, severity-tinted */
.daily-total {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    padding: 3px 9px;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}
.daily-total-zero {
    color: rgba(255,255,255,0.28);
    background: transparent;
    font-weight: 500;
    padding: 0;
}
.daily-total-low {
    color: #bfdbfe;
    background: rgba(59,130,246,0.14);
}
.daily-total-warn {
    color: #fcd34d;
    background: rgba(245,158,11,0.18);
}
.daily-total-bad {
    color: #fff;
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    box-shadow: 0 2px 10px rgba(239,68,68,0.30);
}

/* Per-row "View" action — placeholder until per-driver-day view ships */
.daily-col-action { width: 64px; }
.daily-row-view {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11.5px;
    font-weight: 700;
    color: rgba(255,255,255,0.35);
    padding: 4px 8px;
    border-radius: 6px;
    text-decoration: none;
    cursor: not-allowed;
    transition: all 0.12s ease;
    border: 1px solid rgba(255,255,255,0.06);
}
.daily-row-view:hover {
    color: rgba(255,255,255,0.62);
    background: rgba(255,255,255,0.03);
    border-color: rgba(255,255,255,0.10);
}

/* Clean toggle row — sits between problem drivers and clean drivers */
.daily-clean-divider td {
    padding: 0;
    background: transparent;
    border-bottom: none;
}
.daily-clean-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 14px 16px;
    background: transparent;
    border: none;
    border-top: 1px dashed rgba(255,255,255,0.08);
    border-bottom: 1px dashed rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.55);
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    text-align: left;
    margin: 8px 0 0;
    transition: all 0.15s ease;
}
.daily-clean-toggle:hover {
    color: #fff;
    background: rgba(255,255,255,0.025);
}
.daily-clean-toggle-arrow {
    transition: transform 0.18s ease;
    color: rgba(34,197,94,0.7);
}
.daily-clean-toggle-text { flex: 1; }
.daily-clean-toggle-hint {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.35);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Clean-row badge — green check pill in lieu of zeroes */
.daily-row-clean td { opacity: 0.62; }
.daily-row-clean:hover td { opacity: 0.92; }
.daily-clean-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 9px;
    background: rgba(34,197,94,0.08);
    border: 1px solid rgba(34,197,94,0.22);
    border-radius: 999px;
    color: #86efac;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ==========================================================================
   DAILY DRIVER TABLE  v3 — column distribution fix
   --------------------------------------------------------------------------
   v2 used auto-layout, so each metric column shrank to fit its narrow
   header ("RTS") + narrow contents (single digits in pills). With
   right-align on the cells, all the numbers ended up hugged tight
   against the Driver column, leaving a huge dead zone on the right.
   Fix: lock the layout with explicit per-column widths and centre the
   numeric cells so each metric reads as its own clean column.
   ========================================================================== */

.daily-driver-table {
    table-layout: fixed;
    width: 100%;
}
.daily-driver-table th:nth-child(1),
.daily-driver-table td:nth-child(1) {
    /* Driver column — flexible, takes leftover space */
    width: auto;
    min-width: 180px;
}
.daily-driver-table th:nth-child(2),
.daily-driver-table th:nth-child(3),
.daily-driver-table th:nth-child(4),
.daily-driver-table th:nth-child(5),
.daily-driver-table td:nth-child(2),
.daily-driver-table td:nth-child(3),
.daily-driver-table td:nth-child(4),
.daily-driver-table td:nth-child(5) {
    /* RTS / DNR / POD / CC — equal width, centred */
    width: 90px;
}
.daily-driver-table th:nth-child(6),
.daily-driver-table td:nth-child(6) {
    /* Total — a bit wider to give the pill room */
    width: 110px;
}
.daily-driver-table th:nth-child(7),
.daily-driver-table td:nth-child(7) {
    width: 84px;
}

/* Override v1's right-align on numeric headers/cells specifically for
   this table so the chips sit in the centre of each column. The detail
   tables below stay right-aligned where it makes sense (call duration). */
.daily-driver-table .daily-num { text-align: center; }

/* Truncate long driver names rather than blowing out the column */
.daily-driver-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* On smaller viewports, narrow the metric columns slightly so the
   driver column has room to breathe. */
@media (max-width: 1100px) {
    .daily-driver-table th:nth-child(2),
    .daily-driver-table th:nth-child(3),
    .daily-driver-table th:nth-child(4),
    .daily-driver-table th:nth-child(5),
    .daily-driver-table td:nth-child(2),
    .daily-driver-table td:nth-child(3),
    .daily-driver-table td:nth-child(4),
    .daily-driver-table td:nth-child(5) { width: 72px; }
    .daily-driver-table th:nth-child(6),
    .daily-driver-table td:nth-child(6) { width: 88px; }
    .daily-driver-table th:nth-child(7),
    .daily-driver-table td:nth-child(7) { width: 64px; }
}

/* ==========================================================================
   DAILY DRIVER RENAME  — inline edit on the per-driver table
   --------------------------------------------------------------------------
   Driver names are buttons. Click → input replaces text. Enter saves,
   Escape cancels. Tiny toast next to the cell on success/failure.
   ========================================================================== */

.daily-driver-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

/* Make .daily-driver-name a button (override the v1 div styling) */
button.daily-driver-name {
    background: transparent;
    border: 1px dashed transparent;
    border-radius: 6px;
    padding: 2px 6px;
    margin: -2px -6px;
    color: inherit;
    font: inherit;
    font-weight: 600;
    text-align: left;
    cursor: text;
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: all 0.12s ease;
}
button.daily-driver-name:hover {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.10);
    color: #fff;
}
button.daily-driver-name.is-unmapped {
    color: rgba(255,255,255,0.50);
    font-style: italic;
    font-weight: 500;
    border-color: rgba(245,158,11,0.20);
    background: rgba(245,158,11,0.04);
}
button.daily-driver-name.is-unmapped:hover {
    color: #fbbf24;
    background: rgba(245,158,11,0.10);
    border-color: rgba(245,158,11,0.40);
    font-style: normal;
}
button.daily-driver-name.is-editing {
    border-style: solid;
    border-color: rgba(245,158,11,0.60);
    background: rgba(245,158,11,0.06);
    cursor: text;
}
button.daily-driver-name.is-saving { opacity: 0.5; pointer-events: none; }

/* Inline input that replaces the button text mid-edit */
.daily-driver-rename-input {
    background: transparent;
    border: none;
    color: #fff;
    font: inherit;
    font-weight: 600;
    font-size: 13px;
    padding: 0;
    width: 100%;
    min-width: 120px;
    outline: none;
    font-style: normal;
}
.daily-driver-rename-input::placeholder {
    color: rgba(255,255,255,0.30);
    font-style: italic;
}

/* Tiny inline confirmation/error after save */
.daily-rename-flash {
    display: inline-block;
    margin-top: 4px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 1;
    transition: opacity 0.4s ease;
}
.daily-rename-flash-ok  { color: #86efac; }
.daily-rename-flash-err { color: #fca5a5; }
.daily-rename-flash.is-fading { opacity: 0; }

/* ==========================================================================
   DAILY DRIVER HANDOUT  (.dd-*)
   --------------------------------------------------------------------------
   Single-driver, single-day printable / shareable view. Less dense
   than the day overview — meant to be read on a phone or printed.
   ========================================================================== */

/* "View" link on the day view becomes active and clickable */
.daily-row-view.is-active {
    color: rgba(255,255,255,0.55);
    cursor: pointer;
    border-color: rgba(255,255,255,0.10);
}
.daily-row-view.is-active:hover {
    color: #fbbf24;
    background: rgba(245,158,11,0.06);
    border-color: rgba(245,158,11,0.32);
}

/* Share row above the handout */
.dd-share-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.dd-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 8px;
    color: rgba(255,255,255,0.78);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}
.dd-share-btn:hover {
    background: rgba(255,255,255,0.07);
    color: #fff;
    border-color: rgba(255,255,255,0.18);
}
.dd-share-btn-primary {
    background: #25d366;
    border-color: #1ebe57;
    color: #04240f;
}
.dd-share-btn-primary:hover {
    background: #2ee076;
    color: #04240f;
}
.dd-share-btn.is-saved { color: #86efac; border-color: rgba(134,239,172,0.40); }

/* The handout itself — printable card */
.dd-handout {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 28px 32px;
    max-width: 740px;
    margin: 0 auto;
}

.dd-handout-head {
    border-bottom: 1px solid var(--border);
    padding-bottom: 22px;
    margin-bottom: 22px;
}
.dd-handout-meta-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.50);
    margin-bottom: 8px;
}
.dd-handout-depot {
    padding: 2px 10px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(245,158,11,0.20), rgba(239,68,68,0.10));
    border: 1px solid rgba(245,158,11,0.30);
    color: #fbbf24;
}
.dd-handout-date { color: rgba(255,255,255,0.55); }
.dd-handout-title {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #fff;
    margin: 0;
    line-height: 1.15;
}
.dd-handout-title-tid {
    font-family: var(--font-mono, monospace);
    font-size: 22px;
    color: rgba(255,255,255,0.78);
}
.dd-handout-warn {
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(245,158,11,0.08);
    border: 1px solid rgba(245,158,11,0.24);
    border-radius: 8px;
    color: #fcd34d;
    font-size: 11.5px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

/* Summary block — clean day vs counts */
.dd-handout-summary { margin-top: 18px; }
.dd-summary-clean {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: rgba(34,197,94,0.08);
    border: 1px solid rgba(34,197,94,0.28);
    border-radius: 12px;
    color: #86efac;
}
.dd-summary-clean-title {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: #bbf7d0;
}
.dd-summary-clean-sub {
    font-size: 13px;
    color: rgba(187,247,208,0.72);
    margin-top: 2px;
}

.dd-summary-counts {
    display: flex;
    align-items: center;
    gap: 22px;
    padding: 16px 20px;
    background: rgba(255,255,255,0.025);
    border: 1px solid var(--border);
    border-radius: 12px;
    flex-wrap: wrap;
}
.dd-summary-total {
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.dd-summary-total-value {
    font-size: 36px;
    font-weight: 900;
    letter-spacing: -0.03em;
    color: #fbbf24;
    line-height: 1;
}
.dd-summary-total-label {
    font-size: 13px;
    color: rgba(255,255,255,0.62);
    font-weight: 600;
}
.dd-summary-mini { display: flex; gap: 8px; flex-wrap: wrap; }
.dd-mini {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(255,255,255,0.04);
    font-size: 12.5px;
    font-weight: 700;
}
.dd-mini-n { font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.dd-mini-l { color: rgba(255,255,255,0.55); letter-spacing: 0.04em; }
.dd-mini-rts .dd-mini-n { color: #fbbf24; }
.dd-mini-dnr .dd-mini-n { color: #fca5a5; }
.dd-mini-pod .dd-mini-n { color: #c4b5fd; }
.dd-mini-cc  .dd-mini-n { color: #93c5fd; }

/* Sections per fail type */
.dd-section { margin-bottom: 26px; }
.dd-section-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 8px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.dd-section-icon {
    width: 28px; height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.65);
    flex-shrink: 0;
}
.dd-section-rts .dd-section-icon { background: rgba(245,158,11,0.15); color: #fbbf24; }
.dd-section-dnr .dd-section-icon { background: rgba(220,38,38,0.15); color: #fca5a5; }
.dd-section-pod .dd-section-icon { background: rgba(124,58,237,0.18); color: #c4b5fd; }
.dd-section-cc  .dd-section-icon { background: rgba(59,130,246,0.15); color: #93c5fd; }

.dd-section-title {
    flex: 1;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    margin: 0;
    letter-spacing: -0.005em;
}
.dd-section-count {
    font-size: 12px;
    font-weight: 700;
    color: rgba(255,255,255,0.55);
    padding: 2px 9px;
    background: rgba(255,255,255,0.05);
    border-radius: 999px;
    font-variant-numeric: tabular-nums;
}

/* Fail items inside sections */
.dd-list { list-style: none; padding: 0; margin: 0; }
.dd-item {
    padding: 10px 12px;
    margin-bottom: 6px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 8px;
}
.dd-item-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}
.dd-item-postcode {
    font-weight: 800;
    font-size: 13.5px;
    color: #fff;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
}
.dd-item-reason {
    color: rgba(255,255,255,0.85);
    font-weight: 500;
}
.dd-item-pill {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: rgba(255,255,255,0.65);
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
}
.dd-item-pill-ok {
    color: #86efac;
    background: rgba(34,197,94,0.10);
    border-color: rgba(34,197,94,0.28);
}
.dd-item-pill-warn {
    color: #fcd34d;
    background: rgba(245,158,11,0.10);
    border-color: rgba(245,158,11,0.28);
}
.dd-item-sub {
    font-size: 11.5px;
    color: rgba(255,255,255,0.45);
    margin-top: 4px;
    line-height: 1.5;
}
.dd-item-sub em { font-style: normal; color: rgba(255,255,255,0.65); }
.dd-item-tracking {
    font-size: 10.5px;
    font-family: var(--font-mono, monospace);
    color: rgba(255,255,255,0.30);
    margin-top: 3px;
    letter-spacing: 0.02em;
}

.dd-handout-foot {
    margin-top: 28px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 11px;
    color: rgba(255,255,255,0.32);
    letter-spacing: 0.02em;
}

/* ===== PRINT STYLES ====================================================
   When the user hits Print or Cmd+P, strip everything that isn't the
   handout and switch to a high-contrast black-on-white treatment so it
   actually photocopies / reads on paper. */
@media print {
    .no-print, .nav-side, .nav-side-backdrop, .app-topbar,
    .page-header, .chat-bubble, .anomaly-show-more { display: none !important; }

    body {
        padding: 0 !important;
        background: #fff !important;
        color: #000 !important;
    }
    .app-main { padding: 0 !important; max-width: 100% !important; }

    .dd-handout {
        max-width: 100% !important;
        background: #fff !important;
        border: 1px solid #ddd !important;
        color: #000 !important;
        padding: 16mm 14mm !important;
        margin: 0 !important;
        border-radius: 0 !important;
    }
    .dd-handout-title           { color: #000 !important; }
    .dd-handout-title-tid       { color: #444 !important; }
    .dd-handout-date            { color: #444 !important; }
    .dd-handout-meta-row        { color: #555 !important; }
    .dd-handout-depot {
        background: #fff !important;
        color: #000 !important;
        border: 1px solid #000 !important;
    }
    .dd-summary-counts,
    .dd-summary-clean {
        background: #f6f6f6 !important;
        border: 1px solid #ccc !important;
        color: #000 !important;
    }
    .dd-summary-total-value     { color: #000 !important; }
    .dd-summary-total-label     { color: #333 !important; }
    .dd-summary-clean-title,
    .dd-summary-clean-sub       { color: #0a3d20 !important; }

    .dd-section { page-break-inside: avoid; }
    .dd-section-head            { border-bottom: 1px solid #888 !important; }
    .dd-section-title           { color: #000 !important; }
    .dd-section-count           { background: #eee !important; color: #000 !important; }
    .dd-section-icon            { background: #eee !important; color: #000 !important; }

    .dd-item {
        background: #fafafa !important;
        border: 1px solid #ddd !important;
        page-break-inside: avoid;
    }
    .dd-item-postcode           { color: #000 !important; }
    .dd-item-reason             { color: #000 !important; }
    .dd-item-sub                { color: #444 !important; }
    .dd-item-sub em             { color: #000 !important; }
    .dd-item-tracking           { color: #666 !important; }
    .dd-item-pill {
        background: #fff !important;
        border: 1px solid #888 !important;
        color: #000 !important;
    }
    .dd-mini                    { background: #f0f0f0 !important; }
    .dd-mini-n                  { color: #000 !important; }
    .dd-mini-l                  { color: #444 !important; }

    .dd-handout-foot            { color: #666 !important; }
    a { color: inherit !important; text-decoration: none !important; }
}

/* ==========================================================================
   DAILY KPI DELTAS  — rolling-average comparison chips
   --------------------------------------------------------------------------
   Each KPI tile on daily_view.php picks up a small inline chip showing
   how today compares to the depot's last-7-day rolling average. Down
   arrow = better (fewer fails than usual). Up arrow = worse. Flat =
   roughly average. Hidden entirely if we don't have enough baseline.
   ========================================================================== */

.daily-kpi-value-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
.daily-kpi-value-row .daily-kpi-value { margin-bottom: 0; }

.daily-kpi-delta {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1;
    cursor: help;
    border: 1px solid transparent;
    font-variant-numeric: tabular-nums;
}
.daily-kpi-delta svg { flex-shrink: 0; }
.daily-kpi-delta-vs {
    font-weight: 500;
    opacity: 0.65;
    margin-left: 1px;
}

/* Tone variants — lower-is-better, so "down" is good. */
.daily-kpi-delta-good {
    color: #86efac;
    background: rgba(34,197,94,0.10);
    border-color: rgba(34,197,94,0.28);
}
.daily-kpi-delta-bad {
    color: #fca5a5;
    background: rgba(220,38,38,0.12);
    border-color: rgba(220,38,38,0.32);
}
.daily-kpi-delta-neutral {
    color: rgba(255,255,255,0.55);
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.10);
}

/* ==========================================================================
   DNR INVESTIGATIONS  (.dnr-* prefix)
   --------------------------------------------------------------------------
   Pages: dnr.php (hub with upload + week selector + leaderboard) and
   dnr_driver.php (per-driver investigation with concession history).
   Uses its own prefix so it doesn't collide with .daily-, .kpi-, etc.
   ========================================================================== */

/* ===== UPLOAD CARD ===== */
.dnr-upload-card .app-card-head { margin-bottom: 12px; }
.dnr-upload-card code {
    font-family: var(--font-mono, monospace);
    font-size: 11.5px;
    background: rgba(255,255,255,0.05);
    padding: 1px 5px;
    border-radius: 4px;
    color: rgba(255,255,255,0.78);
}
.dnr-uploader { display: flex; flex-direction: column; gap: 12px; }

.dnr-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 28px 24px;
    border: 2px dashed rgba(255,255,255,0.10);
    border-radius: 12px;
    background: rgba(255,255,255,0.015);
    cursor: pointer;
    transition: all 0.18s ease;
    color: rgba(255,255,255,0.55);
}
.dnr-drop:hover,
.dnr-drop.is-dragover {
    border-color: rgba(245,158,11,0.45);
    background: rgba(245,158,11,0.04);
    color: #fff;
}
.dnr-drop.is-dragover {
    border-style: solid;
    box-shadow: inset 0 0 0 1px rgba(245,158,11,0.30);
}
.dnr-drop svg { color: rgba(255,255,255,0.45); transition: color 0.15s ease; }
.dnr-drop:hover svg,
.dnr-drop.is-dragover svg { color: #fbbf24; }
.dnr-drop-text { font-size: 14px; }
.dnr-drop-text strong { color: #fff; font-weight: 700; }
.dnr-drop-browse {
    color: #fbbf24;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.dnr-drop-hint { font-size: 11.5px; color: rgba(255,255,255,0.40); }

.dnr-staged { display: flex; flex-direction: column; gap: 5px; }
.dnr-staged-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    font-size: 12.5px;
}
.dnr-staged-row svg { color: rgba(255,255,255,0.45); flex-shrink: 0; }
.dnr-staged-name { flex: 1; color: #fff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dnr-staged-size {
    color: rgba(255,255,255,0.40);
    font-variant-numeric: tabular-nums;
    font-size: 11px;
}
.dnr-staged-remove {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 6px;
    color: rgba(255,255,255,0.45);
    padding: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.12s ease;
}
.dnr-staged-remove:hover {
    color: #fca5a5;
    border-color: rgba(239,68,68,0.40);
    background: rgba(239,68,68,0.08);
}
.dnr-uploader-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
}

/* ===== WEEK SELECTOR STRIP ===== */
.dnr-week-strip {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 4px 0 8px;
    margin-bottom: 16px;
    scrollbar-width: thin;
}
.dnr-week-pill {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    color: rgba(255,255,255,0.62);
    text-decoration: none;
    font-size: 12px;
    transition: all 0.15s ease;
}
.dnr-week-pill:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
    border-color: rgba(255,255,255,0.18);
}
.dnr-week-pill.is-active {
    background: linear-gradient(135deg, rgba(245,158,11,0.18), rgba(239,68,68,0.06));
    border-color: rgba(245,158,11,0.45);
    color: #fff;
    box-shadow: 0 2px 10px rgba(245,158,11,0.12);
}
.dnr-week-pill-num   { font-weight: 800; font-size: 13px; }
.dnr-week-pill-year  { opacity: 0.55; font-weight: 600; }
.dnr-week-pill-count {
    margin-left: 4px;
    padding: 1px 7px;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
    font-size: 11px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.dnr-week-pill.is-active .dnr-week-pill-count {
    background: rgba(245,158,11,0.20);
    color: #fcd34d;
}

/* ===== WEEK HEADER (selected) ===== */
.dnr-week-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
    padding: 4px 4px 0;
}
.dnr-week-title {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    margin: 0;
    letter-spacing: -0.01em;
}
.dnr-week-range {
    font-size: 12px;
    color: rgba(255,255,255,0.45);
    margin-top: 3px;
    font-weight: 600;
}
.dnr-week-total { text-align: right; }
.dnr-week-total-n {
    display: block;
    font-size: 28px;
    font-weight: 800;
    color: #fbbf24;
    line-height: 1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.dnr-week-total-l {
    display: block;
    margin-top: 4px;
    font-size: 11.5px;
    color: rgba(255,255,255,0.50);
    font-weight: 600;
}

/* ===== DEPOT BREAKDOWN TILES ===== */
.dnr-depots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}
.dnr-depot {
    padding: 14px 16px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    text-align: center;
    border-left-width: 3px;
}
.dnr-depot-zero { border-left-color: rgba(34,197,94,0.45); }
.dnr-depot-low  { border-left-color: rgba(96,165,250,0.45); }
.dnr-depot-warn { border-left-color: rgba(245,158,11,0.55); }
.dnr-depot-bad  {
    border-left-color: #ef4444;
    background: rgba(239,68,68,0.03);
}
.dnr-depot-code {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255,255,255,0.50);
    margin-bottom: 2px;
}
.dnr-depot-count {
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    line-height: 1;
}
.dnr-depot-bad .dnr-depot-count  { color: #fca5a5; }
.dnr-depot-warn .dnr-depot-count { color: #fcd34d; }
.dnr-depot-zero .dnr-depot-count { color: rgba(255,255,255,0.30); }
.dnr-depot-sub {
    font-size: 11px;
    color: rgba(255,255,255,0.42);
    margin-top: 4px;
}

/* ===== DRIVER LEADERBOARD ===== */
.dnr-driver-table-wrap {
    overflow-x: auto;
    margin: 0 -4px;
}
.dnr-driver-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
}
.dnr-driver-table thead th {
    text-align: left;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.42);
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
}
.dnr-driver-table .dnr-num { text-align: center; }
.dnr-driver-table td {
    padding: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    font-size: 13px;
    color: rgba(255,255,255,0.85);
}
.dnr-driver-table th:nth-child(1) { width: 50px; }                    /* rank */
.dnr-driver-table th:nth-child(2) { width: auto; min-width: 200px; }  /* driver */
.dnr-driver-table th:nth-child(3) { width: 180px; }                   /* depots */
.dnr-driver-table th:nth-child(4) { width: 110px; }                   /* count */
.dnr-driver-table th:nth-child(5) { width: 110px; }                   /* action */

.dnr-driver-row td:first-child {
    border-left: 3px solid transparent;
    padding-left: 12px;
}
.dnr-row-low  td:first-child { border-left-color: rgba(96,165,250,0.30); }
.dnr-row-warn td:first-child { border-left-color: rgba(245,158,11,0.55); }
.dnr-row-bad  td:first-child {
    border-left-color: #ef4444;
    box-shadow: inset 4px 0 12px rgba(239,68,68,0.06);
}
.dnr-row-bad td { background: rgba(239,68,68,0.025); }

.dnr-rank {
    font-weight: 700;
    color: rgba(255,255,255,0.40);
    font-variant-numeric: tabular-nums;
}
.dnr-driver-name-cell {
    font-weight: 700;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dnr-tid-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    background: rgba(245,158,11,0.12);
    border: 1px solid rgba(245,158,11,0.30);
    border-radius: 999px;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #fbbf24;
    vertical-align: middle;
}
.dnr-depots-cell { display: flex; flex-wrap: wrap; gap: 4px; }
.dnr-depot-chip {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: rgba(255,255,255,0.72);
}
.dnr-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    padding: 3px 10px;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}
.dnr-count-low {
    color: #bfdbfe;
    background: rgba(59,130,246,0.12);
    border: 1px solid rgba(59,130,246,0.24);
}
.dnr-count-warn {
    color: #fcd34d;
    background: rgba(245,158,11,0.16);
    border: 1px solid rgba(245,158,11,0.30);
}
.dnr-count-bad {
    color: #fff;
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    box-shadow: 0 2px 10px rgba(239,68,68,0.30);
    border: 1px solid transparent;
}
.dnr-col-action { width: 110px; }
.dnr-row-view {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 11.5px;
    font-weight: 700;
    color: rgba(255,255,255,0.62);
    background: transparent;
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.12s ease;
}
.dnr-row-view:hover {
    color: #fbbf24;
    background: rgba(245,158,11,0.06);
    border-color: rgba(245,158,11,0.32);
}

/* ===== DRIVER INVESTIGATION PAGE ===== */
.dnr-driver-head-card { padding: 24px 28px; }
.dnr-driver-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    flex-wrap: wrap;
}
.dnr-driver-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: rgba(255,255,255,0.50);
    font-weight: 600;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
    flex-wrap: wrap;
}
.dnr-driver-depot {
    padding: 2px 10px;
    background: linear-gradient(135deg, rgba(245,158,11,0.18), rgba(239,68,68,0.08));
    border: 1px solid rgba(245,158,11,0.30);
    border-radius: 999px;
    color: #fbbf24;
    font-weight: 700;
    text-transform: uppercase;
}
.dnr-driver-tid {
    font-family: var(--font-mono, monospace);
    font-size: 11px;
    background: rgba(255,255,255,0.04);
    padding: 2px 7px;
    border-radius: 4px;
    color: rgba(255,255,255,0.65);
}
.dnr-driver-status {
    padding: 2px 8px;
    background: rgba(239,68,68,0.10);
    border: 1px solid rgba(239,68,68,0.28);
    border-radius: 999px;
    color: #fca5a5;
    font-weight: 700;
    text-transform: uppercase;
}
.dnr-driver-name {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #fff;
    margin: 0;
    line-height: 1.15;
}
.dnr-driver-name.is-unmapped {
    font-family: var(--font-mono, monospace);
    font-size: 22px;
    color: rgba(255,255,255,0.78);
}
.dnr-driver-total { text-align: right; }
.dnr-driver-total-n {
    display: block;
    font-size: 38px;
    font-weight: 900;
    color: #fbbf24;
    line-height: 1;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}
.dnr-driver-total-l {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: rgba(255,255,255,0.55);
    font-weight: 600;
}

/* Sparkline strip — bars per week, value labelled on top */
.dnr-spark {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.dnr-spark-label {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.42);
    font-weight: 700;
    margin-bottom: 8px;
}
.dnr-spark-bars {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 80px;
}
.dnr-spark-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    min-width: 40px;
}
.dnr-spark-bar {
    width: 100%;
    max-width: 48px;
    background: linear-gradient(to top, rgba(245,158,11,0.45), rgba(245,158,11,0.18));
    border-top: 2px solid #fbbf24;
    border-radius: 4px 4px 0 0;
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 3px;
}
.dnr-spark-n {
    font-size: 10.5px;
    font-weight: 700;
    color: #fcd34d;
    font-variant-numeric: tabular-nums;
}
.dnr-spark-w {
    margin-top: 6px;
    font-size: 10.5px;
    color: rgba(255,255,255,0.42);
    font-weight: 600;
}

/* Gap (timing) buckets */
.dnr-gap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    padding: 4px;
}
.dnr-gap {
    padding: 14px 16px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.02);
}
.dnr-gap-warn {
    border-color: rgba(245,158,11,0.32);
    background: rgba(245,158,11,0.04);
}
.dnr-gap-neutral { border-color: rgba(255,255,255,0.10); }
.dnr-gap-info {
    border-color: rgba(96,165,250,0.28);
    background: rgba(59,130,246,0.04);
}
.dnr-gap-zero { opacity: 0.6; }
.dnr-gap-n {
    font-size: 24px;
    font-weight: 800;
    color: #fff;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.dnr-gap-warn .dnr-gap-n { color: #fcd34d; }
.dnr-gap-info .dnr-gap-n { color: #93c5fd; }
.dnr-gap-l {
    margin-top: 6px;
    font-size: 12.5px;
    font-weight: 700;
    color: rgba(255,255,255,0.78);
}
.dnr-gap-h {
    font-size: 10.5px;
    color: rgba(255,255,255,0.40);
    margin-top: 2px;
}

/* History table */
.dnr-history-wrap { overflow-x: auto; }
.dnr-history-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.dnr-history-table thead th {
    text-align: left;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.42);
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
}
.dnr-history-table .dnr-num { text-align: center; }
.dnr-history-table td {
    padding: 9px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    font-size: 12px;
    color: rgba(255,255,255,0.78);
}
.dnr-tracking {
    font-family: var(--font-mono, monospace);
    font-size: 11px;
    color: rgba(255,255,255,0.72);
    background: rgba(255,255,255,0.03);
    padding: 2px 6px;
    border-radius: 4px;
}
.dnr-week-tag {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(255,255,255,0.04);
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    color: rgba(255,255,255,0.62);
}
.dnr-gap-cell-warn    { color: #fcd34d; font-weight: 700; font-variant-numeric: tabular-nums; }
.dnr-gap-cell-neutral { color: rgba(255,255,255,0.62); font-variant-numeric: tabular-nums; }
.dnr-gap-cell-info    { color: #93c5fd; font-variant-numeric: tabular-nums; }
.dnr-gap-cell-zero    { color: rgba(255,255,255,0.25); }

/* ==========================================================================
   DNR ENRICHMENT  — context row from daily reports cross-reference
   --------------------------------------------------------------------------
   When a concession's tracking_id appears in our daily_reports DNR data,
   the next <tr> shows the delivery context (postcode, scan, contact
   compliance, 25m+ flag, customer note). Visually pulled in slightly
   from the main row to read as "extra detail for this tracking".
   ========================================================================== */

/* Hint banner above the table */
.dnr-enrichment-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    margin-bottom: 8px;
    background: rgba(59,130,246,0.06);
    border: 1px solid rgba(59,130,246,0.22);
    border-radius: 8px;
    font-size: 11.5px;
    color: #93c5fd;
}
.dnr-enrichment-hint svg { color: #60a5fa; flex-shrink: 0; }
.dnr-enrichment-hint strong { color: #bfdbfe; font-weight: 800; }

/* Main row that has a follow-up enrichment row — soften its bottom
   border so the two visually pair up */
.dnr-history-row.has-enrichment td { border-bottom: none; }

/* The enrichment row itself */
.dnr-enrich-row td {
    padding: 0 10px 10px;       /* hugs the main row above */
    border-bottom: 1px solid rgba(255,255,255,0.04);
    background: transparent;
}
.dnr-enrich {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 0 6px 26px;    /* indent so it reads as a sub-line */
    border-left: 2px solid rgba(96,165,250,0.30);
    margin-left: 4px;
}
.dnr-enrich-postcode {
    font-weight: 800;
    color: #fff;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
    font-size: 12.5px;
    margin-right: 4px;
}
.dnr-enrich-pill {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: rgba(255,255,255,0.72);
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
}
.dnr-enrich-pill-ok {
    color: #86efac;
    background: rgba(34,197,94,0.10);
    border-color: rgba(34,197,94,0.28);
}
.dnr-enrich-pill-warn {
    color: #fcd34d;
    background: rgba(245,158,11,0.10);
    border-color: rgba(245,158,11,0.28);
}
.dnr-enrich-note {
    font-size: 11px;
    color: rgba(255,255,255,0.55);
    margin-left: 4px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dnr-enrich-note em {
    font-style: normal;
    color: rgba(255,255,255,0.78);
}

/* ==========================================================================
   DNR DRIVER BEHAVIOR PROFILE
   --------------------------------------------------------------------------
   Aggregated stats from this driver's appearances in daily report DNR
   tabs: where they typically leave packages, contact compliance rate,
   25m+ scan rate. Surfaces behavior even when tracking_id-to-tracking_id
   matching against concessions is sparse.
   ========================================================================== */

.dnr-profile {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 18px;
}
@media (max-width: 800px) {
    .dnr-profile { grid-template-columns: 1fr; }
}

.dnr-profile-label {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.42);
    font-weight: 700;
    margin-bottom: 8px;
}
.dnr-profile-chips {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.dnr-profile-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(124,58,237,0.06);
    border: 1px solid rgba(124,58,237,0.22);
    border-radius: 8px;
}
.dnr-profile-chip-label {
    flex: 1;
    color: #ddd6fe;
    font-weight: 600;
    font-size: 13px;
}
.dnr-profile-chip-count {
    font-size: 17px;
    font-weight: 800;
    color: #c4b5fd;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}
.dnr-profile-chip-pct {
    font-size: 11.5px;
    color: rgba(196,181,253,0.65);
    font-weight: 700;
    min-width: 36px;
    text-align: right;
}

.dnr-profile-flags {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 8px;
}
.dnr-profile-flag {
    padding: 12px 14px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
}
.dnr-profile-flag-low  { /* default neutral */ }
.dnr-profile-flag-warn {
    background: rgba(245,158,11,0.06);
    border-color: rgba(245,158,11,0.28);
}
.dnr-profile-flag-bad {
    background: rgba(239,68,68,0.06);
    border-color: rgba(239,68,68,0.30);
}
.dnr-profile-flag-n {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    line-height: 1;
}
.dnr-profile-flag-warn .dnr-profile-flag-n { color: #fcd34d; }
.dnr-profile-flag-bad  .dnr-profile-flag-n { color: #fca5a5; }
.dnr-profile-flag-l {
    margin-top: 5px;
    font-size: 12px;
    font-weight: 700;
    color: rgba(255,255,255,0.78);
}
.dnr-profile-flag-h {
    margin-top: 2px;
    font-size: 10.5px;
    color: rgba(255,255,255,0.42);
    font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   DNR COACHING LOG  (on dnr_driver.php)
   --------------------------------------------------------------------------
   Reuses the existing addCoachingNote / getCoachingNotes helpers from
   driver.php so notes added here also show up on the driver's profile.
   "Suggested note" button autofills the textarea with a pattern-derived
   sentence the user can tweak before saving.
   ========================================================================== */

.dnr-coach-form {
    margin-bottom: 16px;
    padding: 16px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
}
.dnr-coach-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.dnr-coach-kind {
    padding: 6px 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 6px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
}
.dnr-coach-suggest-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    background: rgba(124,58,237,0.10);
    border: 1px solid rgba(124,58,237,0.30);
    border-radius: 6px;
    color: #c4b5fd;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.12s ease;
}
.dnr-coach-suggest-btn:hover {
    background: rgba(124,58,237,0.18);
    border-color: rgba(124,58,237,0.50);
    color: #ddd6fe;
}
.dnr-coach-input {
    width: 100%;
    padding: 10px 12px;
    background: rgba(0,0,0,0.20);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 7px;
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
    min-height: 70px;
    box-sizing: border-box;
}
.dnr-coach-input:focus {
    outline: none;
    border-color: rgba(245,158,11,0.45);
    background: rgba(0,0,0,0.30);
}
.dnr-coach-input::placeholder {
    color: rgba(255,255,255,0.30);
}
.dnr-coach-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.dnr-coach-hint {
    font-size: 11px;
    color: rgba(255,255,255,0.40);
}
.dnr-coach-submit { white-space: nowrap; }

/* Coaching log entries */
.dnr-coach-log {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.dnr-coach-entry {
    padding: 12px 14px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    border-left-width: 3px;
}
.dnr-coach-kind-note     { border-left-color: rgba(255,255,255,0.20); }
.dnr-coach-kind-coaching { border-left-color: rgba(96,165,250,0.55); }
.dnr-coach-kind-warning  { border-left-color: rgba(245,158,11,0.65); }
.dnr-coach-kind-incident { border-left-color: rgba(239,68,68,0.70);  background: rgba(239,68,68,0.03); }
.dnr-coach-kind-praise   { border-left-color: rgba(34,197,94,0.55); }

.dnr-coach-entry-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    font-size: 11px;
}
.dnr-coach-entry-kind {
    padding: 1px 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.05);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 9.5px;
    color: rgba(255,255,255,0.78);
}
.dnr-coach-kind-coaching .dnr-coach-entry-kind { background: rgba(96,165,250,0.15); color: #93c5fd; }
.dnr-coach-kind-warning  .dnr-coach-entry-kind { background: rgba(245,158,11,0.15); color: #fcd34d; }
.dnr-coach-kind-incident .dnr-coach-entry-kind { background: rgba(239,68,68,0.18);  color: #fca5a5; }
.dnr-coach-kind-praise   .dnr-coach-entry-kind { background: rgba(34,197,94,0.15);  color: #86efac; }

.dnr-coach-entry-meta {
    flex: 1;
    color: rgba(255,255,255,0.42);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}
.dnr-coach-entry-del { margin: 0; }
.dnr-coach-entry-del button {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.30);
    padding: 4px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.12s ease;
    display: inline-flex;
    align-items: center;
}
.dnr-coach-entry-del button:hover {
    color: #fca5a5;
    background: rgba(239,68,68,0.08);
}
.dnr-coach-entry-body {
    font-size: 13px;
    color: rgba(255,255,255,0.85);
    line-height: 1.5;
    word-break: break-word;
}

.dnr-link-quiet {
    color: rgba(255,255,255,0.55);
    text-decoration: none;
    border-bottom: 1px dotted rgba(255,255,255,0.20);
}
.dnr-link-quiet:hover { color: #fbbf24; border-bottom-color: #fbbf24; }

/* ==========================================================================
   DNR DRIVER RATE  — concessions / deliveries
   --------------------------------------------------------------------------
   Header card gets a second total tile (rate %) alongside the raw count.
   Each sparkline bar gets a tiny rate badge beneath the week label.
   ========================================================================== */

.dnr-driver-totals {
    display: flex;
    gap: 18px;
    align-items: stretch;
    flex-wrap: wrap;
}
.dnr-driver-rate {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    padding: 8px 14px;
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 10px;
    min-width: 110px;
    cursor: help;
}
.dnr-driver-rate-good {
    background: rgba(34,197,94,0.06);
    border-color: rgba(34,197,94,0.30);
}
.dnr-driver-rate-warn {
    background: rgba(245,158,11,0.06);
    border-color: rgba(245,158,11,0.30);
}
.dnr-driver-rate-bad {
    background: rgba(239,68,68,0.08);
    border-color: rgba(239,68,68,0.34);
}
.dnr-driver-rate-n {
    font-size: 22px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    letter-spacing: -0.02em;
    color: #fff;
}
.dnr-driver-rate-good .dnr-driver-rate-n { color: #86efac; }
.dnr-driver-rate-warn .dnr-driver-rate-n { color: #fcd34d; }
.dnr-driver-rate-bad  .dnr-driver-rate-n { color: #fca5a5; }
.dnr-driver-rate-l {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255,255,255,0.55);
    margin-top: 3px;
}
.dnr-driver-rate-h {
    font-size: 10.5px;
    color: rgba(255,255,255,0.40);
    margin-top: 3px;
    font-variant-numeric: tabular-nums;
}

/* Per-week rate badge beneath sparkline bars */
.dnr-spark-rate {
    margin-top: 3px;
    font-size: 9.5px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    padding: 0 5px;
    border-radius: 4px;
    line-height: 1.4;
}
.dnr-spark-rate-good    { color: #86efac; background: rgba(34,197,94,0.08); }
.dnr-spark-rate-warn    { color: #fcd34d; background: rgba(245,158,11,0.10); }
.dnr-spark-rate-bad     { color: #fca5a5; background: rgba(239,68,68,0.12); }
.dnr-spark-rate-neutral { color: rgba(255,255,255,0.35); }

/* ==========================================================================
   DNR LEADERBOARD FILTER BAR
   --------------------------------------------------------------------------
   Sits above the driver table on dnr.php. Live search + depot pill
   toggle + visible-count tile. All client-side — no reload.
   ========================================================================== */

.dnr-filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 4px 12px;
    flex-wrap: wrap;
}

.dnr-filter-search {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 220px;
    max-width: 360px;
    padding: 0 10px;
    background: rgba(0,0,0,0.20);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 8px;
    transition: border-color 0.15s ease;
}
.dnr-filter-search:focus-within {
    border-color: rgba(245,158,11,0.45);
    background: rgba(0,0,0,0.30);
}
.dnr-filter-search svg { color: rgba(255,255,255,0.40); flex-shrink: 0; }
.dnr-filter-search input {
    flex: 1;
    border: none;
    background: transparent;
    color: #fff;
    font: inherit;
    font-size: 13px;
    padding: 9px 10px;
    outline: none;
}
.dnr-filter-search input::placeholder { color: rgba(255,255,255,0.30); }
.dnr-filter-clear {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.45);
    padding: 4px;
    cursor: pointer;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    transition: all 0.12s ease;
}
.dnr-filter-clear:hover { color: #fff; background: rgba(255,255,255,0.06); }

.dnr-filter-pills {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.dnr-filter-pill {
    padding: 6px 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 7px;
    color: rgba(255,255,255,0.62);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: all 0.12s ease;
    font-family: inherit;
}
.dnr-filter-pill:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
    border-color: rgba(255,255,255,0.18);
}
.dnr-filter-pill.is-active {
    background: linear-gradient(135deg, rgba(245,158,11,0.20), rgba(239,68,68,0.08));
    border-color: rgba(245,158,11,0.45);
    color: #fcd34d;
}

.dnr-filter-count {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    margin-left: auto;
    padding: 4px 10px;
    background: rgba(255,255,255,0.03);
    border-radius: 7px;
}
#dnrFilterCount {
    font-size: 16px;
    font-weight: 800;
    color: #fff;
    font-variant-numeric: tabular-nums;
}
.dnr-filter-count-label {
    font-size: 11px;
    color: rgba(255,255,255,0.50);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
}

/* ==========================================================================
   DNR — STREAK BADGES + WoW DELTA
   --------------------------------------------------------------------------
   Inline on the driver leaderboard. Streak badge sits next to the name.
   WoW delta chip sits next to the concession count.
   ========================================================================== */

.dnr-streak-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 8px;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
    vertical-align: middle;
    cursor: help;
}
.dnr-streak-short {  /* 2 weeks */
    color: #fcd34d;
    background: rgba(245,158,11,0.10);
    border: 1px solid rgba(245,158,11,0.30);
}
.dnr-streak-mid {    /* 3 weeks */
    color: #fb923c;
    background: rgba(249,115,22,0.14);
    border: 1px solid rgba(249,115,22,0.40);
}
.dnr-streak-long {   /* 4+ weeks */
    color: #fff;
    background: linear-gradient(135deg, #f97316, #dc2626);
    border: 1px solid transparent;
    box-shadow: 0 1px 6px rgba(220,38,38,0.30);
}

.dnr-count-cell {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
}
.dnr-wow {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    padding: 2px 6px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    cursor: help;
}
.dnr-wow-up {
    color: #fca5a5;
    background: rgba(239,68,68,0.10);
    border: 1px solid rgba(239,68,68,0.28);
}
.dnr-wow-up.big {       /* spike of 5+ — more visual weight */
    color: #fff;
    background: rgba(239,68,68,0.40);
    border-color: rgba(239,68,68,0.60);
}
.dnr-wow-down {
    color: #86efac;
    background: rgba(34,197,94,0.10);
    border: 1px solid rgba(34,197,94,0.28);
}
.dnr-wow-new {
    color: #c4b5fd;
    background: rgba(124,58,237,0.14);
    border: 1px solid rgba(124,58,237,0.34);
    padding: 2px 7px;
    font-size: 9.5px;
    letter-spacing: 0.06em;
}

/* ==========================================================================
   DNR NETWORK TREND  — 8-week bar chart at the top of dnr.php
   ========================================================================== */
.dnr-trend-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px 20px;
    margin-bottom: 18px;
}
.dnr-trend-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 14px;
    margin-bottom: 14px;
}
.dnr-trend-title {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    margin: 0;
    letter-spacing: -0.005em;
}
.dnr-trend-sub {
    display: block;
    font-size: 11.5px;
    color: rgba(255,255,255,0.45);
    margin-top: 2px;
    font-weight: 500;
}
.dnr-trend-summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.dnr-trend-summary-n {
    font-size: 26px;
    font-weight: 800;
    color: #fff;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    letter-spacing: -0.02em;
}
.dnr-trend-summary-l {
    font-size: 11.5px;
    color: rgba(255,255,255,0.45);
    font-weight: 600;
}
.dnr-trend-delta {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}
.dnr-trend-delta-up {
    color: #fca5a5;
    background: rgba(239,68,68,0.10);
    border: 1px solid rgba(239,68,68,0.30);
}
.dnr-trend-delta-down {
    color: #86efac;
    background: rgba(34,197,94,0.10);
    border: 1px solid rgba(34,197,94,0.30);
}

.dnr-trend-bars {
    display: flex;
    align-items: stretch;
    gap: 6px;
    height: 100px;
    padding-top: 18px;       /* leaves room for the value labels above the bars */
}
.dnr-trend-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 30px;
}
.dnr-trend-bar-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    position: relative;
}
.dnr-trend-bar {
    width: 100%;
    background: linear-gradient(to top, rgba(245,158,11,0.18), rgba(245,158,11,0.50));
    border-top: 2px solid rgba(245,158,11,0.85);
    border-radius: 3px 3px 0 0;
    min-height: 4px;
    transition: filter 0.15s ease;
    cursor: help;
}
.dnr-trend-bar-wrap:hover .dnr-trend-bar { filter: brightness(1.2); }
.dnr-trend-bar-n {
    position: absolute;
    top: -16px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 10.5px;
    font-weight: 800;
    color: rgba(255,255,255,0.72);
    font-variant-numeric: tabular-nums;
}
.dnr-trend-bar-label {
    margin-top: 6px;
    text-align: center;
    font-size: 10.5px;
    font-weight: 700;
    color: rgba(255,255,255,0.45);
    text-decoration: none;
    transition: color 0.12s ease;
    font-variant-numeric: tabular-nums;
}
.dnr-trend-bar-label:hover { color: #fbbf24; }

/* Current week's bar is highlighted */
.dnr-trend-col.is-current .dnr-trend-bar {
    background: linear-gradient(to top, rgba(239,68,68,0.25), rgba(239,68,68,0.65));
    border-top-color: #ef4444;
    box-shadow: 0 0 14px rgba(239,68,68,0.25);
}
.dnr-trend-col.is-current .dnr-trend-bar-n { color: #fff; }
.dnr-trend-col.is-current .dnr-trend-bar-label {
    color: #fcd34d;
    font-weight: 800;
}

/* ==========================================================================
   DNR POSTCODE PATTERNS  — per-driver and per-network surfaces
   ========================================================================== */

/* Per-driver page: stacked card list */
.dnr-postcodes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
}
.dnr-postcode {
    padding: 12px 14px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    border-left-width: 3px;
}
.dnr-postcode-low  { border-left-color: rgba(96,165,250,0.40); }
.dnr-postcode-warn { border-left-color: rgba(245,158,11,0.55); }
.dnr-postcode-bad  {
    border-left-color: #ef4444;
    background: rgba(239,68,68,0.04);
}
.dnr-postcode-code {
    font-family: var(--font-mono, monospace);
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.01em;
    margin-bottom: 4px;
}
.dnr-postcode-count {
    display: flex;
    align-items: baseline;
    gap: 5px;
}
.dnr-postcode-n {
    font-size: 18px;
    font-weight: 800;
    color: #fbbf24;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.dnr-postcode-l {
    font-size: 10.5px;
    color: rgba(255,255,255,0.42);
}
.dnr-postcode-bad .dnr-postcode-n  { color: #fca5a5; }
.dnr-postcode-warn .dnr-postcode-n { color: #fcd34d; }

/* Network page: horizontal scroll-friendly tile row */
.dnr-postcodes-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
}
.dnr-pc-tile {
    padding: 14px 16px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    text-align: center;
    border-left-width: 3px;
}
.dnr-pc-tile-low  { border-left-color: rgba(96,165,250,0.40); }
.dnr-pc-tile-warn { border-left-color: rgba(245,158,11,0.55); }
.dnr-pc-tile-bad  {
    border-left-color: #ef4444;
    background: rgba(239,68,68,0.04);
}
.dnr-pc-tile-code {
    font-family: var(--font-mono, monospace);
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.02em;
    margin-bottom: 4px;
}
.dnr-pc-tile-n {
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    color: #fbbf24;
}
.dnr-pc-tile-bad  .dnr-pc-tile-n { color: #fca5a5; }
.dnr-pc-tile-warn .dnr-pc-tile-n { color: #fcd34d; }
.dnr-pc-tile-l {
    margin-top: 5px;
    font-size: 10.5px;
    color: rgba(255,255,255,0.42);
}

/* ==========================================================================
   MOBILE POLISH  (<= 768px and <= 480px)
   --------------------------------------------------------------------------
   With the sidebar correctly hidden on mobile, content now uses the full
   viewport — but most page-level surfaces (KPI grids, page headers,
   week selectors, tables, charts) were tuned for desktop widths and
   need explicit mobile rules.
   ========================================================================== */

@media (max-width: 768px) {
    /* Page headers stack vertically — title + sub-line on one row,
       action buttons (export, share, etc.) below. */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        margin: 4px 0 18px;
    }
    .page-title { font-size: 22px; line-height: 1.2; }
    .page-sub   { font-size: 13px; }

    /* Welcome row on home — name + waving emoji fit on smaller fonts */
    .app-welcome h1 { font-size: 22px; }
    .app-welcome p  { font-size: 13px; }

    /* App cards lose some side padding — full-width content is more
       important than gutters on a 375px screen. */
    .app-card        { padding: 14px 12px; }
    .app-card-head   { flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
    .app-card-title  { font-size: 14px; }
    .app-card-sub    { font-size: 11.5px; }

    /* Topbar shrinks — depot badge collapses to icon-only when space
       gets tight; user trigger removes the username label. */
    .app-topbar              { padding: 8px 12px; gap: 8px; }
    .app-topbar-crumb        { display: none; }   /* burger + brand is context */
    .app-user-meta           { display: none; }
}

@media (max-width: 480px) {
    .page-title { font-size: 20px; }
    .app-card   { padding: 12px 10px; }

    /* Most flex/grid rows fall back to single-column at this width */
    .daily-kpi-row,
    .dnr-depots,
    .dnr-postcodes-row,
    .dnr-gap-grid,
    .dnr-profile-flags { grid-template-columns: 1fr 1fr; }
}

/* ==========================================================================
   MOBILE — DNR PAGES
   ========================================================================== */

@media (max-width: 768px) {
    /* DNR trend chart — bars get tighter and labels smaller so 8 weeks
       still fit on a 375px screen. */
    .dnr-trend-card  { padding: 14px 12px; }
    .dnr-trend-head  { flex-wrap: wrap; gap: 8px; }
    .dnr-trend-bars  { gap: 3px; height: 80px; padding-top: 16px; }
    .dnr-trend-col   { min-width: 0; }
    .dnr-trend-bar-n     { font-size: 9.5px; top: -14px; }
    .dnr-trend-bar-label { font-size: 9.5px; margin-top: 4px; }
    .dnr-trend-summary-n { font-size: 22px; }

    /* Week pill strip already scrolls horizontally — make pills tighter */
    .dnr-week-pill { padding: 7px 10px; font-size: 11.5px; }

    /* Week summary header stacks */
    .dnr-week-header { flex-direction: column; align-items: flex-start; gap: 6px; }
    .dnr-week-title  { font-size: 18px; }
    .dnr-week-total  { text-align: left; }

    /* Depot tiles use 2-up grid (was auto-fill 140px which only fits one
       comfortably at 375 — looks awkward). */
    .dnr-depots         { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .dnr-depot          { padding: 10px 12px; }
    .dnr-depot-count    { font-size: 22px; }

    /* Driver leaderboard — drop the depot column on very narrow screens,
       use the per-row depot chip(s) under the name instead via a small
       inline-block treatment. Keeps the count column visible. */
    .dnr-driver-table { table-layout: auto; }
    .dnr-driver-table th:nth-child(3),
    .dnr-driver-table td:nth-child(3) { display: none; }
    .dnr-driver-table th:nth-child(2),
    .dnr-driver-table td:nth-child(2) { min-width: 140px; }
    .dnr-driver-table th:nth-child(4),
    .dnr-driver-table td:nth-child(4) { width: 90px; }
    .dnr-driver-table th:nth-child(5),
    .dnr-driver-table td:nth-child(5) { width: 60px; }
    .dnr-row-view {
        padding: 4px 6px;
        font-size: 10.5px;
    }
    .dnr-row-view svg { display: none; }   /* arrow takes too much horizontal */

    /* Filter bar wraps */
    .dnr-filter-bar { gap: 8px; }
    .dnr-filter-search { min-width: 100%; max-width: 100%; }
    .dnr-filter-count { margin-left: 0; }

    /* Investigation page — header card, total tiles wrap */
    .dnr-driver-head-card { padding: 16px 14px; }
    .dnr-driver-name      { font-size: 22px; }
    .dnr-driver-totals    { width: 100%; }
    .dnr-driver-total,
    .dnr-driver-rate      { flex: 1; }
    .dnr-driver-total-n   { font-size: 28px; }
    .dnr-driver-rate-n    { font-size: 18px; }

    /* History table — tracking + dates can't all fit, hide depot col on
       narrow screens (the page is already scoped to one depot) */
    .dnr-history-table th:nth-child(2),
    .dnr-history-table td:nth-child(2) { display: none; }
    .dnr-tracking { font-size: 10px; }

    /* Coaching form — submit goes full width below */
    .dnr-coach-form  { padding: 12px 10px; }
    .dnr-coach-actions { flex-direction: column; align-items: stretch; }
    .dnr-coach-submit  { width: 100%; }
}

/* ==========================================================================
   MOBILE — DAILY REPORT PAGES
   ========================================================================== */

@media (max-width: 768px) {
    /* KPI tiles row → 2 columns instead of 4 */
    .daily-kpi-row    { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .daily-kpi        { padding: 12px; }
    .daily-kpi-value  { font-size: 24px; }

    /* Per-driver table loses the action column label & icon to save space */
    .daily-driver-table th:nth-child(7),
    .daily-driver-table td:nth-child(7) { width: 64px; }
    .daily-row-view svg { display: none; }
    .daily-row-view { font-size: 10.5px; padding: 4px 6px; }

    /* Day handout — narrower padding, smaller name */
    .dd-handout { padding: 18px 14px; }
    .dd-handout-title { font-size: 22px; }
    .dd-summary-counts { padding: 12px 14px; gap: 14px; }
    .dd-summary-total-value { font-size: 30px; }
    .dd-share-row { flex-wrap: wrap; }
    .dd-share-btn { flex: 1; min-width: 0; justify-content: center; }
}

@media (max-width: 480px) {
    .daily-kpi-row { grid-template-columns: 1fr 1fr; }
    .daily-kpi-value { font-size: 22px; }

    /* Daily driver table — shrink metric columns further */
    .daily-driver-table th:nth-child(2),
    .daily-driver-table th:nth-child(3),
    .daily-driver-table th:nth-child(4),
    .daily-driver-table th:nth-child(5),
    .daily-driver-table td:nth-child(2),
    .daily-driver-table td:nth-child(3),
    .daily-driver-table td:nth-child(4),
    .daily-driver-table td:nth-child(5) { width: 52px; }
}

/* ==========================================================================
   MOBILE — UPLOAD ZONES
   ========================================================================== */

@media (max-width: 768px) {
    .dnr-drop      { padding: 20px 14px; }
    .dnr-drop-text { font-size: 13px; text-align: center; }

    .dnr-uploader-actions { flex-direction: column-reverse; gap: 8px; }
    .dnr-uploader-actions .btn { width: 100%; justify-content: center; }
}

/* ==========================================================================
   MOBILE — HOME / SCORECARD PAGES
   ========================================================================== */

@media (max-width: 768px) {
    /* Top KPI / hero cards — already had some mobile rules, but make sure
       everything wraps cleanly and chart cards don't blow out horizontally */
    .kpi-card  { padding: 14px 14px; }
}

/* Smooth horizontal scroll for any wide table that we DIDN'T explicitly
   adapt — keeps the user from getting a stuck layout. */
@media (max-width: 768px) {
    .daily-driver-table-wrap,
    .daily-detail-table-wrap,
    .dnr-driver-table-wrap,
    .dnr-history-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ==========================================================================
   DNR DRIVER LEADERBOARD — CARD GRID
   --------------------------------------------------------------------------
   Compact card-based replacement for the long single-column table. With
   100+ drivers the table was a vertical wall; the grid surfaces 3-4 cards
   per row on desktop, 2 on laptop, 1 on mobile.
   Each card stays interactive: whole-card click navigates to the
   investigation page when a driver_id exists.
   ========================================================================== */

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

.dnr-driver-card {
    display: block;            /* anchors render as blocks for layout */
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-left-width: 3px;
    border-radius: 8px;
    padding: 10px 12px;
    color: inherit;
    text-decoration: none;
    transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}
/* When the filter JS sets [hidden], it needs to win against the
   class-based display rules above (and against the .is-list-mode
   display:flex). The UA stylesheet's '[hidden]{display:none}' has
   element specificity and loses to a class. Force it. */
.dnr-driver-card[hidden] { display: none !important; }
a.dnr-driver-card { cursor: pointer; }
a.dnr-driver-card:hover {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.12);
    transform: translateY(-1px);
}

/* Severity tints inherit the same left-accent the table rows used */
.dnr-driver-card.dnr-row-low  { border-left-color: rgba(96,165,250,0.45); }
.dnr-driver-card.dnr-row-warn { border-left-color: rgba(245,158,11,0.65); }
.dnr-driver-card.dnr-row-bad  {
    border-left-color: #ef4444;
    background: rgba(239,68,68,0.04);
}
a.dnr-driver-card.dnr-row-bad:hover { background: rgba(239,68,68,0.07); }

.dnr-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.dnr-card-ident {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;       /* lets the name truncate inside the flex item */
    flex: 1;
}
.dnr-card-ident .dnr-rank {
    font-size: 12px;
    font-weight: 700;
    color: rgba(255,255,255,0.40);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}
.dnr-card-ident .dnr-rank::before { content: '#'; opacity: 0.6; }
.dnr-card-name {
    font-size: 13.5px;
    font-weight: 700;
    color: #fff;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
    flex: 1;
}
.dnr-card-count {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
/* Reuse existing .dnr-count and .dnr-wow chip styles already defined */

.dnr-card-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.dnr-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    min-width: 0;
    flex: 1;
}
.dnr-card-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.30);
    flex-shrink: 0;
    transition: color 0.12s ease, transform 0.12s ease;
}
a.dnr-driver-card:hover .dnr-card-chevron {
    color: #fbbf24;
    transform: translateX(2px);
}

/* The streak badge sits inline with the depot chips on the bottom row;
   remove the old margin-left it carried when it was inline with the
   name in the table layout. */
.dnr-card-meta .dnr-streak-badge { margin-left: 0; }

/* Mobile — single column, slightly tighter padding */
@media (max-width: 768px) {
    .dnr-driver-grid { grid-template-columns: 1fr; gap: 6px; }
    .dnr-driver-card { padding: 10px 11px; }
    .dnr-card-name   { font-size: 13px; }
}

/* ==========================================================================
   DNR LEADERBOARD TOOLBAR — view toggle + export buttons
   ========================================================================== */
.app-card-head { gap: 12px; }
.app-card-head-text { flex: 1; min-width: 0; }

.dnr-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Segmented view-mode toggle */
.dnr-view-toggle {
    display: inline-flex;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 7px;
    overflow: hidden;
    background: rgba(255,255,255,0.02);
}
.dnr-view-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.55);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}
.dnr-view-btn:hover    { color: rgba(255,255,255,0.85); background: rgba(255,255,255,0.03); }
.dnr-view-btn.is-active {
    color: #fbbf24;
    background: rgba(251,191,36,0.10);
    cursor: default;
}
.dnr-view-btn + .dnr-view-btn { border-left: 1px solid rgba(255,255,255,0.08); }

/* Export buttons */
.dnr-export-group { display: inline-flex; gap: 6px; }
.dnr-export-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 7px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.02);
    color: rgba(255,255,255,0.72);
    font-size: 11.5px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}
.dnr-export-btn:hover {
    background: rgba(255,255,255,0.05);
    color: #fff;
    border-color: rgba(255,255,255,0.15);
    transform: translateY(-1px);
}
.dnr-export-btn-primary {
    background: linear-gradient(135deg, rgba(245,158,11,0.18), rgba(245,158,11,0.10));
    border-color: rgba(245,158,11,0.40);
    color: #fcd34d;
}
.dnr-export-btn-primary:hover {
    background: linear-gradient(135deg, rgba(245,158,11,0.28), rgba(245,158,11,0.16));
    color: #fde68a;
    border-color: rgba(245,158,11,0.60);
}

/* ==========================================================================
   DNR LEADERBOARD — LIST VIEW MODE
   --------------------------------------------------------------------------
   A denser single-column rendering of the same cards. Same DOM, just a
   different layout via the .is-list-mode modifier on .dnr-driver-grid.
   The card collapses into a single horizontal row (rank, name, depots,
   streak, count, WoW, chevron) — closer to the old table but with the
   card's nicer hit area and severity tint preserved.

   Layout trick: the card's two inner divs (.dnr-card-top + .dnr-card-bottom)
   are set to display:contents so their CHILDREN bubble up into the card's
   own flex container — meaning all the leaf elements (ident, meta, count,
   chevron) sit on the same horizontal line without restructuring the DOM.
   ========================================================================== */
.dnr-driver-grid.is-list-mode {
    grid-template-columns: 1fr;
    gap: 4px;
}
.dnr-driver-grid.is-list-mode .dnr-driver-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 7px 12px;
}
.dnr-driver-grid.is-list-mode .dnr-card-top,
.dnr-driver-grid.is-list-mode .dnr-card-bottom {
    display: contents;        /* flatten — children flow into the card flex */
}
.dnr-driver-grid.is-list-mode .dnr-card-ident {
    flex: 1;
    min-width: 0;
}
.dnr-driver-grid.is-list-mode .dnr-card-meta,
.dnr-driver-grid.is-list-mode .dnr-card-count {
    flex-shrink: 0;
}
.dnr-driver-grid.is-list-mode .dnr-card-name { font-size: 13px; }

/* On mobile the list mode falls back to the standard grid-mode card
   layout — at 1-column anyway, the stacked rows read better than a
   cramped single line. */
@media (max-width: 768px) {
    .dnr-driver-grid.is-list-mode .dnr-driver-card {
        display: block;
        padding: 10px 11px;
    }
    .dnr-driver-grid.is-list-mode .dnr-card-top,
    .dnr-driver-grid.is-list-mode .dnr-card-bottom {
        display: flex;
    }
    .dnr-driver-grid.is-list-mode .dnr-card-top { margin-bottom: 8px; }
}


/* ==========================================================================
   DNR LEADERBOARD — LEGEND + COUNT LABEL
   --------------------------------------------------------------------------
   Drivers see this page screenshotted / printed at the depot. Without
   context they can't tell what "11" or "↑3" means. The legend strip
   above the grid and the "DNRs" label on each card carry the meaning
   wherever the image goes.
   ========================================================================== */

.dnr-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    padding: 9px 14px;
    margin-bottom: 10px;
    border-radius: 7px;
    background: rgba(255,255,255,0.025);
    border: 1px solid rgba(255,255,255,0.05);
    font-size: 11.5px;
    color: rgba(255,255,255,0.65);
}
.dnr-legend-label {
    font-size: 10px;
    font-weight: 700;
    color: rgba(255,255,255,0.40);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.dnr-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
/* Sample chips inside the legend are non-interactive — strip hover/tooltip
   affordances so they read as illustrations. */
.dnr-legend-sample {
    cursor: default;
    pointer-events: none;
}

/* Inline label under the count number on each card. Tiny, all-caps,
   neutral colour — adds context without competing with the big number. */
.dnr-count-stack {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
}
.dnr-count-label {
    font-size: 9px;
    font-weight: 700;
    color: rgba(255,255,255,0.40);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 2px;
}

/* In list mode the count + label sit horizontally with the rest of the
   meta row — stack still vertical, just less vertical space available. */
.dnr-driver-grid.is-list-mode .dnr-count-label { font-size: 8.5px; }

/* Mobile — legend wraps naturally; reduce horizontal padding */
@media (max-width: 768px) {
    .dnr-legend       { gap: 10px; padding: 8px 11px; font-size: 11px; }
    .dnr-legend-label { display: none; }   /* save horizontal space */
}

/* ==========================================================================
   DNR — WEEK HERO + CALLOUTS + DEPOT SPARKLINES
   --------------------------------------------------------------------------
   Turns the plain "Week N · 2026 [254]" header into a dashboard-style
   hero card: title block + total + WoW chip on top, three at-a-glance
   callouts (top offender, biggest spike, chronic streaks) below.
   The depot tiles get inline sparklines so each one tells a trend
   story instead of just "151 this week".
   ========================================================================== */

.dnr-week-hero {
    padding: 18px 20px;
    margin-bottom: 14px;
    background: linear-gradient(135deg, rgba(245,158,11,0.04) 0%, rgba(239,68,68,0.04) 100%);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
}
.dnr-week-hero-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}
.dnr-week-hero-title .dnr-week-title {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.01em;
    margin: 0;
}
.dnr-week-hero-title .dnr-week-range {
    margin-top: 3px;
    font-size: 12px;
    color: rgba(255,255,255,0.50);
    font-weight: 500;
}

.dnr-week-hero-total {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1;
}
.dnr-week-hero-total-n {
    font-size: 38px;
    font-weight: 800;
    color: #fbbf24;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.025em;
    line-height: 1;
}
.dnr-week-hero-total-l {
    margin-top: 4px;
    font-size: 11.5px;
    color: rgba(255,255,255,0.50);
    font-weight: 600;
}
.dnr-week-hero-wow {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-top: 7px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    cursor: help;
}
.dnr-week-hero-wow-up   { background: rgba(239,68,68,0.12); color: #fca5a5; border: 1px solid rgba(239,68,68,0.32); }
.dnr-week-hero-wow-down { background: rgba(34,197,94,0.12); color: #86efac; border: 1px solid rgba(34,197,94,0.32); }

/* === Callouts row inside the hero === */
.dnr-week-hero-callouts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.dnr-callout {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 11px 13px;
    border-radius: 9px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-left-width: 3px;
    color: inherit;
    text-decoration: none;
    transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}
a.dnr-callout { cursor: pointer; }
a.dnr-callout:hover {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.14);
    transform: translateY(-1px);
}
.dnr-callout-bad  { border-left-color: #ef4444; background: rgba(239,68,68,0.05); }
.dnr-callout-warn { border-left-color: #f59e0b; background: rgba(245,158,11,0.05); }
.dnr-callout-info { border-left-color: #60a5fa; background: rgba(59,130,246,0.05); }
.dnr-callout-icon {
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 1px;
}
.dnr-callout-body { flex: 1; min-width: 0; }
.dnr-callout-label {
    font-size: 9.5px;
    font-weight: 700;
    color: rgba(255,255,255,0.42);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 2px;
}
.dnr-callout-value {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dnr-callout-meta {
    margin-top: 3px;
    font-size: 11px;
    color: rgba(255,255,255,0.55);
    font-weight: 500;
}
.dnr-callout-meta strong {
    color: #fbbf24;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

/* === Depot sparklines === */
.dnr-depot { position: relative; overflow: hidden; }   /* sparkline clips to card */
.dnr-depot-spark {
    display: block;
    width: 100%;
    height: 22px;
    margin-top: 8px;
    overflow: visible;
}
.dnr-depot-spark-line {
    fill: none;
    stroke: rgba(255,255,255,0.55);
    stroke-width: 1.4;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}
.dnr-depot-spark-area {
    fill: rgba(255,255,255,0.06);
    stroke: none;
}
.dnr-depot-spark-dot {
    fill: rgba(255,255,255,0.85);
}
/* Severity-tinted sparklines match the depot's tone */
.dnr-depot-bad  .dnr-depot-spark-line { stroke: #fca5a5; }
.dnr-depot-bad  .dnr-depot-spark-area { fill: rgba(239,68,68,0.14); }
.dnr-depot-bad  .dnr-depot-spark-dot  { fill: #fca5a5; }
.dnr-depot-warn .dnr-depot-spark-line { stroke: #fcd34d; }
.dnr-depot-warn .dnr-depot-spark-area { fill: rgba(245,158,11,0.12); }
.dnr-depot-warn .dnr-depot-spark-dot  { fill: #fcd34d; }
.dnr-depot-low  .dnr-depot-spark-line { stroke: #93c5fd; }
.dnr-depot-low  .dnr-depot-spark-area { fill: rgba(96,165,250,0.10); }
.dnr-depot-low  .dnr-depot-spark-dot  { fill: #93c5fd; }
.dnr-depot-zero .dnr-depot-spark-line { stroke: rgba(255,255,255,0.30); }
.dnr-depot-zero .dnr-depot-spark-area { fill: rgba(255,255,255,0.04); }

/* Mobile polish for the hero */
@media (max-width: 768px) {
    .dnr-week-hero          { padding: 14px 14px; }
    .dnr-week-hero-top      { flex-direction: column; align-items: flex-start; gap: 10px; }
    .dnr-week-hero-total    { align-items: flex-start; text-align: left; }
    .dnr-week-hero-total-n  { font-size: 32px; }
    .dnr-week-hero-callouts { grid-template-columns: 1fr; gap: 8px; padding-top: 12px; margin-top: 12px; }
    .dnr-callout-value      { font-size: 13px; }
}

/* ==========================================================================
   DNR — COLLAPSIBLE UPLOAD CARD
   --------------------------------------------------------------------------
   The upload drop-zone is dormant 99% of the time. Now a <details> block
   that collapses to just its header when there's already data on the
   page; opens to reveal the full drop-zone when the user clicks the
   summary row.
   ========================================================================== */

details.dnr-upload-card { padding: 0; overflow: hidden; }
.dnr-upload-summary {
    list-style: none;
    cursor: pointer;
    padding: 14px 18px;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    transition: background 0.12s ease;
}
.dnr-upload-summary::-webkit-details-marker { display: none; }
.dnr-upload-summary:hover { background: rgba(255,255,255,0.02); }
.dnr-upload-summary-text { flex: 1; min-width: 0; }
.dnr-upload-summary .app-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
}
.dnr-upload-summary-icon {
    color: rgba(245,158,11,0.85);
    flex-shrink: 0;
}
.dnr-upload-chevron {
    color: rgba(255,255,255,0.40);
    transition: transform 0.18s ease, color 0.12s ease;
    flex-shrink: 0;
}
details.dnr-upload-card[open] .dnr-upload-chevron {
    transform: rotate(180deg);
    color: #fbbf24;
}

/* The form sits below the summary when open. Re-add the padding the
   surrounding app-card normally provides (since we set padding:0 above). */
details.dnr-upload-card[open] .dnr-uploader {
    padding: 0 18px 18px 18px;
}

/* ==========================================================================
   DNR — OLDER WEEKS BAR
   --------------------------------------------------------------------------
   Renders ONLY when there are weeks beyond the trend chart's 8-week
   window. Subtle pill row, horizontal scroll if many. Avoids competing
   with the trend chart for "primary week selector" status.
   ========================================================================== */

.dnr-week-older {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    margin-bottom: 12px;
    background: rgba(255,255,255,0.015);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 8px;
}
.dnr-week-older-label {
    font-size: 10px;
    font-weight: 700;
    color: rgba(255,255,255,0.40);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    flex-shrink: 0;
    padding-left: 4px;
}
.dnr-week-older-scroll {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2px;
    flex: 1;
    scrollbar-width: thin;
}
.dnr-week-older-scroll::-webkit-scrollbar { height: 4px; }
.dnr-week-older-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.10); border-radius: 2px; }

.dnr-week-chip {
    display: inline-flex;
    align-items: baseline;
    gap: 3px;
    padding: 5px 10px;
    border-radius: 6px;
    background: transparent;
    color: rgba(255,255,255,0.55);
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    font-variant-numeric: tabular-nums;
    transition: background 0.12s ease, color 0.12s ease;
    flex-shrink: 0;
}
.dnr-week-chip:hover {
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.85);
}
.dnr-week-chip.is-active {
    background: rgba(245,158,11,0.12);
    color: #fbbf24;
    border: 1px solid rgba(245,158,11,0.30);
    padding: 4px 9px;       /* compensate for the border */
}
.dnr-week-chip-year {
    font-size: 9.5px;
    color: rgba(255,255,255,0.30);
    font-weight: 600;
}
.dnr-week-chip:hover .dnr-week-chip-year  { color: rgba(255,255,255,0.55); }
.dnr-week-chip.is-active .dnr-week-chip-year { color: rgba(252,211,77,0.65); }

@media (max-width: 768px) {
    .dnr-week-older-label { display: none; }   /* save horizontal room */
}

/* ==========================================================================
   HOME DASHBOARD — INTERACTIVITY UPGRADES
   --------------------------------------------------------------------------
   Adds hover/click affordances to the surfaces that were static SVG + flat
   div rows. Goal: every visible data point feels alive — hover hints at
   what it is, click takes you to the detail.
   ========================================================================== */

/* === Trend chart — interactive dots ====================================== */

/* The transparent <a> wrapper needs an explicit cursor; SVG anchors don't
   pick up :link styles from the document automatically. */
.trend-chart a.trend-dot-link { cursor: pointer; }

/* The visible dot grows + glows on hover. The <circle.trend-dot-hit> is
   an invisible larger hit-target sitting on top — easier to mouse onto a
   5px dot when the actual circle picks up hover from an 11px radius. */
.trend-chart .trend-dot-hit {
    fill: transparent;
    pointer-events: all;
}
.trend-chart .trend-dot {
    fill: #fbbf24;
    stroke: #fff;
    stroke-width: 2;
    transition: r 0.15s ease, filter 0.15s ease;
}
.trend-chart a.trend-dot-link:hover .trend-dot {
    r: 6.5;
    filter: drop-shadow(0 0 8px rgba(251,191,36,0.65));
}
.trend-chart .trend-dot.is-latest {
    fill: #fff;
    stroke: #fbbf24;
    stroke-width: 2.5;
}

/* Soft pulsing ring behind the latest dot — "you are here" indicator */
.trend-chart .trend-dot-pulse {
    fill: rgba(251,191,36,0.40);
    transform-box: fill-box;
    transform-origin: center;
    animation: trend-pulse 2s ease-out infinite;
    pointer-events: none;
}
@keyframes trend-pulse {
    0%   { r: 4.5;  opacity: 0.6; }
    70%  { r: 13;   opacity: 0;   }
    100% { r: 13;   opacity: 0;   }
}

/* === Clickable list rows ================================================ */

/* Renders both <a class="app-row app-row-clickable"> (whole-row link)
   and the legacy <div class="app-row"> with an inline anchor.
   The whole-row version is the new default — bigger hit area, easier
   on touch. Tells the user it's interactive via cursor + hover lift. */
.app-row.app-row-clickable {
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: background 0.14s ease, transform 0.14s ease, border-color 0.14s ease;
    border-radius: 8px;
    margin: 0 -8px;       /* extend hover bg slightly past the card padding */
    padding-left: 8px;
    padding-right: 8px;
    position: relative;
}
.app-row.app-row-clickable:hover {
    background: rgba(251,191,36,0.06);
    transform: translateX(2px);
}
.app-row.app-row-clickable:hover .app-row-name {
    color: #fbbf24;
}
.app-row.app-row-clickable:hover .app-row-score-pill {
    transform: scale(1.04);
}
/* Reveal a subtle '→' on hover at the right edge — quick affordance
   that the row navigates */
.app-row.app-row-clickable::after {
    content: '→';
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%) translateX(-6px);
    color: rgba(251,191,36,0.0);
    font-weight: 700;
    transition: color 0.14s ease, transform 0.14s ease;
    pointer-events: none;
}
.app-row.app-row-clickable:hover::after {
    color: rgba(251,191,36,0.85);
    transform: translateY(-50%) translateX(0);
}
.app-row.app-row-clickable .app-row-score-pill {
    transition: transform 0.14s ease;
}

/* Subtle card hover lift across the dashboard surfaces — gives the
   whole page a "this is alive" feel without going overboard. */
.app-card { transition: border-color 0.18s ease; }
.app-card:hover { border-color: rgba(255,255,255,0.10); }

/* ==========================================================================
   HOME DASHBOARD — TREND RANGE TOGGLE + ROW SPARKLINES
   ========================================================================== */

/* Trend chart header controls (range pills + view-history link) sit
   on the right of the card header in a small flex group. */
.trend-controls {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}
.trend-range {
    display: inline-flex;
    background: rgba(255,255,255,0.025);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 6px;
    padding: 2px;
}
.trend-range-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    padding: 3px 9px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    color: rgba(255,255,255,0.50);
    text-decoration: none;
    transition: background 0.12s ease, color 0.12s ease;
    font-variant-numeric: tabular-nums;
}
.trend-range-btn:hover {
    color: rgba(255,255,255,0.85);
    background: rgba(255,255,255,0.04);
}
.trend-range-btn.is-active {
    color: #fbbf24;
    background: rgba(251,191,36,0.14);
}

/* Inline row sparkline (used on Top Performers rows). 60×20 viewBox,
   no axis, no labels — pure shape. Stretches to whatever flex width
   the row gives it (capped via CSS below). */
.row-spark {
    width: 64px;
    height: 18px;
    flex-shrink: 0;
    margin-right: 10px;
    opacity: 0.85;
    transition: opacity 0.12s ease;
}
.app-row-clickable:hover .row-spark { opacity: 1; }
.row-spark-line {
    fill: none;
    stroke: rgba(251,191,36,0.85);
    stroke-width: 1.4;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}
.row-spark-dot { fill: #fbbf24; }

/* Make movers rows whole-row clickable (parity with top performers).
   Lighter hover than the app-row equivalent — movers are denser so
   the bg tint stays subtle. */
.movers-row { transition: background 0.14s ease, transform 0.14s ease; border-radius: 8px; }
.movers-row.movers-row-clickable {
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
}
.movers-row.movers-row-clickable:hover {
    background: rgba(251,191,36,0.05);
    transform: translateX(2px);
}
.movers-row.movers-row-clickable:hover .movers-row-name { color: #fbbf24; }

/* ==========================================================================
   HIGH-RESOLUTION POLISH
   --------------------------------------------------------------------------
   On wide displays (the user's setup looks like 1920+) the cards and
   text felt thin. Scale up the visual weight at >=1440px so the
   dashboard fills the screen with substance instead of pale slivers.
   ========================================================================== */

@media (min-width: 1440px) {
    /* Slightly larger card padding + breathing room */
    .app-card        { padding: 22px 24px; }
    .app-card-header { margin-bottom: 14px; }
    .app-card-title  { font-size: 13.5px; }

    /* Row text gets a touch more substance */
    .app-row-name    { font-size: 14.5px; }
    .app-row-meta    { font-size: 12px; }

    /* Pills are slightly more substantial */
    .tier-pill,
    .app-row-score-pill { font-size: 12.5px; padding: 3px 11px; }
    .movers-delta    { font-size: 13.5px; }

    /* Sparkline a bit wider so the shape reads at a glance */
    .row-spark { width: 80px; height: 20px; }

    /* Trend chart aspect — give it a bit more height to fill the card */
    .trend-chart { aspect-ratio: 700 / 240; }
    .trend-week  { font-size: 11.5px; }
    .trend-label { font-size: 11px; }
}

@media (min-width: 1920px) {
    /* True wide-screen — give the layout more grid presence */
    .app-card        { padding: 26px 28px; border-radius: 14px; }
    .app-card-title  { font-size: 14.5px; }
    .app-row-name    { font-size: 15.5px; }
    .app-row-meta    { font-size: 12.5px; }
    .app-row-avatar  { width: 38px; height: 38px; font-size: 13px; }
    .app-row-rank    { font-size: 13.5px; min-width: 32px; }

    /* Score pills get more weight */
    .tier-pill,
    .app-row-score-pill { font-size: 13.5px; padding: 4px 13px; }

    /* Sparkline wider still */
    .row-spark { width: 96px; height: 22px; }

    /* Quick action tiles at the bottom benefit from more padding */
    .qa-tile { padding: 16px 20px; font-size: 14px; }
}

/* Sharper text rendering at any DPR — helps Retina + 4K displays */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* ==========================================================================
   LIVE WEEK-TO-DATE SCORECARD
   --------------------------------------------------------------------------
   Visual goal: looks like an Amazon scorecard but with running totals
   and a status badge so drivers see at a glance whether they're clean,
   on track, or heading into trouble. Designed to project on a TV.
   ========================================================================== */

/* === Hero card =========================================================== */

.live-hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 14px;
    padding: 22px 24px;
    margin-bottom: 16px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 20px;
    align-items: center;
}
.live-hero-main {
    display: flex;
    align-items: center;
    gap: 18px;
}
.live-hero-week {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 86px;
    height: 86px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #1e293b;
    font-weight: 800;
    flex-shrink: 0;
    box-shadow: 0 6px 18px rgba(245,158,11,0.18);
}
.live-hero-week-num { font-size: 26px; line-height: 1; }
.live-hero-week-year { font-size: 11px; margin-top: 4px; opacity: 0.78; letter-spacing: 0.04em; }

.live-hero-stack { display: flex; flex-direction: column; gap: 10px; }
.live-hero-title {
    font-size: 18px;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: -0.01em;
}
.live-hero-coverage { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.live-day-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 9px;
    border-radius: 5px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    background: transparent;
    color: rgba(255,255,255,0.30);
    border: 1px dashed rgba(255,255,255,0.10);
}
.live-day-chip.is-on {
    background: rgba(34,197,94,0.12);
    color: #22c55e;
    border: 1px solid rgba(34,197,94,0.30);
    border-style: solid;
}
.live-day-count { color: rgba(255,255,255,0.45); font-size: 11px; margin-left: 8px; }

.live-hero-kpis { display: flex; gap: 18px; }
.live-kpi {
    text-align: center;
    min-width: 76px;
    padding: 6px 4px;
}
.live-kpi-num {
    font-size: 28px;
    font-weight: 800;
    color: #f8fafc;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.live-kpi-lbl {
    font-size: 10.5px;
    color: rgba(255,255,255,0.50);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 6px;
}
.live-kpi-good .live-kpi-num { color: #22c55e; }
.live-kpi-bad  .live-kpi-num { color: #ef4444; }

/* === Week picker ======================================================== */

.live-week-picker {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.live-week-picker-label {
    font-size: 11px;
    color: rgba(255,255,255,0.40);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-right: 4px;
}
.live-week-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border-radius: 6px;
    background: rgba(255,255,255,0.025);
    border: 1px solid rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 11.5px;
    font-weight: 700;
    transition: background 0.12s ease, color 0.12s ease;
}
.live-week-chip:hover { background: rgba(255,255,255,0.05); color: #f8fafc; }
.live-week-chip.is-on {
    background: rgba(251,191,36,0.14);
    border-color: rgba(251,191,36,0.30);
    color: #fbbf24;
}
.live-week-chip-days {
    font-size: 9.5px;
    opacity: 0.55;
    font-weight: 600;
}

/* === KPI breakdown strip =============================================== */

.live-breakdown {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}
.live-bd-tile {
    background: rgba(255,255,255,0.025);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    padding: 14px 16px;
}
.live-bd-label {
    font-size: 10.5px;
    color: rgba(255,255,255,0.50);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.live-bd-num {
    font-size: 30px;
    font-weight: 800;
    color: #f8fafc;
    margin: 4px 0;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.live-bd-hint {
    font-size: 11px;
    color: rgba(255,255,255,0.35);
}

/* === Leaderboard ======================================================= */

.live-board {
    overflow: hidden;
}
.live-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 4px 0 14px;
    padding: 8px 10px;
    background: rgba(255,255,255,0.02);
    border-radius: 8px;
}
.live-legend-chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 5px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.live-legend-chip.is-clean        { background: rgba(34,197,94,0.14);  color: #22c55e; }
.live-legend-chip.is-on_track     { background: rgba(59,130,246,0.14); color: #60a5fa; }
.live-legend-chip.is-watch        { background: rgba(251,191,36,0.14); color: #fbbf24; }
.live-legend-chip.is-concern      { background: rgba(249,115,22,0.14); color: #fb923c; }
.live-legend-chip.is-intervention { background: rgba(239,68,68,0.14);  color: #f87171; }

.live-board-scroll {
    overflow-x: auto;
    margin: 0 -8px;
    padding: 0 8px;
}
.live-board-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.live-board-table thead th {
    text-align: left;
    padding: 9px 10px;
    font-size: 10.5px;
    color: rgba(255,255,255,0.45);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    white-space: nowrap;
}
.live-th-num    { text-align: right; }
.live-th-total  { color: rgba(251,191,36,0.65); }
.live-th-rank   { width: 50px; }
.live-th-status { width: 130px; }

.live-board-table tbody tr {
    border-bottom: 1px solid rgba(255,255,255,0.03);
    transition: background 0.12s ease;
}
.live-board-table tbody tr:hover { background: rgba(255,255,255,0.025); }

.live-board-table td {
    padding: 11px 10px;
    color: rgba(255,255,255,0.78);
    font-variant-numeric: tabular-nums;
}
.live-td-num { text-align: right; }
.live-td-num.has-value { color: #f8fafc; font-weight: 600; }
.live-td-total { color: #fbbf24; font-size: 14px; font-weight: 800; }

.live-td-rank { text-align: center; }
.live-rank-plain {
    display: inline-block;
    width: 26px; height: 26px;
    line-height: 26px;
    text-align: center;
    font-weight: 700;
    color: rgba(255,255,255,0.55);
    font-size: 12px;
}
.live-medal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    border-radius: 50%;
    font-weight: 800;
    font-size: 12px;
    color: #1e293b;
}
.live-medal-1 { background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%); box-shadow: 0 2px 8px rgba(251,191,36,0.40); }
.live-medal-2 { background: linear-gradient(135deg, #e5e7eb 0%, #9ca3af 100%); }
.live-medal-3 { background: linear-gradient(135deg, #f59e42 0%, #b45309 100%); color: #fff; }

.live-driver-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.live-driver-link:hover .live-driver-name { color: #fbbf24; }
.live-driver-name {
    color: #f8fafc;
    font-weight: 600;
    transition: color 0.12s ease;
}
.live-driver-tid {
    font-size: 10.5px;
    color: rgba(255,255,255,0.35);
    font-variant-numeric: tabular-nums;
}

/* Row tinting based on status — subtle background hint of where the
   driver sits. Stronger on the right edge via the pill, lighter on
   the whole row so the table stays readable. */
.live-row-clean        { /* no tint, default */ }
.live-row-on_track     { /* no tint */ }
.live-row-watch        { background: rgba(251,191,36,0.025); }
.live-row-concern      { background: rgba(249,115,22,0.035); }
.live-row-intervention { background: rgba(239,68,68,0.05); }

.live-status-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 5px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.live-status-clean        { background: rgba(34,197,94,0.16);  color: #22c55e; }
.live-status-on_track     { background: rgba(59,130,246,0.16); color: #60a5fa; }
.live-status-watch        { background: rgba(251,191,36,0.16); color: #fbbf24; }
.live-status-concern      { background: rgba(249,115,22,0.16); color: #fb923c; }
.live-status-intervention { background: rgba(239,68,68,0.18);  color: #fca5a5; font-weight: 800; }

.live-footnote {
    margin-top: 14px;
    font-size: 11.5px;
    color: rgba(255,255,255,0.40);
    line-height: 1.55;
}
.live-footnote em { font-style: italic; color: rgba(255,255,255,0.55); }

/* === Mobile / narrow viewports ========================================= */

@media (max-width: 900px) {
    .live-hero { grid-template-columns: 1fr; gap: 14px; }
    .live-hero-kpis { justify-content: space-around; gap: 8px; }
    .live-kpi { min-width: 60px; }
    .live-kpi-num { font-size: 24px; }
    .live-breakdown { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .live-hero-week { width: 64px; height: 64px; }
    .live-hero-week-num { font-size: 20px; }
    .live-hero-week-year { font-size: 9.5px; }
    .live-board-table { font-size: 12px; }
    .live-board-table td { padding: 8px 7px; }
}

/* === High-resolution polish — match the rest of the app ================ */

@media (min-width: 1440px) {
    .live-kpi-num   { font-size: 32px; }
    .live-bd-num    { font-size: 34px; }
    .live-board-table { font-size: 13.5px; }
    .live-board-table td { padding: 13px 12px; }
}

@media (min-width: 1920px) {
    .live-hero { padding: 28px 32px; }
    .live-hero-week { width: 96px; height: 96px; }
    .live-hero-week-num { font-size: 30px; }
    .live-hero-title { font-size: 20px; }
    .live-kpi-num { font-size: 36px; }
    .live-bd-num  { font-size: 38px; }
    .live-board-table { font-size: 14.5px; }
}

/* ==========================================================================
   SCORECARD — INLINE "ADD NAME" BUTTON
   --------------------------------------------------------------------------
   Shown next to drivers in the scorecard that exist in the parsed data
   but don't have a name in the roster (display_name = transporter_id).
   Click → prompt() for the name → server saves via api.php → reload.
   Admin-only — non-admins never see the button (gated server-side).
   ========================================================================== */
.sc-add-name-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    padding: 2px 8px 2px 6px;
    background: rgba(34,197,94,0.10);
    color: #4ade80;
    border: 1px solid rgba(34,197,94,0.25);
    border-radius: 5px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
    font-family: inherit;
    -webkit-font-smoothing: antialiased;
}
.sc-add-name-btn:hover {
    background: rgba(34,197,94,0.18);
    color: #86efac;
    border-color: rgba(34,197,94,0.45);
}
.sc-add-name-btn:active { transform: translateY(1px); }
.sc-add-name-btn:disabled {
    opacity: 0.5;
    cursor: wait;
}
.sc-add-name-btn svg {
    flex-shrink: 0;
}

/* === Inline editor that replaces the + button on click =================== */

.sc-add-name-editor {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    vertical-align: middle;
}
.sc-add-name-input {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(34, 197, 94, 0.40);
    border-radius: 5px;
    padding: 4px 9px;
    color: #f8fafc;
    font-size: 12px;
    font-family: inherit;
    font-weight: 500;
    width: 200px;
    outline: none;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.sc-add-name-input:focus {
    border-color: #4ade80;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}
.sc-add-name-input::placeholder {
    color: rgba(255, 255, 255, 0.30);
}
.sc-add-name-save,
.sc-add-name-cancel {
    width: 24px;
    height: 24px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.65);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
    padding: 0;
}
.sc-add-name-save {
    background: rgba(34, 197, 94, 0.16);
    color: #4ade80;
    border-color: rgba(34, 197, 94, 0.32);
}
.sc-add-name-save:hover {
    background: rgba(34, 197, 94, 0.28);
    color: #86efac;
    border-color: rgba(34, 197, 94, 0.55);
}
.sc-add-name-cancel:hover {
    background: rgba(255, 255, 255, 0.10);
    color: #f8fafc;
}
.sc-add-name-save:disabled,
.sc-add-name-cancel:disabled,
.sc-add-name-input:disabled {
    opacity: 0.55;
    cursor: wait;
}

/* Saving state — pulse the input border to signal in-flight */
.sc-add-name-editor.is-saving .sc-add-name-input {
    animation: sc-saving-pulse 1.2s ease-in-out infinite;
}
@keyframes sc-saving-pulse {
    0%, 100% { border-color: rgba(34, 197, 94, 0.40); }
    50%      { border-color: rgba(34, 197, 94, 0.85); }
}

/* "Field is invalid" nudge — quick horizontal shake */
@keyframes sc-shake {
    0%, 100% { transform: translateX(0); }
    20%      { transform: translateX(-3px); }
    40%      { transform: translateX(3px); }
    60%      { transform: translateX(-2px); }
    80%      { transform: translateX(2px); }
}

/* Brief green flash on a row when its name has just been saved */
.sc-row-just-saved {
    animation: sc-row-flash 1.5s ease-out;
}
@keyframes sc-row-flash {
    0%   { background: rgba(34, 197, 94, 0.22); }
    100% { background: transparent; }
}

/* ==========================================================================
   DRIVER PROFILE — YEAR-BY-YEAR COMPARISON
   ========================================================================== */

.dyc-card { /* base inherits from .app-card */ }

.dyc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.dyc-year-card {
    background: rgba(255,255,255,0.025);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: border-color 0.14s ease, background 0.14s ease;
}
.dyc-year-card:hover {
    border-color: rgba(251,191,36,0.18);
    background: rgba(255,255,255,0.035);
}

.dyc-year-head {
    display: flex; justify-content: space-between; align-items: baseline;
}
.dyc-year-label {
    font-size: 22px; font-weight: 800; color: #f8fafc;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}
.dyc-year-weeks {
    font-size: 11px; color: rgba(255,255,255,0.40);
    font-variant-numeric: tabular-nums;
}

.dyc-avg-block { display: flex; flex-direction: column; gap: 1px; }
.dyc-avg-num {
    font-size: 30px; font-weight: 800; color: #fbbf24;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.dyc-avg-label {
    font-size: 10px; color: rgba(255,255,255,0.45);
    text-transform: uppercase; letter-spacing: 0.06em;
    margin-top: 2px;
}

.dyc-delta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 5px;
    font-size: 11px; font-weight: 700;
    width: max-content;
    font-variant-numeric: tabular-nums;
}
.dyc-delta.is-up   { background: rgba(34,197,94,0.16);  color: #4ade80; }
.dyc-delta.is-down { background: rgba(239,68,68,0.18);  color: #f87171; }
.dyc-delta.is-flat { background: rgba(107,114,128,0.18); color: rgba(255,255,255,0.65); }
.dyc-delta-vs { opacity: 0.55; font-weight: 500; }

.dyc-range-row {
    display: flex; align-items: center; gap: 6px;
    font-size: 11.5px;
    color: rgba(255,255,255,0.65);
}
.dyc-range-lbl { color: rgba(255,255,255,0.40); margin-right: 3px; font-size: 10.5px; }
.dyc-range-val { color: #f8fafc; font-weight: 700; font-variant-numeric: tabular-nums; }
.dyc-range-sep { color: rgba(255,255,255,0.20); }

.dyc-tier-strip {
    display: flex;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    background: rgba(255,255,255,0.05);
}
.dyc-tier-seg { display: block; height: 100%; }

.dyc-tier-counts {
    display: flex; flex-wrap: wrap;
    gap: 4px 10px;
    font-size: 10.5px;
    color: rgba(255,255,255,0.65);
}
.dyc-tier-count {
    display: inline-flex; align-items: center; gap: 4px;
}
.dyc-tier-dot {
    display: inline-block; width: 8px; height: 8px;
    border-radius: 50%;
}
.dyc-tier-cnum { color: #f8fafc; font-weight: 700; font-variant-numeric: tabular-nums; }
.dyc-tier-clbl { color: rgba(255,255,255,0.55); }

.dyc-footer {
    margin-top: 4px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.06);
    font-size: 11px;
    color: rgba(255,255,255,0.55);
}
.dyc-delivered { color: #f8fafc; font-weight: 700; font-variant-numeric: tabular-nums; }
.dyc-delivered-lbl { color: rgba(255,255,255,0.45); }

/* ==========================================================================
   DRIVER PROFILE — EXPORT STRIP
   ========================================================================== */

.driver-export-strip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 8px;
}
.driver-export-label {
    font-size: 11px;
    color: rgba(255,255,255,0.50);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    margin-right: 4px;
}
.driver-export-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(251,191,36,0.10);
    color: #fbbf24;
    border: 1px solid rgba(251,191,36,0.22);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.14s ease, border-color 0.14s ease;
}
.driver-export-btn:hover {
    background: rgba(251,191,36,0.20);
    border-color: rgba(251,191,36,0.45);
    color: #fcd34d;
}

@media (max-width: 600px) {
    .driver-export-strip { flex-wrap: wrap; }
    .driver-export-label { width: 100%; margin-bottom: 4px; }
}

/* ==========================================================================
   CONTACT COMPLIANCE — page (cc.php)
   --------------------------------------------------------------------------
   Visual cousin of the DNR page. Hero with depot CC% + week selector,
   reason-code chips, driver leaderboard sorted ASC (worst first), with
   expandable per-driver tracking IDs underneath.
   ========================================================================== */

/* Upload card ---------------------------------------------------------- */
.cc-upload-card {
    margin-bottom: 14px;
}
.cc-upload-form {
    display: flex;
    gap: 12px;
    align-items: stretch;
    margin-top: 4px;
}
.cc-upload-drop {
    flex: 1;
    display: flex;
    border: 1.5px dashed rgba(34,197,94,0.30);
    border-radius: 10px;
    padding: 14px 18px;
    background: rgba(34,197,94,0.04);
    cursor: pointer;
    transition: background 0.14s ease, border-color 0.14s ease;
    position: relative;
}
.cc-upload-drop:hover {
    background: rgba(34,197,94,0.08);
    border-color: rgba(34,197,94,0.50);
}
.cc-upload-drop input[type="file"] {
    position: absolute; inset: 0;
    opacity: 0;
    cursor: pointer;
}
.cc-upload-drop-inner {
    display: flex; align-items: center; gap: 12px;
    flex: 1;
}
.cc-upload-drop-inner svg { color: #4ade80; flex-shrink: 0; }
.cc-upload-drop-title {
    font-size: 13px; font-weight: 600; color: #f8fafc; display: block;
}
.cc-upload-drop-hint {
    font-size: 11px; color: rgba(255,255,255,0.45);
    display: block; margin-top: 2px;
    font-family: 'JetBrains Mono', monospace;
}
.cc-upload-btn {
    padding: 0 22px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: #052e16;
    border: 0; border-radius: 10px;
    font-size: 13px; font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.08s ease, box-shadow 0.14s ease;
}
.cc-upload-btn:hover {
    box-shadow: 0 4px 14px rgba(34,197,94,0.35);
}
.cc-upload-btn:active { transform: translateY(1px); }

.cc-empty {
    text-align: center;
    padding: 40px 20px;
}
.cc-empty h3 { color: rgba(255,255,255,0.70); margin-bottom: 4px; }
.cc-empty p  { color: rgba(255,255,255,0.45); font-size: 13px; }

/* Hero ----------------------------------------------------------------- */
.cc-hero {
    margin-bottom: 14px;
}
.cc-hero-head {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 18px;
    margin-bottom: 14px;
}
.cc-hero-eyebrow {
    font-size: 10px; letter-spacing: 0.14em;
    color: rgba(34,197,94,0.85);
    font-weight: 700; text-transform: uppercase;
    margin-bottom: 4px;
}
.cc-hero-title {
    font-size: 24px; font-weight: 800;
    color: #f8fafc;
    letter-spacing: -0.01em;
    margin: 0;
}
.cc-hero-sub {
    font-size: 12px;
    color: rgba(255,255,255,0.50);
    margin-top: 4px;
}
.cc-hero-score {
    text-align: right;
    padding: 4px 14px 4px 18px;
    border-radius: 10px;
    border: 1px solid;
}
.cc-hero-score.tone-great { background: rgba(34,197,94,0.10); border-color: rgba(34,197,94,0.30); }
.cc-hero-score.tone-good  { background: rgba(34,197,94,0.07); border-color: rgba(34,197,94,0.22); }
.cc-hero-score.tone-fair  { background: rgba(251,191,36,0.10); border-color: rgba(251,191,36,0.30); }
.cc-hero-score.tone-bad   { background: rgba(239,68,68,0.10); border-color: rgba(239,68,68,0.30); }
.cc-hero-score-num {
    font-size: 30px; font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    letter-spacing: -0.02em;
}
.tone-great .cc-hero-score-num { color: #4ade80; }
.tone-good  .cc-hero-score-num { color: #86efac; }
.tone-fair  .cc-hero-score-num { color: #fbbf24; }
.tone-bad   .cc-hero-score-num { color: #f87171; }
.cc-hero-score-cap {
    font-size: 10px; color: rgba(255,255,255,0.55);
    letter-spacing: 0.06em; text-transform: uppercase;
    font-weight: 700; margin-top: 6px;
}

/* Stats strip ---------------------------------------------------------- */
.cc-stats-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}
.cc-stat {
    background: rgba(255,255,255,0.025);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    padding: 10px 14px;
}
.cc-stat.cc-stat-bad {
    background: rgba(239,68,68,0.07);
    border-color: rgba(239,68,68,0.22);
}
.cc-stat-v {
    font-size: 20px; font-weight: 800;
    color: #f8fafc;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.cc-stat.cc-stat-bad .cc-stat-v { color: #f87171; }
.cc-stat-l {
    font-size: 10.5px; color: rgba(255,255,255,0.50);
    margin-top: 3px;
}

/* Pills ---------------------------------------------------------------- */
.cc-week-pills,
.cc-depot-pills {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin-top: 8px;
}
.cc-week-pill,
.cc-depot-pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 5px 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    color: rgba(255,255,255,0.65);
    font-size: 11px; font-weight: 600;
    text-decoration: none;
    transition: background 0.12s ease, border-color 0.12s ease;
    font-family: 'JetBrains Mono', monospace;
}
.cc-week-pill:hover,
.cc-depot-pill:hover {
    background: rgba(255,255,255,0.06);
    color: #f8fafc;
}
.cc-week-pill.is-active,
.cc-depot-pill.is-active {
    background: rgba(34,197,94,0.16);
    border-color: rgba(34,197,94,0.40);
    color: #4ade80;
}
.cc-week-pill-yr {
    color: rgba(255,255,255,0.35);
    font-size: 10px;
}
.cc-week-pill.is-active .cc-week-pill-yr { color: rgba(74,222,128,0.65); }

/* Reason breakdown ---------------------------------------------------- */
.cc-reasons-card { margin-bottom: 14px; }
.cc-reason-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}
.cc-reason-tile {
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid;
}
.cc-reason-bad  { background: rgba(239,68,68,0.07);  border-color: rgba(239,68,68,0.22); }
.cc-reason-warn { background: rgba(251,191,36,0.06); border-color: rgba(251,191,36,0.22); }
.cc-reason-info { background: rgba(96,165,250,0.06); border-color: rgba(96,165,250,0.22); }
.cc-reason-head {
    display: flex; justify-content: space-between; align-items: baseline;
    margin-bottom: 3px;
}
.cc-reason-label {
    font-size: 12.5px; font-weight: 700;
    color: #f8fafc;
}
.cc-reason-cnt {
    font-size: 22px; font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.cc-reason-bad  .cc-reason-cnt { color: #f87171; }
.cc-reason-warn .cc-reason-cnt { color: #fbbf24; }
.cc-reason-info .cc-reason-cnt { color: #93c5fd; }
.cc-reason-sub {
    font-size: 10.5px; color: rgba(255,255,255,0.55);
}
.cc-reason-hint {
    font-size: 11px; color: rgba(255,255,255,0.65);
    font-style: italic;
    margin-top: 6px;
    line-height: 1.4;
}
.cc-reason-code {
    font-size: 9.5px; color: rgba(255,255,255,0.30);
    font-family: 'JetBrains Mono', monospace;
    margin-top: 4px;
    letter-spacing: 0.02em;
}

/* Driver leaderboard --------------------------------------------------- */
.cc-drivers-card { margin-bottom: 14px; }
.cc-driver-list {
    display: flex; flex-direction: column; gap: 4px;
}
.cc-driver-row {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 7px;
    transition: background 0.14s ease;
    border-left-width: 3px;
}
.cc-driver-row.tone-great { border-left-color: #22c55e; }
.cc-driver-row.tone-good  { border-left-color: rgba(34,197,94,0.55); }
.cc-driver-row.tone-fair  { border-left-color: #fbbf24; background: rgba(251,191,36,0.04); }
.cc-driver-row.tone-bad   { border-left-color: #ef4444; background: rgba(239,68,68,0.05); }

.cc-driver-summary {
    display: grid;
    grid-template-columns: 32px 1fr 60px 220px 80px;
    gap: 12px;
    align-items: center;
    padding: 9px 14px;
    cursor: pointer;
    list-style: none;
}
.cc-driver-summary::-webkit-details-marker { display: none; }
.cc-driver-summary::marker { content: ''; }
.cc-driver-row[open] .cc-driver-summary {
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.cc-driver-rank {
    font-size: 11px; color: rgba(255,255,255,0.35);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
}
.cc-driver-name {
    display: flex; flex-direction: column; gap: 2px;
    min-width: 0;
}
.cc-driver-link {
    color: #f8fafc;
    font-size: 13px; font-weight: 600;
    text-decoration: none;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cc-driver-link:hover { color: #fbbf24; }
.cc-driver-tid {
    font-size: 10px;
    color: rgba(255,255,255,0.32);
    font-family: 'JetBrains Mono', monospace;
}
.cc-driver-depot {
    font-size: 10.5px; font-weight: 700;
    color: rgba(255,255,255,0.55);
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.02em;
}
.cc-driver-stats {
    font-size: 11.5px;
    color: rgba(255,255,255,0.62);
    display: flex; align-items: center; gap: 10px;
}
.cc-driver-stats strong { color: #f8fafc; font-variant-numeric: tabular-nums; }
.cc-driver-missed {
    background: rgba(239,68,68,0.18);
    color: #fca5a5;
    padding: 2px 8px; border-radius: 10px;
    font-size: 10px; font-weight: 700;
    letter-spacing: 0.02em;
}
.cc-driver-pct {
    font-size: 16px; font-weight: 800;
    font-variant-numeric: tabular-nums;
    text-align: right;
    letter-spacing: -0.01em;
}
.cc-pct-great { color: #4ade80; }
.cc-pct-good  { color: #86efac; }
.cc-pct-fair  { color: #fbbf24; }
.cc-pct-bad   { color: #f87171; }

/* Expanded stops ------------------------------------------------------- */
.cc-driver-stops {
    padding: 10px 14px 12px 50px;
    background: rgba(0,0,0,0.16);
}
.cc-stops-title {
    font-size: 10px; letter-spacing: 0.06em;
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
    font-weight: 700; margin-bottom: 6px;
}
.cc-stop-group {
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 6px;
    border-left: 3px solid;
}
.cc-stop-group:last-child { margin-bottom: 0; }
.cc-stop-bad  { border-left-color: #ef4444; background: rgba(239,68,68,0.05); }
.cc-stop-warn { border-left-color: #fbbf24; background: rgba(251,191,36,0.05); }
.cc-stop-info { border-left-color: #60a5fa; background: rgba(96,165,250,0.05); }
.cc-stop-reason {
    font-size: 11.5px; font-weight: 700;
    color: #f8fafc;
    margin-bottom: 5px;
    display: flex; align-items: center; gap: 6px;
}
.cc-stop-count {
    color: rgba(255,255,255,0.45);
    font-weight: 600;
    font-size: 10.5px;
}
.cc-stop-tids {
    display: flex; flex-wrap: wrap; gap: 4px;
}
.cc-stop-tid {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.78);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.06);
}

/* Responsive ----------------------------------------------------------- */
@media (max-width: 900px) {
    .cc-stats-strip { grid-template-columns: repeat(2, 1fr); }
    .cc-driver-summary {
        grid-template-columns: 28px 1fr 80px;
        gap: 8px;
    }
    .cc-driver-depot { grid-column: 2; }
    .cc-driver-stats { grid-column: 1 / -1; padding-left: 36px; font-size: 11px; }
    .cc-driver-pct { grid-row: 1; }
    .cc-upload-form { flex-direction: column; }
    .cc-upload-btn { padding: 12px; }
}

/* ==========================================================================
   CONTACT COMPLIANCE — export strip (cc.php)
   --------------------------------------------------------------------------
   PDF + Excel export buttons, gold-tinted, sitting between the stats
   strip and week pills. Same visual language as driver_pdf's export
   strip and DNR's export buttons.
   ========================================================================== */
.cc-export-strip {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0 12px;
    padding: 10px 14px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 8px;
}
.cc-export-label {
    font-size: 11px;
    color: rgba(255,255,255,0.50);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    margin-right: 4px;
}
.cc-export-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(251,191,36,0.10);
    color: #fbbf24;
    border: 1px solid rgba(251,191,36,0.22);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}
.cc-export-btn:hover {
    background: rgba(251,191,36,0.20);
    border-color: rgba(251,191,36,0.45);
    color: #fcd34d;
}

@media (max-width: 600px) {
    .cc-export-strip { flex-wrap: wrap; }
    .cc-export-label { width: 100%; margin-bottom: 4px; }
}

/* Subtle helper text shown next to the "DPE2" depot indicator in the
   CC hero subtitle when the topbar narrowed the scope. */
.cc-hero-hint {
    color: rgba(255,255,255,0.30);
    font-size: 10.5px;
    font-style: italic;
    margin-left: 6px;
}

/* ==========================================================================
   CC — policy clarification note + week selector label
   ========================================================================== */
.cc-policy-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 4px 0 12px;
    padding: 10px 14px;
    background: rgba(249,115,22,0.07);
    border: 1px solid rgba(249,115,22,0.20);
    border-left: 3px solid #f97316;
    border-radius: 7px;
    font-size: 11.5px;
    line-height: 1.55;
    color: rgba(255,255,255,0.75);
}
.cc-policy-note svg {
    color: #fb923c;
    flex-shrink: 0;
    margin-top: 2px;
}
.cc-policy-note strong {
    color: #fdba74;
    font-weight: 700;
}
.cc-policy-note em {
    color: #fed7aa;
    font-style: italic;
}

.cc-week-pills-label {
    display: inline-flex;
    align-items: center;
    font-size: 10.5px;
    color: rgba(255,255,255,0.40);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-right: 4px;
}
.cc-week-pills-hint {
    display: inline-flex;
    align-items: center;
    font-size: 10.5px;
    color: rgba(255,255,255,0.30);
    font-style: italic;
    margin-left: 4px;
}

/* ==========================================================================
   POD QUALITY — page (pod.php)
   --------------------------------------------------------------------------
   Mirrors the CC page architecture but with a camera/photo-AI accent.
   Hero shows photo success%, reject categories tile out with coaching
   hints, drivers split into "with rejects" (expanded, worst first) and
   "perfect" (collapsed block grid below).
   ========================================================================== */

/* Upload card ---------------------------------------------------------- */
.pod-upload-card { margin-bottom: 14px; }
.pod-upload-form {
    display: flex;
    gap: 12px;
    align-items: stretch;
    margin-top: 4px;
}
.pod-upload-drop {
    flex: 1;
    display: flex;
    border: 1.5px dashed rgba(96,165,250,0.30);
    border-radius: 10px;
    padding: 14px 18px;
    background: rgba(96,165,250,0.04);
    cursor: pointer;
    transition: background 0.14s ease, border-color 0.14s ease;
    position: relative;
}
.pod-upload-drop:hover {
    background: rgba(96,165,250,0.08);
    border-color: rgba(96,165,250,0.50);
}
.pod-upload-drop input[type="file"] {
    position: absolute; inset: 0;
    opacity: 0;
    cursor: pointer;
}
.pod-upload-drop-inner {
    display: flex; align-items: center; gap: 12px;
    flex: 1;
}
.pod-upload-drop-inner svg { color: #60a5fa; flex-shrink: 0; }
.pod-upload-drop-title {
    font-size: 13px; font-weight: 600; color: #f8fafc; display: block;
}
.pod-upload-drop-hint {
    font-size: 11px; color: rgba(255,255,255,0.45);
    display: block; margin-top: 2px;
    font-family: 'JetBrains Mono', monospace;
}
.pod-upload-btn {
    padding: 0 22px;
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    color: #0c1e3a;
    border: 0; border-radius: 10px;
    font-size: 13px; font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.08s ease, box-shadow 0.14s ease;
}
.pod-upload-btn:hover {
    box-shadow: 0 4px 14px rgba(96,165,250,0.35);
}
.pod-upload-btn:active { transform: translateY(1px); }

.pod-empty {
    text-align: center;
    padding: 40px 20px;
}
.pod-empty h3 { color: rgba(255,255,255,0.70); margin-bottom: 4px; }
.pod-empty p  { color: rgba(255,255,255,0.45); font-size: 13px; }

/* Hero ----------------------------------------------------------------- */
.pod-hero { margin-bottom: 14px; }
.pod-hero-head {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 18px;
    margin-bottom: 14px;
}
.pod-hero-eyebrow {
    font-size: 10px; letter-spacing: 0.14em;
    color: rgba(96,165,250,0.85);
    font-weight: 700; text-transform: uppercase;
    margin-bottom: 4px;
}
.pod-hero-title {
    font-size: 24px; font-weight: 800;
    color: #f8fafc;
    letter-spacing: -0.01em;
    margin: 0;
}
.pod-hero-sub {
    font-size: 12px;
    color: rgba(255,255,255,0.50);
    margin-top: 4px;
}
.pod-hero-hint {
    color: rgba(255,255,255,0.30);
    font-size: 10.5px;
    font-style: italic;
    margin-left: 4px;
}
.pod-hero-score {
    text-align: right;
    padding: 4px 14px 4px 18px;
    border-radius: 10px;
    border: 1px solid;
}
.pod-hero-score.tone-great { background: rgba(34,197,94,0.10); border-color: rgba(34,197,94,0.30); }
.pod-hero-score.tone-good  { background: rgba(34,197,94,0.07); border-color: rgba(34,197,94,0.22); }
.pod-hero-score.tone-fair  { background: rgba(251,191,36,0.10); border-color: rgba(251,191,36,0.30); }
.pod-hero-score.tone-bad   { background: rgba(239,68,68,0.10); border-color: rgba(239,68,68,0.30); }
.pod-hero-score-num {
    font-size: 30px; font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    letter-spacing: -0.02em;
}
.tone-great .pod-hero-score-num { color: #4ade80; }
.tone-good  .pod-hero-score-num { color: #86efac; }
.tone-fair  .pod-hero-score-num { color: #fbbf24; }
.tone-bad   .pod-hero-score-num { color: #f87171; }
.pod-hero-score-cap {
    font-size: 10px; color: rgba(255,255,255,0.55);
    letter-spacing: 0.06em; text-transform: uppercase;
    font-weight: 700; margin-top: 6px;
}

/* Stats strip ---------------------------------------------------------- */
.pod-stats-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}
.pod-stat {
    background: rgba(255,255,255,0.025);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    padding: 10px 14px;
}
.pod-stat.pod-stat-bad {
    background: rgba(239,68,68,0.07);
    border-color: rgba(239,68,68,0.22);
}
.pod-stat-v {
    font-size: 20px; font-weight: 800;
    color: #f8fafc;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.pod-stat.pod-stat-bad .pod-stat-v { color: #f87171; }
.pod-stat-l {
    font-size: 10.5px; color: rgba(255,255,255,0.50);
    margin-top: 3px;
}

/* Week selector pills -------------------------------------------------- */
.pod-week-pills {
    display: flex; flex-wrap: wrap; gap: 6px;
    align-items: center;
    margin-top: 8px;
}
.pod-week-pills-label {
    display: inline-flex;
    align-items: center;
    font-size: 10.5px;
    color: rgba(255,255,255,0.40);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-right: 4px;
}
.pod-week-pills-hint {
    font-size: 10.5px;
    color: rgba(255,255,255,0.30);
    font-style: italic;
    margin-left: 4px;
}
.pod-week-pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 5px 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    color: rgba(255,255,255,0.65);
    font-size: 11px; font-weight: 600;
    text-decoration: none;
    transition: background 0.12s ease, border-color 0.12s ease;
    font-family: 'JetBrains Mono', monospace;
}
.pod-week-pill:hover {
    background: rgba(255,255,255,0.06);
    color: #f8fafc;
}
.pod-week-pill.is-active {
    background: rgba(96,165,250,0.16);
    border-color: rgba(96,165,250,0.40);
    color: #93c5fd;
}
.pod-week-pill-yr {
    color: rgba(255,255,255,0.35);
    font-size: 10px;
}
.pod-week-pill.is-active .pod-week-pill-yr { color: rgba(147,197,253,0.65); }

/* Reject category breakdown -------------------------------------------- */
.pod-reasons-card { margin-bottom: 14px; }
.pod-policy-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 4px 0 12px;
    padding: 10px 14px;
    background: rgba(249,115,22,0.07);
    border: 1px solid rgba(249,115,22,0.20);
    border-left: 3px solid #f97316;
    border-radius: 7px;
    font-size: 11.5px;
    line-height: 1.55;
    color: rgba(255,255,255,0.75);
}
.pod-policy-note svg {
    color: #fb923c;
    flex-shrink: 0;
    margin-top: 2px;
}
.pod-policy-note strong {
    color: #fdba74;
    font-weight: 700;
}
.pod-reason-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
}
.pod-reason-tile {
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid;
}
.pod-reason-bad  { background: rgba(239,68,68,0.07);  border-color: rgba(239,68,68,0.22); }
.pod-reason-warn { background: rgba(251,191,36,0.06); border-color: rgba(251,191,36,0.22); }
.pod-reason-head {
    display: flex; justify-content: space-between; align-items: baseline;
    margin-bottom: 3px;
}
.pod-reason-label {
    font-size: 12.5px; font-weight: 700;
    color: #f8fafc;
}
.pod-reason-cnt {
    font-size: 22px; font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.pod-reason-bad  .pod-reason-cnt { color: #f87171; }
.pod-reason-warn .pod-reason-cnt { color: #fbbf24; }
.pod-reason-sub {
    font-size: 10.5px; color: rgba(255,255,255,0.55);
}
.pod-reason-hint {
    font-size: 11px; color: rgba(255,255,255,0.65);
    font-style: italic;
    margin-top: 6px;
    line-height: 1.4;
}

/* Zero-rejects celebration card ---------------------------------------- */
.pod-zero-card {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(34,197,94,0.08) 0%, rgba(34,197,94,0.04) 100%);
    border: 1px solid rgba(34,197,94,0.25);
    border-left: 3px solid #22c55e;
    border-radius: 8px;
}
.pod-zero-icon {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: rgba(34,197,94,0.18);
    display: flex; align-items: center; justify-content: center;
    color: #4ade80;
    flex-shrink: 0;
}
.pod-zero-title {
    font-size: 14px; font-weight: 700;
    color: #4ade80;
    margin-bottom: 2px;
}
.pod-zero-sub {
    font-size: 12px;
    color: rgba(255,255,255,0.65);
    line-height: 1.5;
}

/* Driver leaderboard --------------------------------------------------- */
.pod-drivers-card { margin-bottom: 14px; }
.pod-driver-list {
    display: flex; flex-direction: column; gap: 4px;
    margin-bottom: 10px;
}
.pod-driver-row {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 7px;
    border-left-width: 3px;
}
.pod-driver-row.tone-bad   { border-left-color: #ef4444; background: rgba(239,68,68,0.05); }
.pod-driver-row.tone-warn  { border-left-color: #fbbf24; background: rgba(251,191,36,0.04); }
.pod-driver-row.tone-mild  { border-left-color: rgba(251,191,36,0.55); }

.pod-driver-summary {
    display: grid;
    grid-template-columns: 32px 1fr 60px 280px 95px 80px;
    gap: 12px;
    align-items: center;
    padding: 9px 14px;
    cursor: pointer;
    list-style: none;
}
.pod-driver-summary::-webkit-details-marker { display: none; }
.pod-driver-summary::marker { content: ''; }
.pod-driver-row[open] .pod-driver-summary {
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.pod-driver-rank {
    font-size: 11px; color: rgba(255,255,255,0.35);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
}
.pod-driver-name {
    display: flex; flex-direction: column; gap: 2px;
    min-width: 0;
}
.pod-driver-link {
    color: #f8fafc;
    font-size: 13px; font-weight: 600;
    text-decoration: none;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pod-driver-link:hover { color: #fbbf24; }
.pod-driver-tid {
    font-size: 10px;
    color: rgba(255,255,255,0.32);
    font-family: 'JetBrains Mono', monospace;
}
.pod-driver-depot {
    font-size: 10.5px; font-weight: 700;
    color: rgba(255,255,255,0.55);
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.02em;
}
.pod-driver-stats {
    font-size: 11.5px;
    color: rgba(255,255,255,0.62);
    font-variant-numeric: tabular-nums;
}
.pod-driver-stats strong { color: #f8fafc; }
.pod-driver-rejects {
    display: flex; justify-content: center;
}
.pod-rejects-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 10.5px; font-weight: 800;
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
}
.pod-rejects-bad  { background: rgba(239,68,68,0.20); color: #fca5a5; }
.pod-rejects-warn { background: rgba(251,191,36,0.20); color: #fcd34d; }
.pod-rejects-mild { background: rgba(251,191,36,0.12); color: #fde68a; }
.pod-driver-pct {
    font-size: 15px; font-weight: 800;
    font-variant-numeric: tabular-nums;
    text-align: right;
    letter-spacing: -0.01em;
}
.pod-pct-bad   { color: #f87171; }
.pod-pct-warn  { color: #fbbf24; }
.pod-pct-mild  { color: #fde68a; }

/* Expanded driver details ---------------------------------------------- */
.pod-driver-details {
    padding: 10px 14px 12px 50px;
    background: rgba(0,0,0,0.16);
}
.pod-driver-details-title {
    font-size: 10px; letter-spacing: 0.06em;
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
    font-weight: 700; margin-bottom: 6px;
}
.pod-reject-chips {
    display: flex; flex-wrap: wrap; gap: 6px;
}
.pod-reject-chip {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    border-left: 3px solid;
    min-width: 200px;
    max-width: 360px;
}
.pod-chip-bad  { background: rgba(239,68,68,0.06);  border-left-color: #ef4444; }
.pod-chip-warn { background: rgba(251,191,36,0.06); border-left-color: #fbbf24; }
.pod-chip-num {
    font-size: 16px; font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    color: #f8fafc;
    min-width: 18px;
}
.pod-chip-bad  .pod-chip-num { color: #fca5a5; }
.pod-chip-warn .pod-chip-num { color: #fcd34d; }
.pod-chip-label {
    font-size: 11.5px; font-weight: 700;
    color: #f8fafc;
    white-space: nowrap;
}
.pod-chip-hint {
    font-size: 10.5px;
    color: rgba(255,255,255,0.55);
    font-style: italic;
    flex: 1;
    line-height: 1.35;
}

/* Perfect drivers (zero rejects) — collapsed block --------------------- */
.pod-perfect-block {
    background: rgba(34,197,94,0.04);
    border: 1px solid rgba(34,197,94,0.15);
    border-radius: 7px;
    padding: 4px;
}
.pod-perfect-summary {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    list-style: none;
    color: #86efac;
    font-size: 12px; font-weight: 600;
}
.pod-perfect-summary::-webkit-details-marker { display: none; }
.pod-perfect-summary::marker { content: ''; }
.pod-perfect-summary svg { color: #4ade80; flex-shrink: 0; }
.pod-perfect-hint {
    margin-left: auto;
    font-size: 10.5px;
    color: rgba(74,222,128,0.55);
    font-style: italic;
    font-weight: 500;
}
.pod-perfect-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 6px;
    padding: 8px 6px 4px;
}
.pod-perfect-card {
    display: flex; flex-direction: column; gap: 2px;
    padding: 8px 10px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(34,197,94,0.12);
    border-radius: 5px;
    text-decoration: none;
    transition: background 0.12s ease, border-color 0.12s ease;
}
.pod-perfect-card:hover {
    background: rgba(34,197,94,0.05);
    border-color: rgba(34,197,94,0.30);
}
.pod-perfect-name {
    font-size: 12px; font-weight: 600;
    color: #f8fafc;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pod-perfect-stats {
    font-size: 10.5px;
    color: rgba(255,255,255,0.45);
    font-variant-numeric: tabular-nums;
}

/* Responsive ----------------------------------------------------------- */
@media (max-width: 1000px) {
    .pod-driver-summary {
        grid-template-columns: 28px 1fr 90px 80px;
        gap: 8px;
    }
    .pod-driver-depot { display: none; }
    .pod-driver-stats { grid-column: 1 / -1; padding-left: 36px; font-size: 11px; }
}
@media (max-width: 700px) {
    .pod-stats-strip { grid-template-columns: repeat(2, 1fr); }
    .pod-upload-form { flex-direction: column; }
    .pod-upload-btn { padding: 12px; }
    .pod-reject-chip { min-width: unset; max-width: unset; }
}

/* ==========================================================================
   POD QUALITY — table + export strip (replaces older row-based layout)
   --------------------------------------------------------------------------
   Compact dense table, one row per driver, issue codes inline (matches
   the print-report aesthetic the user wanted). Sorted rejects DESC
   server-side. Filter toggle to show only drivers with rejects.
   ========================================================================== */

/* Export strip — gold-tinted, identical pattern to cc-export-strip */
.pod-export-strip {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    padding: 10px 14px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 8px;
}
.pod-export-label {
    font-size: 11px;
    color: rgba(255,255,255,0.50);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    margin-right: 4px;
}
.pod-export-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(251,191,36,0.10);
    color: #fbbf24;
    border: 1px solid rgba(251,191,36,0.22);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}
.pod-export-btn:hover {
    background: rgba(251,191,36,0.20);
    border-color: rgba(251,191,36,0.45);
    color: #fcd34d;
}

/* Filter toggle pills */
.pod-filter-toggle {
    display: flex;
    gap: 6px;
    margin: 4px 0 10px;
}
.pod-filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: rgba(255,255,255,0.03);
    color: rgba(255,255,255,0.65);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 7px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
    font-family: inherit;
}
.pod-filter-pill:hover {
    background: rgba(255,255,255,0.06);
    color: #f8fafc;
}
.pod-filter-pill.is-active {
    background: rgba(96,165,250,0.16);
    border-color: rgba(96,165,250,0.40);
    color: #93c5fd;
}
.pod-filter-count {
    background: rgba(255,255,255,0.08);
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.pod-filter-pill.is-active .pod-filter-count {
    background: rgba(96,165,250,0.20);
    color: #bfdbfe;
}

/* Table */
.pod-table-wrap {
    overflow-x: auto;
    margin: 0 -4px;
}
.pod-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
    /* Fixed layout: respect explicit column widths instead of distributing
       space proportionally to content. Without this, the table tries to
       fill 100% width by stretching every column — so narrow numeric
       columns (showing just '0' or '7') get padded with huge whitespace,
       pushing the Issue Details column all the way to the far right. */
    table-layout: fixed;
}
/* Column widths — total adds up to roughly the inner content area
   (1440px container - ~50px gutters = ~1390px). Driver column gets the
   leftover by being the only flex one. Numeric columns are tight but
   readable; Issue Details fits 'NoPkg:4 InCar:3 Close:2' on one line. */
.pod-table colgroup .col-rank    { width: 44px; }
.pod-table colgroup .col-driver  { width: auto; }
.pod-table colgroup .col-depot   { width: 64px; }
.pod-table colgroup .col-num     { width: 80px; }
.pod-table colgroup .col-issues  { width: 320px; }
.pod-table thead th {
    background: rgba(255,255,255,0.03);
    color: rgba(255,255,255,0.50);
    font-size: 9.5px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    padding: 8px 8px;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    white-space: nowrap;
}
.pod-table thead th.pod-th-num { text-align: right; }
.pod-table tbody tr {
    border-bottom: 1px solid rgba(255,255,255,0.03);
    transition: background 0.10s ease;
}
.pod-table tbody tr:hover { background: rgba(255,255,255,0.025); }
.pod-table td {
    padding: 8px 8px;
    color: rgba(255,255,255,0.78);
    vertical-align: middle;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    overflow: hidden;
    text-overflow: ellipsis;
}

.pod-tr-perfect td { color: rgba(255,255,255,0.55); }
.pod-tr-mild  { background: rgba(251,191,36,0.025); }
.pod-tr-warn  { background: rgba(251,191,36,0.05); }
.pod-tr-bad   { background: rgba(239,68,68,0.07); }

.pod-td-rank {
    color: rgba(255,255,255,0.35);
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    font-weight: 700;
    white-space: nowrap;
}
.pod-td-driver {
    overflow: hidden;
}
.pod-td-driver .pod-driver-link {
    color: #f8fafc;
    font-weight: 600;
    text-decoration: none;
    font-size: 12.5px;
}
.pod-td-driver .pod-driver-link:hover { color: #fbbf24; }
.pod-td-driver .pod-driver-tid {
    font-size: 10px;
    color: rgba(255,255,255,0.30);
    font-family: 'JetBrains Mono', monospace;
    margin-top: 2px;
}
.pod-td-depot {
    color: rgba(255,255,255,0.50);
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.pod-td-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    white-space: nowrap;
}
.pod-num-dim   { color: rgba(255,255,255,0.30); font-weight: 400; }
.pod-num-amber { color: #fbbf24; }
.pod-num-red   { color: #f87171; }
.pod-rate-perfect { color: #4ade80; }
.pod-rate-mild    { color: #fde68a; }
.pod-rate-warn    { color: #fbbf24; }
.pod-rate-bad     { color: #f87171; }

.pod-td-issues {
    /* Cell can break content if Issue Details list overflows the
       remaining column width (rare, but possible with many categories). */
    white-space: normal;
}
.pod-issue-code {
    display: inline-block;
    padding: 2px 7px;
    margin: 1px 2px 1px 0;
    border-radius: 4px;
    font-size: 10.5px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.01em;
    border: 1px solid;
    white-space: nowrap;
    cursor: help;
}
.pod-code-bad {
    background: rgba(239,68,68,0.14);
    color: #fca5a5;
    border-color: rgba(239,68,68,0.30);
}
.pod-code-warn {
    background: rgba(251,191,36,0.14);
    color: #fcd34d;
    border-color: rgba(251,191,36,0.30);
}
.pod-code-bypass {
    background: rgba(148,163,184,0.14);
    color: #cbd5e1;
    border-color: rgba(148,163,184,0.30);
}
.pod-issue-perfect {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(34,197,94,0.10);
    color: #4ade80;
    border: 1px solid rgba(34,197,94,0.22);
    border-radius: 4px;
    font-size: 10.5px;
    font-weight: 700;
}

@media (max-width: 900px) {
    .pod-td-depot { display: none; }
    .pod-table thead th.pod-th-depot { display: none; }
    .pod-table { font-size: 11px; }
    .pod-table td, .pod-table th { padding: 6px 6px; }
}

/* ==========================================================================
   PHR (Preference Honor Rate) — page (phr.php)
   --------------------------------------------------------------------------
   Mirrors CC visual language with a purple-pink accent (vs CC's green).
   Two unique blocks: "Top preference mismatches" card showing the worst
   safe_place->delivery_scan combinations, and per-driver expansion shows
   COMBINATIONS not tracking IDs (PHR weeks routinely hit 2000+ stops).
   ========================================================================== */

/* Upload card */
.phr-upload-card { margin-bottom: 14px; }
.phr-upload-form { display: flex; gap: 12px; align-items: stretch; margin-top: 4px; }
.phr-upload-drop {
    flex: 1; display: flex;
    border: 1.5px dashed rgba(168,85,247,0.30);
    border-radius: 10px;
    padding: 14px 18px;
    background: rgba(168,85,247,0.04);
    cursor: pointer;
    transition: background 0.14s ease, border-color 0.14s ease;
    position: relative;
}
.phr-upload-drop:hover { background: rgba(168,85,247,0.08); border-color: rgba(168,85,247,0.50); }
.phr-upload-drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.phr-upload-drop-inner { display: flex; align-items: center; gap: 12px; flex: 1; }
.phr-upload-drop-inner svg { color: #c084fc; flex-shrink: 0; }
.phr-upload-drop-title { font-size: 13px; font-weight: 600; color: #f8fafc; display: block; }
.phr-upload-drop-hint {
    font-size: 11px; color: rgba(255,255,255,0.45);
    display: block; margin-top: 2px;
    font-family: 'JetBrains Mono', monospace;
}
.phr-upload-btn {
    padding: 0 22px;
    background: linear-gradient(135deg, #a855f7 0%, #7e22ce 100%);
    color: #fff;
    border: 0; border-radius: 10px;
    font-size: 13px; font-weight: 700;
    cursor: pointer; font-family: inherit;
    transition: transform 0.08s ease, box-shadow 0.14s ease;
}
.phr-upload-btn:hover { box-shadow: 0 4px 14px rgba(168,85,247,0.35); }
.phr-upload-btn:active { transform: translateY(1px); }

.phr-empty { text-align: center; padding: 40px 20px; }
.phr-empty h3 { color: rgba(255,255,255,0.70); margin-bottom: 4px; }
.phr-empty p { color: rgba(255,255,255,0.45); font-size: 13px; }

/* Hero */
.phr-hero { margin-bottom: 14px; }
.phr-hero-head {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 18px; margin-bottom: 14px;
}
.phr-hero-eyebrow {
    font-size: 10px; letter-spacing: 0.14em;
    color: rgba(192,132,252,0.85);
    font-weight: 700; text-transform: uppercase;
    margin-bottom: 4px;
}
.phr-hero-title {
    font-size: 24px; font-weight: 800;
    color: #f8fafc; letter-spacing: -0.01em; margin: 0;
}
.phr-hero-sub { font-size: 12px; color: rgba(255,255,255,0.50); margin-top: 4px; }
.phr-hero-hint {
    color: rgba(255,255,255,0.30); font-size: 10.5px;
    font-style: italic; margin-left: 4px;
}
.phr-hero-score {
    text-align: right; padding: 4px 14px 4px 18px;
    border-radius: 10px; border: 1px solid;
}
.phr-hero-score.tone-great { background: rgba(34,197,94,0.10); border-color: rgba(34,197,94,0.30); }
.phr-hero-score.tone-good  { background: rgba(34,197,94,0.07); border-color: rgba(34,197,94,0.22); }
.phr-hero-score.tone-fair  { background: rgba(251,191,36,0.10); border-color: rgba(251,191,36,0.30); }
.phr-hero-score.tone-bad   { background: rgba(239,68,68,0.10); border-color: rgba(239,68,68,0.30); }
.phr-hero-score-num {
    font-size: 30px; font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1; letter-spacing: -0.02em;
}
.phr-hero-score.tone-great .phr-hero-score-num { color: #4ade80; }
.phr-hero-score.tone-good  .phr-hero-score-num { color: #86efac; }
.phr-hero-score.tone-fair  .phr-hero-score-num { color: #fbbf24; }
.phr-hero-score.tone-bad   .phr-hero-score-num { color: #f87171; }
.phr-hero-score-cap {
    font-size: 10px; color: rgba(255,255,255,0.55);
    letter-spacing: 0.06em; text-transform: uppercase;
    font-weight: 700; margin-top: 6px;
}

/* Stats strip */
.phr-stats-strip {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 10px; margin-bottom: 14px;
}
.phr-stat {
    background: rgba(255,255,255,0.025);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px; padding: 10px 14px;
}
.phr-stat.phr-stat-good { background: rgba(34,197,94,0.07); border-color: rgba(34,197,94,0.22); }
.phr-stat.phr-stat-bad  { background: rgba(239,68,68,0.07); border-color: rgba(239,68,68,0.22); }
.phr-stat-v {
    font-size: 20px; font-weight: 800; color: #f8fafc;
    font-variant-numeric: tabular-nums; line-height: 1;
}
.phr-stat-good .phr-stat-v { color: #4ade80; }
.phr-stat-bad  .phr-stat-v { color: #f87171; }
.phr-stat-l { font-size: 10.5px; color: rgba(255,255,255,0.50); margin-top: 3px; }

/* Week pills */
.phr-week-pills { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.phr-week-pills-label {
    display: inline-flex; align-items: center;
    font-size: 10.5px; color: rgba(255,255,255,0.40);
    font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.06em; margin-right: 4px;
}
.phr-week-pills-hint {
    font-size: 10.5px; color: rgba(255,255,255,0.30);
    font-style: italic; margin-left: 4px;
}
.phr-week-pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 5px 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px; color: rgba(255,255,255,0.65);
    font-size: 11px; font-weight: 600;
    text-decoration: none;
    transition: background 0.12s ease, border-color 0.12s ease;
    font-family: 'JetBrains Mono', monospace;
}
.phr-week-pill:hover { background: rgba(255,255,255,0.06); color: #f8fafc; }
.phr-week-pill.is-active {
    background: rgba(168,85,247,0.16);
    border-color: rgba(168,85,247,0.40);
    color: #c084fc;
}
.phr-week-pill-yr { color: rgba(255,255,255,0.35); font-size: 10px; }
.phr-week-pill.is-active .phr-week-pill-yr { color: rgba(192,132,252,0.65); }

/* Export strip — gold-tinted, same as CC/POD */
.phr-export-strip {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 14px; padding: 10px 14px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 8px;
}
.phr-export-label {
    font-size: 11px; color: rgba(255,255,255,0.50);
    text-transform: uppercase; letter-spacing: 0.06em;
    font-weight: 700; margin-right: 4px;
}
.phr-export-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px;
    background: rgba(251,191,36,0.10); color: #fbbf24;
    border: 1px solid rgba(251,191,36,0.22);
    border-radius: 6px;
    font-size: 12px; font-weight: 600; text-decoration: none;
    transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}
.phr-export-btn:hover {
    background: rgba(251,191,36,0.20);
    border-color: rgba(251,191,36,0.45);
    color: #fcd34d;
}

/* Reason breakdown card */
.phr-reasons-card { margin-bottom: 14px; }
.phr-policy-note {
    display: flex; align-items: flex-start; gap: 8px;
    margin: 4px 0 12px; padding: 10px 14px;
    background: rgba(249,115,22,0.07);
    border: 1px solid rgba(249,115,22,0.20);
    border-left: 3px solid #f97316;
    border-radius: 7px;
    font-size: 11.5px; line-height: 1.55;
    color: rgba(255,255,255,0.75);
}
.phr-policy-note svg { color: #fb923c; flex-shrink: 0; margin-top: 2px; }
.phr-policy-note strong { color: #fdba74; font-weight: 700; }

.phr-reason-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
}
.phr-reason-tile { padding: 12px 14px; border-radius: 8px; border: 1px solid; }
.phr-reason-bad  { background: rgba(239,68,68,0.07);  border-color: rgba(239,68,68,0.22); }
.phr-reason-warn { background: rgba(251,191,36,0.06); border-color: rgba(251,191,36,0.22); }
.phr-reason-head {
    display: flex; justify-content: space-between; align-items: baseline;
    margin-bottom: 3px;
}
.phr-reason-label { font-size: 12.5px; font-weight: 700; color: #f8fafc; }
.phr-reason-cnt {
    font-size: 22px; font-weight: 800;
    font-variant-numeric: tabular-nums; line-height: 1;
}
.phr-reason-bad  .phr-reason-cnt { color: #f87171; }
.phr-reason-warn .phr-reason-cnt { color: #fbbf24; }
.phr-reason-sub { font-size: 10.5px; color: rgba(255,255,255,0.55); }
.phr-reason-hint {
    font-size: 11px; color: rgba(255,255,255,0.65);
    font-style: italic; margin-top: 6px; line-height: 1.4;
}
.phr-reason-code {
    font-size: 9.5px; color: rgba(255,255,255,0.30);
    font-family: 'JetBrains Mono', monospace;
    margin-top: 4px; letter-spacing: 0.02em;
}

/* Top combinations — cleaner ranked list */
.phr-combos-card { margin-bottom: 14px; }
.phr-combo-list { display: flex; flex-direction: column; gap: 6px; }
.phr-combo-row {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px;
    border-radius: 7px;
    border-left: 3px solid;
    background: rgba(255,255,255,0.02);
    transition: background 0.12s ease;
}
.phr-combo-row.is-bad  { border-left-color: rgba(239,68,68,0.55); }
.phr-combo-row.is-warn { border-left-color: rgba(251,191,36,0.55); }
.phr-combo-row.is-top.is-bad  { background: rgba(239,68,68,0.06); border-left-color: #ef4444; }
.phr-combo-row.is-top.is-warn { background: rgba(251,191,36,0.05); border-left-color: #fbbf24; }
.phr-combo-rank {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px; font-weight: 800;
    color: rgba(255,255,255,0.35);
    min-width: 26px;
}
.phr-combo-row.is-top .phr-combo-rank {
    color: #fbbf24;
    font-size: 13px;
}
.phr-combo-text {
    flex: 1;
    font-size: 12px;
    color: rgba(255,255,255,0.72);
    line-height: 1.5;
}
.phr-combo-want, .phr-combo-did {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px; font-weight: 700;
    padding: 1px 7px; border-radius: 4px;
}
.phr-combo-want { background: rgba(34,197,94,0.14); color: #86efac; }
.phr-combo-did  { background: rgba(239,68,68,0.14); color: #fca5a5; }
.phr-combo-arrow { color: rgba(255,255,255,0.30); margin: 0 4px; font-weight: 700; }
.phr-combo-cnt {
    font-size: 14px; font-weight: 800;
    color: #f8fafc;
    font-variant-numeric: tabular-nums;
    background: rgba(255,255,255,0.06);
    padding: 4px 10px; border-radius: 6px;
    white-space: nowrap;
}
.phr-combo-row.is-top .phr-combo-cnt {
    background: rgba(251,191,36,0.16);
    color: #fcd34d;
    font-size: 16px;
}
.phr-combo-cnt-l {
    font-size: 10px;
    font-weight: 600;
    color: rgba(255,255,255,0.45);
    margin-left: 3px;
}
.phr-combo-row.is-top .phr-combo-cnt-l { color: rgba(252,211,77,0.65); }

/* Reason "show more" collapse */
.phr-reason-more {
    margin-top: 8px;
    border-top: 1px dashed rgba(255,255,255,0.08);
    padding-top: 10px;
}
.phr-reason-more summary {
    display: flex; align-items: center; gap: 6px;
    list-style: none;
    cursor: pointer;
    font-size: 11px;
    color: rgba(255,255,255,0.55);
    font-weight: 600;
    padding: 4px 0;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.phr-reason-more summary::-webkit-details-marker { display: none; }
.phr-reason-more summary svg {
    transition: transform 0.15s ease;
    color: rgba(255,255,255,0.45);
}
.phr-reason-more[open] summary svg { transform: rotate(180deg); }
.phr-reason-more summary:hover { color: #f8fafc; }
.phr-reason-grid-compact {
    margin-top: 8px;
}
.phr-reason-grid-compact .phr-reason-tile {
    padding: 8px 12px;
}
.phr-reason-grid-compact .phr-reason-cnt { font-size: 16px; }
.phr-reason-grid-compact .phr-reason-label { font-size: 11.5px; }

/* "+N more" overflow chip on driver combos */
.phr-combo-more {
    background: rgba(255,255,255,0.04) !important;
    border-left: 2px solid rgba(255,255,255,0.15) !important;
    color: rgba(255,255,255,0.45);
    font-size: 10.5px;
    font-style: italic;
    padding: 5px 10px;
    border-radius: 5px;
    display: inline-flex;
    align-items: center;
    margin: 0 4px 4px 0;
}

/* Driver leaderboard */
.phr-drivers-card { margin-bottom: 14px; }
.phr-driver-list { display: flex; flex-direction: column; gap: 4px; }
.phr-driver-row {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 7px;
    border-left-width: 3px;
}
.phr-driver-row.tone-great { border-left-color: #22c55e; }
.phr-driver-row.tone-good  { border-left-color: rgba(34,197,94,0.55); }
.phr-driver-row.tone-fair  { border-left-color: #fbbf24; background: rgba(251,191,36,0.04); }
.phr-driver-row.tone-bad   { border-left-color: #ef4444; background: rgba(239,68,68,0.05); }

.phr-driver-summary {
    display: grid;
    grid-template-columns: 32px 1fr 60px 240px 80px;
    gap: 12px; align-items: center;
    padding: 9px 14px;
    cursor: pointer; list-style: none;
}
.phr-driver-summary::-webkit-details-marker { display: none; }
.phr-driver-summary::marker { content: ''; }
.phr-driver-row[open] .phr-driver-summary { border-bottom: 1px solid rgba(255,255,255,0.05); }
.phr-driver-rank {
    font-size: 11px; color: rgba(255,255,255,0.35);
    font-family: 'JetBrains Mono', monospace; font-weight: 700;
}
.phr-driver-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.phr-driver-link {
    color: #f8fafc; font-size: 13px; font-weight: 600;
    text-decoration: none;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.phr-driver-link:hover { color: #fbbf24; }
.phr-driver-tid {
    font-size: 10px; color: rgba(255,255,255,0.32);
    font-family: 'JetBrains Mono', monospace;
}
.phr-driver-depot {
    font-size: 10.5px; font-weight: 700;
    color: rgba(255,255,255,0.55);
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.02em;
}
.phr-driver-stats {
    font-size: 11.5px; color: rgba(255,255,255,0.62);
    font-variant-numeric: tabular-nums;
}
.phr-driver-stats strong { color: #f8fafc; }
.phr-driver-missed { color: #fca5a5; font-weight: 700; }
.phr-driver-pct {
    font-size: 16px; font-weight: 800;
    font-variant-numeric: tabular-nums;
    text-align: right; letter-spacing: -0.01em;
}
.phr-pct-great { color: #4ade80; }
.phr-pct-good  { color: #86efac; }
.phr-pct-fair  { color: #fbbf24; }
.phr-pct-bad   { color: #f87171; }

/* Per-driver combos expansion */
.phr-driver-combos {
    padding: 10px 14px 12px 50px;
    background: rgba(0,0,0,0.16);
}
.phr-combos-title {
    font-size: 10px; letter-spacing: 0.06em;
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
    font-weight: 700; margin-bottom: 6px;
}
.phr-combo-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 10px;
    margin: 0 4px 4px 0;
    border-radius: 5px;
    font-size: 11px;
    border-left: 2px solid;
}
.phr-combo-pill.is-bad  { background: rgba(239,68,68,0.07);  border-left-color: #ef4444; }
.phr-combo-pill.is-warn { background: rgba(251,191,36,0.06); border-left-color: #fbbf24; }
.phr-combo-pill-want {
    color: #86efac; font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
}
.phr-combo-pill-arrow {
    color: rgba(255,255,255,0.45);
    font-size: 12px;
}
.phr-combo-pill-did {
    color: #fca5a5; font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
}
.phr-combo-pill-cnt {
    background: rgba(255,255,255,0.10);
    color: #f8fafc;
    padding: 1px 7px; border-radius: 3px;
    font-size: 10.5px; font-weight: 800;
    font-variant-numeric: tabular-nums;
    margin-left: 2px;
}

/* Responsive */
@media (max-width: 900px) {
    .phr-stats-strip { grid-template-columns: repeat(2, 1fr); }
    .phr-driver-summary { grid-template-columns: 28px 1fr 80px; gap: 8px; }
    .phr-driver-depot { grid-column: 2; }
    .phr-driver-stats { grid-column: 1 / -1; padding-left: 36px; font-size: 11px; }
    .phr-driver-pct { grid-row: 1; }
    .phr-upload-form { flex-direction: column; }
    .phr-upload-btn { padding: 12px; }
    .phr-combo-row { flex-direction: column; align-items: flex-start; }
    .phr-combo-cnt { margin-left: 0; }
}

/* ==========================================================================
   CDF (Customer Delivery Feedback) — page (cdf.php)
   --------------------------------------------------------------------------
   Incident-list layout with a cyan/teal accent (distinct from CC green,
   PHR purple, POD blue). Flag strip surfaces driver-fault signals; L1
   category bars; driver leaderboard with per-incident expansion.
   ========================================================================== */

/* Upload card */
.cdf-upload-card { margin-bottom: 14px; }
.cdf-upload-form { display: flex; gap: 12px; align-items: stretch; margin-top: 4px; }
.cdf-upload-drop {
    flex: 1; display: flex;
    border: 1.5px dashed rgba(34,211,238,0.30);
    border-radius: 10px;
    padding: 14px 18px;
    background: rgba(34,211,238,0.04);
    cursor: pointer;
    transition: background 0.14s ease, border-color 0.14s ease;
    position: relative;
}
.cdf-upload-drop:hover { background: rgba(34,211,238,0.08); border-color: rgba(34,211,238,0.50); }
.cdf-upload-drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.cdf-upload-drop-inner { display: flex; align-items: center; gap: 12px; flex: 1; }
.cdf-upload-drop-inner svg { color: #22d3ee; flex-shrink: 0; }
.cdf-upload-drop-title { font-size: 13px; font-weight: 600; color: #f8fafc; display: block; }
.cdf-upload-drop-hint {
    font-size: 11px; color: rgba(255,255,255,0.45);
    display: block; margin-top: 2px;
    font-family: 'JetBrains Mono', monospace;
}
.cdf-upload-btn {
    padding: 0 22px;
    background: linear-gradient(135deg, #22d3ee 0%, #0891b2 100%);
    color: #042f2e;
    border: 0; border-radius: 10px;
    font-size: 13px; font-weight: 700;
    cursor: pointer; font-family: inherit;
    transition: transform 0.08s ease, box-shadow 0.14s ease;
}
.cdf-upload-btn:hover { box-shadow: 0 4px 14px rgba(34,211,238,0.35); }
.cdf-upload-btn:active { transform: translateY(1px); }

.cdf-empty { text-align: center; padding: 40px 20px; }
.cdf-empty h3 { color: rgba(255,255,255,0.70); margin-bottom: 4px; }
.cdf-empty p { color: rgba(255,255,255,0.45); font-size: 13px; }

/* Hero */
.cdf-hero { margin-bottom: 14px; }
.cdf-hero-head {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 18px; margin-bottom: 14px;
}
.cdf-hero-eyebrow {
    font-size: 10px; letter-spacing: 0.14em;
    color: rgba(34,211,238,0.85);
    font-weight: 700; text-transform: uppercase;
    margin-bottom: 4px;
}
.cdf-hero-title {
    font-size: 24px; font-weight: 800;
    color: #f8fafc; letter-spacing: -0.01em; margin: 0;
}
.cdf-hero-sub { font-size: 12px; color: rgba(255,255,255,0.50); margin-top: 4px; }
.cdf-hero-hint {
    color: rgba(255,255,255,0.30); font-size: 10.5px;
    font-style: italic; margin-left: 4px;
}
.cdf-hero-score {
    text-align: right; padding: 4px 16px 4px 20px;
    border-radius: 10px;
    background: rgba(239,68,68,0.10);
    border: 1px solid rgba(239,68,68,0.28);
}
.cdf-hero-score-num {
    font-size: 32px; font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1; letter-spacing: -0.02em;
    color: #f87171;
}
.cdf-hero-score-cap {
    font-size: 10px; color: rgba(255,255,255,0.55);
    letter-spacing: 0.06em; text-transform: uppercase;
    font-weight: 700; margin-top: 6px;
}

/* Flag strip */
.cdf-flags {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 10px; margin-bottom: 14px;
}
.cdf-flag {
    background: rgba(255,255,255,0.025);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px; padding: 11px 14px;
}
.cdf-flag-warn { background: rgba(251,191,36,0.07); border-color: rgba(251,191,36,0.22); }
.cdf-flag-bad  { background: rgba(239,68,68,0.08);  border-color: rgba(239,68,68,0.25); }
.cdf-flag-v {
    font-size: 22px; font-weight: 800; color: #f8fafc;
    font-variant-numeric: tabular-nums; line-height: 1;
}
.cdf-flag-warn .cdf-flag-v { color: #fbbf24; }
.cdf-flag-bad  .cdf-flag-v { color: #f87171; }
.cdf-flag-l { font-size: 11px; color: rgba(255,255,255,0.62); margin-top: 4px; font-weight: 600; }
.cdf-flag-hint { font-size: 9.5px; color: rgba(255,255,255,0.38); margin-top: 2px; font-style: italic; }

/* Week pills (cyan accent) */
.cdf-week-pills { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.cdf-week-pills-label {
    display: inline-flex; align-items: center;
    font-size: 10.5px; color: rgba(255,255,255,0.40);
    font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.06em; margin-right: 4px;
}
.cdf-week-pills-hint {
    font-size: 10.5px; color: rgba(255,255,255,0.30);
    font-style: italic; margin-left: 4px;
}
.cdf-week-pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 5px 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px; color: rgba(255,255,255,0.65);
    font-size: 11px; font-weight: 600;
    text-decoration: none;
    transition: background 0.12s ease, border-color 0.12s ease;
    font-family: 'JetBrains Mono', monospace;
}
.cdf-week-pill:hover { background: rgba(255,255,255,0.06); color: #f8fafc; }
.cdf-week-pill.is-active {
    background: rgba(34,211,238,0.16);
    border-color: rgba(34,211,238,0.40);
    color: #67e8f9;
}
.cdf-week-pill-yr { color: rgba(255,255,255,0.35); font-size: 10px; }
.cdf-week-pill.is-active .cdf-week-pill-yr { color: rgba(103,232,249,0.65); }

/* Export strip */
.cdf-export-strip {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 14px; padding: 10px 14px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 8px;
}
.cdf-export-label {
    font-size: 11px; color: rgba(255,255,255,0.50);
    text-transform: uppercase; letter-spacing: 0.06em;
    font-weight: 700; margin-right: 4px;
}
.cdf-export-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px;
    background: rgba(251,191,36,0.10); color: #fbbf24;
    border: 1px solid rgba(251,191,36,0.22);
    border-radius: 6px;
    font-size: 12px; font-weight: 600; text-decoration: none;
    transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}
.cdf-export-btn:hover {
    background: rgba(251,191,36,0.20);
    border-color: rgba(251,191,36,0.45);
    color: #fcd34d;
}

/* Category bars (L1) */
.cdf-cat-card { margin-bottom: 14px; }
.cdf-bars { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.cdf-bar-row {
    display: grid;
    grid-template-columns: 220px 1fr 70px;
    gap: 12px; align-items: center;
}
.cdf-bar-label { font-size: 12px; color: rgba(255,255,255,0.78); font-weight: 600; }
.cdf-bar-track {
    height: 22px;
    background: rgba(255,255,255,0.03);
    border-radius: 5px;
    overflow: hidden;
}
.cdf-bar-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.3s ease;
    min-width: 2px;
}
.cdf-bar-bad  { background: linear-gradient(90deg, #dc2626, #ef4444); }
.cdf-bar-warn { background: linear-gradient(90deg, #d97706, #fbbf24); }
.cdf-bar-mild { background: linear-gradient(90deg, #475569, #64748b); }
.cdf-bar-val {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.cdf-bar-val strong { font-size: 14px; color: #f8fafc; font-weight: 800; }
.cdf-bar-pct { font-size: 10px; color: rgba(255,255,255,0.40); margin-left: 4px; }

/* L2 reasons collapse */
.cdf-l2-details {
    margin-top: 12px;
    border-top: 1px dashed rgba(255,255,255,0.08);
    padding-top: 10px;
}
.cdf-l2-details summary {
    display: flex; align-items: center; gap: 6px;
    list-style: none; cursor: pointer;
    font-size: 11px; color: rgba(255,255,255,0.55);
    font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.06em; padding: 4px 0;
}
.cdf-l2-details summary::-webkit-details-marker { display: none; }
.cdf-l2-details summary svg { transition: transform 0.15s ease; }
.cdf-l2-details[open] summary svg { transform: rotate(180deg); }
.cdf-l2-details summary:hover { color: #f8fafc; }
.cdf-l2-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 6px; margin-top: 8px;
}
.cdf-l2-item {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px;
    background: rgba(255,255,255,0.02);
    border-radius: 6px;
}
.cdf-l2-cnt {
    font-size: 12px; font-weight: 800; color: #67e8f9;
    font-variant-numeric: tabular-nums;
    min-width: 22px; text-align: right;
}
.cdf-l2-label { font-size: 11px; color: rgba(255,255,255,0.65); }

/* Driver leaderboard */
.cdf-drivers-card { margin-bottom: 14px; }
.cdf-driver-list { display: flex; flex-direction: column; gap: 4px; }
.cdf-driver-row {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 7px;
    border-left-width: 3px;
}
.cdf-driver-row.tone-mild { border-left-color: rgba(148,163,184,0.55); }
.cdf-driver-row.tone-warn { border-left-color: #fbbf24; background: rgba(251,191,36,0.04); }
.cdf-driver-row.tone-bad  { border-left-color: #ef4444; background: rgba(239,68,68,0.05); }

.cdf-driver-summary {
    display: grid;
    grid-template-columns: 32px 1fr 60px auto 110px;
    gap: 12px; align-items: center;
    padding: 9px 14px;
    cursor: pointer; list-style: none;
}
.cdf-driver-summary::-webkit-details-marker { display: none; }
.cdf-driver-summary::marker { content: ''; }
.cdf-driver-row[open] .cdf-driver-summary { border-bottom: 1px solid rgba(255,255,255,0.05); }
.cdf-driver-rank {
    font-size: 11px; color: rgba(255,255,255,0.35);
    font-family: 'JetBrains Mono', monospace; font-weight: 700;
}
.cdf-driver-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cdf-driver-link {
    color: #f8fafc; font-size: 13px; font-weight: 600;
    text-decoration: none;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cdf-driver-link:hover { color: #67e8f9; }
.cdf-driver-tid {
    font-size: 10px; color: rgba(255,255,255,0.32);
    font-family: 'JetBrains Mono', monospace;
}
.cdf-driver-depot {
    font-size: 10.5px; font-weight: 700;
    color: rgba(255,255,255,0.55);
    font-family: 'JetBrains Mono', monospace;
}
.cdf-driver-flags { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.cdf-mini-flag {
    font-size: 9.5px; font-weight: 700;
    padding: 2px 7px; border-radius: 4px;
    white-space: nowrap;
    font-family: 'JetBrains Mono', monospace;
}
.cdf-mini-warn { background: rgba(251,191,36,0.14); color: #fcd34d; border: 1px solid rgba(251,191,36,0.28); }
.cdf-mini-bad  { background: rgba(239,68,68,0.14); color: #fca5a5; border: 1px solid rgba(239,68,68,0.30); }
.cdf-driver-cnt {
    text-align: right;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    display: flex; flex-direction: column; align-items: flex-end;
}
.cdf-driver-cnt { font-size: 18px; }
.cdf-cnt-mild { color: #cbd5e1; }
.cdf-cnt-warn { color: #fbbf24; }
.cdf-cnt-bad  { color: #f87171; }
.cdf-driver-cnt-l {
    font-size: 9px; font-weight: 600;
    color: rgba(255,255,255,0.40);
    text-transform: uppercase; letter-spacing: 0.04em;
    margin-top: 1px;
}

/* Per-incident expansion */
.cdf-feedback-list {
    padding: 8px 14px 12px 50px;
    background: rgba(0,0,0,0.16);
    display: flex; flex-direction: column; gap: 6px;
}
.cdf-fb-item {
    padding: 8px 12px;
    background: rgba(255,255,255,0.02);
    border-radius: 6px;
    border-left: 2px solid rgba(255,255,255,0.10);
}
.cdf-fb-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cdf-fb-cat {
    font-size: 11px; font-weight: 700;
    padding: 2px 8px; border-radius: 4px;
}
.cdf-fb-bad  { background: rgba(239,68,68,0.14); color: #fca5a5; }
.cdf-fb-warn { background: rgba(251,191,36,0.14); color: #fcd34d; }
.cdf-fb-mild { background: rgba(148,163,184,0.14); color: #cbd5e1; }
.cdf-fb-reason { font-size: 11.5px; color: rgba(255,255,255,0.70); }
.cdf-fb-meta {
    display: flex; gap: 12px; flex-wrap: wrap;
    margin-top: 5px;
    font-size: 10.5px; color: rgba(255,255,255,0.45);
}
.cdf-fb-date { font-family: 'JetBrains Mono', monospace; }
.cdf-fb-phr strong { color: rgba(255,255,255,0.70); font-weight: 700; }
.cdf-fb-flags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }

/* Responsive */
@media (max-width: 900px) {
    .cdf-flags { grid-template-columns: repeat(2, 1fr); }
    .cdf-bar-row { grid-template-columns: 130px 1fr 56px; gap: 8px; }
    .cdf-bar-label { font-size: 11px; }
    .cdf-driver-summary { grid-template-columns: 28px 1fr auto; gap: 8px; }
    .cdf-driver-depot, .cdf-driver-flags { display: none; }
    .cdf-upload-form { flex-direction: column; }
    .cdf-upload-btn { padding: 12px; }
    .cdf-feedback-list { padding-left: 20px; }
}

/* ==========================================================================
   DAILY REPORT — export strip (daily_view.php)
   Share the day's report with drivers as PDF / Excel.
   ========================================================================== */
.daily-export-strip {
    display: flex; align-items: center; gap: 10px;
    margin: 0 0 18px; padding: 10px 14px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 8px;
}
.daily-export-label {
    font-size: 11px; color: rgba(255,255,255,0.50);
    text-transform: uppercase; letter-spacing: 0.06em;
    font-weight: 700; margin-right: 4px;
}
.daily-export-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px;
    background: rgba(251,191,36,0.10); color: #fbbf24;
    border: 1px solid rgba(251,191,36,0.22);
    border-radius: 6px;
    font-size: 12px; font-weight: 600; text-decoration: none;
    transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}
.daily-export-btn:hover {
    background: rgba(251,191,36,0.20);
    border-color: rgba(251,191,36,0.45);
    color: #fcd34d;
}
@media (max-width: 720px) {
    .daily-export-strip { flex-wrap: wrap; }
}

/* ==========================================================================
   DSC (Delivery Service Concessions) — page (dsc.php)
   --------------------------------------------------------------------------
   Emerald / money-green accent (distinct from CC green, PHR purple, POD
   blue, CDF cyan, Daily amber). Cost (£) is the headline — hero shows the
   total cost, the bucket chart ranks BY COST, drivers rank BY COST.
   ========================================================================== */

/* Upload card */
.dsc-upload-card { margin-bottom: 14px; }
.dsc-upload-form { display: flex; gap: 12px; align-items: stretch; margin-top: 4px; }
.dsc-upload-drop {
    flex: 1; display: flex;
    border: 1.5px dashed rgba(16,185,129,0.30);
    border-radius: 10px; padding: 14px 18px;
    background: rgba(16,185,129,0.04);
    cursor: pointer; position: relative;
    transition: background 0.14s ease, border-color 0.14s ease;
}
.dsc-upload-drop:hover { background: rgba(16,185,129,0.08); border-color: rgba(16,185,129,0.50); }
.dsc-upload-drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dsc-upload-drop-inner { display: flex; align-items: center; gap: 12px; flex: 1; }
.dsc-upload-drop-inner svg { color: #10b981; flex-shrink: 0; }
.dsc-upload-drop-title { font-size: 13px; font-weight: 600; color: #f8fafc; display: block; }
.dsc-upload-drop-hint {
    font-size: 11px; color: rgba(255,255,255,0.45); display: block; margin-top: 2px;
    font-family: 'JetBrains Mono', monospace;
}
.dsc-upload-btn {
    padding: 0 22px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #022c22; border: 0; border-radius: 10px;
    font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit;
    transition: transform 0.08s ease, box-shadow 0.14s ease;
}
.dsc-upload-btn:hover { box-shadow: 0 4px 14px rgba(16,185,129,0.35); }
.dsc-upload-btn:active { transform: translateY(1px); }

.dsc-empty { text-align: center; padding: 40px 20px; }
.dsc-empty h3 { color: rgba(255,255,255,0.70); margin-bottom: 4px; }
.dsc-empty p { color: rgba(255,255,255,0.45); font-size: 13px; }

/* Hero */
.dsc-hero { margin-bottom: 14px; }
.dsc-hero-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 14px; }
.dsc-hero-eyebrow {
    font-size: 10px; letter-spacing: 0.14em; color: rgba(16,185,129,0.9);
    font-weight: 700; text-transform: uppercase; margin-bottom: 4px;
}
.dsc-hero-title { font-size: 24px; font-weight: 800; color: #f8fafc; letter-spacing: -0.01em; margin: 0; }
.dsc-hero-sub { font-size: 12px; color: rgba(255,255,255,0.50); margin-top: 4px; }
.dsc-hero-sub strong { color: rgba(16,185,129,0.95); font-weight: 700; }
.dsc-hero-hint { color: rgba(255,255,255,0.30); font-size: 10.5px; font-style: italic; margin-left: 4px; }
.dsc-hero-score {
    text-align: right; padding: 6px 18px 6px 22px; border-radius: 10px;
    background: rgba(16,185,129,0.12); border: 1px solid rgba(16,185,129,0.30);
}
.dsc-hero-score-num {
    font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums;
    line-height: 1; letter-spacing: -0.02em; color: #34d399;
}
.dsc-hero-score-cap {
    font-size: 10px; color: rgba(255,255,255,0.55); letter-spacing: 0.06em;
    text-transform: uppercase; font-weight: 700; margin-top: 6px;
}

/* Stat strip */
.dsc-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.dsc-stat { background: rgba(255,255,255,0.025); border: 1px solid rgba(255,255,255,0.06); border-radius: 8px; padding: 11px 14px; }
.dsc-stat-v { font-size: 20px; font-weight: 800; color: #f8fafc; font-variant-numeric: tabular-nums; line-height: 1; }
.dsc-stat-l { font-size: 11px; color: rgba(255,255,255,0.55); margin-top: 5px; font-weight: 600; }

/* Week pills (emerald) */
.dsc-week-pills { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.dsc-week-pills-label {
    display: inline-flex; align-items: center; font-size: 10.5px;
    color: rgba(255,255,255,0.40); font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.06em; margin-right: 4px;
}
.dsc-week-pills-hint { font-size: 10.5px; color: rgba(255,255,255,0.30); font-style: italic; margin-left: 4px; }
.dsc-week-pill {
    display: inline-flex; align-items: center; gap: 4px; padding: 5px 12px;
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px; color: rgba(255,255,255,0.65); font-size: 11px; font-weight: 600;
    text-decoration: none; font-family: 'JetBrains Mono', monospace;
    transition: background 0.12s ease, border-color 0.12s ease;
}
.dsc-week-pill:hover { background: rgba(255,255,255,0.06); color: #f8fafc; }
.dsc-week-pill.is-active { background: rgba(16,185,129,0.16); border-color: rgba(16,185,129,0.40); color: #6ee7b7; }
.dsc-week-pill-yr { color: rgba(255,255,255,0.35); font-size: 10px; }
.dsc-week-pill.is-active .dsc-week-pill-yr { color: rgba(110,231,183,0.65); }

/* Export strip */
.dsc-export-strip {
    display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
    padding: 10px 14px; background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05); border-radius: 8px;
}
.dsc-export-label {
    font-size: 11px; color: rgba(255,255,255,0.50); text-transform: uppercase;
    letter-spacing: 0.06em; font-weight: 700; margin-right: 4px;
}
.dsc-export-btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
    background: rgba(16,185,129,0.10); color: #34d399;
    border: 1px solid rgba(16,185,129,0.22); border-radius: 6px;
    font-size: 12px; font-weight: 600; text-decoration: none;
    transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}
.dsc-export-btn:hover { background: rgba(16,185,129,0.20); border-color: rgba(16,185,129,0.45); color: #6ee7b7; }

/* Bucket bars (by cost) */
.dsc-bucket-card { margin-bottom: 14px; }
.dsc-bars { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.dsc-bar-row { display: grid; grid-template-columns: 200px 1fr 110px; gap: 12px; align-items: center; }
.dsc-bar-label { font-size: 12px; color: rgba(255,255,255,0.78); font-weight: 600; }
.dsc-bar-track { height: 22px; background: rgba(255,255,255,0.03); border-radius: 5px; overflow: hidden; }
.dsc-bar-fill { height: 100%; border-radius: 5px; transition: width 0.3s ease; min-width: 2px; }
.dsc-bar-bad  { background: linear-gradient(90deg, #dc2626, #ef4444); }
.dsc-bar-warn { background: linear-gradient(90deg, #d97706, #fbbf24); }
.dsc-bar-mild { background: linear-gradient(90deg, #059669, #34d399); }
.dsc-bar-val { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dsc-bar-val strong { font-size: 14px; color: #f8fafc; font-weight: 800; }
.dsc-bar-meta { display: block; font-size: 10px; color: rgba(255,255,255,0.40); margin-top: 1px; }

/* Driver leaderboard */
.dsc-drivers-card { margin-bottom: 14px; }
.dsc-driver-list { display: flex; flex-direction: column; gap: 4px; }
.dsc-driver-row {
    background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.06);
    border-radius: 7px; border-left-width: 3px;
}
.dsc-driver-row.tone-mild { border-left-color: rgba(52,211,153,0.55); }
.dsc-driver-row.tone-warn { border-left-color: #fbbf24; background: rgba(251,191,36,0.04); }
.dsc-driver-row.tone-bad  { border-left-color: #ef4444; background: rgba(239,68,68,0.05); }
.dsc-driver-summary {
    display: grid; grid-template-columns: 32px 1fr 60px auto 88px;
    gap: 12px; align-items: center; padding: 9px 14px; cursor: pointer; list-style: none;
}
.dsc-driver-summary::-webkit-details-marker { display: none; }
.dsc-driver-summary::marker { content: ''; }
.dsc-driver-row[open] .dsc-driver-summary { border-bottom: 1px solid rgba(255,255,255,0.05); }
.dsc-driver-rank { font-size: 11px; color: rgba(255,255,255,0.35); font-family: 'JetBrains Mono', monospace; font-weight: 700; }
.dsc-driver-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dsc-driver-link { color: #f8fafc; font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dsc-driver-link:hover { color: #6ee7b7; }
.dsc-driver-tid { font-size: 10px; color: rgba(255,255,255,0.32); font-family: 'JetBrains Mono', monospace; }
.dsc-driver-depot { font-size: 10.5px; font-weight: 700; color: rgba(255,255,255,0.55); font-family: 'JetBrains Mono', monospace; }
.dsc-driver-meta { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.dsc-mini { font-size: 9.5px; font-weight: 700; padding: 2px 7px; border-radius: 4px; white-space: nowrap; font-family: 'JetBrains Mono', monospace; }
.dsc-mini-dpmo { background: rgba(148,163,184,0.14); color: #cbd5e1; border: 1px solid rgba(148,163,184,0.25); }
.dsc-mini-hv { background: rgba(168,85,247,0.16); color: #d8b4fe; border: 1px solid rgba(168,85,247,0.30); }
.dsc-mini-cnt { background: rgba(16,185,129,0.14); color: #6ee7b7; border: 1px solid rgba(16,185,129,0.28); }
.dsc-driver-cost { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; font-size: 16px; }
.dsc-cost-mild { color: #34d399; }
.dsc-cost-warn { color: #fbbf24; }
.dsc-cost-bad  { color: #f87171; }

/* Per-concession expansion */
.dsc-conc-list { padding: 8px 14px 12px 50px; background: rgba(0,0,0,0.16); display: flex; flex-direction: column; gap: 6px; }
.dsc-conc-item { padding: 8px 12px; background: rgba(255,255,255,0.02); border-radius: 6px; border-left: 2px solid rgba(255,255,255,0.10); }
.dsc-conc-main { display: flex; align-items: center; gap: 10px; }
.dsc-conc-bucket { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 4px; }
.dsc-conc-bad  { background: rgba(239,68,68,0.14); color: #fca5a5; }
.dsc-conc-warn { background: rgba(251,191,36,0.14); color: #fcd34d; }
.dsc-conc-mild { background: rgba(52,211,153,0.14); color: #6ee7b7; }
.dsc-conc-cost { margin-left: auto; font-size: 13px; font-weight: 800; color: #f8fafc; font-variant-numeric: tabular-nums; }
.dsc-conc-meta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 5px; font-size: 10.5px; color: rgba(255,255,255,0.45); }
.dsc-conc-wk { font-family: 'JetBrains Mono', monospace; color: rgba(255,255,255,0.60); font-weight: 700; }
.dsc-conc-date { font-family: 'JetBrains Mono', monospace; }
.dsc-conc-flag { color: #fcd34d; font-weight: 600; }
.dsc-conc-flag-hv { color: #d8b4fe; }

/* Responsive */
@media (max-width: 900px) {
    .dsc-stats { grid-template-columns: repeat(2, 1fr); }
    .dsc-bar-row { grid-template-columns: 120px 1fr 88px; gap: 8px; }
    .dsc-bar-label { font-size: 11px; }
    .dsc-driver-summary { grid-template-columns: 28px 1fr auto; gap: 8px; }
    .dsc-driver-depot, .dsc-driver-meta { display: none; }
    .dsc-upload-form { flex-direction: column; }
    .dsc-upload-btn { padding: 12px; }
    .dsc-conc-list { padding-left: 20px; }
}

/* DSC per-week drill-down selector — elegant card tabs, each showing its
   own count + cost; the latest week is gently highlighted. */
.dsc-drill {
    display: flex; flex-wrap: wrap; gap: 7px; align-items: stretch;
    margin-top: 12px; padding-top: 12px;
    border-top: 1px dashed rgba(255,255,255,0.08);
}
.dsc-drill-label {
    display: inline-flex; align-items: center;
    font-size: 10.5px; color: rgba(255,255,255,0.40);
    font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
    margin-right: 2px;
}
.dsc-drill-tab {
    display: flex; flex-direction: column; gap: 2px;
    padding: 7px 14px; min-width: 78px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 9px; text-decoration: none;
    transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
}
.dsc-drill-tab:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.16); }
.dsc-drill-tab.is-active {
    background: rgba(16,185,129,0.15);
    border-color: rgba(16,185,129,0.45);
    box-shadow: inset 0 0 0 1px rgba(16,185,129,0.25);
}
.dsc-drill-tab.is-latest:not(.is-active) { border-color: rgba(110,231,183,0.30); }
.dsc-drill-wk {
    font-size: 13px; font-weight: 800; color: #f8fafc;
    font-family: 'JetBrains Mono', monospace; letter-spacing: -0.01em;
    display: flex; align-items: center; gap: 5px;
}
.dsc-drill-tab.is-active .dsc-drill-wk { color: #6ee7b7; }
.dsc-drill-latest {
    font-size: 8px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.05em; color: #022c22;
    background: #6ee7b7; padding: 1px 5px; border-radius: 4px;
    font-family: -apple-system, sans-serif;
}
.dsc-drill-sub {
    font-size: 10px; color: rgba(255,255,255,0.45);
    font-variant-numeric: tabular-nums;
}
.dsc-drill-tab.is-active .dsc-drill-sub { color: rgba(110,231,183,0.75); }
@media (max-width: 720px) {
    .dsc-drill-tab { min-width: 0; flex: 1 1 calc(33% - 7px); padding: 6px 8px; }
}

/* DSC driver-handout export button — slightly distinct so it's not confused
   with the internal (£) PDF. */
.dsc-export-btn-driver {
    background: rgba(110,231,183,0.12);
    color: #6ee7b7;
    border-color: rgba(110,231,183,0.30);
}
.dsc-export-btn-driver:hover {
    background: rgba(110,231,183,0.22);
    border-color: rgba(110,231,183,0.50);
    color: #a7f3d0;
}

/* Team — per-module upload grant checkboxes (edit-user modal) */
.users-form-hint { font-weight: 400; color: rgba(255,255,255,0.40); font-size: 11px; }
.users-upload-grid {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 6px 14px; margin-top: 8px;
}
.users-upload-opt {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; color: rgba(255,255,255,0.80);
    cursor: pointer; padding: 4px 2px;
}
.users-upload-opt input { accent-color: #22c55e; width: 15px; height: 15px; cursor: pointer; }
.users-upload-note {
    font-size: 11px; color: rgba(255,255,255,0.38);
    margin-top: 8px; font-style: italic;
}

/* ==========================================================================
   Driver profile — cross-module Operations summary (driver.php)
   One tile per module showing the latest week's number, severity-toned,
   linking into the module page. The "flagged in N modules" header line
   is the coaching-priority signal.
   ========================================================================== */
.xm-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 10px;
}
.xm-tile {
    display: block; padding: 11px 14px;
    background: rgba(255,255,255,0.025);
    border: 1px solid rgba(255,255,255,0.07);
    border-left-width: 3px; border-radius: 8px;
    text-decoration: none;
    transition: background 0.12s ease, border-color 0.12s ease;
}
.xm-tile:hover { background: rgba(255,255,255,0.05); }
.xm-tile.xm-ok   { border-left-color: rgba(52,211,153,0.60); }
.xm-tile.xm-warn { border-left-color: #fbbf24; background: rgba(251,191,36,0.04); }
.xm-tile.xm-bad  { border-left-color: #ef4444; background: rgba(239,68,68,0.05); }
.xm-tile-head {
    display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
    font-size: 10.5px; font-weight: 700; color: rgba(255,255,255,0.62);
    text-transform: uppercase; letter-spacing: 0.05em;
}
.xm-wk { font-family: 'JetBrains Mono', monospace; font-size: 9.5px; color: rgba(255,255,255,0.38); text-transform: none; }
.xm-tile-v {
    font-size: 21px; font-weight: 800; color: #f8fafc;
    font-variant-numeric: tabular-nums; margin-top: 6px; line-height: 1;
}
.xm-tile.xm-warn .xm-tile-v { color: #fbbf24; }
.xm-tile.xm-bad  .xm-tile-v { color: #f87171; }
.xm-unit { font-size: 11px; font-weight: 600; color: rgba(255,255,255,0.50); }
.xm-tile-s { font-size: 10.5px; color: rgba(255,255,255,0.45); margin-top: 5px; }

/* ==========================================================================
   Week-over-week trend strip (partials/trend_strip.php)
   Compact CSS bar chart used on CC / POD / PHR / CDF pages. Latest bar is
   accent-coloured; delta badge says better/worse vs last week.
   ========================================================================== */
.wtrend { margin-top: 12px; padding-top: 12px; border-top: 1px dashed rgba(255,255,255,0.08); }
.wtrend-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.wtrend-title {
    font-size: 10.5px; color: rgba(255,255,255,0.40);
    font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
}
.wtrend-delta {
    font-size: 11.5px; font-weight: 800;
    font-variant-numeric: tabular-nums;
    padding: 3px 10px; border-radius: 6px;
}
.wtrend-up   { color: #34d399; background: rgba(52,211,153,0.10); border: 1px solid rgba(52,211,153,0.25); }
.wtrend-down { color: #f87171; background: rgba(239,68,68,0.10); border: 1px solid rgba(239,68,68,0.25); }
.wtrend-flat { color: rgba(255,255,255,0.55); background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.10); }
.wtrend-bars {
    display: flex; align-items: stretch; gap: 6px;
    height: 96px;
}
.wtrend-col {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: flex-end; gap: 4px;
    text-decoration: none; min-width: 0;
    border-radius: 6px; padding: 2px 2px 0;
    transition: background 0.12s ease;
}
.wtrend-col:hover { background: rgba(255,255,255,0.04); }
.wtrend-val {
    font-size: 9.5px; font-weight: 700; color: rgba(255,255,255,0.55);
    font-variant-numeric: tabular-nums; white-space: nowrap;
}
.wtrend-col.is-latest .wtrend-val { color: #f8fafc; font-size: 10px; }
.wtrend-bar {
    width: 100%; max-width: 44px;
    background: rgba(255,255,255,0.14);
    border-radius: 4px 4px 0 0;
    min-height: 5px;
    transition: background 0.12s ease;
}
.wtrend-col:hover .wtrend-bar { background: rgba(255,255,255,0.24); }
.wtrend-wk {
    font-size: 9px; color: rgba(255,255,255,0.35);
    font-family: 'JetBrains Mono', monospace; font-weight: 700;
}
.wtrend-col.is-latest .wtrend-wk { color: rgba(255,255,255,0.70); }
@media (max-width: 720px) {
    .wtrend-bars { height: 72px; }
    .wtrend-val { font-size: 8px; }
}

/* ==========================================================================
   Home — Operations pulse (one tile per module, latest week + WoW delta)
   ========================================================================== */
.ops-pulse-card { margin-top: 14px; }
.ops-pulse-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}
.ops-tile {
    position: relative; display: block; overflow: hidden;
    padding: 12px 14px 10px;
    background: rgba(255,255,255,0.025);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 10px; text-decoration: none;
    transition: background 0.14s ease, border-color 0.14s ease, transform 0.1s ease;
}
.ops-tile::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: var(--ops-accent, #22d3ee); opacity: 0.85;
}
.ops-tile:hover {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.16);
    transform: translateY(-1px);
}
.ops-tile-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ops-tile-label {
    font-size: 10px; font-weight: 800; color: rgba(255,255,255,0.60);
    text-transform: uppercase; letter-spacing: 0.06em;
}
.ops-tile-wk { font-family: 'JetBrains Mono', monospace; font-size: 9.5px; color: rgba(255,255,255,0.36); font-weight: 700; }
.ops-tile-value {
    font-size: 26px; font-weight: 800; color: #f8fafc;
    font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
    line-height: 1; margin-top: 8px;
}
.ops-tile-foot { display: flex; align-items: center; gap: 8px; margin-top: 7px; min-height: 18px; flex-wrap: wrap; }
.ops-tile-delta {
    font-size: 10.5px; font-weight: 800; font-variant-numeric: tabular-nums;
    padding: 2px 7px; border-radius: 5px;
}
.ops-up   { color: #34d399; background: rgba(52,211,153,0.10); }
.ops-down { color: #f87171; background: rgba(239,68,68,0.10); }
.ops-flat { color: rgba(255,255,255,0.50); background: rgba(255,255,255,0.05); }
.ops-tile-sub { font-size: 10px; color: rgba(255,255,255,0.42); }
.ops-tile-spark {
    display: flex; align-items: flex-end; gap: 2px;
    height: 26px; margin-top: 9px;
}
.ops-spark-bar {
    flex: 1; background: rgba(255,255,255,0.12);
    border-radius: 2px 2px 0 0; min-height: 3px;
}
.ops-spark-bar.is-latest { background: var(--ops-accent, #22d3ee); }

/* ==========================================================================
   Home — Coaching priorities (cross-module flagged drivers)
   ========================================================================== */
.ops-coach-card { margin-top: 14px; }
.ops-coach-list { display: flex; flex-direction: column; gap: 6px; }
.ops-coach-row {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 12px; border-radius: 8px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    text-decoration: none;
    transition: background 0.12s ease, border-color 0.12s ease;
}
.ops-coach-row:hover { background: rgba(255,255,255,0.045); border-color: rgba(255,255,255,0.13); }
.ops-coach-sev { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.ops-coach-bad  .ops-coach-sev { background: #ef4444; box-shadow: 0 0 8px rgba(239,68,68,0.55); }
.ops-coach-warn .ops-coach-sev { background: #fbbf24; box-shadow: 0 0 8px rgba(251,191,36,0.40); }
.ops-coach-mild .ops-coach-sev { background: rgba(255,255,255,0.30); }
.ops-coach-name {
    font-size: 13px; font-weight: 700; color: #f1f5f9;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    flex: 0 1 auto; min-width: 120px;
    display: flex; align-items: baseline; gap: 7px;
}
.ops-coach-depot {
    font-family: 'JetBrains Mono', monospace; font-size: 9px;
    color: rgba(255,255,255,0.40); font-weight: 700;
}
.ops-coach-chips { display: flex; gap: 5px; flex-wrap: wrap; flex: 1; min-width: 0; }
.ops-coach-chip {
    font-size: 9.5px; color: rgba(255,255,255,0.62);
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.09);
    padding: 2px 8px; border-radius: 5px; white-space: nowrap;
}
.ops-coach-chip b { color: rgba(255,255,255,0.85); font-weight: 800; margin-right: 2px; }
.ops-coach-count {
    font-size: 10px; font-weight: 800; color: rgba(255,255,255,0.45);
    white-space: nowrap; flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
}
.ops-coach-bad .ops-coach-count { color: #f87171; }
.ops-coach-warn .ops-coach-count { color: #fbbf24; }
@media (max-width: 720px) {
    .ops-coach-row { flex-wrap: wrap; }
    .ops-coach-chips { order: 3; flex-basis: 100%; }
}

/* Home welcome — today's date + current ISO week badge (Amazon weeks!) */
.app-welcome-today {
    display: flex; flex-direction: column; align-items: flex-end; gap: 3px;
    flex: 0 0 auto;
}
.app-welcome-date {
    font-size: 12px; font-weight: 600; color: rgba(255,255,255,0.55);
}
.app-welcome-week {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px; font-weight: 800; color: #6ee7b7;
    background: rgba(16,185,129,0.10);
    border: 1px solid rgba(16,185,129,0.30);
    padding: 3px 11px; border-radius: 7px;
    letter-spacing: 0.02em;
}
@media (max-width: 720px) {
    .app-welcome-today { display: none; }
}

/* ==========================================================================
   Driver Training — admin pages (trainings.php / training_results.php)
   The driver page (t.php) is standalone with its own inline CSS.
   ========================================================================== */
.tr-hero { margin-bottom: 16px; }
.tr-hero-eyebrow { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: #6ee7b7; font-weight: 800; margin-bottom: 4px; }
.tr-hero-title { font-size: 22px; font-weight: 800; letter-spacing: -0.015em; line-height: 1.2; }
.tr-hero-sub { font-size: 12px; color: rgba(255,255,255,0.50); margin-top: 6px; }
.tr-hero-back { color: #6ee7b7; text-decoration: none; font-weight: 700; }
.tr-hero-back:hover { text-decoration: underline; }
.tr-status-draft { color: #fbbf24; }
.tr-status-active { color: #34d399; }
.tr-status-archived { color: rgba(255,255,255,0.40); }

.tr-empty { padding: 18px 6px; color: rgba(255,255,255,0.55); font-size: 13.5px; line-height: 1.6; }
.tr-note { background: rgba(251,191,36,0.08); border: 1px solid rgba(251,191,36,0.25); color: #fcd34d; border-radius: 8px; padding: 9px 13px; font-size: 12.5px; margin-bottom: 12px; }

.tr-btn {
    display: inline-block; padding: 8px 16px; border-radius: 8px;
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.80); font-size: 12.5px; font-weight: 700;
    cursor: pointer; text-decoration: none; font-family: inherit;
    transition: background 0.12s ease, border-color 0.12s ease;
}
.tr-btn:hover { background: rgba(255,255,255,0.09); border-color: rgba(255,255,255,0.22); }
.tr-btn-primary { background: linear-gradient(135deg,#10b981,#059669); border-color: transparent; color: #022c22; }
/* NB: .tr-btn:hover (class+pseudo) outranks .tr-btn-primary (class), so the
   hover state MUST re-assert the gradient or the button goes dark on hover. */
.tr-btn-primary:hover { background: linear-gradient(135deg,#10b981,#059669); border-color: transparent; filter: brightness(1.08); }
.tr-btn-danger { background: rgba(239,68,68,0.10); border-color: rgba(239,68,68,0.30); color: #f87171; }
.tr-btn-danger:hover { background: rgba(239,68,68,0.18); border-color: rgba(239,68,68,0.40); }
.tr-btn-small { padding: 4px 11px; font-size: 11px; }

.tr-form-row { margin-bottom: 12px; }
.tr-form-row label { display: block; font-size: 12px; font-weight: 700; color: rgba(255,255,255,0.65); margin-bottom: 5px; }
.tr-form-hint { font-weight: 400; color: rgba(255,255,255,0.38); font-size: 11px; }
.tr-form-row input[type=text], .tr-form-row input[type=number], .tr-form-row input[type=date],
.tr-form-row textarea, .tr-form-row select {
    background: rgba(0,0,0,0.25); border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px; color: #f1f5f9; padding: 9px 12px; font-size: 13.5px;
    font-family: inherit; width: 100%;
    /* Tell the browser this is a dark UI so NATIVE widgets (select
       dropdown lists, date-picker calendar, spinners) render dark too —
       without this the option list pops up light-grey with our light
       text on top of it: unreadable. */
    color-scheme: dark;
}
.tr-form-row select option { background-color: #111a2c; color: #f1f5f9; }
.tr-form-row-inline { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.tr-form-row-inline label { margin-bottom: 0; }
.tr-form-row-inline input, .tr-form-row-inline select { width: auto; }
.tr-form-row input:focus, .tr-form-row textarea:focus, .tr-form-row select:focus { outline: none; border-color: rgba(52,211,153,0.50); }
.tr-form-actions { margin-top: 6px; display: flex; gap: 9px; }

.tr-tpl-list { display: flex; flex-direction: column; gap: 7px; }
.tr-tpl-row {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; border-radius: 9px; text-decoration: none;
    background: rgba(255,255,255,0.025); border: 1px solid rgba(255,255,255,0.07);
    transition: background 0.12s ease, border-color 0.12s ease;
}
.tr-tpl-row:hover { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.15); }
.tr-tpl-status { font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; padding: 3px 9px; border-radius: 5px; background: rgba(255,255,255,0.06); }
.tr-tpl-title { font-size: 14px; font-weight: 700; color: #f1f5f9; flex: 1; min-width: 0; text-decoration: none; }
.tr-tpl-title:hover { color: #6ee7b7; text-decoration: underline; }
.tr-tpl-meta { font-size: 11px; color: rgba(255,255,255,0.42); white-space: nowrap; }

.tr-q-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.tr-q-row { border: 1px solid rgba(255,255,255,0.07); border-left: 3px solid rgba(52,211,153,0.45); border-radius: 8px; padding: 10px 13px; background: rgba(255,255,255,0.015); }
.tr-q-row.tr-q-cs { border-left-color: rgba(96,165,250,0.55); }
.tr-q-head { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.tr-q-num { font-family: 'JetBrains Mono', monospace; font-size: 9.5px; font-weight: 800; color: rgba(255,255,255,0.40); }
.tr-q-text { font-size: 13px; font-weight: 600; color: #f1f5f9; flex: 1; min-width: 200px; }
.tr-q-type { font-size: 10px; color: rgba(255,255,255,0.40); white-space: nowrap; }
.tr-q-actions { display: flex; gap: 9px; align-items: center; }
.tr-q-actions a { font-size: 11px; color: #6ee7b7; text-decoration: none; font-weight: 700; }
.tr-q-del { background: none; border: 0; color: #f87171; font-size: 11px; font-weight: 700; cursor: pointer; font-family: inherit; padding: 0; }
.tr-q-scenario { font-size: 11.5px; font-style: italic; color: rgba(255,255,255,0.55); background: rgba(96,165,250,0.05); border-radius: 6px; padding: 6px 10px; margin-top: 7px; }
.tr-q-opts { list-style: none; margin-top: 7px; padding: 0; }
.tr-q-opts li { font-size: 11.5px; color: rgba(255,255,255,0.45); padding: 1.5px 0; }
.tr-q-opts li.is-correct { color: #6ee7b7; font-weight: 600; }

.tr-q-form { border-top: 1px dashed rgba(255,255,255,0.10); padding-top: 15px; }
.tr-q-form h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(255,255,255,0.55); margin-bottom: 12px; }
.tr-opt-row { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; }
.tr-opt-row input[type=checkbox] { width: 17px; height: 17px; accent-color: #059669; flex: 0 0 auto; }
.tr-opt-row input[type=text] { flex: 1; }

.tr-form-linkgen { padding-bottom: 14px; border-bottom: 1px dashed rgba(255,255,255,0.10); margin-bottom: 14px; }
.tr-link-list { display: flex; flex-direction: column; gap: 9px; }
.tr-link-row { border: 1px solid rgba(255,255,255,0.07); border-radius: 9px; padding: 11px 13px; background: rgba(255,255,255,0.015); }
.tr-link-row.is-inactive { opacity: 0.55; }
.tr-link-head { display: flex; gap: 9px; align-items: baseline; flex-wrap: wrap; margin-bottom: 7px; }
.tr-link-depot { font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 800; color: #6ee7b7; }
.tr-link-label { font-size: 12px; color: rgba(255,255,255,0.70); font-weight: 600; }
.tr-link-due { font-size: 10px; color: rgba(255,255,255,0.42); }
.tr-link-due.is-overdue { color: #f87171; font-weight: 700; }
.tr-link-off { font-size: 9px; font-weight: 800; text-transform: uppercase; color: #f87171; background: rgba(239,68,68,0.10); padding: 2px 7px; border-radius: 4px; }
.tr-link-url { display: flex; gap: 7px; }
.tr-link-url input {
    flex: 1; background: rgba(0,0,0,0.30); border: 1px solid rgba(255,255,255,0.10);
    border-radius: 7px; color: rgba(255,255,255,0.60); padding: 6px 10px;
    font-size: 11px; font-family: 'JetBrains Mono', monospace;
}
.tr-link-stats { display: flex; gap: 13px; align-items: center; margin-top: 9px; flex-wrap: wrap; }
.tr-stat { font-size: 11px; color: rgba(255,255,255,0.45); }
.tr-stat b { color: #f1f5f9; font-size: 13px; font-variant-numeric: tabular-nums; }

.tr-comp-list { display: flex; flex-direction: column; gap: 6px; }
.tr-comp-row {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 13px; border-radius: 8px; text-decoration: none;
    background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.06);
    transition: background 0.12s ease;
}
.tr-comp-row:hover { background: rgba(255,255,255,0.05); }
.tr-comp-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.tr-comp-dot.is-pass { background: #34d399; }
.tr-comp-dot.is-fail { background: #fbbf24; }
.tr-comp-name { font-size: 13px; font-weight: 700; color: #f1f5f9; flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 7px; }
.tr-comp-tid { font-family: 'JetBrains Mono', monospace; font-size: 9px; color: rgba(255,255,255,0.38); }
.tr-comp-when { font-size: 11px; color: rgba(255,255,255,0.42); white-space: nowrap; }
.tr-comp-score { font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tr-comp-score.is-pass { color: #34d399; }
.tr-comp-score.is-fail { color: #fbbf24; }
.tr-comp-result { font-size: 9px; font-weight: 800; letter-spacing: 0.05em; color: rgba(255,255,255,0.45); }

.tr-score { font-size: 13px; font-weight: 800; padding: 4px 12px; border-radius: 7px; }
.tr-score-pass { background: rgba(52,211,153,0.12); color: #6ee7b7; }
.tr-score-fail { background: rgba(251,191,36,0.10); color: #fcd34d; }
.tr-c-meta { font-size: 12px; color: rgba(255,255,255,0.50); margin-bottom: 14px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }

.tr-a-list { display: flex; flex-direction: column; gap: 8px; }
.tr-a-row { border: 1px solid rgba(255,255,255,0.07); border-left: 3px solid rgba(255,255,255,0.20); border-radius: 8px; padding: 10px 13px; }
.tr-a-row.tr-a-ok { border-left-color: #34d399; }
.tr-a-row.tr-a-bad { border-left-color: #ef4444; background: rgba(239,68,68,0.04); }
.tr-a-row.tr-a-cs { border-left-color: rgba(96,165,250,0.55); }
.tr-a-q { font-size: 13px; font-weight: 600; color: #f1f5f9; }
.tr-a-num { font-family: 'JetBrains Mono', monospace; font-size: 9.5px; color: rgba(255,255,255,0.38); margin-right: 7px; }
.tr-a-verdict { float: right; font-size: 10.5px; font-weight: 800; }
.tr-a-ok .tr-a-verdict { color: #34d399; }
.tr-a-bad .tr-a-verdict { color: #f87171; }
.tr-a-opts { list-style: none; margin-top: 7px; padding: 0; }
.tr-a-opts li { font-size: 12px; color: rgba(255,255,255,0.42); padding: 2px 0; }
.tr-a-opts li.pick-ok { color: #6ee7b7; font-weight: 700; }
.tr-a-opts li.pick-bad { color: #f87171; font-weight: 700; }
.tr-a-opts li.missed { color: #fbbf24; }
.tr-a-tag { font-size: 9px; font-weight: 800; margin-left: 6px; text-transform: uppercase; }
.tr-a-free { font-size: 12.5px; color: rgba(255,255,255,0.70); margin-top: 6px; background: rgba(0,0,0,0.20); border-radius: 7px; padding: 8px 11px; }

.tr-fb { display: flex; flex-direction: column; gap: 10px; }
.tr-fb-item label { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em; color: rgba(255,255,255,0.42); font-weight: 800; margin-bottom: 4px; }
.tr-fb-item p { font-size: 13px; color: rgba(255,255,255,0.78); line-height: 1.55; }

/* Training library — latest completions: training-name column */
.tr-comp-tpl { font-size: 11px; color: rgba(255,255,255,0.45); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; flex: 0 1 auto; }
@media (max-width: 760px) { .tr-comp-tpl { display: none; } }

/* Training — bare textareas inside tr-form (manager notes) were unstyled */
.tr-form > textarea {
    width: 100%; background: rgba(0,0,0,0.25); border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px; color: #f1f5f9; padding: 10px 13px; font-size: 13.5px;
    font-family: inherit; min-height: 96px; resize: vertical;
}
.tr-form > textarea:focus { outline: none; border-color: rgba(52,211,153,0.50); }

/* Training — depot filter chips on Latest completions */
.tr-depot-filter { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 12px; }
.tr-depot-chip {
    font-size: 11px; font-weight: 800; padding: 5px 13px; border-radius: 999px;
    text-decoration: none; color: rgba(255,255,255,0.60);
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.10);
    transition: all 0.12s ease;
}
.tr-depot-chip:hover { background: rgba(255,255,255,0.08); color: #f1f5f9; }
.tr-depot-chip.is-active {
    background: rgba(16,185,129,0.14); border-color: rgba(16,185,129,0.45); color: #6ee7b7;
}

/* Training builder — lesson preview snippet */
.tr-lesson-preview { font-size: 12px; color: rgba(255,255,255,0.50); margin-top: 7px; line-height: 1.55; }

/* Training results — most missed questions */
.tr-miss-list { display: flex; flex-direction: column; gap: 9px; }
.tr-miss-row { display: grid; grid-template-columns: 1fr 160px 46px 80px; gap: 12px; align-items: center; }
.tr-miss-text { font-size: 12.5px; color: rgba(255,255,255,0.78); }
.tr-miss-bar { height: 7px; border-radius: 99px; background: rgba(255,255,255,0.06); overflow: hidden; }
.tr-miss-fill { display: block; height: 100%; border-radius: 99px; }
.tr-miss-bad  { background: linear-gradient(90deg,#ef4444,#f87171); }
.tr-miss-warn { background: linear-gradient(90deg,#f59e0b,#fbbf24); }
.tr-miss-mild { background: linear-gradient(90deg,#10b981,#34d399); }
.tr-miss-pct { font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; }
.tr-miss-bad-t  { color: #f87171; }
.tr-miss-warn-t { color: #fbbf24; }
.tr-miss-mild-t { color: #6ee7b7; }
.tr-miss-n { font-size: 10.5px; color: rgba(255,255,255,0.40); white-space: nowrap; }
.tr-qr-holder { margin-top: 10px; background: #fff; display: inline-block; padding: 12px; border-radius: 10px; }
.tr-qr-tip { font-size: 10px; color: #334155; margin-top: 8px; max-width: 200px; text-align: center; }
@media (max-width: 720px) { .tr-miss-row { grid-template-columns: 1fr 60px; } .tr-miss-bar, .tr-miss-n { display: none; } }

/* Training — closed record badge */
.tr-closed-badge { font-size: 10px; font-weight: 800; letter-spacing: 0.05em; color: #fcd34d; background: rgba(251,191,36,0.10); border: 1px solid rgba(251,191,36,0.30); padding: 3px 10px; border-radius: 6px; margin-left: 10px; }

/* ================================================================
   Training hub — live pulse strip + Live now card (.trh- prefix)
   ================================================================ */
.trh-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; margin-top: 14px; }
.trh-tile {
    background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.018));
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 14px; padding: 14px 16px;
    transition: transform 0.15s ease, border-color 0.15s ease;
}
.trh-tile:hover { transform: translateY(-2px); border-color: rgba(255,255,255,0.18); }
.trh-num {
    font-family: 'JetBrains Mono', monospace; font-size: 26px; font-weight: 800;
    letter-spacing: -0.02em; line-height: 1; color: #f1f5f9;
    font-variant-numeric: tabular-nums;
}
.trh-live-num { color: #34d399; }
.trh-lbl { margin-top: 7px; font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255,255,255,0.42); display: flex; align-items: center; gap: 6px; }
.trh-dot { width: 7px; height: 7px; border-radius: 50%; background: #34d399; display: inline-block; flex: 0 0 auto; position: relative; }
.trh-dot::after { content: ''; position: absolute; inset: -3px; border-radius: 50%; border: 1.5px solid rgba(52,211,153,0.5); animation: trhPing 2s ease-out infinite; }
.trh-dot-lg { width: 9px; height: 9px; margin-right: 7px; }
@keyframes trhPing { 0% { transform: scale(0.8); opacity: 0.9; } 70%, 100% { transform: scale(2); opacity: 0; } }
.trh-live-list { display: flex; flex-direction: column; gap: 8px; }
.trh-live-row { display: grid; grid-template-columns: 14px 180px 1fr 140px 52px 64px; gap: 11px; align-items: center; padding: 9px 4px; border-bottom: 1px dashed rgba(255,255,255,0.06); }
.trh-live-row:last-child { border-bottom: 0; }
.trh-live-name { font-size: 13px; font-weight: 700; color: #f1f5f9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trh-live-name em { color: rgba(255,255,255,0.40); font-style: italic; font-weight: 500; }
.trh-live-tpl { font-size: 11.5px; color: rgba(255,255,255,0.48); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trh-live-bar { height: 6px; border-radius: 99px; background: rgba(255,255,255,0.07); overflow: hidden; }
.trh-live-bar span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #10b981, #34d399); transition: width 0.4s ease; }
.trh-live-prog { font-family: 'JetBrains Mono', monospace; font-size: 11.5px; font-weight: 700; color: #6ee7b7; text-align: right; }
.trh-live-ago { font-size: 10px; color: rgba(255,255,255,0.35); text-align: right; white-space: nowrap; }
@media (max-width: 1100px) { .trh-strip { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 720px) {
    .trh-strip { grid-template-columns: repeat(2, 1fr); }
    .trh-live-row { grid-template-columns: 12px 1fr 60px; }
    .trh-live-tpl, .trh-live-bar, .trh-live-ago { display: none; }
}

@media (prefers-reduced-motion: reduce) { .trh-dot::after { animation: none; } }

/* ===== Training hub: analytics row + tile glow-up ===== */
.trh-tile { position:relative; overflow:hidden; transition:transform 0.15s ease, box-shadow 0.15s ease; }
.trh-tile::before { content:''; position:absolute; top:0; left:0; right:0; height:3px;
    background:linear-gradient(90deg, rgba(52,211,153,0.0), rgba(52,211,153,0.85), rgba(52,211,153,0.0)); opacity:0.55; }
.trh-tile:nth-child(2)::before, .trh-tile:nth-child(6)::before { background:linear-gradient(90deg, transparent, rgba(96,165,250,0.85), transparent); }
.trh-tile:nth-child(5)::before { background:linear-gradient(90deg, transparent, rgba(251,191,36,0.85), transparent); }
.trh-tile:hover { transform:translateY(-2px); box-shadow:0 10px 26px rgba(0,0,0,0.30); }

.trh-an-row { display:grid; grid-template-columns:1.35fr 1fr 1fr; gap:14px; margin-top:14px; }
@media (max-width:1080px) { .trh-an-row { grid-template-columns:1fr; } }
.trh-an-card { padding:16px 18px; }
.trh-an-title { font-size:12px; font-weight:800; letter-spacing:0.08em; text-transform:uppercase;
    color:var(--ink-mid, #94a3b8); margin-bottom:12px; }
.trh-an-svg { width:100%; height:170px; display:block; overflow:visible; }
.trh-an-legend { display:flex; gap:16px; margin-top:8px; font-size:11.5px; color:var(--ink-low, #64748b); }
.trh-an-legend span { display:flex; align-items:center; gap:6px; }
.trh-leg { width:10px; height:10px; border-radius:3px; display:inline-block; }
.trh-leg-pass { background:rgba(52,211,153,0.9); }
.trh-leg-fail { background:rgba(251,191,36,0.75); }
.trh-an-empty { font-size:13px; color:var(--ink-low, #64748b); font-style:italic; padding:6px 0; }

.trh-an-miss { margin-bottom:11px; }
.trh-an-miss:last-child { margin-bottom:0; }
.trh-an-miss-q { font-size:12.5px; color:var(--ink-high, #e2e8f0); line-height:1.35; }
.trh-an-miss-bar { height:5px; border-radius:99px; background:rgba(148,163,184,0.12); margin:5px 0 3px; overflow:hidden; }
.trh-an-miss-bar i { display:block; height:100%; border-radius:99px;
    background:linear-gradient(90deg, #fbbf24, #ef4444); }
.trh-an-miss-meta { font-size:10.5px; color:var(--ink-low, #64748b); }

.trh-an-coach { display:flex; align-items:center; gap:10px; padding:8px 10px; border-radius:9px;
    text-decoration:none; transition:background 0.12s ease; }
.trh-an-coach:hover { background:rgba(148,163,184,0.07); }
.trh-an-coach-name { flex:1; font-size:13px; font-weight:600; color:var(--ink-high, #e2e8f0);
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.trh-an-coach-score { font-size:12px; font-weight:800; color:#fbbf24; }
.trh-an-coach-when { font-size:11px; color:var(--ink-low, #64748b); }

/* ===== Training: load-more + library row delete ===== */
.tr-loadmore-wrap { display:flex; justify-content:center; margin-top:12px; }
.tr-loadmore { min-width:200px; }
.tr-loadmore-count { opacity:0.6; font-weight:600; }
.tr-tpl-row .tr-btn-danger.tr-btn-small { margin-left:6px; }

/* No-station marker on completion rows */
.tr-comp-nodepot { color: rgba(148,163,184,0.55); font-style: italic; }

/* Download CSV button on Latest completions */
.tr-csv-btn { color:#6ee7b7 !important; border:1px solid rgba(52,211,153,0.30); border-radius:7px;
    padding:4px 11px; transition:background 0.12s ease, border-color 0.12s ease; }
.tr-csv-btn:hover { background:rgba(52,211,153,0.10); border-color:rgba(52,211,153,0.55); }
.tr-depot-chip { cursor:pointer; font-family:inherit; }
button.tr-depot-chip { background:transparent; }
