/* Accessible dark theme: shared colors for desktop, mobile, forms and cards. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #edf5f5;
  --muted: #a9bdc2;
  --line: #33474d;
  --paper: #1b2a2f;
  --bg: #101a1f;
  --accent: #43c4c2;
  --accent-dark: #72d6d2;
  --accent-soft: #183a3e;
  --lime: #d9f56b;
  --lime-soft: #303a28;
  --peach: #44302b;
  --shadow: 0 18px 55px rgba(0, 0, 0, .22);
  --surface: #1b2a2f;
  --surface-raised: #22343a;
  --surface-soft: #17252a;
  --field-bg: #111e23;
  --field-border: #40555b;
  --label: #cfdddf;
}

:root[data-theme="dark"] body,
:root[data-theme="dark"] .main-area,
:root[data-theme="dark"] .page-wrap,
:root[data-theme="dark"] .auth-page,
:root[data-theme="dark"] .platform-page {
  background-color: var(--bg);
  color: var(--ink);
}

:root[data-theme="dark"] .topbar {
  border-color: var(--line);
  background: rgba(27, 42, 47, .91);
}

:root[data-theme="dark"] .auth-page { position: relative; }

:root[data-theme="dark"] .topbar-studio,
:root[data-theme="dark"] .page-heading h1,
:root[data-theme="dark"] .section-heading h2,
:root[data-theme="dark"] .exercise-body h3,
:root[data-theme="dark"] .summary-card b,
:root[data-theme="dark"] .info-panel h2,
:root[data-theme="dark"] .profile-photo-copy h2,
:root[data-theme="dark"] .profile-edit-heading h2,
:root[data-theme="dark"] .evolution-panel-heading h2,
:root[data-theme="dark"] .load-card-heading h3,
:root[data-theme="dark"] .body-comparison-card > b,
:root[data-theme="dark"] .measurement-form-heading b,
:root[data-theme="dark"] .nutrition-editor-heading h2,
:root[data-theme="dark"] .nutrition-meal-card h3,
:root[data-theme="dark"] .platform-heading h1,
:root[data-theme="dark"] .platform-request-card h2,
:root[data-theme="dark"] .login-card h2,
:root[data-theme="dark"] .onboarding-card h1,
:root[data-theme="dark"] .error-card h1 {
  color: var(--ink);
}

:root[data-theme="dark"] .crumb,
:root[data-theme="dark"] .page-heading p,
:root[data-theme="dark"] .section-heading p,
:root[data-theme="dark"] .summary-card small,
:root[data-theme="dark"] .summary-card p,
:root[data-theme="dark"] .exercise-body > p,
:root[data-theme="dark"] .info-panel > p,
:root[data-theme="dark"] .profile-photo-copy p,
:root[data-theme="dark"] .profile-edit-heading p,
:root[data-theme="dark"] .profile-shortcut > span:last-child,
:root[data-theme="dark"] .evolution-panel-heading p,
:root[data-theme="dark"] .evolution-stats p,
:root[data-theme="dark"] .body-comparison-card > p,
:root[data-theme="dark"] .measurement-form-heading small,
:root[data-theme="dark"] .nutrition-heading p,
:root[data-theme="dark"] .nutrition-connect-card p,
:root[data-theme="dark"] .nutrition-meal-card p,
:root[data-theme="dark"] .platform-heading p,
:root[data-theme="dark"] .platform-request-space,
:root[data-theme="dark"] .footer,
:root[data-theme="dark"] .story-copy,
:root[data-theme="dark"] .login-card > p,
:root[data-theme="dark"] .local-note {
  color: var(--muted);
}

/* Neutral panels use one calm surface; colorful hero and completion cards remain expressive. */
:root[data-theme="dark"] .summary-card,
:root[data-theme="dark"] .day-panel,
:root[data-theme="dark"] .exercise-card,
:root[data-theme="dark"] .info-panel,
:root[data-theme="dark"] .profile-overview,
:root[data-theme="dark"] .profile-edit-card,
:root[data-theme="dark"] .evolution-stats article,
:root[data-theme="dark"] .evolution-panel,
:root[data-theme="dark"] .weekly-progress-history,
:root[data-theme="dark"] .load-progress-card,
:root[data-theme="dark"] .body-comparison-card,
:root[data-theme="dark"] .measurement-history,
:root[data-theme="dark"] .reference-disclosure,
:root[data-theme="dark"] .plan-history-disclosure,
:root[data-theme="dark"] .previous-weeks-disclosure,
:root[data-theme="dark"] .class-panel,
:root[data-theme="dark"] .week-panel,
:root[data-theme="dark"] .nutrition-student-card,
:root[data-theme="dark"] .nutrition-editor,
:root[data-theme="dark"] .nutrition-meal-card,
:root[data-theme="dark"] .nutrition-history,
:root[data-theme="dark"] .nutrition-connect-card,
:root[data-theme="dark"] .student-share-card,
:root[data-theme="dark"] .nutrition-day-view,
:root[data-theme="dark"] .professional-current-workout,
:root[data-theme="dark"] .professional-workout-day,
:root[data-theme="dark"] .professional-exercise-edit,
:root[data-theme="dark"] .platform-auth-card,
:root[data-theme="dark"] .platform-request-card,
:root[data-theme="dark"] .platform-empty,
:root[data-theme="dark"] .login-card,
:root[data-theme="dark"] .onboarding-card,
:root[data-theme="dark"] .error-card {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

:root[data-theme="dark"] .measurement-form,
:root[data-theme="dark"] .routine-add-form,
:root[data-theme="dark"] .platform-approval-form,
:root[data-theme="dark"] .professional-workout-day.is-locked,
:root[data-theme="dark"] .nutrition-history-meals > details,
:root[data-theme="dark"] .class-panel:not([open]) .class-summary,
:root[data-theme="dark"] .week-panel:not([open]) .week-summary,
:root[data-theme="dark"] .plan-history-disclosure > summary,
:root[data-theme="dark"] .previous-weeks-disclosure > summary,
:root[data-theme="dark"] .weekly-progress-history > summary,
:root[data-theme="dark"] .load-history li {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--ink);
}

:root[data-theme="dark"] .profile-stats article,
:root[data-theme="dark"] .profile-facts > div,
:root[data-theme="dark"] .prescription,
:root[data-theme="dark"] .set-row,
:root[data-theme="dark"] .set-entry,
:root[data-theme="dark"] .load-history li,
:root[data-theme="dark"] .body-comparison-values > span,
:root[data-theme="dark"] .nutrition-meal-field,
:root[data-theme="dark"] .nutrition-guidance,
:root[data-theme="dark"] .nutrition-day-editor,
:root[data-theme="dark"] .professional-workout-day > h3,
:root[data-theme="dark"] .platform-approval-form,
:root[data-theme="dark"] .platform-empty > span,
:root[data-theme="dark"] .class-number {
  border-color: var(--line);
  background: var(--surface-raised);
  color: var(--ink);
}

:root[data-theme="dark"] .profile-overview,
:root[data-theme="dark"] .profile-edit-card,
:root[data-theme="dark"] .body-comparison-card,
:root[data-theme="dark"] .plan-cycle-heading,
:root[data-theme="dark"] .plan-cycle-section.is-history .plan-cycle-heading,
:root[data-theme="dark"] .reference-panel,
:root[data-theme="dark"] .nutrition-connect-card,
:root[data-theme="dark"] .student-share-card {
  background: var(--surface);
}

:root[data-theme="dark"] .streak-icon {
  background: #45371f;
  color: #f6c76d;
}

:root[data-theme="dark"] .profile-photo {
  border-color: #28494d;
  background: linear-gradient(140deg, #1c3d40, #34402c);
}

:root[data-theme="dark"] .photo-delete {
  border-color: #604542;
  background: #382927;
  color: #f0b3a8;
}

:root[data-theme="dark"] .photo-delete:hover {
  border-color: #80554f;
  background: #47302d;
}

:root[data-theme="dark"] .current-goal,
:root[data-theme="dark"] .nutrition-plan-banner {
  border-color: #35544a;
  background: linear-gradient(110deg, #1b342f, #26332b);
  color: var(--ink);
}

:root[data-theme="dark"] .current-goal b,
:root[data-theme="dark"] .nutrition-plan-banner h2,
:root[data-theme="dark"] .nutrition-plan-banner p {
  color: var(--ink);
}

/* Fields stay legible and visibly separated from cards, including disabled values. */
:root[data-theme="dark"] body :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea) {
  border-color: var(--field-border);
  background-color: var(--field-bg);
  color: var(--ink);
  color-scheme: dark;
}

:root[data-theme="dark"] body :is(input, select, textarea)::placeholder {
  color: #91a6ac;
  opacity: 1;
}

:root[data-theme="dark"] body :is(input, select, textarea):focus-visible {
  border-color: var(--accent);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(67, 196, 194, .2);
}

:root[data-theme="dark"] body :is(input, select, textarea):disabled {
  border-color: #35494f;
  background-color: #26363b;
  color: #a7babc;
  opacity: 1;
}

:root[data-theme="dark"] .measurement-form .input-unit {
  border-color: var(--field-border);
  background: var(--field-bg);
}

:root[data-theme="dark"] .measurement-form .input-unit input {
  border: 0;
  background: transparent;
  box-shadow: none;
}

:root[data-theme="dark"] .form-stack > label,
:root[data-theme="dark"] .profile-form-grid > label,
:root[data-theme="dark"] .plan-edit-form > label,
:root[data-theme="dark"] .exercise-edit-form label,
:root[data-theme="dark"] .measurement-input-grid > label,
:root[data-theme="dark"] .routine-add-form label,
:root[data-theme="dark"] .nutrition-editor label,
:root[data-theme="dark"] .professional-exercise-form label,
:root[data-theme="dark"] .platform-auth-card label,
:root[data-theme="dark"] .platform-approval-form label,
:root[data-theme="dark"] .set-row label,
:root[data-theme="dark"] .set-entry label,
:root[data-theme="dark"] .prescription-field {
  color: var(--label);
}

:root[data-theme="dark"] .input-unit b,
:root[data-theme="dark"] .measurement-form .input-unit b,
:root[data-theme="dark"] .evolution-stats small,
:root[data-theme="dark"] .body-comparison-card > small,
:root[data-theme="dark"] .body-comparison-card > b span,
:root[data-theme="dark"] .measurement-history > summary,
:root[data-theme="dark"] .measurement-history-list > article > span,
:root[data-theme="dark"] .profile-stats small,
:root[data-theme="dark"] .profile-facts small,
:root[data-theme="dark"] .profile-private,
:root[data-theme="dark"] .class-summary-copy > span,
:root[data-theme="dark"] .class-intro p,
:root[data-theme="dark"] .profile-editor > p,
:root[data-theme="dark"] .profile-editor > summary > span > small,
:root[data-theme="dark"] .week-progress-copy,
:root[data-theme="dark"] .week-title small,
:root[data-theme="dark"] .nutrition-student-status small,
:root[data-theme="dark"] .nutrition-meal-field small,
:root[data-theme="dark"] .nutrition-guidance-field > small,
:root[data-theme="dark"] .nutrition-day-editor > summary small,
:root[data-theme="dark"] .nutrition-day-view > summary small,
:root[data-theme="dark"] .professional-exercise-edit > summary small,
:root[data-theme="dark"] .platform-request-card time,
:root[data-theme="dark"] .platform-approval-form label small {
  color: var(--muted);
}

:root[data-theme="dark"] .class-summary-copy b,
:root[data-theme="dark"] .week-title b,
:root[data-theme="dark"] .load-card-foot b,
:root[data-theme="dark"] .body-comparison-values strong,
:root[data-theme="dark"] .profile-stats b,
:root[data-theme="dark"] .profile-facts b,
:root[data-theme="dark"] .measurement-history-list b,
:root[data-theme="dark"] .nutrition-history-plan > div:first-child b,
:root[data-theme="dark"] .professional-exercise-edit > summary span,
:root[data-theme="dark"] .platform-auth-card h1,
:root[data-theme="dark"] .platform-empty h2 {
  color: var(--ink);
}

:root[data-theme="dark"] .measurement-history-list,
:root[data-theme="dark"] .class-content,
:root[data-theme="dark"] .week-content,
:root[data-theme="dark"] .exercise-edit,
:root[data-theme="dark"] .nutrition-history-plan,
:root[data-theme="dark"] .professional-exercise-edit,
:root[data-theme="dark"] .class-content,
:root[data-theme="dark"] .load-chart {
  border-color: var(--line);
}

:root[data-theme="dark"] .exercise-card,
:root[data-theme="dark"] .class-panel,
:root[data-theme="dark"] .week-panel,
:root[data-theme="dark"] .professional-exercise-edit,
:root[data-theme="dark"] .measurement-history,
:root[data-theme="dark"] .nutrition-day-editor,
:root[data-theme="dark"] .nutrition-day-view {
  border-color: var(--line);
}

:root[data-theme="dark"] .video-slot {
  border-color: #3e696d;
  background: linear-gradient(135deg, #183438, #1b2b30);
  color: #b6d4d5;
}

:root[data-theme="dark"] .video-slot:before,
:root[data-theme="dark"] .video-slot:after {
  background: #34585c;
}

:root[data-theme="dark"] .video-slot b,
:root[data-theme="dark"] .video-slot span {
  color: #c0d9da;
}

:root[data-theme="dark"] .equipment-chip,
:root[data-theme="dark"] .count-badge,
:root[data-theme="dark"] .day-chip,
:root[data-theme="dark"] .muscle-chip,
:root[data-theme="dark"] .nutrition-status,
:root[data-theme="dark"] .nutrition-history > summary span,
:root[data-theme="dark"] .plan-cycle-current,
:root[data-theme="dark"] .routine-locked-label,
:root[data-theme="dark"] .platform-count {
  background: #254044;
  color: #a8e5de;
}

:root[data-theme="dark"] .button.soft,
:root[data-theme="dark"] .rest-chip,
:root[data-theme="dark"] .photo-picker,
:root[data-theme="dark"] .nutrition-version-button,
:root[data-theme="dark"] .completion-button-ghost,
:root[data-theme="dark"] .platform-reject-button {
  border-color: var(--line);
  background: #26383d;
  color: #d7e8e8;
}

:root[data-theme="dark"] .routine-remove-button,
:root[data-theme="dark"] .share-reset-button,
:root[data-theme="dark"] .platform-reject-button {
  border-color: #604542;
  background: #382927;
  color: #f0b3a8;
}

:root[data-theme="dark"] .rest-timer,
:root[data-theme="dark"] .set-row.set-done,
:root[data-theme="dark"] .class-finish-form,
:root[data-theme="dark"] .class-finished-note,
:root[data-theme="dark"] .week-progress-note {
  border-color: #36564f;
  background: #1c342f;
  color: #c8e9dc;
}

:root[data-theme="dark"] .class-finish-form > div b,
:root[data-theme="dark"] .set-saved,
:root[data-theme="dark"] .set-progress,
:root[data-theme="dark"] .last-weight-note b,
:root[data-theme="dark"] .load-best b,
:root[data-theme="dark"] .weekly-progress-copy strong {
  color: #8cdbb2;
}

:root[data-theme="dark"] .flash.success,
:root[data-theme="dark"] .nutrition-notice,
:root[data-theme="dark"] .profile-privacy,
:root[data-theme="dark"] .evolution-honesty-note,
:root[data-theme="dark"] .evolution-footnote,
:root[data-theme="dark"] .privacy-hint,
:root[data-theme="dark"] .platform-setup-notice {
  border-color: #3d5949;
  background: #1d3028;
  color: #c6dfcd;
}

:root[data-theme="dark"] .flash.error,
:root[data-theme="dark"] .set-error {
  border-color: #6a403e;
  background: #3a2527;
  color: #ffc3ba;
}

:root[data-theme="dark"] .safety-note {
  border-color: #584737;
  background: #302a22;
  color: #dec9a9;
}

:root[data-theme="dark"] .safety-note b,
:root[data-theme="dark"] .platform-setup-notice b {
  color: #f0d49d;
}

:root[data-theme="dark"] .page-wrap a:not(.button),
:root[data-theme="dark"] .auth-page a:not(.button),
:root[data-theme="dark"] .platform-page a:not(.button) {
  color: var(--accent-dark);
}

:root[data-theme="dark"] .button.primary,
:root[data-theme="dark"] .completion-button-share,
:root[data-theme="dark"] .sidebar a {
  color: #fff;
}

:root[data-theme="dark"] .login-story,
:root[data-theme="dark"] .login-story h1,
:root[data-theme="dark"] .login-story h2,
:root[data-theme="dark"] .login-story p,
:root[data-theme="dark"] .login-story .eyebrow,
:root[data-theme="dark"] .onboarding-card,
:root[data-theme="dark"] .onboarding-card h1,
:root[data-theme="dark"] .error-card h1 {
  color: var(--ink);
}

:root[data-theme="dark"] .demo-accounts,
:root[data-theme="dark"] .demo-accounts code,
:root[data-theme="dark"] .story-copy,
:root[data-theme="dark"] .login-pills span,
:root[data-theme="dark"] .form-divider,
:root[data-theme="dark"] .goal-option small {
  color: var(--muted);
}

:root[data-theme="dark"] .goal-option,
:root[data-theme="dark"] .demo-accounts code,
:root[data-theme="dark"] .login-pills span {
  border-color: var(--line);
  background: var(--surface-raised);
}

:root[data-theme="dark"] .goal-option:has(input:checked) {
  border-color: var(--accent);
  background: #19383b;
}

:root[data-theme="dark"] .mobile-nav {
  border-color: var(--line);
  background: rgba(20, 32, 37, .96);
}

:root[data-theme="dark"] .mobile-nav a {
  color: #b6c6c9;
}

:root[data-theme="dark"] .mobile-nav a.active {
  background: #1a3b3e;
  color: #72d6d2;
}

/* Secondary surfaces and dense controls used across the student and coach views. */
:root[data-theme="dark"] .plan-stamp,
:root[data-theme="dark"] .goal-option,
:root[data-theme="dark"] .prescription-editor,
:root[data-theme="dark"] .nutrition-history-meals > details,
:root[data-theme="dark"] .nutrition-day-editor,
:root[data-theme="dark"] .nutrition-day-view,
:root[data-theme="dark"] .student-share-code-row code {
  border-color: var(--line);
  background: var(--surface-raised);
  color: var(--ink);
}

:root[data-theme="dark"] .plan-stamp b,
:root[data-theme="dark"] .goal-option b,
:root[data-theme="dark"] .nutrition-day-editor > summary,
:root[data-theme="dark"] .nutrition-day-view > summary,
:root[data-theme="dark"] .nutrition-history > summary,
:root[data-theme="dark"] .nutrition-history-meals p,
:root[data-theme="dark"] .professional-workout-day > h3 {
  color: var(--ink);
}

:root[data-theme="dark"] .goal-option:has(input:checked) {
  border-color: var(--accent);
  background: #19383b;
}

:root[data-theme="dark"] .nutrition-empty {
  border-color: #405b55;
  background: linear-gradient(135deg, #1b302c, #1b2a2f);
  color: var(--ink);
}

:root[data-theme="dark"] .nutrition-empty > span,
:root[data-theme="dark"] .evolution-stat-icon,
:root[data-theme="dark"] .evolution-panel-icon,
:root[data-theme="dark"] .evolution-empty > span,
:root[data-theme="dark"] .reference-mark,
:root[data-theme="dark"] .nutrition-student-avatar,
:root[data-theme="dark"] .nutrition-meal-icon {
  background: #254044;
  color: #a8e5de;
}

:root[data-theme="dark"] .next-week-card {
  border-color: #36564f;
  background: linear-gradient(120deg, #1c342f, #1e3539);
  color: var(--ink);
}

:root[data-theme="dark"] .next-week-card p,
:root[data-theme="dark"] .class-finish-form > div span,
:root[data-theme="dark"] .nutrition-student-status small,
:root[data-theme="dark"] .nutrition-history-plan > div:first-child small,
:root[data-theme="dark"] .nutrition-version-note,
:root[data-theme="dark"] .student-share-status,
:root[data-theme="dark"] .nutrition-meal-field small,
:root[data-theme="dark"] .nutrition-guidance-field > small,
:root[data-theme="dark"] .professional-exercise-edit > summary small,
:root[data-theme="dark"] .demo-credit,
:root[data-theme="dark"] .consent-line {
  color: var(--muted);
}

:root[data-theme="dark"] .class-open,
:root[data-theme="dark"] .class-summary-copy small,
:root[data-theme="dark"] .set-current,
:root[data-theme="dark"] .exercise-summary-hint,
:root[data-theme="dark"] .exercise-edit > summary,
:root[data-theme="dark"] .load-history > summary,
:root[data-theme="dark"] .nutrition-meal-card .eyebrow,
:root[data-theme="dark"] .nutrition-day-editor > summary::after,
:root[data-theme="dark"] .nutrition-day-view > summary::after {
  color: var(--accent-dark);
}

:root[data-theme="dark"] .last-weight-note,
:root[data-theme="dark"] .measurement-history > summary,
:root[data-theme="dark"] .measurement-history-list > article > span,
:root[data-theme="dark"] .measurement-history-list small,
:root[data-theme="dark"] .body-comparison-values > span,
:root[data-theme="dark"] .body-comparison-card > b span,
:root[data-theme="dark"] .load-chart-point > b,
:root[data-theme="dark"] .load-chart-point > span {
  color: var(--muted);
}

:root[data-theme="dark"] .completed-note {
  border: 1px solid #36564f;
  background: #1c342f;
  color: #c8e9dc;
}

:root[data-theme="dark"] .completed-note span {
  background: #294c40;
  color: #a9e6bf;
}

:root[data-theme="dark"] .completion-card {
  border-color: #365451;
  background: radial-gradient(circle at 92% 2%, rgba(240,163,64,.16), transparent 32%),
    radial-gradient(circle at 0% 100%, rgba(29,169,175,.14), transparent 36%),
    linear-gradient(135deg, #1c302e 0%, #202e3c 52%, #332d26 100%);
  box-shadow: var(--shadow);
}

:root[data-theme="dark"] .completion-card-top,
:root[data-theme="dark"] .completion-card-meta,
:root[data-theme="dark"] .completion-share-hint {
  color: var(--muted);
}

:root[data-theme="dark"] .completion-quote {
  color: var(--ink);
}

:root[data-theme="dark"] .load-chart,
:root[data-theme="dark"] .evolution-track,
:root[data-theme="dark"] .week-progress-track {
  border-color: var(--line);
  background-color: var(--surface-soft);
}

:root[data-theme="dark"] .profile-stats article,
:root[data-theme="dark"] .profile-facts > div,
:root[data-theme="dark"] .body-comparison-values > span,
:root[data-theme="dark"] .load-progress-card,
:root[data-theme="dark"] .week-panel:not([open]) .week-summary,
:root[data-theme="dark"] .week-progress-note,
:root[data-theme="dark"] .nutrition-meal-field,
:root[data-theme="dark"] .nutrition-guidance,
:root[data-theme="dark"] .routine-add-form,
:root[data-theme="dark"] .professional-workout-day.is-locked {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--ink);
}

:root[data-theme="dark"] .profile-stats small,
:root[data-theme="dark"] .profile-facts small,
:root[data-theme="dark"] .week-progress-note span,
:root[data-theme="dark"] .prescription-field,
:root[data-theme="dark"] .prescription-times,
:root[data-theme="dark"] .load-progress-card .load-card-heading small,
:root[data-theme="dark"] .load-best,
:root[data-theme="dark"] .weekly-progress-copy small {
  color: var(--muted);
}

:root[data-theme="dark"] .plan-cycle-badge,
:root[data-theme="dark"] .week-title small {
  color: #e4bb79;
}

:root[data-theme="dark"] .plan-history-disclosure > summary b,
:root[data-theme="dark"] .previous-weeks-disclosure > summary b,
:root[data-theme="dark"] .weekly-progress-history > summary b {
  color: var(--ink);
}

:root[data-theme="dark"] .plan-history-disclosure > summary small,
:root[data-theme="dark"] .previous-weeks-disclosure > summary small,
:root[data-theme="dark"] .weekly-progress-history > summary small {
  color: var(--muted);
}

:root[data-theme="dark"] .nutrition-status.active,
:root[data-theme="dark"] .routine-locked-label,
:root[data-theme="dark"] .plan-cycle-current,
:root[data-theme="dark"] .week-progress-state {
  background: #254044;
  color: #a8e5de;
}

:root[data-theme="dark"] .nutrition-status.empty {
  background: #303b40;
  color: var(--muted);
}

:root[data-theme="dark"] .summary-icon.lime {
  background: #303a28;
  color: #d9f56b;
}

:root[data-theme="dark"] .nutrition-day-editor[open] > summary,
:root[data-theme="dark"] .nutrition-day-view[open] > summary {
  border-color: var(--line);
  background: #20343a;
}

:root[data-theme="dark"] .live-dot {
  box-shadow: 0 0 0 4px #303a28;
}

:root[data-theme="dark"] .theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 38px;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #22343a;
  color: #e4eeee;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 38px;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.74);
  color: var(--ink);
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition: background-color .16s ease, border-color .16s ease, transform .16s ease;
}

.theme-toggle:hover { transform: translateY(-1px); }
.theme-toggle:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.theme-toggle-icon { font-size: 16px; line-height: 1; }
.theme-toggle-auth { position: absolute; z-index: 5; top: max(14px, env(safe-area-inset-top)); right: max(14px, env(safe-area-inset-right)); }

@media (max-width: 700px) {
  .topbar-actions { gap: 9px; }
  .topbar > div { min-width: 0; }
  .topbar-studio { display: inline-block; max-width: min(40vw, 150px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
  .crumb { display: inline-block; max-width: 24vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
  .theme-toggle { width: 40px; min-width: 40px; height: 40px; min-height: 40px; padding: 0; }
  .theme-toggle-label { display: none; }
  .secure-indicator { gap: 5px; }
  .theme-toggle-auth { top: max(10px, env(safe-area-inset-top)); right: 12px; }
}

@media (max-width: 390px) {
  .topbar-actions { gap: 6px; }
  .topbar-studio { max-width: 36vw; }
  .crumb { max-width: 20vw; }
  .secure-indicator { font-size: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .theme-toggle { transition: none; }
}

/* Final contrast polish for small labels and filled action buttons. */
:root[data-theme="dark"] .button.primary {
  background: #167f82;
  color: #fff;
}

:root[data-theme="dark"] .button.primary:hover {
  background: #1b8285;
}

:root[data-theme="dark"] .secure-indicator,
:root[data-theme="dark"] .onboarding-progress,
:root[data-theme="dark"] .onboarding-progress b {
  color: var(--muted);
}

:root[data-theme="dark"] .sidebar .nav-label {
  color: var(--muted);
}

:root[data-theme="dark"] .demo-accounts b {
  color: var(--ink);
}

:root[data-theme="dark"] .summary-icon.peach {
  background: #44302b;
  color: #ffa37d;
}
