/* OYS theme layer: higher-contrast dark (default) and a light theme, switched by <html data-theme>.
 * Dark tokens were chosen to meet WCAG AA (>= 4.5:1) for body and secondary text on the darkest card (#0d0d16). */
:root, html[data-theme="dark"] {
  --bg: #0f172a; --bg-card: #0d0d16; --bg-card-2: #12121a; --bg-raised: #1e293b; --line: #2a2f45;
  --text: #f1f5f9; --text-2: #d5dbe7; --text-muted: #a3adc2; --text-faint: #8b95ab; --amount: #ffffff;
  --accent: #a78bfa; --link: #c4b5fd;
}
html[data-theme="light"] {
  --bg: #f6f7fb; --bg-card: #ffffff; --bg-card-2: #f1f3f9; --bg-raised: #e9ecf4; --line: #d4d9e6;
  --text: #0f172a; --text-2: #243047; --text-muted: #475569; --text-faint: #5b6577; --amount: #0f172a;
  --accent: #6d28d9; --link: #5b21b6;
  color-scheme: light;
}
/* primary text and links owned by the theme too (also keeps pages readable if the Tailwind CDN is slow) */
html[data-theme] .text-white, html[data-theme] .text-slate-100, html[data-theme] .text-slate-200,
html[data-theme] .mm-row, html[data-theme] a.mm-row, html[data-theme] .oys-sb-row, html[data-theme] .mm-card { color: var(--text); }
html[data-theme] a.mm-row, html[data-theme] a.oys-sb-row { text-decoration: none; }
/* contrast lift for the Tailwind greys the templates use for secondary text (both themes) */
html[data-theme] .text-slate-400 { color: var(--text-2) !important; }
html[data-theme] .text-slate-500 { color: var(--text-muted) !important; }
html[data-theme] .text-slate-600 { color: var(--text-faint) !important; }
html[data-theme] .text-slate-300 { color: var(--text-2) !important; }
html[data-theme] .mm-muted, html[data-theme] .oys-sb-muted, html[data-theme] .mm-pill, html[data-theme] .oys-sb-row-sub,
html[data-theme] .mm-stat span, html[data-theme] .oys-sb-stats span, html[data-theme] .mm-lbl, html[data-theme] .day-head,
html[data-theme] .legend, html[data-theme] .grid-head, html[data-theme] .month-cell .dnum, html[data-theme] .week-col .dnum,
html[data-theme] .more, html[data-theme] .oys-sb-title, html[data-theme] .oys-sb-menu-title { color: var(--text-muted) !important; }
html[data-theme] .amt, html[data-theme] .mm-stat b, html[data-theme] .oys-sb-stats b { color: var(--amount) !important; }
/* light theme: surfaces, borders and primary text */
html[data-theme="light"], html[data-theme="light"] body { background: var(--bg) !important; color: var(--text); }
html[data-theme="light"] .bg-dark-900, html[data-theme="light"] .bg-dark-950, html[data-theme="light"] nav.bg-dark-900\/95 { background-color: #ffffffee !important; }
html[data-theme="light"] .bg-dark-800, html[data-theme="light"] .bg-dark-850, html[data-theme="light"] [class*="bg-[#0d0d16]"],
html[data-theme="light"] [class*="bg-[#12121a]"], html[data-theme="light"] [class*="bg-[#13131f]"], html[data-theme="light"] .bg-dark-800\/60,
html[data-theme="light"] .mm-card, html[data-theme="light"] .mm-row, html[data-theme="light"] .appt-row, html[data-theme="light"] .month-cell,
html[data-theme="light"] .week-col, html[data-theme="light"] .cat-card, html[data-theme="light"] .acct-chip, html[data-theme="light"] .sub-row,
html[data-theme="light"] .oys-sb, html[data-theme="light"] .oys-sb-panel, html[data-theme="light"] .oys-sb-row, html[data-theme="light"] .oys-sb-handle,
html[data-theme="light"] .oys-sb-config, html[data-theme="light"] .oys-sb-cfg-row, html[data-theme="light"] .oys-sb-menu, html[data-theme="light"] .oys-sb-stats > div,
html[data-theme="light"] .plan-card, html[data-theme="light"] .tip-box { background: var(--bg-card) !important; color: var(--text); }
html[data-theme="light"] .mm-field, html[data-theme="light"] .mm-tab, html[data-theme="light"] .view-pill, html[data-theme="light"] .nav-btn,
html[data-theme="light"] .mini-btn, html[data-theme="light"] .chip, html[data-theme="light"] .week-ev, html[data-theme="light"] .oys-sb-ib,
html[data-theme="light"] .cat-chip, html[data-theme="light"] .oys-sb-btn.ghost, html[data-theme="light"] .mm-btn.ghost, html[data-theme="light"] .mm-pill,
html[data-theme="light"] .oys-sb-panel-head .ct, html[data-theme="light"] input, html[data-theme="light"] select, html[data-theme="light"] textarea { background: var(--bg-card-2) !important; color: var(--text) !important; border-color: var(--line) !important; }
html[data-theme="light"] .mm-tab.on, html[data-theme="light"] .view-pill.on { background: #ede9fe !important; color: var(--accent) !important; border-color: var(--accent) !important; }
html[data-theme="light"] .border-slate-800, html[data-theme="light"] .border-slate-700, html[data-theme="light"] .divide-slate-800 > * { border-color: var(--line) !important; }
html[data-theme="light"] .text-white, html[data-theme="light"] .text-slate-100, html[data-theme="light"] .text-slate-200, html[data-theme="light"] .mm-row .text-slate-100,
html[data-theme="light"] .oys-sb-row-main, html[data-theme="light"] .oys-sb-panel-head .nm, html[data-theme="light"] .text-slate-200 { color: var(--text) !important; }
html[data-theme="light"] .text-brand-400, html[data-theme="light"] .text-indigo-300, html[data-theme="light"] .text-emerald-300 { color: var(--accent) !important; }
html[data-theme="light"] .hover\:bg-dark-850:hover, html[data-theme="light"] .hover\:bg-dark-800:hover { background: var(--bg-raised) !important; }
html[data-theme="light"] .mm-coverage { background: #fff7e6 !important; color: #7c4a03 !important; border-color: #f59e0b !important; }
html[data-theme="light"] .mm-coverage-link { color: #92400e !important; }
html[data-theme="light"] .oys-nav-btn { border-color: var(--line); color: var(--text-muted); }
html[data-theme="light"] .oys-nav-btn:hover:not(:disabled) { background: var(--bg-raised); color: var(--text); }
html[data-theme="light"] .mm-bar { background: var(--bg-raised); }
html[data-theme="light"] .oys-sb-panel-body { border-top-color: var(--line); }
