/* LUNOX Fit Lab — dark theme (Emily, 10 Oct 2026: "allow system to easily swap
   between light and dark mode"). The top-bar button in fitlab.js sets
   html[data-theme="dark"]; everything below is Bedrock's own colour tokens
   given night values, plus the few places Bedrock's stylesheet (bedrock.css,
   read-only) paints white by hand. Light mode is untouched: without the
   attribute none of this applies. */
html[data-theme="dark"] {
  color-scheme: dark;
  /* Contrast lifted on 10 Oct 2026 ("improve dark mode, its hard to read"): brighter
     ink and muted text, a card that stands off the page, lines you can see. */
  --brand: #c08fd6;
  --brand-dark: #a977c0;
  --brand-light: #d0a6e2;
  --brand-tint: #32253d;
  --brand-tint-2: #43324f;
  --bg: #100b15;
  --card: #241b2d;
  --text: #f6f1f9;
  --muted: #c3b6cc;
  --line: #44384f;
  --line-soft: #352b3e;
  --ok: #7fe0a8;      --ok-bg: #1b4a2e;
  --warn: #f6c77a;    --warn-bg: #4a3812;
  --bad: #ff9d94;     --bad-bg: #5a2825;
  --info: #9ccbf7;    --info-bg: #1b3a5c;
  --neutral-bg: #33283e;
  /* Bedrock paints page headings with this gradient as text; the light-mode purples vanish on dark */
  --grad-brand: linear-gradient(135deg, #e6c8f3 0%, #c89bdc 55%, #dcb9ea 100%);
  --shadow: 0 2px 12px rgba(0, 0, 0, .35);
  --shadow-lift: 0 8px 24px rgba(0, 0, 0, .5);
  --accent-teal: #6cc8da;  --accent-teal-bg: #11313a;
  --accent-amber: #f0b860; --accent-amber-bg: #3b2c10;
  --accent-blue: #86bcf2;  --accent-blue-bg: #152c47;
  --mat-latex: #4a4430; --mat-memory: #2c4a2a; --mat-soft: #4a4420; --mat-medium: #3a2a46; --mat-hard: #27394a;
}
/* the ground: a plain dark wash instead of Bedrock's fixed lavender gradient */
html[data-theme="dark"] body { background: var(--bg); color: var(--text); }
/* the logo is deep purple on transparent — lift it to white on the dark rail */
html[data-theme="dark"] .sidebar .logo img, html[data-theme="dark"] .login-card .login-logo { filter: brightness(0) invert(1); opacity: .92; }
/* places bedrock.css paints white or a fixed light colour by hand */
html[data-theme="dark"] input, html[data-theme="dark"] select, html[data-theme="dark"] textarea { background: var(--card); color: var(--text); }
html[data-theme="dark"] input::placeholder, html[data-theme="dark"] textarea::placeholder { color: var(--muted); opacity: .8; }
html[data-theme="dark"] .login-card { background: var(--card); }
html[data-theme="dark"] button.danger, html[data-theme="dark"] .btn.danger { background: var(--card); color: var(--bad); }
html[data-theme="dark"] button.ghost.danger:hover, html[data-theme="dark"] .btn.ghost.danger:hover { background: var(--bad-bg); }
html[data-theme="dark"] .notice.exch-box, html[data-theme="dark"] .notice.fj-box { background: var(--card); }
html[data-theme="dark"] .notice.bad { color: var(--bad); }
html[data-theme="dark"] .kpi-fun .kpi-ic { background: color-mix(in srgb, var(--kt, var(--brand)) 28%, var(--card)); }
html[data-theme="dark"] .topbar .who { background: var(--neutral-bg); }
html[data-theme="dark"] .cal .timecol, html[data-theme="dark"] .cal .slot, html[data-theme="dark"] .cal .slot.today-col { background: var(--card); }
html[data-theme="dark"] .cal .appt.s-completed { background: var(--neutral-bg); color: var(--muted); }
html[data-theme="dark"] .appt-pop { background: var(--card); }
html[data-theme="dark"] .appt-pop .ap-remarks { background: var(--neutral-bg); }
html[data-theme="dark"] .pt-chip.off { background: var(--card); }
html[data-theme="dark"] .soft-btn { background: var(--neutral-bg); color: var(--text); border-color: var(--line); }
html[data-theme="dark"] .modal-backdrop { background: rgba(0, 0, 0, .6); }
html[data-theme="dark"] .sidebar nav a.active { color: #fff; }
/* Fit Lab pieces with their own fixed light colours */
html[data-theme="dark"] .fl-sc-a { background: #3b2c10; color: #f0b860; }
html[data-theme="dark"] .fl-hcol.today { background: var(--brand-tint); }
html[data-theme="dark"] .fl-ob-head { background: linear-gradient(135deg, var(--card) 0%, color-mix(in srgb, var(--brand-tint) 70%, var(--card)) 100%); }
html[data-theme="dark"] .fl-ob-cell.off { background: repeating-linear-gradient(135deg, var(--card), var(--card) 6px, var(--bad-bg) 6px, var(--bad-bg) 12px); }
html[data-theme="dark"] .fl-photos img, html[data-theme="dark"] .fl-heat { border-color: var(--line); }
html[data-theme="dark"] .fl-lightbox { background: rgba(0, 0, 0, .9); }
/* the light-or-dark button itself */
.fl-theme { white-space: nowrap; margin: 0; }
/* a quiet fade when the colours change */
html[data-theme] body, html[data-theme] .card, html[data-theme] .sidebar, html[data-theme] .topbar, html[data-theme] input, html[data-theme] select, html[data-theme] textarea { transition: background-color .18s ease, color .18s ease, border-color .18s ease; }
/* tile and chart accent colours were chosen for white; lift them on the dark card */
html[data-theme="dark"] .kpi-fun .v, html[data-theme="dark"] .fl-chart h3 { color: color-mix(in srgb, var(--kt, var(--brand)) 55%, #fff); }
/* saturated day and group colours were chosen for white paper: lift them where they are ink, deepen them where they are ground */
html[data-theme="dark"] .fl-ob-boxhead .dcount, html[data-theme="dark"] .fl-ob-item .ico, html[data-theme="dark"] .fl-ob-cell.train .dnum, html[data-theme="dark"] .fl-ob-cell .dtag, html[data-theme="dark"] .fl-ob-sub, html[data-theme="dark"] .fl-ob-tools select.has, html[data-theme="dark"] .fl-ob-add svg { color: color-mix(in srgb, var(--c) 55%, #fff); }
html[data-theme="dark"] .fl-ob-gband { color: color-mix(in srgb, var(--g) 62%, #fff); background: color-mix(in srgb, var(--g) 16%, var(--card)); border-bottom-color: color-mix(in srgb, var(--g) 30%, var(--card)); }
html[data-theme="dark"] .fl-ob-boxhead { background: color-mix(in srgb, var(--c) 22%, var(--card)); border-bottom-color: color-mix(in srgb, var(--c) 35%, var(--card)); }
html[data-theme="dark"] .fl-ob-boxhead .dcount { background: color-mix(in srgb, var(--c) 18%, var(--card)); }
html[data-theme="dark"] .fl-ob-box { border-color: color-mix(in srgb, var(--c) 45%, var(--card)); }
html[data-theme="dark"] .fl-ob-item .ico { background: color-mix(in srgb, var(--c) 30%, var(--card)); }
html[data-theme="dark"] .fl-ob-item { border-bottom-color: color-mix(in srgb, var(--c) 22%, var(--card)); }
html[data-theme="dark"] .fl-ob-cell.train { background: color-mix(in srgb, var(--c) 28%, var(--card)); border-color: color-mix(in srgb, var(--c) 70%, #fff); }
html[data-theme="dark"] .fl-ob-pill { background: var(--neutral-bg); border-color: var(--line); color: var(--text); }
html[data-theme="dark"] .fl-ob-avatar { background: var(--brand-tint-2); border-color: var(--brand); }
html[data-theme="dark"] .fl-ob-tools select, html[data-theme="dark"] .fl-ob-add input { color: var(--text); }
html[data-theme="dark"] .fl-ob-tools select { border-color: var(--line); }
html[data-theme="dark"] .fl-ob-add { border-color: color-mix(in srgb, var(--c) 55%, var(--card)); }
html[data-theme="dark"] .fl-sec-sub, html[data-theme="dark"] .fl-note, html[data-theme="dark"] .muted, html[data-theme="dark"] label { color: var(--muted); }
html[data-theme="dark"] th { color: var(--muted); }
html[data-theme="dark"] .badge { color: var(--text); }
html[data-theme="dark"] .br-chip { color: var(--muted); border-color: var(--line); }
html[data-theme="dark"] .br-chip.on, html[data-theme="dark"] .tab-chip.on { color: #fff; }
html[data-theme="dark"] .fl-bar { background: var(--brand-tint-2); }
html[data-theme="dark"] .fl-bar i { background: var(--brand); }
/* the rail and the top bar: Bedrock paints them white by hand (a gradient and a frosted bar) */
html[data-theme="dark"] .sidebar { background: var(--card); border-right-color: var(--line); }
html[data-theme="dark"] .topbar { background: color-mix(in srgb, var(--card) 88%, transparent); border-bottom-color: var(--line); }
html[data-theme="dark"] .sidebar nav a { color: var(--muted); }
html[data-theme="dark"] .sidebar nav a.active { background: linear-gradient(135deg, #7a3a92 0%, #5a2470 60%, #4a1d5c 100%); color: #fff; box-shadow: 0 4px 12px rgba(0, 0, 0, .4); }
html[data-theme="dark"] .sidebar .foot { color: var(--muted); border-top-color: var(--line); }
html[data-theme="dark"] .sidebar .sub.fl-sub, html[data-theme="dark"] .sidebar .brandname { color: var(--brand); }
html[data-theme="dark"] .topbar .pagetitle { color: var(--text); }
html[data-theme="dark"] .fl-subnav .br-chip { background: var(--card); }
html[data-theme="dark"] .br-chip.on.tab-chip { background: #6a2d80; border-color: #6a2d80; color: #fff; }
