:root {
    --bg: #F2F2F7;
    --card: #FFFFFF;
    --border: #E5E5EA;
    --text: #000000;
    --text-secondary: #5F5E5A;
    --text-tertiary: #888780;
    --label-secondary: var(--text-secondary);
    --placeholder-muted: var(--text-tertiary);
    --primary: #FFD60A;
    --primary-light: #FFF9E0;
    --brand-green: #30D158;
    --brand-blue: #38BDF8;
    --brand-orange: #FF9F0A;
    --brand-red: #FF3B30;
    --brand-purple: #A855F7;
    --success: #30D158;
    --warning: #FF9F0A;
    --danger: #FF3B30;
    --gold: #FFD60A;
    --btn-on-primary: #111111;
    --btn-secondary-bg: #ffffff;
    --btn-secondary-text: #000000;
    --btn-secondary-border: #e5e5ea;
    --nav-pill-bg: rgba(255, 255, 255, 0.78);
    --nav-pill-border: rgba(0, 0, 0, 0.06);
    --nav-bar-height: 78px;
    --safe-area-top: env(safe-area-inset-top, 0px);
    --nav-safe-bottom: env(safe-area-inset-bottom, 0px);
    --nav-bottom-inset: calc(var(--nav-bar-height) + var(--nav-safe-bottom));
    --shadow-card: 0 2px 16px rgba(0, 0, 0, 0.06);
    --bar-calories: #FFD60A;
    --bar-protein: #38BDF8;
    --bar-carbs: #30D158;
    --bar-fat: #FF9F0A;
    --bar-steps: #38bdf8;
    --bar-water: #38bdf8;
    --font-stack: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
    --font-page-greeting: 700 28px/1.2 var(--font-stack);
    --font-card-title: 700 20px/1.25 var(--font-stack);
    --font-body: 400 14px/1.5 var(--font-stack);
    --font-stat-number: 700 32px/1.15 var(--font-stack);
    --font-section-header: 600 11px/1.35 var(--font-stack);
    --font-stat-label: 500 11px/1.35 var(--font-stack);
    --font-button: 600 16px/1.25 var(--font-stack);
    --font-nav-label: 400 11px/1.25 var(--font-stack);
}

/* In-app dark mode only (body.dark / body.dark-mode) — never OS prefers-color-scheme */
body.dark,
body.dark-mode {
    --bg: #1C1C1E;
    --card: #2C2C2E;
    --border: #3A3A3C;
    --text: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.75);
    --text-tertiary: rgba(255, 255, 255, 0.55);
    --label-secondary: var(--text-secondary);
    --placeholder-muted: var(--text-tertiary);
    --primary: #ffd60a;
    --primary-light: #3a3420;
    --btn-on-primary: #111111;
    --btn-secondary-bg: #1c1c1e;
    --btn-secondary-text: #ffffff;
    --btn-secondary-border: #2c2c2e;
    --nav-pill-bg: rgba(28, 28, 30, 0.82);
    --nav-pill-border: rgba(255, 255, 255, 0.08);
    --shadow-card: 0 2px 20px rgba(0, 0, 0, 0.45);
}

/* iOS WKWebView / Safari: home-indicator inset is ~34px. That whole value was
   painted as empty space under tab labels (Android inset is ~0, so it looked fine).
   Pull labels 12px closer; floor at 0 so iPhone SE / Android are unchanged. */
@supports (-webkit-touch-callout: none) {
    :root {
        --nav-safe-bottom: max(0px, calc(env(safe-area-inset-bottom, 0px) - 12px));
    }
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html {
    color-scheme: light;
}
body.dark,
body.dark-mode {
    color-scheme: dark;
}
html,
body,
button,
input,
select,
textarea {
    font-family: var(--font-stack);
}
input,
select {
    font-size: 16px;
}
button {
    min-width: 44px;
    min-height: 44px;
}
body {
    background: var(--bg);
    color: var(--text);
    font: var(--font-body);
    padding-top: var(--safe-area-top);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    transition: background 0.3s;
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
}
html.pg-auth-chrome-light,
body.pg-auth-chrome-light {
    background: #FFFFFF !important;
}
body.pg-auth-chrome-light {
    padding-bottom: 0 !important;
}
body.pg-auth-chrome-light::after {
    content: '';
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: max(24px, env(safe-area-inset-bottom, 0px));
    background: #FFFFFF;
    pointer-events: none;
    z-index: 999;
}
/* In-app legal docs (Privacy / Terms) */
.pg-legal-doc {
    position: fixed;
    inset: 0;
    z-index: 110000;
    background: var(--bg);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: none;
    touch-action: pan-y;
    max-width: 100vw;
    padding: 0;
}
.pg-legal-doc-inner {
    max-width: 480px;
    margin: 0 auto;
    padding: 0 16px calc(28px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
}
.pg-legal-doc-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 4px 0 10px;
    background: var(--bg);
}
.pg-legal-doc-back {
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    padding: 6px 10px;
    margin: 0 0 0 -6px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
}
.pg-legal-doc-back:active {
    opacity: 0.7;
}
.pg-legal-doc-title {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
    letter-spacing: 0.02em;
}
.pg-legal-doc-body {
    min-height: 40vh;
}

#auth-modal {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100dvh;
    z-index: 100000;
    display: none;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    min-height: 100dvh;
    padding: 0;
    padding-top: var(--safe-area-top);
    background: #FFFFFF;
    box-sizing: border-box;
    overflow: hidden;
}
.auth-modal-wrapper {
    width: 100%;
    height: 100%;
    padding: 0;
    box-sizing: border-box;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    flex: 1;
}
.auth-card {
    width: 100%;
    max-width: none;
    background: #FFFFFF;
    border: none;
    border-radius: 0;
    padding: 24px;
    box-shadow: none;
    margin: 0;
    overflow: hidden;
    box-sizing: border-box;
    flex: 1;
}
.auth-card h1, .auth-card h2 {
    color: #1C1C1E;
    font: var(--font-card-title);
    margin-bottom: 8px;
}
.auth-card p {
    color: #636366;
    font: var(--font-body);
    margin-bottom: 16px;
}
.auth-card input[type="email"],
.auth-card input[type="password"] {
    background: #FFFFFF;
    border: 1.5px solid #E5E5EA;
    border-radius: 12px;
    color: #1C1C1E;
    padding: 12px;
    font: var(--font-body);
    font-size: 16px;
    width: 100%;
    margin-bottom: 10px;
    font-family: inherit;
    box-sizing: border-box;
}
.auth-card input[type="email"]:focus,
.auth-card input[type="password"]:focus {
    outline: none;
    border-color: #FFD60A;
    box-shadow: 0 0 0 3px rgba(255, 214, 10, 0.18);
}
.auth-card input::placeholder {
    color: #8E8E93;
}
.btn-oauth {
    width: 100%;
    border-radius: 12px;
    border: 1.5px solid #E5E5EA;
    background: #FFFFFF;
    color: #1C1C1E;
    padding: 12px 14px;
    font: var(--font-button);
    cursor: pointer;
    margin-bottom: 10px;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-sizing: border-box;
}
.btn-oauth:hover {
    border-color: #D1D1D6;
    background: #F8F8FA;
    color: #1C1C1E;
}
.btn-oauth:active {
    opacity: 0.9;
}
#auth-login-card.auth-card {
    padding: 0;
    overflow: hidden;
}
.auth-check-email-panel {
    padding: 24px;
    box-sizing: border-box;
}
.auth-screen-shell {
    overflow: hidden;
    border-radius: 0;
}
.auth-screen-track {
    display: flex;
    width: 200%;
    transform: translateX(0);
    transition: transform 0.28s ease;
}
#auth-login-card.auth-signup-mode .auth-screen-track {
    transform: translateX(-50%);
}
.auth-screen {
    width: 50%;
    flex: 0 0 50%;
    padding: 24px;
    box-sizing: border-box;
}
.auth-login-logo {
    width: 100%;
    height: 225px;
    display: block;
    margin: 6px 0 12px;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    object-fit: contain;
    object-position: center;
    box-sizing: border-box;
}
.auth-back-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: #1C1C1E;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    margin: 2px 0 8px;
}
.auth-screen-title {
    font-size: 28px;
    font-weight: 800;
    color: #1C1C1E;
    margin: 0 0 6px;
}
.auth-screen-subtitle {
    font-size: 14px;
    line-height: 1.5;
    color: #8E8E93;
    margin: 0 0 18px;
}
.auth-field-label {
    display: block;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #8E8E93;
    margin-bottom: 6px;
}
.auth-hint-copy {
    display: none;
    font-size: 12px;
    line-height: 1.4;
    color: #8E8E93;
    margin: -2px 0 12px;
}
.auth-forgot-wrap {
    text-align: center;
    margin: -2px 0 12px;
}
.auth-inline-link {
    background: none;
    border: none;
    padding: 0;
    font-size: 13px;
    font-weight: 700;
    color: #A855F7;
    cursor: pointer;
}
.auth-primary-btn,
.auth-outline-btn {
    width: 100%;
    min-height: 48px;
    border-radius: 14px;
    padding: 13px 16px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s, background 0.2s, color 0.2s, border-color 0.2s;
    box-sizing: border-box;
}
.auth-primary-btn {
    background: #FFD60A;
    color: #111111;
    border: 1px solid #FFD60A;
}
.auth-primary-btn:active {
    transform: scale(0.98);
}
.auth-primary-btn:disabled {
    background: #E5E5EA;
    border-color: #E5E5EA;
    color: #8E8E93;
    cursor: default;
    transform: none;
}
.auth-outline-btn {
    background: #000000;
    color: #FFFFFF;
    border: none;
    margin-top: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.auth-outline-btn:hover {
    background: #111111;
}
.auth-outline-btn-base {
    color: #FFFFFF;
}
.auth-outline-btn-accent {
    color: #FFD60A;
}
.auth-divider {
    position: relative;
    text-align: center;
    margin: 14px 0;
}
.auth-divider::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    border-top: 1px solid var(--border);
}
.auth-divider span {
    position: relative;
    z-index: 1;
    display: inline-block;
    padding: 0 10px;
    background: #FFFFFF;
    color: #8E8E93;
    font: var(--font-section-header);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.auth-signup-divider {
    margin-top: 16px;
}
.auth-inline-error {
    display: none;
    color: #FF3B30;
    font-size: 13px;
    line-height: 1.45;
    text-align: center;
    margin: 0 24px 20px;
}
.auth-confirm-error {
    min-height: 18px;
    margin: -2px 0 12px;
    color: #FF3B30;
    font-size: 12px;
    line-height: 1.4;
}
.auth-legal-copy,
.auth-signup-legal {
    font-size: 11px;
    line-height: 1.5;
    color: #8E8E93;
    text-align: center;
    margin-top: 12px;
}
.auth-signup-legal {
    margin: 4px 0 14px;
    text-align: left;
}
:is(body.dark, body.dark-mode) .auth-card p,
:is(body.dark, body.dark-mode) .auth-card input::placeholder,
:is(body.dark, body.dark-mode) .auth-screen-subtitle,
:is(body.dark, body.dark-mode) .auth-field-label,
:is(body.dark, body.dark-mode) .auth-hint-copy,
:is(body.dark, body.dark-mode) .auth-primary-btn:disabled,
:is(body.dark, body.dark-mode) .auth-divider span,
:is(body.dark, body.dark-mode) .auth-legal-copy,
:is(body.dark, body.dark-mode) .auth-signup-legal {
    color: var(--text-secondary);
}
.auth-secondary-link {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 8px 0 0;
    border: none;
    background: transparent;
    color: #A855F7;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.auth-bridge-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 640px) {
    #auth-modal {
        min-height: 100dvh;
        height: 100dvh;
        padding: 0;
        padding-top: var(--safe-area-top);
        align-items: stretch;
        justify-content: flex-start;
        overflow: hidden;
        box-sizing: border-box;
    }
    .auth-modal-wrapper {
        padding: 0;
    }
    .auth-card {
        width: 100%;
        max-width: none;
        border-radius: 0;
        margin: 0;
    }
    .auth-card h2 {
        font: var(--font-card-title);
    }
    .auth-card p {
        font: var(--font-body);
        line-height: 1.5;
    }
    .auth-primary-btn,
    .auth-outline-btn,
    .btn-oauth {
        min-height: 44px;
        width: 100%;
        box-sizing: border-box;
    }
    .auth-screen {
        padding: 24px 20px;
    }
    .auth-inline-error {
        margin: 0 16px 16px;
    }
}

/* HEADER */
.header { background: var(--bg); padding: 16px 20px 12px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; border-bottom: 1px solid var(--border); }
.header h1 { color: var(--text); font: var(--font-card-title); letter-spacing: 0.06em; text-transform: uppercase; }
.header-greeting { color: var(--text-secondary); font: var(--font-body); text-align: right; max-width: 55%; }

/* SCREENS
   Top sits below body safe-area (notch/status bar). Safe-area itself is
   body padding-top: var(--safe-area-top) — do not reduce that.
   Home: 6px. Train / Nutrition / Progress / Profile: 2px.
   Profile sub-menus use #profile-v2-sheet-host (not .screen) — see toolbar rule. */
.screen { display: none; padding: 4px 16px 8px; opacity: 0; }
#screen-home {
    padding-top: 6px;
}
#screen-train,
#screen-calories,
#screen-progress,
#screen-profile {
    padding-top: 2px;
}
.screen.active { display: block; animation: screenFadeIn 0.15s ease forwards; }
#screen-home.active,
#screen-train.active,
#screen-calories.active,
#screen-progress.active {
    padding-bottom: calc(var(--nav-bottom-inset) + 8px);
}

/* Progress tab — never allow page-level horizontal scroll / grey-gap bleed */
#screen-progress,
#screen-progress.active {
    position: relative;
    overflow-x: hidden;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    overscroll-behavior-x: none;
}
#screen-progress > div,
#progress-pane,
#profile-pane,
#progress-dashboard-root,
#progress-profile-toggle,
#progress-legacy-content {
    max-width: 100%;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}
#progress-dashboard-root canvas,
#progress-pane canvas {
    display: block;
    max-width: 100%;
}
#progress-dash-weight-chart-holder,
#progress-dash-nutrition-chart-holder,
#progress-strength-chart-wrap,
#progress-dash-training-load-chart-wrap,
#progress-dash-frequency-chart-wrap,
#progress-dash-frequency-bars-host {
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
    box-sizing: border-box;
}
#train-workout-content,
#train-log-content {
    padding-bottom: 0 !important;
}

/* Pull-to-refresh (main tabs) */
#pg-pull-refresh {
    position: fixed;
    top: env(safe-area-inset-top, 0px);
    left: 0;
    right: 0;
    z-index: 12000;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    height: 0;
    pointer-events: none;
    overflow: hidden;
    padding-top: 0;
    box-sizing: border-box;
    background: var(--bg);
    transition: height 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
#pg-pull-refresh.pg-pull-refresh--snap-back {
    transition: height 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.screen.pg-pull-refresh-shift {
    will-change: transform;
}
.screen.pg-pull-refresh-shift--snap {
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.pg-pull-refresh__spinner-wrap {
    margin-bottom: 10px;
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.15s ease, transform 0.15s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
#pg-pull-refresh.pg-pull-refresh--visible .pg-pull-refresh__spinner-wrap {
    opacity: 1;
    transform: scale(0.92);
}
#pg-pull-refresh.pg-pull-refresh--threshold .pg-pull-refresh__spinner-wrap,
#pg-pull-refresh.pg-pull-refresh--loading .pg-pull-refresh__spinner-wrap {
    opacity: 1;
    transform: scale(1);
}
.pg-pull-refresh__spinner {
    display: block;
    width: 22px;
    height: 22px;
    box-sizing: border-box;
    border: 2px solid var(--border);
    border-top-color: var(--primary, #FFD60A);
    border-radius: 50%;
    transform-origin: center center;
}
#pg-pull-refresh.pg-pull-refresh--spinning .pg-pull-refresh__spinner {
    animation: pgPullRefreshSpin 0.8s linear infinite;
}
@keyframes pgPullRefreshSpin {
    to { transform: rotate(360deg); }
}

@keyframes screenFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUpCard {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* CARDS */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 22px; padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow-card); animation: slideUpCard 0.3s ease forwards; }
.card h2 { color: var(--text); font: var(--font-section-header); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 14px; }
.card-kicker { color: var(--text); font: var(--font-section-header); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 12px; }

/* STATS */
.stat-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.stat-label { color: var(--text-tertiary); font: var(--font-stat-label); text-transform: uppercase; letter-spacing: 0.06em; }
.stat-value { color: var(--text); font: var(--font-stat-number); }

/* PROGRESS BARS */
.progress-bar-outer { background: var(--border); border-radius: 999px; height: 8px; margin-top: 6px; overflow: hidden; }
.progress-bar-inner { height: 8px; border-radius: 999px; width: 0%; transition: width 0.5s ease; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.04); background: var(--border); }
.progress-bar-inner.green { background: var(--success); }
.progress-bar-inner.gold { background: var(--primary); }
#home-bar-calories, #nut-bar-calories { background: var(--bar-calories) !important; }
#home-bar-protein, #bar-protein { background: var(--bar-protein) !important; }
#home-bar-carbs, #bar-carbs { background: var(--bar-carbs) !important; }
#home-bar-fat, #bar-fat { background: var(--bar-fat) !important; }
#home-bar-steps, #bar-steps, #steps-bar-train { background: var(--bar-steps) !important; }
#home-bar-water, #bar-water { background: var(--bar-water) !important; }
#home-prog-bar, #prog-bar { background: var(--text) !important; }

/* BUTTONS — default = secondary (white pill); yellow only Start/Save workout */
.btn {
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
    border: 1px solid var(--btn-secondary-border);
    border-radius: 999px;
    padding: 15px 22px;
    font: var(--font-button);
    letter-spacing: 0.02em;
    cursor: pointer;
    width: 100%;
    margin-bottom: 10px;
    transition: transform 0.1s ease, opacity 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-accent-yellow {
    background: var(--primary) !important;
    color: var(--btn-on-primary) !important;
    border-color: var(--primary) !important;
}
.btn-outline {
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
    border: 1px solid var(--btn-secondary-border);
    border-radius: 999px;
    padding: 12px 20px;
    font: var(--font-button);
    cursor: pointer;
    width: 100%;
    margin-bottom: 10px;
    transition: transform 0.1s ease, opacity 0.15s ease;
}
.btn-outline:active { transform: scale(0.97); }
.btn-small {
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
    border: 1px solid var(--btn-secondary-border);
    border-radius: 999px;
    padding: 8px 14px;
    font: var(--font-button);
    cursor: pointer;
    margin-right: 6px;
    margin-bottom: 6px;
    min-width: 44px;
    min-height: 44px;
    transition: transform 0.1s ease;
}
.btn-small:active { transform: scale(0.97); }
.btn-danger {
    background: var(--btn-secondary-bg);
    color: var(--danger);
    border: 1px solid var(--btn-secondary-border);
    border-radius: 999px;
    padding: 8px 12px;
    font: var(--font-button);
    cursor: pointer;
}
.btn-destructive {
    background: var(--btn-secondary-bg) !important;
    color: #ff453a !important;
    border: 1px solid var(--btn-secondary-border) !important;
    border-radius: 999px;
}
.btn-destructive:active { transform: scale(0.97); }
.btn-destructive:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}
.btn-premium { background: linear-gradient(135deg, #F59E0B, #EF4444); color: #fff; border: none; border-radius: 12px; padding: 14px 20px; font: var(--font-button); cursor: pointer; width: 100%; margin-bottom: 10px; }

/* HOME HERO */
.home-hero { margin-bottom: 18px; padding: 0 2px; }
.home-hero-greeting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 0;
}
.home-hero-greeting-text {
    flex: 1;
    min-width: 0;
}
.home-hero-title {
    font: 700 24px/1.15 var(--font-stack);
    color: var(--text);
    line-height: 1.15;
    margin: 0 0 2px;
    letter-spacing: -0.02em;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.home-hero-sub {
    font: var(--font-body);
    color: var(--text-secondary);
    margin: 0;
}
#profile-v2-display-name {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}
#home-friends-btn {
    position: relative;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    margin: 0 -8px 0 0;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}
#home-friends-count-pill {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: #FF3B30;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    line-height: 16px;
    display: none;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    pointer-events: none;
}

/* HOME DAILY + RING */
.home-daily-card .home-daily-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.home-score-numbers { flex: 1; min-width: 0; }
.home-score-big { font: var(--font-stat-number); color: var(--text); letter-spacing: -0.03em; line-height: 1; }
.home-score-slash { font: var(--font-card-title); color: var(--text-secondary); margin-left: 2px; }
.home-score-caption { margin-top: 8px; font: var(--font-section-header); color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.08em; }
.home-score-ring-wrap { position: relative; width: 108px; height: 108px; flex-shrink: 0; }
.home-score-svg { width: 100%; height: 100%; display: block; }
.home-score-track { stroke: var(--border); stroke-width: 8; }
.home-score-progress { stroke: var(--primary); stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 0.5s ease; }
.home-score-ring-icon { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 20px; opacity: 0.85; pointer-events: none; }

/* Home steps + recovery mini rings (64×64 SVG): percentage centred in the ring */
.pg-home-mini-ring-wrap {
    position: relative;
    flex-shrink: 0;
    width: 64px;
    height: 64px;
}
.pg-home-mini-ring-wrap > svg {
    display: block;
}
.pg-home-mini-ring__pct-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.pg-home-mini-ring__label {
    margin: 0;
    padding: 0;
    line-height: 1;
    font-weight: 800;
    color: var(--text);
    text-align: center;
    font-size: 15px;
    font-variant-numeric: tabular-nums;
    /* Bold “%” sits slightly below mathematical centre; small nudge for optical balance */
    transform: translateY(-0.06em);
}
#home-recovery-pct.pg-home-mini-ring__label {
    font-size: 13px;
}

/* Home — Weekly Summary headline (workouts completed line) */
.home-weekly-summary-stat {
    margin: 0;
    padding: 0;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--text);
}

.home-stats-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.home-stat-chip { background: var(--bg); border-radius: 14px; padding: 10px 6px; text-align: center; border: 1px solid var(--border); }
.home-stat-ico { display: flex; justify-content: center; color: var(--text); margin-bottom: 4px; opacity: 0.85; }
.home-stat-lbl { display: block; font: var(--font-stat-label); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-tertiary); margin-bottom: 2px; }
.home-stat-val { display: block; font: var(--font-stat-number); color: var(--text); line-height: 1.15; word-break: break-word; }
@media (max-width: 380px) {
    .home-stats-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.home-streak-summary { margin-top: 4px; }

/* HOME WORKOUT CARD */
.home-workout-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.home-workout-title { font: var(--font-card-title); color: var(--text); letter-spacing: -0.02em; margin: 4px 0 6px; }
.home-workout-meta { font: var(--font-body); color: var(--text-secondary); }
.home-workout-badge { flex-shrink: 0; background: var(--bg); color: var(--text-tertiary); font: var(--font-stat-label); text-transform: uppercase; letter-spacing: 0.06em; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--border); }
:is(body.dark, body.dark-mode) .home-workout-badge { border-color: var(--border); }
.home-workout-visual { height: 120px; border-radius: 16px; background: linear-gradient(135deg, var(--bg) 0%, var(--border) 100%); margin-bottom: 14px; position: relative; overflow: hidden; }
.home-workout-visual::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 70% 80%, rgba(0,0,0,0.06), transparent 55%); pointer-events: none; }
:is(body.dark, body.dark-mode) .home-workout-visual::after { background: radial-gradient(circle at 70% 80%, rgba(255,255,255,0.08), transparent 55%); }
.btn-start-workout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    text-align: left;
    margin-bottom: 10px;
    background: var(--primary) !important;
    color: var(--btn-on-primary) !important;
    border-color: var(--primary) !important;
}
.btn-start-workout .btn-start-workout-label { flex: 1; }
.btn-play-circle { width: 40px; height: 40px; border-radius: 50%; background: rgba(0,0,0,0.08); display: flex; align-items: center; justify-content: center; font-size: 14px; padding-left: 3px; flex-shrink: 0; }
:is(body.dark, body.dark-mode) .btn-play-circle { background: rgba(255,255,255,0.15); }
.home-rest-outline { margin-bottom: 0; }

/* SCORE (legacy) */
.score-circle { width: 110px; height: 110px; border-radius: 50%; border: 5px solid var(--border); display: flex; flex-direction: column; align-items: center; justify-content: center; margin: 0 auto 16px; background: var(--bg); }
.score-number { color: var(--text); font: var(--font-stat-number); }
.score-label { color: var(--text-tertiary); font: var(--font-stat-label); text-transform: uppercase; letter-spacing: 0.06em; }

/* COACH */
.coach-prompt { background: var(--bg); border-left: 3px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; color: var(--text-secondary); font: var(--font-body); }
.coach-prompt.success { background: #ECFDF5; border-color: var(--success); }

/* STREAK */
.streak-bar { display: flex; gap: 4px; margin-top: 10px; justify-content: space-between; }
.streak-day { flex: 1; height: 36px; border-radius: 8px; background: var(--border); display: flex; align-items: center; justify-content: center; font: var(--font-stat-label); text-transform: uppercase; color: var(--text-tertiary); }
.streak-day.done { background: var(--primary); color: #111111; font-weight: 500; }
:is(body.dark, body.dark-mode) .streak-day.done { color: #111111; }
.streak-day.today { border: 2px solid var(--text); }

/* CATEGORY GRID */
.category-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.category-btn { background: var(--card); border: 2px solid var(--border); border-radius: 14px; padding: 18px 10px; text-align: center; cursor: pointer; color: var(--text); font: var(--font-button); transition: all 0.2s; letter-spacing: 0.02em; }
.category-btn:active { transform: scale(0.97); }
.category-btn.selected { border-color: var(--primary); background: rgba(255, 214, 10, 0.22); color: var(--text); }
:is(body.dark, body.dark-mode) .category-btn.selected { color: #ffffff; }

/* EXERCISE BLOCKS */
.exercise-block { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px; margin-bottom: 12px; }
.exercise-name { color: var(--text); font: var(--font-card-title); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.set-row { display: grid; grid-template-columns: 36px 1fr 1fr 36px; gap: 8px; align-items: center; margin-bottom: 8px; }
.set-num { color: var(--text-secondary); font: var(--font-body); text-align: center; }
.set-input { background: var(--bg); border: 1.5px solid var(--border); border-radius: 8px; color: var(--text); padding: 10px; font: var(--font-body); font-size: 16px; text-align: center; width: 100%; }
.set-input:focus { outline: none; border-color: var(--text); }
.set-input::placeholder { color: var(--text-secondary); font-weight: 400; }
.remove-set { color: var(--text); cursor: pointer; text-align: center; font-size: 20px; opacity: 0.75; min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; }
.set-headers { display: grid; grid-template-columns: 36px 1fr 1fr 36px; gap: 8px; margin-bottom: 6px; }
.set-header { color: var(--text-tertiary); font: var(--font-stat-label); text-align: center; text-transform: uppercase; letter-spacing: 0.06em; }
.pr-badge { background: var(--bar-protein); color: #fff; font: var(--font-stat-label); text-transform: uppercase; letter-spacing: 0.06em; padding: 2px 6px; border-radius: 6px; }

/* REST TIMER */
.rest-timer {
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 20px;
    padding: 14px 16px;
    text-align: center;
    display: none;
    position: fixed;
    bottom: calc(var(--nav-bottom-inset) + 16px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 1250;
    width: min(260px, calc(100% - 32px));
    box-shadow: var(--shadow-card);
}
.rest-timer-cancel {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border: 1px solid var(--btn-secondary-border);
    border-radius: 999px;
    background: var(--btn-secondary-bg);
    color: #ff453a;
    font-size: 20px;
    line-height: 1;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 0;
}
.rest-timer-count { color: var(--text); font: var(--font-stat-number); line-height: 1; }

/* WORKOUT TIMER */
.workout-timer-bar {
    background: #111111;
    border-radius: 999px;
    padding: 8px 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.2);
}
.workout-timer-label { color: rgba(255,255,255,0.75); font: var(--font-stat-label); text-transform: uppercase; letter-spacing: 0.06em; }
.workout-timer-value { color: #fff; font: var(--font-stat-number); }
#workout-timer-bar {
    position: fixed;
    top: 60px;
    right: 16px;
    left: auto;
    transform: none;
    width: auto;
    max-width: calc(100% - 32px);
    z-index: 1240;
    margin: 0;
}

#train-active { padding-bottom: calc(var(--nav-bottom-inset) + 76px); }
#save-btn {
    position: fixed;
    bottom: calc(var(--nav-bottom-inset) + 16px);
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 520px;
    z-index: 1300;
    margin: 0;
    box-shadow: var(--shadow-card);
    transition: transform 0.1s ease, opacity 0.15s ease;
}
#save-btn:active {
    transform: translateX(-50%) scale(0.97);
}
#save-btn.btn-accent-yellow {
    background: var(--primary) !important;
    color: var(--btn-on-primary) !important;
    border-color: var(--primary) !important;
}

/* MEALS */
.meal-block { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px; margin-bottom: 12px; }
.meal-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.meal-name { color: var(--text); font: var(--font-card-title); flex: 1; }
.meal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    margin-bottom: 14px;
}
.meal-action-btn {
    display: block;
    width: 100%;
    box-sizing: border-box;
    min-height: 48px;
    padding: 14px 16px;
    font: var(--font-button);
    line-height: 1.25;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: opacity 0.15s ease, transform 0.05s ease;
}
.meal-action-btn:active { opacity: 0.92; transform: scale(0.99); }
.meal-action-btn--primary {
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
    border: 1px solid var(--btn-secondary-border);
    border-radius: 999px;
}
.meal-action-btn--template {
    background: #f3e8ff;
    color: #7c3aed;
    border: 1px solid #e9d5ff;
}
:is(body.dark, body.dark-mode) .meal-action-btn--template {
    background: rgba(243, 232, 255, 0.12);
    color: #e9d5ff;
    border-color: rgba(233, 213, 255, 0.45);
}
.meal-action-btn--remove {
    background: var(--btn-secondary-bg);
    color: #ff453a;
    border: 1px solid var(--btn-secondary-border);
    border-radius: 999px;
}
.meal-totals { color: var(--text-secondary); font: var(--font-body); margin-top: 2px; }
.meals-container { width: 100%; }
.nutrition-meals-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
    margin-bottom: 12px;
}
.nutrition-meals-footer .btn,
.nutrition-meals-footer .btn-outline {
    margin-bottom: 0;
}
.meal-food-list { border-top: 1px solid var(--border); margin-top: 8px; }
.food-entry { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.food-entry-info { flex: 1; }
.food-entry-name { color: var(--text); font: var(--font-body); }
.food-entry-macros { color: var(--text-secondary); font: var(--font-body); margin-top: 2px; }
.food-entry-cals { color: var(--text); font: var(--font-stat-number); margin-right: 12px; }
.food-entry-delete { color: var(--danger); cursor: pointer; font-size: 20px; padding: 4px; min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.meal-totals-row { color: var(--text); font: var(--font-stat-number); margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--border); }

/* MACRO PILLS */
.macro-pill { display: inline-block; background: var(--bg); color: var(--text); border-radius: 6px; padding: 2px 8px; font: var(--font-stat-label); text-transform: uppercase; letter-spacing: 0.06em; margin-right: 4px; border: 1px solid var(--border); }
.macro-pill.protein { background: #FEF3C7; color: #92400E; }
.macro-pill.carbs { background: #ECFDF5; color: #065F46; }
.macro-pill.fat { background: #FEF2F2; color: #991B1B; }

/* PERSONAL BESTS */
.pb-item { background: var(--bg); border-radius: 12px; padding: 12px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; border: 1px solid var(--border); }
.pb-exercise { color: var(--text); font: var(--font-body); }
.pb-value { color: var(--text); font: var(--font-stat-number); }

/* BADGES */
.badge { display: inline-flex; align-items: center; gap: 6px; background: var(--bg); color: var(--text); border-radius: 20px; padding: 6px 12px; font: var(--font-body); margin: 4px; opacity: 0.45; border: 1px solid var(--border); }
.badge.earned { background: var(--primary); color: var(--btn-on-primary); border-color: var(--primary); opacity: 1; }

/* TAGS */
.tag { background: var(--bg); color: var(--text); border-radius: 8px; padding: 6px 10px; font: var(--font-body); margin-right: 6px; margin-bottom: 6px; display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; cursor: pointer; border: 1.5px solid var(--border); }
.tag.selected { border-color: var(--primary); background: rgba(255, 214, 10, 0.22); color: var(--text); }
:is(body.dark, body.dark-mode) .tag.selected { color: #ffffff; }

/* INPUTS */
select option { background: #ffffff; color: #111111; }
:is(body.dark, body.dark-mode) select option { background: #1c1c1e; color: #ffffff; }
select, input[type="text"], input[type="number"], input[type="date"], textarea { background: var(--bg); border: 1.5px solid var(--border); border-radius: 10px; color: var(--text); padding: 12px; font: var(--font-body); font-size: 16px; width: 100%; margin-bottom: 10px; font-family: inherit; }
select:focus, input:focus { outline: none; border-color: var(--text); }
label { color: var(--text-tertiary); font: var(--font-section-header); text-transform: uppercase; letter-spacing: 0.08em; display: block; margin-bottom: 4px; }

/* NAV — fixed iOS-style tab bar */
.nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    background: #FFFFFF;
    border-top: 1px solid #E5E5EA;
    padding-top: 10px;
    padding-bottom: 0;
    box-sizing: border-box;
    min-height: calc(var(--nav-bar-height) + var(--nav-safe-bottom));
    box-shadow: none;
    overflow: visible;
}
.nav-inner {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    width: 100%;
    max-width: 560px;
    padding: 2px 6px 3px;
    padding-bottom: var(--nav-safe-bottom);
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
.nav-item {
    color: var(--text-tertiary);
    font: var(--font-nav-label);
    text-align: center;
    cursor: pointer;
    flex: 1 1 0;
    min-width: 44px;
    padding: 0 2px;
    transition: transform 0.1s ease, color 0.2s;
    -webkit-tap-highlight-color: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    align-self: center;
    box-sizing: border-box;
}
.nav-item:not(.nav-plus-fab) {
    height: 48px;
    min-height: 48px;
    max-height: 48px;
}
.nav-item-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    min-width: 48px;
    height: 32px;
    min-height: 32px;
    max-height: 32px;
    padding: 0 10px;
    box-sizing: border-box;
    border-radius: 16px;
    margin: 0 auto 2px;
    flex: 0 0 auto;
    background: transparent;
}
.nav-item:not(.nav-plus-fab) > span:not(.nav-item-icon-wrap) {
    display: block;
    line-height: 1.25;
    min-height: 14px;
    height: 14px;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nav-item.active { color: var(--text); }
.nav-item.active .nav-item-icon-wrap { background: rgba(0, 0, 0, 0.06); }
:is(body.dark, body.dark-mode) .nav-item.active .nav-item-icon-wrap { background: rgba(255, 255, 255, 0.12); }
.nav-item svg { display: block; margin: 0; flex-shrink: 0; }
.nav-item:not(.nav-plus-fab) .nav-item-icon-wrap svg {
    width: 22px;
    height: 22px;
}
.nav-item:active { transform: scale(0.97); }
#nav-profile.nav-plus-fab:active { transform: translateY(-10px) scale(0.97); }
:is(body.dark, body.dark-mode) .nav {
    background: var(--bg);
    border-top-color: #2C2C2E;
}

/* Edit Meal, Create Exercise, and Create Routine share these header actions. */
.pg-sheet-header-cancel {
    background: none;
    border: none;
    font-size: 15px;
    font-weight: 700;
    color: var(--label-secondary);
    cursor: pointer;
    padding: 8px 4px;
    -webkit-tap-highlight-color: transparent;
}
.pg-sheet-header-save {
    background: #FFD60A;
    border: none;
    border-radius: 10px;
    padding: 9px 20px;
    font-size: 14px;
    font-weight: 700;
    color: #111;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* ══ FULL-SCREEN MODALS — iOS safe areas (status bar + home indicator) ══ */
/* Top toolbar rows: padding on the element that contains Cancel/Save/Close/Done — not the shell. */
.pg-modal-safe-header,
.pg-modal-action-bar,
#food-modal > .pg-modal-action-bar,
#workout-template-editor > div > .pg-modal-action-bar,
#edit-meal-editor > div > .pg-modal-action-bar,
#exercise-picker-modal > div > .pg-modal-action-bar,
#create-routine-modal .pg-create-routine-modal__header > .pg-modal-action-bar,
#workout-session-modal.workout-session-modal-full .workout-session-modal-header > .pg-modal-action-bar,
#save-workout-modal > .pg-modal-action-bar,
#program-select-modal > div > .pg-modal-action-bar,
#workout-detail-modal > div > .pg-modal-action-bar,
#exercise-detail-modal > .pg-modal-action-bar,
#workout-completion-overlay .workout-completion-header {
    padding-top: calc(env(safe-area-inset-top, 0px) + 12px) !important;
    box-sizing: border-box;
}
/* Profile sub-menus + Privacy/Terms: match Train/Nutrition/Progress (2px below notch). */
#profile-v2-sheet-toolbar,
.pg-legal-doc-header {
    padding-top: calc(env(safe-area-inset-top, 0px) + 2px) !important;
    box-sizing: border-box;
}
#profile-v2-sheet-host {
    overflow-x: hidden !important;
    overflow-y: auto;
    overscroll-behavior-x: none;
    touch-action: pan-y;
    max-width: 100vw;
    background: var(--bg);
}
#profile-v2-sheet-shell {
    width: 100%;
    max-width: 480px;
    min-width: 0;
    box-sizing: border-box;
    overflow-x: hidden;
    min-height: 100%;
    min-height: 100dvh;
    /* Toolbar owns notch + 2px (match Train). Do not stack another 12px here. */
    padding-top: 0 !important;
    padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
}
#profile-v2-sheet-body {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow-x: hidden;
}
#profile-v2-sheet-body input,
#profile-v2-sheet-body select,
#profile-v2-sheet-body textarea,
#profile-v2-sheet-body button {
    max-width: 100%;
}
#profile-v2-sheet-body input,
#profile-v2-sheet-body select,
#profile-v2-sheet-body textarea {
    box-sizing: border-box;
    min-width: 0;
}
#profile-v2-sheet-body input[type="date"],
#profile-v2-sheet-body #pv2-dob {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    -webkit-min-logical-width: 0;
    /* Match Name/Age: padding 12 + ~21px text ≈ 45px; contain native date chrome */
    height: 45px;
    padding: 12px;
    font-size: 15px;
    line-height: 1.25;
    border: none;
    border-radius: 12px;
    overflow: hidden;
    -webkit-appearance: none;
    appearance: none;
}
#profile-v2-sheet-body input[type="date"]::-webkit-datetime-edit,
#profile-v2-sheet-body #pv2-dob::-webkit-datetime-edit {
    padding: 0;
    margin: 0;
    line-height: 1.25;
}
#profile-v2-sheet-body input[type="date"]::-webkit-calendar-picker-indicator,
#profile-v2-sheet-body #pv2-dob::-webkit-calendar-picker-indicator {
    margin: 0;
    padding: 0;
}
.pg-modal-safe-footer,
[data-pg-modal-footer="1"] {
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-sizing: border-box;
}
.pg-modal-fullscreen {
    box-sizing: border-box !important;
    padding-bottom: env(safe-area-inset-bottom, 0px) !important;
    padding-top: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto;
    overscroll-behavior-x: none;
    touch-action: pan-y;
    max-width: 100vw;
}
.pg-modal-fullscreen--shell-pad-top {
    padding-top: 0 !important;
}
.pg-modal-fullscreen--header-child {
    padding-top: 0 !important;
}
.pg-modal-sheet-panel {
    box-sizing: border-box;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
/* Bottom sheets: keep Cancel / primary actions above Android home indicator */
#water-options-sheet > div:first-child,
#create-custom-modal > div:first-child,
#session-rest-picker-sheet > div:first-child,
#equipment-filter-sheet > div:first-child,
[id$="-sheet"] > div:first-child,
[id$="-picker-sheet"] > div:first-child {
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)) !important;
    box-sizing: border-box !important;
}
/* Centered Day Streak info card is not a bottom sheet — equal inset above the title and below Got it. */
#profile-v2-streak-info-sheet > div:first-child {
    padding: 20px 18px !important;
}
#sleep-modal > div:first-child {
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)) !important;
    box-sizing: border-box !important;
}
#create-routine-modal {
    padding-bottom: env(safe-area-inset-bottom, 0px) !important;
    box-sizing: border-box !important;
}
#food-modal {
    padding-top: 0 !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
    padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px)) !important;
    box-sizing: border-box !important;
}
#food-portion {
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)) !important;
    box-sizing: border-box !important;
}
#exercise-picker-modal #picker-add-bar {
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
    box-sizing: border-box !important;
}
#save-workout-modal {
    padding-top: 0 !important;
    padding-bottom: env(safe-area-inset-bottom, 0px) !important;
    box-sizing: border-box !important;
}
#barcode-scan-overlay {
    padding-top: 0 !important;
    padding-bottom: env(safe-area-inset-bottom, 0px) !important;
    box-sizing: border-box !important;
}
#barcode-scan-overlay #barcode-torch-btn {
    top: calc(24px + env(safe-area-inset-top, 0px) + 12px) !important;
}
#add-meal-modal > div:first-child,
#add-meal-modal .pg-add-food-sheet {
    display: flex !important;
    flex-direction: column !important;
    /* Cap to the overlay (visual viewport), never using 90vh of the layout viewport —
       that combo let the sheet overflow under the notch when the keyboard was open. */
    max-height: calc(100% - env(safe-area-inset-top, 0px)) !important;
    overflow: hidden !important;
    padding-top: 0 !important;
    /* Same as #pg-pdf-viewer-overlay: edge-to-edge shell. Do not put
       env(safe-area-inset-bottom) here — that reserved a visible gap under the card. */
    padding-bottom: 0 !important;
    box-sizing: border-box !important;
}
/* Header stays outside the scroll pane so FOOD NAME cannot scroll under the island */
#add-meal-modal > div:first-child > .pg-modal-action-bar,
#add-meal-modal .pg-add-food-sheet > .pg-modal-action-bar {
    flex-shrink: 0;
    padding-top: 8px !important;
    box-sizing: border-box;
}
/* Recents sit with the header, not in the form scroller — otherwise they scroll
   off the top when the sheet is height-capped (keyboard / short viewport). */
#add-meal-modal #food-recent-foods-wrap {
    flex-shrink: 0;
}
#add-meal-modal .pg-add-food-sheet-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    /* PDF chrome uses max(10px, env(safe-area-inset-top)) on the toolbar, not
       calc(N + inset) on the shell. Same formula on this scroller so + Add Food
       stays above the home indicator while the sheet background goes to the edge. */
    padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
}
/* Quantity: text field (not type=number) so iOS WebKit honours the same 44px box as SERVING. */
#add-meal-modal #food-quantity {
    -webkit-appearance: none;
    appearance: none;
    height: 44px;
    min-height: 44px;
    max-height: 44px;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
}
#add-meal-modal #food-quantity::-webkit-inner-spin-button,
#add-meal-modal #food-quantity::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
    height: 0;
}
#add-meal-modal #food-serving-select {
    margin-bottom: 0;
}
#add-meal-modal #food-barcode-scan-btn {
    -webkit-appearance: none;
    appearance: none;
    max-height: 44px;
}
#workout-detail-modal {
    padding-top: 0 !important;
    padding-bottom: env(safe-area-inset-bottom, 0px) !important;
    box-sizing: border-box !important;
}
#exercise-detail-modal {
    padding-top: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    touch-action: pan-y;
    overscroll-behavior: none;
}
#exercise-detail-modal.pg-modal-fullscreen {
    overflow: hidden !important;
}
#exercise-detail-modal > .pg-modal-action-bar {
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    background: var(--bg);
}
#exercise-detail-modal .exercise-detail-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
}
#exercise-detail-modal .exercise-detail-scroll img {
    position: static !important;
}
#program-select-modal {
    padding-top: 0 !important;
}

/* Active workout session — full viewport shell; scroll only inner pane (avoids iOS/visual-viewport gap + nav bleed-through). */
#workout-session-modal.workout-session-modal-full {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-height: 100dvh !important;
    box-sizing: border-box;
    z-index: 50000 !important;
    overflow: hidden !important;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    touch-action: pan-y;
    padding-bottom: env(safe-area-inset-bottom, 0px) !important;
}
#workout-session-modal.workout-session-modal-full .workout-session-modal-header {
    flex-shrink: 0;
    position: relative;
    z-index: 30;
    background: var(--bg);
    padding-top: 0;
    box-sizing: border-box;
}
#workout-session-modal.workout-session-modal-full .workout-session-modal-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    overscroll-behavior-y: contain;
}
/* Active workout logger: exercise titles follow theme text (not picker yellow). */
#workout-session-modal .session-exercise-name {
    color: var(--text) !important;
}
/* Android WebView often fails to clip children to border-radius without a compositing hint. */
#workout-session-modal .session-exercise-card {
    border-radius: 20px;
    overflow: hidden;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}
#workout-session-modal .session-exercise-card .session-set-row,
#workout-session-modal .session-exercise-card .session-target-row {
    min-width: 0;
    max-width: 100%;
}
/* Set-row actions: centre check / note / delete in their tracks; keep box-sizing consistent. */
#workout-session-modal .session-set-row > .session-set-complete-btn,
#workout-session-modal .session-set-row > .session-set-note-btn,
#workout-session-modal .session-set-row > .session-set-delete-btn {
    justify-self: center;
    align-self: center;
    box-sizing: border-box;
    padding: 0;
    margin: 0;
}
#workout-session-modal .session-exercise-gif-wrap,
#workout-session-modal .session-exercise-gif-wrap img {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}
#workout-session-modal .session-exercise-gif-fallback {
    display: flex !important;
    align-items: center;
    justify-content: center;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Minimized active workout: must beat .workout-session-modal-full z-index/display so the shell does not block the app or mini bar. */
#workout-session-modal.workout-session-modal-full.workout-session-modal-minimized {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Workout Complete overlay — same as #pg-pdf-viewer-overlay: edge-to-edge
   shell. Do not put env(safe-area-inset-bottom) here — that reserved a
   visible gap and shortened the flex scrollport so Back to Home clipped. */
#workout-completion-overlay {
  overflow: hidden;
  padding-top: 0;
  padding-bottom: 0;
  box-sizing: border-box;
}
#workout-completion-overlay .workout-completion-header {
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
  padding-left: max(24px, env(safe-area-inset-left, 0px));
  padding-right: max(24px, env(safe-area-inset-right, 0px));
}
#workout-completion-overlay .workout-completion-scroller {
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #C7C7CC transparent;
  /* Profile sheet formula: constant + inset so Back to Home clears the
     home indicator even when env() is 0. Overlay shell stays edge-to-edge. */
  padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
}
#workout-completion-overlay .workout-completion-scroller::-webkit-scrollbar {
  width: 4px;
}
#workout-completion-overlay .workout-completion-scroller::-webkit-scrollbar-track {
  background: transparent;
}
#workout-completion-overlay .workout-completion-scroller::-webkit-scrollbar-thumb {
  background: #C7C7CC;
  border-radius: 4px;
}
#workout-completion-overlay .workout-completion-scroll-inner {
  width: 100%;
  max-width: none;
  min-height: 100%;
  margin: 0;
  padding: 0 max(24px, env(safe-area-inset-right, 0px)) 0 max(24px, env(safe-area-inset-left, 0px));
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}
#workout-completion-overlay .completion-btn-home {
  min-width: 0;
  min-height: 0;
  position: relative;
  align-self: center;
  overflow: visible;
  appearance: none;
  -webkit-appearance: none;
}
/* Hang the chevron left of the label so the underlined text is the centered box. */
#workout-completion-overlay .completion-btn-home svg {
  position: absolute;
  right: calc(100% + 4px);
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}
#workout-completion-overlay .completion-photo-chooser-cancel,
#workout-completion-overlay .completion-photo-remove,
#pg-completion-share-customize .completion-photo-chooser-cancel,
#pg-completion-share-customize .completion-photo-remove {
  min-height: 0;
}

#pg-completion-share-customize .pg-share-customize-scroller {
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
#pg-completion-share-customize .pg-share-customize-inner {
  width: 100%;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
}
#pg-completion-share-customize .pg-share-customize-share-wrap {
  width: 100%;
  max-width: 400px;
  box-sizing: border-box;
}
#pg-completion-share-customize.is-share-debug .pg-share-customize-share-wrap {
  outline: 3px solid #FF2D55;
  outline-offset: 2px;
}
#pg-completion-share-customize .pg-share-customize-share {
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(255, 214, 10, 0.45);
  min-height: 52px;
  white-space: normal;
}
#pg-completion-share-customize .pg-share-btn-spinner,
#workout-completion-overlay .completion-btn-share .pg-share-btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: pgPullRefreshSpin 0.8s linear infinite;
  flex-shrink: 0;
}
#pg-completion-share-customize .pg-share-live-status {
  display: none;
  margin: -2px 0 10px;
  min-height: 1.25em;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  color: var(--text, #111);
}
#pg-completion-share-customize.is-share-debug .pg-share-live-status {
  display: block;
}
#workout-completion-overlay .completion-btn-share {
  touch-action: manipulation;
}
#pg-completion-share-customize .pg-share-customize-share:active {
  background: #3A3A3C !important;
  opacity: 1 !important;
}
#pg-completion-share-customize .pg-share-tap-probe,
#pg-completion-share-customize .pg-share-overlay-probe,
#pg-completion-share-customize .pg-share-compositor-dt {
  display: none;
}
#pg-completion-share-customize.is-share-debug .pg-share-tap-probe,
#pg-completion-share-customize.is-share-debug .pg-share-compositor-dt {
  display: block;
  margin: -4px 0 10px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  color: #B45309;
  text-align: center;
}
#pg-completion-share-customize.is-share-debug .pg-share-overlay-probe {
  display: block;
  position: absolute;
  left: 8px;
  right: 8px;
  top: calc(2px + env(safe-area-inset-top, 0px));
  margin: 0;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.25;
  color: #B45309;
  text-align: center;
  pointer-events: none;
  z-index: 2;
  word-break: break-word;
}
#pg-completion-share-customize .pg-share-preview-wrap {
  width: 100%;
  max-width: 280px;
  margin: 0 auto;
  border-radius: 16px;
  overflow: hidden;
  background: var(--card);
  box-shadow: var(--shadow-card);
  position: relative;
  transform: translateZ(0);
}
#pg-completion-share-customize .pg-share-variant-slide.is-generating .pg-share-preview-wrap {
  min-height: min(42vh, 280px);
}
#pg-completion-share-customize .pg-share-preview-placeholder {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 3;
  align-items: center;
  justify-content: center;
  background: rgba(242, 242, 247, 0.82);
  pointer-events: none;
}
body.dark #pg-completion-share-customize .pg-share-preview-placeholder,
body.dark-mode #pg-completion-share-customize .pg-share-preview-placeholder {
  background: rgba(28, 28, 30, 0.82);
}
#pg-completion-share-customize .pg-share-variant-slide.is-generating .pg-share-preview-placeholder {
  display: flex;
}
#pg-completion-share-customize .pg-share-preview-placeholder-pulse {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: #FFD60A;
  animation: pgSharePreviewSpin 0.75s linear infinite;
}
@keyframes pgSharePreviewSpin {
  to { transform: rotate(360deg); }
}
#pg-completion-share-customize .pg-share-preview-img,
#pg-completion-share-customize .pg-share-preview-canvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(42vh, 480px);
  object-fit: contain;
  background: var(--card);
  transform: translateZ(0);
}
#pg-completion-share-customize .pg-share-preview-stage {
  display: none;
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: min(48vh, 520px);
  overflow: hidden;
  touch-action: pan-x;
  background: #111;
}
#pg-completion-share-customize .pg-share-preview-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
#pg-completion-share-customize .pg-share-preview-scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(to bottom, rgba(0,0,0,0.10) 0%, rgba(0,0,0,0) 40%, rgba(0,0,0,0.20) 100%);
}
#pg-completion-share-customize .pg-share-preview-content-wrap {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  transform-origin: center center;
  will-change: transform;
  touch-action: none;
}
#pg-completion-share-customize .pg-share-preview-content {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
#pg-completion-share-customize .pg-share-preview-handle {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 2px solid #FFFFFF;
  border-radius: 50%;
  background: #FFD60A;
  box-shadow: 0 1px 4px rgba(0,0,0,0.35);
  cursor: nwse-resize;
  touch-action: none;
}
#pg-completion-share-customize .pg-share-reset-pos {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0 0 10px;
  width: 100%;
  max-width: 400px;
}
#pg-completion-share-customize.is-photo-preview .pg-share-preview-img,
#pg-completion-share-customize.is-photo-preview .pg-share-preview-canvas {
  display: none;
}
#pg-completion-share-customize.is-photo-preview .pg-share-preview-stage {
  display: block;
}
#pg-completion-share-customize.is-photo-preview .pg-share-variant-carousel {
  touch-action: pan-x;
}
#pg-completion-share-customize.is-photo-preview .pg-share-preview-wrap {
  max-width: 236px;
  background: #111;
}
#pg-completion-share-customize .pg-share-variant-carousel {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  align-self: stretch;
  width: 100%;
  max-width: 400px;
  margin: 0 0 10px;
  padding: 0 calc((100% - 236px) / 2);
  gap: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-snap-stop: always;
  scroll-padding-inline: calc((100% - 236px) / 2);
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  scrollbar-width: none;
  box-sizing: border-box;
}
#pg-completion-share-customize .pg-share-variant-carousel::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
#pg-completion-share-customize .pg-share-variant-slide {
  flex: 0 0 236px;
  width: 236px;
  max-width: 236px;
  scroll-snap-align: center;
  scroll-snap-stop: always;
}
#pg-completion-share-customize .pg-share-preview-debug,
#pg-completion-share-customize .pg-share-debug-copy-wrap {
  display: none;
}
#pg-completion-share-customize.is-share-debug .pg-share-preview-debug {
  display: block;
  margin: 6px 0 0;
  padding: 6px 8px;
  border-radius: 8px;
  background: #FEF3C7;
  color: #92400E;
  font: 10px/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-word;
  text-align: left;
}
body.dark #pg-completion-share-customize.is-share-debug .pg-share-preview-debug,
body.dark-mode #pg-completion-share-customize.is-share-debug .pg-share-preview-debug {
  background: #3F3F00;
  color: #FFD60A;
}
#pg-completion-share-customize.is-share-debug .pg-share-debug-copy-wrap {
  display: block;
  width: 100%;
  max-width: 400px;
  margin: 0 0 10px;
}
#pg-completion-share-customize .pg-share-debug-hint {
  margin: 0 0 8px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-secondary);
  text-align: left;
}
#pg-completion-share-customize .pg-share-debug-copy {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
#pg-completion-share-customize .pg-share-variant-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin: 0 0 12px;
}
#pg-completion-share-customize .pg-share-variant-dot {
  width: 8px;
  height: 8px;
  min-width: 8px;
  min-height: 8px;
  padding: 0;
  border: none;
  border-radius: 99px;
  background: var(--border);
  cursor: pointer;
}
#pg-completion-share-customize .pg-share-variant-dot.is-active {
  width: 18px;
  min-width: 18px;
  background: #FFD60A;
}
#pg-completion-share-customize .pg-share-bg-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  width: 100%;
  max-width: 400px;
  align-self: stretch;
  margin: 0 0 10px;
  padding: 0;
  box-sizing: border-box;
}
#pg-completion-share-customize .pg-share-bg-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 12px;
  padding: 10px 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-sizing: border-box;
}
#pg-completion-share-customize .pg-share-bg-chip svg {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  display: block;
}
#pg-completion-share-customize .pg-share-bg-chip.is-selected {
  border-color: #FFD60A;
  background: rgba(255, 214, 10, 0.22);
}
#pg-completion-share-customize .pg-share-bg-chip:disabled {
  opacity: 0.4;
  cursor: default;
}
#pg-completion-share-customize .completion-btn-add-photo {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  background: #FFD60A;
  color: #111111;
  border: none;
}
#pg-completion-share-customize .completion-btn-add-photo-pair {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
#pg-completion-share-customize .completion-btn-add-photo svg {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  display: block;
}
#pg-completion-share-customize .completion-btn-add-photo-label {
  flex: 0 0 auto;
}
#pg-completion-share-customize .pg-share-bg-photo-hint {
  display: none;
  margin: -4px 0 10px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
#pg-completion-share-customize.is-photo-preview .pg-share-bg-photo-hint {
  display: block;
}
#pg-completion-share-customize.is-transparent-preview .pg-share-preview-wrap {
  background-color: #e8e8ed;
  background-image:
    linear-gradient(45deg, #d4d4d8 25%, transparent 25%),
    linear-gradient(-45deg, #d4d4d8 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d4d4d8 75%),
    linear-gradient(-45deg, transparent 75%, #d4d4d8 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}
#pg-completion-share-customize.is-transparent-preview .pg-share-preview-img,
#pg-completion-share-customize.is-transparent-preview .pg-share-preview-canvas {
  background: transparent;
}

/* Personal Bests card — single-column names; visible scrollbar after ~5 lines. */
#workout-completion-overlay .workout-completion-pb-list,
.workout-completion-pb-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #C7C7CC transparent;
}
#workout-completion-overlay .workout-completion-pb-list > p,
.workout-completion-pb-list > p {
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
}
#workout-completion-overlay .workout-completion-pb-list::-webkit-scrollbar,
.workout-completion-pb-list::-webkit-scrollbar {
  width: 4px;
}
#workout-completion-overlay .workout-completion-pb-list::-webkit-scrollbar-track,
.workout-completion-pb-list::-webkit-scrollbar-track {
  background: transparent;
}
#workout-completion-overlay .workout-completion-pb-list::-webkit-scrollbar-thumb,
.workout-completion-pb-list::-webkit-scrollbar-thumb {
  background: #C7C7CC;
  border-radius: 4px;
}

/* ONBOARDING */
.onboarding { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: #111111; z-index: 99999; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px; text-align: center; overflow-y: auto; }
.onboarding h1 { color: #fff; font: var(--font-page-greeting); margin-bottom: 8px; }
.onboarding p { color: rgba(255,255,255,0.8); font: var(--font-body); margin-bottom: 24px; }
.onboarding input, .onboarding select { background: rgba(255,255,255,0.15); border: 1.5px solid rgba(255,255,255,0.3); color: #fff; border-radius: 12px; padding: 14px; font: var(--font-body); font-size: 16px; width: 100%; margin-bottom: 12px; }
.onboarding input::placeholder { color: rgba(255,255,255,0.6); }
.onboarding label { color: rgba(255,255,255,0.8); text-align: left; font: var(--font-section-header); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 4px; display: block; }
.onboarding .btn { background: #ffffff; color: #111111; font: var(--font-button); padding: 16px; border-radius: 999px; margin-top: 8px; border: none; }
.onboarding select option { background: #111111; color: #fff; }
.onboarding-step { display: none; width: 100%; max-width: 400px; }
.onboarding-step.active { display: block; }
.step-indicator { display: flex; gap: 8px; margin-bottom: 24px; justify-content: center; }
.step-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.3); }
.step-dot.active { background: #fff; }

/* LANGUAGE GRID */
.lang-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.lang-btn { background: rgba(255,255,255,0.15); border: 2px solid rgba(255,255,255,0.3); border-radius: 12px; padding: 14px; text-align: center; cursor: pointer; color: #fff; font: var(--font-button); transition: all 0.2s; }
.lang-btn.selected { background: rgba(255,255,255,0.3); border-color: #fff; }

/* PATH SELECTION */
.path-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 16px; }
.path-btn { background: rgba(255,255,255,0.15); border: 2px solid rgba(255,255,255,0.3); border-radius: 16px; padding: 20px; text-align: left; cursor: pointer; color: #fff; transition: all 0.2s; }
.path-btn:active { transform: scale(0.98); }
.path-btn.primary-path { background: rgba(255,255,255,0.25); border-color: #fff; }
.path-btn-title { font: var(--font-button); margin-bottom: 4px; }
.path-btn-sub { font: var(--font-body); opacity: 0.8; }

/* UNIT TOGGLE */
.unit-toggle { display: flex; gap: 8px; margin-bottom: 12px; }
.unit-btn { flex: 1; background: rgba(255,255,255,0.15); border: 2px solid rgba(255,255,255,0.3); border-radius: 10px; padding: 10px; min-width: 44px; min-height: 44px; text-align: center; cursor: pointer; color: #fff; font: var(--font-body); transition: all 0.2s; }
.unit-btn.selected { background: rgba(255,255,255,0.35); border-color: #fff; }

/* ROUTINES */
.routine-item { background: var(--card); border: 1.5px solid var(--border); border-radius: 14px; padding: 16px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; transition: transform 0.1s ease; }
.routine-item:active { transform: scale(0.97); }
.routine-name { color: var(--text); font: var(--font-card-title); }
.routine-meta { color: var(--text-secondary); font: var(--font-body); margin-top: 4px; }
.routine-arrow { color: var(--text); font-size: 20px; opacity: 0.45; }

/* PHASE */
.phase-history-item { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 8px; }

/* CHECK-IN */
.checkin-item { border-bottom: 1px solid var(--border); padding: 12px 0; }
.checkin-date { color: var(--text); font: var(--font-card-title); }
.checkin-detail { color: var(--label-secondary); font: var(--font-body); margin-top: 4px; }

/* SECTION TITLES */
.section-title { color: var(--text); font: var(--font-card-title); margin-bottom: 16px; margin-top: 8px; }
.section-subtitle { color: var(--text-tertiary); font: var(--font-section-header); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; margin-top: 12px; }

/* FILTER BAR */
.filter-bar { display: flex; gap: 8px; margin-bottom: 12px; overflow-x: auto; padding-bottom: 4px; }
.filter-btn { background: var(--card); border: 1.5px solid var(--border); border-radius: 20px; padding: 6px 14px; min-width: 44px; min-height: 44px; font: var(--font-stat-label); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text); opacity: 0.65; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; }
.filter-btn.active { opacity: 1; background: var(--primary); border-color: var(--primary); color: #111111; }
:is(body.dark, body.dark-mode) .filter-btn.active { color: #111111; }

/* TOGGLE */
.toggle-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.toggle-label { color: var(--text); font: var(--font-body); }
.toggle-switch { width: 44px; height: 24px; min-width: 44px; min-height: 44px; background: transparent; border-radius: 12px; cursor: pointer; position: relative; transition: background 0.2s; display: inline-flex; align-items: center; }
.toggle-switch::before { content: ""; position: absolute; left: 0; top: 50%; width: 44px; height: 24px; transform: translateY(-50%); background: var(--border); border-radius: 12px; transition: background 0.2s; }
.toggle-switch.on::before { background: var(--success); }
.toggle-knob { width: 20px; height: 20px; background: #fff; border-radius: 50%; position: absolute; top: 50%; left: 2px; transform: translateY(-50%); transition: left 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2); z-index: 1; }
.toggle-switch.on .toggle-knob { left: 22px; }

/* Profile Settings → Notifications: yellow track ON, muted grey OFF (distinct from theme success green) */
.pv2-notif-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    border-bottom: 1px solid #E5E5EA;
    box-sizing: border-box;
}
.pv2-notif-row:last-child {
    border-bottom: none;
}

body.dark .pv2-notif-row,
body.dark-mode .pv2-notif-row .pv2-notif-row {
    border-bottom-color: #3A3A3C;
}
.toggle-switch.pv2-notif-toggle {
    flex-shrink: 0;
}
.toggle-switch.pv2-notif-toggle::before {
    background: #E5E5EA;
}
.toggle-switch.pv2-notif-toggle.on::before {
    background: #FFD60A;
}

/* Profile → Language: full-color flag emoji (not button text color / dark-mode filters) */
.pv2-lang-flag {
    font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
    display: inline-block;
    vertical-align: -0.05em;
    margin-right: 10px;
    line-height: 1;
    filter: none !important;
    -webkit-filter: none !important;
    color: revert;
    -webkit-text-fill-color: initial;
}
.pv2-lang-label {
    color: inherit;
}

/* PLATES */
.plates-result { background: var(--bg); border-radius: 10px; padding: 12px; margin-top: 8px; color: var(--text); font: var(--font-body); border: 1px solid var(--border); }

/* PREMIUM */
.premium-lock { background: var(--card); border: 2px dashed var(--border); border-radius: 16px; padding: 24px; margin-bottom: 12px; text-align: center; }
.premium-lock-icon { font: var(--font-stat-number); margin-bottom: 8px; }
.premium-lock-title { color: var(--text); font: var(--font-card-title); margin-bottom: 4px; }
.premium-lock-sub { color: var(--label-secondary); font: var(--font-body); margin-bottom: 16px; }
.premium-badge { display: inline-flex; align-items: center; gap: 4px; background: linear-gradient(135deg, #F59E0B, #EF4444); color: #fff; border-radius: 20px; padding: 4px 12px; font: var(--font-section-header); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 12px; }
.premium-feature-list { text-align: left; margin-bottom: 16px; }
.premium-feature-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; color: var(--label-secondary); font: var(--font-body); }
.premium-feature-item.unlocked { color: var(--text); }
.premium-teaser { filter: blur(4px); pointer-events: none; user-select: none; opacity: 0.6; }

/* TOAST */
#toast {
    position: fixed;
    left: 50%;
    bottom: 96px;
    transform: translateX(-50%) translateY(16px);
    min-width: 220px;
    max-width: calc(100vw - 32px);
    padding: 12px 16px;
    border-radius: 12px;
    color: #fff;
    font: var(--font-body);
    text-align: center;
    z-index: 100001;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}
#toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
#toast.toast-success { background: var(--success); }
#toast.toast-error { background: var(--danger); }

/* NUTRITION HERO */
.nut-screen-title { font: var(--font-page-greeting); letter-spacing: -0.02em; margin-bottom: 12px; color: var(--text); }
.nut-date-nav { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 8px; }
.nut-nav-btn {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    border: 1px solid var(--btn-secondary-border);
    background: var(--btn-secondary-bg);
    color: var(--text);
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
    transition: transform 0.1s ease;
}
.nut-nav-btn:active { transform: scale(0.97); }
.nut-today-mid {
    border: none;
    background: transparent;
    font: var(--font-card-title);
    color: var(--text);
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 12px;
}
.nut-cal-date-sub { font: var(--font-stat-label); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text); opacity: 0.5; text-align: center; margin-bottom: 8px; }
.nut-hero-calories { font: var(--font-page-greeting); letter-spacing: -0.02em; text-align: center; margin: 8px 0 4px; color: var(--text); }
.nut-cal-remaining { text-align: center; font: var(--font-card-title); margin-bottom: 10px; }
.nut-hero-cal-bar { margin-bottom: 16px; }
.nut-macro-pills { display: flex; flex-direction: column; gap: 10px; }
.nut-macro-pill {
    border-radius: 16px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    background: var(--bg);
}
.nut-m-pill-lbl { display: block; font: var(--font-stat-label); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text); opacity: 0.55; margin-bottom: 4px; }
.nut-m-pill-val { font: var(--font-stat-number); color: var(--text); }
.nut-m-pill-track { height: 8px; border-radius: 999px; background: var(--border); margin-top: 8px; overflow: hidden; }
.nut-m-pill-fill { display: block; height: 100%; border-radius: 999px; width: 0%; transition: width 0.4s ease; }
.nut-macro-pill--protein .nut-m-pill-fill { background: #38BDF8; }
.nut-macro-pill--carbs .nut-m-pill-fill { background: #30D158; }
.nut-macro-pill--fats .nut-m-pill-fill { background: #FF9F0A; }

/* Nutrition → Daily Targets macro fills (match home macros card linear bars) */
#nutrition-tab-content .nut-daily-target-macro-fill--protein { background: #38BDF8 !important; }
#nutrition-tab-content .nut-daily-target-macro-fill--carbs { background: #30D158 !important; }
#nutrition-tab-content .nut-daily-target-macro-fill--fats { background: #FF9F0A !important; }
/* Nutrition → Water Intake card (minimal inline glass fill tracker) */
.nut-water-intake-card {
    overflow: hidden;
}
.nut-water-bottle {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 118px;
    height: 140px;
    line-height: 0;
}
.nut-water-bottle svg {
    display: block;
    width: 118px;
    height: 140px;
    overflow: visible;
}
.nut-water-bottle-fill {
    transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
}
@media (prefers-reduced-motion: reduce) {
    .nut-water-bottle-fill {
        transition: none;
    }
    .nut-water-liquid animate {
        display: none;
    }
}
.nut-water-intake-main {
    min-width: 0;
}
/* Nutrition → water tracker drops (inline SVG from `pgSvgNutritionCapaWaterDrop`) */
.nut-water-drop {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 0;
    width: 16px;
    height: 16px;
    overflow: hidden;
}
.nut-water-drop svg {
    display: block;
    max-width: 100%;
    max-height: 100%;
}

/* Circular “+” controls — shared flexbox centering (Train, Nutrition, legacy water) */
.pg-btn-circle-plus {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

.pg-btn-circle-plus svg,
.nut-water-plus svg {
    display: block;
    flex-shrink: 0;
}

/* Nutrition meal/water “+” circles stay white with a black icon in dark mode (inline color:var(--text) was white-on-white). */
:is(body.dark, body.dark-mode) #nutrition-tab-content .pg-btn-circle-plus {
    color: #111111 !important;
}

/* Train → Get Started → Exercise Library book badge: solid brand yellow in dark mode (inline rgba tint reads muted on dark cards). */
:is(body.dark, body.dark-mode) #train-workout-content button[onclick*="openExerciseLibraryBrowser"] > span[aria-hidden="true"] {
    background: #FFD60A !important;
}

/* Dark mode: solid brand yellow for soft yellow-tint badges/chips (same muted-rgba issue as Exercise Library). Light mode keeps inline tints. */
:is(body.dark, body.dark-mode) button[aria-label="Weight Plate Calculator"] {
    background: var(--primary, #FFD60A) !important;
    color: var(--btn-on-primary, #111111) !important;
}

:is(body.dark, body.dark-mode) #home-up-next > div > div:first-child {
    background: var(--primary, #FFD60A) !important;
}
:is(body.dark, body.dark-mode) #home-up-next > div > div:first-child svg {
    stroke: var(--btn-on-primary, #111111) !important;
}

:is(body.dark, body.dark-mode) button[onclick="profileV2ScrollToProTrial()"] > span:last-child {
    background: var(--primary, #FFD60A) !important;
    color: var(--btn-on-primary, #111111) !important;
}

:is(body.dark, body.dark-mode) #profile-level-badge {
    background: var(--primary, #FFD60A) !important;
    color: var(--btn-on-primary, #111111) !important;
    border-color: var(--primary, #FFD60A) !important;
}

.nut-water-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.nut-water-summary { font: var(--font-button); color: var(--text); flex: 1; min-width: 120px; }
.nut-water-dots { display: flex; gap: 6px; flex-wrap: wrap; flex: 2; justify-content: flex-end; }
.nut-water-plus {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    border: 1px solid var(--btn-secondary-border);
    background: var(--btn-secondary-bg);
    color: var(--text);
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.1s ease;
}
.nut-water-plus:active { transform: scale(0.97); }

/* TRAIN PROGRAM + WEEK */
.train-program-card { margin-bottom: 12px; }
.train-program-title { font: var(--font-page-greeting); letter-spacing: -0.01em; margin-bottom: 12px; color: var(--text); }
.train-phase-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.train-phase-tab {
    flex: 1;
    text-align: center;
    padding: 8px 6px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 999px;
    font: var(--font-stat-label);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    opacity: 0.65;
}
.train-phase-tab--active { opacity: 1; background: rgba(0, 0, 0, 0.06); border-color: var(--border); font-weight: 500; }
:is(body.dark, body.dark-mode) .train-phase-tab--active { background: rgba(255, 255, 255, 0.1); }
.train-week-progress-track { height: 8px; border-radius: 999px; background: var(--border); overflow: hidden; margin-bottom: 6px; }
.train-week-progress-fill { height: 100%; width: 0%; background: var(--primary); border-radius: 999px; transition: width 0.4s ease; }
.train-week-progress-label { font: var(--font-section-header); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text); margin-bottom: 12px; }
.train-week-list { display: flex; flex-direction: column; gap: 8px; }
.train-week-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--bg);
}
.train-week-row--done { border-color: rgba(255, 214, 10, 0.65); background: rgba(255, 214, 10, 0.12); }
.train-week-day { font: var(--font-stat-label); text-transform: uppercase; letter-spacing: 0.06em; width: 40px; color: var(--text); opacity: 0.65; }
.train-week-info { flex: 1; min-width: 0; }
.train-week-name { font: var(--font-card-title); color: var(--text); }
.train-week-meta { font: var(--font-body); color: var(--text-secondary); opacity: 0.65; margin-top: 2px; }
:is(body.dark, body.dark-mode) .train-week-meta { opacity: 1; }
.train-week-ico { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; font: var(--font-body); color: var(--text); opacity: 0.35; flex-shrink: 0; }
.train-week-row--done .train-week-ico { background: var(--primary); border-color: var(--primary); color: #111; opacity: 1; }

/* PROGRESS FILTERS + PHOTOS */
.progress-screen-heading { font: var(--font-page-greeting); margin-bottom: 12px; letter-spacing: -0.02em; color: var(--text); }
.progress-filter-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.progress-filter-btn {
    padding: 8px 14px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 999px;
    border: 1px solid var(--btn-secondary-border);
    background: var(--btn-secondary-bg);
    color: var(--text);
    font: var(--font-stat-label);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: transform 0.1s ease, background 0.15s ease;
}
.progress-filter-btn.active { background: rgba(0, 0, 0, 0.06); font-weight: 500; }
:is(body.dark, body.dark-mode) .progress-filter-btn.active { background: rgba(255, 255, 255, 0.1); }
.progress-filter-btn:active { transform: scale(0.97); }
.progress-weight-hero { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.progress-weight-big { font: var(--font-stat-number); color: var(--text); }
.progress-weight-delta { font: var(--font-card-title); color: var(--text-secondary); }
.progress-strength-ex { font: var(--font-section-header); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text); margin-bottom: 6px; }
.progress-strength-val { font: var(--font-stat-number); color: var(--text); margin-bottom: 8px; }
.progress-strength-note { font: var(--font-body); color: var(--text-secondary); opacity: 0.55; }
:is(body.dark, body.dark-mode) .progress-strength-note { opacity: 1; }
.progress-photos-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.progress-photos-head h2 { margin-bottom: 0; }
.progress-photos-seeall { font: var(--font-button); color: var(--text); opacity: 0.55; }
.progress-photos-row { display: flex; gap: 10px; }
.progress-photo-placeholder { flex: 1; aspect-ratio: 1; border-radius: 14px; background: var(--bg); border: 1px dashed var(--border); min-height: 80px; }

/* PROFILE HERO */
.profile-hero-card {
    background: #111111;
    color: #ffffff;
    border-radius: 24px;
    padding: 20px 18px 18px;
    margin-bottom: 14px;
    border: 1px solid #2c2c2e;
    box-shadow: var(--shadow-card);
}
.profile-hero-top { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.profile-hero-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #2c2c2e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
    flex-shrink: 0;
}
.profile-hero-name-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.profile-hero-name { font: var(--font-card-title); margin: 0; color: #ffffff; }
.profile-level-badge {
    background: var(--primary);
    color: #111111;
    font: var(--font-stat-label);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 4px 10px;
    border-radius: 999px;
}
.profile-hero-goal { font: var(--font-body); color: rgba(255, 255, 255, 0.75); margin-top: 4px; }
.profile-xp-wrap { margin-bottom: 14px; }
.profile-xp-track { height: 10px; border-radius: 999px; background: #2c2c2e; overflow: hidden; }
.profile-xp-fill { height: 100%; width: 0%; background: var(--primary); border-radius: 999px; transition: width 0.4s ease; }
.profile-xp-label { font: var(--font-section-header); text-transform: uppercase; letter-spacing: 0.08em; color: rgba(255, 255, 255, 0.8); margin-top: 6px; }
.profile-hero-stats { display: flex; justify-content: space-between; gap: 8px; text-align: center; }
.profile-hero-stat { flex: 1; }
.phs-num { display: block; font: var(--font-stat-number); color: #ffffff; }
.phs-lbl { font: var(--font-stat-label); text-transform: uppercase; letter-spacing: 0.06em; color: rgba(255, 255, 255, 0.65); }
/* Uppercase section header — match Progress cards (e.g. BODY STATS, LEVEL & XP): 11px / 700 / 1px / --text */
.pg-heading-achievements {
    margin: 0;
    padding: 0;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    line-height: 1.35;
    color: var(--text);
}

/* Progress tab — achievements card header: "ACHIEVEMENTS 🏆" inline left, View All right */
.pg-progress-achievements-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-width: 0;
    margin: 0 0 8px;
    box-sizing: border-box;
}
.pg-progress-achievements-title-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1;
}
.pg-progress-achievements-trophy {
    font-size: 13px;
    line-height: 1;
    flex-shrink: 0;
}

.profile-achievements-card .profile-achievements-title {
    margin-bottom: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    line-height: 1.35;
    color: #888780;
}
body.dark .profile-achievements-card .profile-achievements-title,
body.dark-mode .profile-achievements-card .profile-achievements-title {
    color: var(--text);
}
.profile-hex-row { display: flex; justify-content: space-around; gap: 12px; padding: 8px 0; }
.profile-hex {
    width: 56px;
    height: 56px;
    background: #111;
    border: 2px solid var(--primary);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}
.profile-quick-menu { padding: 0; overflow: hidden; }
.profile-menu-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 16px 18px;
    border: none;
    border-bottom: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    font: var(--font-button);
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease, transform 0.1s ease;
}
.profile-menu-row:last-child { border-bottom: none; }
.profile-menu-row:active { transform: scale(0.99); background: var(--bg); }
.profile-menu-chev { font-size: 20px; opacity: 0.45; }

/* MEALS — thumb */
.meal-thumb {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--border), var(--bg));
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.filter-bar .filter-btn { transition: transform 0.1s ease; }
.filter-bar .filter-btn:active { transform: scale(0.97); }


.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #fff;
  color: #3c4043;
  border: 1px solid #dadce0;
  font: var(--font-button);
  font-family: 'Google Sans', Roboto, sans-serif;
}

.btn-google:hover {
  background: #f8f9fa;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* Sign in with Apple — black button, white logo & label (Human Interface Guidelines) */
.btn-apple {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  background: #000000;
  color: #ffffff;
  border: 1px solid #000000;
  font: var(--font-button);
  -webkit-font-smoothing: antialiased;
}
.btn-apple:hover {
  background: #1a1a1a;
  border-color: #1a1a1a;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.btn-apple:active {
  opacity: 0.92;
}

/* ══ ONBOARDING V2 ══ */
.onboarding-v2 {
  position: fixed;
  inset: 0;
  background: #f2f2f7;
  color: #1c1c1e;
  color-scheme: light;
  z-index: 99999;
  overflow: hidden;
  /* JS sets display:flex when showing onboarding; default row breaks screen layout */
  flex-direction: column;
  align-items: stretch;
}
.onboarding-v2 > .ob2-screen {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.onboarding-v2.ob2-tour-light {
  background: #f2f2f7;
}
.onboarding-v2.ob2-tour-light .ob2-progress-bar {
  background: rgba(0, 0, 0, 0.08);
}
.onboarding-v2.ob2-tour-light .ob2-progress-fill {
  background: #ffd60a;
}
.onboarding-v2.ob2-tour-light .ob2-screen {
  color: #111;
}
.onboarding-v2.ob2-tour-light .ob2-back {
  color: rgba(0, 0, 0, 0.55);
}
.onboarding-v2.ob2-tour-light .ob2-title {
  color: #111;
}
.onboarding-v2.ob2-tour-light .ob2-sub {
  color: rgba(0, 0, 0, 0.6);
}
/* Theme picker live preview (tour slide 0 only — toggled from JS) */
.onboarding-v2.ob2-theme-preview-dark {
  background: #000000;
  color: #f2f2f7;
  color-scheme: dark;
}
.onboarding-v2.ob2-theme-preview-dark .ob2-screen {
  color: #f2f2f7;
}
.ob2-tour-card {
  will-change: transform;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* Theme screen (ob2-s8): full-viewport width — no outer onboarding screen padding */
#ob2-s8.ob2-screen {
  padding: 0;
  margin: 0;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  overflow: hidden;
}
#ob2-s8 .ob2-learn-fullbleed {
  width: 100%;
  box-sizing: border-box;
}
#ob2-s8 .ob2-learn-column {
  padding-top: env(safe-area-inset-top, 0px);
  box-sizing: border-box;
}
#ob2-s8 .ob2-learn-column > div:last-child {
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important;
  padding-left: max(24px, env(safe-area-inset-left, 0px)) !important;
  padding-right: max(24px, env(safe-area-inset-right, 0px)) !important;
}
.ob2-progress-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: #e5e5ea;
  z-index: 100000;
}
.ob2-progress-fill {
  height: 100%;
  background: #FFD60A;
  border-radius: 0 2px 2px 0;
  transition: width 0.4s ease;
}
.ob2-screen {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: 60px 24px calc(40px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  color: #1c1c1e;
}
/* Welcome: horizontal padding lives inside the white column (match tour stripe) */
#ob2-s1.ob2-screen,
#ob2-s7.ob2-screen {
  padding-left: 0;
  padding-right: 0;
}
.ob2-screen.active { display: block; }

/* Pre–theme screens: same centred max-width strip as rest of app (480px); theme (ob2-s8) unchanged */
.onboarding-v2 .ob2-screen:not(#ob2-s8).active {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.onboarding-v2 .ob2-screen:not(#ob2-s8).active > * {
  width: 100%;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

/* Welcome + summary: full #F2F2F7 width, centred 480px white column */
.onboarding-v2 #ob2-s1.ob2-screen.active > .ob2-pre-tour-shell,
.onboarding-v2 #ob2-s7.ob2-screen.active > .ob2-pre-tour-shell {
  width: 100%;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #f2f2f7;
  box-sizing: border-box;
}
.onboarding-v2 #ob2-s1.ob2-screen.active .ob2-pre-tour-column,
.onboarding-v2 #ob2-s7.ob2-screen.active .ob2-pre-tour-column {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: #ffffff;
  box-sizing: border-box;
  flex-shrink: 0;
}
.ob2-back {
  background: none;
  border: none;
  color: #8e8e93;
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  margin-bottom: 20px;
  display: block;
}
.ob2-title {
  font: var(--font-page-greeting);
  color: #1c1c1e;
  margin-bottom: 8px;
  line-height: 1.2;
}
.ob2-sub {
  font: var(--font-body);
  color: #8e8e93;
  margin-bottom: 28px;
}
.ob2-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 28px;
}
.ob2-option {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #ffffff;
  border: 2px solid #e5e5ea;
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.ob2-option.selected,
.ob2-option:active {
  border-color: #ffd60a;
  background: rgba(255, 214, 10, 0.22);
}
.ob2-option-icon { font-size: 28px; flex-shrink: 0; }
.ob2-option-title { font: var(--font-card-title); color: #1c1c1e; margin-bottom: 2px; }
.ob2-option-sub { font: var(--font-body); color: #8e8e93; }
.ob2-option-check {
  margin-left: auto;
  font-size: 16px;
  color: #1c1c1e;
  font-weight: 700;
  opacity: 0;
  flex-shrink: 0;
}
.ob2-option.selected .ob2-option-check { opacity: 1; }
.ob2-days-btn {
  border: 2px solid #e5e5ea;
  border-radius: 16px;
  padding: 20px 10px;
  text-align: center;
  cursor: pointer;
  background: #ffffff;
  transition: border-color 0.2s, background 0.2s;
}
.ob2-days-btn.selected {
  border-color: #ffd60a;
  background: rgba(255, 214, 10, 0.22);
}
.ob2-days-btn > div:first-child {
  font-size: 24px;
  font-weight: 800;
  color: #1c1c1e;
}
.ob2-days-btn > div:last-child {
  font-size: 11px;
  color: #8e8e93;
}
.onboarding-v2.ob2-theme-preview-dark .ob2-back,
.onboarding-v2.ob2-theme-preview-dark .ob2-sub,
.onboarding-v2.ob2-theme-preview-dark .ob2-option-sub,
.onboarding-v2.ob2-theme-preview-dark .ob2-days-btn > div:last-child {
  color: rgba(255, 255, 255, 0.6);
}
.ob2-cta {
  width: 100%;
  background: #ffd60a;
  color: #111;
  border: none;
  border-radius: 16px;
  padding: 18px;
  font: var(--font-button);
  font-weight: 800;
  cursor: pointer;
  margin-top: 8px;
  flex-shrink: 0;
}
.ob2-cta:active { transform: scale(0.98); }

.ob2-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ob2-pill {
  flex: 1;
  min-width: 26%;
  padding: 10px 8px;
  border-radius: 12px;
  border: 2px solid #e5e5ea;
  background: #ffffff;
  color: #1c1c1e;
  font: var(--font-body);
  cursor: pointer;
  text-align: center;
  box-sizing: border-box;
}
.ob2-pill.selected {
  border-color: #ffd60a;
  background: rgba(255, 214, 10, 0.22);
  color: #1c1c1e;
  font-weight: 700;
}
.onboarding-v2 input::placeholder {
  color: #c5c5c7;
}
.ob2-wheel-select {
  flex: 1;
  min-width: 0;
  max-height: 132px;
  font: var(--font-body);
  font-size: 16px;
  color: #1c1c1e;
  border-radius: 12px;
  padding: 6px 4px;
  background: #ffffff;
  border: 1px solid #e5e5ea;
  box-sizing: border-box;
}

/* ══ SLEEP MODAL ══ */
#sleep-modal {
  position: fixed;
  inset: 0;
  z-index: 50000;
  background: rgba(0,0,0,0.6);
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.sleep-quick-btn {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 8px 14px;
  font: var(--font-button);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.1s;
}
.sleep-quick-btn:active { transform: scale(0.97); }

/* Progress tab — achievements strip: full-bleed to card edges, no scrollbar.
   Negative margins cancel the card’s 16px horizontal padding so circles can
   scroll to the rounded card edge. Left padding keeps the first circle aligned
   with the header. End cap is a real flex item (32px so the last medal sits
   past the 28px right-edge fade). ::after / padding-right do not extend
   scrollWidth in overflow flex containers. */
#progress-dash-achievements-card {
  overflow-x: hidden;
}
/* Breakout wrapper. Right-edge fade overlay uses var(--card) so it still
   paints when CSS mask cannot reach a composited overflow:auto scroll layer
   (Chromium / WKWebView). Left edge stays unmasked — at rest the first
   medal sits in the 16px gutter, fully opaque. */
.progress-dash-achievements-strip-clip {
  position: relative;
  isolation: isolate;
  z-index: 0;
  width: calc(100% + 32px);
  max-width: none;
  min-width: 0;
  margin-left: -16px;
  margin-right: -16px;
  box-sizing: border-box;
}
.progress-dash-achievements-strip-clip::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 28px;
  pointer-events: none;
  z-index: 2;
  /* Same RGB as the opaque stop so WK does not interpolate through gray. */
  background: linear-gradient(to right, rgba(255,255,255,0), var(--card));
}
body.dark .progress-dash-achievements-strip-clip::after,
body.dark-mode .progress-dash-achievements-strip-clip::after {
  background: linear-gradient(to right, rgba(44,44,46,0), var(--card));
}
#progress-dash-achievements-strip,
.progress-dash-achievements-strip {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  overscroll-behavior-x: none;
  width: 100%;
  max-width: none;
  min-width: 0;
  margin: 0;
  padding: 6px 0 8px 16px;
  box-sizing: border-box;
  scrollbar-width: none;
  -ms-overflow-style: none;
  /* Mask on the scroller + stacking context. Parent masks do not apply to
     overflow scroll compositor layers. translateZ(0) is the Chromium
     workaround so -webkit-mask-image actually fades the medals. */
  position: relative;
  z-index: 0;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  -webkit-mask-image: linear-gradient(to left, rgba(0,0,0,0) 0, #000 28px, #000 100%);
  mask-image: linear-gradient(to left, rgba(0,0,0,0) 0, #000 28px, #000 100%);
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}
#progress-dash-achievements-strip > .progress-dash-achievements-endcap,
.progress-dash-achievements-strip > .progress-dash-achievements-endcap {
  /* 32px so the last medal sits past the 28px fade when fully scrolled right */
  flex: 0 0 32px;
  width: 32px;
  min-width: 32px;
  height: 1px;
  pointer-events: none;
  /* cancel the 8px row gap so end inset is a clean 32px */
  margin-left: -8px;
}
#progress-dash-achievements-strip::-webkit-scrollbar,
.progress-dash-achievements-strip::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
#progress-dash-achievements-strip > div,
.progress-dash-achievements-strip > div {
  flex: 0 0 auto;
}
#progress-dash-achievements-strip button,
.progress-dash-achievements-strip button {
  touch-action: pan-x pan-y;
}

/* Progress Body Stats — goal pill + change-goal link (override global 44px button touch target) */
#progress-dash-weight-goal-tag .progress-dash-weight-goal-change-btn {
  margin-top: 4px !important;
  margin-bottom: 0 !important;
  padding: 0 !important;
  min-height: auto !important;
  min-width: auto !important;
  height: auto !important;
  width: auto !important;
  display: inline-block !important;
  line-height: 1.2 !important;
}

/* Profile v2 — Getting Started numbered onboarding list */
.pg-gs-sheet {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pg-gs-intro {
  margin: 0 0 4px;
  padding: 0 2px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}
.pg-gs-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-radius: 16px;
  padding: 12px 12px 12px 10px;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.pg-gs-step-badge {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #FFD60A;
  color: #111;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pg-gs-step-num {
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
}
.pg-gs-step-copy {
  flex: 1;
  min-width: 0;
  padding-top: 1px;
}
.pg-gs-step-title {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.pg-gs-step-title-icon {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
.pg-gs-step-icon {
  display: block;
}
.pg-gs-step-body {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
}

/* Profile v2 — App Updates list: ~4 entries visible; rest scrolls inside the card */
.profile-v2-updates-scroll {
  max-height: 280px;
  overflow-y: scroll;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) var(--bg);
  padding-right: 4px;
}
.profile-v2-updates-scroll::-webkit-scrollbar {
  width: 10px;
}
.profile-v2-updates-scroll::-webkit-scrollbar-track {
  background: var(--bg);
  border-radius: 999px;
}
.profile-v2-updates-scroll::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 999px;
  border: 2px solid var(--bg);
}

/* Progress achievement hex — Tabler webfont reads lighter with small size + low weight */
.pg-ach-ti-glyph {
    font-weight: 300;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Progress achievements — View All is header-only; must not stack over the hex strip */
#progress-dash-achievements-see-all.progress-dash-achievements-view-all-btn,
button.progress-dash-achievements-view-all-btn {
  flex-shrink: 0;
  margin: 0;
  padding: 2px 0 2px 8px;
  min-width: 44px;
  min-height: 44px;
  border: none;
  background: none !important;
  box-shadow: none !important;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  color: var(--label-secondary);
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.2;
  position: static;
  z-index: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  appearance: none;
}

/* ══ HOME V2 SCORE CARD ══ */
.home-score-card {
  background: var(--card);
  border-radius: 22px;
  padding: 18px;
  margin-bottom: 10px;
}

/* Explicit in-app light preference (body.theme-light) */
body.theme-light {
  --bg: #f2f2f7;
  --card: #ffffff;
  --border: #e5e5ea;
  --text: #000000;
  --text-secondary: #5f5e5a;
  --text-tertiary: #888780;
  --label-secondary: var(--text-secondary);
  --placeholder-muted: var(--text-tertiary);
  --primary: #ffd60a;
  --primary-light: #fff9e0;
  --btn-on-primary: #111111;
  --btn-secondary-bg: #ffffff;
  --btn-secondary-text: #000000;
  --btn-secondary-border: #e5e5ea;
  --nav-pill-bg: rgba(255, 255, 255, 0.78);
  --nav-pill-border: rgba(0, 0, 0, 0.06);
  --shadow-card: 0 2px 16px rgba(0, 0, 0, 0.06);
}


/* Profile V2 (div rows): preference label matches button-row label typography */
.profile-v2-pref-label {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.35;
  color: #000000;
}

:is(body.dark, body.dark-mode) .profile-v2-pref-label {
  color: #ffffff;
}

/* Profile V2 → gender select matches grey input fields on white card */
select.pv2-profile-gender-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 12px 40px 12px 14px;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.3;
  color: #111111;
  background-color: #f2f2f7;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23111111' d='M1.4 0L6 4.6 10.6 0 12 1.4l-6 6-6-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px 8px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

select.pv2-profile-gender-select:focus {
  outline: 2px solid rgba(0, 0, 0, 0.12);
  outline-offset: 1px;
}

select.pv2-profile-gender-select::-ms-expand {
  display: none;
}

body.dark select.pv2-profile-gender-select,
body.dark-mode select.pv2-profile-gender-select select.pv2-profile-gender-select,
body.dark select.pv2-profile-select,
body.dark-mode select.pv2-profile-select select.pv2-profile-select {
  color: #ffffff;
  background-color: #2C2C2E;
  border: 1.5px solid #3A3A3C;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23ffffff' d='M1.4 0L6 4.6 10.6 0 12 1.4l-6 6-6-6z'/%3E%3C/svg%3E");
}

body.dark select.pv2-profile-gender-select option,
body.dark-mode select.pv2-profile-gender-select option select.pv2-profile-gender-select option,
body.dark select.pv2-profile-select option,
body.dark-mode select.pv2-profile-select option select.pv2-profile-select option {
  background: #2C2C2E;
  color: #ffffff;
}

/* Profile → Nutrition targets (TDEE / macros) */
.pg-nutrition-targets-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 14px 14px;
  margin-bottom: 12px;
  box-sizing: border-box;
}

.pg-nutrition-targets-card__title {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--label-secondary);
  text-transform: uppercase;
}

.pg-nut-target-row {
  width: 100%;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 0;
  border: none;
  border-top: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

.pg-nutrition-targets-card .pg-nut-target-row:first-of-type {
  border-top: none;
  padding-top: 2px;
}

.pg-nut-target-row__label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  min-width: 0;
}

.pg-nut-target-row__value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.pg-nut-target-row__value--muted {
  font-size: 14px;
  font-weight: 600;
  color: var(--label-secondary);
}

.pg-nut-target-row__unit {
  font-size: 12px;
  font-weight: 600;
  color: var(--label-secondary);
  flex-shrink: 0;
}

.pg-nut-target-row__unit--muted {
  color: var(--label-secondary);
  opacity: 0.9;
}

.pg-nut-target-row--tdee {
  padding-top: 8px;
  padding-bottom: 4px;
}

.pg-nut-target-cal-hint {
  margin: -4px 0 6px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--label-secondary);
  font-weight: 500;
}

.pg-nut-inline-editor {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg);
  box-sizing: border-box;
}

/* Nutrition tab → Your Targets quick-reference card */
.pg-nut-targets-quickref {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
}

/* Text link — do not inherit global button 44×44 tap target (was centering label too low). */
.pg-nut-targets-quickref-link {
  min-width: 0 !important;
  min-height: 0 !important;
  height: auto;
  line-height: 1.35;
}

.pg-nut-targets-quickref-link:hover,
.pg-nut-targets-quickref-link:active {
  text-decoration: underline;
  text-underline-offset: 2px;
}

:is(body.dark, body.dark-mode) .pg-nut-targets-quickref {
  background: var(--card);
  border-color: var(--border);
  color: var(--text);
}

/* Train → Edit / New Routine modal: scrollable day list */
.pg-create-routine-modal {
  -webkit-overflow-scrolling: touch;
}

.pg-create-routine-modal__scroll {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.pg-nut-target-row--static {
  cursor: default;
  pointer-events: none;
}

/* Profile sheet → Units toggles (match Progress 7D/30D pill contrast) */
.pv2-unit-toggle {
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}

.pv2-unit-toggle:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}

#pg-offline-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg, #F2F2F7);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.pg-offline-card {
  background: #FFFFFF;
  border-radius: 24px;
  padding: 40px 32px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.08);
}

.pg-offline-logo {
  width: 100px;
  height: 100px;
  object-fit: contain;
  border-radius: 16px;
  margin-bottom: 24px;
}

.pg-offline-logo-fallback {
  background: #FFD60A;
  flex-shrink: 0;
  margin-left: auto;
  margin-right: auto;
}

.pg-offline-title {
  font-size: 24px;
  font-weight: 800;
  color: #1C1C1E;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}

.pg-offline-msg {
  font-size: 15px;
  color: #6B6B6B;
  line-height: 1.6;
  margin-bottom: 32px;
}

.pg-offline-btn {
  background: #FFD60A;
  color: #000000;
  border: none;
  border-radius: 50px;
  padding: 16px 40px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  width: 100%;
  transition: opacity 0.2s;
}

.pg-offline-btn:active { opacity: 0.8; }