/*
 * Design Token System
 * ===================
 * This stylesheet uses CSS custom properties (design tokens) organized into:
 *
 * COLORS:
 *   --color-{semantic}              Semantic: success, warning, danger, info
 *   --color-bp-{level}              BP classification: optimal, normal, high-normal, grade1-3
 *   --color-chart-{role}            Chart: primary, secondary, accent, highlight, plan
 *   --color-sync-{state}            Sync status: pending, success, error
 *   --color-toast-{type}-{part}     Toast notifications: success/warning/error/info bg/text/solid
 *   --color-status-{state}-{part}   Status bar: offline/syncing/pending bg-start/bg-end/text/border
 *   --color-workout-{variant}       Workout cards and action buttons
 *
 * SPACING:       --space-{xs|sm|md|lg|xl|2xl}     4/8/12/16/24/32px
 * BORDER RADIUS: --radius-{sm|md|lg|xl|pill}      6/10/14/18/999px
 * SHADOWS:       --shadow-{sm|md|lg}              3 elevation levels
 * TYPOGRAPHY:    --font-size-{xs|sm|md|lg|xl}     11/13/15/18/24px
 *                --font-weight-{normal|medium|bold} 400/500/600
 * Z-INDEX:       --z-{dropdown|overlay|modal|popover|toast} 100-1100
 *
 * BUTTONS:
 *   Base:  .btn (reset)  Variants: .btn-primary, .btn-secondary, .btn-danger
 *   Sizes: .btn-sm, .btn-md (default), .btn-lg
 *   Shape: .btn-pill, .btn-icon
 *
 * UTILITIES:
 *   Layout:  .flex-row, .flex-col, .flex-between, .flex-center, .flex-wrap, .items-start
 *   Spacing: .mt-{size}, .mb-{size}, .p-{size}, .gap-{size}
 *   Text:    .text-center, .text-hint, .text-sm, .text-bold, .text-danger
 *   Display: .hidden, .block, .inline-flex
 *   State:   .empty-state, .loading-state
 *
 * RULES:
 *   - No hardcoded hex colors outside :root — use tokens
 *   - No inline style assignments in JS — use CSS classes
 *   - Telegram theme vars (--tg-theme-*) are mirrored in :root with fallbacks
 */

:root {
    /* Telegram theme mirrors */
    --bg-color: var(--tg-theme-bg-color, #fff);
    --text-color: var(--tg-theme-text-color, #000);
    --hint-color: var(--tg-theme-hint-color, #888);
    --link-color: var(--tg-theme-link-color, #2481cc);
    --button-color: var(--tg-theme-button-color, #2481cc);
    --button-text-color: var(--tg-theme-button-text-color, #fff);
    --secondary-bg-color: var(--tg-theme-secondary-bg-color, #f0f0f0);

    /* Semantic colors */
    --color-success: #22c55e;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-info: #3b82f6;

    /* BP classification colors */
    --color-bp-optimal: #22c55e;
    --color-bp-normal: #4ECDC4;
    --color-bp-high-normal: #eab308;
    --color-bp-grade1: #f97316;
    --color-bp-grade2: #ef4444;
    --color-bp-grade3: #dc2626;

    /* Chart colors */
    --color-chart-primary: #667eea;
    --color-chart-secondary: #764ba2;
    --color-chart-accent: #4ECDC4;
    --color-chart-highlight: #ffd700;

    /* Hero card gradient stops */
    --color-hero-pink-start: #f093fb;
    --color-hero-pink-end: #f5576c;
    --color-hero-blue-start: #4facfe;
    --color-hero-blue-end: #00f2fe;

    /* Sync status colors */
    --color-sync-pending: #f59e0b;
    --color-sync-success: #22c55e;
    --color-sync-error: #ef4444;

    /* Toast / alert colors */
    --color-toast-success-bg: #d4edda;
    --color-toast-success-text: #155724;
    --color-toast-warning-bg: #fff3cd;
    --color-toast-warning-text: #856404;
    --color-toast-error-bg: #f8d7da;
    --color-toast-error-text: #721c24;
    --color-toast-info-bg: #e0f2fe;
    --color-toast-info-text: #0c4a6e;

    /* Overlay / backdrop colors */
    --color-overlay: rgba(0, 0, 0, 0.5);
    --color-overlay-light: rgba(0, 0, 0, 0.2);

    /* BP category badge colors */
    --color-bp-category-grade1-bg: #ffe5d5;
    --color-bp-category-grade1-text: #c45a00;

    /* Chart extra colors */
    --color-chart-plan: #67e8f9;
    --color-chart-gradient-opacity: 0.25;

    /* Inventory badge */
    --color-inventory-ok: #2d9c93;

    /* Workout card gradients */
    --color-workout-card-bg-start: #f5f7fa;
    --color-workout-card-bg-end: #e8ecf1;
    --color-workout-today-start: #f093fb;
    --color-workout-today-end: #f5576c;
    --color-workout-skipped-start: #fff3e0;
    --color-workout-skipped-end: #ffe0b2;
    --color-workout-skipped-accent: #e65100;

    /* Status bar - offline */
    --color-status-offline-bg-start: #fee2e2;
    --color-status-offline-bg-end: #fecaca;
    --color-status-offline-text: #991b1b;
    --color-status-offline-border: #fca5a5;

    /* Status bar - syncing */
    --color-status-syncing-bg-start: #e0f2fe;
    --color-status-syncing-bg-end: #bae6fd;
    --color-status-syncing-text: #0369a1;
    --color-status-syncing-border: #7dd3fc;

    /* Status bar - pending */
    --color-status-pending-bg-start: #fef3c7;
    --color-status-pending-bg-end: #fde68a;
    --color-status-pending-text: #92400e;
    --color-status-pending-border: #fcd34d;

    /* Sync toast solid backgrounds */
    --color-toast-info-solid: #1e40af;
    --color-toast-success-solid: #059669;
    --color-toast-error-solid: #dc2626;

    /* Data refresh banner */
    --color-refresh-btn: #b45309;

    /* UI / borders */
    --color-border-divider: #ddd;
    --color-toggle-inactive: #ccc;

    /* Autocomplete */
    --color-autocomplete-delete: #e53935;
    --color-autocomplete-delete-light: #ffcdd2;

    /* Food search status */
    --color-food-status-success: #2e7d32;
    --color-food-status-empty: #7a6a00;
    --color-food-status-error: #c62828;

    /* Workout action button colors */
    --color-workout-stop-bg: #ffebee;
    --color-workout-stop-text: #c62828;
    --color-workout-stop-border: #ef9a9a;
    --color-workout-skip-bg: #fff3e0;
    --color-workout-skip-text: #e65100;
    --color-workout-skip-border: #ffcc80;

    /* Mi Band / outdoor workout colors */
    --color-miband-badge-bg: #e8f5e9;
    --color-miband-badge-text: #388e3c;
    --color-miband-badge-border: #a5d6a7;
    --color-miband-chip-bg: #e8f5e9;
    --color-miband-chip-text: #2e7d32;

    /* Scanner */
    --color-scanner-bg: #000;

    /* Spacing tokens */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 24px;
    --space-2xl: 32px;

    /* Border radius tokens */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --radius-pill: 999px;

    /* Shadow tokens */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);

    /* Typography tokens */
    --font-size-xs: 11px;
    --font-size-sm: 13px;
    --font-size-md: 15px;
    --font-size-lg: 18px;
    --font-size-xl: 24px;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-bold: 600;

    /* Z-index tokens */
    --z-dropdown: 100;
    --z-overlay: 1000;
    --z-modal: 1001;
    --z-popover: 1002;
    --z-toast: 1100;

    /* ==========================================================================
       Wandergeek Design System — deep-teal stage, glossy tiles, sun accent.
       Fonts (Space Grotesk, JetBrains Mono) are loaded via <link> in
       index.html (see head block). No --wg-* token may be referenced from
       JS — CSS-only per docs/frontend.md#design-tokens.
       ========================================================================== */

    /* Wandergeek — raw palette */
    --wg-paper: #F4FBF7;
    --wg-paper-deep: #E9F3EB;
    --wg-paper-soft: #FAFEFB;
    --wg-ink: #0F5042;
    --wg-ink-85: rgba(15, 80, 66, 0.88);
    --wg-ink-70: rgba(15, 80, 66, 0.72);
    --wg-ink-55: rgba(15, 80, 66, 0.55);
    --wg-ink-35: rgba(15, 80, 66, 0.32);
    --wg-ink-15: rgba(15, 80, 66, 0.14);
    --wg-ink-08: rgba(15, 80, 66, 0.07);
    --wg-teal: #2D544F;
    --wg-teal-stage: #0f2522;
    --wg-teal-sage: #56AC8A;
    --wg-mint: #8FC5BC;
    --wg-mint-soft: #9CE4CC;
    --wg-sun: #FBBD0D;
    --wg-sun-deep: #E5A600;
    --wg-sun-soft: #FFE492;
    --wg-clay: #C6553A;
    --wg-clay-soft: #F3A693;

    /* Wandergeek — semantic aliases */
    --wg-bg-stage: var(--wg-teal-stage);
    --wg-bg-card: #254844;
    --wg-bg-card-inset: #1F3F3B;
    --wg-fg-1: var(--wg-paper);
    --wg-fg-2: rgba(244, 251, 247, 0.72);
    --wg-fg-3: rgba(244, 251, 247, 0.55);
    --wg-fg-4: rgba(244, 251, 247, 0.42);
    --wg-fg-5: rgba(244, 251, 247, 0.32);
    --wg-border-hairline: rgba(255, 255, 255, 0.06);
    --wg-border-strong: rgba(255, 255, 255, 0.12);

    /* Wandergeek — status tag triplets */
    --wg-tag-normal-bg: rgba(86, 172, 138, 0.18);
    --wg-tag-normal-fg: #9CE4CC;
    --wg-tag-normal-border: rgba(86, 172, 138, 0.3);
    --wg-tag-high-bg: rgba(251, 189, 13, 0.14);
    --wg-tag-high-fg: #FFD870;
    --wg-tag-high-border: rgba(251, 189, 13, 0.28);
    --wg-tag-alert-bg: rgba(198, 85, 58, 0.18);
    --wg-tag-alert-fg: #F3A693;
    --wg-tag-alert-border: rgba(198, 85, 58, 0.35);

    /* Wandergeek — type families (display + mono intentionally share JetBrains Mono) */
    --wg-font-display: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    --wg-font-ui: 'Space Grotesk', ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --wg-font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

    /* Wandergeek — gloss material gradients */
    --wg-gloss-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0) 50%), linear-gradient(180deg, #3C6B65 0%, #264742 100%);
    --wg-gloss-bg-sun: linear-gradient(180deg, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 55%), linear-gradient(180deg, #FFD14A 0%, #E5A600 100%);
    --wg-gloss-bg-clay: linear-gradient(180deg, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0) 55%), linear-gradient(180deg, #D8624A 0%, #A8442C 100%);
    --wg-gloss-bg-inset: linear-gradient(180deg, #1F3F3B 0%, #264742 100%);

    /* Wandergeek — gloss material shadows */
    --wg-gloss-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), inset 0 -1px 0 rgba(0, 0, 0, 0.25), 0 2px 0 rgba(0, 0, 0, 0.18), 0 6px 16px -6px rgba(0, 0, 0, 0.35);
    --wg-gloss-shadow-sun: inset 0 1px 0 rgba(255, 255, 255, 0.55), inset 0 -1px 0 rgba(0, 0, 0, 0.18), 0 2px 0 rgba(160, 110, 0, 0.4), 0 6px 18px -4px rgba(251, 189, 13, 0.45);
    --wg-gloss-shadow-inset: inset 0 2px 4px rgba(0, 0, 0, 0.35), inset 0 -1px 0 rgba(255, 255, 255, 0.04);

    /* Wandergeek — dimensional tokens (specific to the gloss material). */
    --wg-radius-gloss: 10px;
    --wg-radius-icon: 12px;
    --wg-radius-card: 14px;
    --wg-card-pad: 14px;
    --wg-icon-btn-size: 44px;
    --wg-font-size-tag: 10.5px;
    --wg-section-label-pad-top: 18px;
    /* Shared toolbar-row action button height (Round-2 defects Task 2).
       Matches the 14d / 30d / 60d range pill min-height so the primary
       action button (+Log, Add, Start) aligns on the same visual baseline
       as the sibling range/subtab pills. Used by .wg-toolbar-btn. */
    --wg-toolbar-btn-height: 36px;

    /* Wandergeek — phone chrome (Task 3). Decorative iPhone frame on desktop. */
    --wg-phone-pad: 12px;
    --wg-phone-radius: 48px;
    --wg-phone-screen-radius: 38px;
    --wg-phone-shadow:
        0 50px 100px -20px rgba(0, 0, 0, 0.7),
        0 0 0 2px rgba(255, 255, 255, 0.06),
        0 0 0 3px rgba(0, 0, 0, 0.8);
    --wg-dynamic-island-radius: 20px;
    --wg-status-bar-pad-bottom: 6px;
    --wg-status-bar-font-size: 15px;
    --wg-radius-pill: 999px;

    /* Wandergeek — bottom nav (Task 5). Multi-row nav, one slot per section. */
    --wg-bottom-nav-pad-top: 10px;
    --wg-bottom-nav-pad-x: 12px;
    --wg-bottom-nav-pad-bottom: 30px;
    --wg-bottom-nav-inner-radius: 20px;
    --wg-bottom-nav-inner-pad: 6px;
    --wg-bottom-nav-gap: 4px;
    --wg-nav-item-radius: 14px;
    --wg-nav-item-pad-y: 8px;
    --wg-nav-item-pad-x: 4px;
    --wg-nav-item-gap: 3px;
    --wg-nav-item-font-size: 9.5px;
    --wg-nav-icon-size: 22px;
    --wg-bottom-nav-z: 40;
    /* FAB sits below the fixed bottom nav (z 40) in stacking order, but
       its vertical bottom offset (--wg-bottom-nav-reserved + --space-md)
       keeps it geometrically above the nav so the two never overlap. */
    --wg-z-fab: 30;
    /* Reserved viewport-bottom space so fixed nav never occludes page content.
       Sized for the two-row default (8 items): 30px bottom pad + 12px inner pad +
       two 52px rows + 4px row gap + ~12px slack ≈ 160px. */
    --wg-bottom-nav-reserved: 160px;

    /* Wandergeek — Today screen (Task 7). Next-action, vitals grid, fuel,
       plan, streak cards. Tokens for dimensions that fall outside the
       standard --space-*/--font-size-* ladder. */
    --wg-today-gap: 10px;
    --wg-tile-pad-block: 10px;
    --wg-tile-pad-inline: 11px;
    --wg-next-action-pad-block: 10px;
    --wg-next-action-pad-inline: 12px;
    --wg-fuel-card-pad-block: 12px;
    --wg-fuel-card-pad-inline: 14px;
    --wg-section-label-gap: 6px;
    --wg-font-size-metric-value: 20px;
    --wg-font-size-fuel-value: 22px;
    --wg-font-size-fuel-pct: 16px;
    --wg-font-size-plan-value: 13px;
    --wg-font-size-streak-value: 18px;
    --wg-streak-bar-height: 22px;
    --wg-font-size-mini: 10px;
    --wg-font-size-caps: 10px;
    --wg-next-action-bg: linear-gradient(180deg, rgba(251, 189, 13, 0.18) 0%, rgba(251, 189, 13, 0.06) 100%);
    --wg-next-action-border: rgba(251, 189, 13, 0.3);
    --wg-next-action-icon-bg: rgba(251, 189, 13, 0.2);
    --wg-next-action-icon-border: rgba(251, 189, 13, 0.4);
    --wg-metric-tile-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(0, 0, 0, 0) 60%), var(--wg-bg-card);
    --wg-mini-bar-track-bg: rgba(0, 0, 0, 0.35);
    --wg-mini-bar-track-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);

    /* Wandergeek — shared chart theme (Round-2 Task 13 / defect 16).
       Single source of truth for every chart card's surface, grid-line
       stroke, and axis-tick label color/size. BP + Weight + Workout chart
       rules consume these tokens so the look stays coherent across sections
       and axis labels stay readable on the dark stage. Individual charts
       keep their own `--wg-<chart>-*` tokens for chart-specific geometry
       (line stroke width, band alpha, point radius, etc.) — but surface,
       grid, and axis tick styling MUST come from the shared tokens below. */
    --wg-chart-card-bg: var(--wg-bg-card);
    --wg-chart-card-border: var(--wg-border-hairline);
    --wg-chart-card-radius: var(--wg-radius-card);
    --wg-chart-card-pad: var(--wg-card-pad);
    --wg-chart-guide-stroke: var(--wg-fg-5);
    --wg-chart-guide-stroke-width: 1px;
    --wg-chart-guide-dasharray: 2 4;
    --wg-chart-axis-tick-color: var(--wg-fg-3);
    --wg-chart-axis-tick-size: 10px;

    /* Wandergeek — BP screen (Phase 3, Task 1). Dimensional tokens for the
       current-reading card, range selector, chart geometry, and guide-line
       strokes. Everything visual in features/bp.js reads from here. */
    --wg-bp-reading-value-size: 44px;
    --wg-bp-range-selector-height: 36px;
    --wg-bp-range-selector-pad: 4px;
    --wg-bp-chart-width: 358px;
    --wg-bp-chart-height: 200px;
    --wg-bp-chart-band-alpha: 0.18;
    --wg-bp-chart-guide-dasharray: var(--wg-chart-guide-dasharray);
    --wg-bp-chart-guide-stroke-width: var(--wg-chart-guide-stroke-width);
    --wg-bp-chart-line-stroke-width: 2px;
    --wg-bp-chart-last-point-radius: 4px;
    --wg-bp-chart-last-stroke-width: 2px;
    --wg-bp-average-value-size: 22px;
    --wg-bp-current-card-pad: 16px;
    --wg-bp-history-row-pad: 12px;

    /* BP status aliases — wrap the existing tag triplets so the BP classifier
       can return a status key (normal / highnormal / grade1 / grade2) and the
       renderer applies `.wg-bp-status--<key>` without duplicating tag styles. */
    --wg-bp-status-normal-bg: var(--wg-tag-normal-bg);
    --wg-bp-status-normal-fg: var(--wg-tag-normal-fg);
    --wg-bp-status-normal-border: var(--wg-tag-normal-border);
    --wg-bp-status-highnormal-bg: var(--wg-tag-high-bg);
    --wg-bp-status-highnormal-fg: var(--wg-tag-high-fg);
    --wg-bp-status-highnormal-border: var(--wg-tag-high-border);
    --wg-bp-status-grade1-bg: var(--wg-tag-high-bg);
    --wg-bp-status-grade1-fg: var(--wg-tag-high-fg);
    --wg-bp-status-grade1-border: var(--wg-tag-high-border);
    --wg-bp-status-grade2-bg: var(--wg-tag-alert-bg);
    --wg-bp-status-grade2-fg: var(--wg-tag-alert-fg);
    --wg-bp-status-grade2-border: var(--wg-tag-alert-border);

    /* Wandergeek — Food screen (Phase 4, Task 1). Dimensional tokens for the
       daily macros card, macro bars, sub-tab strip, day navigator, meal list,
       and edit-food modal. Every visual value in features/food.js and
       components/wg-macro-bar.js reads from here. */
    --wg-food-kcal-display-size: 30px;
    --wg-food-kcal-unit-size: 14px;
    --wg-food-kcal-pct-size: 22px;
    --wg-food-kcal-pct-label-size: 10px;
    --wg-food-macro-bar-height: 8px;
    --wg-food-macro-row-cols: 56px 1fr auto;
    --wg-food-macro-row-gap: 12px;
    --wg-food-subtab-pad-y: 6px;
    --wg-food-subtab-pad-x: 10px;
    --wg-food-subtab-gap: 4px;
    --wg-food-day-nav-icon-size: 36px;
    --wg-food-day-nav-title-size: 15px;
    --wg-food-meal-header-gap: 6px;
    --wg-food-item-row-pad: 12px;
    --wg-food-total-kcal-input: 18px;

    /* Edit-food modal (Phase 4, Task 6) — eyebrow + mono header layout, input
       wrapper padding, and the bottom action bar. */
    --wg-food-modal-eyebrow-size: 10.5px;
    --wg-food-modal-title-size: 18px;
    --wg-food-modal-row-gap: 10px;
    --wg-food-modal-section-gap: 14px;
    --wg-food-modal-input-pad-y: 10px;
    --wg-food-modal-input-pad-x: 12px;

    /* Food macro color aliases — Energy / Protein / Carbs / Fat map to the
       existing sun / mint / teal-sage / clay-soft palette so the macro-bar
       variants pick up the right fill without duplicating hex values. */
    --wg-food-macro-energy: var(--wg-sun);
    --wg-food-macro-protein: var(--wg-mint-soft);
    --wg-food-macro-carbs: var(--wg-teal-sage);
    --wg-food-macro-fat: var(--wg-clay-soft);

    /* Meds screen tokens (Phase 5, Task 1) — next-action card, schedule-hour
       headers, med row grid, inventory count mono display, sub-tab strip. */
    --wg-meds-next-card-pad: 16px;
    --wg-meds-next-subtitle-size: 11px;
    --wg-meds-next-names-size: 15px;
    --wg-meds-hour-header-size: 13px;
    --wg-meds-row-cols: 1fr auto;
    --wg-meds-row-gap: 10px;
    --wg-meds-row-pad: 12px;
    --wg-meds-name-size: 16px;
    --wg-meds-dosage-size: 12px;
    --wg-meds-inventory-count-size: 28px;
    --wg-meds-subtab-pad-y: 6px;
    --wg-meds-subtab-pad-x: 10px;
    --wg-meds-subtab-gap: 4px;

    /* Meds inventory status aliases (Phase 5, Task 1) — wrap the existing
       --wg-tag-* triplets so the inventory classifier can return a token-
       group name (ok / low / out) without duplicating tag styles. Mirrors
       the --wg-bp-status-* pattern. */
    --wg-meds-status-ok-bg: var(--wg-tag-normal-bg);
    --wg-meds-status-ok-fg: var(--wg-tag-normal-fg);
    --wg-meds-status-ok-border: var(--wg-tag-normal-border);
    --wg-meds-status-low-bg: var(--wg-tag-high-bg);
    --wg-meds-status-low-fg: var(--wg-tag-high-fg);
    --wg-meds-status-low-border: var(--wg-tag-high-border);
    --wg-meds-status-out-bg: var(--wg-tag-alert-bg);
    --wg-meds-status-out-fg: var(--wg-tag-alert-fg);
    --wg-meds-status-out-border: var(--wg-tag-alert-border);

    /* Meds history sub-tab tokens (Phase 5, Task 5) — filter strip geometry,
       day-group label size, log-row padding, trailing time + status sizes. */
    --wg-meds-filter-gap: 8px;
    --wg-meds-filter-field-pad-y: 4px;
    --wg-meds-filter-field-pad-x: 10px;
    --wg-meds-filter-label-size: 10px;
    --wg-meds-history-row-pad: 12px;
    --wg-meds-history-row-gap: 8px;
    --wg-meds-history-day-size: 11px;
    --wg-meds-history-time-size: 12px;
    --wg-meds-history-name-size: 14px;
    --wg-meds-next-intake-pad-y: 6px;
    --wg-meds-next-intake-pad-x: 10px;

    /* Meds inventory sub-tab tokens (Phase 5, Task 6) — card padding and
       gap, dosage / count-label / refilled-row type sizes. The big mono
       count reuses the existing `--wg-meds-inventory-count-size` token. */
    --wg-meds-inventory-card-pad: 14px;
    --wg-meds-inventory-card-gap: 10px;
    --wg-meds-inventory-dosage-size: 12px;
    --wg-meds-inventory-count-label-size: 12px;
    --wg-meds-inventory-refilled-size: 11px;
    --wg-meds-inventory-refill-gap: 8px;

    /* Edit-medication modal tokens (Phase 5, Task 7) — dual-line header,
       gloss-inset input wraps, schedule-pill strip, times-row layout, and
       the Cancel / Save action bar. */
    --wg-meds-modal-eyebrow-size: 10.5px;
    --wg-meds-modal-title-size: 18px;
    --wg-meds-modal-row-gap: 10px;
    --wg-meds-modal-section-gap: 14px;
    --wg-meds-modal-input-pad-y: 10px;
    --wg-meds-modal-input-pad-x: 12px;
    --wg-meds-modal-pill-gap: 4px;
    --wg-meds-modal-pill-pad-y: 6px;
    --wg-meds-modal-pill-pad-x: 10px;
    --wg-meds-modal-pill-size: 12px;
    --wg-meds-modal-label-size: 10.5px;
    --wg-meds-modal-rx-size: 11px;
    --wg-meds-modal-day-size: 32px;
    --wg-meds-modal-time-row-gap: 8px;
    --wg-meds-modal-toggle-gap: 8px;

    /* Wandergeek — Weight screen (Phase 6, Task 1). Dimensional tokens for
       the big current-weight card, trend arrow + delta, optional goal card,
       range selector, single-series chart, and day-grouped history rows.
       Everything visual in features/weight.js and components/wg-weight-chart.js
       reads from here. */
    --wg-weight-goal-card-pad: 12px;
    --wg-weight-goal-value-size: 16px;
    --wg-weight-goal-bar-height: 8px;
    --wg-weight-goal-delta-size: 11px;
    --wg-weight-range-selector-height: 36px;
    --wg-weight-range-selector-pad: 4px;
    --wg-weight-chart-width: 358px;
    --wg-weight-chart-height: 200px;
    --wg-weight-chart-line-stroke-width: 2px;
    --wg-weight-chart-goal-stroke-width: 1px;
    --wg-weight-chart-goal-dasharray: 2 4;
    --wg-weight-chart-last-point-radius: 4px;
    --wg-weight-chart-last-stroke-width: 2px;
    --wg-weight-chart-plan-stroke-width: 1.2px;
    --wg-weight-chart-plan-dasharray: 2 3;
    --wg-weight-chart-trend-stroke-width: 1px;
    --wg-weight-chart-trend-dasharray: 4 3;
    --wg-weight-chart-tick-size: 9px;
    --wg-weight-chart-goal-label-size: 9.5px;
    --wg-weight-chart-legend-swatch-w: 14px;
    --wg-weight-chart-legend-swatch-h: 2px;
    --wg-weight-chart-legend-swatch-radius: 1px;
    --wg-weight-prognosis-label-gap: 4px;
    --wg-weight-prognosis-value-size: 18px;
    --wg-weight-prognosis-trend-size: 14px;
    --wg-weight-history-row-cols: 1fr auto;
    --wg-weight-history-row-gap: 10px;
    --wg-weight-history-row-pad: 12px;
    --wg-weight-history-weight-size: 16px;
    --wg-weight-history-time-size: 12px;
    --wg-weight-history-day-size: 11px;

    /* Edit-weight modal tokens (Phase 6, Task 6) — dual-line header, gloss-inset
       input wraps, kg/lb unit-toggle pill pair, and the Cancel / Save action bar
       with 2× flex on Save per modal-button-order convention. */
    --wg-weight-modal-eyebrow-size: 10.5px;
    --wg-weight-modal-title-size: 18px;
    --wg-weight-modal-section-gap: 14px;
    --wg-weight-modal-input-pad-y: 10px;
    --wg-weight-modal-input-pad-x: 12px;
    --wg-weight-modal-weight-row-gap: 8px;
    --wg-weight-modal-unit-toggle-pad: 4px;
    --wg-weight-modal-unit-toggle-gap: 4px;
    --wg-weight-modal-unit-btn-pad-y: 6px;
    --wg-weight-modal-unit-btn-pad-x: 10px;
    --wg-weight-modal-unit-btn-size: 12px;
    --wg-weight-modal-unit-btn-min-w: 40px;
    --wg-weight-modal-label-size: 10.5px;
    --wg-weight-modal-weight-input-size: 20px;

    /* Record-BP modal tokens (Task 4b audit) — dual-line header, gloss-inset
       input wraps, 3-up Systolic/Diastolic/Pulse readings row with 20px mono
       inputs, 2-up Site/Position row, Notes textarea, and the Cancel / Save
       action bar with 2× flex on Save per modal-button-order convention. */
    --wg-bp-modal-eyebrow-size: 10.5px;
    --wg-bp-modal-title-size: 18px;
    --wg-bp-modal-section-gap: 14px;
    --wg-bp-modal-row-gap: 10px;
    --wg-bp-modal-input-pad-y: 10px;
    --wg-bp-modal-input-pad-x: 12px;
    --wg-bp-modal-label-size: 10.5px;
    --wg-bp-modal-reading-size: 20px;

    /* Take-meds (medication confirm) modal tokens (Task 4b audit) — dual-line
       header with a sun eyebrow, checkbox-style med rows (selected = green
       highlight, idle = inset dark), secondary Snooze + Skip buttons row, and
       the full-width "Confirm selected" primary button. */
    --wg-med-confirm-modal-eyebrow-size: 10.5px;
    --wg-med-confirm-modal-title-size: 22px;
    --wg-med-confirm-modal-subtitle-size: 11px;
    --wg-med-confirm-modal-row-pad-y: 10px;
    --wg-med-confirm-modal-row-pad-x: 12px;
    --wg-med-confirm-modal-row-gap: 6px;
    --wg-med-confirm-modal-check-size: 22px;
    --wg-med-confirm-modal-check-radius: 6px;
    --wg-med-confirm-modal-name-size: 13px;
    --wg-med-confirm-modal-dose-size: 10.5px;
    --wg-med-confirm-modal-action-gap: 8px;

    /* Wandergeek — Workouts screen (Phase 7, Task 1). Dimensional tokens for
       the sub-tab strip, today's-workout card, day-grouped history rows,
       session-detail view with set-by-set rows, groups/exercises list rows,
       stat tiles + chart geometry, and the log-set / edit-group / edit-
       library modals. Everything visual in features/workout.js and
       components/wg-workout-chart.js reads from here. */
    --wg-workouts-subtab-pad-y: 6px;
    --wg-workouts-subtab-pad-x: 10px;
    --wg-workouts-subtab-gap: 4px;
    --wg-workouts-today-card-pad: 16px;
    --wg-workouts-today-subtitle-size: 11px;
    --wg-workouts-today-names-size: 15px;
    --wg-workouts-today-duration-size: 12px;
    --wg-workouts-slot-tag-pad-y: 4px;
    --wg-workouts-slot-tag-pad-x: 8px;
    --wg-workouts-slot-tag-size: 11px;
    --wg-workouts-history-day-size: 11px;
    --wg-workouts-history-row-cols: 1fr auto;
    --wg-workouts-history-row-gap: 10px;
    --wg-workouts-history-row-pad: 12px;
    --wg-workouts-history-duration-size: 14px;
    --wg-workouts-history-count-size: 12px;
    --wg-workouts-session-header-size: 15px;
    --wg-workouts-session-meta-size: 11px;
    --wg-workouts-session-set-row-min-h: 28px;
    --wg-workouts-session-set-row-gap: 8px;
    --wg-workouts-session-set-row-size: 13px;
    --wg-workouts-session-action-gap: 8px;
    --wg-workouts-groups-row-cols: 1fr auto;
    --wg-workouts-groups-row-gap: 10px;
    --wg-workouts-groups-row-pad: 12px;
    --wg-workouts-groups-name-size: 15px;
    --wg-workouts-groups-count-size: 11px;
    --wg-workouts-exercises-row-cols: 1fr auto;
    --wg-workouts-exercises-row-gap: 10px;
    --wg-workouts-exercises-row-pad: 12px;
    --wg-workouts-exercises-name-size: 15px;
    --wg-workouts-stats-tile-pad: 14px;
    --wg-workouts-stats-tile-gap: 10px;
    --wg-workouts-stats-tile-value-size: 22px;
    --wg-workouts-stats-tile-label-size: 10.5px;
    --wg-workouts-stats-range-height: 36px;
    --wg-workouts-stats-range-pad: 4px;
    --wg-workouts-chart-width: 358px;
    --wg-workouts-chart-height: 200px;
    --wg-workouts-chart-line-stroke-width: 2px;
    --wg-workouts-chart-last-point-radius: 4px;
    --wg-workouts-chart-last-stroke-width: 2px;
    --wg-workouts-stats-legend-swatch-size: 10px;

    /* Log-set / edit-exercise / edit-group / edit-library modal tokens
       (Phase 7, Task 8) — mono header, gloss-inset input wraps for name /
       reps / weight / duration, Cancel + Save bar with 2× flex on Save per
       modal-button-order convention. */
    --wg-workouts-modal-eyebrow-size: 10.5px;
    --wg-workouts-modal-title-size: 18px;
    --wg-workouts-modal-row-gap: 10px;
    --wg-workouts-modal-section-gap: 14px;
    --wg-workouts-modal-input-pad-y: 10px;
    --wg-workouts-modal-input-pad-x: 12px;
    --wg-workouts-modal-label-size: 10.5px;

    /* Rotation-slot semantic aliases (Phase 7, Task 1) — wrap the shared tag
       triplets so the rotation-slot classifier (PUSH / PULL / LEGS / REST /
       AD-HOC) can return a token-group name without duplicating tag styles.
       PUSH/PULL/LEGS are the active-session variants (sun-adjacent); REST
       is the muted/normal variant; AD-HOC is the mint variant so it reads
       as a neutral "not-a-rotation-slot" tag. Mirrors the
       --wg-bp-status-* / --wg-meds-status-* pattern. */
    --wg-workouts-slot-push-bg: var(--wg-tag-high-bg);
    --wg-workouts-slot-push-fg: var(--wg-tag-high-fg);
    --wg-workouts-slot-push-border: var(--wg-tag-high-border);
    --wg-workouts-slot-pull-bg: var(--wg-tag-high-bg);
    --wg-workouts-slot-pull-fg: var(--wg-tag-high-fg);
    --wg-workouts-slot-pull-border: var(--wg-tag-high-border);
    --wg-workouts-slot-legs-bg: var(--wg-tag-high-bg);
    --wg-workouts-slot-legs-fg: var(--wg-tag-high-fg);
    --wg-workouts-slot-legs-border: var(--wg-tag-high-border);
    --wg-workouts-slot-rest-bg: var(--wg-tag-normal-bg);
    --wg-workouts-slot-rest-fg: var(--wg-tag-normal-fg);
    --wg-workouts-slot-rest-border: var(--wg-tag-normal-border);
    --wg-workouts-slot-adhoc-bg: var(--wg-tag-normal-bg);
    --wg-workouts-slot-adhoc-fg: var(--wg-tag-normal-fg);
    --wg-workouts-slot-adhoc-border: var(--wg-tag-normal-border);

    /* Wandergeek — Health screen (Phase 8, Task 1). Dimensional tokens for
       the sub-tab strip, summary tile row, range selector, sleep + steps +
       vitals charts, notes list row + edit modal. Everything visual in
       features/health.js and the three chart components (wg-sleep-chart,
       wg-steps-chart, wg-vitals-chart) reads from here. */
    --wg-health-subtab-pad-y: 6px;
    --wg-health-subtab-pad-x: 10px;
    --wg-health-subtab-gap: 4px;
    --wg-health-summary-tile-pad: 14px;
    --wg-health-summary-tile-gap: 10px;
    --wg-health-summary-tile-value-size: 22px;
    --wg-health-summary-tile-label-size: 10.5px;
    --wg-health-summary-tile-trend-size: 11px;
    --wg-health-range-selector-height: 36px;
    --wg-health-range-selector-pad: 4px;
    --wg-health-chart-width: 358px;
    --wg-health-chart-height: 200px;
    --wg-health-chart-tall-height: 240px;
    --wg-health-chart-line-stroke-width: 2px;
    --wg-health-chart-last-point-radius: 4px;
    --wg-health-chart-last-stroke-width: 2px;
    --wg-health-card-pad: 16px;
    --wg-health-card-header-size: 15px;
    --wg-health-card-stat-size: 12px;
    --wg-health-legend-badge-size: 10px;
    --wg-health-legend-gap: 8px;
    --wg-health-notes-row-cols: 1fr auto;
    --wg-health-notes-row-gap: 10px;
    --wg-health-notes-row-pad: 12px;
    --wg-health-notes-day-size: 11px;
    --wg-health-notes-time-size: 12px;
    --wg-health-notes-body-size: 14px;
    --wg-health-notes-compose-pad-y: 10px;
    --wg-health-notes-compose-pad-x: 12px;
    --wg-health-notes-compose-card-pad: 12px;
    --wg-health-notes-compose-gap: 10px;
    --wg-health-notes-compose-title-size: 13px;
    --wg-health-notes-compose-tag-size: 10.5px;
    --wg-health-notes-compose-tag-pad-y: 3px;
    --wg-health-notes-compose-tag-pad-x: 8px;
    --wg-health-notes-compose-textarea-min: 64px;
    --wg-health-notes-compose-count-size: 10.5px;
    --wg-health-notes-compose-save-min: 36px;
    --wg-health-notes-compose-save-pad-y: 9px;
    --wg-health-notes-compose-save-pad-x: 16px;
    --wg-health-notes-compose-save-size: 12.5px;
    --wg-health-notes-row-tag-size: 10px;

    /* Edit-note modal tokens (Phase 8, Task 1 / rewired Task 8) — mono header,
       gloss-inset textarea wrap, Cancel + Save action bar with 2× flex on
       Save per modal-button-order convention. */
    --wg-health-modal-eyebrow-size: 10.5px;
    --wg-health-modal-title-size: 18px;
    --wg-health-modal-row-gap: 10px;
    --wg-health-modal-section-gap: 14px;
    --wg-health-modal-input-pad-y: 10px;
    --wg-health-modal-input-pad-x: 12px;
    --wg-health-modal-label-size: 10.5px;

    /* Sleep-stage color tokens (Phase 8, Task 1) — replace hardcoded hex in
       the sleep chart. deep / light / rem / awake drive stacked-bar fills;
       hr drives the overlay line + dot + label. */
    --wg-health-sleep-deep: #5a2d9c;
    --wg-health-sleep-light: #2481cc;
    --wg-health-sleep-rem: #c161d9;
    --wg-health-sleep-awake: #e5b220;
    --wg-health-sleep-hr: #ff3b30;

    /* Steps chart color tokens (Phase 8, Task 1) — bar fill + rotated count
       label contrast. */
    --wg-health-steps-bar: #34c759;
    --wg-health-steps-label-inside: #ffffff;

    /* Vitals chart color tokens (Phase 8, Task 1) — one line color per
       vital. Used by both the shared vitals line chart today and the
       forthcoming WGVitalsChart component (Task 6) keyed by vital. */
    --wg-health-vitals-hr-line: #ff3b30;
    --wg-health-vitals-spo2-line: #32ade6;
    --wg-health-vitals-stress-line: #ff9500;

    /* Settings screen tokens (Phase 9, Task 1) — sectioned cards, canonical
       setting-row grid (left column title+description, right column control),
       token'd row hairline divider, read-only info grid used by the Timezone
       card, number-field input height for Food Targets, action-row gap. */
    --wg-settings-section-pad: 14px;
    --wg-settings-section-gap: 12px;
    --wg-settings-row-cols: 1fr auto;
    --wg-settings-row-gap: 12px;
    --wg-settings-row-pad-y: 12px;
    --wg-settings-row-pad-x: 0px;
    --wg-settings-row-divider: 1px solid var(--wg-border-hairline);
    --wg-settings-title-size: 14px;
    --wg-settings-desc-size: 12px;
    --wg-settings-info-grid-cols: max-content 1fr;
    --wg-settings-info-grid-gap: 8px;
    --wg-settings-info-label-size: 10.5px;
    --wg-settings-info-value-size: 13px;
    --wg-settings-number-field-height: 44px;
    --wg-settings-number-field-pad-x: 12px;
    --wg-settings-number-field-label-size: 10.5px;
    --wg-settings-number-grid-cols: 1fr 1fr;
    --wg-settings-number-grid-gap: 12px;
    --wg-settings-number-field-gap: 6px;
    --wg-settings-number-field-unit-size: 11px;
    --wg-settings-save-btn-min-height: 44px;
    --wg-settings-action-row-gap: 8px;
    --wg-settings-version-size: 10px;
    --wg-settings-version-pad: 20px;

    /* Toggle primitive tokens (Phase 9, Task 1) — the new WGToggle primitive
       uses these for the off / on / focus / disabled visual states. `bg` is
       the unchecked pill background, `bg-on` the checked gloss-sun
       background; `knob` / `knob-on` are the circle fills; `border-*` cover
       default / focus-visible / disabled outline variants. */
    --wg-toggle-width: 46px;
    --wg-toggle-height: 26px;
    --wg-toggle-knob-size: 20px;
    --wg-toggle-knob-pad: 3px;
    --wg-toggle-bg: var(--wg-gloss-bg-inset);
    --wg-toggle-bg-on: var(--wg-gloss-bg-sun);
    --wg-toggle-knob: var(--wg-ink-70);
    --wg-toggle-knob-on: var(--wg-ink);
    --wg-toggle-border: rgba(0, 0, 0, 0.25);
    --wg-toggle-border-focus: var(--wg-sun);
    --wg-toggle-border-disabled: var(--wg-border-hairline);
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

#app {
    padding: var(--space-lg);
    /* Reserves room for the fixed Wandergeek bottom nav (two-row default) plus
       legacy FAB space so the last card is never clipped by the nav. */
    padding-bottom: var(--wg-bottom-nav-reserved);
}

h1 {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    letter-spacing: -0.01em;
    margin-bottom: var(--space-lg);
}

h2 {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    letter-spacing: -0.01em;
}

h3 {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-bold);
    letter-spacing: -0.01em;
}

/* Sub-tabs (medications, workouts, health) */
.med-tabs,
.workout-tabs,
.health-tabs {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
    border-bottom: 2px solid var(--hint-color);
}

.med-tab,
.workout-tab,
.food-tab,
.health-tab {
    padding: var(--space-md) var(--space-xl);
    min-height: 44px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--hint-color);
    font-weight: var(--font-weight-medium);
    border-bottom: 3px solid transparent;
    transition: color 0.15s ease;
}

.med-tab.active,
.workout-tab.active,
.food-tab.active,
.health-tab.active {
    color: var(--link-color);
    border-bottom: 3px solid var(--link-color);
}

/* Sub-tab content visibility */
.med-tab-content,
.workout-tab-content,
.food-tab-content,
.health-tab-content {
    display: none;
}

.med-tab-content.active,
.workout-tab-content.active,
.food-tab-content.active,
.health-tab-content.active {
    display: block;
}

/* List Items */
.med-item,
.history-item {
    background-color: var(--secondary-bg-color);
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    border: 1px solid rgba(0, 0, 0, 0.06);
    transition: background-color 0.15s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.med-info h4 {
    margin: 0 0 var(--space-xs) 0;
    font-size: var(--font-size-md);
}

.med-info p {
    margin: 0;
    font-size: var(--font-size-sm);
    color: var(--hint-color);
}

.med-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-xs);
}


.icon-action-btn {
    min-width: 44px;
    min-height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-sm);
    margin: 0;
    transition: opacity 0.2s ease, background-color 0.2s ease;
    border-radius: var(--radius-sm);
}

.icon-action-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.icon-action-btn.delete:hover {
    background-color: rgba(255, 59, 48, 0.1);
}

.modal-action-btn {
    min-height: 44px;
    padding: 0 var(--space-lg);
    border-radius: var(--radius-lg);
    border: none;
    background-color: var(--secondary-bg-color);
    color: var(--text-color);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.modal-action-btn:hover {
    background-color: rgba(0, 0, 0, 0.08);
}

.modal-action-btn:active {
    transform: scale(0.96);
}

.modal-action-btn.delete:hover {
    background-color: rgba(255, 59, 48, 0.1);
}

/* =============================================
   Button System
   Base: .btn
   Colors: .btn-primary, .btn-secondary, .btn-danger
   Sizes: .btn-sm, (default = md), .btn-lg
   Shapes: .btn-pill, .btn-icon
   Layout: .btn-fab (fixed bottom-right FAB)
   ============================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-md);
    padding: var(--space-md) var(--space-xl);
    transition: background-color 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    box-sizing: border-box;
}

.btn:active {
    transform: scale(0.97);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary {
    background-color: var(--button-color);
    color: var(--button-text-color);
}

.btn-secondary {
    background-color: var(--secondary-bg-color);
    color: var(--text-color);
}

.btn-danger {
    background-color: var(--color-danger);
    color: white;
}

.btn-danger-outline {
    background: transparent;
    color: var(--color-danger);
    border: 1px solid var(--color-danger);
}

.btn-ghost {
    background: none;
    color: var(--hint-color);
}

.btn-sm {
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-size-xs);
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: var(--space-lg) var(--space-xl);
    font-size: var(--font-size-md);
}

.btn-pill {
    border-radius: var(--radius-pill);
}

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
}

.btn-fab {
    position: fixed;
    bottom: var(--space-xl);
    right: var(--space-xl);
    box-shadow: var(--shadow-md);
    z-index: var(--z-dropdown);
}

.btn-link {
    background: none;
    color: var(--link-color);
    padding: var(--space-sm) 0;
    font-weight: var(--font-weight-medium);
}

/* Modal */
#modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-overlay);
    z-index: var(--z-overlay);
}

#miband-workout-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--secondary-bg-color, #fff);
    padding: var(--space-xl);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 320px;
    max-height: 85vh;
    overflow-y: auto;
    z-index: var(--z-modal);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: var(--shadow-lg);
    animation: modal-enter 0.2s ease;
}

@keyframes modal-enter {
    from {
        opacity: 0;
        transform: translate(-50%, -48%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

#miband-workout-modal {
    max-width: 500px;
}


#workout-group-modal.hidden,
#workout-variant-modal.hidden,
#workout-exercise-modal.hidden,
#exercise-library-modal.hidden,
#miband-workout-modal.hidden,
#workout-session-modal.hidden,
#workout-add-exercise-to-session-modal.hidden,
#modal-overlay.hidden,
.view {
    display: none;
}

#weight-modal.hidden {
    display: none;
}

.view.active {
    display: block;
}

input {
    width: 100%;
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    border: 1px solid var(--hint-color);
    border-radius: var(--radius-sm);
    background: var(--bg-color);
    color: var(--text-color);
    box-sizing: border-box;
    font-size: var(--font-size-md);
}

.actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-md);
}

.actions button {
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--radius-sm);
    font-weight: var(--font-weight-medium);
    border: none;
    cursor: pointer;
}

/* Schedule Form */
select {
    width: 100%;
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    border: 1px solid var(--hint-color);
    border-radius: var(--radius-sm);
    background: var(--bg-color);
    color: var(--text-color);
    box-sizing: border-box;
    font-size: var(--font-size-md);
}

.hidden {
    display: none !important;
}

/* Day Selector */
.days-select {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.days-select span {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--secondary-bg-color);
    font-size: var(--font-size-xs);
    cursor: pointer;
    border: 2px solid transparent;
}

.days-select span.selected {
    background: var(--button-color);
    color: var(--button-text-color);
    border-color: var(--button-color);
}

/* Time Inputs */
.time-row {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.remove-time {
    font-size: var(--font-size-xl);
}


/* Archived Medications */
.med-item.archived {
    opacity: 0.5;
}

.med-item.archived h4 {
    text-decoration: line-through;
}

/* Form Row */
.form-row {
    margin-bottom: var(--space-lg);
}

/* Group-descriptor label replacement (for spans that describe a group of inputs) */
.form-label {
    display: block;
    margin-bottom: var(--space-sm);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-sm);
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* History Grouping */
.history-group {
    background-color: var(--secondary-bg-color);
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.history-header {
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.history-items {
    padding-left: 28px;
    /* Indent under icon */
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.history-subitem {
    background: rgba(0, 0, 0, 0.05);
    /* slightly clearer than bg */
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    display: inline-block;
}

/* Dark mode adjustment if needed */
@media (prefers-color-scheme: dark) {
    .history-subitem {
        background: rgba(255, 255, 255, 0.1);
    }
}

/* BP Section */
#bp-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* BP Modal — shell is the generic `.wg-modal` utility; `.wg-modal__title`
   owns typography. The paper-era #bp-modal h3 rule is obsolete. */

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xl);
}

.modal-header .actions {
    margin: 0;
}

.bp-inputs-row {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.bp-input-group {
    flex: 1;
}

.bp-input-group label {
    display: block;
    font-size: var(--font-size-xs);
    color: var(--hint-color);
    margin-bottom: var(--space-xs);
}

.bp-input-group input {
    width: 100%;
    padding: var(--space-md);
    border: 1px solid var(--hint-color);
    border-radius: var(--radius-sm);
    background: var(--bg-color);
    color: var(--text-color);
    box-sizing: border-box;
    font-size: var(--font-size-md);
    text-align: center;
}

#bp-list:empty::before {
    content: 'No blood pressure readings yet.';
    display: block;
    text-align: center;
    color: var(--hint-color);
    padding: 40px var(--space-xl);
}

/* Weight Section — Wandergeek chart card surface.
   Shares the same teal card background / hairline border as #bpChart so the
   weight screen matches the rest of the stage instead of showing through the
   Telegram theme's --secondary-bg-color (which is near-white on light
   clients and made the chart and Y-axis tick labels illegible). */
#weightChart {
    margin-bottom: var(--space-md);
    padding: var(--wg-chart-card-pad);
    background: var(--wg-chart-card-bg);
    border: 1px solid var(--wg-chart-card-border);
    border-radius: var(--wg-chart-card-radius);
    box-sizing: border-box;
    position: relative;
}

.wg-weight-chart-panel__current {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-sm);
    margin-bottom: var(--space-xs);
    padding: 0 2px;
}

.wg-weight-chart-panel__current-label {
    font-family: var(--wg-font-ui);
    font-size: var(--font-size-xs);
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--wg-fg-4);
}

.wg-weight-chart-panel__current-value {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-weight-goal-value-size);
    line-height: 1;
    color: var(--wg-fg-1);
    letter-spacing: -0.01em;
}

.wg-weight-chart-panel__current-unit {
    font-family: var(--wg-font-mono);
    font-size: 0.55em;
    margin-left: 0.25em;
    color: var(--wg-fg-3);
    letter-spacing: 0.04em;
}

svg.chart-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.chart-line {
    fill: none;
    stroke: var(--color-chart-accent);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chart-point {
    fill: var(--color-chart-accent);
    stroke: var(--bg-color);
    stroke-width: 2;
}

.chart-area {
    fill: rgba(78, 205, 196, 0.1);
    stroke: none;
}

.chart-label {
    font-size: var(--font-size-xs);
    fill: var(--hint-color);
    text-anchor: middle;
}

.chart-label-emphasis {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    text-anchor: middle;
}

.chart-grid {
    stroke: var(--hint-color);
    stroke-width: 0.5;
    opacity: 0.2;
    stroke-dasharray: 4 4;
}

.chart-grid-refined {
    stroke: var(--hint-color);
    stroke-width: 0.5;
    stroke-opacity: 0.08;
    stroke-dasharray: none;
}

.chart-point-latest {
    stroke: var(--bg-color);
    stroke-width: 2;
}

.chart-point-pulse {
    animation: chart-pulse 2s ease-in-out infinite;
}

@keyframes chart-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0; }
}

.chart-line-animated {
    stroke-dasharray: var(--line-length);
    stroke-dashoffset: var(--line-length);
    animation: chart-draw 0.6s ease-out forwards;
}

@keyframes chart-draw {
    to { stroke-dashoffset: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .chart-point-pulse { animation: none; opacity: 0.3; }
    .chart-line-animated { animation: none; stroke-dashoffset: 0; }
}

.chart-goal-line {
    stroke: var(--color-success);
    stroke-width: 2;
    stroke-dasharray: 6 4;
}

.chart-plan-line {
    stroke: var(--color-chart-plan);
    stroke-width: 2;
    opacity: 0.7;
}

#weight-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.inventory-badge {
    display: inline-block;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    background: rgba(78, 205, 196, 0.15);
    color: var(--color-inventory-ok);
    margin-top: var(--space-sm);
}

.inventory-badge.low {
    background: rgba(255, 59, 48, 0.15);
    color: var(--color-danger);
}

.restock-row {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

.restock-row input {
    width: 80px;
    margin-bottom: 0;
}

.restock-history {
    margin-top: var(--space-md);
    font-size: var(--font-size-xs);
    color: var(--hint-color);
}

.restock-history ul {
    list-style: none;
    padding: 0;
    margin: var(--space-xs) 0 0 0;
}

.restock-history li {
    padding: var(--space-xs) 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.hint {
    font-size: var(--font-size-xs);
    color: var(--hint-color);
    margin: var(--space-xs) 0;
}

/* Weight ruler + paper-era weight-display classes removed in Phase 6 Task 6
   (Wandergeek). The modal now uses `.wg-weight-modal__*` with a gloss-inset
   number input and a kg/lb unit-toggle pill pair; the old drag-ruler is gone. */

/* Exercise Log Entry */
.exercise-log-entry {
    background: var(--secondary-bg-color);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.exercise-log-entry h4 {
    margin: 0 0 var(--space-md) 0;
    font-size: 1.1em;
}

.log-input-row {
    display: flex;
    gap: var(--space-md);
    align-items: center;
    margin-bottom: var(--space-sm);
}

.log-input-group {
    flex: 1;
}

.log-input-group label {
    display: block;
    font-size: 0.8em;
    color: var(--hint-color);
    margin-bottom: var(--space-xs);
}

.log-input-group input {
    margin-bottom: 0;
    padding: var(--space-sm);
}

/* Workouts — "Next workout" card.
   Round-2 Task 10 (defect 13a): restyled from the legacy purple/teal
   gradient card (with white-on-gradient text, yellow accent stripe, and
   emoji-prefixed pill buttons) to Wandergeek tokens. Surface mirrors
   the Today "Next up" card + Meds History next-intake pane — elevated
   teal on the stage, hairline border, --wg-radius-card. The kicker label
   uses the muted-uppercase small caption; the title is display typeface;
   the subtitle is secondary UI text. Primary action (Start Workout /
   Continue / Cancel Skip) is .wg-toolbar-btn.wg-toolbar-btn--primary —
   yellow filled, matching every other primary CTA across the app.
   Secondary actions (Skip / Stop / Next Variant) use the shared outline
   variant .wg-toolbar-btn--secondary added in the same task. No
   gradients, no accent stripe, no emoji. */

.wg-workouts-next-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    margin-bottom: var(--space-lg);
    background: var(--wg-bg-card);
    border: 1px solid var(--wg-border-hairline);
    border-radius: var(--wg-radius-card);
    box-sizing: border-box;
}

.wg-workouts-next-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
}

.wg-workouts-next-card__kicker {
    font-family: var(--wg-font-ui);
    font-size: var(--wg-font-size-caps);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--wg-fg-3);
    font-weight: 600;
}

.wg-workouts-next-card__date {
    font-family: var(--wg-font-ui);
    font-size: var(--font-size-xs);
    color: var(--wg-fg-2);
}

.wg-workouts-next-card__info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    cursor: pointer;
}

.wg-workouts-next-card__title {
    margin: 0;
    font-family: var(--wg-font-display);
    font-size: var(--font-size-lg);
    line-height: 1.2;
    color: var(--wg-fg-1);
}

.wg-workouts-next-card__subtitle {
    margin: 0;
    font-family: var(--wg-font-ui);
    font-size: var(--font-size-sm);
    color: var(--wg-fg-2);
}

.wg-workouts-next-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.wg-workouts-next-card__actions > .wg-toolbar-btn {
    flex: 1 1 auto;
}

/* ==================== Sync Status Styles ==================== */

/* Sync Status Bar */
.sync-status-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    margin-bottom: var(--space-md);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
}

.sync-status-bar.offline {
    background: linear-gradient(135deg, var(--color-status-offline-bg-start) 0%, var(--color-status-offline-bg-end) 100%);
    color: var(--color-status-offline-text);
    border: 1px solid var(--color-status-offline-border);
}

.sync-status-bar.syncing {
    background: linear-gradient(135deg, var(--color-status-syncing-bg-start) 0%, var(--color-status-syncing-bg-end) 100%);
    color: var(--color-status-syncing-text);
    border: 1px solid var(--color-status-syncing-border);
}

.sync-status-bar.pending {
    background: linear-gradient(135deg, var(--color-status-pending-bg-start) 0%, var(--color-status-pending-bg-end) 100%);
    color: var(--color-status-pending-text);
    border: 1px solid var(--color-status-pending-border);
}

.sync-status-bar.synced {
    background: var(--secondary-bg-color);
    color: var(--hint-color);
    border: 1px solid transparent;
    padding: var(--space-xs) var(--space-lg);
}

#settings-view .sync-status-bar {
    margin: 0;
    padding: var(--space-xs) var(--space-md);
    font-size: var(--font-size-xs);
    border-radius: var(--radius-pill);
}

.sync-icon {
    font-size: var(--font-size-md);
}

.sync-icon.spinning {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Offline Banner */
.offline-banner {
    background: linear-gradient(135deg, var(--color-status-offline-bg-start) 0%, var(--color-status-offline-bg-end) 100%);
    color: var(--color-status-offline-text);
    border-bottom: 1px solid var(--color-status-offline-border);
    text-align: center;
    padding: var(--space-xs) var(--space-md);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
}

/* Offline-disabled button state */
.offline-disabled {
    opacity: 0.5;
    pointer-events: none;
    position: relative;
}

/* In-flight save state applied by saveWorkoutSessionDetails to every button
   that could re-trigger the same request (paper-era Save + Wandergeek
   Finish). Disables interaction and dims the button to match the prior
   inline opacity behavior without violating rule 3 (no inline .style.). */
.wg-btn-saving {
    opacity: 0.6;
    pointer-events: none;
}

.offline-disabled-tooltip {
    display: block;
    font-size: var(--font-size-xs);
    color: var(--hint-color);
    margin-top: var(--space-xs);
    text-align: center;
}

/* Pending Sync Indicator on Items */
.pending-sync {
    border-left: 4px solid var(--color-sync-pending) !important;
    position: relative;
}

.sync-pending-badge {
    display: inline-block;
    padding: 2px var(--space-sm);
    background: var(--color-status-pending-bg-start);
    color: var(--color-status-pending-text);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    border-radius: var(--radius-sm);
    margin-left: var(--space-sm);
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sync-rejected-badge {
    display: inline-block;
    padding: 2px var(--space-sm);
    background: var(--color-danger);
    color: #fff;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    border-radius: var(--radius-sm);
    margin-left: var(--space-sm);
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: help;
}

/* Toast Notifications */
.sync-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    z-index: var(--z-overlay);
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    max-width: 90%;
    text-align: center;
}

.sync-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.sync-toast.info {
    background: var(--color-toast-info-solid);
    color: white;
}

.sync-toast.success {
    background: var(--color-toast-success-solid);
    color: white;
}

.sync-toast.error {
    background: var(--color-toast-error-solid);
    color: white;
}

.data-refresh-banner {
    position: fixed;
    left: var(--space-lg);
    right: var(--space-lg);
    bottom: 90px;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-md);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-status-pending-border);
    background: var(--color-status-pending-bg-start);
    color: var(--color-status-pending-text);
    box-shadow: var(--shadow-lg);
}

.data-refresh-banner.hidden {
    display: none;
}

.data-refresh-banner button {
    border: none;
    border-radius: var(--radius-pill);
    background: var(--color-refresh-btn);
    color: white;
    font-weight: var(--font-weight-bold);
    padding: var(--space-sm) var(--space-lg);
    cursor: pointer;
}

/* Dark mode token overrides */
@media (prefers-color-scheme: dark) {
    :root {
        --color-status-offline-bg-start: #450a0a;
        --color-status-offline-bg-end: #7f1d1d;
        --color-status-offline-text: #fecaca;
        --color-status-offline-border: #b91c1c;
        --color-status-syncing-bg-start: #0c4a6e;
        --color-status-syncing-bg-end: #075985;
        --color-status-syncing-text: #bae6fd;
        --color-status-syncing-border: #0369a1;
        --color-status-pending-bg-start: #451a03;
        --color-status-pending-bg-end: #78350f;
        --color-status-pending-text: #fde68a;
        --color-status-pending-border: #b45309;
        --color-refresh-btn: #d97706;
    }
}

/* Settings Toggle Styles */
.setting-item {
    background-color: var(--secondary-bg-color);
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    border: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xl);
}

.setting-item.setting-item-divider {
    margin-top: var(--space-xl);
    border-top: 1px solid var(--color-border-divider);
    padding-top: var(--space-xl);
}

.setting-item h3 {
    margin: 0;
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-bold);
}

.setting-desc {
    margin: var(--space-xs) 0 0 0;
    font-size: var(--font-size-sm);
    color: var(--hint-color);
}

.food-date-nav {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    margin-bottom: var(--space-md);
}

.food-date-nav input {
    margin-bottom: 0;
}


.food-target-progress {
    margin-bottom: var(--space-md);
    padding: var(--space-lg);
    background: var(--secondary-bg-color);
    border-radius: var(--radius-md);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.food-target-row {
    margin-bottom: var(--space-md);
}

.food-target-row:last-child {
    margin-bottom: 0;
}

.food-target-topline {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-sm);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-sm);
}

.food-target-topline .food-target-name {
    font-weight: var(--font-weight-bold);
}

.food-target-topline .food-target-values {
    color: var(--hint-color);
    white-space: nowrap;
}

.food-target-bar {
    width: 100%;
    height: 8px;
    border-radius: var(--radius-pill);
    overflow: hidden;
    background: rgba(0, 0, 0, 0.12);
}

.food-target-fill {
    height: 100%;
    border-radius: var(--radius-pill);
}

.food-target-topline .food-target-values.excess-text {
    color: var(--danger-color, #ef4444);
    font-weight: var(--font-weight-bold);
}

.food-target-bar.excess {
    height: 12px;
    background: rgba(239, 68, 68, 0.15);
}

.period-link {
    color: var(--primary-color, #2481cc);
    cursor: pointer;
    transition: color 0.2s, font-weight 0.2s;
}

.period-link:active {
    opacity: 0.7;
}

.period-link.active {
    font-weight: var(--font-weight-bold);
    color: var(--text-color);
    text-decoration: underline;
}

.toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--color-toggle-inactive);
    transition: .4s;
    border-radius: var(--radius-pill);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.toggle-slider {
    background-color: var(--link-color);
}

input:checked+.toggle-slider:before {
    transform: translateX(22px);
}

#food-product-modal,
#food-save-meal-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--secondary-bg-color, #fff);
    padding: var(--space-xl);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 320px;
    max-height: 85vh;
    overflow-y: auto;
    z-index: var(--z-modal);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: var(--shadow-lg);
    animation: modal-enter 0.2s ease;
}

#food-product-modal {
    z-index: var(--z-popover);
}

#food-product-modal.hidden,
#food-save-meal-modal.hidden {
    display: none;
}

.food-search-status {
    margin: var(--space-sm) 0 0;
    font-size: var(--font-size-xs);
    color: var(--hint-color);
}

.food-search-status.loading::before {
    content: "";
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: var(--space-sm);
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: food-search-spin 0.8s linear infinite;
    vertical-align: -1px;
}

/* Custom Autocomplete — Wandergeek-styled dropdown (Phase 4 follow-up).
   Mounts inside the Food modal (`.wg-food-modal` on `--wg-bg-card`); the
   list surface uses the inset card token so items read as a recessed
   popover against the modal body. */
.autocomplete-items {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid var(--wg-border-hairline);
    border-top: none;
    z-index: var(--z-popover);
    background: var(--wg-bg-card-inset);
    color: var(--wg-fg-1);
    font-family: var(--wg-font-ui);
    border-radius: 0 0 var(--wg-radius-gloss) var(--wg-radius-gloss);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        0 8px 18px -8px rgba(0, 0, 0, 0.5);
}

.autocomplete-items div.autocomplete-item {
    padding: var(--space-md) var(--space-md);
    cursor: pointer;
    border-bottom: 1px solid var(--wg-border-hairline);
    font-size: var(--font-size-sm);
    color: var(--wg-fg-1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
}

.autocomplete-item-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--wg-fg-1);
}

.autocomplete-item-meta {
    color: var(--wg-fg-2);
    font-size: var(--font-size-xs);
}

.autocomplete-item-actions {
    display: flex;
    gap: var(--space-xs);
    flex-shrink: 0;
}

.autocomplete-action-btn {
    background: transparent;
    border: 1px solid var(--wg-border-strong);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 2px var(--space-sm);
    font-size: var(--font-size-sm);
    line-height: 1;
    color: var(--wg-fg-2);
    transition: color 0.15s, border-color 0.15s, background-color 0.15s;
}

.autocomplete-action-btn:hover {
    color: var(--wg-fg-1);
    border-color: var(--wg-mint-soft);
}

.autocomplete-action-delete:hover {
    color: var(--wg-clay-soft);
    border-color: var(--wg-clay-soft);
}

.autocomplete-items div.autocomplete-item:hover,
.autocomplete-items div.autocomplete-item.autocomplete-active {
    background: var(--wg-bg-card);
    color: var(--wg-fg-1);
}

.autocomplete-items div.autocomplete-item:hover .autocomplete-item-name,
.autocomplete-items div.autocomplete-item.autocomplete-active .autocomplete-item-name {
    color: var(--wg-fg-1);
}

.autocomplete-items div.autocomplete-item:hover .autocomplete-action-btn {
    color: var(--wg-fg-1);
    border-color: var(--wg-border-strong);
}

.autocomplete-close {
    padding: var(--space-sm) var(--space-md) !important;
    background: var(--wg-bg-card-inset);
    border-bottom: 1px solid var(--wg-border-hairline) !important;
    font-size: var(--font-size-sm) !important;
    font-weight: var(--font-weight-bold);
    color: var(--wg-fg-2);
    text-align: right;
    position: sticky;
    top: 0;
    z-index: 10;
}

.autocomplete-close:hover {
    color: var(--wg-fg-1) !important;
    background: var(--wg-bg-card) !important;
}

.autocomplete-load-more {
    padding: var(--space-md) !important;
    text-align: center;
    font-size: var(--font-size-sm) !important;
    font-weight: var(--font-weight-medium);
    color: var(--wg-mint-soft);
    background: var(--wg-bg-card-inset);
    border-top: 1px solid var(--wg-border-hairline) !important;
    border-bottom: none !important;
    position: sticky;
    bottom: 0;
    z-index: 10;
}

.autocomplete-load-more:hover {
    background: var(--wg-bg-card) !important;
    color: var(--wg-fg-1) !important;
}

.autocomplete-load-more.loading {
    color: var(--wg-fg-3);
    pointer-events: none;
    background: var(--wg-bg-card-inset);
}

.food-search-status.success {
    color: var(--color-food-status-success);
}

.food-search-status.empty {
    color: var(--color-food-status-empty);
}

.food-search-status.error {
    color: var(--color-food-status-error);
}

@keyframes food-search-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

#food-scanner-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--secondary-bg-color, #fff);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    width: min(92vw, 380px);
    z-index: 1003;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: var(--shadow-lg);
    animation: modal-enter 0.2s ease;
}

#food-scanner-modal.hidden {
    display: none;
}

.food-scanner-status {
    margin: var(--space-sm) 0 var(--space-md);
    font-size: var(--font-size-sm);
    color: var(--hint-color);
}

.food-scanner-video {
    width: 100%;
    min-height: 220px;
    max-height: 52vh;
    background: var(--color-scanner-bg);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    object-fit: cover;
}

/* Food DB / Meal DB panel (Phase 4, Task 5 follow-up). Legacy `.food-db-*`
   class names are retained on row children (actions, info, name, macros,
   meta) because the architecture test's required-class list still resolves
   against them; all visual values come from --wg-* tokens. Cards carry
   both `.wg-card` (surface treatment) and `.wg-food-db-card` (inner
   layout); the sort strip styling lives in `.wg-food-db-panel__sort` and
   `.wg-food-db-panel__sort-btn` (see Meal DB / Food DB rules further
   down), and the legacy `.fooddb-sort-*` class names remain on the HTML
   only as JS selectors (`bindFoodControls`, `loadFoodDB`). */
.food-db-actions {
    display: flex;
    gap: var(--space-xs);
    justify-content: flex-end;
    align-items: center;
    flex-shrink: 0;
    margin-left: var(--space-md);
}

.food-db-actions-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-md);
}

.food-db-info {
    flex: 1;
    min-width: 0;
}

.food-db-name {
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-md);
    margin-bottom: var(--space-xs);
    color: var(--wg-fg-1);
}

.food-db-macros {
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-sm);
    color: var(--wg-fg-3);
    letter-spacing: 0.02em;
}

.food-db-meta {
    font-size: var(--font-size-xs);
    color: var(--wg-fg-4);
    border-top: 1px solid var(--wg-border-hairline);
    padding-top: var(--space-sm);
    margin-top: var(--space-sm);
    display: flex;
    gap: var(--space-md);
    font-family: var(--wg-font-mono);
}

.food-meal-badge {
    background: var(--wg-mint-soft);
    color: var(--wg-ink);
    padding: 1px var(--space-sm);
    border-radius: var(--wg-radius-pill);
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-sm);
    margin-left: auto;
}

/* Food log items */
.food-checkbox-wrap {
    margin-right: var(--space-md);
    flex-shrink: 0;
}

.food-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.food-product-link {
    color: var(--primary-color);
    text-decoration: none;
}

/* Food floating action button */
.food-floating-btn {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-overlay);
    box-shadow: var(--shadow-md);
}

/* Food meal cards — Meal DB panel inner row layout (Phase 4, Task 5 follow-up) */
.food-meal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-md);
    margin-bottom: var(--space-sm);
}

.food-meal-info {
    flex: 1;
    min-width: 0;
}

.food-meal-name {
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-md);
    color: var(--wg-fg-1);
}

.food-meal-actions {
    display: flex;
    gap: var(--space-xs);
    flex-shrink: 0;
}

.food-nutrition-row {
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-sm);
    display: flex;
    gap: var(--space-lg);
    color: var(--wg-fg-2);
    letter-spacing: 0.02em;
}

/* Food summary */
.food-summary-block {
    margin-bottom: var(--space-lg);
    padding: var(--space-md);
    font-weight: var(--font-weight-bold);
    background: var(--secondary-bg-color);
    border-radius: var(--radius-md);
}

.food-summary-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.food-summary-details {
    font-weight: var(--font-weight-normal);
    font-size: var(--font-size-sm);
    margin-left: var(--space-md);
}

.food-select-btn {
    margin: 0;
    border: 1px solid var(--border-color, #ccc);
}

.fooddb-pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--wg-border-hairline);
}

#fooddb-page-info {
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-sm);
    color: var(--wg-fg-3);
    letter-spacing: 0.02em;
}

.pagination-buttons {
    display: flex;
    gap: var(--space-sm);
}

.pagination-buttons button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========== Utility Classes ========== */

.flex-row {
    display: flex;
    flex-direction: row;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.items-start {
    align-items: flex-start;
}

.text-center {
    text-align: center;
}

.text-hint {
    color: var(--hint-color);
}

.text-danger {
    color: var(--color-danger);
}

.text-success {
    color: var(--color-success);
}

.text-muted {
    color: var(--hint-color);
}

.cursor-pointer {
    cursor: pointer;
}

.gap-sm {
    gap: var(--space-sm);
}

.gap-md {
    gap: var(--space-md);
}

.gap-xl {
    gap: var(--space-xl);
}

.mb-xs {
    margin-bottom: var(--space-xs);
}

.mb-sm {
    margin-bottom: var(--space-sm);
}

.mb-md {
    margin-bottom: var(--space-md);
}

.mb-lg {
    margin-bottom: var(--space-lg);
}

.mt-sm {
    margin-top: var(--space-sm);
}

.mt-md {
    margin-top: var(--space-md);
}

.mt-xs {
    margin-top: var(--space-xs);
}

.m-0 {
    margin: 0;
}

.fw-medium {
    font-weight: var(--font-weight-medium);
}

.w-full {
    width: 100%;
}

/* ========== Login Page ========== */

.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    gap: var(--space-xl);
    padding: var(--space-xl);
}

.login-title {
    color: var(--text-color);
    margin-bottom: var(--space-md);
}

.login-message {
    color: var(--text-color);
    text-align: center;
    max-width: 400px;
    line-height: 1.6;
}

.login-tg-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
}

.login-tg-hint {
    margin: 0;
    color: var(--text-color);
    text-align: center;
    max-width: 320px;
    line-height: 1.5;
}

.login-tg-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md) var(--space-xl);
    font-size: var(--font-size-lg);
    background: var(--link-color);
    color: #fff;
    border-radius: var(--radius-sm);
    text-decoration: none;
}

.login-divider {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    color: var(--hint-color);
    margin: var(--space-md) 0;
}

.login-divider-line {
    flex: 1;
    height: 1px;
    background: var(--color-border-divider);
}

.login-setup-link {
    margin-top: var(--space-xs);
    font-size: var(--font-size-sm);
    color: var(--link-color);
}

/* OIDC button with dynamic color support via CSS custom properties */
.btn-oidc {
    --_oidc-bg: var(--button-color);
    --_oidc-text: var(--button-text-color);
    background: var(--_oidc-bg);
    color: var(--_oidc-text);
}

/* ========== Webpush Status ========== */

.status-success {
    color: var(--color-success);
}

.status-error {
    color: var(--color-danger);
}

.status-muted {
    color: var(--hint-color);
}

/* ========== Medication Components ========== */

.med-supplement-badge {
    margin-left: var(--space-sm);
    color: var(--hint-color);
}

.med-normalized-name {
    font-size: 0.85em;
    color: var(--hint-color);
    margin-top: -5px;
    margin-bottom: var(--space-xs);
}

.med-action-icons {
    display: flex;
    gap: var(--space-sm);
}

.med-empty-text {
    text-align: center;
    color: var(--hint-color);
}

/* ========== Next Intake Card (Meds, History) ==========
   Round-2 Task 8, defect 11b: restyled from the legacy purple-gradient
   plus translucent-pill look to Wandergeek tokens. Card surface matches
   the Today "Next up" pattern (elevated teal on the stage, hairline
   border, --wg-radius-card); kicker label is muted-uppercase small
   caption; the countdown uses the display-numeric typeface; meta line
   carries the medication names and `at DD.MM., HH:MM`. The Take Now
   CTA reuses .wg-toolbar-btn.wg-toolbar-btn--primary so its size
   matches the other primary actions across the app — color is the
   only emphasis. */

.wg-meds-next-intake-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--wg-bg-card);
    border: 1px solid var(--wg-border-hairline);
    border-radius: var(--wg-radius-card);
    box-sizing: border-box;
}

.wg-meds-next-intake-card__text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.wg-meds-next-intake-card__kicker {
    font-family: var(--wg-font-ui);
    font-size: var(--wg-font-size-caps);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--wg-fg-3);
    font-weight: 600;
}

.wg-meds-next-intake-card__time {
    font-family: var(--wg-font-display);
    font-size: var(--font-size-xl);
    line-height: 1.1;
    color: var(--wg-fg-1);
    margin-top: 2px;
}

.wg-meds-next-intake-card__meta {
    font-family: var(--wg-font-ui);
    font-size: var(--font-size-xs);
    color: var(--wg-fg-2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wg-meds-next-intake-card__cta {
    white-space: nowrap;
}

/* ========== Health Overview Charts ========== */

.chart-section {
    margin-top: var(--space-xl);
    padding: var(--space-md) 0;
}

.chart-section h3 {
    margin-bottom: var(--space-xs);
}

.chart-container {
    height: 200px;
    width: 100%;
}

.chart-container-tall {
    height: 250px;
    width: 100%;
}

.chart-stat {
    font-size: var(--font-size-xs);
    color: var(--hint-color);
    text-align: center;
    margin-top: var(--space-xs);
}

.chart-stat-spaced {
    font-size: var(--font-size-xs);
    color: var(--hint-color);
    text-align: center;
    margin-top: var(--space-sm);
}

.chart-legend {
    font-size: var(--font-size-xs);
    display: flex;
    justify-content: center;
    gap: var(--space-md);
    margin-top: var(--space-xs);
    color: var(--hint-color);
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.chart-disclaimer {
    font-size: var(--font-size-xs);
    color: var(--hint-color);
    text-align: center;
    margin-top: var(--space-2xl);
}

.chart-legend-badge {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: var(--radius-sm);
}

.chart-legend-badge-line {
    display: inline-block;
    width: 10px;
    height: 2px;
}

/* SVG charts */
.svg-chart {
    overflow: visible;
}

/* ========== List Reset ========== */

.list-reset {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* ========== Additional Utilities ========== */

.flex-1 {
    flex: 1;
}

.flex-wrap {
    flex-wrap: wrap;
}

.text-xs {
    font-size: var(--font-size-xs);
}

.text-sm {
    font-size: var(--font-size-sm);
}

.text-error {
    color: var(--color-danger);
}

.mt-lg {
    margin-top: var(--space-lg);
}

.mt-xl {
    margin-top: var(--space-xl);
}

/* ========== Empty/Error State (shared) ========== */

.empty-state-msg {
    text-align: center;
    color: var(--hint-color);
    padding: var(--space-xl);
}

.no-data-msg {
    color: var(--hint-color);
    font-size: var(--font-size-sm);
}

/* ========== PWA Update Toast ========== */

.pwa-update-toast {
    position: fixed;
    top: var(--space-xl);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(102, 126, 234, 0.95);
    color: white;
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-toast);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    display: flex;
    gap: var(--space-md);
    align-items: center;
}

.pwa-update-btn {
    background: rgba(255, 255, 255, 0.25);
    color: inherit;
    border: none;
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-sm);
    font-weight: var(--font-weight-bold);
    cursor: pointer;
    white-space: nowrap;
}

/* ========== Sync Debug Panel ========== */

.sync-debug-panel {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 40vh;
    background: rgba(0, 0, 0, 0.9);
    color: var(--color-success);
    font-family: monospace;
    font-size: var(--font-size-xs);
    overflow-y: auto;
    z-index: var(--z-toast);
    padding: var(--space-sm);
}

.sync-debug-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-sm);
}

.sync-debug-close {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: none;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
}

.sync-hint {
    font-size: var(--font-size-xs);
    opacity: 0.7;
}

.sync-hint-dim {
    font-size: var(--font-size-xs);
    opacity: 0.5;
}

/* ========== Settings Status ========== */

.settings-status {
    display: none;
}

.settings-status.visible {
    display: block;
}

/* ========== Workout Components ========== */

.workout-pending-msg {
    color: var(--hint-color);
    font-size: 0.9em;
}

.workout-variant-card {
    background: var(--wg-bg-card);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--wg-radius-card);
    margin-bottom: var(--space-sm);
    border: 1px solid var(--wg-border-hairline);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
    box-sizing: border-box;
    font-family: var(--wg-font-ui);
    color: var(--wg-fg-1);
}

.workout-variant-card strong {
    font-weight: 600;
    color: var(--wg-fg-1);
}

.workout-variant-desc {
    margin-top: 2px;
    font-size: var(--font-size-xs);
    color: var(--wg-fg-2);
}

/* Edit Variant modal exercise rows (Round-2 Task 11, #14): dark elevated-teal
   card surface matching .wg-workouts-next-card / .wg-meds-next-intake-card so
   the rows read against the modal stage instead of a legacy white card.
   Text tokens flip to paper-on-dark; the trash button hover flips to a
   light-on-dark overlay so the 44px hit target remains discoverable. */
.wg-workouts-exercise-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    margin-bottom: var(--space-sm);
    background: var(--wg-bg-card);
    border: 1px solid var(--wg-border-hairline);
    border-radius: var(--wg-radius-card);
    box-sizing: border-box;
}

.wg-workouts-exercise-row__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    cursor: pointer;
}

.wg-workouts-exercise-row__title {
    font-family: var(--wg-font-ui);
    font-size: var(--font-size-md);
    font-weight: 600;
    color: var(--wg-fg-1);
}

.wg-workouts-exercise-row__meta {
    font-family: var(--wg-font-ui);
    font-size: var(--font-size-xs);
    color: var(--wg-fg-2);
}

.wg-workouts-exercise-row__delete:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.workout-delete-btn-inline {
    position: static;
    margin-left: var(--space-md);
}

/* Workout exercise log entry */
.exercise-log-entry.unsaved {
    opacity: 0.6;
}

.exercise-log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.exercise-log-delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2em;
    min-width: 44px;
    min-height: 44px;
    padding: var(--space-xs) var(--space-sm);
    color: var(--color-danger);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.exercise-log-unsaved-hint {
    font-size: 0.75em;
    color: var(--hint-color);
    margin-bottom: var(--space-xs);
}

/* Today dashboard */
.today-root {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.today-greeting {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    letter-spacing: -0.01em;
    margin: 0;
    color: var(--text-color);
}

.today-offline-banner {
    padding: var(--space-sm) var(--space-md);
    background: var(--secondary-bg-color);
    color: var(--hint-color);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    text-align: center;
}

.today-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-md);
}

@media (min-width: 720px) {
    .today-card-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.today-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-xs);
    padding: var(--space-md);
    background: var(--secondary-bg-color);
    color: var(--text-color);
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    text-align: left;
    cursor: pointer;
    font: inherit;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
    min-height: 88px;
}

.today-card:hover:not(:disabled) {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.today-card:disabled {
    cursor: default;
    opacity: 0.7;
}

.today-card-warning {
    border-color: var(--color-warning);
}

.today-card-stale {
    border-color: var(--hint-color);
}

.today-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
}

.today-card-title {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--hint-color);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.today-card-badge {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    padding: 2px var(--space-sm);
    border-radius: var(--radius-pill);
}

.today-card-badge-warning {
    background: var(--color-warning);
    color: var(--bg-color);
}

.today-card-badge-stale {
    background: var(--hint-color);
    color: var(--bg-color);
}

.today-card-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.today-card-value {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    color: var(--text-color);
}

.today-card-detail {
    font-size: var(--font-size-sm);
    color: var(--hint-color);
}

.today-card-empty {
    font-size: var(--font-size-sm);
    color: var(--hint-color);
    margin: 0;
}

.today-card-trend {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin-top: var(--space-xs);
}

.today-trend-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: var(--hint-color);
}

.today-trend-arrow svg {
    width: 100%;
    height: 100%;
    display: block;
}

.today-trend-up {
    color: var(--color-warning);
}

.today-trend-down {
    color: var(--color-success);
}

.today-trend-flat {
    color: var(--hint-color);
}

.today-card-trend-label {
    font-size: var(--font-size-sm);
    color: var(--hint-color);
}

.today-empty {
    padding: var(--space-xl) var(--space-md);
    text-align: center;
    color: var(--hint-color);
    font-size: var(--font-size-md);
    background: var(--secondary-bg-color);
    border-radius: var(--radius-lg);
}

/* ==========================================================================
   Wandergeek primitives — gloss material classes for the deep-teal stage.
   All values come from --wg-* tokens; no hardcoded hex in this block.
   ========================================================================== */

.wg-stage {
    background:
        radial-gradient(1200px 600px at 50% -10%, rgba(86, 172, 138, 0.18), transparent 60%),
        radial-gradient(800px 500px at 80% 110%, rgba(251, 189, 13, 0.08), transparent 60%),
        var(--wg-bg-stage);
    color: var(--wg-fg-1);
    font-family: var(--wg-font-ui);
    -webkit-font-smoothing: antialiased;
}

.wg-card {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(0, 0, 0, 0) 60%),
        var(--wg-bg-card);
    border: 1px solid var(--wg-border-hairline);
    border-radius: var(--wg-radius-card);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        inset 0 -1px 0 rgba(0, 0, 0, 0.2),
        0 1px 0 rgba(0, 0, 0, 0.3);
    padding: var(--wg-card-pad);
}

.wg-card--inset {
    background: var(--wg-gloss-bg-inset);
    box-shadow: var(--wg-gloss-shadow-inset);
    border: 1px solid rgba(0, 0, 0, 0.25);
}

.wg-gloss {
    font-family: var(--wg-font-ui);
    font-weight: 600;
    color: var(--wg-fg-1);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--wg-radius-gloss);
    background: var(--wg-gloss-bg);
    box-shadow: var(--wg-gloss-shadow);
    transition: filter 120ms ease, transform 120ms ease;
    cursor: pointer;
}

.wg-gloss:active {
    transform: translateY(1px);
    filter: brightness(0.95);
}

.wg-gloss:hover {
    filter: brightness(1.07);
}

.wg-gloss--sun {
    color: var(--wg-ink);
    background: var(--wg-gloss-bg-sun);
    border-color: rgba(0, 0, 0, 0.18);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
    box-shadow: var(--wg-gloss-shadow-sun);
}

.wg-gloss--clay {
    color: var(--wg-fg-1);
    background: var(--wg-gloss-bg-clay);
    border-color: rgba(0, 0, 0, 0.2);
}

.wg-gloss--inset {
    background: var(--wg-gloss-bg-inset);
    box-shadow: var(--wg-gloss-shadow-inset);
    border: 1px solid rgba(0, 0, 0, 0.25);
    color: var(--wg-fg-1);
    border-radius: var(--wg-radius-gloss);
}

.wg-gloss--lg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: var(--space-md) var(--space-xl);
    font-size: var(--font-size-md);
}

/* Shared toolbar-row action button (Round-2 defects Task 2). Unifies the
   "primary action pill sitting next to a range/subtab track" pattern on BP
   (+Log), Weight (+Log), Meds (Add), Workouts (Start) and Food (Add). The
   per-section one-off classes (.wg-bp-range-selector__add, .wg-meds-subtabs-
   row__add, .wg-workouts-subtabs-row__add, .wg-food-day-nav__add,
   .wg-weight-header-row__add) that once repeated the same size/padding/radius
   recipe have been deleted as each per-section task migrated to this shared
   class (defects 8, 9, 10, 13b, 15).
   Size+shape only — color is provided by .wg-gloss / .wg-gloss--sun or the
   --primary modifier below. `align-self: center` defeats the
   `align-items: stretch` inflation that made the add button visually
   taller than the adjacent pills (defects 8, 10, 13b, 15). */
.wg-toolbar-btn {
    flex-shrink: 0;
    align-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    min-height: var(--wg-toolbar-btn-height);
    padding: var(--space-xs) var(--space-md);
    font-family: var(--wg-font-ui);
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-sm);
    border-radius: var(--wg-radius-gloss);
    cursor: pointer;
}

/* Primary variant — yellow filled gloss, matching .wg-gloss--sun. Color
   only; never changes size. Apply to the canonical "add/log/start" action
   in a toolbar row. */
.wg-toolbar-btn--primary {
    color: var(--wg-ink);
    background: var(--wg-gloss-bg-sun);
    border: 1px solid rgba(0, 0, 0, 0.18);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
    box-shadow: var(--wg-gloss-shadow-sun);
    transition: filter 120ms ease, transform 120ms ease;
}

.wg-toolbar-btn--primary:active {
    transform: translateY(1px);
    filter: brightness(0.95);
}

.wg-toolbar-btn--primary:hover {
    filter: brightness(1.07);
}

/* Secondary variant — outline/ghost on the teal stage. Introduced in
   Round-2 Task 10 (defect 13a) for the Workouts "Next workout" card's
   Skip / Stop / Next Variant actions. Matches the --primary variant's
   size (base class owns all sizing) — color only. */
.wg-toolbar-btn--secondary {
    color: var(--wg-fg-1);
    background: transparent;
    border: 1px solid var(--wg-border-hairline);
    box-shadow: none;
    transition: filter 120ms ease, transform 120ms ease, background-color 120ms ease;
}

.wg-toolbar-btn--secondary:active {
    transform: translateY(1px);
    filter: brightness(0.95);
}

.wg-toolbar-btn--secondary:hover {
    border-color: var(--wg-border-strong);
}

.wg-icon-btn {
    width: var(--wg-icon-btn-size);
    height: var(--wg-icon-btn-size);
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0;
}

.wg-icon-btn .wg-gloss {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--wg-radius-icon);
}

/* Wandergeek modal shell — generic card-like overlay container.
   Reused by every section that needs a centered modal dialog (BP, Food,
   Medication, Weight, Workouts). Inner layout composes __title + __body +
   __actions. Positioning/sizing mirrors the legacy #bp-modal block so the
   ModalManager open/close wiring keeps working without shell changes. */
.wg-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 320px;
    max-height: 85vh;
    overflow-y: auto;
    z-index: var(--z-modal);
    padding: var(--wg-card-pad);
    font-family: var(--wg-font-ui);
    color: var(--wg-fg-1);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(0, 0, 0, 0) 60%),
        var(--wg-bg-card);
    border: 1px solid var(--wg-border-hairline);
    border-radius: var(--wg-radius-card);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        inset 0 -1px 0 rgba(0, 0, 0, 0.2),
        0 1px 0 rgba(0, 0, 0, 0.3);
    animation: modal-enter 0.2s ease;
}

.wg-modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.wg-modal__title {
    margin: 0;
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--wg-fg-1);
}

.wg-modal__body {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.wg-modal__actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: var(--space-sm);
}

.wg-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.wg-field--row {
    display: flex;
    flex-direction: row;
    gap: var(--space-md);
}

.wg-field--row > .wg-field {
    flex: 1;
    min-width: 0;
}

.wg-label {
    font-family: var(--wg-font-ui);
    font-size: var(--font-size-xs);
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--wg-fg-3);
}

.wg-input {
    width: 100%;
    padding: var(--space-md);
    font-family: var(--wg-font-ui);
    font-size: var(--font-size-md);
    color: var(--wg-fg-1);
    background: var(--wg-bg-card-inset);
    border: 1px solid var(--wg-border-hairline);
    border-radius: var(--wg-radius-gloss);
    box-sizing: border-box;
    margin: 0;
}

.wg-select {
    width: 100%;
    padding: var(--space-md);
    font-family: var(--wg-font-ui);
    font-size: var(--font-size-md);
    color: var(--wg-fg-1);
    background: var(--wg-bg-card-inset);
    border: 1px solid var(--wg-border-hairline);
    border-radius: var(--wg-radius-gloss);
    box-sizing: border-box;
    margin: 0;
}

.wg-input:focus {
    outline: none;
    border-color: var(--wg-sun);
}

.wg-select:focus {
    outline: none;
    border-color: var(--wg-sun);
}

.wg-input::placeholder {
    color: var(--wg-fg-4);
}

textarea.wg-input {
    resize: vertical;
}

.wg-tag {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    font-family: var(--wg-font-ui);
    font-size: var(--wg-font-size-tag);
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 3px var(--space-sm);
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
}

.wg-tag--normal {
    background: var(--wg-tag-normal-bg);
    color: var(--wg-tag-normal-fg);
    border-color: var(--wg-tag-normal-border);
}

.wg-tag--high {
    background: var(--wg-tag-high-bg);
    color: var(--wg-tag-high-fg);
    border-color: var(--wg-tag-high-border);
}

.wg-tag--alert {
    background: var(--wg-tag-alert-bg);
    color: var(--wg-tag-alert-fg);
    border-color: var(--wg-tag-alert-border);
}

.wg-tag--mono {
    font-family: var(--wg-font-mono);
    letter-spacing: 0;
}

/* Sun-yellow active-chip variant. Used by the notes-composer tag chips
   (Phase 8 / Task 7) when the user picks SLEEP / STRESS / HR / SPO2 /
   STEPS / NOTE. Visual value resolves to the shared `--wg-tag-high-*`
   palette (same sun-yellow used by BP high-normal + weight trend-good)
   so no new colors enter the token set. */
.wg-tag--sun {
    background: var(--wg-tag-high-bg);
    color: var(--wg-tag-high-fg);
    border-color: var(--wg-tag-high-border);
}

.wg-section-label {
    font-family: var(--wg-font-ui);
    font-size: var(--wg-font-size-tag);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--wg-fg-4);
    padding: var(--wg-section-label-pad-top) var(--space-xs) var(--space-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    min-width: 0;
}

.wg-section-label > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wg-section-label::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--wg-sun);
    border-radius: 50%;
    margin-right: var(--space-sm);
    box-shadow: 0 0 8px var(--wg-sun);
    flex-shrink: 0;
}

.wg-mono-display {
    font-family: var(--wg-font-mono);
    font-weight: 500;
    letter-spacing: -0.02em;
    color: var(--wg-fg-1);
}

.wg-muted {
    color: var(--wg-fg-3);
}

.wg-muted-strong {
    color: var(--wg-fg-2);
}

/* ==========================================================================
   Wandergeek phone chrome — decorative iPhone frame (Task 3).
   On desktop the chrome wraps the SPA in a 390×844 phone shell with status bar,
   dynamic island, and home indicator. On mobile/PWA viewports the chrome
   collapses (display: contents on the shell, hidden ornaments) so the app
   fills the viewport. All values via --wg-* tokens.
   ========================================================================== */

.wg-phone {
    width: 390px;
    height: 844px;
    flex-shrink: 0;
    position: relative;
    background: #000;
    padding: var(--wg-phone-pad);
    border-radius: var(--wg-phone-radius);
    box-shadow: var(--wg-phone-shadow);
}

.wg-phone-screen {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: var(--wg-phone-screen-radius);
    background: var(--wg-bg-stage);
    display: flex;
    flex-direction: column;
}

.wg-phone-screen__content {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    position: relative;
}

.wg-dynamic-island {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 110px;
    height: 32px;
    background: #000;
    border-radius: var(--wg-dynamic-island-radius);
    z-index: 1003;
    pointer-events: none;
}

.wg-status-bar {
    flex-shrink: 0;
    height: 50px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 0 28px var(--wg-status-bar-pad-bottom);
    font-family: -apple-system, 'SF Pro Text', system-ui, sans-serif;
    font-size: var(--wg-status-bar-font-size);
    font-weight: 600;
    color: var(--wg-fg-1);
    z-index: 10;
    position: relative;
}

.wg-status-bar__icons {
    display: flex;
    align-items: center;
    gap: 5px;
}

.wg-home-indicator {
    position: absolute;
    bottom: 7px;
    left: 50%;
    transform: translateX(-50%);
    width: 134px;
    height: 5px;
    border-radius: var(--wg-radius-pill);
    background: rgba(255, 255, 255, 0.45);
    z-index: 1003;
    pointer-events: none;
}

/* Mobile / PWA: collapse the chrome and let the screen fill the viewport. */
@media (max-width: 480px) {
    .wg-phone {
        width: 100%;
        height: 100vh;
        height: 100dvh;
        padding: 0;
        border-radius: 0;
        box-shadow: none;
        background: var(--wg-bg-stage);
    }

    .wg-phone-screen {
        border-radius: 0;
    }

    .wg-dynamic-island,
    .wg-status-bar,
    .wg-home-indicator {
        display: none;
    }
}

/* ==========================================================================
   Wandergeek bottom nav — canonical lateral navigation (Task 5).
   One slot per real section (Today, BP, Food, Meds, Weight, Workouts, Health,
   Settings). --wg-nav-cols is set on .wg-bottom-nav__inner by JS (items.length
   drives the column count); when items > 5 the grid wraps to a second row.
   ========================================================================== */

.wg-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--wg-bottom-nav-pad-top) var(--wg-bottom-nav-pad-x) var(--wg-bottom-nav-pad-bottom);
    background: linear-gradient(180deg, rgba(15, 37, 34, 0) 0%, rgba(15, 37, 34, 0.85) 40%, rgba(15, 37, 34, 0.95) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: var(--wg-bottom-nav-z);
}

.wg-bottom-nav__inner {
    display: grid;
    grid-template-columns: repeat(var(--wg-nav-cols, 5), 1fr);
    grid-auto-flow: row;
    gap: var(--wg-bottom-nav-gap);
    padding: var(--wg-bottom-nav-inner-pad);
    border-radius: var(--wg-bottom-nav-inner-radius);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(0, 0, 0, 0) 60%),
        rgba(15, 37, 34, 0.85);
    border: 1px solid var(--wg-border-strong);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 10px 30px -8px rgba(0, 0, 0, 0.6);
}

.wg-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--wg-nav-item-gap);
    padding: var(--wg-nav-item-pad-y) var(--wg-nav-item-pad-x);
    border-radius: var(--wg-nav-item-radius);
    background: none;
    border: none;
    font-family: var(--wg-font-ui);
    font-size: var(--wg-nav-item-font-size);
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--wg-fg-4);
    cursor: pointer;
    transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.wg-nav-item > svg {
    width: var(--wg-nav-icon-size);
    height: var(--wg-nav-icon-size);
    stroke: currentColor;
    fill: none;
}

.wg-nav-item:hover:not(.wg-nav-item--active) {
    color: var(--wg-fg-2);
}

.wg-nav-item--active {
    color: var(--wg-sun);
    background: linear-gradient(180deg, rgba(251, 189, 13, 0.14) 0%, rgba(251, 189, 13, 0.05) 100%);
    box-shadow: inset 0 0 0 1px rgba(251, 189, 13, 0.22);
}

/* =============================================
   WG SCREEN STAGE — shared substrate utility
   (Phase 3, Task 4). Applies the deep-teal stage
   with radial highlights to any top-level screen
   view. Chosen over per-view rules because Phase
   4+ will reskin BP/Food/Meds/Weight/Workouts/
   Health/Settings and all need the same substrate;
   a shared class avoids per-PR thrash. `.wg-today`
   keeps its own rule for now — folding it into
   this utility is a follow-up, not part of Task 4.
   ============================================= */
.wg-screen-stage {
    color: var(--wg-fg-1);
    /* Bleed the stage past #app's padding so the palette fills edge-to-edge;
       mirrors the .wg-today pattern. */
    background:
        radial-gradient(1200px 600px at 50% -10%, rgba(86, 172, 138, 0.18), transparent 60%),
        radial-gradient(800px 500px at 80% 110%, rgba(251, 189, 13, 0.08), transparent 60%),
        var(--wg-bg-stage);
    margin: calc(var(--space-lg) * -1);
    margin-bottom: calc(var(--wg-bottom-nav-reserved) * -1);
    padding: var(--space-lg) var(--space-lg) var(--wg-bottom-nav-reserved);
    min-height: 100vh;
    box-sizing: border-box;
}

/* Empty-state copy over the dark stage: #bp-list:empty::before and
   .empty-state-msg both default to var(--hint-color) (mid-grey), which
   drops to poor contrast on --wg-bg-stage. Restore a near-white muted
   fg so the "No readings yet" / "No cached data" strings stay legible. */
.wg-screen-stage #bp-list:empty::before,
.wg-screen-stage .empty-state-msg {
    color: var(--wg-fg-3);
}

/* =============================================
   WG TODAY — Wandergeek reskin (Task 7)
   Deep-teal stage layout with: next-action
   (sun), vitals grid, fuel card + mini bars,
   plan tiles, streak card, and the sparkline
   primitive used by metric tiles.
   ============================================= */

.wg-today {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    color: var(--wg-fg-1);
    /* Bleed the deep-teal stage past #app's padding so the Wandergeek
       palette fills edge-to-edge. Without this the near-white fg tokens
       render near-invisible on the paper-white body. */
    background:
        radial-gradient(1200px 600px at 50% -10%, rgba(86, 172, 138, 0.18), transparent 60%),
        radial-gradient(800px 500px at 80% 110%, rgba(251, 189, 13, 0.08), transparent 60%),
        var(--wg-bg-stage);
    margin: calc(var(--space-lg) * -1);
    margin-bottom: calc(var(--wg-bottom-nav-reserved) * -1);
    padding: var(--space-lg) var(--space-lg) var(--wg-bottom-nav-reserved);
    min-height: 100vh;
    box-sizing: border-box;
}

.wg-next-action-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--wg-next-action-pad-block) var(--wg-next-action-pad-inline);
    background: var(--wg-next-action-bg);
    border: 1px solid var(--wg-next-action-border);
    border-radius: var(--wg-radius-card);
    color: inherit;
    font: inherit;
    text-align: left;
    width: 100%;
    /* WHY: the meds variant renders as a <div>, which defaults to
       box-sizing: content-box. Without this, width: 100% + padding
       overflows the Today stage gutter while sibling <button> cards
       (fuel/plan tiles) pick up UA border-box and stay inside it. */
    box-sizing: border-box;
    cursor: pointer;
}

/* Plain surface variant: meds card at the bottom of Today drops the
   sun-yellow banner and sits on the regular card background so the
   "Take" gloss-sun button remains the only emphasis. */
.wg-next-action-card--plain {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(0, 0, 0, 0) 60%),
        var(--wg-bg-card);
    border-color: var(--wg-border-hairline);
}

.wg-next-action-card--plain .wg-next-action-card__icon {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--wg-border-hairline);
    color: var(--wg-fg-2);
}

.wg-next-action-card--plain .wg-next-action-card__kicker {
    color: var(--wg-fg-3);
}

.wg-next-action-card__icon {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: var(--wg-radius-gloss);
    background: var(--wg-next-action-icon-bg);
    border: 1px solid var(--wg-next-action-icon-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--wg-sun);
}

.wg-next-action-card__text {
    flex: 1;
    min-width: 0;
}

.wg-next-action-card__kicker {
    font-size: var(--wg-font-size-caps);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--wg-sun-soft);
    font-weight: 600;
}

.wg-next-action-card__value {
    font-family: var(--wg-font-display);
    font-size: var(--font-size-sm);
    color: var(--wg-fg-1);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wg-next-action-card__cta {
    flex-shrink: 0;
    padding: var(--space-xs) var(--space-md);
    font-size: var(--font-size-sm);
}

.wg-section-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    padding: var(--wg-section-label-pad-top) var(--space-xs) var(--wg-section-label-gap);
}

.wg-section-label-row .wg-section-label {
    padding: 0;
}

.wg-section-label-row__hint {
    font-size: var(--wg-font-size-caps);
    color: var(--wg-fg-3);
}

.wg-vitals-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
}

.wg-metric-tile {
    padding: var(--wg-tile-pad-block) var(--wg-tile-pad-inline);
    text-align: left;
    background: var(--wg-metric-tile-bg);
    border: 1px solid var(--wg-border-hairline);
    border-radius: var(--wg-radius-card);
    color: inherit;
    font: inherit;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.wg-metric-tile__label {
    font-size: var(--wg-font-size-caps);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--wg-fg-3);
    font-weight: 600;
}

.wg-metric-tile__value {
    font-family: var(--wg-font-display);
    font-size: var(--wg-font-size-metric-value);
    font-weight: 500;
    letter-spacing: -0.02em;
    color: var(--wg-fg-1);
    line-height: 1;
}

.wg-metric-tile__value-muted {
    color: var(--wg-fg-3);
    font-weight: 500;
}

.wg-metric-tile__unit {
    font-size: var(--wg-font-size-caps);
    color: var(--wg-fg-3);
    font-family: var(--wg-font-ui);
}

.wg-metric-tile__spark {
    min-height: 22px;
}

.wg-metric-tile__status {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.wg-fuel-card {
    padding: var(--wg-fuel-card-pad-block) var(--wg-fuel-card-pad-inline);
    background: var(--wg-bg-card);
    border: 1px solid var(--wg-border-hairline);
    border-radius: var(--wg-radius-card);
    color: inherit;
    font: inherit;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
    cursor: pointer;
}

.wg-fuel-card__header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-sm);
}

.wg-fuel-card__total {
    font-family: var(--wg-font-display);
    font-size: var(--wg-font-size-fuel-value);
    line-height: 1;
    color: var(--wg-fg-1);
}

.wg-fuel-card__total-unit {
    font-family: var(--wg-font-ui);
    font-size: var(--font-size-sm);
    color: var(--wg-fg-3);
    margin-left: var(--space-xs);
}

.wg-fuel-card__pct {
    font-family: var(--wg-font-display);
    font-size: var(--wg-font-size-fuel-pct);
    color: var(--wg-sun);
    line-height: 1;
    text-align: right;
}

.wg-fuel-card__pct-label {
    font-size: var(--wg-font-size-caps);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--wg-fg-3);
    margin-top: 2px;
}

.wg-fuel-card__bars {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    margin-top: var(--space-sm);
}

.wg-mini-bar {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.wg-mini-bar__label {
    width: 52px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--wg-fg-2);
}

.wg-mini-bar__track {
    flex: 1;
    height: 6px;
    background: var(--wg-mini-bar-track-bg);
    border-radius: var(--wg-radius-pill);
    box-shadow: var(--wg-mini-bar-track-shadow);
    overflow: hidden;
    display: block;
}

.wg-mini-bar__svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* .wg-mini-bar__fill is the SVG <rect> whose `width` attribute drives the
   bar length. Colour comes from variant classes so consumers don't set
   inline fill/stroke. */
.wg-mini-bar__fill {
    fill: var(--wg-sun);
}
.wg-mini-bar__fill--sun { fill: var(--wg-sun); }
.wg-mini-bar__fill--mint { fill: var(--wg-mint-soft); }
.wg-mini-bar__fill--sage { fill: var(--wg-teal-sage); }
.wg-mini-bar__fill--sun-deep { fill: var(--wg-sun-deep); }

.wg-mini-bar__value {
    width: 44px;
    font-family: var(--wg-font-display);
    font-size: var(--wg-font-size-mini);
    color: var(--wg-fg-3);
    text-align: right;
}

.wg-plan-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
}

.wg-plan-tile {
    padding: var(--wg-tile-pad-block) var(--wg-tile-pad-inline);
    background: var(--wg-bg-card);
    border: 1px solid var(--wg-border-hairline);
    border-radius: var(--wg-radius-card);
    color: inherit;
    font: inherit;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.wg-plan-tile__header {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.wg-plan-tile__label {
    font-size: var(--wg-font-size-caps);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--wg-fg-3);
    font-weight: 600;
}

.wg-plan-tile__value {
    font-family: var(--wg-font-display);
    font-size: var(--wg-font-size-plan-value);
    color: var(--wg-fg-1);
    line-height: 1.1;
}

.wg-plan-tile__detail {
    font-size: var(--font-size-xs);
    color: var(--wg-fg-3);
}

/* Today shortcut row (Task 3) — 3 quick-log tiles that open the existing
   food / BP / weight modals directly. Uses the same material vocabulary
   as `.wg-metric-tile` so the shortcuts visually belong to the Today
   card stack. */
.wg-today-shortcuts {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-sm);
}

.wg-shortcut-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--wg-tile-pad-block) var(--space-xs);
    background: var(--wg-metric-tile-bg);
    border: 1px solid var(--wg-border-hairline);
    border-radius: var(--wg-radius-card);
    color: inherit;
    font: inherit;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
}

.wg-shortcut-tile__icon {
    width: 30px;
    height: 30px;
    border-radius: var(--wg-radius-gloss);
    background: var(--wg-next-action-icon-bg);
    border: 1px solid var(--wg-next-action-icon-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--wg-sun);
}

.wg-shortcut-tile__label {
    font-size: var(--wg-font-size-caps);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--wg-fg-2);
    font-weight: 600;
}

/* Today meds card (Task 3) — header row (icon + kicker + "Take" CTA),
   then an optional list of scheduled med names. Lives at the bottom of
   the Today stack. */
.wg-today-meds {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    align-items: stretch;
}

.wg-today-meds__head {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.wg-today-meds__list {
    list-style: none;
    margin: 0;
    padding-top: var(--space-sm);
    border-top: 1px solid var(--wg-border-hairline);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.wg-today-meds__row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.wg-today-meds__dot {
    width: 5px;
    height: 5px;
    border-radius: var(--wg-radius-pill);
    background: var(--wg-sun);
    flex-shrink: 0;
}

.wg-today-meds__name {
    font-size: var(--font-size-sm);
    color: var(--wg-fg-1);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wg-streak-card {
    padding: var(--wg-tile-pad-block) var(--space-md);
    background: var(--wg-bg-card);
    border: 1px solid var(--wg-border-hairline);
    border-radius: var(--wg-radius-card);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
}

.wg-streak-card__value {
    font-family: var(--wg-font-display);
    font-size: var(--wg-font-size-streak-value);
    color: var(--wg-sun);
    letter-spacing: -0.02em;
    line-height: 1;
}

.wg-streak-card__value-label {
    color: var(--wg-fg-3);
    font-size: var(--font-size-xs);
    letter-spacing: 0;
    margin-left: var(--space-xs);
}

.wg-streak-card__detail {
    font-size: var(--wg-font-size-caps);
    color: var(--wg-fg-3);
    margin-top: 3px;
}

.wg-streak-bars {
    display: flex;
    gap: 3px;
}

.wg-streak-bar {
    width: 5px;
    height: var(--wg-streak-bar-height);
    border-radius: 2px;
    background: var(--wg-mint-soft);
}

.wg-streak-bar--hot {
    background: var(--wg-sun);
}

/* Sparkline variants — stroke & fill colours come from a single
   `color` per variant so the <path>, fill path, and tail circle
   all track the same --wg-* token. */
.wg-sparkline {
    display: block;
    color: var(--wg-mint-soft);
}
.wg-sparkline--sun { color: var(--wg-sun); }
.wg-sparkline--mint { color: var(--wg-mint-soft); }
.wg-sparkline--mint-soft { color: var(--wg-mint-soft); }
.wg-sparkline--coral { color: var(--wg-clay-soft); }

.wg-spark {
    stroke: currentColor;
    stroke-width: 1.4;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.wg-spark-fill {
    fill: currentColor;
    opacity: 0.14;
    stroke: none;
}

.wg-spark-tail {
    fill: currentColor;
    stroke: none;
}

/* BP chart (Phase 3, Task 2) — SVG children rely solely on --wg-* tokens
   via these classes. Colors never appear inline on sys/dia/band paths or
   last-point circles. */
.wg-bp-chart {
    display: block;
    width: 100%;
    max-width: var(--wg-bp-chart-width);
    height: auto;
    margin-inline: auto;
}

.wg-bp-chart__guide {
    stroke: var(--wg-chart-guide-stroke);
    stroke-width: var(--wg-chart-guide-stroke-width);
    stroke-dasharray: var(--wg-chart-guide-dasharray);
    fill: none;
}

.wg-bp-chart__band {
    fill: var(--wg-mint-soft);
    fill-opacity: var(--wg-bp-chart-band-alpha);
    stroke: none;
}

.wg-bp-chart__sys {
    fill: none;
    stroke: var(--wg-mint-soft);
    stroke-width: var(--wg-bp-chart-line-stroke-width);
    stroke-linecap: round;
    stroke-linejoin: round;
}

.wg-bp-chart__dia {
    fill: none;
    stroke: var(--wg-teal-sage);
    stroke-width: var(--wg-bp-chart-line-stroke-width);
    stroke-linecap: round;
    stroke-linejoin: round;
}

.wg-bp-chart__last {
    fill: var(--wg-sun);
    stroke: var(--wg-teal-stage);
    stroke-width: var(--wg-bp-chart-last-stroke-width);
}

/* Round-2, Task 2 — axis tick labels. Emitted as <text> elements with a
   data-bp-axis attribute so x/y ticks can be restyled independently if
   needed. Color and size resolve via the shared --wg-chart-axis-tick-*
   tokens so the weight chart matches (Round-2 Task 13 / defect 16). */
.wg-bp-chart__axis-tick {
    fill: var(--wg-chart-axis-tick-color);
    font-family: inherit;
    font-size: var(--wg-chart-axis-tick-size);
    font-variant-numeric: tabular-nums;
}

.wg-bp-chart__axis-tick[data-bp-axis="y"] {
    text-anchor: end;
}

.wg-bp-chart__axis-tick[data-bp-axis="x"] {
    text-anchor: middle;
}

/* Weight chart (Phase 6, Task 2) — single-series line with optional goal
   overlay. Every stroke/fill resolves via tokens; SVG children carry no
   inline stroke= / fill= / style= attributes. */
.wg-weight-chart {
    display: block;
    width: 100%;
    max-width: var(--wg-weight-chart-width);
    height: auto;
    margin-inline: auto;
}

.wg-weight-chart--empty {
    min-height: var(--wg-weight-chart-height);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--wg-fg-5);
    font-size: var(--wg-weight-history-time-size);
}

.wg-weight-chart__guide {
    stroke: var(--wg-chart-guide-stroke);
    stroke-width: var(--wg-chart-guide-stroke-width);
    stroke-dasharray: var(--wg-chart-guide-dasharray);
    fill: none;
}

.wg-weight-chart__line {
    fill: none;
    stroke: var(--wg-mint-soft);
    stroke-width: var(--wg-weight-chart-line-stroke-width);
    stroke-linecap: round;
    stroke-linejoin: round;
}

.wg-weight-chart__goal {
    stroke: var(--wg-sun);
    stroke-width: var(--wg-weight-chart-goal-stroke-width);
    stroke-dasharray: var(--wg-weight-chart-goal-dasharray);
    fill: none;
}

.wg-weight-chart__last {
    fill: var(--wg-sun);
    stroke: var(--wg-teal-stage);
    stroke-width: var(--wg-weight-chart-last-stroke-width);
}

.wg-weight-chart__plan {
    stroke: var(--wg-sun);
    stroke-width: var(--wg-weight-chart-plan-stroke-width);
    stroke-dasharray: var(--wg-weight-chart-plan-dasharray);
    opacity: 0.55;
    fill: none;
}

.wg-weight-chart__trend {
    stroke: var(--wg-mint-soft);
    stroke-width: var(--wg-weight-chart-trend-stroke-width);
    stroke-dasharray: var(--wg-weight-chart-trend-dasharray);
    opacity: 0.55;
    fill: none;
}

.wg-weight-chart__y-tick-label,
.wg-weight-chart__x-tick-label {
    font-family: inherit;
    font-size: var(--wg-chart-axis-tick-size);
    font-variant-numeric: tabular-nums;
    fill: var(--wg-chart-axis-tick-color);
}

.wg-weight-chart__goal-label {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-weight-chart-goal-label-size);
    font-weight: 600;
    letter-spacing: 0.06em;
    fill: var(--wg-sun);
}

.wg-weight-chart-legend {
    display: flex;
    justify-content: center;
    gap: var(--space-md);
    margin: var(--space-xs) 0 var(--space-md);
    font-family: var(--wg-font-ui);
    font-size: var(--font-size-xs);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--wg-fg-4);
}

.wg-weight-chart-legend__item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
}

.wg-weight-chart-legend__swatch {
    display: inline-block;
    width: var(--wg-weight-chart-legend-swatch-w);
    height: var(--wg-weight-chart-legend-swatch-h);
    border-radius: var(--wg-weight-chart-legend-swatch-radius);
}

.wg-weight-chart-legend__swatch--actual {
    background: var(--wg-mint-soft);
}

.wg-weight-chart-legend__swatch--plan {
    background: var(--wg-sun);
    opacity: 0.7;
}

.wg-weight-chart-legend__swatch--goal {
    background: var(--wg-sun);
}

/* Weight prognosis card — shows days-to-goal + weekly trend using a
   simple linear-regression projection. Shown when a goal is set and we
   have enough data points; the render helper guards against NaN/Infinity
   and falls back to "—" when the projection isn't meaningful. */
.wg-weight-prognosis-card {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.wg-weight-prognosis-card__label {
    font-family: var(--wg-font-ui);
    font-size: var(--font-size-xs);
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--wg-fg-4);
}

.wg-weight-prognosis-card__value {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-weight-prognosis-value-size);
    color: var(--wg-fg-1);
    letter-spacing: -0.02em;
    margin-top: var(--wg-weight-prognosis-label-gap);
}

.wg-weight-prognosis-card__trend-value {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-weight-prognosis-trend-size);
    letter-spacing: -0.01em;
}

.wg-weight-prognosis-card__trend-value--good {
    color: var(--wg-mint-soft);
}

.wg-weight-prognosis-card__trend-value--bad {
    color: var(--wg-warn-fg, #E56B4A);
}

.wg-weight-prognosis-card__trend-value--flat {
    color: var(--wg-fg-4);
}

/* Weight goal card (Phase 6, Task 3; Round-2 Task 12 defect #15). The
   paper-era current-reading card was deleted in Round-2 Task 12 — the
   value surfaces on Today's weight tile, the chart, and the history
   list instead. The goal card renders only when a goal exists; it
   carries a mono target, a gloss-inset progress track with a
   --fill-pct width driven by goalData progress, and a muted
   “Δ kg to goal” label. */
.wg-weight-goal-card {
    padding: var(--wg-weight-goal-card-pad);
    margin-bottom: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.wg-weight-goal-card[hidden] {
    display: none;
}

.wg-weight-goal-card__label {
    padding: 0;
}

.wg-weight-goal-card__value {
    font-size: var(--wg-weight-goal-value-size);
    line-height: 1;
    color: var(--wg-fg-1);
}

.wg-weight-goal-card__track {
    position: relative;
    height: var(--wg-weight-goal-bar-height);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.wg-weight-goal-card__fill {
    height: 100%;
    width: var(--fill-pct, 0%);
    background: var(--wg-sun);
    border-radius: inherit;
    transition: width 0.4s ease;
}

.wg-weight-goal-card__delta {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-weight-goal-delta-size);
}

/* Weight range selector + chart panel (Phase 6, Task 4; Round-2 Task 12
   defect #15). Outer container is a flex row holding the inset
   7d/30d/90d/All track and the trailing inline +Log pill (via the
   shared .wg-toolbar-btn .wg-toolbar-btn--primary). Keeping the inset
   limited to the track preserves the “tabs in a trough” look while
   letting the primary action sit on the stage (mirrors
   .wg-bp-range-selector). */
.wg-weight-range-selector {
    display: flex;
    gap: var(--space-xs);
    align-items: stretch;
    margin-bottom: var(--space-md);
}

.wg-weight-range-selector__track {
    flex: 1;
    display: flex;
    gap: var(--space-xs);
    padding: var(--wg-weight-range-selector-pad);
}

.wg-weight-range-selector__btn {
    flex: 1;
    min-height: var(--wg-weight-range-selector-height);
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-sm);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--wg-radius-gloss);
}

.wg-weight-chart-panel {
    padding: var(--wg-chart-card-pad);
    margin-bottom: var(--space-md);
    background: var(--wg-chart-card-bg);
    border: 1px solid var(--wg-chart-card-border);
    border-radius: var(--wg-chart-card-radius);
}

/* Weight history list (Phase 6, Task 5). Day-grouped gloss cards with a
   mono weight value, ISO-local time, optional sync badge, and a trailing
   edit/delete icon-button cluster. Mirrors the .wg-bp-history structure. */
.wg-weight-history {
    list-style: none;
    padding: 0;
    margin: 0;
}

.wg-weight-history__group {
    list-style: none;
    margin-bottom: var(--space-md);
}

.wg-weight-history__group-label {
    padding-top: var(--wg-section-label-pad-top);
    padding-bottom: var(--space-sm);
    font-size: var(--wg-weight-history-day-size);
}

.wg-weight-history__rows {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.wg-weight-history-row {
    padding: var(--wg-weight-history-row-pad);
    display: grid;
    grid-template-columns: var(--wg-weight-history-row-cols);
    gap: var(--wg-weight-history-row-gap);
    align-items: center;
}

.wg-weight-history-row__body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.wg-weight-history-row__value {
    font-size: var(--wg-weight-history-weight-size);
    line-height: 1.1;
    display: inline-flex;
    align-items: baseline;
    gap: var(--space-xs);
}

.wg-weight-history-row__unit {
    font-size: var(--wg-weight-history-time-size);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--wg-fg-4);
}

.wg-weight-history-row__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-xs);
}

.wg-weight-history-row__time {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-weight-history-time-size);
    color: var(--wg-fg-3);
    letter-spacing: 0.02em;
}

.wg-weight-history-row__actions {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}


/* Edit-weight modal (Phase 6, Task 6) — shares the generic `.wg-modal` shell
   for positioning and chrome; overlays a dual-line mono header, gloss input
   wraps, a kg/lb unit-toggle pill pair, and a Cancel/Save action bar where
   Save carries 2× flex per modal-button-order convention. Every visual value
   resolves to a `--wg-weight-modal-*` or shared `--wg-*` token. */
.wg-weight-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.wg-weight-modal__heading {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    min-width: 0;
}

.wg-weight-modal__eyebrow {
    padding: 0;
    font-size: var(--wg-weight-modal-eyebrow-size);
    color: var(--wg-fg-3);
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.wg-weight-modal__eyebrow::before {
    content: none;
}

.wg-weight-modal__title {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-weight-modal-title-size);
    color: var(--wg-fg-1);
    line-height: 1.1;
}

.wg-weight-modal__body {
    display: flex;
    flex-direction: column;
    gap: var(--wg-weight-modal-section-gap);
}

.wg-weight-modal__field {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    min-width: 0;
}

.wg-weight-modal__label {
    font-size: var(--wg-weight-modal-label-size);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--wg-fg-3);
    font-weight: var(--font-weight-bold);
}

.wg-weight-modal__input-wrap {
    padding: var(--wg-weight-modal-input-pad-y) var(--wg-weight-modal-input-pad-x);
    display: flex;
    align-items: center;
    min-width: 0;
}

.wg-weight-modal__input {
    width: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    outline: none;
    box-shadow: none;
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-md);
    color: var(--wg-fg-1);
    min-width: 0;
}

.wg-weight-modal__input::placeholder {
    color: var(--wg-fg-4);
}

.wg-weight-modal__textarea {
    resize: vertical;
    font-family: var(--wg-font-ui);
}

.wg-weight-modal__weight-row {
    display: flex;
    align-items: stretch;
    gap: var(--wg-weight-modal-weight-row-gap);
}

.wg-weight-modal__weight-wrap {
    flex: 1 1 0;
    min-width: 0;
}

.wg-weight-modal__weight-input {
    font-size: var(--wg-weight-modal-weight-input-size);
    -moz-appearance: textfield;
    appearance: textfield;
}

.wg-weight-modal__weight-input::-webkit-inner-spin-button,
.wg-weight-modal__weight-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.wg-weight-modal__unit-toggle {
    display: flex;
    gap: var(--wg-weight-modal-unit-toggle-gap);
    padding: var(--wg-weight-modal-unit-toggle-pad);
    align-items: stretch;
}

.wg-weight-modal__unit-btn {
    min-width: var(--wg-weight-modal-unit-btn-min-w);
    padding: var(--wg-weight-modal-unit-btn-pad-y) var(--wg-weight-modal-unit-btn-pad-x);
    font-family: var(--wg-font-ui);
    font-size: var(--wg-weight-modal-unit-btn-size);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--wg-fg-2);
    border-radius: var(--wg-radius-gloss);
    cursor: pointer;
}

.wg-weight-modal__unit-btn[aria-pressed="true"] {
    color: var(--wg-ink);
}

.wg-weight-modal__header-actions {
    display: flex;
    gap: var(--space-xs);
    align-items: center;
    flex-shrink: 0;
}

.wg-weight-modal__header-btn {
    min-height: 36px;
    padding: var(--space-xs) var(--space-sm);
    font-family: var(--wg-font-ui);
    font-size: var(--font-size-sm);
    border-radius: var(--wg-radius-gloss);
    cursor: pointer;
    white-space: nowrap;
}

.wg-weight-modal__header-btn--save {
    padding: var(--space-xs) var(--space-md);
}

/* Record-BP modal (Task 4b audit) — shares the generic `.wg-modal` shell;
   overlays the dual-line eyebrow/title header, gloss-inset input wraps, a
   3-up Systolic/Diastolic/Pulse row with 20px mono readings, a 2-up
   Site/Position row, Notes textarea, and the Cancel/Save action bar with a
   2× flex on Save per the modal-button-order convention. Every visual value
   reads from a `--wg-bp-modal-*` or shared `--wg-*` token. */
.wg-bp-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.wg-bp-modal__heading {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    min-width: 0;
}

.wg-bp-modal__eyebrow {
    padding: 0;
    font-size: var(--wg-bp-modal-eyebrow-size);
    color: var(--wg-fg-3);
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.wg-bp-modal__eyebrow::before {
    content: none;
}

.wg-bp-modal__title {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-bp-modal-title-size);
    color: var(--wg-fg-1);
    line-height: 1.1;
}

.wg-bp-modal__body {
    display: flex;
    flex-direction: column;
    gap: var(--wg-bp-modal-section-gap);
}

.wg-bp-modal__field {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    min-width: 0;
}

.wg-bp-modal__label {
    font-size: var(--wg-bp-modal-label-size);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--wg-fg-3);
    font-weight: var(--font-weight-bold);
}

.wg-bp-modal__input-wrap {
    padding: var(--wg-bp-modal-input-pad-y) var(--wg-bp-modal-input-pad-x);
    display: flex;
    align-items: center;
    min-width: 0;
}

.wg-bp-modal__input {
    width: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    outline: none;
    box-shadow: none;
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-md);
    color: var(--wg-fg-1);
    min-width: 0;
}

.wg-bp-modal__input::placeholder {
    color: var(--wg-fg-4);
}

.wg-bp-modal__input--reading {
    font-size: var(--wg-bp-modal-reading-size);
}

.wg-bp-modal__textarea {
    resize: vertical;
    font-family: var(--wg-font-ui);
}

.wg-bp-modal__select {
    font-family: var(--wg-font-ui);
    appearance: none;
    -webkit-appearance: none;
}

.wg-bp-modal__row {
    display: flex;
    gap: var(--wg-bp-modal-row-gap);
    align-items: flex-end;
}

.wg-bp-modal__row > .wg-bp-modal__field {
    flex: 1 1 0;
    min-width: 0;
}

.wg-bp-modal__header-actions {
    display: flex;
    gap: var(--space-xs);
    align-items: center;
    flex-shrink: 0;
}

.wg-bp-modal__header-btn {
    min-height: 36px;
    padding: var(--space-xs) var(--space-sm);
    font-family: var(--wg-font-ui);
    font-size: var(--font-size-sm);
    border-radius: var(--wg-radius-gloss);
    cursor: pointer;
    white-space: nowrap;
}

.wg-bp-modal__header-btn--save {
    padding: var(--space-xs) var(--space-md);
}

/* BP screen — current-reading card, range selector, chart card (Phase 3, Task 3).
   The current-reading card shows a 44px mono sys/dia display, a status tag via
   --wg-bp-status-* aliases, an optional pulse sparkline, and a kicker label.
   The range selector is a gloss-inset strip with three gloss buttons; the
   active one picks up the sun modifier. Dimensions come entirely from tokens. */
.wg-bp-current-card {
    padding: var(--wg-bp-current-card-pad);
    margin-bottom: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.wg-bp-current-card__kicker {
    padding: 0;
}

.wg-bp-current-card__value {
    font-size: var(--wg-bp-reading-value-size);
    line-height: 1;
    color: var(--wg-fg-1);
}

.wg-bp-current-card__dia {
    color: var(--wg-fg-4);
}

.wg-bp-current-card__meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.wg-bp-current-card__pulse {
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-sm);
}

.wg-bp-current-card__spark {
    display: flex;
    align-items: center;
    color: var(--wg-sun);
}

.wg-bp-current-card__empty {
    font-size: var(--font-size-md);
}

.wg-bp-status {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    font-family: var(--wg-font-ui);
    font-size: var(--wg-font-size-tag);
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 3px var(--space-sm);
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
}

.wg-bp-status--normal {
    background: var(--wg-bp-status-normal-bg);
    color: var(--wg-bp-status-normal-fg);
    border-color: var(--wg-bp-status-normal-border);
}

.wg-bp-status--highnormal {
    background: var(--wg-bp-status-highnormal-bg);
    color: var(--wg-bp-status-highnormal-fg);
    border-color: var(--wg-bp-status-highnormal-border);
}

.wg-bp-status--grade1 {
    background: var(--wg-bp-status-grade1-bg);
    color: var(--wg-bp-status-grade1-fg);
    border-color: var(--wg-bp-status-grade1-border);
}

.wg-bp-status--grade2 {
    background: var(--wg-bp-status-grade2-bg);
    color: var(--wg-bp-status-grade2-fg);
    border-color: var(--wg-bp-status-grade2-border);
}

/* Range selector row (Phase 5, Task 5). Outer container is a plain flex
   row holding the inset 14/30/60d track and the trailing inline +Log pill.
   Keeping the inset limited to the track preserves the "tabs in a trough"
   look while letting the sun-gloss action button sit on the stage. */
.wg-bp-range-selector {
    display: flex;
    gap: var(--space-xs);
    align-items: stretch;
    margin-bottom: var(--space-md);
}

.wg-bp-range-selector__track {
    flex: 1;
    display: flex;
    gap: var(--space-xs);
    padding: var(--wg-bp-range-selector-pad);
}

.wg-bp-range-selector__btn {
    flex: 1;
    min-height: var(--wg-bp-range-selector-height);
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-sm);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--wg-radius-gloss);
}

/* Round-2 Task 5 (defect 8): the BP +Log button adopted the shared
   .wg-toolbar-btn .wg-toolbar-btn--primary (see ~line 3295). The per-section
   .wg-bp-range-selector__add / __add-label rules were removed — the label
   below the icon now uses the shared .wg-toolbar-btn__label. */
.wg-toolbar-btn__label {
    letter-spacing: 0.02em;
}

.wg-bp-chart-card {
    padding: var(--wg-chart-card-pad);
    margin-bottom: var(--space-md);
    background: var(--wg-chart-card-bg);
    border: 1px solid var(--wg-chart-card-border);
    border-radius: var(--wg-chart-card-radius);
}

/* 3-up averages grid (14d / 30d / 60d). Each tile reuses .wg-card as the
   gloss-card substrate and stacks section-label → mono-display value →
   unit suffix → optional readings meta. Missing stats collapse to "—"
   with .wg-bp-average-card__value--empty dimming the glyph. */
.wg-bp-averages {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.wg-bp-average-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-xs);
    min-width: 0;
}

.wg-bp-average-card__label {
    padding: 0;
    margin: 0;
}

.wg-bp-average-card__value {
    font-size: var(--wg-bp-average-value-size);
    line-height: 1.1;
}

.wg-bp-average-card__value--empty {
    color: var(--wg-fg-4);
}

.wg-bp-average-card__unit {
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-xs);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.wg-bp-average-card__meta {
    font-size: var(--font-size-xs);
}

/* Day-grouped history list (Phase 3, Task 5). Groups use `.wg-section-label`
   day headers; each reading is a `.wg-card` row with mono sys/dia values,
   a status tag, optional pulse tag, and a trailing .wg-icon-btn delete. */
.wg-bp-history {
    list-style: none;
    padding: 0;
    margin: 0;
}

.wg-bp-history__group {
    list-style: none;
    margin-bottom: var(--space-md);
}

.wg-bp-history__group-label {
    padding-top: var(--wg-section-label-pad-top);
    padding-bottom: var(--space-sm);
}

.wg-bp-history__rows {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.wg-bp-reading-row {
    padding: var(--wg-bp-history-row-pad);
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.wg-bp-reading-row__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.wg-bp-reading-row__value {
    font-size: var(--wg-bp-average-value-size);
    line-height: 1.1;
}

.wg-bp-reading-row__dia {
    color: var(--wg-fg-4);
}

.wg-bp-reading-row__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-xs);
}

.wg-bp-reading-row__time {
    font-family: var(--wg-font-mono);
    color: var(--wg-fg-3);
    letter-spacing: 0.02em;
}

.wg-bp-reading-row__actions {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.wg-tag--pending {
    background: var(--wg-tag-high-bg);
    color: var(--wg-tag-high-fg);
    border-color: var(--wg-tag-high-border);
}

.wg-tag--rejected {
    background: var(--wg-tag-alert-bg);
    color: var(--wg-tag-alert-fg);
    border-color: var(--wg-tag-alert-border);
}

/* Food macro bar (Phase 4, Task 2) — reusable row rendered by
   components/wg-macro-bar.js. Four variants (Energy / Protein / Carbs /
   Fat) swap the fill color via --wg-food-macro-* tokens. The fill width
   is driven dynamically from JS via the neutral --fill-pct custom
   property so no color or visual token ever appears in the component
   source. */
.wg-macro-bar {
    display: grid;
    grid-template-columns: var(--wg-food-macro-row-cols);
    gap: var(--wg-food-macro-row-gap);
    align-items: center;
}

.wg-macro-bar__label {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    color: var(--wg-fg-2);
}

.wg-macro-bar__track {
    height: var(--wg-food-macro-bar-height);
    border-radius: var(--wg-radius-pill);
    overflow: hidden;
    padding: 0;
}

.wg-macro-bar__fill {
    height: 100%;
    width: var(--fill-pct, 0%);
    border-radius: var(--wg-radius-pill);
    transition: width 400ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.wg-macro-bar__fill--energy {
    background: var(--wg-food-macro-energy);
}

.wg-macro-bar__fill--protein {
    background: var(--wg-food-macro-protein);
}

.wg-macro-bar__fill--carbs {
    background: var(--wg-food-macro-carbs);
}

.wg-macro-bar__fill--fat {
    background: var(--wg-food-macro-fat);
}

.wg-macro-bar__value {
    min-width: 72px;
    text-align: right;
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-xs);
    color: var(--wg-fg-3);
}

.wg-macro-bar__value-target {
    color: var(--wg-fg-4);
}

@media (prefers-reduced-motion: reduce) {
    .wg-macro-bar__fill {
        transition: none;
    }
}

/* Daily macros card (Phase 4, Task 4). `.wg-card` shell with a mono kcal
   total on the left, sun-tinted `% of target` on the right, and four
   WGMacroBar rows stacked below. Populated by renderFoodMacrosCard()
   from features/food.js; hidden for week / 2-week periods. */
.wg-food-macros-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.wg-food-macros-card__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-sm);
}

.wg-food-macros-card__total {
    display: flex;
    align-items: baseline;
    gap: var(--space-xs);
}

.wg-food-macros-card__kcal {
    font-size: var(--wg-food-kcal-display-size);
    line-height: 1;
}

.wg-food-macros-card__unit {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-food-kcal-unit-size);
    color: var(--wg-fg-3);
    text-transform: lowercase;
}

.wg-food-macros-card__percent {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    font-family: var(--wg-font-mono);
    color: var(--wg-fg-3);
    line-height: 1;
}

.wg-food-macros-card__percent-value {
    color: var(--wg-sun);
    font-size: var(--wg-food-kcal-pct-size);
    font-weight: var(--font-weight-bold);
    letter-spacing: -0.02em;
    line-height: 1;
}

.wg-food-macros-card__percent-label {
    color: var(--wg-fg-4);
    font-family: var(--wg-font-ui);
    font-size: var(--wg-food-kcal-pct-label-size);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 600;
    margin-top: 2px;
}

.wg-food-macros-card__bars {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

/* Phase 5, Task 4 — outer `.wg-food-subtabs` strip was retired in favor of
   an inline +Add button in the day navigator and a Daily/Weekly segmented
   toggle inside the macros card. Rules for `.wg-food-subtabs` and
   `.wg-food-subtabs__btn` were removed alongside the markup. */

/* In-card Daily/Weekly toggle (Phase 5, Task 4). Inset pill strip that sits
   above the kcal total inside `.wg-food-macros-card`; the active pill uses
   the sun-gloss gradient vocabulary. All values resolve through existing
   `--wg-*` tokens — no hardcoded colors. */
.wg-food-macros-card__header-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-xs);
    min-width: 0;
}

.wg-food-macros-card__toggle {
    display: inline-flex;
    gap: var(--space-xs);
    padding: var(--space-xs);
    border-radius: var(--wg-radius-gloss);
}

.wg-food-macros-card__toggle-btn {
    padding: var(--space-xs) var(--space-sm);
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-xs);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-weight: var(--font-weight-bold);
    color: var(--wg-fg-4);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--wg-radius-gloss);
    cursor: pointer;
}

.wg-food-macros-card__toggle-btn--active {
    color: var(--wg-sun);
    background: var(--wg-gloss-bg-sun);
    border-color: var(--wg-border-strong);
    box-shadow: var(--wg-gloss-shadow-sun);
}

.wg-food-macros-card__avg {
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-xs);
    color: var(--wg-fg-4);
    margin-top: var(--space-xs);
}

/* Food library entry (Phase 5, Task 4). Ghost-link row below the meal list
   that reveals the collapsed My Meals + Food DB panels. Keeps the sections
   reachable after the outer tab strip was removed. */
.wg-food-library-entry {
    display: flex;
    justify-content: center;
    margin-top: var(--space-lg);
    margin-bottom: var(--space-md);
}

.wg-food-library-entry__btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-md);
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-xs);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--wg-fg-3);
    background: transparent;
    border: 1px solid var(--wg-border-hairline);
    border-radius: var(--wg-radius-gloss);
    cursor: pointer;
}

.wg-food-library-entry__btn--open .wg-food-library-entry__chevron {
    transform: rotate(180deg);
}

.wg-food-library-entry__chevron {
    display: inline-block;
    transition: transform 160ms ease;
}

.wg-food-library-view {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    margin-top: var(--space-md);
    margin-bottom: var(--space-md);
}

/* Meds sub-tab strip (Phase 5, Task 2; revised Task 5; Round-2 Task 7).
   `.wg-gloss--inset` container wraps three `.wg-gloss`-capable pills —
   History (default) / Schedule / Inventory — the active pill carries
   `.wg-gloss--sun` (plus `.wg-meds-subtabs__btn--active` for tests).
   Round-2 Task 7 removed the trailing add-medication pill from this row
   (the Add CTA is now scoped to the Schedule subtab via
   `.wg-meds-schedule-header` below) so History and Inventory no longer
   show an irrelevant control. The outer `.wg-meds-subtabs-row` wrapper
   is retained for layout stability and to keep legacy selectors happy. */
.wg-meds-subtabs-row {
    display: flex;
    gap: var(--space-xs);
    align-items: stretch;
    margin-bottom: var(--space-md);
}

.wg-meds-subtabs {
    flex: 1;
    display: flex;
    gap: var(--wg-meds-subtab-gap);
    padding: var(--wg-meds-subtab-pad-y) var(--wg-meds-subtab-pad-x);
}

.wg-meds-subtabs__btn {
    flex: 1;
    min-height: 36px;
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-sm);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--wg-radius-gloss);
}

/* Schedule-subtab header (Round-2 Task 7 — defect #10).
   Hosts the #add-btn Add-medication pill at the top of the Schedule list.
   Because this row lives inside `#med-schedule-tab` (a `.med-tab-content`
   that toggles `display:none` when inactive), the Add control is only
   visible while Schedule is the active subtab — History and Inventory
   render without an Add control, per the defect report. */
.wg-meds-schedule-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: var(--space-sm);
}

/* Workouts sub-tab strip (Phase 7, Task 2; revised Task 5; Round-2 Task 10).
   `.wg-gloss--inset` container wraps four `.wg-gloss`-capable pills — History /
   Groups / Exercises / Stats — the active pill carries `.wg-gloss--sun` (plus
   `.wg-workouts-subtabs__btn--active` for tests). The strip is wrapped by a
   `.wg-workouts-subtabs-row` flex container that also holds the inline
   `#start-adhoc-workout-btn` ad-hoc CTA on the right. Round-2 Task 10
   (defect 13b) migrated the Start button from its per-section
   `.wg-workouts-subtabs-row__add` one-off onto the shared
   `.wg-toolbar-btn .wg-toolbar-btn--primary` class so its height aligns
   with the sibling subtab pills. */
.wg-workouts-subtabs-row {
    display: flex;
    gap: var(--space-xs);
    align-items: stretch;
    margin-bottom: var(--space-md);
}

.wg-workouts-subtabs {
    flex: 1;
    display: flex;
    gap: var(--wg-workouts-subtab-gap);
    padding: var(--wg-workouts-subtab-pad-y) var(--wg-workouts-subtab-pad-x);
}

.wg-workouts-subtabs__btn {
    flex: 1;
    min-height: 36px;
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-sm);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--wg-radius-gloss);
}

/* Health sub-tab strip (Phase 8, Task 2). `.wg-gloss--inset` container wraps
   two `.wg-gloss`-capable pills — Overview / Notes — the active pill carries
   `.wg-gloss--sun` (plus `.wg-health-subtabs__btn--active` for tests).
   Mirrors the Phase 4 Food / Phase 5 Meds / Phase 7 Workouts sub-tab strips. */
.wg-health-subtabs {
    display: flex;
    gap: var(--wg-health-subtab-gap);
    padding: var(--wg-health-subtab-pad-y) var(--wg-health-subtab-pad-x);
    margin-bottom: var(--space-md);
}

.wg-health-subtabs__btn {
    flex: 1;
    min-height: 36px;
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-sm);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--wg-radius-gloss);
}

/* Health summary tile row (Phase 8, Task 3). Grid of mono stat tiles — one
   per vital (sleep hours, steps, HR avg, SpO2 avg, stress avg) — on top of
   the Overview sub-tab. Trend arrow per tile is colored by a per-vital
   "good direction" classifier (sun / alert / neutral / empty). */
.wg-health-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
    gap: var(--wg-health-summary-tile-gap);
    padding: var(--wg-health-summary-tile-pad);
    margin-bottom: var(--space-md);
}

.wg-health-summary__tile {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    min-width: 0;
}

.wg-health-summary__value {
    font-size: var(--wg-health-summary-tile-value-size);
    line-height: 1.1;
}

.wg-health-summary__tile--empty .wg-health-summary__value {
    color: var(--wg-fg-3);
}

.wg-health-summary__label {
    font-size: var(--wg-health-summary-tile-label-size);
    padding: 0;
}

.wg-health-summary__trend {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-health-summary-tile-trend-size);
    color: var(--wg-fg-3);
    min-height: 1em;
}

.wg-health-summary__trend--sun {
    color: var(--wg-sun);
}

.wg-health-summary__trend--alert {
    color: var(--color-danger);
}

.wg-health-summary__trend--neutral {
    color: var(--wg-fg-3);
}

.wg-health-summary__trend--empty {
    color: var(--wg-fg-4);
}

/* Health range selector (Phase 8, Task 3). `.wg-gloss--inset` container
   carrying 7d / 30d pills; the active pill flips to `.wg-gloss--sun`. The
   selector is presentation-only — it picks which average pair (7d/30d) the
   summary tiles use. */
.wg-health-range-selector {
    display: flex;
    gap: var(--space-xs);
    padding: var(--wg-health-range-selector-pad);
    margin-bottom: var(--space-md);
}

.wg-health-range-selector__btn {
    flex: 1;
    min-height: var(--wg-health-range-selector-height);
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-sm);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--wg-radius-gloss);
}

/* Today's-workout card (Phase 7, Task 3). Sun-glossed card mirroring the
   Meds next-action pattern. `renderTodaysWorkoutCard` picks one of three
   variants: non-rest (sun gloss + Start button), rest (muted card + ad-hoc
   CTA), already-completed (muted card + completed eyebrow). The
   rotation-slot tag uses the --wg-workouts-slot-* semantic aliases so the
   same element styling can render PUSH / PULL / LEGS / REST / AD-HOC. */
.wg-workouts-today-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--wg-workouts-today-card-pad);
    border-radius: var(--wg-radius-card);
    color: inherit;
    text-align: left;
    width: 100%;
    margin-bottom: var(--space-md);
}

.wg-workouts-today-card__text {
    flex: 1;
    min-width: 0;
}

.wg-workouts-today-card__subtitle {
    font-size: var(--wg-workouts-today-subtitle-size);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--wg-sun-soft);
    font-weight: 600;
}

.wg-workouts-today-card--rest .wg-workouts-today-card__subtitle,
.wg-workouts-today-card--completed .wg-workouts-today-card__subtitle {
    color: var(--wg-fg-2);
}

.wg-workouts-today-card__value {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-workouts-today-names-size);
    color: var(--wg-fg-1);
    margin-top: var(--space-xs);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wg-workouts-today-card__duration {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-workouts-today-duration-size);
    color: var(--wg-fg-2);
    margin-top: var(--space-xs);
}

.wg-workouts-today-card__start {
    flex-shrink: 0;
    padding: var(--space-xs) var(--space-md);
    font-size: var(--font-size-sm);
    font-family: var(--wg-font-mono);
    border-radius: var(--wg-radius-gloss);
    cursor: pointer;
}

.wg-workouts-today-card__adhoc {
    flex-shrink: 0;
    padding: var(--space-xs) var(--space-md);
    font-size: var(--font-size-sm);
    font-family: var(--wg-font-mono);
    border-radius: var(--wg-radius-gloss);
    cursor: pointer;
}

.wg-workouts-slot-tag {
    display: inline-flex;
    align-items: center;
    padding: var(--wg-workouts-slot-tag-pad-y) var(--wg-workouts-slot-tag-pad-x);
    font-family: var(--wg-font-mono);
    font-size: var(--wg-workouts-slot-tag-size);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    border-radius: var(--wg-radius-gloss);
    border: 1px solid transparent;
    margin-right: var(--space-xs);
}

.wg-workouts-slot-tag--push {
    background: var(--wg-workouts-slot-push-bg);
    color: var(--wg-workouts-slot-push-fg);
    border-color: var(--wg-workouts-slot-push-border);
}

.wg-workouts-slot-tag--pull {
    background: var(--wg-workouts-slot-pull-bg);
    color: var(--wg-workouts-slot-pull-fg);
    border-color: var(--wg-workouts-slot-pull-border);
}

.wg-workouts-slot-tag--legs {
    background: var(--wg-workouts-slot-legs-bg);
    color: var(--wg-workouts-slot-legs-fg);
    border-color: var(--wg-workouts-slot-legs-border);
}

.wg-workouts-slot-tag--rest {
    background: var(--wg-workouts-slot-rest-bg);
    color: var(--wg-workouts-slot-rest-fg);
    border-color: var(--wg-workouts-slot-rest-border);
}

.wg-workouts-slot-tag--adhoc {
    background: var(--wg-workouts-slot-adhoc-bg);
    color: var(--wg-workouts-slot-adhoc-fg);
    border-color: var(--wg-workouts-slot-adhoc-border);
}

/* Workouts history sub-tab (Phase 7, Task 4). Day-grouped `.wg-card` rows
   mirror the Meds + Weight history patterns: each row carries a rotation-slot
   tag, mono duration, optional volume, and a trailing icon-button cluster
   (view / edit / delete). Offline-pending + rejected states surface as
   `.wg-tag--mono` variants. */
.wg-workouts-history {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.wg-workouts-history__empty {
    color: var(--wg-fg-4);
    text-align: center;
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-sm);
    margin: var(--space-lg) 0;
}

.wg-workouts-history__list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.wg-workouts-history__group {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.wg-workouts-history__group-label {
    font-size: var(--wg-workouts-history-day-size);
}

.wg-workouts-history__rows {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.wg-workouts-history-row {
    display: grid;
    grid-template-columns: var(--wg-workouts-history-row-cols);
    column-gap: var(--wg-workouts-history-row-gap);
    align-items: center;
    padding: var(--wg-workouts-history-row-pad);
    cursor: pointer;
}

.wg-workouts-history-row__body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.wg-workouts-history-row__title {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: var(--space-xs);
    min-width: 0;
}

.wg-workouts-history-row__name {
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-sm);
    color: var(--wg-fg-1);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.wg-workouts-history-row__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.wg-workouts-history-row__time,
.wg-workouts-history-row__duration,
.wg-workouts-history-row__count,
.wg-workouts-history-row__volume {
    font-family: var(--wg-font-mono);
    color: var(--wg-fg-3);
    letter-spacing: 0.02em;
}

.wg-workouts-history-row__time,
.wg-workouts-history-row__count {
    font-size: var(--wg-workouts-history-count-size);
}

.wg-workouts-history-row__duration {
    font-size: var(--wg-workouts-history-duration-size);
    color: var(--wg-fg-2);
}

.wg-workouts-history-row__volume {
    font-size: var(--wg-workouts-history-count-size);
}

.wg-workouts-history-row__actions {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    flex-shrink: 0;
}

/* Workouts session-detail view (Phase 7, Task 4). Mono header sits above the
   per-exercise `.wg-card` list. Each exercise card shows a mono name, a
   set-by-set mono summary ("{sets} × {reps} · {weight}kg"), and gloss-inset
   wrapped number inputs for sets / reps / weight plus a notes field. A
   three-button action cluster (Log set / Finish / Delete) anchors the
   bottom of the session detail. */
.wg-workouts-session-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.wg-workouts-session-info__row {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.wg-workouts-session-info__header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.wg-workouts-session-info__title {
    font-size: var(--wg-workouts-session-header-size);
}

.wg-workouts-session-info__meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-family: var(--wg-font-mono);
    font-size: var(--wg-workouts-session-meta-size);
    color: var(--wg-fg-3);
}

.wg-workouts-session-info__status {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
}

.wg-workouts-session-info__status-label {
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    color: var(--wg-fg-4);
    letter-spacing: 0.12em;
}

.wg-workouts-session-info__status-select {
    appearance: none;
    background: transparent;
    border: none;
    padding: 0;
    color: var(--wg-fg-1);
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-sm);
    cursor: pointer;
}

.wg-workouts-session-logs {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.wg-workouts-session-logs__empty {
    color: var(--wg-fg-4);
    text-align: center;
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-sm);
    margin: var(--space-md) 0;
}

.wg-workouts-session-exercise {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    padding: var(--space-md);
}

.wg-workouts-session-exercise.unsaved {
    opacity: 0.6;
}

.wg-workouts-session-exercise__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
}

.wg-workouts-session-exercise__name {
    font-size: var(--font-size-md);
    color: var(--wg-fg-1);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wg-workouts-session-exercise__mono {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-workouts-session-set-row-size);
    color: var(--wg-fg-2);
    min-height: var(--wg-workouts-session-set-row-min-h);
    display: flex;
    align-items: center;
    gap: var(--wg-workouts-session-set-row-gap);
    letter-spacing: 0.04em;
}

.wg-workouts-session-exercise__hint {
    font-size: var(--font-size-xs);
    color: var(--wg-fg-4);
    font-family: var(--wg-font-mono);
}

.wg-workouts-session-exercise__inputs {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

.wg-workouts-session-exercise__field {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: var(--space-xs) var(--space-sm);
    min-width: 0;
}

.wg-workouts-session-exercise__field--notes {
    margin-top: var(--space-xs);
}

.wg-workouts-session-exercise__field-label {
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-xs);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--wg-fg-4);
}

.wg-workouts-session-exercise__field-input {
    appearance: none;
    background: transparent;
    border: none;
    padding: 0;
    color: var(--wg-fg-1);
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-sm);
    width: 100%;
}

.wg-workouts-session-exercise__field-input:focus {
    outline: none;
}

.wg-workouts-session-actions {
    display: flex;
    gap: var(--wg-workouts-session-action-gap);
    margin-top: var(--space-md);
}

.wg-workouts-session-actions__btn {
    flex: 1;
    min-height: 44px;
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--wg-radius-gloss);
    cursor: pointer;
}

.wg-workouts-session-actions__log-set {
    flex: 2;
}

/* Workout session modal shell. Wraps the session-details modal in the shared
   .wg-modal teal-gloss surface and dresses the legacy modal-header / .btn
   action row with wandergeek tokens so the Delete / Cancel / Save buttons
   match the rest of the workouts surfaces instead of sitting on paper. */
.wg-workouts-session-modal {
    max-width: 420px;
}

.wg-workouts-session-modal__header {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.wg-workouts-session-modal__heading {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    min-width: 0;
}

.wg-workouts-session-modal__eyebrow {
    padding: 0;
    font-size: var(--wg-workouts-modal-eyebrow-size);
    color: var(--wg-fg-3);
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.wg-workouts-session-modal__eyebrow::before {
    content: none;
}

.wg-workouts-session-modal__title {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-workouts-modal-title-size);
    color: var(--wg-fg-1);
    line-height: 1.1;
}

.wg-workouts-session-modal__header-actions {
    display: flex;
    gap: var(--space-xs);
    flex-wrap: wrap;
}

.wg-workouts-session-modal__header-btn {
    flex: 1 1 auto;
    min-height: 36px;
    padding: var(--space-xs) var(--space-sm);
    font-family: var(--wg-font-ui);
    font-size: var(--font-size-sm);
    border-radius: var(--wg-radius-gloss);
    cursor: pointer;
    white-space: nowrap;
}

.wg-workouts-session-modal__header-btn--danger {
    color: var(--color-danger);
}

.wg-workouts-session-modal__header-btn--save {
    flex: 2 1 auto;
}

.wg-workouts-session-modal__body {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

/* Workout-Start modal (Task 11 of header-actions refactor). The legacy
   push-notification "Workout Time!" prompt was the last modal still using
   the paper-era .actions block; this promotes it onto the wg-modal shell
   and aligns the primary Cancel/Start pair to the header so they survive
   a focused mobile keyboard. Mirrors .wg-workouts-session-modal__header*. */
.wg-workouts-start-modal {
    max-width: 420px;
}

.wg-workouts-start-modal__header {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.wg-workouts-start-modal__heading {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    min-width: 0;
}

.wg-workouts-start-modal__eyebrow {
    padding: 0;
    font-size: var(--wg-workouts-modal-eyebrow-size);
    color: var(--wg-fg-3);
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.wg-workouts-start-modal__eyebrow::before {
    content: none;
}

.wg-workouts-start-modal__title {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-workouts-modal-title-size);
    color: var(--wg-fg-1);
    line-height: 1.1;
}

.wg-workouts-start-modal__header-actions {
    display: flex;
    gap: var(--space-xs);
    flex-wrap: wrap;
}

.wg-workouts-start-modal__header-btn {
    flex: 1 1 auto;
    min-height: 36px;
    padding: var(--space-xs) var(--space-sm);
    font-family: var(--wg-font-ui);
    font-size: var(--font-size-sm);
    border-radius: var(--wg-radius-gloss);
    cursor: pointer;
    white-space: nowrap;
}

.wg-workouts-start-modal__header-btn--save {
    flex: 2 1 auto;
}

.wg-workouts-start-modal__body {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.wg-workouts-start-modal__subtitle {
    margin: 0;
    color: var(--wg-fg-3);
    font-size: var(--font-size-sm);
}

.wg-workouts-start-modal__secondary-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.wg-workouts-start-modal__secondary-btn {
    width: 100%;
    min-height: 40px;
    padding: var(--space-xs) var(--space-sm);
    font-family: var(--wg-font-ui);
    font-size: var(--font-size-sm);
    border-radius: var(--wg-radius-gloss);
    cursor: pointer;
    color: var(--wg-fg-1);
}

.wg-workouts-start-modal__secondary-btn--danger {
    color: var(--color-danger);
}

/* Workouts groups sub-tab (Phase 7, Task 5). Each group renders as a
   `.wg-card` row carrying a rotation-slot tag, mono group name, days +
   scheduled-time meta, an optional rotating/inactive mono tag, and a
   trailing `.wg-icon-btn` cluster (edit / delete). A full-width
   `.wg-gloss--sun` "Add workout group" CTA sits below the list. */
.wg-workouts-groups {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.wg-workouts-groups__empty {
    color: var(--wg-fg-4);
    text-align: center;
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-sm);
    margin: var(--space-lg) 0;
}

.wg-workouts-groups__list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.wg-workouts-groups-row {
    display: grid;
    grid-template-columns: var(--wg-workouts-groups-row-cols);
    column-gap: var(--wg-workouts-groups-row-gap);
    align-items: center;
    padding: var(--wg-workouts-groups-row-pad);
    cursor: pointer;
}

.wg-workouts-groups-row--inactive {
    opacity: 0.65;
}

.wg-workouts-groups-row__body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.wg-workouts-groups-row__title {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: var(--space-xs);
    min-width: 0;
}

.wg-workouts-groups-row__name {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-workouts-groups-name-size);
    color: var(--wg-fg-1);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.wg-workouts-groups-row__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.wg-workouts-groups-row__days,
.wg-workouts-groups-row__time,
.wg-workouts-groups-row__count {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-workouts-groups-count-size);
    color: var(--wg-fg-3);
    letter-spacing: 0.02em;
}

.wg-workouts-groups-row__actions {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    flex-shrink: 0;
}

.wg-workouts-groups__add-cta {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    min-height: 44px;
    padding: var(--space-md) var(--space-lg);
    margin-top: var(--space-md);
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-md);
    border-radius: var(--wg-radius-gloss);
    cursor: pointer;
}

.wg-workouts-groups__add-cta-label {
    letter-spacing: 0.04em;
}

/* Edit-workout-group modal (Phase 7, Task 5). Shares the generic `.wg-modal`
   shell for positioning/chrome; overlays a mono eyebrow + title header,
   `.wg-gloss--inset` input wraps for name / description / time /
   notification, a days-select chip row, toggle checkboxes, variant +
   exercise sub-sections, and a Cancel/Save action bar (Save 2× flex per
   modal-button-order convention). */
.wg-workouts-group-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.wg-workouts-group-modal__heading {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    min-width: 0;
}

.wg-workouts-group-modal__eyebrow {
    padding: 0;
    font-size: var(--wg-workouts-modal-eyebrow-size);
    color: var(--wg-fg-3);
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.wg-workouts-group-modal__eyebrow::before {
    content: none;
}

.wg-workouts-group-modal__title {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-workouts-modal-title-size);
    color: var(--wg-fg-1);
    line-height: 1.1;
}

.wg-workouts-group-modal__body {
    display: flex;
    flex-direction: column;
    gap: var(--wg-workouts-modal-section-gap);
}

.wg-workouts-group-modal__field {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    min-width: 0;
    flex: 1 1 0;
}

.wg-workouts-group-modal__row {
    display: flex;
    gap: var(--wg-workouts-modal-row-gap);
}

.wg-workouts-group-modal__label {
    font-size: var(--wg-workouts-modal-label-size);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--wg-fg-3);
    font-weight: var(--font-weight-bold);
}

.wg-workouts-group-modal__input-wrap {
    padding: var(--wg-workouts-modal-input-pad-y) var(--wg-workouts-modal-input-pad-x);
    display: flex;
    align-items: center;
    min-width: 0;
}

.wg-workouts-group-modal__input {
    width: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    outline: none;
    box-shadow: none;
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-md);
    color: var(--wg-fg-1);
    min-width: 0;
}

.wg-workouts-group-modal__input::placeholder {
    color: var(--wg-fg-4);
}

.wg-workouts-group-modal__textarea {
    resize: vertical;
    font-family: var(--wg-font-ui);
}

.wg-workouts-group-modal__days-wrap {
    flex-wrap: wrap;
}

.wg-workouts-group-modal__toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-sm);
    color: var(--wg-fg-2);
    cursor: pointer;
}

.wg-workouts-group-modal__toggle-label {
    letter-spacing: 0.02em;
}

.wg-workouts-group-modal__section {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
}

.wg-workouts-group-modal__section-label {
    padding: 0;
}

.wg-workouts-group-modal__section-add {
    align-self: flex-start;
    padding: var(--space-xs) var(--space-md);
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-sm);
    border-radius: var(--wg-radius-gloss);
    cursor: pointer;
}

.wg-workouts-group-modal__header-actions {
    display: flex;
    gap: var(--space-xs);
    align-items: center;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.wg-workouts-group-modal__header-btn {
    flex: 1 1 auto;
    min-height: 36px;
    padding: var(--space-xs) var(--space-sm);
    font-family: var(--wg-font-ui);
    font-size: var(--font-size-sm);
    border-radius: var(--wg-radius-gloss);
    cursor: pointer;
    white-space: nowrap;
}

.wg-workouts-group-modal__header-btn--save {
    flex: 2 1 auto;
}

/* Workouts exercises sub-tab (Phase 7, Task 6). Each exercise renders as
   a `.wg-card` row carrying a rotation-slot mono tag, the exercise mono
   name, a defaults eyebrow (sets×reps + weight + notes), and a trailing
   `.wg-icon-btn` cluster (edit / delete). A full-width `.wg-gloss--sun`
   "Add exercise" CTA sits below the list. */
.wg-workouts-exercises {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.wg-workouts-exercises__empty {
    color: var(--wg-fg-4);
    text-align: center;
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-sm);
    margin: var(--space-lg) 0;
}

.wg-workouts-exercises__list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.wg-workouts-exercises-row {
    display: grid;
    grid-template-columns: var(--wg-workouts-exercises-row-cols);
    column-gap: var(--wg-workouts-exercises-row-gap);
    align-items: center;
    padding: var(--wg-workouts-exercises-row-pad);
    cursor: pointer;
}

.wg-workouts-exercises-row__body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.wg-workouts-exercises-row__title {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: var(--space-xs);
    min-width: 0;
}

.wg-workouts-exercises-row__name {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-workouts-exercises-name-size);
    color: var(--wg-fg-1);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.wg-workouts-exercises-row__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.wg-workouts-exercises-row__defaults,
.wg-workouts-exercises-row__weight,
.wg-workouts-exercises-row__notes {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-workouts-groups-count-size);
    color: var(--wg-fg-3);
    letter-spacing: 0.02em;
}

.wg-workouts-exercises-row__notes {
    font-family: var(--wg-font-ui);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    max-width: 100%;
}

.wg-workouts-exercises-row__actions {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    flex-shrink: 0;
}

/* Exercises tab header row (Round-2, Task 6). Inline sun-gloss `+ Add`
   pill right-aligned next to a section label. Replaces the retired
   full-width `.wg-workouts-exercises__add-cta` bottom dock so the
   affordance is always visible above the library list. */
.wg-workouts-exercises-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.wg-workouts-exercises-header__label {
    padding: 0;
    flex: 1;
    min-width: 0;
}

.wg-workouts-exercises-header__add {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    min-height: 36px;
    padding: var(--space-xs) var(--space-md);
    font-family: var(--wg-font-ui);
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-sm);
    border-radius: var(--wg-radius-gloss);
    cursor: pointer;
}

.wg-workouts-exercises-header__add-label {
    letter-spacing: 0.02em;
}

/* Edit-library-exercise modal (Phase 7, Task 6). Shares the generic `.wg-modal`
   shell for positioning/chrome; overlays a mono eyebrow + title header,
   `.wg-gloss--inset` input wraps for name / sets / reps / weight / notes,
   and a Cancel/Save action bar (Save 2× flex per modal-button-order
   convention). */
.wg-workouts-library-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.wg-workouts-library-modal__heading {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    min-width: 0;
}

.wg-workouts-library-modal__eyebrow {
    padding: 0;
    font-size: var(--wg-workouts-modal-eyebrow-size);
    color: var(--wg-fg-3);
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.wg-workouts-library-modal__eyebrow::before {
    content: none;
}

.wg-workouts-library-modal__title {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-workouts-modal-title-size);
    color: var(--wg-fg-1);
    line-height: 1.1;
}

.wg-workouts-library-modal__body {
    display: flex;
    flex-direction: column;
    gap: var(--wg-workouts-modal-section-gap);
}

.wg-workouts-library-modal__field {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    min-width: 0;
    flex: 1 1 0;
}

.wg-workouts-library-modal__row {
    display: flex;
    gap: var(--wg-workouts-modal-row-gap);
}

.wg-workouts-library-modal__label {
    font-size: var(--wg-workouts-modal-label-size);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--wg-fg-3);
    font-weight: var(--font-weight-bold);
}

.wg-workouts-library-modal__input-wrap {
    padding: var(--wg-workouts-modal-input-pad-y) var(--wg-workouts-modal-input-pad-x);
    display: flex;
    align-items: center;
    min-width: 0;
}

.wg-workouts-library-modal__input {
    width: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    outline: none;
    box-shadow: none;
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-md);
    color: var(--wg-fg-1);
    min-width: 0;
}

.wg-workouts-library-modal__input::placeholder {
    color: var(--wg-fg-4);
}

.wg-workouts-library-modal__header-actions {
    display: flex;
    gap: var(--space-xs);
    align-items: center;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.wg-workouts-library-modal__header-btn {
    flex: 1 1 auto;
    min-height: 36px;
    padding: var(--space-xs) var(--space-sm);
    font-family: var(--wg-font-ui);
    font-size: var(--font-size-sm);
    border-radius: var(--wg-radius-gloss);
    cursor: pointer;
    white-space: nowrap;
}

.wg-workouts-library-modal__header-btn--save {
    flex: 2 1 auto;
}

/* Edit-exercise modal (Phase 7, Task 8). Shares the generic `.wg-modal` shell
   for positioning/chrome; overlays a mono eyebrow + title header,
   `.wg-gloss--inset` input wraps for name / sets / reps / weight / order,
   and a Cancel/Save action bar (Save 2x flex per modal-button-order
   convention). */
.wg-workouts-exercise-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.wg-workouts-exercise-modal__heading {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    min-width: 0;
}

.wg-workouts-exercise-modal__eyebrow {
    padding: 0;
    font-size: var(--wg-workouts-modal-eyebrow-size);
    color: var(--wg-fg-3);
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.wg-workouts-exercise-modal__eyebrow::before {
    content: none;
}

.wg-workouts-exercise-modal__title {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-workouts-modal-title-size);
    color: var(--wg-fg-1);
    line-height: 1.1;
}

.wg-workouts-exercise-modal__body {
    display: flex;
    flex-direction: column;
    gap: var(--wg-workouts-modal-section-gap);
}

.wg-workouts-exercise-modal__field {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    min-width: 0;
    flex: 1 1 0;
}

.wg-workouts-exercise-modal__row {
    display: flex;
    gap: var(--wg-workouts-modal-row-gap);
}

.wg-workouts-exercise-modal__label {
    font-size: var(--wg-workouts-modal-label-size);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--wg-fg-3);
    font-weight: var(--font-weight-bold);
}

.wg-workouts-exercise-modal__input-wrap {
    padding: var(--wg-workouts-modal-input-pad-y) var(--wg-workouts-modal-input-pad-x);
    display: flex;
    align-items: center;
    min-width: 0;
}

.wg-workouts-exercise-modal__input {
    width: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    outline: none;
    box-shadow: none;
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-md);
    color: var(--wg-fg-1);
    min-width: 0;
}

.wg-workouts-exercise-modal__input::placeholder {
    color: var(--wg-fg-4);
}

.wg-workouts-exercise-modal__header-actions {
    display: flex;
    gap: var(--space-xs);
    align-items: center;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.wg-workouts-exercise-modal__header-btn {
    flex: 1 1 auto;
    min-height: 36px;
    padding: var(--space-xs) var(--space-sm);
    font-family: var(--wg-font-ui);
    font-size: var(--font-size-sm);
    border-radius: var(--wg-radius-gloss);
    cursor: pointer;
    white-space: nowrap;
}

.wg-workouts-exercise-modal__header-btn--save {
    flex: 2 1 auto;
}

/* Edit-variant modal (Round-2, Task 6). Mirrors the group/exercise modal
   shape on the generic `.wg-modal` shell so its background and chrome are
   driven by the --wg-bg-card teal-gloss tokens, not the legacy paper-white
   modal block. */
.wg-workouts-variant-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.wg-workouts-variant-modal__heading {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    min-width: 0;
}

.wg-workouts-variant-modal__eyebrow {
    padding: 0;
    font-size: var(--wg-workouts-modal-eyebrow-size);
    color: var(--wg-fg-3);
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.wg-workouts-variant-modal__eyebrow::before {
    content: none;
}

.wg-workouts-variant-modal__title {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-workouts-modal-title-size);
    color: var(--wg-fg-1);
    line-height: 1.1;
}

.wg-workouts-variant-modal__body {
    display: flex;
    flex-direction: column;
    gap: var(--wg-workouts-modal-section-gap);
}

.wg-workouts-variant-modal__field {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    min-width: 0;
    flex: 1 1 0;
}

.wg-workouts-variant-modal__label {
    font-size: var(--wg-workouts-modal-label-size);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--wg-fg-3);
    font-weight: var(--font-weight-bold);
}

.wg-workouts-variant-modal__input-wrap {
    padding: var(--wg-workouts-modal-input-pad-y) var(--wg-workouts-modal-input-pad-x);
    display: flex;
    align-items: center;
    min-width: 0;
}

.wg-workouts-variant-modal__input {
    width: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    outline: none;
    box-shadow: none;
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-md);
    color: var(--wg-fg-1);
    min-width: 0;
}

.wg-workouts-variant-modal__input::placeholder {
    color: var(--wg-fg-4);
}

.wg-workouts-variant-modal__textarea {
    resize: vertical;
    font-family: var(--wg-font-ui);
}

.wg-workouts-variant-modal__section {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
}

.wg-workouts-variant-modal__section-label {
    padding: 0;
}

.wg-workouts-variant-modal__section-add {
    align-self: flex-start;
    padding: var(--space-xs) var(--space-md);
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-sm);
    border-radius: var(--wg-radius-gloss);
    cursor: pointer;
}

.wg-workouts-variant-modal__header-actions {
    display: flex;
    gap: var(--space-xs);
    align-items: center;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.wg-workouts-variant-modal__header-btn {
    flex: 1 1 auto;
    min-height: 36px;
    padding: var(--space-xs) var(--space-sm);
    font-family: var(--wg-font-ui);
    font-size: var(--font-size-sm);
    border-radius: var(--wg-radius-gloss);
    cursor: pointer;
    white-space: nowrap;
}

.wg-workouts-variant-modal__header-btn--save {
    flex: 2 1 auto;
}

/* Log-set modal (Phase 7, Task 8). Shares the generic `.wg-modal` shell for
   positioning/chrome; overlays a mono "Log set" eyebrow + dynamic-title
   header ("Log set \u00b7 Bench"), `.wg-gloss--inset` input wraps for
   name / sets / reps / weight / notes, and a Cancel/Save action bar
   (Save 2x flex per modal-button-order convention). */
.wg-workouts-log-set-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.wg-workouts-log-set-modal__heading {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    min-width: 0;
}

.wg-workouts-log-set-modal__eyebrow {
    padding: 0;
    font-size: var(--wg-workouts-modal-eyebrow-size);
    color: var(--wg-fg-3);
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.wg-workouts-log-set-modal__eyebrow::before {
    content: none;
}

.wg-workouts-log-set-modal__title {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-workouts-modal-title-size);
    color: var(--wg-fg-1);
    line-height: 1.1;
}

.wg-workouts-log-set-modal__body {
    display: flex;
    flex-direction: column;
    gap: var(--wg-workouts-modal-section-gap);
}

.wg-workouts-log-set-modal__field {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    min-width: 0;
    flex: 1 1 0;
}

.wg-workouts-log-set-modal__row {
    display: flex;
    gap: var(--wg-workouts-modal-row-gap);
}

.wg-workouts-log-set-modal__label {
    font-size: var(--wg-workouts-modal-label-size);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--wg-fg-3);
    font-weight: var(--font-weight-bold);
}

.wg-workouts-log-set-modal__input-wrap {
    padding: var(--wg-workouts-modal-input-pad-y) var(--wg-workouts-modal-input-pad-x);
    display: flex;
    align-items: center;
    min-width: 0;
}

.wg-workouts-log-set-modal__input {
    width: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    outline: none;
    box-shadow: none;
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-md);
    color: var(--wg-fg-1);
    min-width: 0;
}

.wg-workouts-log-set-modal__input::placeholder {
    color: var(--wg-fg-4);
}

.wg-workouts-log-set-modal__header-actions {
    display: flex;
    gap: var(--space-xs);
    align-items: center;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.wg-workouts-log-set-modal__header-btn {
    flex: 1 1 auto;
    min-height: 36px;
    padding: var(--space-xs) var(--space-sm);
    font-family: var(--wg-font-ui);
    font-size: var(--font-size-sm);
    border-radius: var(--wg-radius-gloss);
    cursor: pointer;
    white-space: nowrap;
}

.wg-workouts-log-set-modal__header-btn--save {
    flex: 2 1 auto;
}

/* Workouts stats sub-tab (Phase 7, Task 7). A `.wg-gloss--inset` range
   selector (7d / 30d / 90d / All) drives WGWorkoutChart; the active button
   picks up the sun modifier. Below the chart, stat tiles render as a
   two-column `.wg-card` grid (sessions / completion / active weeks /
   skipped). Persisted range key: `mt-workouts-stats-range`. */
.wg-workouts-stats {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.wg-workouts-stats__range {
    display: flex;
    gap: var(--space-xs);
    padding: var(--wg-workouts-stats-range-pad);
}

.wg-workouts-stats__range-btn {
    flex: 1;
    min-height: var(--wg-workouts-stats-range-height);
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-sm);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--wg-radius-gloss);
}

.wg-workouts-stats__chart-panel {
    padding: var(--wg-card-pad);
    background: var(--wg-bg-card);
    border: 1px solid var(--wg-border-hairline);
    border-radius: var(--wg-radius-card);
}

.wg-workouts-stats__tiles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--wg-workouts-stats-tile-gap);
}

.wg-workouts-stats__tile {
    padding: var(--wg-workouts-stats-tile-pad);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    min-width: 0;
}

.wg-workouts-stats__tile-value {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-workouts-stats-tile-value-size);
    line-height: 1;
    color: var(--wg-fg-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wg-workouts-stats__tile-label {
    font-size: var(--wg-workouts-stats-tile-label-size);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--wg-fg-4);
}

.wg-workouts-stats__section-label {
    padding-top: var(--wg-section-label-pad-top);
    padding-bottom: var(--space-sm);
}

.wg-workouts-stats__top-exercises {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.wg-workouts-stats__top-row {
    padding: var(--wg-workouts-stats-tile-pad);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.wg-workouts-stats__top-row-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-sm);
    min-width: 0;
}

.wg-workouts-stats__top-row-name {
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-md);
    color: var(--wg-fg-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.wg-workouts-stats__top-row-volume {
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-sm);
    color: var(--wg-fg-3);
    flex-shrink: 0;
}

.wg-workouts-stats__top-row-bar {
    position: relative;
    height: 4px;
    border-radius: var(--radius-pill);
    background: var(--wg-ink-08);
    overflow: hidden;
}

.wg-workouts-stats__top-row-bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--wg-sun);
    width: var(--fill-pct, 0%);
    border-radius: inherit;
}

.wg-workouts-stats__empty {
    padding: var(--wg-card-pad);
    text-align: center;
    color: var(--wg-fg-4);
    font-size: var(--font-size-md);
}

/* WGWorkoutChart base shell (Phase 7, Task 7). The SVG carries the shared
   class; empty-state returns a <div> with the same class + --empty modifier
   so callers can append either return shape without conditional styling. */
.wg-workout-chart {
    display: block;
    width: 100%;
    max-width: var(--wg-workouts-chart-width);
    height: auto;
    margin-inline: auto;
}

.wg-workout-chart--empty {
    min-height: var(--wg-workouts-chart-height);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--wg-fg-5);
    font-size: var(--font-size-sm);
}

.wg-workout-chart__guide {
    stroke: var(--wg-fg-5);
    stroke-width: var(--wg-bp-chart-guide-stroke-width);
    stroke-dasharray: var(--wg-bp-chart-guide-dasharray);
    fill: none;
}

.wg-workout-chart__line {
    fill: none;
    stroke: var(--wg-sun);
    stroke-width: var(--wg-workouts-chart-line-stroke-width);
    stroke-linecap: round;
    stroke-linejoin: round;
}

.wg-workout-chart__last {
    fill: var(--wg-sun);
    stroke: var(--wg-teal-stage);
    stroke-width: var(--wg-workouts-chart-last-stroke-width);
}

/* Round-2, Task 6 — numeric axis tick labels. Mirrors the bp/weight
   `__axis-tick` pattern: labels pull `fill` from the muted-on-teal
   foreground token and reserve a tabular-nums variant so the numbers stay
   vertically aligned. Y-tick labels right-align against the plot edge;
   x-tick date labels centre-align below the plot. */
.wg-workout-chart__axis-tick {
    fill: var(--wg-fg-3);
    font-family: inherit;
    font-size: var(--wg-font-size-mini);
    font-variant-numeric: tabular-nums;
}

.wg-workout-chart__axis-tick[data-workout-axis="y"] {
    text-anchor: end;
}

.wg-workout-chart__axis-tick[data-workout-axis="x"] {
    text-anchor: middle;
}

/* Round-2, Task 6 — stats-tab chart legend. Sits directly below the chart
   panel; a sun-swatch + series-label pill documents which metric the line
   shows (sessions per week vs volume kg). */
.wg-workouts-stats__legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
    margin-bottom: var(--space-md);
}

.wg-workouts-stats__legend-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--wg-radius-gloss);
    font-family: var(--wg-font-mono);
    font-size: var(--wg-font-size-mini);
    color: var(--wg-fg-2);
    background: var(--wg-bg-card-inset);
    border: 1px solid var(--wg-border-hairline);
}

.wg-workouts-stats__legend-swatch {
    width: var(--wg-workouts-stats-legend-swatch-size);
    height: var(--wg-workouts-stats-legend-swatch-size);
    border-radius: var(--wg-radius-pill);
    background: var(--wg-sun);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

/* WGSleepChart base shell (Phase 8, Task 4). The SVG carries the shared
   class; empty-state returns a <div> with the same class + --empty modifier.
   Stacked-bar fills resolve via the per-stage variant classes (deep / light /
   rem / awake); the HR overlay path, dots, and labels resolve via the
   __hr-line / __hr-dot / __hr-dot-outer / __hr-label classes. */
.wg-sleep-chart {
    display: block;
    width: 100%;
    max-width: var(--wg-health-chart-width);
    height: auto;
    margin-inline: auto;
}

.wg-sleep-chart--empty {
    min-height: var(--wg-health-chart-tall-height);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--wg-fg-5);
    font-size: var(--font-size-sm);
}

.wg-sleep-chart__stage {
    stroke: none;
}

.wg-sleep-chart__stage--deep {
    fill: var(--wg-health-sleep-deep);
}

.wg-sleep-chart__stage--light {
    fill: var(--wg-health-sleep-light);
}

.wg-sleep-chart__stage--rem {
    fill: var(--wg-health-sleep-rem);
}

.wg-sleep-chart__stage--awake {
    fill: var(--wg-health-sleep-awake);
}

.wg-sleep-chart__guide {
    stroke: var(--wg-fg-5);
    stroke-width: var(--wg-bp-chart-guide-stroke-width);
    stroke-dasharray: var(--wg-bp-chart-guide-dasharray);
    fill: none;
}

.wg-sleep-chart__tick {
    stroke: var(--wg-fg-5);
    fill: none;
}

.wg-sleep-chart__axis-label {
    fill: var(--wg-fg-5);
    font-size: var(--font-size-xs);
    font-family: var(--wg-font-mono);
}

.wg-sleep-chart__day-label {
    fill: var(--wg-fg-5);
    font-size: var(--font-size-xs);
    font-family: var(--wg-font-mono);
}

.wg-sleep-chart__bar-label {
    fill: var(--wg-fg-1);
    font-size: var(--font-size-xs);
    font-family: var(--wg-font-mono);
}

.wg-sleep-chart__hr-line {
    fill: none;
    stroke: var(--wg-health-sleep-hr);
    stroke-width: var(--wg-health-chart-line-stroke-width);
    stroke-linecap: round;
    stroke-linejoin: round;
}

.wg-sleep-chart__hr-dot-outer {
    fill: var(--wg-bg-card);
    stroke: none;
}

.wg-sleep-chart__hr-dot {
    fill: var(--wg-health-sleep-hr);
    stroke: none;
}

.wg-sleep-chart__hr-label {
    fill: var(--wg-health-sleep-hr);
    font-size: var(--font-size-xs);
    font-family: var(--wg-font-mono);
    font-weight: var(--font-weight-bold);
    paint-order: stroke fill;
    stroke: var(--wg-bg-card);
    stroke-width: 3;
}

/* Sleep card shell (Phase 8, Task 4). Wraps the WGSleepChart SVG under a
   mono header, followed by a legend row and a section-label averages line.
   The card itself uses the shared .wg-card surface. */
.wg-sleep-card {
    padding: var(--wg-health-card-pad);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.wg-sleep-card__header {
    font-size: var(--wg-health-card-header-size);
}

.wg-sleep-card__stat {
    font-size: var(--wg-health-card-stat-size);
    color: var(--wg-fg-4);
}

/* Sleep card legend (Phase 8, Task 4) — mono swatch + label pairs; swatch
   colour resolves via the __badge--{variant} class, never an inline style. */
.wg-health-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--wg-health-legend-gap);
    align-items: center;
}

.wg-health-legend__item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--font-size-xs);
    color: var(--wg-fg-3);
    font-family: var(--wg-font-mono);
}

.wg-health-legend__badge {
    display: inline-block;
    width: var(--wg-health-legend-badge-size);
    height: var(--wg-health-legend-badge-size);
    border-radius: var(--radius-sm);
}

.wg-health-legend__badge--line {
    height: 2px;
    border-radius: var(--radius-pill);
}

.wg-health-legend__badge--deep {
    background: var(--wg-health-sleep-deep);
}

.wg-health-legend__badge--light {
    background: var(--wg-health-sleep-light);
}

.wg-health-legend__badge--rem {
    background: var(--wg-health-sleep-rem);
}

.wg-health-legend__badge--awake {
    background: var(--wg-health-sleep-awake);
}

.wg-health-legend__badge--hr {
    background: var(--wg-health-sleep-hr);
}

/* Steps chart (Phase 8, Task 5). Single-series vertical bar chart with
   rotated in-bar step-count labels. Bar fill + label contrast resolve via
   the --wg-health-steps-* tokens; axis + day labels + guide lines match the
   sleep chart's muted style. */
.wg-steps-chart {
    display: block;
    width: 100%;
    max-width: var(--wg-health-chart-width);
    height: auto;
    margin-inline: auto;
}

.wg-steps-chart--empty {
    min-height: var(--wg-health-chart-tall-height);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--wg-fg-5);
    font-size: var(--font-size-sm);
}

.wg-steps-chart__bar {
    fill: var(--wg-health-steps-bar);
    stroke: none;
}

.wg-steps-chart__guide {
    stroke: var(--wg-fg-5);
    stroke-width: var(--wg-bp-chart-guide-stroke-width);
    stroke-dasharray: var(--wg-bp-chart-guide-dasharray);
    fill: none;
}

.wg-steps-chart__axis-label {
    fill: var(--wg-fg-5);
    font-size: var(--font-size-xs);
    font-family: var(--wg-font-mono);
}

.wg-steps-chart__day-label {
    fill: var(--wg-fg-5);
    font-size: var(--font-size-xs);
    font-family: var(--wg-font-mono);
}

.wg-steps-chart__count-label {
    font-size: var(--font-size-xs);
    font-family: var(--wg-font-mono);
    font-weight: var(--font-weight-medium);
}

.wg-steps-chart__count-label--inside {
    fill: var(--wg-health-steps-label-inside);
}

.wg-steps-chart__count-label--outside {
    fill: var(--wg-fg-1);
}

/* Steps card shell (Phase 8, Task 5). Wraps the WGStepsChart SVG under a
   mono header, followed by a section-label averages line. */
.wg-steps-card {
    padding: var(--wg-health-card-pad);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.wg-steps-card__header {
    font-size: var(--wg-health-card-header-size);
}

.wg-steps-card__stat {
    font-size: var(--wg-health-card-stat-size);
    color: var(--wg-fg-4);
}

/* Vitals chart (Phase 8, Task 6). Area + line chart parameterised by vital
   ('hr' | 'spo2' | 'stress'); the variant modifier on the root svg selects
   the --wg-health-vitals-<vital>-line token. Axis + day + guide styling
   matches the sleep + steps charts. */
.wg-vitals-chart {
    display: block;
    width: 100%;
    max-width: var(--wg-health-chart-width);
    height: auto;
    margin-inline: auto;
}

.wg-vitals-chart--empty {
    min-height: var(--wg-health-chart-height);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--wg-fg-5);
    font-size: var(--font-size-sm);
}

.wg-vitals-chart__guide {
    stroke: var(--wg-fg-5);
    stroke-width: var(--wg-bp-chart-guide-stroke-width);
    stroke-dasharray: var(--wg-bp-chart-guide-dasharray);
    fill: none;
}

.wg-vitals-chart__axis-label {
    fill: var(--wg-fg-5);
    font-size: var(--font-size-xs);
    font-family: var(--wg-font-mono);
}

.wg-vitals-chart__day-label {
    fill: var(--wg-fg-5);
    font-size: var(--font-size-xs);
    font-family: var(--wg-font-mono);
}

.wg-vitals-chart__area {
    fill: currentColor;
    fill-opacity: 0.18;
    stroke: none;
}

.wg-vitals-chart__line {
    fill: none;
    stroke: currentColor;
    stroke-width: var(--wg-health-chart-line-stroke-width);
    stroke-linecap: round;
    stroke-linejoin: round;
}

.wg-vitals-chart__last {
    fill: currentColor;
    stroke: none;
}

.wg-vitals-chart--hr {
    color: var(--wg-health-vitals-hr-line);
}

.wg-vitals-chart--spo2 {
    color: var(--wg-health-vitals-spo2-line);
}

.wg-vitals-chart--stress {
    color: var(--wg-health-vitals-stress-line);
}

/* Vitals card shell (Phase 8, Task 6). Wraps the WGVitalsChart SVG under
   a mono header, followed by a section-label averages line. Mirrors the
   sleep + steps card shells. */
.wg-vitals-card {
    padding: var(--wg-health-card-pad);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.wg-vitals-card__header {
    font-size: var(--wg-health-card-header-size);
}

.wg-vitals-card__stat {
    font-size: var(--wg-health-card-stat-size);
    color: var(--wg-fg-4);
}

/* Health screen data-source disclaimer (Phase 8). Muted section-label
   footer identifying the .nxk backup data source. */
.wg-health-disclaimer {
    text-align: center;
    color: var(--wg-fg-5);
    margin-top: var(--space-sm);
}

/* Health Notes sub-tab (Phase 8, Task 7). `.wg-gloss--inset` textarea wrap
   on top with a full-width `.wg-gloss--sun` Save CTA, then a day-grouped
   `.wg-card` list. Each row carries a mono timestamp, the note body, and a
   trailing `.wg-icon-btn` cluster (edit + delete). Offline-pending +
   rejected states surface as `.wg-tag--mono` variants. */
.wg-health-notes {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.wg-health-notes-compose {
    display: flex;
    flex-direction: column;
    gap: var(--wg-health-notes-compose-gap);
    padding: var(--wg-health-notes-compose-card-pad);
}

.wg-health-notes-compose__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    min-width: 0;
}

.wg-health-notes-compose__title {
    font-size: var(--wg-health-notes-compose-title-size);
    color: var(--wg-fg-1);
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.wg-health-notes-compose__tags {
    display: flex;
    gap: var(--space-xs);
    overflow-x: auto;
    min-width: 0;
    scrollbar-width: none;
}

.wg-health-notes-compose__tags::-webkit-scrollbar {
    display: none;
}

.wg-health-notes-compose__tag {
    flex: 0 0 auto;
    cursor: pointer;
    background: var(--wg-tag-normal-bg);
    color: var(--wg-tag-normal-fg);
    border-color: var(--wg-tag-normal-border);
    font-size: var(--wg-health-notes-compose-tag-size);
    letter-spacing: 0.1em;
    padding: var(--wg-health-notes-compose-tag-pad-y) var(--wg-health-notes-compose-tag-pad-x);
}

.wg-health-notes-compose__wrap {
    padding: var(--wg-health-notes-compose-pad-y) var(--wg-health-notes-compose-pad-x);
}

.wg-health-notes-compose__textarea {
    width: 100%;
    box-sizing: border-box;
    background: transparent;
    border: 0;
    outline: none;
    resize: vertical;
    font-family: var(--wg-font-ui);
    font-size: var(--wg-health-notes-body-size);
    color: var(--wg-fg-1);
    min-height: var(--wg-health-notes-compose-textarea-min);
    line-height: 1.45;
}

.wg-health-notes-compose__textarea::placeholder {
    color: var(--wg-fg-4);
}

.wg-health-notes-compose__footer {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.wg-health-notes-compose__count {
    font-size: var(--wg-health-notes-compose-count-size);
    color: var(--wg-fg-4);
    letter-spacing: 0.08em;
}

.wg-health-notes-compose__save {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    min-height: var(--wg-health-notes-compose-save-min);
    padding: var(--wg-health-notes-compose-save-pad-y) var(--wg-health-notes-compose-save-pad-x);
    font-family: var(--wg-font-ui);
    font-size: var(--wg-health-notes-compose-save-size);
    border-radius: var(--wg-radius-gloss);
    cursor: pointer;
}

.wg-health-notes-compose__save[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
}

.wg-health-notes__loading {
    color: var(--wg-fg-4);
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-sm);
    text-align: center;
    padding: var(--space-md) 0;
}

.wg-health-notes__list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.wg-health-notes__group {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.wg-health-notes__group-label {
    font-size: var(--wg-health-notes-day-size);
}

.wg-health-notes__rows {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.wg-health-notes-row {
    display: grid;
    grid-template-columns: var(--wg-health-notes-row-cols);
    column-gap: var(--wg-health-notes-row-gap);
    align-items: flex-start;
    padding: var(--wg-health-notes-row-pad);
}

.wg-health-notes-row--pending {
    opacity: 0.85;
}

.wg-health-notes-row--rejected {
    border-color: var(--wg-tag-alert-border);
}

.wg-health-notes-row__body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.wg-health-notes-row__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.wg-health-notes-row__time {
    font-size: var(--wg-health-notes-time-size);
    color: var(--wg-fg-3);
    letter-spacing: 0.02em;
}

.wg-health-notes-row__tag {
    font-size: var(--wg-health-notes-row-tag-size);
    letter-spacing: 0.1em;
    cursor: pointer;
}

/* Round-2 Task 5: active-filter state — user has tapped a row chip to pin
   the list to that tag. Reuses the existing high/sun token palette; the
   distinguishing cue is a sharpened outline so the pinned chip reads as
   "selected" against otherwise-identical siblings. */
.wg-health-notes-row__tag--active {
    outline: 1px solid var(--wg-sun);
    outline-offset: 1px;
}

.wg-health-notes-row__content {
    font-family: var(--wg-font-ui);
    font-size: var(--wg-health-notes-body-size);
    color: var(--wg-fg-1);
    white-space: pre-wrap;
    word-break: break-word;
}

.wg-health-notes-row__actions {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    flex-shrink: 0;
}

.wg-health-notes__load-more {
    list-style: none;
}

.wg-health-notes__load-more-btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: var(--space-md) var(--space-lg);
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-sm);
    border-radius: var(--wg-radius-gloss);
    cursor: pointer;
}

.wg-health-notes__empty {
    text-align: center;
    color: var(--wg-fg-4);
    padding: var(--space-lg);
}

.wg-health-notes__empty-msg {
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-sm);
}

/* Edit-note modal (Phase 8, Task 8). Shares the generic `.wg-modal` shell;
   overlays a dual-line mono header with header-actions hosting the close
   icon, Cancel, and Save buttons (kept visible above mobile keyboards), and
   a gloss-inset textarea body. Every visual value resolves to
   `--wg-health-modal-*` or shared `--wg-*` tokens. */
.wg-health-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.wg-health-modal__heading {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    min-width: 0;
}

.wg-health-modal__eyebrow {
    padding: 0;
    font-size: var(--wg-health-modal-eyebrow-size);
    color: var(--wg-fg-3);
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.wg-health-modal__eyebrow::before {
    content: none;
}

.wg-health-modal__title {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-health-modal-title-size);
    color: var(--wg-fg-1);
    line-height: 1.1;
}

.wg-health-modal__body {
    display: flex;
    flex-direction: column;
    gap: var(--wg-health-modal-section-gap);
}

.wg-health-modal__field {
    display: flex;
    flex-direction: column;
    gap: var(--wg-health-modal-row-gap);
    min-width: 0;
}

.wg-health-modal__label {
    font-size: var(--wg-health-modal-label-size);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--wg-fg-3);
    font-weight: var(--font-weight-bold);
}

.wg-health-modal__input-wrap {
    padding: var(--wg-health-modal-input-pad-y) var(--wg-health-modal-input-pad-x);
    display: flex;
    align-items: stretch;
    min-width: 0;
}

.wg-health-modal__input {
    width: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    outline: none;
    box-shadow: none;
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-md);
    color: var(--wg-fg-1);
    min-width: 0;
}

.wg-health-modal__input::placeholder {
    color: var(--wg-fg-4);
}

.wg-health-modal__textarea {
    resize: vertical;
    min-height: 120px;
}

.wg-health-modal__header-actions {
    display: flex;
    gap: var(--space-xs);
    align-items: center;
    flex-shrink: 0;
}

.wg-health-modal__header-btn {
    min-height: 36px;
    padding: var(--space-xs) var(--space-sm);
    font-family: var(--wg-font-ui);
    font-size: var(--font-size-sm);
    border-radius: var(--wg-radius-gloss);
    cursor: pointer;
    white-space: nowrap;
}

.wg-health-modal__header-btn--save {
    padding: var(--space-xs) var(--space-md);
}

/* Meds schedule sub-tab (Phase 5, Task 4). `.wg-section-label` hour headers
   bracket clusters of scheduled meds; each row is a `.wg-card` with a name
   (mono-display), dosage, schedule summary, optional inventory tag, and a
   trailing `.wg-icon-btn` cluster (Log / Edit / Delete). As-needed and
   Archived groups reuse the same section-label header pattern. */
.wg-meds-section-label {
    font-size: var(--wg-meds-hour-header-size);
}

.wg-meds-row {
    display: grid;
    grid-template-columns: var(--wg-meds-row-cols);
    column-gap: var(--wg-meds-row-gap);
    padding: var(--wg-meds-row-pad);
    margin-bottom: var(--space-sm);
}

.wg-meds-row.archived {
    opacity: 0.65;
}

.wg-meds-row__info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.wg-meds-row__title {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: var(--space-sm);
    min-width: 0;
}

.wg-meds-row__name {
    font-size: var(--wg-meds-name-size);
    color: var(--wg-fg-1);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.wg-meds-row__dosage {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-meds-dosage-size);
    color: var(--wg-fg-3);
    letter-spacing: 0.02em;
}

.wg-meds-row__supplement {
    flex-shrink: 0;
}

.wg-meds-row__schedule {
    font-size: var(--font-size-sm);
    color: var(--wg-fg-3);
}

.wg-meds-row__rx,
.wg-meds-row__dates {
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-xs);
    color: var(--wg-fg-4);
    letter-spacing: 0.02em;
}

.wg-meds-row__inventory {
    align-self: flex-start;
}

.wg-meds-row__actions {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    flex-shrink: 0;
}

.wg-meds-row__log-btn {
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-sm);
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--wg-radius-gloss);
    cursor: pointer;
}

.wg-meds-row__action-icons {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
}

/* Meds history sub-tab (Phase 5, Task 5). Two `.wg-gloss--inset` select
   wraps sit atop a muted next-intake link row, followed by a day-grouped
   list where each minute-cluster of intakes is a `.wg-card` row. Status
   tokens come from `.wg-tag` + `.wg-tag--mono` variants so the paper-era
   ✅/⏳/❌ icons become mono-label pills. */
.wg-meds-filters {
    display: flex;
    gap: var(--wg-meds-filter-gap);
    margin-bottom: var(--space-md);
}

.wg-meds-filters__field {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: var(--wg-meds-filter-field-pad-y) var(--wg-meds-filter-field-pad-x);
    min-width: 0;
}

.wg-meds-filters__label {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-meds-filter-label-size);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--wg-fg-4);
}

.wg-meds-filters__select {
    appearance: none;
    background: transparent;
    border: none;
    padding: 0;
    color: var(--wg-fg-1);
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-sm);
    width: 100%;
    cursor: pointer;
}

.wg-meds-filters__select:focus {
    outline: none;
}

.wg-meds-next-intake-trigger {
    display: block;
    padding: var(--wg-meds-next-intake-pad-y) var(--wg-meds-next-intake-pad-x);
    margin-bottom: var(--space-md);
    color: var(--wg-fg-3);
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-sm);
}

.wg-meds-next-intake-trigger:empty {
    display: none;
}

.wg-meds-history {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.wg-meds-history__empty {
    color: var(--wg-fg-4);
    text-align: center;
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-sm);
    margin: var(--space-lg) 0;
}

.wg-meds-history__day {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.wg-meds-history__day-label {
    font-size: var(--wg-meds-history-day-size);
}

.wg-meds-history__rows {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.wg-meds-history__row {
    display: flex;
    align-items: center;
    gap: var(--wg-meds-history-row-gap);
    padding: var(--wg-meds-history-row-pad);
}

.wg-meds-history__row.cursor-pointer {
    cursor: pointer;
}

.wg-meds-history__row-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.wg-meds-history__names {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.wg-meds-history__name {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-meds-history-name-size);
    color: var(--wg-fg-1);
}

.wg-meds-history__meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.wg-meds-history__time {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-meds-history-time-size);
    color: var(--wg-fg-3);
    letter-spacing: 0.04em;
}

.wg-meds-history__actions {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    flex-shrink: 0;
}

.wg-meds-history__status {
    white-space: nowrap;
}

/* Meds inventory sub-tab (Phase 5, Task 6). One `.wg-card` per medication
   that tracks inventory. Each card shows the med name + dosage, a large
   mono count + label, an optional low-stock alert pill, a muted
   last-refilled row, and a trailing Refill button that toggles a
   gloss-inset quantity input + confirm/cancel row underneath. */
.wg-meds-inventory {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.wg-meds-inventory__empty {
    color: var(--wg-fg-4);
    text-align: center;
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-sm);
    margin: var(--space-lg) 0;
}

.wg-meds-inventory__card {
    display: grid;
    grid-template-columns: 1fr auto;
    column-gap: var(--wg-meds-inventory-card-gap);
    row-gap: var(--wg-meds-inventory-card-gap);
    align-items: center;
    padding: var(--wg-meds-inventory-card-pad);
}

.wg-meds-inventory__main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.wg-meds-inventory__title {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-sm);
}

.wg-meds-inventory__name {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-meds-name-size);
    color: var(--wg-fg-1);
}

.wg-meds-inventory__dosage {
    color: var(--wg-fg-3);
    font-size: var(--wg-meds-inventory-dosage-size);
    font-family: var(--wg-font-mono);
}

.wg-meds-inventory__count-wrap {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.wg-meds-inventory__count {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-meds-inventory-count-size);
    color: var(--wg-fg-1);
    line-height: 1;
    letter-spacing: 0.02em;
}

.wg-meds-inventory__count-label {
    color: var(--wg-fg-3);
    font-size: var(--wg-meds-inventory-count-label-size);
    font-family: var(--wg-font-mono);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.wg-meds-inventory__low {
    white-space: nowrap;
}

.wg-meds-inventory__refilled {
    color: var(--wg-fg-4);
    font-family: var(--wg-font-mono);
    font-size: var(--wg-meds-inventory-refilled-size);
    letter-spacing: 0.04em;
}

.wg-meds-inventory__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.wg-meds-inventory__refill-btn {
    white-space: nowrap;
}

.wg-meds-inventory__refill-form {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: var(--wg-meds-inventory-refill-gap);
    flex-wrap: wrap;
}

.wg-meds-inventory__refill-form[hidden] {
    display: none;
}

.wg-meds-inventory__refill-input-wrap {
    flex: 1 1 160px;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--wg-meds-filter-field-pad-y) var(--wg-meds-filter-field-pad-x);
}

.wg-meds-inventory__refill-input-label {
    color: var(--wg-fg-3);
    font-family: var(--wg-font-mono);
    font-size: var(--wg-meds-filter-label-size);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.wg-meds-inventory__refill-input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--wg-fg-1);
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-sm);
    outline: none;
    min-width: 0;
}

/* Food day navigator (Phase 4, Task 3). Three-cell row — chevron button,
   center mono title + subtitle, chevron button. The hidden <input type="date">
   lets the mono title trigger the native picker via showPicker(); the
   "Today" chip slides in when the user navigates away from today. */
.wg-food-day-nav {
    display: grid;
    grid-template-columns:
        var(--wg-food-day-nav-icon-size) 1fr var(--wg-food-day-nav-icon-size);
    column-gap: var(--space-sm);
    row-gap: var(--space-xs);
    align-items: center;
    margin-bottom: var(--space-md);
}

/* Round-2 Task 6 (defect #9). `--with-action` widens the grid to a trailing
   `auto` column so the inline +Add sits beside the next-day chevron in a
   single row: [< prev] [date] [next >] [Add]. Previously this rule lived
   above the base `.wg-food-day-nav` declaration — equal specificity meant
   the base rule's 3-column `grid-template-columns` won the cascade, so the
   4th grid item (Add) spilled onto an implicit second row. Keeping the
   override AFTER the base rule fixes the wrap. */
.wg-food-day-nav--with-action {
    grid-template-columns:
        var(--wg-food-day-nav-icon-size) 1fr var(--wg-food-day-nav-icon-size) auto;
}

.wg-food-day-nav__icon-btn {
    width: var(--wg-food-day-nav-icon-size);
    height: var(--wg-food-day-nav-icon-size);
    min-width: var(--wg-food-day-nav-icon-size);
    color: var(--wg-fg-1);
    background: var(--wg-gloss-bg);
    border: 1px solid var(--wg-border-strong);
    border-radius: var(--wg-radius-icon);
    box-shadow: var(--wg-gloss-shadow);
}

.wg-food-day-nav__icon-btn:disabled {
    color: var(--wg-fg-4);
    filter: brightness(0.85);
    cursor: not-allowed;
}

.wg-food-day-nav__center {
    position: relative;
    text-align: center;
    min-width: 0;
}

.wg-food-day-nav__input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    border: 0;
    padding: 0;
    margin: 0;
}

.wg-food-day-nav__title {
    font-size: var(--wg-food-day-nav-title-size);
    cursor: pointer;
    user-select: none;
}

.wg-food-day-nav__subtitle {
    padding: 0;
    margin: 0;
    text-transform: uppercase;
    font-size: var(--font-size-xs);
    letter-spacing: 0.5px;
    color: var(--wg-fg-3);
}

.wg-food-day-nav__subtitle::before {
    content: none;
}

.wg-food-day-nav__week {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-sm);
    pointer-events: none;
    background: var(--wg-bg-card);
    border: 1px solid var(--wg-border-hairline);
    border-radius: var(--wg-radius-card);
    color: var(--wg-fg-2);
}

/* Food meal-grouped item list (Phase 4, Task 5). Each meal is a
   `.wg-food-meal-group` — a `.wg-section-label` header with a trailing mono
   kcal total, followed by `.wg-card` rows for each logged item. Rows carry
   name + grams on the left, sun-tinted kcal and a mono P/F macro line on the
   right, with a trailing `.wg-icon-btn` cluster (edit + delete). Offline
   pending / rejected logs get `.wg-tag--mono` badges, mirroring BP Phase 3. */
.wg-food-meal-group {
    margin-bottom: var(--space-lg);
}

.wg-food-meal-group__header {
    padding-top: var(--wg-section-label-pad-top);
    padding-bottom: var(--space-sm);
    gap: var(--wg-food-meal-header-gap);
}

.wg-food-meal-group__title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wg-food-meal-group__total {
    font-size: var(--font-size-sm);
    color: var(--wg-fg-2);
    text-transform: none;
    letter-spacing: 0;
}

.wg-food-meal-group__rows {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.wg-food-item-row {
    padding: var(--wg-food-item-row-pad);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    cursor: pointer;
}

.wg-food-item-row__checkbox {
    flex-shrink: 0;
}

.wg-food-item-row__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.wg-food-item-row__name {
    font-weight: var(--font-weight-medium);
    color: var(--wg-fg-1);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wg-food-item-row__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-xs);
    color: var(--wg-fg-3);
    font-family: var(--wg-font-mono);
}

.wg-food-item-row__grams {
    letter-spacing: 0.02em;
}

.wg-food-item-row__stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-xs);
    min-width: 0;
}

.wg-food-item-row__kcal {
    font-size: var(--font-size-sm);
    color: var(--wg-sun);
    font-weight: var(--font-weight-bold);
}

.wg-food-item-row__macros {
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-xs);
    color: var(--wg-fg-4);
    letter-spacing: 0.02em;
}

.wg-food-item-row__actions {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    flex-shrink: 0;
}

.wg-food-item-row--pending {
    opacity: 0.85;
}

.wg-food-item-row--rejected {
    border-color: var(--wg-tag-alert-border);
}

.wg-food-meal-list__empty {
    padding: var(--space-lg) 0;
}

/* Meal DB / Food DB panels (Phase 4, Task 5 follow-up) — .wg-food-db-panel
   wraps the sub-tab content shell; `.wg-food-db-card` applies to each row
   alongside `.wg-card` so the gloss surface, hairline border, and inner
   padding come from the shared card primitive. `.wg-food-db-panel__sort`
   matches the sub-tab strip layout so Meal/Food DB share rhythm with the
   daily log. */
.wg-food-db-panel {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.wg-food-db-panel__hint {
    font-family: var(--wg-font-ui);
    font-size: var(--font-size-sm);
    color: var(--wg-fg-3);
    margin: 0 0 var(--space-sm);
}

.wg-food-db-panel__search {
    margin-bottom: var(--space-sm);
}

.wg-food-db-panel__sort {
    display: flex;
    gap: var(--wg-food-subtab-gap);
    padding: var(--wg-food-subtab-pad-y) var(--wg-food-subtab-pad-x);
    margin-bottom: var(--space-md);
}

.wg-food-db-panel__sort-btn {
    flex: 1;
    min-height: 36px;
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-sm);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--wg-radius-gloss);
    text-align: center;
}

.wg-food-db-panel__list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.wg-food-db-panel__empty {
    padding: var(--space-lg) 0;
    font-family: var(--wg-font-ui);
    font-size: var(--font-size-sm);
    color: var(--wg-fg-3);
    text-align: center;
    margin: 0;
}

.wg-food-db-panel__empty--error {
    color: var(--wg-tag-alert-fg);
}

.wg-food-db-panel__pagination {
    margin-top: var(--space-md);
}

.wg-food-db-panel__page-info {
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-sm);
    color: var(--wg-fg-3);
    letter-spacing: 0.02em;
}

.wg-food-db-panel__page-actions {
    display: flex;
    gap: var(--space-sm);
}

.wg-food-db-panel__page-btn {
    min-height: 36px;
    padding: var(--space-xs) var(--space-md);
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-sm);
    border-radius: var(--wg-radius-gloss);
}

.wg-food-db-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    cursor: pointer;
}

/* Edit-food modal (Phase 4, Task 6) — uses the shared `.wg-modal` shell
   for positioning + chrome, then overlays the dual-line eyebrow/title
   header, gloss-inset input wraps, three-up macros row, and bottom
   Cancel/Save action bar. Every visual value reads from a `--wg-food-modal-*`
   or shared `--wg-*` token. */
.wg-food-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.wg-food-modal__heading {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    min-width: 0;
}

.wg-food-modal__eyebrow {
    padding: 0;
    font-size: var(--wg-food-modal-eyebrow-size);
    color: var(--wg-fg-3);
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.wg-food-modal__eyebrow::before {
    content: none;
}

.wg-food-modal__title {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-food-modal-title-size);
    color: var(--wg-fg-1);
    line-height: 1.1;
}

.wg-food-modal__body {
    display: flex;
    flex-direction: column;
    gap: var(--wg-food-modal-section-gap);
}

.wg-food-modal__row {
    display: flex;
    gap: var(--wg-food-modal-row-gap);
    align-items: flex-end;
}

.wg-food-modal__row--quick > .wg-food-modal__field--weight {
    flex: 1 1 90px;
    min-width: 0;
}

.wg-food-modal__row--quick > .wg-food-modal__field--barcode {
    flex: 2 1 auto;
    min-width: 0;
}

.wg-food-modal__row--macros > .wg-food-modal__field {
    flex: 1 1 0;
    min-width: 0;
}

.wg-food-modal__field {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    min-width: 0;
}

.wg-food-modal__field--name {
    position: relative;
}

.wg-food-modal__label {
    font-size: var(--wg-food-modal-eyebrow-size);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--wg-fg-3);
    font-weight: var(--font-weight-bold);
}

.wg-food-modal__input-wrap {
    padding: var(--wg-food-modal-input-pad-y) var(--wg-food-modal-input-pad-x);
    display: flex;
    align-items: center;
    min-width: 0;
}

.wg-food-modal__name-wrap {
    position: relative;
}

.wg-food-modal__input {
    width: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    outline: none;
    box-shadow: none;
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-md);
    color: var(--wg-fg-1);
    min-width: 0;
}

.wg-food-modal__input::placeholder {
    color: var(--wg-fg-4);
}

.wg-food-modal__input--total-kcal {
    font-size: var(--wg-food-total-kcal-input);
}

.wg-food-modal__barcode-row {
    display: flex;
    gap: var(--space-sm);
    align-items: stretch;
    min-width: 0;
}

.wg-food-modal__barcode-row > .wg-food-modal__input-wrap {
    flex: 1 1 auto;
    min-width: 0;
}

.wg-food-modal__scan-btn {
    flex: 0 0 auto;
    padding: var(--wg-food-modal-input-pad-y) var(--wg-food-modal-input-pad-x);
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    font-family: var(--wg-font-ui);
    font-size: var(--font-size-sm);
}

.wg-food-modal__status {
    margin: 0;
    font-size: var(--font-size-xs);
}

.wg-food-modal__product-link {
    font-size: var(--font-size-xs);
}

.wg-food-modal__section-label {
    padding: 0;
}

.wg-food-modal__section-label::before {
    content: none;
}

.wg-food-modal__per100g {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    margin-left: auto;
    font-size: var(--font-size-xs);
    color: var(--wg-fg-3);
    font-weight: var(--font-weight-normal);
    cursor: pointer;
}

.wg-food-modal__per100g input {
    margin: 0;
}

.wg-food-modal__header-actions {
    display: flex;
    gap: var(--space-xs);
    align-items: center;
    flex-shrink: 0;
}

.wg-food-modal__header-btn {
    min-height: 36px;
    padding: var(--space-xs) var(--space-sm);
    font-family: var(--wg-font-ui);
    font-size: var(--font-size-sm);
    border-radius: var(--wg-radius-gloss);
    cursor: pointer;
    white-space: nowrap;
}

.wg-food-modal__header-btn--save {
    padding: var(--space-xs) var(--space-md);
}

/* Edit-medication modal (Phase 5, Task 7) — shares the generic `.wg-modal`
   shell for positioning and chrome; overlays a dual-line mono header, gloss
   input wraps, schedule-type pill strip, times editor, inventory block,
   toggle row, and the Cancel/Save action bar. Every visual value comes from
   a `--wg-meds-modal-*` or shared `--wg-*` token. */
.wg-meds-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.wg-meds-modal__heading {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    min-width: 0;
}

.wg-meds-modal__eyebrow {
    padding: 0;
    font-size: var(--wg-meds-modal-eyebrow-size);
    color: var(--wg-fg-3);
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.wg-meds-modal__eyebrow::before {
    content: none;
}

.wg-meds-modal__title {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-meds-modal-title-size);
    color: var(--wg-fg-1);
    line-height: 1.1;
}

.wg-meds-modal__body {
    display: flex;
    flex-direction: column;
    gap: var(--wg-meds-modal-section-gap);
}

.wg-meds-modal__row {
    display: flex;
    gap: var(--wg-meds-modal-row-gap);
    align-items: flex-end;
}

.wg-meds-modal__row > .wg-meds-modal__field {
    flex: 1 1 0;
    min-width: 0;
}

.wg-meds-modal__field {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    min-width: 0;
}

.wg-meds-modal__label {
    font-size: var(--wg-meds-modal-label-size);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--wg-fg-3);
    font-weight: var(--font-weight-bold);
}

.wg-meds-modal__input-wrap {
    padding: var(--wg-meds-modal-input-pad-y) var(--wg-meds-modal-input-pad-x);
    display: flex;
    align-items: center;
    min-width: 0;
}

.wg-meds-modal__input {
    width: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    outline: none;
    box-shadow: none;
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-md);
    color: var(--wg-fg-1);
    min-width: 0;
}

.wg-meds-modal__input::placeholder {
    color: var(--wg-fg-4);
}

.wg-meds-modal__select {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.wg-meds-modal__rx {
    margin: 0;
    font-size: var(--wg-meds-modal-rx-size);
    color: var(--wg-fg-3);
    font-family: var(--wg-font-mono);
    display: none;
}

.wg-meds-modal__pills {
    display: flex;
    gap: var(--wg-meds-modal-pill-gap);
    padding: var(--wg-meds-modal-pill-gap);
    align-items: stretch;
}

.wg-meds-modal__pill {
    flex: 1 1 0;
    min-width: 0;
    padding: var(--wg-meds-modal-pill-pad-y) var(--wg-meds-modal-pill-pad-x);
    font-family: var(--wg-font-ui);
    font-size: var(--wg-meds-modal-pill-size);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--wg-fg-2);
    border-radius: var(--wg-radius-gloss);
    cursor: pointer;
}

.wg-meds-modal__pill[aria-pressed="true"] {
    color: var(--wg-ink);
}

.wg-meds-modal__hidden-select {
    display: none;
}

.wg-meds-modal__days {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0;
}

.wg-meds-modal__days span {
    width: var(--wg-meds-modal-day-size);
    height: var(--wg-meds-modal-day-size);
}

.wg-meds-modal__times {
    display: flex;
    flex-direction: column;
    gap: var(--wg-meds-modal-time-row-gap);
}

.wg-meds-modal__time-row {
    display: flex;
    gap: var(--wg-meds-modal-time-row-gap);
    align-items: center;
    margin-bottom: 0;
}

.wg-meds-modal__time-wrap {
    flex: 1 1 auto;
}

.wg-meds-modal__remove-time {
    flex: 0 0 auto;
    font-size: var(--font-size-lg);
}

.wg-meds-modal__add-time {
    align-self: flex-start;
    padding: var(--wg-meds-modal-pill-pad-y) var(--wg-meds-modal-pill-pad-x);
    font-family: var(--wg-font-ui);
    font-size: var(--font-size-sm);
    border-radius: var(--wg-radius-gloss);
}

.wg-meds-modal__inventory-block {
    gap: var(--wg-meds-modal-row-gap);
}

.wg-meds-modal__inventory {
    display: flex;
    flex-direction: column;
    gap: var(--wg-meds-modal-row-gap);
}

.wg-meds-modal__inventory.hidden {
    display: none;
}

.wg-meds-modal__restock {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.wg-meds-modal__restock-row {
    display: flex;
    gap: var(--wg-meds-modal-time-row-gap);
    align-items: center;
}

.wg-meds-modal__restock-qty-wrap {
    flex: 1 1 auto;
    min-width: 0;
}

.wg-meds-modal__restock-add {
    flex: 0 0 auto;
    padding: var(--wg-meds-modal-pill-pad-y) var(--wg-meds-modal-pill-pad-x);
    font-family: var(--wg-font-ui);
    font-size: var(--font-size-sm);
    border-radius: var(--wg-radius-gloss);
}

.wg-meds-modal__restock-history {
    font-size: var(--font-size-xs);
    color: var(--wg-fg-3);
}

.wg-meds-modal__toggle-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--wg-meds-modal-toggle-gap);
}

.wg-meds-modal__toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    font-family: var(--wg-font-ui);
    font-size: var(--font-size-sm);
    color: var(--wg-fg-2);
    cursor: pointer;
}

.wg-meds-modal__toggle input[type="checkbox"] {
    margin: 0;
    width: auto;
}

.wg-meds-modal__header-actions {
    display: flex;
    gap: var(--space-xs);
    align-items: center;
    flex-shrink: 0;
}

.wg-meds-modal__header-btn {
    min-height: 36px;
    padding: var(--space-xs) var(--space-sm);
    font-family: var(--wg-font-ui);
    font-size: var(--font-size-sm);
    border-radius: var(--wg-radius-gloss);
    cursor: pointer;
    white-space: nowrap;
}

.wg-meds-modal__header-btn--save {
    padding: var(--space-xs) var(--space-md);
}

/* Take-meds (medication confirm) modal (Task 4b audit) — shares the generic
   `.wg-modal` shell; overlays a sun-coloured eyebrow, mono title ("Time for
   Meds"), subtitle (count / scheduled-for text), scrollable list of
   checkbox-style rows (each row flips from dark-inset to green-highlight
   when selected), a Snooze + Skip secondary actions row, and the full-width
   sun "Confirm selected" primary button. Every visual value reads from a
   `--wg-med-confirm-modal-*` or shared `--wg-*` token. */
.wg-med-confirm-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.wg-med-confirm-modal__heading {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    min-width: 0;
}

.wg-med-confirm-modal__eyebrow {
    padding: 0;
    font-size: var(--wg-med-confirm-modal-eyebrow-size);
    color: var(--wg-sun);
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.wg-med-confirm-modal__eyebrow::before {
    content: none;
}

.wg-med-confirm-modal__title {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-med-confirm-modal-title-size);
    color: var(--wg-fg-1);
    line-height: 1.1;
}

.wg-med-confirm-modal__subtitle {
    font-size: var(--wg-med-confirm-modal-subtitle-size);
    color: var(--wg-fg-3);
}

.wg-med-confirm-modal__close-btn {
    flex-shrink: 0;
}

.wg-med-confirm-modal__time-edit {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    margin-bottom: var(--space-md);
}

.wg-med-confirm-modal__label {
    font-size: var(--wg-med-confirm-modal-eyebrow-size);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--wg-fg-3);
    font-weight: var(--font-weight-bold);
}

.wg-med-confirm-modal__input-wrap {
    padding: var(--space-md);
    display: flex;
    align-items: center;
    min-width: 0;
}

.wg-med-confirm-modal__input {
    width: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    outline: none;
    box-shadow: none;
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-md);
    color: var(--wg-fg-1);
    min-width: 0;
}

.wg-med-confirm-modal__list {
    display: flex;
    flex-direction: column;
    gap: var(--wg-med-confirm-modal-row-gap);
    margin-bottom: var(--space-md);
}

.wg-med-confirm-modal__row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--wg-med-confirm-modal-row-pad-y) var(--wg-med-confirm-modal-row-pad-x);
    border-radius: var(--wg-radius-gloss);
    background: var(--wg-gloss-bg-inset);
    border: 1px solid var(--wg-border-hairline);
    cursor: pointer;
    min-width: 0;
}

.wg-med-confirm-modal__row--on {
    background: var(--wg-tag-high-bg);
    border-color: var(--wg-tag-high-border);
}

.wg-med-confirm-modal__row-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

.wg-med-confirm-modal__check {
    width: var(--wg-med-confirm-modal-check-size);
    height: var(--wg-med-confirm-modal-check-size);
    border-radius: var(--wg-med-confirm-modal-check-radius);
    flex-shrink: 0;
    background: var(--wg-bg-card-inset);
    border: 1px solid var(--wg-border-hairline);
    box-shadow: var(--wg-gloss-shadow-inset);
    display: flex;
    align-items: center;
    justify-content: center;
}

.wg-med-confirm-modal__row--on .wg-med-confirm-modal__check {
    background: var(--wg-tag-high-fg);
    border-color: var(--wg-tag-high-border);
    box-shadow: none;
    position: relative;
}

.wg-med-confirm-modal__row--on .wg-med-confirm-modal__check::after {
    content: '';
    width: 8px;
    height: 4px;
    border-left: 2px solid var(--wg-ink);
    border-bottom: 2px solid var(--wg-ink);
    transform: rotate(-45deg) translate(1px, -1px);
}

.wg-med-confirm-modal__row-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1 1 auto;
}

.wg-med-confirm-modal__row-name {
    font-family: var(--wg-font-ui);
    font-size: var(--wg-med-confirm-modal-name-size);
    color: var(--wg-fg-1);
    font-weight: var(--font-weight-bold);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wg-med-confirm-modal__secondary-actions {
    display: flex;
    gap: var(--wg-med-confirm-modal-action-gap);
    margin-bottom: var(--wg-med-confirm-modal-action-gap);
}

.wg-med-confirm-modal__secondary {
    flex: 1 1 0;
    padding: var(--space-md);
    font-family: var(--wg-font-ui);
    font-size: var(--font-size-sm);
    border-radius: var(--wg-radius-gloss);
}

.wg-med-confirm-modal__secondary--skip {
    color: var(--wg-tag-alert-fg);
}

.wg-med-confirm-modal__primary {
    width: 100%;
    padding: var(--space-md);
    font-family: var(--wg-font-ui);
    font-size: var(--font-size-md);
    border-radius: var(--wg-radius-gloss);
}

/* Wandergeek toggle primitive (Phase 9, Task 1). Renders a pill with a
   knob driven by a hidden <input type="checkbox">. The unchecked state
   uses --wg-toggle-bg (inset-gloss); the checked state flips to
   --wg-toggle-bg-on (the sun gradient) so the toggle visually matches
   the `.wg-gloss--sun` convention used for primary actions everywhere
   else in the Wandergeek system. Focus-visible and disabled states are
   tokenized via --wg-toggle-border-{focus,disabled}. */
.wg-toggle {
    position: relative;
    display: inline-block;
    width: var(--wg-toggle-width);
    height: var(--wg-toggle-height);
    flex-shrink: 0;
    cursor: pointer;
}

.wg-toggle__input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    inset: 0;
    cursor: pointer;
}

.wg-toggle__track {
    position: absolute;
    inset: 0;
    background: var(--wg-toggle-bg);
    border: 1px solid var(--wg-toggle-border);
    border-radius: var(--wg-radius-pill);
    box-shadow: var(--wg-gloss-shadow-inset);
    transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
    pointer-events: none;
}

.wg-toggle__knob {
    position: absolute;
    top: var(--wg-toggle-knob-pad);
    left: var(--wg-toggle-knob-pad);
    width: var(--wg-toggle-knob-size);
    height: var(--wg-toggle-knob-size);
    background: var(--wg-toggle-knob);
    border-radius: var(--radius-pill);
    transition: transform 160ms ease, background 160ms ease;
    pointer-events: none;
}

.wg-toggle__input:checked ~ .wg-toggle__track {
    background: var(--wg-toggle-bg-on);
    box-shadow: var(--wg-gloss-shadow-sun);
}

.wg-toggle__input:checked ~ .wg-toggle__knob {
    background: var(--wg-toggle-knob-on);
    transform: translateX(calc(var(--wg-toggle-width) - var(--wg-toggle-knob-size) - var(--wg-toggle-knob-pad) - var(--wg-toggle-knob-pad)));
}

.wg-toggle__input:focus-visible ~ .wg-toggle__track {
    outline: 2px solid var(--wg-toggle-border-focus);
    outline-offset: 2px;
}

.wg-toggle__input:disabled ~ .wg-toggle__track {
    border-color: var(--wg-toggle-border-disabled);
    opacity: 0.6;
}

.wg-toggle__input:disabled ~ .wg-toggle__knob {
    opacity: 0.6;
}

.wg-toggle--disabled {
    cursor: not-allowed;
}

/* Settings row shell used by <mt-setting-toggle> — full spec in Phase 9,
   Task 2 (section cards + row list). Minimum viable layout lives here so
   the Task 1 rewrite of MTSettingToggle renders meaningfully even before
   the card shell lands. */
.wg-settings-row {
    display: grid;
    grid-template-columns: var(--wg-settings-row-cols);
    gap: var(--wg-settings-row-gap);
    align-items: center;
    padding: var(--wg-settings-row-pad-y) var(--wg-settings-row-pad-x);
}

.wg-settings-row + .wg-settings-row {
    border-top: var(--wg-settings-row-divider);
}

.wg-settings-row__content {
    min-width: 0;
}

.wg-settings-row__title {
    margin: 0;
    font-family: var(--wg-font-ui);
    font-size: var(--wg-settings-title-size);
    font-weight: var(--font-weight-medium);
    color: var(--wg-fg-1);
}

.wg-settings-row__desc {
    margin: var(--space-xs) 0 0 0;
    font-family: var(--wg-font-ui);
    font-size: var(--wg-settings-desc-size);
    color: var(--wg-fg-3);
}

.wg-settings-row__control {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

/* Sectioned card shell (Phase 9, Task 2) — groups titled settings rows into
   a `.wg-card` with a mono header, optional uppercase eyebrow, and an
   optional muted description. The `.wg-settings-row-list` child container
   holds the caller-provided rows (toggles, inputs, buttons) and inherits
   the token'd row hairline divider from `.wg-settings-row + .wg-settings-row`. */
.wg-settings-section {
    display: flex;
    flex-direction: column;
    gap: var(--wg-settings-section-gap);
    padding: var(--wg-settings-section-pad);
}

.wg-settings-section__eyebrow {
    padding: 0;
}

.wg-settings-section__title {
    margin: 0;
    font-family: var(--wg-font-mono);
    font-size: var(--wg-settings-title-size);
    font-weight: var(--font-weight-medium);
    color: var(--wg-fg-1);
    letter-spacing: 0.02em;
}

.wg-settings-section__desc {
    margin: 0;
    font-family: var(--wg-font-ui);
    font-size: var(--wg-settings-desc-size);
    color: var(--wg-fg-3);
}

.wg-settings-row-list {
    display: flex;
    flex-direction: column;
}

/* Read-only info rows (Phase 9, Task 2) — used by the Timezone card. The
   label is a short uppercase eyebrow; the value is a mono display string.
   Layout is a max-content + 1fr grid driven by `--wg-settings-info-grid-*`
   tokens so multiple info rows inside a `.wg-card--inset` container align
   their label columns. */
.wg-settings-info-row {
    display: grid;
    grid-template-columns: var(--wg-settings-info-grid-cols);
    gap: var(--wg-settings-info-grid-gap);
    align-items: baseline;
    padding: var(--wg-settings-row-pad-y) 0;
}

.wg-settings-info-row + .wg-settings-info-row {
    border-top: var(--wg-settings-row-divider);
}

.wg-settings-info-row__label {
    font-family: var(--wg-font-ui);
    font-size: var(--wg-settings-info-label-size);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--wg-fg-4);
}

.wg-settings-info-row__value {
    font-size: var(--wg-settings-info-value-size);
    color: var(--wg-fg-1);
    min-width: 0;
    overflow-wrap: anywhere;
}

/* Info-grid frame (Phase 9, Task 3). Wraps the Timezone card's info rows
   in a `.wg-gloss--inset` panel so each value reads against the same
   inset-glass surface used for numeric input wraps. */
.wg-settings-info-grid {
    padding: var(--wg-settings-row-pad-y) var(--wg-settings-section-pad);
}

/* Muted footnote below an info-grid (e.g. timezone change warning). */
.wg-settings-info-note {
    margin: var(--wg-settings-section-gap) 0 0 0;
    font-family: var(--wg-font-ui);
    font-size: var(--wg-settings-desc-size);
    color: var(--wg-fg-3);
}

.wg-settings-info-note:empty {
    display: none;
}

/* Utility — hide a settings-view element without inline styles. Used by
   `sync.js` to toggle the sync status bar off before the first update
   tick and by any future empty-state gating. */
.wg-settings-hidden {
    display: none !important;
}

/* Hide the OIDC setup card when the flow is disabled (container stays in
   the DOM so app.js can populate it, but nothing should render visually
   when it's empty). */
.wg-settings-oidc:empty {
    display: none;
}

/* Notifications card (Phase 9, Task 4) — webpush status pill + action-row
   buttons share this section. The status pill uses the Wandergeek tag
   triplets (`--wg-tag-normal-*` / `--wg-tag-alert-*` / neutral hairline)
   via the `.wg-tag--mono--success` / `--alert` / `--muted` variants. The
   legacy `.status-success` / `.status-error` / `.status-muted` class
   names survive as aliases so any code that still sets them resolves to
   the same token'd styling. */
.wg-settings-webpush-status {
    margin: 0;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--wg-radius-gloss);
    border: 1px solid transparent;
    font-family: var(--wg-font-mono);
    font-size: var(--wg-settings-desc-size);
    letter-spacing: 0;
}

.wg-tag--mono--success,
.wg-settings-webpush-status.status-success {
    background: var(--wg-tag-normal-bg);
    color: var(--wg-tag-normal-fg);
    border-color: var(--wg-tag-normal-border);
}

.wg-tag--mono--alert,
.wg-settings-webpush-status.status-error {
    background: var(--wg-tag-alert-bg);
    color: var(--wg-tag-alert-fg);
    border-color: var(--wg-tag-alert-border);
}

.wg-tag--mono--muted,
.wg-settings-webpush-status.status-muted {
    background: transparent;
    color: var(--wg-fg-3);
    border-color: var(--wg-border-hairline);
}

/* Action-row inside a settings row — lays out two inline action buttons
   (Test Meds / Test BP) with a token'd gap instead of `margin-left`. */
.wg-settings-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--wg-settings-action-row-gap);
    justify-content: flex-end;
}

.wg-settings-action-btn {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-settings-desc-size);
    padding: var(--space-xs) var(--space-md);
    border: none;
    color: var(--wg-fg-1);
    cursor: pointer;
}

/* Food Targets number-field grid (Phase 9, Task 6). A 2×2 grid of
   number fields for calories / carbs / protein / fat. Each field is a
   stacked mono uppercase label + a `.wg-gloss--inset` input wrap with a
   trailing unit tag. No inline styles, no hardcoded spacing — every
   value comes from a `--wg-settings-number-*` token. */
.wg-settings-number-grid {
    display: grid;
    grid-template-columns: var(--wg-settings-number-grid-cols);
    gap: var(--wg-settings-number-grid-gap);
}

.wg-settings-number-field {
    display: flex;
    flex-direction: column;
    gap: var(--wg-settings-number-field-gap);
    min-width: 0;
}

.wg-settings-number-field__label {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-settings-number-field-label-size);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--wg-fg-3);
    font-weight: var(--font-weight-bold);
}

.wg-settings-number-field__wrap {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    min-height: var(--wg-settings-number-field-height);
    padding: 0 var(--wg-settings-number-field-pad-x);
    min-width: 0;
}

.wg-settings-number-field__input {
    flex: 1 1 0;
    width: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    outline: none;
    box-shadow: none;
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-md);
    color: var(--wg-fg-1);
    min-width: 0;
}

.wg-settings-number-field__input::placeholder {
    color: var(--wg-fg-4);
}

.wg-settings-number-field__unit {
    font-family: var(--wg-font-mono);
    font-size: var(--wg-settings-number-field-unit-size);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--wg-fg-3);
    flex-shrink: 0;
}

/* Full-width primary Save button inside the Food Targets section —
   `.wg-gloss--sun` carries the glossy gradient; this class adds the
   full-width layout + min-height so the button matches the other
   Wandergeek save actions. */
.wg-settings-save-btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    min-height: var(--wg-settings-save-btn-min-height);
    padding: var(--space-md) var(--space-lg);
    font-family: var(--wg-font-mono);
    font-size: var(--font-size-md);
    border: none;
    border-radius: var(--wg-radius-gloss);
    color: var(--wg-fg-1);
    cursor: pointer;
}

/* Version footer (Phase 9, Task 7) — mono eyebrow + short-hash value
   centered below the last settings section. Sits outside any card so it
   reads as metadata, not content. Value text is the `VERSION_PLACEHOLDER`
   string swapped at deploy time. */
.wg-settings-version {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: var(--wg-settings-version-pad) var(--space-md) var(--space-md);
    font-family: var(--wg-font-mono);
    font-size: var(--wg-settings-version-size);
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.wg-settings-version__label {
    color: var(--wg-fg-4);
}

.wg-settings-version__value {
    color: var(--wg-fg-3);
}
