/* Semantic dark surfaces; keep the existing brand/accent colours and nav style. */
:root[data-theme="dark"]{--ink:#edf0e9;--paper:#121511;--card:#1d221c;--muted:#a4ad9f;--line:#394234;--violet:#b1a5ff;--danger:#ff8f8f;--shadow:0 16px 45px #0005;color-scheme:dark}
:root[data-theme="dark"] body{background:var(--paper);color:var(--ink)}
:root[data-theme="dark"] :is(.card,.exercise,.template-card,.profile-preview,.list-item,.video-review,.hidden-catalog-item,.food-ingredient){background:var(--card);border-color:var(--line);box-shadow:none}
:root[data-theme="dark"] :is(.modal,.login-panel){background:var(--paper);color:var(--ink)}
:root[data-theme="dark"] :is(.input,.set-row input,.btn-light,.icon-action,.back,.target,.date-chip,.check,.comment){background:#252c23;border-color:var(--line);color:var(--ink)}
:root[data-theme="dark"] :is(.input,.set-row input)::placeholder{color:#a2ab9b;opacity:1}
:root[data-theme="dark"] :is(.close,.link-button){color:var(--ink)}
:root[data-theme="dark"] :is(.muted,.topbar p,.nutrition-heading>p,.food-meal-info>small,.food-goal-legend span,.food-product-hint,.food-product-result span,.food-day-group>header>b,.nutrition-metrics small,.nutrition-metrics span,.nutrition-photo-selection small,.training-mode-card small,.profile-preview small,.program-card small,.program-card p,.list-item small,.compact-number-field>span){color:var(--muted)}
:root[data-theme="dark"] .btn:not(.btn-light):not(.btn-accent):not(.btn-video):not(.btn-exit){background:#343d2c;color:#f1f4eb}
:root[data-theme="dark"] .btn-accent{background:#ff5a1f;color:#fff}
:root[data-theme="dark"] :is(.sidebar,.mobile-nav,.hero-workout,.stat.dark,.workout-runner){background:#10130e;color:#f1f4eb}
:root[data-theme="dark"] .stat.lime{background:#d7ff4f;border-color:#d7ff4f;color:#10130e}
:root[data-theme="dark"] .stat.lime small{color:#465121}
:root[data-theme="dark"] .stat.accent{background:#ff5a1f;color:#fff}
:root[data-theme="dark"] .stat.accent small{color:#ffe0d2}
:root[data-theme="dark"] :is(.ex-body,.editable-exercise,.catalog-row-advanced,.attention-row,.training-mode-card,.program-detail-meta.compact span){background:#20261e;border-color:var(--line);color:var(--ink)}
:root[data-theme="dark"] :is(.exercise-feedback,.nutrition-answer){background:#213025;border-color:#40533d;color:var(--ink)}
:root[data-theme="dark"] .exercise-feedback .eyebrow{color:#bad1a6}
:root[data-theme="dark"] .exercise-feedback .comment{background:#283b2c}
:root[data-theme="dark"] .coach-note{background:#36291d;color:#f2c9a2}
:root[data-theme="dark"] .previous-result{background:#2d2942;color:#f1ebff}
:root[data-theme="dark"] .previous-result span{color:#c1b9d9}
:root[data-theme="dark"] :is(.progress,.auth-tabs,.training-mode-switch,.nutrition-manual,.nutrition-request-status,.food-slot-time){background:#2b3428;color:#b9c5b0}
:root[data-theme="dark"] .check.on{background:var(--lime);border-color:var(--lime);color:#10130e}
:root[data-theme="dark"] .check.on svg{color:#10130e}
:root[data-theme="dark"] .auth-tabs button.active{background:#3d4936;color:#fff}
:root[data-theme="dark"] .weekday-picker span{background:#252c23;border-color:var(--line);color:var(--ink)}
:root[data-theme="dark"] .weekday-picker input:checked+span{background:#d7ff4f;color:#10130e;border-color:#d7ff4f}
:root[data-theme="dark"] .send-field .comment-btn{background:#d7ff4f;color:#10130e}
:root[data-theme="dark"] :is(.remove,.remove-editable,.remove-composition){background:#3d2525;color:#ff9999}
:root[data-theme="dark"] :is(.danger-text,.danger-link,.delete-workout-comment){color:#ff9999}
:root[data-theme="dark"] .icon-action.danger-text{color:#ff9999}
:root[data-theme="dark"] .toast{background:#e4ebdb;color:#1a2116}
:root[data-theme="dark"] .standalone .brand{color:var(--ink)}
:root[data-theme="dark"] :is(.food-meal-photo,.food-dish-cover,.nutrition-photo-selection img,.nutrition-photo){background:#252d22}
:root[data-theme="dark"] .food-gauge-bg{stroke:#343d2e}
:root[data-theme="dark"] .food-gauge-value{fill:#f0f4e9}
:root[data-theme="dark"] .food-gauge-caption{fill:#b3bda9}
:root[data-theme="dark"] .food-gauge-protein{stroke:#79b6d8}
:root[data-theme="dark"] .food-gauge-fat{stroke:#e7b85a}
:root[data-theme="dark"] .food-gauge-carbs{stroke:#e798ad}
:root[data-theme="dark"] .food-legend-protein b{color:#8ec4e1}
:root[data-theme="dark"] .food-legend-fat b{color:#efc779}
:root[data-theme="dark"] .food-legend-carbs b{color:#f0adc0}
:root[data-theme="dark"] :is(.food-calorie-rest,.food-detail-link,.food-ai-answer summary,.food-slot-add){color:#b5cfaa}
:root[data-theme="dark"] :is(.food-diary-meal,.food-product-result,.food-slot-add,.food-dish-totals){border-color:var(--line)}
:root[data-theme="dark"] .food-dish-totals>b{color:#bfceb5}
:root[data-theme="dark"] .food-ai-answer{background:#273222;color:#e1e9d9}
:root[data-theme="dark"] .food-analysis-error{color:#ffae93}
:root[data-theme="dark"] .food-product-result small{color:#edd08c}
:root[data-theme="dark"] .food-add-options>button{background:#252c23;border-color:var(--line);color:var(--ink)}
:root[data-theme="dark"] :is(.food-add-options small,.food-ingredient small){color:var(--muted)}
:root[data-theme="dark"] .nutrition-camera-button{background:#29392b;color:#bfd5b8;border-color:#455441}
:root[data-theme="dark"] .food-macro-calories{background:#263d4a;color:#a2d1ee}
:root[data-theme="dark"] .food-macro-protein{background:#253e32;color:#a2d6b6}
:root[data-theme="dark"] .food-macro-fat{background:#423725;color:#f1cf8c}
:root[data-theme="dark"] .food-macro-carbs{background:#432d38;color:#f0b8cb}
:root[data-theme="dark"] .nutrition-menu-panel{background:#252c23;border-color:var(--line);box-shadow:0 12px 35px #0007}
:root[data-theme="dark"] .nutrition-menu-panel button{color:var(--ink)}
:root[data-theme="dark"] .nutrition-menu-panel button:hover{background:#35412e}
:root[data-theme="dark"] .nutrition-theme-switch{background:#47503f}
:root[data-theme="dark"] .nutrition-menu-panel [aria-checked="true"] .nutrition-theme-switch{background:#d7ff4f}
:root[data-theme="dark"] .food-scan-overlay>.modal{background:#151716!important;color:#fff}

/* Training/program screens: legacy light surfaces need explicit dark pairs. */
:root[data-theme="dark"] :is(.ai-summary,.ai-working,.ai-next-week details,.record-list button,.catalog-video-preview,.offline-video-card){background:#252c23;border-color:var(--line);color:var(--ink)}
:root[data-theme="dark"] :is(.ai-assistant,.ai-request-card,.workout-feedback-card){background:#1d2920;border-color:#3e5542;color:var(--ink)}
:root[data-theme="dark"] :is(.ai-summary small,.ai-working small,.ai-next-week>p,.ai-next-week details p span,.self-quick small,.analytics-stats small,.analytics-stats span,.analytics-tr.head,.analytics-tr small,.record-list small,.chart-card .card-title small,.chart-dates,.chart-legend,.catalog-item .effectiveness small,.video-hint,.offline-video-head small,.program-detail-meta b,.video-review-head small){color:var(--muted)}
:root[data-theme="dark"] .ai-next-week details p{border-color:var(--line)}
:root[data-theme="dark"] :is(.ai-warnings span,.coach-note){background:#3b301f;color:#f3d69b}
:root[data-theme="dark"] :is(.ai-error,.danger-warning){background:#3c2527;border-color:#754549;color:#ffb9b9}
:root[data-theme="dark"] :is(.ai-private,.ai-request-badge){background:#2f4936;color:#c0e1c3}
:root[data-theme="dark"] .workout-actions{background:rgba(32,38,30,.96);border-color:var(--line);box-shadow:none}
:root[data-theme="dark"] .set-video{background:#252c23;border-color:var(--line);color:#ff8c5d}
:root[data-theme="dark"] .set-video.uploading{background:#453022;border-color:#ff8c5d}
:root[data-theme="dark"] :is(.workout-tabs button,.attention-controls button,.workout-row-menu,.workout-row-menu button){background:#252c23;border-color:var(--line);color:var(--ink)}
:root[data-theme="dark"] :is(.workout-tabs button.active,.attention-controls button.active){background:#d7ff4f;border-color:#d7ff4f;color:#10130e}
:root[data-theme="dark"] .workout-row-menu button{color:#ffb2a2}
:root[data-theme="dark"] .record-list button>span{background:#d7ff4f;color:#14200d}
:root[data-theme="dark"] .tag{background:#343d2f;color:#e2ebda}
:root[data-theme="dark"] :is(.tag.active,.tag.pending,.workout-status-icon.active){background:#44371e;color:#f9d894}
:root[data-theme="dark"] :is(.tag.planned,.tag.customized){background:#342d50;color:#d4c7ff}
:root[data-theme="dark"] :is(.tag.done,.tag.approved,.workout-status-icon.done){background:#2c4430;color:#bde4bb}
:root[data-theme="dark"] :is(.tag.archived,.workout-status-icon){background:#353c31;color:#cad3c2}
:root[data-theme="dark"] .tag.needs_work{background:#4b292b;color:#ffc3c3}
:root[data-theme="dark"] .video-badge{background:#472d22;color:#ffb48d}
:root[data-theme="dark"] .section-title span{background:#35402e;color:#d7e3cc}
:root[data-theme="dark"] :is(.exercise-more-toggle,.attention-more){color:#bdcbb4}
:root[data-theme="dark"] .exercise-more-content .target{background:#283023;border-color:var(--line);color:var(--ink)}
:root[data-theme="dark"] .target.recommended-target{background:#263e30;border-color:#46634c;color:#bdddbe}
:root[data-theme="dark"] .target.recommended-target b{color:#d2edce}
:root[data-theme="dark"] .target.history-target{background:#293025;border-color:var(--line)}
:root[data-theme="dark"] :is(.workout-comment,.workout-comment.athlete){background:#283726;color:var(--ink)}
:root[data-theme="dark"] .workout-comment small{color:#bdc7b6}
:root[data-theme="dark"] .chart-mode-switch{background:#242c20;border-color:var(--line)}
:root[data-theme="dark"] .chart-mode-switch button{color:#b7c4ae}
:root[data-theme="dark"] .chart-mode-switch button.active{background:#465337;color:#f3f8ec;box-shadow:none}
:root[data-theme="dark"] .progress-filters .btn.active{background:#4b3e23;border-color:#af965e;color:#ffdda4}
:root[data-theme="dark"] :is(.chart-axis-label,.chart-date-label){fill:#b6c2ad}
:root[data-theme="dark"] .chart-grid-line{stroke:#3a4535}
:root[data-theme="dark"] .chart-card .card-title b{color:#efb881}
:root[data-theme="dark"] .analytics-tr{border-color:var(--line)}
:root[data-theme="dark"] .catalog-item .effectiveness b{color:#edba73}
:root[data-theme="dark"] :is(.catalog-item a,.catalog-item>div>small,.exercise-options summary,.editable-exercise details summary){color:#bcb0ff}
:root[data-theme="dark"] .catalog-video-link{color:#b6d1c4}
:root[data-theme="dark"] :is(.catalog-video-empty,.empty){color:var(--muted);border-color:#55624a}
:root[data-theme="dark"] .delete-account-card{background:#302123;border-color:#754549;color:#ffd6d6}
:root[data-theme="dark"] .delete-account-card small{color:#e6b4b4}
:root[data-theme="dark"] .delete-account-card .danger-text{color:#ffaaaa}
:root[data-theme="dark"] .goal-chips label{background:#252c23;border-color:var(--line);color:var(--ink)}
:root[data-theme="dark"] .goal-chips label:has(input:checked){background:#31412b;border-color:#879e61;color:#ecf4e4}
:root[data-theme="dark"] input[type="checkbox"]{accent-color:#d7ff4f}
:root[data-theme="dark"] .move-controls button{background:#2d3727;color:#d5dfcc}
:root[data-theme="dark"] .move-controls button:disabled{opacity:.35}
:root[data-theme="dark"] .move-controls .move-label{color:var(--muted)}
:root[data-theme="dark"] :is(.upload-progress,.offline-video-progress){background:#303a2b;color:var(--ink)}
:root[data-theme="dark"] :is(.upload-progress span,.offline-video-progress span){color:#fff;text-shadow:0 1px 2px #10130e,0 0 3px #10130e;background:#10130e99}
:root[data-theme="dark"] .video-comment .comment-delete{background:#30382a;border-color:var(--line);color:#f4b4a5}
:root[data-theme="dark"] .catalog-video{background:#20261e;border-color:var(--line)}
:root[data-theme="dark"] .infinite-status{color:var(--muted)}
:root[data-theme="dark"] .training-mode-switch button:not(.active){color:#b7c4ae}
:root[data-theme="dark"] .btn.btn-danger{background:#a52b27;border-color:#b94e49;color:#fff}
:root[data-theme="dark"] .nutrition-metrics>div:first-child b{color:#f1b18e}

/* One accessible account menu beside the heading in every section. */
.page-heading-row{display:flex;align-items:center;justify-content:space-between;gap:12px;min-width:0}
.page-heading-row h1{flex:1;min-width:0;overflow-wrap:anywhere}
.topbar>div:first-child{flex:1;min-width:0}
.section-menu{align-self:center;margin:0;z-index:16}
.section-menu>summary{color:var(--ink)}
.section-menu-panel{width:268px;min-width:0;max-height:min(70dvh,560px);overflow-y:auto;overscroll-behavior:contain;box-sizing:border-box}
.section-menu-user{padding:10px;color:var(--muted);font-size:12px;font-weight:700;border-bottom:1px solid var(--line);margin-bottom:4px;overflow-wrap:anywhere}
.section-menu-panel .account-menu-icon{display:grid;place-items:center;width:21px;height:21px;flex:0 0 21px}
.section-menu-panel button.section-menu-logout{color:#b52c22;border-top:1px solid var(--line);border-radius:0 0 10px 10px}
:root[data-theme="dark"] .section-menu-panel button.section-menu-logout{color:#ffaaaa}
.sidebar-theme-toggle .nutrition-theme-switch{margin-left:auto;flex-shrink:0}
.sidebar-theme-toggle[aria-checked="true"] .nutrition-theme-switch{background:#d7ff4f}
.sidebar-theme-toggle[aria-checked="true"] .nutrition-theme-switch:after{transform:translateX(14px);background:#26301f}
.sidebar-theme-toggle:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.sidebar .nav{overflow-y:auto;min-height:0}
@media(min-width:901px){.page-heading-row{gap:20px}.section-menu{display:none!important}.sidebar{overflow-y:auto}.sidebar .profile{flex-shrink:0}}
@media(max-width:900px){.topbar>div:first-child{flex-basis:100%;width:100%}.desktop-nutrition-goals{display:none}}

/* Compact, readable headings shared by every application section. */
.content h1{font-size:clamp(22px,2.4vw,30px);line-height:1.25;letter-spacing:-.035em;overflow-wrap:anywhere}
.content h2,.modal h2{line-height:1.3;letter-spacing:-.02em;overflow-wrap:anywhere}
.hero-workout h2{font-size:26px;line-height:1.3;letter-spacing:-.035em;max-width:900px}
.hero-workout>div:first-child{min-width:0;flex:1}
.hero-date{flex-shrink:0;margin-left:20px}
.section-title h2,.attention .card-title h2,.absence-card .card-title h2{font-size:18px}
.program-banner h2,.modal-head h2,.login-card h2{font-size:21px;line-height:1.3;letter-spacing:-.025em}
.workout-head .back,.workout-head-actions,.page-heading-row>.section-menu{flex-shrink:0}
.page-heading-row{align-items:flex-start}
@media(max-width:900px){
 .content h1{font-size:22px;line-height:1.3;letter-spacing:-.025em}
 .hero-workout{padding:22px;min-height:0}
 .hero-workout h2{font-size:20px;line-height:1.35;letter-spacing:-.025em}
 .hero-date{margin-left:0;margin-top:24px;font-size:36px}
 .program-banner h2,.modal-head h2,.login-card h2{font-size:19px}
 .workout-head{position:relative;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:14px 10px}
 .workout-head>.back{grid-column:1;grid-row:1;justify-self:start}
 .workout-head>.workout-head-actions{grid-column:2;grid-row:1;margin-left:0;justify-content:flex-end}
 .workout-head>.grow{grid-column:1/-1;grid-row:2;width:100%;min-width:0}
 .workout-head .eyebrow{margin-bottom:8px}
 .workout-head .page-heading-row{display:block}
 .workout-head h1{font-size:20px;line-height:1.35}
 .workout-head .section-menu{position:absolute;top:0;left:84px;right:auto}
}
