/* Matte presentation layer. :root gives these theme rules priority over legacy module colours. Kept after the legacy structural sheets (including generated dark.css).
   Theme tokens are shared by every screen; layout, dialog semantics and release gates stay in their modules. */
html:root[data-theme] {
  --m-bg:#f5f1e9;
  --m-surface:#fffcf6;
  --m-subtle:#eaece1;
  --m-ink:#293d33;
  --m-muted:#56665c;
  --m-line:#d5dcd0;
  --m-accent:#356654;
  --m-accent-hover:#28513f;
  --m-accent-soft:#dce9d5;
  --m-on-accent:#fff;
  --m-inverse:#254e43;
  --m-inverse-text:#f4f5e9;
  --m-inverse-muted:#ceddca;
  --m-hero:#dbe8db;
  --m-sand:#f1e5d2;
  --m-teal:#2b716b;--m-teal-soft:#e2eee8;
  --m-clay:#8d5139;--m-clay-soft:#f2e4d9;
  --m-honey:#80642a;--m-honey-soft:#f1ead3;
  --m-sage:#4c6b39;--m-sage-soft:#e5edd9;
  --navy:var(--m-ink);--navy-2:var(--m-accent);--cyan:var(--m-accent);
  --cyan-soft:var(--m-accent-soft);--yellow:var(--m-accent-soft);--yellow-soft:var(--m-subtle);
  --paper:var(--m-bg);--paper-2:var(--m-surface);--white:var(--m-surface);
  --ink:var(--m-ink);--muted:var(--m-muted);--line:var(--m-line);
  --success:#426549;--danger:#a83b35;
  --shadow:0 12px 40px #18231714;--shadow-soft:none;--radius:12px;
  background:var(--m-bg);color:var(--m-ink);color-scheme:light;
}
html:root[data-theme="dark"] {
  --m-bg:#182824;--m-surface:#233a32;--m-subtle:#2c453a;
  --m-ink:#edf1e9;--m-muted:#c0d1c5;--m-line:#456252;
  --m-accent:#bdd497;--m-accent-hover:#d0e1b3;--m-accent-soft:#3b533b;
  --m-on-accent:#213422;--m-inverse:#294f43;--m-inverse-text:#f4f5e9;
  --m-inverse-muted:#ceddca;--success:#b5d69b;--danger:#ffb2a4;
  --m-hero:#335a49;--m-sand:#4a4030;
  --m-teal:#98d3c4;--m-teal-soft:#294d43;
  --m-clay:#efb69b;--m-clay-soft:#4d3b31;
  --m-honey:#e3ce89;--m-honey-soft:#48432e;
  --m-sage:#b7d38f;--m-sage-soft:#384c30;
  --dk-text:var(--m-ink);--shadow:0 12px 40px #0003;
  color-scheme:dark;
}
html:root[data-theme] body { background:var(--m-bg);color:var(--m-ink);letter-spacing:0; }
html:root[data-theme] body ::selection { background:var(--m-accent);color:var(--m-on-accent); }
html:root[data-theme] body :is(h1,h2,h3,h4,h5) { font-weight:650;letter-spacing:-.035em; }
html:root[data-theme] body :is(button,input,textarea,select) { box-shadow:none; }
html:root[data-theme] body :is(button,a,input,textarea,select,summary):focus-visible { outline:2px solid var(--m-accent);outline-offset:4px; }
html:root[data-theme] body :is(input,textarea,select) { background:var(--m-surface);color:var(--m-ink);border:1px solid var(--m-line);border-radius:8px; }
html:root[data-theme] body :is(input,textarea,select):focus { border-color:var(--m-accent);box-shadow:none; }
html:root[data-theme] body :is(select option,select optgroup) { background:var(--m-surface);color:var(--m-ink); }
html:root[data-theme] body label { color:var(--m-muted); }
html:root[data-theme] body .eyebrow { color:var(--m-muted);font-weight:650;letter-spacing:.13em;font-size:.6875rem; }
html:root[data-theme] body :is(.primary,.secondary,.hero-ghost,.coach-log) { border-radius:8px;min-height:44px;padding:11px 18px;font-weight:650;transition:background .15s,color .15s;border:1px solid transparent; }
html:root[data-theme] body .primary { background:var(--m-accent);color:var(--m-on-accent);box-shadow:none; }
html:root[data-theme] body .primary:hover { background:var(--m-accent-hover);color:var(--m-on-accent);transform:none;box-shadow:none; }
html:root[data-theme] body .secondary { background:var(--m-subtle);border-color:var(--m-line);color:var(--m-ink); }
html:root[data-theme] body .secondary:hover { background:var(--m-accent-soft);transform:none; }
html:root[data-theme] body :is(.text-button,.icon-button) { color:var(--m-accent); }
html:root[data-theme] body :is(.segmented,.method-row,.training-tabs) { border-radius:9px;background:var(--m-subtle);border:1px solid var(--m-line);box-shadow:none; }
html:root[data-theme] body :is(.segmented,.method-row) button { border-radius:6px;background:transparent;color:var(--m-muted);min-height:44px; }
html:root[data-theme] body :is(.segmented,.method-row) button.active { background:var(--m-surface);color:var(--m-ink);box-shadow:0 1px 3px #15251312; }
html:root[data-theme] body .dk-logo { filter:none;display:block;object-fit:contain; }
html:root[data-theme] body .mobile-brand { display:none; }

/* A quiet, stationary frame. The active destination uses a line and weight, with no coloured icon tile. */
html:root[data-theme] body .app-shell { grid-template-columns:236px minmax(0,1fr); }
html:root[data-theme] body .sidebar { width:236px;padding:32px 20px 20px;background:var(--m-bg);border-inline-end:1px solid var(--m-line);color:var(--m-ink); }
html:root[data-theme] body .sidebar::before { display:none; }
html:root[data-theme] body .logo { margin:0 10px 46px;color:var(--m-ink);gap:11px; }
html:root[data-theme] body .logo .dk-logo { width:44px;height:44px; }
html:root[data-theme] body .logo strong { font-size:1.04rem;font-weight:700;letter-spacing:-.04em; }
html:root[data-theme] body .logo small { color:var(--m-muted);font-size:.56rem;letter-spacing:.22em; }
html:root[data-theme] body .sidebar nav { gap:5px; }
html:root[data-theme] body .nav-item { color:var(--m-muted);border-radius:6px;padding:11px 12px;gap:10px;min-height:48px; }
html:root[data-theme] body .nav-item:hover { background:var(--m-subtle);color:var(--m-ink);transform:none; }
html:root[data-theme] body .nav-item.active { color:var(--m-ink);background:var(--m-accent-soft);box-shadow:inset 2px 0 var(--m-accent); }
html:root[data-theme] body .nav-item span { background:transparent;color:inherit; }
html:root[data-theme] body .nav-item b { font-size:.8125rem;font-weight:600; }
html:root[data-theme] body .sidebar-workout { background:var(--m-surface);border:1px solid var(--m-line);border-radius:9px;color:var(--m-ink); }
html:root[data-theme] body .sidebar-workout>span { background:var(--m-accent-soft);color:var(--m-accent);border-radius:6px; }
html:root[data-theme] body .sidebar-workout small { color:var(--m-muted); }
html:root[data-theme] body .sidebar-foot { border-color:var(--m-line); }
html:root[data-theme] body .sidebar-foot :is(.text-button,.language-select) { color:var(--m-muted); }
html:root[data-theme] body .content { padding:28px clamp(24px,4vw,64px) 80px;max-width:1480px;min-width:0; }
html:root[data-theme] body .topbar { border-bottom:1px solid var(--m-line);padding-bottom:22px;margin-bottom:24px;gap:16px; }
html:root[data-theme] body .topbar h1 { color:var(--m-ink);font-size:2rem;font-weight:600;letter-spacing:-.045em;margin-top:7px; }
html:root[data-theme] body .page-heading .eyebrow { color:var(--m-muted); }
html:root[data-theme] body .top-start { background:transparent;border:1px solid var(--m-line);color:var(--m-ink);border-radius:8px;padding:8px 12px; }
html:root[data-theme] body .top-start span { width:25px;height:25px;background:var(--m-subtle);color:var(--m-accent);border-radius:5px; }
html:root[data-theme] body .avatar { background:var(--m-accent-soft);border:1px solid var(--m-line);color:var(--m-ink);border-radius:50%;width:40px;height:40px;box-shadow:none; }
html:root[data-theme] body .view-section { animation:none; }

/* Today's recommendation is a compact note. A chosen scene keeps its natural colour as a small desktop detail. */
html:root[data-theme] body .coach-card { background:var(--m-hero);color:var(--m-ink);min-height:0;align-items:center;padding:28px 30px;border:1px solid var(--m-line);border-radius:12px;box-shadow:none;margin-bottom:16px; }
html:root[data-theme] body .coach-card::after { inset:16px 16px 16px auto;width:23%;border-radius:6px;background:var(--scene,url('/images/donekind-fitness-hero-v1.webp')) center/cover no-repeat;filter:saturate(.65);opacity:.6; }
html:root[data-theme] body .coach-card.scene-calm::after { display:none; }
html:root[data-theme] body .coach-copy { max-width:72%; }
html:root[data-theme] body .coach-header { display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:12px; }
html:root[data-theme] body .coach-status { background:transparent;border:0;padding:0;backdrop-filter:none;border-radius:0;color:var(--m-muted);font-size:.65rem;letter-spacing:.12em; }
html:root[data-theme] body .coach-status i { background:var(--m-accent);box-shadow:none;width:5px;height:5px; }
html:root[data-theme] body .coach-card h3 { color:var(--m-ink);font-size:clamp(1.45rem,1.1rem + 1.1vw,2rem);line-height:1.18;font-weight:600;letter-spacing:-.035em;margin:14px 0 10px; }
html:root[data-theme] body .coach-card p { color:var(--m-muted);max-height:none;overflow:visible; }
html:root[data-theme] body .coach-actions { margin-top:20px;flex-wrap:wrap; }
html:root[data-theme] body .coach-actions button { border-radius:7px;min-height:44px;font-size:.8125rem; }
html:root[data-theme] body .coach-actions .primary { background:var(--m-accent);color:var(--m-on-accent); }
html:root[data-theme] body .coach-log { background:transparent;color:var(--m-ink);border-color:var(--m-line);backdrop-filter:none; }
html:root[data-theme] body .streak-chip { position:static;inset:auto;display:inline-flex;align-items:center;flex-wrap:wrap;gap:6px;min-width:0;max-width:100%;width:fit-content;padding:6px 8px;border:1px solid var(--m-line);background:var(--m-surface);color:var(--m-ink);border-radius:6px;backdrop-filter:none; }
html:root[data-theme] body .streak-chip :is(span,small) { color:var(--m-muted);background:transparent; }
html:root[data-theme] body .streak-chip span { display:inline;width:auto;height:auto; }
html:root[data-theme] body .streak-chip strong { font-size:1.1rem;font-weight:650; }
html:root[data-theme] body .hero-grid { grid-template-columns:minmax(0,1.6fr) minmax(260px,.8fr);gap:16px; }
html:root[data-theme] body :is(.calorie-card,.quick-card,.chart-card,.form-card,.profile-card,.active-program-card,.daily-nutrition-card,.goal-card,.achievement,.exercise-card,.stat) { background:var(--m-surface);color:var(--m-ink);border:1px solid var(--m-line);border-radius:12px;box-shadow:none; }
html:root[data-theme] body .calorie-card { min-height:230px;padding:26px;gap:26px; }
html:root[data-theme] body .ring { width:150px;height:150px;flex-shrink:0;background:conic-gradient(var(--m-teal) var(--progress),var(--m-subtle) 0); }
html:root[data-theme] body .ring::before { inset:7px;background:var(--m-surface); }
html:root[data-theme] body .ring strong { color:var(--m-ink);font-size:2.5rem;font-weight:550;font-variant-numeric:tabular-nums;letter-spacing:-.05em; }
html:root[data-theme] body .ring :is(span,b) { color:var(--m-muted); }
html:root[data-theme] body .ring b { font-size:.6875rem;font-weight:500; }
html:root[data-theme] body .calorie-copy :is(p,small) { color:var(--m-muted); }
html:root[data-theme] body .calorie-copy h3 { color:var(--m-ink);font-size:1.5rem;font-weight:600;line-height:1.25; }
html:root[data-theme] body .quick-card { padding:24px;background:var(--m-sand); }
html:root[data-theme] body .quick-card h3 { color:var(--m-ink);font-weight:600; }
html:root[data-theme] body .quick-card .eyebrow { color:var(--m-muted); }
html:root[data-theme] body .quick-action { border-top:1px solid var(--m-line);color:var(--m-ink);padding:12px 0; }
html:root[data-theme] body .quick-action:hover { background:var(--m-subtle);padding-inline:4px; }
html:root[data-theme] body .quick-action small { color:var(--m-muted); }
html:root[data-theme] body .macro-grid { gap:0;margin:16px 0 24px;border:1px solid var(--m-line);border-radius:10px;overflow:hidden;background:var(--m-surface); }
html:root[data-theme] body .macro-card { --macro-color:var(--m-teal);--macro-tint:var(--m-teal-soft);background:var(--macro-tint);border:0;border-inline-end:1px solid var(--m-line);border-radius:0;box-shadow:none;padding:18px; }
html:root[data-theme] body .macro-card:last-child { border-inline-end:0; }
html:root[data-theme] body .macro-card::before { display:none; }
html:root[data-theme] body .macro-card .top { color:var(--m-muted);font-weight:550; }
html:root[data-theme] body .macro-card strong { color:var(--macro-color);font-weight:600;font-variant-numeric:tabular-nums; }
html:root[data-theme] body :is(.bar,.goal-bar,.nutrient-meter) { height:3px;background:var(--m-subtle); }
/* The fixed dashboard order is protein, carbohydrate, fat, steps. Keep names/values as well as colour. */
html:root[data-theme] body .macro-card:nth-child(2) { --macro-color:var(--m-clay);--macro-tint:var(--m-clay-soft); }
html:root[data-theme] body .macro-card:nth-child(3) { --macro-color:var(--m-honey);--macro-tint:var(--m-honey-soft); }
html:root[data-theme] body .macro-card:nth-child(4) { --macro-color:var(--m-sage);--macro-tint:var(--m-sage-soft); }
html:root[data-theme] body .macro-card .bar i { background:var(--macro-color); }
html:root[data-theme] body .rhythm-strip { background:transparent;border:0;border-block:1px solid var(--m-line);border-radius:0;box-shadow:none;padding:18px 0;gap:20px; }
html:root[data-theme] body .rhythm-day { color:var(--m-muted); }
html:root[data-theme] body .rhythm-day i { background:var(--m-subtle);color:var(--m-muted);border-radius:5px; }
html:root[data-theme] body .rhythm-day.today i { background:var(--m-accent);color:var(--m-on-accent);box-shadow:none; }
html:root[data-theme] body .rhythm-link { color:var(--m-accent); }
html:root[data-theme] body .section-head { margin:28px 0 16px;flex-wrap:wrap; }
html:root[data-theme] body .section-head :is(h3,.eyebrow) { color:var(--m-ink); }
html:root[data-theme] body .section-head>div { min-width:0;max-width:100%; }
html:root[data-theme] body .section-head>button { max-width:100%;white-space:normal; }
html:root[data-theme] body .meal-actions { flex-wrap:wrap;min-width:0; }
html:root[data-theme] body .section-head h3 { font-size:1.3rem;font-weight:600; }
html:root[data-theme] body :is(.meal-card,.workout-row,.planned-row,.wellbeing-note) { background:var(--m-surface);border:1px solid var(--m-line);border-radius:9px;box-shadow:none; }
html:root[data-theme] body :is(.meal-card,.workout-row):hover { background:var(--m-surface);border-color:var(--m-accent);transform:none; }
html:root[data-theme] body :is(.meal-icon,.workout-icon,.exercise-glyph,.quick-icon,.achievement>span) { background:var(--m-subtle);color:var(--m-accent);border-radius:7px; }
html:root[data-theme] body .empty-state { background:transparent;border:1px dashed var(--m-line);color:var(--m-muted);border-radius:9px;padding:32px; }
html:root[data-theme] body .ai-notice { background:var(--m-subtle);border:1px solid var(--m-line);border-radius:9px;color:var(--m-ink); }
html:root[data-theme] body .ai-notice-icon { background:var(--m-accent-soft);color:var(--m-accent); }

/* Training, coaching and progress use the same restrained hierarchy. */
html:root[data-theme] body :is(.training-hero,.progress-intro) { min-height:0;padding:28px 30px;background:var(--m-subtle);color:var(--m-ink);border:1px solid var(--m-line);border-radius:12px;box-shadow:none; }
html:root[data-theme] body :is(.training-hero,.progress-intro)::before,
html:root[data-theme] body :is(.training-hero,.progress-intro)::after,
html:root[data-theme] body .training-hero-word { display:none; }
html:root[data-theme] body :is(.training-hero,.progress-intro) .eyebrow { color:var(--m-muted); }
html:root[data-theme] body :is(.training-hero,.progress-intro) h3 { color:var(--m-ink);font-size:clamp(1.6rem,1.2rem + 1.1vw,2.15rem);font-weight:600;line-height:1.18; }
html:root[data-theme] body .training-hero { background:var(--m-sand); }
html:root[data-theme] body .progress-intro { background:var(--m-teal-soft); }
html:root[data-theme] body .training-hero p { color:var(--m-muted); }
html:root[data-theme] body .hero-ghost { background:transparent;color:var(--m-ink);border-color:var(--m-line); }
html:root[data-theme] body .progress-orbit { background:var(--m-accent-soft);color:var(--m-accent);border-radius:8px; }
html:root[data-theme] body .stat strong { color:var(--m-ink);font-weight:600; }
html:root[data-theme] body .training-tabs button { border-radius:6px;font-weight:600;color:var(--m-muted); }
html:root[data-theme] body .training-tabs button[aria-selected="true"] { background:var(--m-surface);color:var(--m-ink);box-shadow:0 1px 3px #15251312; }
html:root[data-theme] body .active-program-card { background:var(--m-hero);color:var(--m-ink); }
html:root[data-theme] body .active-program-card::after { display:none; }
html:root[data-theme] body .active-program-card :is(p,.eyebrow) { color:var(--m-muted); }
html:root[data-theme] body .active-program-card .primary { background:var(--m-accent);color:var(--m-on-accent); }
html:root[data-theme] body .program-grid { gap:12px; }
html:root[data-theme] body .program-card { min-height:180px;align-content:start;padding:24px;background:var(--m-surface);color:var(--m-ink);border:1px solid var(--m-line);border-radius:10px;box-shadow:none; }
html:root[data-theme] body .program-card::after { display:none; }
html:root[data-theme] body .program-card:hover { transform:none;border-color:var(--m-accent);box-shadow:none; }
html:root[data-theme] body .program-card h4 { color:var(--m-ink);font-size:1.2rem;font-weight:600; }
html:root[data-theme] body .program-card p { max-width:100%;color:var(--m-muted); }
html:root[data-theme] body :is(.tag,.tag.accent) { background:var(--m-subtle);color:var(--m-muted);border:1px solid var(--m-line);border-radius:4px;backdrop-filter:none;font-weight:600; }
html:root[data-theme] body :is(.program-open,.goal-card header strong,.history-best) { color:var(--m-accent); }
html:root[data-theme] body .exercise-tools { background:transparent;border-color:var(--m-line);border-radius:9px; }
html:root[data-theme] body .exercise-card:hover { background:var(--m-subtle);transform:none; }
html:root[data-theme] body .chip-row button { background:var(--m-subtle);color:var(--m-ink); }
html:root[data-theme] body .chip-row button.active { background:var(--m-accent);color:var(--m-on-accent); }
html:root[data-theme] body :is(.daily-coach-card,.coach-data-note,.coach-profile-card,.profile-group,.plan-card,.progress-board) { background:var(--m-surface);border:1px solid var(--m-line);border-radius:10px;box-shadow:none; }
html:root[data-theme] body :is(.daily-nutrition-head,.profile-group) .eyebrow { color:var(--m-muted); }
html:root[data-theme] body :is(.daily-nutrition-card,.profile-card,.form-card,.chart-card) { padding:24px; }
html:root[data-theme] body :is(.nutrient-group,.nutrition-item-detail) { background:var(--m-surface);border:1px solid var(--m-line);border-radius:8px; }
html:root[data-theme] body :is(.nutrient-rows,.nutrient-row,.detail-nutrient-group p) { border-color:var(--m-line); }
html:root[data-theme] body :is(.source-proof,.photo-area,.live-previous) { background:var(--m-subtle);color:var(--m-ink);border-color:var(--m-line); }
html:root[data-theme] body .source-proof small { color:var(--m-muted); }
html:root[data-theme] body .profile-save-bar { background:var(--m-surface);border-color:var(--m-line);box-shadow:none; }

/* Dialogs stay solid and readable without frosted glass or oversized rounding. */
html:root[data-theme] body :is(.modal,.calendar-dialog) { background:var(--m-surface);color:var(--m-ink);border:1px solid var(--m-line);border-radius:12px;box-shadow:var(--shadow); }
html:root[data-theme] body :is(.modal,.calendar-dialog)::backdrop { background:#101b13a6;backdrop-filter:none; }
html:root[data-theme] body .modal-head h3 { color:var(--m-ink);font-weight:600; }
html:root[data-theme] body :is(.draft-item,.analysis-basis,.base-row,.portion-card) { background:var(--m-surface);border-color:var(--m-line);border-radius:8px; }
html:root[data-theme] body :is(.estimate-banner,.analysis-basis.selected) { background:var(--m-subtle);border:1px solid var(--m-line);color:var(--m-ink); }
html:root[data-theme] body .draft-total { background:var(--m-inverse);color:var(--m-inverse-text);border-radius:8px; }
html:root[data-theme] body .quick-tray { background:var(--m-surface);border-color:var(--m-line); }
html:root[data-theme] body .quick-filters .chip[aria-pressed="true"],
html:root[data-theme] body .quick-row.picked .quick-mark { background:var(--m-accent);border-color:var(--m-accent);color:var(--m-on-accent); }
html:root[data-theme] body .toast { background:var(--m-inverse);color:var(--m-inverse-text);box-shadow:var(--shadow);border-radius:8px; }
html:root[data-theme] body .live-workout-dialog { background:var(--m-surface);color:var(--m-ink); }
html:root[data-theme] body :is(.live-topbar,.live-queue,.live-summary) { background:var(--m-inverse);color:var(--m-inverse-text);border-color:#ffffff26; }
html:root[data-theme] body .live-title small { color:var(--m-inverse-muted); }
html:root[data-theme] body .live-discard { background:var(--m-inverse);color:var(--m-inverse-text);border-color:#ffffff59;border-radius:8px;opacity:1; }
html:root[data-theme] body :is(.queue-head,.queue-add,.live-summary small,.live-summary label span) { color:var(--m-inverse-muted); }
html:root[data-theme] body :is(.live-summary>div,.live-summary label) { background:#ffffff08;border-color:#ffffff26;border-radius:8px; }
html:root[data-theme] body .live-summary textarea { background:transparent;color:var(--m-inverse-text);border-color:#ffffff40; }
html:root[data-theme] body input[type="range"] { accent-color:var(--m-accent); }

html:root[data-theme] body .live-stage { background:var(--m-surface); }
html:root[data-theme] body :is(.metric-card,.timer-metric,.workout-complete-card) { background:var(--m-surface);color:var(--m-ink);border:1px solid var(--m-line);border-radius:10px;box-shadow:none; }
html:root[data-theme] body :is(.live-finish,.complete-set,.rest-controls .skip-rest,.complete-mark) { background:var(--m-accent);color:var(--m-on-accent);box-shadow:none;border-radius:8px; }
html:root[data-theme] body :is(.live-progress,.active-program-card .goal-bar) { background:var(--m-line); }
html:root[data-theme] body :is(.live-progress i,.active-program-card .goal-bar i) { background:var(--m-accent); }
html:root[data-theme] body .queue-item.active { background:#b2c3a4;color:#1c291e; }
html:root[data-theme] body .queue-item.active .queue-number { background:#26332a;color:#f0f3e9; }
html:root[data-theme] body .live-rpe button.active { background:var(--m-accent);color:var(--m-on-accent);border-color:var(--m-accent); }
html:root[data-theme] body .floating-add { background:var(--m-accent);color:var(--m-on-accent);border-radius:8px;box-shadow:0 3px 12px #18231720; }
html:root[data-theme] body .floating-add span { background:transparent;color:inherit; }
html:root[data-theme] body .bottom-nav { background:var(--m-surface);border:1px solid var(--m-line);border-radius:10px;backdrop-filter:none;box-shadow:0 3px 15px #18231712; }
html:root[data-theme] body .bottom-nav button { color:var(--m-muted);border-radius:6px; }
html:root[data-theme] body .bottom-nav button.active { background:var(--m-accent-soft);color:var(--m-ink); }

/* Match link/fold accents even when the generated dark sheet is loaded after a theme change. */
html:root[data-theme] body :is(.view-section,.sidebar,.auth-card,.modal) .text-button:not(.danger-text),
html:root[data-theme] body .view-section :is(.fold-toggle,.show-all,.android-check summary) { color:var(--m-accent); }
html:root[data-theme] body .training-intro .eyebrow { color:var(--m-muted); }
html:root[data-theme] body .nutrient-tab { background:var(--m-surface);color:var(--m-muted);border-color:var(--m-line);border-radius:8px; }
html:root[data-theme] body .nutrient-tab.active { background:var(--m-accent);color:var(--m-on-accent);border-color:var(--m-accent); }
html:root[data-theme] body .nutrient-tab.active :is(span,small) { color:var(--m-on-accent);opacity:1; }


/* Sign-in: typography and a softly coloured photograph, with room around the form. */
html:root[data-theme] body .auth-shell { background:var(--m-bg);grid-template-columns:minmax(0,1.1fr) minmax(400px,.9fr);padding:32px;gap:32px; }
html:root[data-theme] body .brand-panel { background:var(--m-inverse);color:var(--m-inverse-text);padding:40px;min-height:calc(100dvh - 64px);border-radius:8px; }
html:root[data-theme] body .brand-panel::after { inset:auto 32px 32px auto;width:30%;height:26%;background:url('/images/donekind-fitness-hero-v1.webp') 62% center/cover;filter:saturate(.7);opacity:.7;border-radius:3px; }
html:root[data-theme] body .auth-brand .dk-logo { width:48px;height:48px; }
html:root[data-theme] body .auth-brand strong { font-size:1.25rem;font-weight:650; }
html:root[data-theme] body .auth-brand span { color:var(--m-inverse-muted);font-weight:500;letter-spacing:.2em; }
html:root[data-theme] body .auth-story { max-width:620px;margin:auto 0;padding:56px 0; }
html:root[data-theme] body .auth-story .eyebrow { color:var(--m-inverse-muted);font-weight:500; }
html:root[data-theme] body .auth-story h1 { color:var(--m-inverse-text);font-weight:500;font-size:clamp(2.6rem,4.2vw,4.5rem);line-height:1.08;letter-spacing:-.055em;margin-bottom:24px; }
html:root[data-theme] body .auth-story>p:last-child { color:var(--m-inverse-muted);font-size:.9375rem;max-width:500px; }
html:root[data-theme] body .auth-proof { grid-template-columns:1fr;gap:12px;max-width:62%; }
html:root[data-theme] body .auth-proof .promise { border-color:#ffffff29;gap:14px;padding-top:12px; }
html:root[data-theme] body .auth-proof .promise :is(span,p) { color:var(--m-inverse-muted);font-weight:500;line-height:1.6; }
html:root[data-theme] body .auth-visual-note { display:none; }
html:root[data-theme] body .auth-card { padding:30px 0;max-width:380px;width:100%;justify-self:center;margin:0;background:transparent;border:0;box-shadow:none; }
html:root[data-theme] body .auth-card .auth-heading { color:var(--m-ink);font-size:1.6rem;font-weight:600;letter-spacing:-.04em; }
html:root[data-theme] body .auth-card .segmented { border-radius:8px; }
html:root[data-theme] body .auth-card .segmented button { border-radius:5px; }
html:root[data-theme] body .auth-card input { background:var(--m-surface); }
html:root[data-theme] body .auth-card label span { color:var(--m-muted);font-size:.6875rem;font-weight:600;letter-spacing:.08em; }
html:root[data-theme] body .auth-card .wide { background:var(--m-accent);color:var(--m-on-accent);border-radius:8px; }
html:root[data-theme] body .auth-card .wide:hover { background:var(--m-accent-hover);box-shadow:none; }
html:root[data-theme] body :is(.auth-legal,.auth-copyright) { color:var(--m-muted); }
html:root[data-theme] body .auth-legal a,html:root[data-theme] body .auth-card>#authLanguage { color:var(--m-ink); }
html:root[data-theme] body .boot-splash { background:var(--m-bg);color:var(--m-ink); }

@media(max-width:1120px) {
  html:root[data-theme] body .app-shell { grid-template-columns:210px minmax(0,1fr); }
  html:root[data-theme] body .sidebar { width:210px;padding-inline:14px; }
  html:root[data-theme] body .content { padding-inline:24px; }
  html:root[data-theme] body .hero-grid { grid-template-columns:1fr; }
  html:root[data-theme] body .auth-shell { grid-template-columns:minmax(0,1fr) minmax(350px,1fr);padding:20px;gap:28px; }
  html:root[data-theme] body .brand-panel { padding:30px;min-height:calc(100dvh - 40px); }
}
@media(max-width:820px) {
  html:root[data-theme] body .app-shell { display:block; }
  html:root[data-theme] body .content { padding:20px 16px 180px;max-width:720px;margin:auto; }
  html:root[data-theme] body .mobile-brand { display:flex;align-items:center;gap:9px;width:fit-content;max-width:100%;min-height:44px;margin-bottom:18px;color:var(--m-ink);text-decoration:none; }
  html:root[data-theme] body .mobile-brand .dk-logo { width:36px;height:36px; }
  html:root[data-theme] body .mobile-brand>span { display:grid;gap:2px; }
  html:root[data-theme] body .mobile-brand strong { font-size:.875rem;letter-spacing:-.03em;line-height:1.2; }
  html:root[data-theme] body .mobile-brand small { font-size:.5rem;letter-spacing:.2em;color:var(--m-muted); }
  html:root[data-theme] body .topbar { padding-bottom:16px;margin-bottom:18px; }
  html:root[data-theme] body .topbar h1 { font-size:1.65rem; }
  html:root[data-theme] body .coach-card { padding:24px; }
  html:root[data-theme] body .coach-copy { max-width:100%; }
  html:root[data-theme] body .coach-card::after { display:none; }
  html:root[data-theme] body .coach-status { max-width:100%; }
  html:root[data-theme] body .coach-card h3 { margin-top:14px;font-size:1.65rem; }
  html:root[data-theme] body .streak-chip span { display:none; }
  html:root[data-theme] body .coach-actions { gap:8px; }
  html:root[data-theme] body .hero-grid { gap:12px; }
  html:root[data-theme] body .calorie-card { min-height:200px;padding:22px;gap:20px; }
  html:root[data-theme] body .ring { width:126px;height:126px; }
  html:root[data-theme] body .ring strong { font-size:2rem; }
  html:root[data-theme] body .calorie-copy h3 { font-size:1.25rem; }
  html:root[data-theme] body .quick-card { padding:22px; }
  html:root[data-theme] body .macro-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  html:root[data-theme] body .macro-card { padding:16px; }
  html:root[data-theme] body .macro-card:nth-child(2) { border-inline-end:0; }
  html:root[data-theme] body .macro-card:nth-child(-n+2) { border-bottom:1px solid var(--m-line); }
  html:root[data-theme] body :is(.training-hero,.progress-intro) { padding:24px; }
  html:root[data-theme] body :is(.chart-card,.form-card,.profile-card,.daily-nutrition-card) { padding:20px; }
  html:root[data-theme] body .floating-add { bottom:calc(146px + env(safe-area-inset-bottom));inset-inline-end:16px;padding:6px; }
  html:root[data-theme] body .bottom-nav { inset-inline:8px;bottom:6px; }
  html:root[data-theme] body .auth-shell { display:block;padding:0; }
  html:root[data-theme] body .brand-panel { min-height:0;padding:28px 24px;border-radius:0; }
  html:root[data-theme] body .brand-panel::after { display:none; }
  html:root[data-theme] body .auth-brand .dk-logo { width:40px;height:40px; }
  html:root[data-theme] body .auth-story { padding:32px 0 0; }
  html:root[data-theme] body .auth-story h1 { font-size:2.1rem;max-width:520px;margin:0;line-height:1.15; }
  html:root[data-theme] body .auth-story .eyebrow { display:none; }
  html:root[data-theme] body .auth-card { width:auto;max-width:440px;margin:auto;padding:32px 24px; }
}
@media(max-width:400px) {
  html:root[data-theme] body .content { padding-inline:12px; }
  html:root[data-theme] body .coach-card { padding:22px 18px; }
  html:root[data-theme] body .calorie-card { padding:20px 16px;gap:14px;grid-template-columns:110px minmax(0,1fr); }
  html:root[data-theme] body .ring { width:110px;height:110px; }
  html:root[data-theme] body .ring b { font-size:.6rem; }
  html:root[data-theme] body .calorie-copy h3 { font-size:1.15rem; }
  html:root[data-theme] body .macro-card { padding:14px; }
}
/* Keep enlarged text and RTL in the same layout contract as the existing accessibility controls. */
html:root[data-theme][dir="rtl"] body .nav-item.active { box-shadow:inset -2px 0 var(--m-accent); }
html:root[data-theme][dir="rtl"] body .coach-card::after { right:auto;left:16px; }
html:root[data-theme][data-text] body .coach-copy { max-width:70%; }
@media(max-width:820px) {
  html:root[data-theme][data-text] body .coach-copy { max-width:100%; }
}
/* Legacy modules with ID-scoped rules keep their layout but take the matte surfaces and type. */
html:root[data-theme] { --cyan-text:var(--m-accent);--brand:var(--m-accent);--outline:var(--m-line); }
html:root[data-theme] body :is(.auth-card,.view-section,.modal,.calendar-dialog) :is(input,textarea,select) { background:var(--m-surface);color:var(--m-ink); }
html:root[data-theme] body .quick-card .quick-action small { color:var(--m-muted); }
html:root[data-theme] body .macro-card .bar { background:var(--m-subtle); }
html:root[data-theme] body .ai-notice-text b { color:var(--m-ink); }
html:root[data-theme] body main #todaySection .coach-card { min-height:0;border-radius:12px;padding:28px 30px; }
html:root[data-theme] body main #todaySection .coach-card .coach-copy { max-width:72%;padding-top:0; }
html:root[data-theme] body main #todaySection .coach-card h3 { font-size:clamp(1.45rem,1.1rem + 1.1vw,2rem);font-weight:600; }
html:root[data-theme] body main #todaySection .coach-card p { color:var(--m-muted); }
html:root[data-theme] body :is(.settings-card,.coach-plan-card,.coach-insight-card,.coach-balance-card,.training-create-bar,.wish-card,.board-card,.insight-block) { background:var(--m-surface);color:var(--m-ink);border:1px solid var(--m-line);border-radius:10px;box-shadow:none; }
html:root[data-theme] body #coachSection :is(.coach-insight-card,.coach-balance-card) { background:var(--m-surface);border-radius:10px;margin-bottom:16px; }
html:root[data-theme] body :is(.coach-insight-card h3,.coach-summary,.balance-row .bal-label,.balance-row b,.insight-block li,.next-step strong) { color:var(--m-ink); }
html:root[data-theme] body :is(.insight-block h5,.next-step span) { color:var(--m-muted); }
html:root[data-theme] body :is(.next-step,.bal-bar) { background:var(--m-subtle);border-radius:6px; }
html:root[data-theme] body .bal-bar i { background:var(--m-accent); }
html:root[data-theme] body .profile-identity { background:var(--m-hero);color:var(--m-ink);border:1px solid var(--m-line);border-radius:10px; }
html:root[data-theme] body .identity-avatar { background:var(--m-accent-soft);color:var(--m-accent);border-radius:8px; }
html:root[data-theme] body .identity-copy p,html:root[data-theme] body .identity-fact small { color:var(--m-muted); }
html:root[data-theme] body .identity-fact { background:var(--m-surface);border:1px solid var(--m-line);border-radius:6px; }
html:root[data-theme] body .training-mark { color:var(--m-clay);background:var(--m-clay-soft);border-radius:8px; }
html:root[data-theme] body .section-tabs { background:var(--m-subtle);border-radius:9px; }
html:root[data-theme] body .section-tabs button { color:var(--m-muted);font-weight:600;border-radius:6px; }
html:root[data-theme] body .section-tabs button[aria-selected="true"] { background:var(--m-surface);color:var(--m-ink);box-shadow:0 1px 3px #15251312; }
html:root[data-theme] body .range-row button:is(.active,[aria-pressed="true"]),
html:root[data-theme] body .progress-board .range-row button[aria-pressed="true"]:hover { background:var(--m-accent);color:var(--m-on-accent);border-color:var(--m-accent); }
html:root[data-theme] body .progress-board { --plot-accent:var(--m-accent);padding:20px; }
html:root[data-theme] body .board-card { border-radius:8px; }
html:root[data-theme] body .insight-more { color:var(--m-accent); }
html:root[data-theme] body .insight small { color:var(--m-muted);opacity:1; }
@media(max-width:820px) {
  html:root[data-theme] body main #todaySection .coach-card { padding:24px 20px; }
  html:root[data-theme] body main #todaySection .coach-card .coach-copy { max-width:100%;padding-top:0; }
  html:root[data-theme] body main #todaySection .coach-card h3 { font-size:1.6rem; }
  html:root[data-theme] body .progress-board { padding:16px; }
}
html:root[data-theme][data-text] body main #todaySection .coach-card .coach-copy { max-width:70%; }
@media(max-width:820px) {
  html:root[data-theme][data-text] body main #todaySection .coach-card .coach-copy { max-width:100%;padding-top:0; }
}
