/* ARENA Apple test — dark mode. Only active when <html data-theme="dark"> (the switch in the top bar, theme.js).
   Light mode is untouched. Printed papers (receipt, invoice, card, certificate, print sheets) always stay light.
   To remove it: delete the dark.css and theme.js lines in index.html. */
html[data-theme="dark"] {
  color-scheme: dark;
  --frame: #0E1124;          /* side menu and top bar */
  --frame-step: #1A1F3D;
  --sheet: #13172F;          /* working area */
  --white: #1C2146;          /* cards and other raised surfaces */
  --edge: #2F3663;
  --rule: #272D52;
  --control: #4A5285;
  --ink: #E3E6F6;
  --heading: #F3F4FF;
  --muted: #A6ACCB;
  --blue: #8C97FF;           /* brand blue lifted so it reads on dark */
  --blue-press: #A3ACFF;
  --blue-tint: #232B63;
  --blue-tint-2: #333C82;
  --magenta: #E567AE;
  --ok: #6BD69A; --ok-tint: #173A2A;
  --warn: #F2B24C; --warn-tint: #3A2C12;
  --danger: #FF8478; --danger-tint: #3F1D1B;
  --lift: 0 1px 3px rgb(0 0 0 / .45), 0 6px 18px rgb(0 0 0 / .35);
  --num-bg: #1F2759; --num-edge: #36408A;
  --line: #3E4675; --line-soft: #262C52;
}
html[data-theme="dark"] body { background: var(--frame); color: var(--ink); }

/* raised surfaces that were painted plain white */
html[data-theme="dark"] :is(.card, .done-box, .choice, .person, .bk-day, .cal-main, .mini-cal, .coach-panel, .summary, .table-wrap:has(table), .split > .section, .step-body > .section, .cal-scroll, .cal-month, .cal, .people, .dialog, .dp-pop, .cal-mcell) { background: var(--white); }
html[data-theme="dark"] :is(.table-wrap thead th, table thead th) { background: #20264F; color: var(--muted); }
html[data-theme="dark"] .setup-card { background: var(--blue-tint); border-color: var(--blue-tint-2); }
html[data-theme="dark"] .seg { background: #0F1329; }
html[data-theme="dark"] .input, html[data-theme="dark"] select, html[data-theme="dark"] textarea { background: #141936; color: var(--ink); }
html[data-theme="dark"] .input::placeholder { color: #7F86AC; }
html[data-theme="dark"] .overlay { background: rgb(2 4 16 / .7); }

/* text that sits on a coloured fill stays white */
html[data-theme="dark"] :is(.btn.primary, .nav-h .count, .nav a .count, .top .tool .badge, .lesson.full, .day[aria-pressed="true"], .toast, .week-slot.full, .bottom-nav b, .dp-grid button[aria-pressed="true"], .dp-months button[aria-pressed="true"], .mini-grid button.sel, .cal-dh.today b, .cal-mcell.today > b, .bk-day[aria-pressed="true"], .bk-day[aria-pressed="true"] small, .drag-tip, .xl-tabs button[aria-selected="true"]) { color: #fff; }
html[data-theme="dark"] .day[aria-pressed="true"]::after { color: #fff; }
/* the primary button keeps a deep brand blue so white text reads */
html[data-theme="dark"] .btn.primary { background: #3B47E0; border-color: #3B47E0; }
html[data-theme="dark"] .btn.primary:hover { background: #4E59F0; border-color: #4E59F0; }
html[data-theme="dark"] :is(.mini-grid button.sel, .cal-dh.today b, .cal-mcell.today > b, .bk-day[aria-pressed="true"], .day[aria-pressed="true"]) { background: #3B47E0; border-color: #3B47E0; }
html[data-theme="dark"] .toast { background: #2A3170; box-shadow: 0 12px 30px rgb(0 0 0 / .5); }
html[data-theme="dark"] .btn:not(.primary):not(.quiet):not(.danger):hover { background: var(--blue-tint); }

/* the logo and brand marks turn white on the dark frame */
html[data-theme="dark"] :is(.side .brand img, .brand-sm img, .top img[src*="blue"]) { filter: brightness(0) invert(1); }

/* the schedule calendar: each coach keeps their colour, on a dark card */
html[data-theme="dark"] .cal-ev { background: color-mix(in srgb, var(--c) 30%, #1C2146); box-shadow: none; }
html[data-theme="dark"] .cal-ev.full { background: color-mix(in srgb, var(--c) 50%, #1C2146); }
html[data-theme="dark"] .cal-ev.done { background: color-mix(in srgb, var(--c) 16%, #1C2146); }
html[data-theme="dark"] .cal-ev b { color: color-mix(in srgb, var(--c) 35%, #ffffff); }
html[data-theme="dark"] .cal-ev > span { color: var(--ink); }
html[data-theme="dark"] .cal-ev > .ring { color: var(--muted); }
html[data-theme="dark"] .ev-mark { background: #0E1124; color: color-mix(in srgb, var(--c) 40%, #ffffff); }
html[data-theme="dark"] .cal-chip { background: color-mix(in srgb, var(--c) 30%, #1C2146); color: var(--ink); }
html[data-theme="dark"] .coach-opt.on { background: color-mix(in srgb, var(--c, #8C97FF) 22%, #1C2146); }
html[data-theme="dark"] .cal-col.closed, html[data-theme="dark"] .cal-mcell.other, html[data-theme="dark"] .cal-mcell.closed { background-color: #10142A; }
html[data-theme="dark"] .bk-plan li { background: #20264F; }
html[data-theme="dark"] .bk-plan li.no { background: var(--warn-tint); }
html[data-theme="dark"] .sc-head, html[data-theme="dark"] .cal-mhead { background: #20264F; }

/* printed papers keep their light look on screen, exactly as they print */
html[data-theme="dark"] :is(.print-area, .paper, .receipt, .invoice, .inv-a4, .certificate, .member-card, .sp-sheet, .paper-wrap .doc-lang, .xl-frame) {
  color-scheme: light;
  --frame: #F7F4EC; --frame-step: #EFEBE0; --sheet: #FFFFFF; --white: #FFFFFF;
  --edge: #E4DFD2; --rule: #EEEAE0; --control: #C9C4B5;
  --ink: #1B1F4B; --heading: #06106A; --muted: #545A78;
  --blue: #0000A7; --blue-press: #00007E; --blue-tint: #E9EBFA; --blue-tint-2: #D5D9F5; --magenta: #AB2372;
  --ok: #1B6E3F; --ok-tint: #E5F2EA; --warn: #8A5200; --warn-tint: #FBF0DB; --danger: #A8231B; --danger-tint: #FBE8E6;
  color: var(--ink);   /* papers carry their own dark ink, so their text never takes the dark mode's light colour */
}
html[data-theme="dark"] .paper-wrap { background: #0E1124; }
html[data-theme="dark"] .member-card { color: #fff; }

/* the switch */
.theme-tgl .icon-sun, html[data-theme="dark"] .theme-tgl .icon-moon { display: none; }
html[data-theme="dark"] .theme-tgl .icon-sun { display: inline; }
.theme-tgl svg { width: 20px; height: 20px; vertical-align: middle; }
@media (max-width: 760px) { .theme-tgl .lbl { display: none; } }
html[data-theme="dark"] .sc-grid { --line: #3A4272; --line-soft: #232948; }
html[data-theme="dark"] .cal-hours > span { color: var(--muted); }
html[data-theme="dark"] .coach-dot, html[data-theme="dark"] .sp-key i { box-shadow: 0 0 0 1.5px rgb(255 255 255 / .55); }
html[data-theme="dark"] .cal-ev { border-inline-start-color: color-mix(in srgb, var(--c) 70%, #ffffff); }
/* papers: tables keep dark ink (the page runs in quirks mode, where table text does not inherit) */
html[data-theme="dark"] :is(.print-area, .paper, .receipt, .invoice, .inv-a4, .certificate, .sp-sheet) :is(table, th, td) { color: var(--ink); }
html[data-theme="dark"] .sp-sheet .sp-item b { color: #06106A; }
html[data-theme="dark"] .sp-sheet .sp-item span { color: #22264A; }
html[data-theme="dark"] .sp-sheet .sp-table thead th { background: #E9EBFA; color: #06106A; }
html[data-theme="dark"] .sp-sheet .sp-table .sp-hour, html[data-theme="dark"] .sp-sheet .sp-table .sp-corner { background: #F4F5FB; color: #06106A; }
html[data-theme="dark"] .sp-sheet.bw .sp-table thead th, html[data-theme="dark"] .sp-sheet.bw .sp-hour, html[data-theme="dark"] .sp-sheet.bw .sp-corner { background: #fff; color: #000; }
html[data-theme="dark"] .sp-sheet.bw .sp-item b, html[data-theme="dark"] .sp-sheet.bw .sp-item span { color: #000; }
html[data-theme="dark"] :is(.print-area, .paper) thead th { background: #F6F7FB; color: #545A78; }
html[data-theme="dark"] .inv-a4 .inv-table thead th { background: var(--inv-night); color: #fff; }

/* the Excel preview shows the real file, which is always light */
html[data-theme="dark"] .xl-frame { background: #fff; }
html[data-theme="dark"] .xl-grid { color: #22264A; }

/* login: the brand panel stays deep royal blue with the white logo */
html[data-theme="dark"] .login .art { background: #10157A; color: #fff; }
html[data-theme="dark"] .login .art .pole { box-shadow: inset 0 0 0 1.5px #fff; }

/* Excel window tabs */
html[data-theme="dark"] .xl-tabs button { color: var(--ink); background: #20264F; }
html[data-theme="dark"] .xl-tabs button[aria-selected="true"] { background: #3B47E0; border-color: #3B47E0; color: #fff; }

/* a disabled main button: clearly off, still readable */
html[data-theme="dark"] .btn.primary:disabled { background: #2A3170; border-color: #2A3170; color: #C3C8EA; opacity: 1; }

/* the membership card is a dark-blue card with white writing, in both modes */
html[data-theme="dark"] .member-card.member-card { color: #fff; }

/* the striped pole keeps its real brand colours in dark mode: magenta and white, with the night-blue edge */
html[data-theme="dark"] .pole { --magenta: #AB2372; --white: #FFFFFF; --heading: #06106A; }
html[data-theme="dark"] .pole-steps { --magenta: #AB2372; --white: #FFFFFF; --heading: #06106A; }

/* the page waits for this file before it shows in dark mode (see the style under <title> in index.html) */
html[data-theme="dark"] #root { visibility: visible; }
