/* Dark mode for every Class45 portal (primary, secondary and college). Turned on by <html data-theme="dark">,
   which the light/dark button sets (saved in the browser) or the device setting chooses. */

/* The theme button (shown in the top bar) */
.theme-toggle { cursor: pointer; }
.theme-toggle .ico-sun, [data-theme=dark] .theme-toggle .ico-moon { display: none; }
[data-theme=dark] .theme-toggle .ico-sun { display: block; }
.nav-toggle { background: rgba(255,255,255,.14); color: #fff; border: 0; width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center; }
.nav-toggle:hover { background: rgba(255,255,255,.24); }

html[data-theme=dark] {
  color-scheme: dark;
  --bg: #08141b;
  --card: rgba(19, 33, 44, .82);
  --surface: #13212c;
  --surface-2: #182a37;
  --text: #e5edf1;
  --muted: #94a7b2;
  --border: rgba(255, 255, 255, .09);
  --shadow: 0 1px 3px rgba(0, 0, 0, .35);
  --glass: rgba(10, 22, 31, .66);
}

/* Gradient background: the school's colour fading into deep navy */
[data-theme=dark] body {
  background: linear-gradient(155deg, color-mix(in srgb, var(--primary) 45%, #050d13) 0%, #08161d 42%, #0a1526 100%) fixed;
  color: var(--text);
}
[data-theme=dark] .admin-body { background: linear-gradient(160deg, color-mix(in srgb, var(--primary) 70%, #04121a) 0%, color-mix(in srgb, var(--primary) 25%, #061019) 55%, #070f1d 100%) fixed; }
[data-theme=dark] .ad-main { background: var(--glass); backdrop-filter: blur(6px); }
[data-theme=dark] .ad-nav a.active { background: var(--glass); color: #fff; }
[data-theme=dark] .ad-nav a.active::before, [data-theme=dark] .ad-nav a.active::after { box-shadow: none; display: none; }
[data-theme=dark] .ad-title, [data-theme=dark] .ad-me-txt strong, [data-theme=dark] .legend b, [data-theme=dark] .tt-name { color: var(--text); }
[data-theme=dark] .ad-burger { color: var(--text); }
[data-theme=dark] .ad-search input { background: rgba(255,255,255,.07); color: var(--text); }
[data-theme=dark] .ad-search input:focus { background: rgba(255,255,255,.1); }
[data-theme=dark] .ad-icon-btn, [data-theme=dark] .ad-bell { background: rgba(255,255,255,.08); color: var(--text); }
[data-theme=dark] .ad-avatar { background: color-mix(in srgb, var(--primary) 35%, #0b1820); color: #fff; }

/* Surfaces */
[data-theme=dark] .card, [data-theme=dark] .panel, [data-theme=dark] .prog-card, [data-theme=dark] .prog-hero,
[data-theme=dark] .vac-panel, [data-theme=dark] .bill-card, [data-theme=dark] .steps a, [data-theme=dark] .steps span,
[data-theme=dark] .demo-pick, [data-theme=dark] .pagination a, [data-theme=dark] .footer, [data-theme=dark] .report-card {
  background: var(--card); border-color: var(--border); color: var(--text); box-shadow: 0 6px 24px rgba(0,0,0,.25);
}
[data-theme=dark] .footer { box-shadow: none; }
[data-theme=dark] .class-form, [data-theme=dark] .preview-box, [data-theme=dark] .bank-kv, [data-theme=dark] .howtopay,
[data-theme=dark] .checklist a, [data-theme=dark] .bill-actions details form, [data-theme=dark] .tt-day,
[data-theme=dark] .font-preview, [data-theme=dark] .bill-actions summary, [data-theme=dark] .tabs-inline a,
[data-theme=dark] .grade-head button.chip, [data-theme=dark] .quick-fees button, [data-theme=dark] .logo-preview {
  background: var(--surface-2); color: var(--text); border-color: var(--border);
}
[data-theme=dark] .demo-pick:hover, [data-theme=dark] .act:hover, [data-theme=dark] tr:hover td { background: rgba(255,255,255,.04); }
[data-theme=dark] .ov-ring img, [data-theme=dark] .ov-ring span { background: var(--surface); border-color: var(--surface); }
[data-theme=dark] .donut-val { fill: var(--text); }
[data-theme=dark] .chart-line .grid { stroke: rgba(255,255,255,.08); }

/* Tables and lines */
[data-theme=dark] th, [data-theme=dark] .admin-body th { background: rgba(255,255,255,.04); color: var(--muted); }
[data-theme=dark] td, [data-theme=dark] th { border-color: var(--border); }
[data-theme=dark] .table-clean th, [data-theme=dark] .table-clean td, [data-theme=dark] .ov-donuts, [data-theme=dark] .glance li,
[data-theme=dark] .tabs-inline, [data-theme=dark] .pay-item, [data-theme=dark] .method-bars div, [data-theme=dark] .bill-lines td,
[data-theme=dark] .tt-cell, [data-theme=dark] .tt-cell.hour { border-color: var(--border); }
[data-theme=dark] .inv-totals .inv-due, [data-theme=dark] .bill-lines tr.is-total td { border-top-color: var(--text); }
[data-theme=dark] .split-bar, [data-theme=dark] .bar, [data-theme=dark] .gb-track, [data-theme=dark] .fee-progress,
[data-theme=dark] .vac-bar, [data-theme=dark] .tracker .t-step::after { background: rgba(255,255,255,.08); }

/* Forms and buttons */
[data-theme=dark] input:not([type=checkbox]):not([type=radio]):not([type=range]), [data-theme=dark] select, [data-theme=dark] textarea {
  background: rgba(255,255,255,.05); color: var(--text); border-color: rgba(255,255,255,.14);
}
[data-theme=dark] select option { background: var(--surface); color: var(--text); }
[data-theme=dark] .btn-outline { background: transparent; color: var(--text); border-color: rgba(255,255,255,.2); }
[data-theme=dark] .btn-ghost { color: color-mix(in srgb, var(--primary) 45%, #fff); border-color: rgba(255,255,255,.18); }
[data-theme=dark] .btn-ghost:hover { background: rgba(255,255,255,.06); }
[data-theme=dark] main a:not(.btn):not(.stat-tile):not(.prog-card),
[data-theme=dark] .ad-content a:not(.btn):not(.stat-tile):not(.prog-card):not(.btn-ghost) { color: color-mix(in srgb, var(--primary) 40%, #fff); }
[data-theme=dark] .footer a { color: color-mix(in srgb, var(--primary) 40%, #fff); }
[data-theme=dark] .target-cards label, [data-theme=dark] .pay-tabs > label { border-color: rgba(255,255,255,.14); background: transparent; color: var(--text); }
[data-theme=dark] .target-cards input:checked + label { background: color-mix(in srgb, var(--primary) 22%, transparent); }
[data-theme=dark] code { background: rgba(255,255,255,.08); color: var(--text); }

/* Status colours on dark */
[data-theme=dark] .alert-success, [data-theme=dark] .notice-green, [data-theme=dark] .checklist a.ok, [data-theme=dark] .balance-pill.ok, [data-theme=dark] .steps .done a { background: rgba(34,197,94,.12); border-color: rgba(34,197,94,.3); color: #86efac; }
[data-theme=dark] .alert-error, [data-theme=dark] .notice-red, [data-theme=dark] .vac-card.is-full, [data-theme=dark] .row-del { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.3); color: #fca5a5; }
[data-theme=dark] .alert-warning, [data-theme=dark] .notice-amber, [data-theme=dark] .setup { background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.3); color: #fcd34d; }
[data-theme=dark] .alert-info, [data-theme=dark] .notice-blue { background: rgba(59,130,246,.12); border-color: rgba(59,130,246,.3); color: #93c5fd; }
[data-theme=dark] .badge-gray { background: rgba(255,255,255,.08); color: #cbd5e1; }
[data-theme=dark] .badge-blue { background: rgba(59,130,246,.18); color: #93c5fd; }
[data-theme=dark] .badge-amber, [data-theme=dark] .chip-amber { background: rgba(245,158,11,.18); color: #fcd34d; }
[data-theme=dark] .badge-orange { background: rgba(249,115,22,.18); color: #fdba74; }
[data-theme=dark] .badge-green, [data-theme=dark] .chip-green, [data-theme=dark] .grade-head button.chip-green { background: rgba(34,197,94,.18); color: #86efac; }
[data-theme=dark] .badge-red { background: rgba(239,68,68,.18); color: #fca5a5; }
[data-theme=dark] .act-ico { background: color-mix(in srgb, var(--c) 22%, transparent); }
[data-theme=dark] .tt-li { background: color-mix(in srgb, var(--c) 16%, transparent); }
[data-theme=dark] .vac-num, [data-theme=dark] .text-green, [data-theme=dark] .bill-lines tr.is-discount td { color: #4ade80; }

/* Printing always uses light colours */
@media print {
  [data-theme=dark] body, [data-theme=dark] .admin-body, [data-theme=dark] .ad-main { background: #fff !important; color: #111 !important; }
  [data-theme=dark] .card, [data-theme=dark] .panel, [data-theme=dark] .report-card { background: #fff !important; color: #111 !important; box-shadow: none !important; }
}
[data-theme=dark] .rc-summary > div { border-color: var(--border); }

/* Demo sign-in role cards */
[data-theme=dark] .demo-pick { box-shadow: none; background: rgba(255,255,255,.03); }
[data-theme=dark] .demo-pick:hover { border-color: color-mix(in srgb, var(--primary) 60%, #fff); }
[data-theme=dark] .demo-pick.is-picked { border-color: color-mix(in srgb, var(--primary) 60%, #fff); box-shadow: inset 3px 0 0 color-mix(in srgb, var(--primary) 60%, #fff); }
