/* Dark theme. Loaded after app.css and forms.css so every rule here wins by order, no !important games. */
html[data-theme=dark]{color-scheme:dark}
html[data-theme=dark] body{--text:#e6ecf2;--muted:#9db0c2;--border:#31435a;--light:#1a2634;--bg:#0e1620;--card:#172230;
  --sfst-soft:#12324a;--aride-soft:#3a2a10;--dre-soft:#2c1f45;--admin-soft:#10332a;--green-soft:#123527;--red-soft:#3a1c1c;--amber-soft:#3a2a10;
  --sfst:#4aa3d6;--aride:#e0a03c;--dre:#a684dc;--admin:#3fae8d;--sfst-dk:#2f7fb0;--aride-dk:#b97813;--dre-dk:#7a56b8;--admin-dk:#24866b;--navy:#8fb3d9}
/* home portal + sign-in pages: --p is set on :root as var(--navy) and resolves there, so the dark --navy above never reached it — links stayed navy-on-navy */
html[data-theme=dark] body[data-portal=home]{--p:#8fb3d9;--p-soft:#1a2f45}
html[data-theme=dark] .login .muted,html[data-theme=dark] .login .small{color:#b6c4d3}
html[data-theme=dark] .login a:not(.btn){color:#9ec9ff;text-decoration:underline;text-underline-offset:2px}
html[data-theme=dark] .login .btn.primary{background:#2c5f8f;border-color:#2c5f8f;color:#fff}
/* surfaces */
html[data-theme=dark] .card{background:var(--card);border-color:var(--border)}
html[data-theme=dark] a.card{border-left:4px solid var(--p)}html[data-theme=dark] a.card:hover{border-color:var(--p);background:#1d2b3b}
html[data-theme=dark] .top{background:#121b26;border-bottom-color:var(--border)}
html[data-theme=dark] th{background:#101923}html[data-theme=dark] td{border-bottom-color:#243342}html[data-theme=dark] tr.row:hover td,html[data-theme=dark] tr[data-href]:hover td{background:#1f2e3f}
html[data-theme=dark] input,html[data-theme=dark] select,html[data-theme=dark] textarea{background:#0e1620;color:var(--text);border-color:var(--border)}
html[data-theme=dark] .search{background:#0e1620;border-color:var(--border)}
html[data-theme=dark] .btn{background:#1e2a38;color:var(--text);border-color:#3a4c62}html[data-theme=dark] .btn:hover{background:#26344a}
html[data-theme=dark] .btn.primary{background:var(--p);border-color:var(--p);color:#fff}html[data-theme=dark] .btn.primary:hover{background:var(--p-dk)}
html[data-theme=dark] .btn.danger{background:#2a1717;color:#f0a0a0;border-color:#5a2a2a}html[data-theme=dark] .btn.ghost{background:transparent;border-color:transparent}
html[data-theme=dark] .flash{background:#1d2b3b;border-color:var(--border);color:var(--text)}html[data-theme=dark] .flash.error{background:#3a1c1c;color:#f0a0a0}html[data-theme=dark] .flash.success{background:#123527;color:#8fd7b4}html[data-theme=dark] .flash.warning{background:#3a2a10;color:#f0c070}
html[data-theme=dark] .chip{background:#243342;color:#c6d3e0}
html[data-theme=dark] .chip.ok{background:var(--green-soft);color:#8fd7b4}html[data-theme=dark] .chip.warn{background:var(--amber-soft);color:#f0c070}html[data-theme=dark] .chip.bad{background:var(--red-soft);color:#f0a0a0}
html[data-theme=dark] .chip.sfst{color:#8ccdf0}html[data-theme=dark] .chip.aride{color:#f5c56c}html[data-theme=dark] .chip.dre{color:#cbb3ee}html[data-theme=dark] .chip.admin{color:#8fd7b4}html[data-theme=dark] .chip.p{background:var(--p-soft);color:#fff}
html[data-theme=dark] .tabs a.on{color:var(--p)}html[data-theme=dark] .stat.accent{border-top-color:var(--p)}
html[data-theme=dark] .switch-wrap i{background:#3a4c62}
html[data-theme=dark] .theme-btn{background:#1e2a38;border-color:#3a4c62;color:var(--text)}
html[data-theme=dark] .kbd,html[data-theme=dark] .notice{background:#1d2b3b;color:var(--text);border-color:var(--border)}
/* sidebar: portal color kept, deeper; home stays neutral */
html[data-theme=dark] .side{background:#121b26;border-right-color:var(--border)}
html[data-theme=dark] body[data-portal=home] .nav a{color:var(--text)}html[data-theme=dark] body[data-portal=home] .nav a.on{background:#243342;color:#fff}html[data-theme=dark] body[data-portal=home] .nav a:hover{background:#1e2a38}
html[data-theme=dark] body[data-portal=home] .switch{background:#0e1620}html[data-theme=dark] body[data-portal=home] .switch a.on{background:#243342}
html[data-theme=dark] body:not([data-portal=home]) .side{background:var(--p-dk);border-right:0}
html[data-theme=dark] body:not([data-portal=home]) .side .nav a{color:#fff}html[data-theme=dark] body:not([data-portal=home]) .side .nav a:hover{background:rgba(255,255,255,.12)}
html[data-theme=dark] body:not([data-portal=home]) .side .nav a.on{background:#fff;color:var(--p-dk)}
html[data-theme=dark] body:not([data-portal=home]) .side .switch{background:rgba(0,0,0,.3)}html[data-theme=dark] body:not([data-portal=home]) .side .switch a.on{background:#fff;color:var(--p-dk)}
html[data-theme=dark] .me .menu div{background:#1a2634;border-color:var(--border)}
html[data-theme=dark] .login-shell{background:linear-gradient(160deg,#08131d,#0f2a3a)}
/* legacy form panels from forms.css */
html[data-theme=dark] .panel,html[data-theme=dark] .data-form-section,html[data-theme=dark] .sectioned-form section{background:var(--card);border-color:var(--border);color:var(--text)}
html[data-theme=dark] .section-title,html[data-theme=dark] .subsection-heading,html[data-theme=dark] .data-form-heading{color:var(--text)}
html[data-theme=dark] .status-pill,html[data-theme=dark] .historical-badge{background:#243342;color:var(--text)}

/* legacy form/detail surfaces that were white in the original stylesheet */
html[data-theme=dark] .arresting-officer-suggestions,
html[data-theme=dark] .cert-mini.gold,
html[data-theme=dark] .clue-grid>div:first-child,
html[data-theme=dark] .continue-button,
html[data-theme=dark] .continue-button:hover,
html[data-theme=dark] .dashboard-stats .metric-icon.gold,
html[data-theme=dark] .data-card,
html[data-theme=dark] .drawing-board,
html[data-theme=dark] .drawing-surface,
html[data-theme=dark] .dre-theme .blue,
html[data-theme=dark] .dre-theme .draft-toolbar,
html[data-theme=dark] .dre-theme .form-step-nav a:focus,
html[data-theme=dark] .dre-theme .form-step-nav a:hover,
html[data-theme=dark] .dre-theme .info-message,
html[data-theme=dark] .error-summary,
html[data-theme=dark] .evaluation-choice-card,
html[data-theme=dark] .form-control,
html[data-theme=dark] .form-step-nav,
html[data-theme=dark] .form-step-nav a span,
html[data-theme=dark] .form-step-nav a.current:not(.completed),
html[data-theme=dark] .form-step-nav a.current:not(.completed)>span,
html[data-theme=dark] .gold,
html[data-theme=dark] .measurement-grid>div:first-child,
html[data-theme=dark] .message.error,
html[data-theme=dark] .panel,
html[data-theme=dark] .panel th,
html[data-theme=dark] .purple,
html[data-theme=dark] .rolling-management-table .row-actions,
html[data-theme=dark] .status-pill.closed,
html[data-theme=dark] .status-pill.draft,
html[data-theme=dark] .status-pill.on-call-status.canceled,
html[data-theme=dark] .status-pill.on-call-status.declined,
html[data-theme=dark] .status-pill.on-call-status.no_response,
html[data-theme=dark] .status-pill.on-call-status.waiting,
html[data-theme=dark] .status-pill.pending,
html[data-theme=dark] .status-pill.rejected,
html[data-theme=dark] .submission-options,
html[data-theme=dark] .tox-continue{background:var(--card);color:var(--text);border-color:var(--border)}
html[data-theme=dark] .form-step-nav a,html[data-theme=dark] .form-step-nav li,html[data-theme=dark] .data-only-step-nav a,html[data-theme=dark] .full-step-nav a{color:var(--text)}
html[data-theme=dark] .form-step-nav .active,html[data-theme=dark] .form-step-nav a.active,html[data-theme=dark] .form-step-nav .is-active{background:var(--p-soft);color:#fff}
html[data-theme=dark] .step-number,html[data-theme=dark] .form-step-nav b,html[data-theme=dark] .form-step-nav strong{color:#fff}

/* legacy text colors: normalize to theme tokens */
html[data-theme=dark] .arresting-officer-suggestions button,
html[data-theme=dark] .badge,
html[data-theme=dark] .blue,
html[data-theme=dark] .cert-mini.blue,
html[data-theme=dark] .cert-mini.gold,
html[data-theme=dark] .choice-copy strong,
html[data-theme=dark] .choice-label,
html[data-theme=dark] .continue-button,
html[data-theme=dark] .dashboard-stats .metric-icon.blue,
html[data-theme=dark] .dashboard-stats .metric-icon.gold,
html[data-theme=dark] .dashboard-stats .metric-icon.purple,
html[data-theme=dark] .data-only-step-nav a.completed,
html[data-theme=dark] .data-only-step-nav a.completed>span,
html[data-theme=dark] .drawing-tools .active,
html[data-theme=dark] .dre-theme .blue,
html[data-theme=dark] .error-summary,
html[data-theme=dark] .evaluation-choice-card,
html[data-theme=dark] .form-step-nav a,
html[data-theme=dark] .form-step-nav a span,
html[data-theme=dark] .form-step-nav a.current:not(.completed),
html[data-theme=dark] .form-step-nav a.current:not(.completed)>span,
html[data-theme=dark] .full-step-nav a.completed,
html[data-theme=dark] .full-step-nav a.completed>span,
html[data-theme=dark] .gold,
html[data-theme=dark] .message.error,
html[data-theme=dark] .purple,
html[data-theme=dark] .status-badge,
html[data-theme=dark] .status-pill.approved,
html[data-theme=dark] .status-pill.closed,
html[data-theme=dark] .status-pill.completed,
html[data-theme=dark] .status-pill.delivered,
html[data-theme=dark] .status-pill.draft,
html[data-theme=dark] .status-pill.in_progress,
html[data-theme=dark] .status-pill.on-call-status.assigned,
html[data-theme=dark] .status-pill.on-call-status.canceled,
html[data-theme=dark] .status-pill.on-call-status.completed,
html[data-theme=dark] .status-pill.on-call-status.declined,
html[data-theme=dark] .status-pill.on-call-status.no_response,
html[data-theme=dark] .status-pill.on-call-status.responding,
html[data-theme=dark] .status-pill.on-call-status.waiting,
html[data-theme=dark] .status-pill.open,
html[data-theme=dark] .status-pill.pending,
html[data-theme=dark] .status-pill.planned,
html[data-theme=dark] .status-pill.rejected,
html[data-theme=dark] .status-pill.skipped,
html[data-theme=dark] .status-pill.test_queued,
html[data-theme=dark] .status-pill.viewed,
html[data-theme=dark] .tox-continue{color:var(--text)}
html[data-theme=dark] .arresting-officer-suggestions p,
html[data-theme=dark] .card-heading p,
html[data-theme=dark] .choice-copy>span:last-child,
html[data-theme=dark] .choice-heading>p:last-child,
html[data-theme=dark] .draft-toolbar>div:first-child span,
html[data-theme=dark] .drawing-heading p,
html[data-theme=dark] .field-help,
html[data-theme=dark] .form-step-nav a small,
html[data-theme=dark] .section-title p,
html[data-theme=dark] .submission-copy>p:last-child,
html[data-theme=dark] .support-ticket-form .field-help,
html[data-theme=dark] .support-ticket-form .support-optional{color:var(--muted)}
html[data-theme=dark] .field-help,html[data-theme=dark] .help-text,html[data-theme=dark] .form-help,html[data-theme=dark] .field p,html[data-theme=dark] .field small{color:var(--muted)}
/* status pills (legacy classes) */
html[data-theme=dark] .status-pill,html[data-theme=dark] .status-badge,html[data-theme=dark] [class*="status-pill "],html[data-theme=dark] [class*="status-badge "]{background:#243342;color:#e6ecf2;border-color:#34475c}
html[data-theme=dark] .status-pill.green,html[data-theme=dark] .status-badge.status-complete,html[data-theme=dark] .status-pill.status-completed,html[data-theme=dark] .status-pill.status-assigned{background:#123527;color:#8fd7b4}
html[data-theme=dark] .status-pill.red,html[data-theme=dark] .status-pill.status-no_response,html[data-theme=dark] .status-pill.status-declined,html[data-theme=dark] .status-pill.status-canceled{background:#3a1c1c;color:#f0a0a0}
html[data-theme=dark] .status-pill.gold,html[data-theme=dark] .status-pill.status-waiting,html[data-theme=dark] .status-pill.status-responding,html[data-theme=dark] .status-badge.status-draft{background:#3a2a10;color:#f0c070}
html[data-theme=dark] .status-pill.approved{background:#123527;color:#8fd7b4}html[data-theme=dark] .status-pill.pending,html[data-theme=dark] .status-pill.draft{background:#3a2a10;color:#f0c070}
html[data-theme=dark] .status-pill.rejected,html[data-theme=dark] .status-pill.closed{background:#3a1c1c;color:#f0a0a0}html[data-theme=dark] .status-pill.planned{background:#1d2b3b;color:#c6d3e0}
html[data-theme=dark] .on-call-status.waiting{background:#3a2a10;color:#f0c070}html[data-theme=dark] .on-call-status.responding{background:#12324a;color:#8ccdf0}html[data-theme=dark] .on-call-status.completed,html[data-theme=dark] .on-call-status.assigned,html[data-theme=dark] .recipient-response.accepted,html[data-theme=dark] .delivery-status.delivered,html[data-theme=dark] .delivery-status.sent{background:#123527;color:#8fd7b4}
html[data-theme=dark] .on-call-status.canceled,html[data-theme=dark] .on-call-status.declined,html[data-theme=dark] .on-call-status.no_response,html[data-theme=dark] .recipient-response.declined,html[data-theme=dark] .delivery-status.failed{background:#3a1c1c;color:#f0a0a0}
/* row action menus stay flat in dark mode */
html[data-theme=dark] .act-menu .btn,html[data-theme=dark] .act-menu button,html[data-theme=dark] .act-menu .btn.primary,html[data-theme=dark] .act-menu .btn.danger,html[data-theme=dark] .act-menu button.danger{background:transparent;border:0;box-shadow:none;color:var(--text)}
html[data-theme=dark] .act-menu .btn.primary{color:var(--p)}html[data-theme=dark] .act-menu .btn.danger,html[data-theme=dark] .act-menu button.danger{color:#f08a8a}
html[data-theme=dark] .act-menu .btn:hover,html[data-theme=dark] .act-menu button:hover{background:var(--p-soft);color:var(--p)}
html[data-theme=dark] .choice-icon,html[data-theme=dark] .choice-icon.blue{background:var(--p-soft);color:var(--p)}
html[data-theme=dark] .choice-icon.gold{background:#3a2f12;color:#e6c46a}html[data-theme=dark] .choice-icon.green{background:#193828;color:#aae4c8}

/* sweep: every carried-over container that hard-codes a light background */
html[data-theme=dark] :is(.metric-card,.summary-card,.class-tool-group,.data-card,.dispatch-response-card,.on-call-request-card,.program-note,.phase146-notice,.phase146-report-summary,.instructor-picker,.class-create-user-prompt,.manual-completion-control,.sms-consent-status,.security-check-row,.notification-choice-grid li label,.notification-admin-field li label,.evaluation-choice-card,.form-step-nav,.inservice-completion-grid .data-card,.clue-grid>div:first-child,.measurement-grid>div:first-child,.responsive-card-table tbody tr,.program-user-hero-badges>span:not(.qualification-badge),.login-card){background:var(--card);border-color:var(--border);color:var(--text)}
html[data-theme=dark] :is(.metric-card,.summary-card,.class-tool-group) :is(h3,strong,.class-summary-number,.metric-copy strong){color:var(--text)}
html[data-theme=dark] :is(.metric-card,.class-tool-group) :is(small,p,.metric-copy small){color:var(--muted)}
html[data-theme=dark] :is(.metric-icon,.class-tool-icon,.choice-icon){background:var(--p-soft);color:var(--p)}
html[data-theme=dark] :is(.metric-icon,.class-tool-icon).gold{background:#3a2f12;color:#e6c46a}html[data-theme=dark] :is(.metric-icon,.class-tool-icon).green{background:#193828;color:#aae4c8}
html[data-theme=dark] .message{background:#1a3823;border-color:#2f5a3d;color:#cfe9d6}html[data-theme=dark] .message strong{color:#e6f5ea}
html[data-theme=dark] .message.error{background:#3a1d1d;border-color:#6a2f2f;color:#f3c9c9}
html[data-theme=dark] .message.warning,html[data-theme=dark] .message.info{background:#3a2f12;border-color:#6a561f;color:#f0dfa8}
html[data-theme=dark] :is(.scroll-table thead th,.responsive-management-table thead th,.rolling-management-table thead .action-header,.panel th){background:var(--light);color:var(--muted)}
html[data-theme=dark] :is(.form-control,input[list],input[data-agency-search],select[data-agency-select],.agency-search-input,.iacp-form-panel input:disabled){background:var(--bg);color:var(--text);border-color:var(--border)}
html[data-theme=dark] :is(.arresting-officer-suggestions,.drawing-surface,.student-intake-card){background:var(--card);color:var(--text)}
html[data-theme=dark] .combo-input{color:var(--text)}
html[data-theme=dark] .rows-form .combo-input{background-color:var(--bg);border-color:var(--border)}
/* certification status dots keep solid colours in dark mode */
html[data-theme=dark] .cert-dot{border:0;color:transparent}
html[data-theme=dark] .cert-dot.green{background:#3fbf7f}
html[data-theme=dark] .cert-dot.gold{background:#e6b83a}
html[data-theme=dark] .cert-dot.red{background:#e05c5c}
html[data-theme=dark] .cert-dot.blue{background:var(--p)}
html[data-theme=dark] .state-view-toolbar,html[data-theme=dark] .state-view-toolbar .quick-views-label{background:var(--card);border-color:var(--border);color:var(--muted)}
html[data-theme=dark] .state-view-toolbar .btn{background:var(--bg);border-color:var(--border);color:var(--text)}
html[data-theme=dark] .state-view-toolbar .btn.primary,html[data-theme=dark] .state-view-toolbar .btn.active{background:var(--p);color:#fff;border-color:var(--p)}
html[data-theme=dark] .state-quick-view-nav{background:var(--card);border-color:var(--border)}
html[data-theme=dark] .state-quick-view-nav>span{color:var(--muted)}
html[data-theme=dark] .state-quick-view-nav .btn,html[data-theme=dark] .state-quick-view-nav a{background:var(--bg);border-color:var(--border);color:var(--text)}
html[data-theme=dark] .state-quick-view-nav .btn.primary,html[data-theme=dark] .state-quick-view-nav .active,html[data-theme=dark] .state-quick-view-nav [aria-current]{background:var(--p);border-color:var(--p);color:#fff}
html[data-theme=dark] .source-coverage-note{background:rgba(120,90,180,.16);color:var(--text)}
html[data-theme=dark] .tile-ic.blue{background:#192e38;color:#a4d4ea}html[data-theme=dark] .tile-ic.gold{background:#3a2f12;color:#e6c46a}html[data-theme=dark] .tile-ic.green{background:#193828;color:#aae4c8}
