/* Fresh lime UI inspired by the promo palette. */
@font-face {
    font-family: "SF Pro Text";
    src: url("fonts/SFProText-Light.ttf") format("truetype");
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "SF Pro Text";
    src: url("fonts/SFProText-LightItalic.ttf") format("truetype");
    font-weight: 300;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: "SF Pro Text";
    src: url("fonts/SFProText-Regular.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "SF Pro Text";
    src: url("fonts/SFProText-RegularItalic.ttf") format("truetype");
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: "SF Pro Text";
    src: url("fonts/SFProText-Medium.ttf") format("truetype");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "SF Pro Text";
    src: url("fonts/SFProText-MediumItalic.ttf") format("truetype");
    font-weight: 500;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: "SF Pro Text";
    src: url("fonts/SFProText-Semibold.ttf") format("truetype");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "SF Pro Text";
    src: url("fonts/SFProText-SemiboldItalic.ttf") format("truetype");
    font-weight: 600;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: "SF Pro Text";
    src: url("fonts/SFProText-Bold.ttf") format("truetype");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "SF Pro Text";
    src: url("fonts/SFProText-BoldItalic.ttf") format("truetype");
    font-weight: 700;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: "SF Pro Text";
    src: url("fonts/SFProText-Heavy.ttf") format("truetype");
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "SF Pro Text";
    src: url("fonts/SFProText-HeavyItalic.ttf") format("truetype");
    font-weight: 800;
    font-style: italic;
    font-display: swap;
}

:root {
    --bg: #eff8d8;
    --bg-elev: rgba(255, 255, 247, 0.84);
    --card: #fffffb;
    --card2: #f4facf;
    --text: #11120f;
    --muted: rgba(17, 18, 15, 0.66);
    --muted2: rgba(17, 18, 15, 0.48);
    --border: rgba(17, 18, 15, 0.1);
    --divider: rgba(17, 18, 15, 0.09);
    --shadow: 0 18px 44px rgba(47, 76, 16, 0.16);
    --shadow2: 0 8px 22px rgba(47, 76, 16, 0.1);

    --accent: #a9f10f;
    --accent-base: #a9f10f;
    --accent-strong: #28a400;
    --ink: #11120f;
    --ink-soft: #20231b;
    --purple: #7a2cff;
    --success: #35c80f;
    --warning: #ffd84d;
    --info: #26b7ca;
    --danger: #f04438;
    --spinner-track: rgba(17, 18, 15, 0.14);
    --spinner-head: var(--ink);

    --bg-pattern-dot: rgba(42, 115, 0, 0.1);
    --bg-pattern-line: rgba(42, 115, 0, 0.045);
    --bg-glow-1: rgba(189, 255, 40, 0.56);
    --bg-glow-2: rgba(255, 255, 255, 0.78);

    --radius: 14px;
    --radius2: 18px;

    --container: 420px;

    --safe-top: env(safe-area-inset-top);
    --safe-bot: env(safe-area-inset-bottom);

    color-scheme: light;
}

/* Manual theme override */
:root[data-theme="dark"] {
    --bg: #0f130d;
    --bg-elev: rgba(24, 29, 20, 0.86);
    --card: #171c14;
    --card2: #202916;
    --text: #f5f8ed;
    --muted: rgba(245, 248, 237, 0.66);
    --muted2: rgba(245, 248, 237, 0.48);
    --border: rgba(245, 248, 237, 0.12);
    --divider: rgba(245, 248, 237, 0.1);
    --shadow: 0 18px 44px rgba(0, 0, 0, 0.38);
    --shadow2: 0 8px 22px rgba(0, 0, 0, 0.28);

    --accent: #b7fb28;
    --accent-base: #b7fb28;
    --accent-strong: #8fe100;
    --ink: #090b08;
    --ink-soft: #11150f;
    --purple: #a17cff;
    --success: #59db38;
    --warning: #ffe066;
    --info: #52d6e2;
    --danger: #ff6b5f;
    --spinner-track: rgba(245, 248, 237, 0.18);
    --spinner-head: var(--accent);

    --bg-pattern-dot: rgba(183, 251, 40, 0.08);
    --bg-pattern-line: rgba(183, 251, 40, 0.035);
    --bg-glow-1: rgba(129, 209, 0, 0.2);
    --bg-glow-2: rgba(255, 255, 255, 0.04);

    color-scheme: dark;
}

:root[data-theme="light"] {
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0f130d;
        --bg-elev: rgba(24, 29, 20, 0.86);
        --card: #171c14;
        --card2: #202916;
        --text: #f5f8ed;
        --muted: rgba(245, 248, 237, 0.66);
        --muted2: rgba(245, 248, 237, 0.48);
        --border: rgba(245, 248, 237, 0.12);
        --divider: rgba(245, 248, 237, 0.1);
        --shadow: 0 18px 44px rgba(0, 0, 0, 0.38);
        --shadow2: 0 8px 22px rgba(0, 0, 0, 0.28);

        --accent: #b7fb28;
        --accent-base: #b7fb28;
        --accent-strong: #8fe100;
        --ink: #090b08;
        --ink-soft: #11150f;
        --purple: #a17cff;
        --success: #59db38;
        --warning: #ffe066;
        --info: #52d6e2;
        --danger: #ff6b5f;
        --spinner-track: rgba(245, 248, 237, 0.18);
        --spinner-head: var(--accent);

        --bg-pattern-dot: rgba(183, 251, 40, 0.08);
        --bg-pattern-line: rgba(183, 251, 40, 0.035);
        --bg-glow-1: rgba(129, 209, 0, 0.2);
        --bg-glow-2: rgba(255, 255, 255, 0.04);

        color-scheme: dark;
    }
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}
html,
body {
    height: 100%;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}
body {
    margin: 0;
    font-family: "SF Pro Text", "Apple Color Emoji", "Segoe UI Emoji",
        "Noto Color Emoji", system-ui, -apple-system, "Segoe UI", Arial,
        sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: none;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
}
body.app-loading {
    overflow: hidden;
}

button {
    cursor: pointer;
}
input,
textarea,
select,
[contenteditable="true"] {
    user-select: text;
    -webkit-user-select: text;
    -webkit-touch-callout: default;
}

.gate {
    position: fixed;
    inset: 0;
    padding: 18px;
    padding-top: calc(18px + var(--safe-top));
    padding-bottom: calc(18px + var(--safe-bot));
    display: grid;
    place-items: center;
    z-index: 999;
    background: color-mix(in oklab, var(--bg) 92%, transparent);
    backdrop-filter: blur(10px);
}
.gate-card {
    width: min(var(--container), 100%);
    border-radius: 26px;
    border: 1px solid var(--border);
    background: var(--card);
    box-shadow: var(--shadow);
    padding: 16px;
}
.gate-title {
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 0.2px;
}
.gate-text {
    margin-top: 8px;
    color: var(--muted);
    line-height: 1.45;
}
.gate-actions {
    margin-top: 14px;
    display: flex;
    gap: 10px;
}

.app-loader {
    position: fixed;
    inset: 0;
    z-index: 998;
    display: grid;
    place-items: center;
    background: var(--bg);
    transition:
        opacity 0.32s ease,
        visibility 0.32s ease;
}
.app-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.app-loader .spinner {
    width: 34px;
    height: 34px;
    border-width: 3px;
}

.app-bg {
    position: fixed;
    inset: 0;
    background-color: var(--bg);
    background-image:
        radial-gradient(70% 54% at 78% -8%, var(--bg-glow-1), transparent 68%),
        radial-gradient(82% 58% at 0% 10%, var(--bg-glow-2), transparent 70%),
        radial-gradient(circle at 1px 1px, var(--bg-pattern-dot) 1px, transparent 1px);
    background-size: auto, auto, 24px 24px;
}

.app-shell {
    position: relative;
    max-width: var(--container);
    width: min(var(--container), 100%);
    margin: 0 auto;
    min-height: 100vh;
    height: auto;
    padding: 0 14px;
    padding-top: calc(8px + var(--safe-top));
    padding-bottom: calc(98px + var(--safe-bot));
    display: flex;
    flex-direction: column;
}
.app-shell.no-tabbar {
    padding-bottom: calc(16px + var(--safe-bot));
}

.topbar {
    position: sticky;
    top: var(--safe-top);
    z-index: 10;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 18px;
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow2);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.title {
    margin: 0;
    font-weight: 900;
    font-size: 22px;
    letter-spacing: 0;
}

.topbar-actions {
    display: flex;
    gap: 8px;
}

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    display: grid;
    place-items: center;
    box-shadow: var(--shadow2);
    transition:
        transform 0.12s ease,
        background 0.12s ease,
        border-color 0.12s ease,
        opacity 0.12s ease;
}
.icon-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    opacity: 0.92;
}
.icon-btn:active {
    transform: scale(0.98);
}
.icon-btn:hover {
    background: var(--card2);
}
.icon-btn:focus-visible {
    outline: 2px solid color-mix(in oklab, var(--accent) 85%, white);
    outline-offset: 2px;
}

.content {
    padding-top: 8px;
    flex: 0 0 auto;
    overflow: visible;
    position: relative;
}

.screen {
    display: none;
    animation: fadein 0.18s ease;
    position: relative;
    min-height: 100%;
}
.screen.active {
    display: block;
}
@keyframes fadein {
    from {
        opacity: 0;
        transform: translateY(3px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.row {
    display: flex;
    align-items: center;
    justify-content: center;
}
.row.space {
    justify-content: space-between;
}
.row.end {
    justify-content: flex-end;
}
.screen-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
    margin: 6px 0 12px;
}
.screen-actions .btn {
    width: 100%;
    justify-content: center;
}
.screen-actions .btn-ic {
    width: 18px;
    height: 18px;
    display: grid;
    place-items: center;
}
#btnShoppingList {
    grid-column: 1 / -1;
}
@media (max-width: 360px) {
    .screen-actions {
        grid-template-columns: 1fr;
    }
    #btnShoppingList {
        grid-column: auto;
    }
}
.row.wrap {
    flex-wrap: wrap;
}
.gap {
    gap: 10px;
}
.mt8 {
    margin-top: 8px;
}
.mt10 {
    margin-top: 10px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius2);
    padding: 14px;
    box-shadow: var(--shadow2);
}

.onboarding-card {
    overflow: hidden;
    background:
        radial-gradient(circle at top right, rgba(169, 241, 15, 0.26), transparent 34%),
        linear-gradient(
            180deg,
            color-mix(in oklab, var(--card) 88%, white),
            color-mix(in oklab, var(--card2) 56%, var(--card))
        );
}
.onboarding-top {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.onboarding-progress {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: color-mix(in oklab, var(--card) 50%, rgba(17, 18, 15, 0.08));
    overflow: hidden;
}
.onboarding-progress span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--accent-strong));
    transition: width 0.28s ease;
}
.onboarding-stage {
    margin-top: 14px;
    animation: fadein 0.22s ease;
}
.onboarding-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.72);
    font-size: 12px;
    font-weight: 700;
}
.onboarding-title {
    margin: 14px 0 8px;
    font-size: 30px;
    line-height: 1.05;
    font-weight: 900;
    letter-spacing: -0.04em;
}
.onboarding-text {
    color: var(--muted);
    line-height: 1.5;
    font-size: 15px;
}
.onboarding-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 22px;
}
.onboarding-option {
    width: 100%;
    border: 1px solid var(--border);
    background: color-mix(in oklab, var(--card) 90%, white);
    color: var(--text);
    border-radius: 20px;
    padding: 16px 18px;
    text-align: left;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition:
        transform 0.12s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
}
.onboarding-option:active {
    transform: scale(0.99);
}
.onboarding-option:hover,
.onboarding-option.selected {
    border-color: color-mix(in oklab, var(--accent-strong) 45%, var(--border));
    box-shadow: 0 10px 24px rgba(47, 76, 16, 0.1);
    background: color-mix(in oklab, var(--accent) 18%, var(--card));
}
.onboarding-field {
    margin-top: 22px;
}
.onboarding-field span {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--muted);
    font-weight: 650;
}
.onboarding-field input {
    width: 100%;
    min-height: 62px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: color-mix(in oklab, var(--card2) 78%, var(--ink));
    color: #f5f8ed;
    padding: 16px 18px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        0 10px 24px rgba(0, 0, 0, 0.14);
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
    caret-color: var(--accent);
}
.onboarding-field input::placeholder {
    color: rgba(245, 248, 237, 0.38);
    font-weight: 600;
}
.onboarding-field input::-webkit-input-placeholder {
    color: rgba(245, 248, 237, 0.38);
}
.onboarding-field input:-webkit-autofill,
.onboarding-field input:-webkit-autofill:hover,
.onboarding-field input:-webkit-autofill:focus {
    -webkit-text-fill-color: #f5f8ed;
    -webkit-box-shadow: 0 0 0 1000px color-mix(in oklab, var(--card2) 78%, var(--ink)) inset;
}
.onboarding-field input:focus {
    border-color: color-mix(in oklab, var(--accent-strong) 50%, var(--border));
    background: color-mix(in oklab, var(--card2) 68%, var(--ink));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 0 0 3px color-mix(in oklab, var(--accent) 26%, transparent),
        0 12px 28px rgba(0, 0, 0, 0.18);
}
.onboarding-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}
.onboarding-actions .btn {
    width: 100%;
    justify-content: center;
}
.onboarding-loading-shell {
    margin-top: 22px;
    display: grid;
    gap: 12px;
}
.onboarding-checklist {
    display: grid;
    gap: 10px;
}
.onboarding-check-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 16px;
    background: color-mix(in oklab, var(--card) 88%, var(--accent) 12%);
    border: 1px solid color-mix(in oklab, var(--accent) 34%, var(--border));
    color: var(--text);
    font-weight: 700;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.55),
        0 10px 20px rgba(47, 76, 16, 0.08);
    transition:
        transform 0.24s ease,
        border-color 0.24s ease,
        background 0.24s ease,
        color 0.24s ease,
        box-shadow 0.24s ease;
}
.onboarding-check-item::before {
    content: "";
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    border: 2px solid var(--spinner-track);
    background: rgba(255, 255, 255, 0.56);
}
.onboarding-check-item.is-running {
    transform: translateX(4px);
    border-color: color-mix(in oklab, var(--accent-strong) 38%, var(--border));
    color: var(--text);
    background: linear-gradient(
        135deg,
        color-mix(in oklab, var(--accent) 22%, var(--card)),
        color-mix(in oklab, var(--accent) 8%, white)
    );
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.62),
        0 12px 24px rgba(47, 76, 16, 0.12);
}
.onboarding-check-item.is-running::before {
    border-color: var(--spinner-track);
    border-top-color: var(--spinner-head);
    background: transparent;
    animation: spin 0.85s linear infinite;
}
.onboarding-check-item.is-done {
    transform: translateX(0);
    border-color: color-mix(in oklab, var(--accent-strong) 42%, var(--border));
    background: linear-gradient(
        135deg,
        color-mix(in oklab, var(--accent) 28%, var(--card)),
        color-mix(in oklab, var(--accent) 10%, white)
    );
    color: var(--text);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.62),
        0 12px 24px rgba(47, 76, 16, 0.14);
}
.onboarding-check-item.is-done::before {
    content: "✓";
    display: grid;
    place-items: center;
    border: 0;
    background: var(--accent);
    color: #162109;
    font-size: 12px;
    font-weight: 900;
}

:root[data-theme="dark"] .onboarding-check-item {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.08);
    color: rgba(245, 248, 237, 0.76);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

:root[data-theme="dark"] .onboarding-check-item::before {
    border-color: rgba(245, 248, 237, 0.22);
    background: rgba(255, 255, 255, 0.03);
}

:root[data-theme="dark"] .onboarding-check-item.is-running {
    border-color: rgba(169, 241, 15, 0.34);
    color: #f5f8ed;
    background: linear-gradient(
        135deg,
        rgba(169, 241, 15, 0.12),
        rgba(255, 255, 255, 0.05)
    );
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        0 10px 20px rgba(47, 76, 16, 0.12);
}

:root[data-theme="dark"] .onboarding-check-item.is-running::before {
    border-color: rgba(169, 241, 15, 0.28);
}

:root[data-theme="dark"] .onboarding-check-item.is-done {
    border-color: color-mix(in oklab, var(--accent) 44%, rgba(255, 255, 255, 0.08));
    background: linear-gradient(
        135deg,
        rgba(169, 241, 15, 0.18),
        rgba(169, 241, 15, 0.06)
    );
    color: #f5f8ed;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        0 10px 20px rgba(47, 76, 16, 0.16);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .onboarding-check-item {
        background: rgba(255, 255, 255, 0.06);
        border-color: rgba(255, 255, 255, 0.08);
        color: rgba(245, 248, 237, 0.76);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
    }

    :root:not([data-theme="light"]) .onboarding-check-item::before {
        border-color: rgba(245, 248, 237, 0.22);
        background: rgba(255, 255, 255, 0.03);
    }

    :root:not([data-theme="light"]) .onboarding-check-item.is-running {
        border-color: rgba(169, 241, 15, 0.34);
        color: #f5f8ed;
        background: linear-gradient(
            135deg,
            rgba(169, 241, 15, 0.12),
            rgba(255, 255, 255, 0.05)
        );
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.04),
            0 10px 20px rgba(47, 76, 16, 0.12);
    }

    :root:not([data-theme="light"]) .onboarding-check-item.is-running::before {
        border-color: rgba(169, 241, 15, 0.28);
    }

    :root:not([data-theme="light"]) .onboarding-check-item.is-done {
        border-color: color-mix(in oklab, var(--accent) 44%, rgba(255, 255, 255, 0.08));
        background: linear-gradient(
            135deg,
            rgba(169, 241, 15, 0.18),
            rgba(169, 241, 15, 0.06)
        );
        color: #f5f8ed;
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.04),
            0 10px 20px rgba(47, 76, 16, 0.16);
    }
}
.preview-hero {
    margin-top: 22px;
    padding: 18px;
    border-radius: 22px;
    background: var(--ink);
    color: #fff;
    box-shadow: var(--shadow);
}
.preview-hero-locked {
    position: relative;
    overflow: hidden;
    min-height: 420px;
}
.preview-hero-blur {
    filter: blur(10px);
    transform: scale(1.02);
    user-select: none;
    pointer-events: none;
}
.preview-hero-locked::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(17, 18, 15, 0.18), rgba(17, 18, 15, 0.34)),
        radial-gradient(circle at center, rgba(255, 255, 255, 0.12), transparent 52%);
}
.preview-hero-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: grid;
    place-items: center;
    padding: 24px;
}
.preview-unlock-btn {
    width: min(260px, 100%);
}
.preview-goal {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    font-size: 12px;
    font-weight: 700;
}
.preview-calories {
    margin-top: 14px;
    font-size: 42px;
    line-height: 1;
    font-weight: 900;
}
.preview-meta {
    margin-top: 8px;
    color: rgba(255, 255, 255, 0.72);
}
.preview-grid {
    margin-top: 18px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.preview-grid div {
    border-radius: 18px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.08);
}
.preview-grid span {
    display: block;
    color: rgba(255, 255, 255, 0.62);
    font-size: 12px;
}
.preview-grid strong {
    display: block;
    margin-top: 6px;
    font-size: 20px;
}
.preview-locked-summary {
    margin-top: 18px;
    color: rgba(245, 248, 237, 0.78);
    line-height: 1.55;
}
.preview-cta {
    margin-top: 18px;
    display: grid;
    gap: 10px;
}
.preview-cta .btn {
    width: 100%;
}
.preview-notes {
    margin-top: 14px;
    display: grid;
    gap: 8px;
}
.preview-note-item {
    border-radius: 14px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.88);
    font-size: 13px;
    font-weight: 650;
}
.preview-paywall-note {
    margin-top: 10px;
    color: rgba(245, 248, 237, 0.78);
    font-size: 13px;
    line-height: 1.45;
}
.preview-trial-panel {
    margin-top: 8px;
}
.preview-trial-actions {
    display: grid;
    gap: 10px;
    margin-top: 8px;
}
.preview-trial-action {
    min-height: 68px;
}

.card-title {
    font-weight: 900;
    margin-bottom: 10px;
    letter-spacing: 0;
}
.result-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.result-card .card-title {
    margin-bottom: 0;
}
.card-subtitle {
    font-weight: 650;
    margin: 4px 0 8px;
}

.photo-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.photo-actions + .row {
    margin-top: 8px;
}
.photo-result-actions {
    margin-top: 10px;
    margin-bottom: 4px;
}
.small {
    font-size: 12px;
}
.muted {
    color: var(--muted);
}
.unit {
    font-size: 13px;
    color: var(--muted);
    font-weight: 650;
}

.divider {
    height: 1px;
    background: var(--divider);
    margin: 12px 0;
    border-radius: 999px;
}

/* Home */
#screen-home .home-user-card {
    background: var(--ink);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.08);
}
#screen-home .home-user-card .muted,
#screen-home .home-user-card .small {
    color: rgba(255, 255, 255, 0.68);
}
#screen-home .home-user-card .badge {
    background: var(--accent);
    color: var(--ink);
    border-color: var(--accent);
}
#screen-home .home-today-card {
    background: color-mix(in oklab, var(--accent) 24%, var(--card));
}
#screen-home .home-plan-card {
    background: var(--ink);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.08);
}
#screen-home .home-plan-card .muted {
    color: rgba(255, 255, 255, 0.68);
}
#screen-home .home-plan-card .home-plan-features .plan-chip {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.12);
}
#screen-home .home-plan-card .btn.primary {
    background: var(--accent);
    color: var(--ink);
    border-color: var(--accent);
}
#screen-home .home-plan-card .btn.primary:hover {
    background: color-mix(in oklab, var(--accent) 86%, var(--card));
}
.home-trial-card {
    background:
        linear-gradient(
            135deg,
            color-mix(in oklab, var(--accent) 24%, var(--card)),
            color-mix(in oklab, var(--card2) 72%, var(--card))
        );
}
.home-trial-card .card-title {
    margin-bottom: 4px;
}
.home-trial-card .badge {
    background: var(--warning);
    color: var(--ink);
    border-color: transparent;
}
.home-trial-card .mini-action {
    position: relative;
    min-height: 72px;
    padding: 14px 16px;
    border-radius: 18px;
    border-color: color-mix(in oklab, var(--accent) 28%, var(--border));
    background:
        linear-gradient(
            135deg,
            color-mix(in oklab, white 86%, var(--accent) 14%),
            color-mix(in oklab, var(--card) 92%, var(--accent) 8%)
        );
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.72),
        0 10px 24px rgba(47, 76, 16, 0.12);
    transition:
        transform 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease,
        background 0.18s ease;
}
.home-trial-card .mini-action:hover {
    border-color: color-mix(in oklab, var(--accent-strong) 42%, var(--border));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.8),
        0 14px 28px rgba(47, 76, 16, 0.16);
}
.home-trial-card .mini-action:active {
    transform: none;
}
.home-trial-card .mini-action::after {
    content: "";
    margin-left: auto;
    width: 9px;
    height: 9px;
    flex: 0 0 9px;
    border-right: 2px solid color-mix(in oklab, var(--text) 72%, transparent);
    border-bottom: 2px solid color-mix(in oklab, var(--text) 72%, transparent);
    transform: rotate(-45deg);
}
.home-trial-card .mini-action > span:last-child {
    max-width: 190px;
    font-size: 15px;
    line-height: 1.28;
    font-weight: 750;
    letter-spacing: -0.01em;
}
.home-trial-card .mini-action-ic {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    background: linear-gradient(180deg, #111713, #1b2417);
    border-color: rgba(17, 23, 19, 0.92);
    color: #ffe37a;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 8px 18px rgba(17, 23, 19, 0.18);
}
.home-trial-card .mini-action:nth-child(2) .mini-action-ic {
    color: #c9ff72;
}
.home-trial-card .mini-action:nth-child(3) .mini-action-ic {
    color: #d9eefc;
}
.home-trial-card .btn.primary {
    width: 100%;
}

:root[data-theme="dark"] .home-trial-card .mini-action {
    border-color: rgba(255, 255, 255, 0.08);
    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.06),
            rgba(255, 255, 255, 0.03)
        );
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        0 10px 24px rgba(0, 0, 0, 0.2);
}

:root[data-theme="dark"] .home-trial-card .mini-action::after {
    border-right-color: rgba(245, 248, 237, 0.72);
    border-bottom-color: rgba(245, 248, 237, 0.72);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .home-trial-card .mini-action {
        border-color: rgba(255, 255, 255, 0.08);
        background:
            linear-gradient(
                135deg,
                rgba(255, 255, 255, 0.06),
                rgba(255, 255, 255, 0.03)
            );
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.04),
            0 10px 24px rgba(0, 0, 0, 0.2);
    }

    :root:not([data-theme="light"]) .home-trial-card .mini-action::after {
        border-right-color: rgba(245, 248, 237, 0.72);
        border-bottom-color: rgba(245, 248, 237, 0.72);
    }
}
.home-paid-card {
    background:
        linear-gradient(
            180deg,
            color-mix(in oklab, var(--ink) 88%, var(--card2)),
            color-mix(in oklab, var(--ink) 96%, black)
        );
    color: #fff;
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow:
        0 18px 34px rgba(0, 0, 0, 0.26),
        inset 0 1px 0 rgba(183, 251, 40, 0.08);
}
.home-paid-card .muted,
.home-paid-card .small {
    color: rgba(255, 255, 255, 0.68);
}
.home-paid-card .badge {
    background: rgba(255, 255, 255, 0.06);
    color: var(--accent);
    border-color: rgba(183, 251, 40, 0.18);
}
.home-paid-card .btn.primary {
    background: var(--accent);
    color: var(--ink);
    border-color: var(--accent);
}
.home-paid-card .btn.primary:hover {
    background: color-mix(in oklab, var(--accent) 88%, white);
}
.home-reset-btn {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(245, 248, 237, 0.92);
    box-shadow: none;
}
.home-reset-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}
.today-macro-grid {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.today-macro {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    background:
        linear-gradient(
            180deg,
            rgba(255, 255, 255, 0.06),
            rgba(255, 255, 255, 0.03)
        );
    padding: 14px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.03),
        0 8px 18px rgba(0, 0, 0, 0.12);
}
.today-macro span {
    display: block;
    color: rgba(255, 255, 255, 0.62);
    font-size: 12px;
    font-weight: 650;
}
.today-macro strong {
    display: block;
    margin-top: 6px;
    font-size: 22px;
    font-weight: 850;
    color: #fff;
}
.home-user {
    display: flex;
    align-items: center;
    gap: 12px;
}
.home-user-meta {
    min-width: 0;
    flex: 1;
}
.home-user-name {
    font-weight: 800;
    letter-spacing: 0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.home-user-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

#homeTodayBadge,
#homePlanBadgeLarge {
    display: none;
}

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    background: var(--ink);
    box-shadow: 0 0 0 2px var(--accent);
    overflow: hidden;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
}
.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.avatar-fallback {
    font-weight: 900;
    color: var(--accent);
}

.home-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 10px;
}
.stat {
    border: 1px solid var(--border);
    background: var(--card2);
    border-radius: 14px;
    padding: 10px;
}
.stat-num {
    margin-top: 2px;
    font-size: 18px;
    font-weight: 850;
}

.home-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}
.home-plan-features {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.home-plan-features .plan-chip {
    border: 1px solid var(--border);
    background: var(--card2);
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 650;
}
.mini-action {
    width: 100%;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    border-radius: 16px;
    padding: 12px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    text-align: left;
    box-shadow: none;
}
.mini-action:active {
    transform: scale(0.99);
}
.mini-action-ic {
    width: 34px;
    height: 34px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: var(--ink);
    border: 1px solid var(--ink);
    color: var(--accent);
    font-size: 18px;
    line-height: 1;
}
.mini-action-ic svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    opacity: 0.95;
}
.mini-action-ic img.emoji {
    width: 18px;
    height: 18px;
    margin: 0;
}
img.emoji {
    width: 1em;
    height: 1em;
    margin: 0 0.05em 0 0.05em;
    vertical-align: -0.12em;
}
@media (max-width: 380px) {
    .onboarding-title {
        font-size: 26px;
    }
    .preview-calories {
        font-size: 36px;
    }
    .preview-grid,
    .today-macro-grid {
        grid-template-columns: 1fr;
    }
}

.subscribe-card {
    overflow: hidden;
    padding: 12px;
}
.subscribe-renew-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.2)),
        linear-gradient(135deg, color-mix(in oklab, var(--accent) 8%, var(--card)), var(--card));
    border-color: color-mix(in oklab, var(--accent) 26%, var(--border));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.46),
        0 12px 26px rgba(47, 76, 16, 0.12);
}
.subscribe-renew-copy {
    flex: 1 1 auto;
    min-width: 0;
}
.subscribe-renew-title {
    font-size: 15px;
    font-weight: 800;
    margin-bottom: 4px;
}
.ios-switch {
    position: relative;
    width: 52px;
    height: 32px;
    flex: 0 0 52px;
    border: 0;
    border-radius: 999px;
    padding: 0;
    background: color-mix(in oklab, var(--muted2) 80%, transparent);
    box-shadow:
        inset 0 0 0 1px rgba(17, 21, 15, 0.08),
        inset 0 3px 8px rgba(17, 21, 15, 0.12);
    transition:
        background 0.18s ease,
        box-shadow 0.18s ease,
        opacity 0.18s ease,
        transform 0.12s ease;
}
.ios-switch::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: #fff;
    box-shadow:
        0 2px 6px rgba(17, 21, 15, 0.18),
        0 1px 2px rgba(17, 21, 15, 0.1);
    transition: transform 0.18s ease;
}
.ios-switch.is-on {
    background: linear-gradient(
        135deg,
        color-mix(in oklab, var(--accent) 92%, white),
        color-mix(in oklab, var(--accent-strong) 84%, var(--accent))
    );
    box-shadow:
        inset 0 0 0 1px rgba(143, 225, 0, 0.18),
        0 0 0 3px color-mix(in oklab, var(--accent) 18%, transparent);
}
.ios-switch.is-on::before {
    transform: translateX(20px);
}
.ios-switch.is-disabled {
    opacity: 0.64;
    cursor: default;
}
.ios-switch:active {
    transform: scale(0.98);
}
.ios-switch:focus-visible {
    outline: none;
    box-shadow:
        0 0 0 3px color-mix(in oklab, var(--accent) 26%, transparent),
        inset 0 0 0 1px rgba(17, 21, 15, 0.08),
        inset 0 3px 8px rgba(17, 21, 15, 0.12);
}
.subscribe-title {
    font-size: 21px;
    line-height: 1.1;
}
.plans-grid {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 10px -12px 0;
    padding: 3px 12px 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 14px;
    cursor: grab;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.plans-grid::-webkit-scrollbar {
    display: none;
}
.plans-grid.dragging {
    cursor: grabbing;
    scroll-snap-type: none;
    user-select: none;
}
.plans-grid.dragging .plan-card {
    cursor: grabbing;
}
.plan-card {
    position: relative;
    flex: 0 0 min(78vw, 300px);
    border: 1px solid var(--border);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.18)),
        linear-gradient(135deg, var(--card), color-mix(in oklab, var(--card2) 44%, var(--card)));
    border-radius: 20px;
    padding: 13px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
    scroll-snap-align: center;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background-color 0.2s ease;
    text-align: left;
    outline: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.plan-card:hover {
    border-color: color-mix(in oklab, var(--accent-strong) 45%, var(--border));
    box-shadow: 0 10px 24px rgba(47, 76, 16, 0.12);
}
.plan-card:focus-visible {
    border-color: color-mix(in oklab, var(--accent-strong) 45%, var(--border));
    box-shadow:
        0 0 0 2px color-mix(in oklab, var(--accent) 45%, transparent),
        0 10px 24px rgba(47, 76, 16, 0.12);
}
.plan-card.active {
    border-color: var(--accent-strong);
    box-shadow:
        0 0 0 2px color-mix(in oklab, var(--accent) 65%, transparent),
        0 12px 28px rgba(47, 76, 16, 0.16);
    background:
        linear-gradient(180deg, color-mix(in oklab, var(--accent) 18%, white), rgba(255, 255, 255, 0.16)),
        linear-gradient(135deg, color-mix(in oklab, var(--accent) 18%, var(--card)), var(--card));
}
.plan-card.disabled {
    cursor: default;
    opacity: 0.72;
}
.plan-card.disabled:hover {
    border-color: var(--border);
    box-shadow: none;
}

:root[data-theme="dark"] .subscribe-renew-card {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
        linear-gradient(135deg, rgba(169, 241, 15, 0.08), var(--card));
    border-color: color-mix(in oklab, var(--accent) 24%, rgba(245, 248, 237, 0.12));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        0 12px 26px rgba(0, 0, 0, 0.18);
}
:root[data-theme="dark"] .ios-switch {
    background: rgba(245, 248, 237, 0.14);
    box-shadow:
        inset 0 0 0 1px rgba(245, 248, 237, 0.05),
        inset 0 3px 8px rgba(0, 0, 0, 0.24);
}
:root[data-theme="dark"] .ios-switch::before {
    background: #f5f8ed;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .subscribe-renew-card {
        background:
            linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
            linear-gradient(135deg, rgba(169, 241, 15, 0.08), var(--card));
        border-color: color-mix(in oklab, var(--accent) 24%, rgba(245, 248, 237, 0.12));
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.04),
            0 12px 26px rgba(0, 0, 0, 0.18);
    }
    :root:not([data-theme="light"]) .ios-switch {
        background: rgba(245, 248, 237, 0.14);
        box-shadow:
            inset 0 0 0 1px rgba(245, 248, 237, 0.05),
            inset 0 3px 8px rgba(0, 0, 0, 0.24);
    }
    :root:not([data-theme="light"]) .ios-switch::before {
        background: #f5f8ed;
    }
}
.plan-top {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    min-height: 44px;
}
.plan-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    background: color-mix(in oklab, var(--accent) 34%, white);
    border: 1px solid color-mix(in oklab, var(--accent-strong) 12%, transparent);
    font-size: 21px;
    line-height: 1;
}
.plan-labels {
    display: grid;
    gap: 2px;
    min-width: 0;
}
.plan-title {
    font-weight: 900;
    font-size: 19px;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.plan-subrow {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.plan-subtitle {
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.plan-price {
    font-size: 25px;
    font-weight: 900;
    letter-spacing: 0;
    line-height: 1;
    color: var(--accent-strong);
}
.plan-credit {
    margin-top: -4px;
    color: color-mix(in oklab, var(--accent-strong) 72%, var(--muted));
    font-size: 11px;
    font-weight: 850;
}
.plan-term-options {
    display: grid;
    overflow: hidden;
    border: 1px solid color-mix(in oklab, var(--accent-strong) 20%, var(--border));
    border-radius: 16px;
    background: color-mix(in oklab, var(--card2) 78%, white);
}
.plan-term-option {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    width: 100%;
    min-height: 52px;
    border: 0;
    border-bottom: 1px solid color-mix(in oklab, var(--border) 74%, transparent);
    background: transparent;
    color: var(--text);
    padding: 8px 9px;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.plan-term-option:last-child {
    border-bottom: 0;
}
.plan-term-option.active {
    background: color-mix(in oklab, var(--accent) 17%, transparent);
}
.plan-term-option.disabled {
    cursor: default;
    opacity: 0.55;
}
.plan-term-option:focus-visible {
    outline: 2px solid color-mix(in oklab, var(--accent-strong) 58%, transparent);
    outline-offset: -2px;
}
.plan-term-check {
    width: 20px;
    height: 20px;
    border-radius: 999px;
    border: 2px solid color-mix(in oklab, var(--muted) 42%, var(--border));
    background: var(--card);
    position: relative;
}
.plan-term-option.active .plan-term-check {
    border-color: var(--accent-strong);
    background: var(--accent-strong);
}
.plan-term-option.active .plan-term-check::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 4px;
    width: 6px;
    height: 3px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg);
}
.plan-term-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
}
.plan-term-title {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    font-size: 13px;
    line-height: 1.1;
    font-weight: 900;
}
.plan-term-sub {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.15;
    font-weight: 700;
}
.plan-term-discount {
    display: inline-grid;
    place-items: center;
    min-height: 18px;
    padding: 0 6px;
    border-radius: 7px;
    background: var(--accent-strong);
    color: #fff;
    font-size: 11px;
    line-height: 1;
    font-weight: 900;
}
.plan-term-month {
    display: grid;
    gap: 2px;
    justify-self: end;
    white-space: nowrap;
    color: var(--text);
    font-size: 13px;
    line-height: 1;
    font-weight: 900;
    text-align: right;
}
.plan-term-month small {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
}
.plan-term-month em {
    color: var(--muted);
    font-size: 9px;
    font-style: normal;
    font-weight: 800;
}
.plan-badge {
    flex: 0 0 auto;
    font-size: 9px;
    line-height: 1;
    font-weight: 850;
    padding: 4px 7px;
    border-radius: 999px;
    color: var(--ink);
    background: var(--accent);
    border: 1px solid color-mix(in oklab, var(--accent-strong) 28%, transparent);
    box-shadow: 0 8px 18px rgba(47, 76, 16, 0.12);
}
.plan-benefits {
    display: grid;
    gap: 8px;
    margin: 2px 0 0;
    padding: 0;
    list-style: none;
}
.plan-benefits li {
    position: relative;
    padding-left: 23px;
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.25;
}
.plan-benefits li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.18em;
    width: 15px;
    height: 15px;
    border-radius: 999px;
    background: var(--accent-strong);
    box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 32%, transparent);
}
.plan-benefits li.is-unavailable {
    color: color-mix(in oklab, var(--muted) 82%, var(--text));
}
.plan-benefits li.is-unavailable::before {
    background:
        linear-gradient(45deg, transparent calc(50% - 1px), #fff calc(50% - 1px), #fff calc(50% + 1px), transparent calc(50% + 1px)),
        linear-gradient(-45deg, transparent calc(50% - 1px), #fff calc(50% - 1px), #fff calc(50% + 1px), transparent calc(50% + 1px)),
        color-mix(in oklab, #ff5b5b 72%, var(--card));
    box-shadow: 0 0 0 3px rgba(255, 91, 91, 0.13);
}
.plan-benefits li::after {
    content: "";
    position: absolute;
    left: 4px;
    top: calc(0.18em + 4px);
    width: 5px;
    height: 3px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg);
}
.plan-benefits li.is-unavailable::after {
    content: none;
}
.plan-cta {
    display: grid;
    place-items: center;
    margin-top: 4px;
    min-height: 42px;
    border-radius: 14px;
    border: 1px solid color-mix(in oklab, var(--accent-strong) 46%, var(--border));
    background: color-mix(in oklab, var(--accent) 16%, transparent);
    color: var(--accent-strong);
    font-size: 13px;
    font-weight: 850;
    cursor: pointer;
}
.plan-card.active .plan-cta {
    background: linear-gradient(135deg, var(--accent-strong), color-mix(in oklab, var(--accent) 70%, var(--accent-strong)));
    border-color: transparent;
    color: #fff;
    box-shadow: 0 12px 24px rgba(40, 164, 0, 0.18);
}
.plan-cta:active {
    transform: none;
}
.plan-cta:disabled {
    cursor: default;
    opacity: 0.72;
}
.plan-dots {
    display: flex;
    justify-content: center;
    gap: 7px;
    margin-top: 2px;
}
.plan-dot {
    width: 7px;
    height: 7px;
    border: 0;
    border-radius: 999px;
    padding: 0;
    background: color-mix(in oklab, var(--muted) 34%, transparent);
    cursor: pointer;
}
.plan-dot.active {
    width: 22px;
    background: var(--accent-strong);
}
:root[data-theme="dark"] .plan-card {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015)),
        linear-gradient(135deg, var(--card), color-mix(in oklab, var(--card2) 62%, var(--card)));
}
:root[data-theme="dark"] .plan-card.active {
    background:
        linear-gradient(180deg, color-mix(in oklab, var(--accent) 10%, transparent), rgba(255, 255, 255, 0.018)),
        linear-gradient(135deg, color-mix(in oklab, var(--accent) 10%, var(--card)), var(--card));
}
:root[data-theme="dark"] .plan-term-options {
    background: color-mix(in oklab, var(--card2) 82%, #10140f);
}
:root[data-theme="dark"] .plan-term-check {
    background: color-mix(in oklab, var(--card) 76%, #111);
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .plan-card {
        background:
            linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015)),
            linear-gradient(135deg, var(--card), color-mix(in oklab, var(--card2) 62%, var(--card)));
    }
    :root:not([data-theme="light"]) .plan-card.active {
        background:
            linear-gradient(180deg, color-mix(in oklab, var(--accent) 10%, transparent), rgba(255, 255, 255, 0.018)),
            linear-gradient(135deg, color-mix(in oklab, var(--accent) 10%, var(--card)), var(--card));
    }
    :root:not([data-theme="light"]) .plan-term-options {
        background: color-mix(in oklab, var(--card2) 82%, #10140f);
    }
    :root:not([data-theme="light"]) .plan-term-check {
        background: color-mix(in oklab, var(--card) 76%, #111);
    }
}
@media (max-width: 360px) {
    .plan-card {
        flex-basis: 86vw;
        padding: 13px;
    }
    .plan-top {
        grid-template-columns: 42px minmax(0, 1fr);
        gap: 8px;
    }
    .plan-icon {
        width: 42px;
        height: 42px;
    }
    .plan-title {
        font-size: 18px;
    }
    .plan-price {
        font-size: 24px;
    }
    .plan-badge {
        font-size: 8.5px;
        padding: 4px 6px;
    }
    .plan-term-option {
        grid-template-columns: 22px minmax(0, 1fr);
    }
    .plan-term-month {
        grid-column: 2;
        justify-self: start;
        font-size: 12px;
    }
}
.plan-features-head {
    display: grid;
    gap: 2px;
    margin-bottom: 10px;
}
.plan-features-head .card-title {
    margin-bottom: 0;
}
.plan-features {
    display: grid;
    gap: 8px;
}
.plan-features .feature {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}
.plan-features .feature::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--accent);
    box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 34%, transparent);
    display: inline-block;
}

.checkout-summary {
    display: grid;
    gap: 8px;
    margin-top: 8px;
}
.checkout-summary .line {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    font-size: 14px;
}
.checkout-summary .line span {
    flex: 1 1 auto;
    min-width: 0;
}
.checkout-summary .line strong {
    flex: 0 1 auto;
    font-weight: 800;
    text-align: right;
}
.checkout-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}
.checkout-actions .btn {
    min-width: 0;
}
.checkout-bot-prompt {
    display: grid;
    gap: 10px;
    margin-top: 14px;
    padding: 14px;
    border-radius: 18px;
    border: 1px solid color-mix(in oklab, var(--accent) 24%, var(--border));
    background: color-mix(in oklab, var(--accent) 8%, var(--card));
}
.checkout-bot-title {
    font-size: 15px;
    font-weight: 800;
}
.checkout-bot-prompt .btn {
    width: 100%;
}
@media (max-width: 360px) {
    .checkout-actions {
        grid-template-columns: 1fr;
    }
}

.screen-lock {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 8px 0 0;
    background: transparent;
    backdrop-filter: none;
    z-index: 1;
}
.screen.locked > :not(.screen-lock) {
    display: none;
}
.lock-card {
    width: 100%;
    max-width: 360px;
    text-align: left;
    border: 1px solid var(--border);
    background: var(--ink);
    color: #fff;
    border-radius: 18px;
    padding: 16px;
}
.lock-card .muted,
.lock-card .small {
    color: rgba(255, 255, 255, 0.68);
}
.lock-card .btn.primary {
    background: var(--accent);
    color: var(--ink);
    border-color: var(--accent);
}
.lock-card .btn.primary:hover {
    background: color-mix(in oklab, var(--accent) 86%, var(--card));
}
.lock-title {
    font-weight: 800;
    font-size: 16px;
    margin-bottom: 6px;
}

.btn {
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    border-radius: 16px;
    padding: 12px 14px;
    font-weight: 700;
    letter-spacing: 0;
    width: 100%;
    box-shadow: var(--shadow2);
    transition:
        transform 0.12s ease,
        opacity 0.12s ease,
        background 0.12s ease,
        border-color 0.12s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}
.btn.loading {
    position: relative;
    opacity: 0.75;
    pointer-events: none;
}
.btn.loading::after {
    content: "";
    width: 14px;
    height: 14px;
    border: 2px solid var(--spinner-track);
    border-top-color: var(--spinner-head);
    border-radius: 50%;
    display: inline-block;
    margin-left: 8px;
    animation: spin 0.9s linear infinite;
}
.btn:hover {
    background: var(--card2);
}
.btn:active {
    transform: none;
}
.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

:root[data-theme="dark"] .onboarding-option {
    background: color-mix(in oklab, var(--card2) 74%, var(--ink));
    border-color: rgba(245, 248, 237, 0.12);
    color: #f5f8ed;
}

:root[data-theme="dark"] .onboarding-option:hover,
:root[data-theme="dark"] .onboarding-option.selected {
    background: color-mix(in oklab, var(--accent) 18%, var(--card2));
    border-color: color-mix(in oklab, var(--accent) 40%, rgba(245, 248, 237, 0.12));
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .onboarding-option {
        background: color-mix(in oklab, var(--card2) 74%, var(--ink));
        border-color: rgba(245, 248, 237, 0.12);
        color: #f5f8ed;
    }

    :root:not([data-theme="light"]) .onboarding-option:hover,
    :root:not([data-theme="light"]) .onboarding-option.selected {
        background: color-mix(in oklab, var(--accent) 18%, var(--card2));
        border-color: color-mix(
            in oklab,
            var(--accent) 40%,
            rgba(245, 248, 237, 0.12)
        );
        box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
    }
}

.btn.primary {
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
}
.btn.primary:hover {
    background: #000;
}
.btn.primary .btn-ic,
.btn.primary b {
    color: var(--accent);
}
.btn.danger {
    background: var(--danger);
    border-color: color-mix(in oklab, var(--danger) 70%, black);
    color: #fff;
}
.btn.danger:hover {
    background: color-mix(in oklab, var(--danger) 82%, var(--card));
}
.btn.secondary {
    background: var(--card);
}
.btn.ghost {
    background: transparent;
    border-color: var(--border);
    box-shadow: none;
}
.btn.link {
    width: auto;
    padding: 8px 10px;
    border: 0;
    background: transparent;
    color: var(--muted);
    box-shadow: none;
}
.btn.inline {
    width: auto;
    padding: 8px 12px;
}

/* Keep meal/workout quick actions visible even if old markup with .ghost is cached */
#btnNewMealPlan,
#btnShoppingList,
#btnNewWorkoutPlan {
    background: var(--card);
    border-color: var(--border);
    color: var(--text);
    box-shadow: var(--shadow2);
}

.btn.link:hover {
    color: var(--text);
    background: color-mix(in oklab, var(--card2) 65%, transparent);
    border-radius: 12px;
}
.btn-ic svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    display: block;
}

.btn:focus-visible {
    outline: 2px solid color-mix(in oklab, var(--accent) 85%, white);
    outline-offset: 2px;
}

/* Scanner */
.scanner {
    margin: 10px 0 12px;
    width: 100%;
    aspect-ratio: 1/1;
    border-radius: 18px;
    background: var(--ink);
    border: none;
    overflow: hidden;
    position: relative;
}
.scanner-inner {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
}
.scanner-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.scanner-frame {
    position: absolute;
    inset: 12px;
    border-radius: 16px;
    border: none;
    box-shadow: none;
    pointer-events: none;
}
.scanner-hint {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 14px;
    font-size: 13px;
    color: #fff;
    background: rgba(17, 18, 15, 0.78);
    border: 1px solid rgba(169, 241, 15, 0.42);
    padding: 10px 12px;
    border-radius: 14px;
    backdrop-filter: blur(10px);
}

.hidden {
    display: none !important;
}

/* Chips */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.chip {
    font-size: 12px;
    font-weight: 650;
    color: var(--text);
    padding: 8px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--card2);
}

/* Check as chip */
.chips-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}
.chip-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    padding: 8px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    user-select: none;
    cursor: pointer;
}
.chip-check input {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 5px;
    border: 1px solid var(--border);
    background: var(--card2);
    display: grid;
    place-content: center;
    flex: 0 0 auto;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}
.chip-check input::after {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 3px;
    background: var(--ink);
    transform: scale(0);
    transition: transform 0.12s ease-out;
}
.chip-check input:checked {
    border-color: var(--accent-strong);
    background: var(--accent);
}
.chip-check input:checked::after {
    transform: scale(1);
}

/* List */
.list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 10px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
}
.nutrition-row {
    align-items: stretch;
    padding: 12px 12px;
    gap: 12px;
}
.nutrition-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
}
.nutrition-name {
    color: var(--text);
    font-size: 15px;
    font-weight: 850;
    line-height: 1.2;
    overflow-wrap: anywhere;
}
.nutrition-grams {
    width: fit-content;
    min-width: 58px;
    max-width: 100%;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid color-mix(in oklab, var(--accent-strong) 24%, var(--border));
    background: color-mix(in oklab, var(--accent) 16%, var(--card2));
    color: var(--text);
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
}
.nutrition-kcal {
    flex: 0 0 auto;
    min-width: 64px;
    padding: 8px 10px;
    border-radius: 15px;
    border: 1px solid color-mix(in oklab, var(--accent-strong) 22%, var(--border));
    background:
        linear-gradient(180deg, color-mix(in oklab, var(--accent) 13%, var(--card2)), var(--card2));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-align: center;
}
.nutrition-kcal strong {
    color: var(--text);
    font-size: 18px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0;
}
.nutrition-kcal span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 850;
    line-height: 1;
    text-transform: uppercase;
}
:root[data-theme="dark"] .nutrition-grams {
    background: rgba(183, 251, 40, 0.08);
}
:root[data-theme="dark"] .nutrition-kcal {
    background:
        linear-gradient(180deg, rgba(183, 251, 40, 0.08), rgba(255, 255, 255, 0.03));
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .nutrition-grams {
        background: rgba(183, 251, 40, 0.08);
    }
    :root:not([data-theme="light"]) .nutrition-kcal {
        background:
            linear-gradient(180deg, rgba(183, 251, 40, 0.08), rgba(255, 255, 255, 0.03));
    }
}
.list-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.list-right {
    text-align: right;
}
.badge {
    font-size: 11px;
    color: var(--text);
    padding: 5px 9px;
    border-radius: 999px;
    border: 1px solid color-mix(in oklab, var(--accent-strong) 22%, var(--border));
    background: var(--card2);
    font-weight: 800;
}

/* Macro */
.big-number {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 0.3px;
    margin-top: 4px;
}
.macro-top {
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
    gap: 12px;
}
.macro-left {
    min-width: 0;
}
.macro-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}
.result-card #resTags {
    margin-top: 2px;
}
.macro-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 10px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--card);
}
.macro-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    flex: 0 0 auto;
}
.macro-dot.protein {
    background: var(--info);
}
.macro-dot.fat {
    background: var(--warning);
}
.macro-dot.carbs {
    background: var(--success);
}
.macro-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.macro-value {
    font-weight: 800;
    font-size: 13px;
}
.macro-label {
    font-size: 11px;
    color: var(--muted);
}
.loader {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 2px;
}
.loader-text {
    font-size: 13px;
    color: var(--muted);
}
.loader-sub {
    margin-left: 40px;
    font-size: 12px;
    color: var(--muted2);
}
.spinner {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 3px solid var(--spinner-track);
    border-top-color: var(--spinner-head);
    animation: spin 0.8s linear infinite;
}
.spinner.sm {
    width: 14px;
    height: 14px;
    border-width: 2px;
}
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
@keyframes pulseGlow {
    0%,
    100% {
        transform: scale(0.92);
        opacity: 0.72;
    }
    50% {
        transform: scale(1.08);
        opacity: 1;
    }
}
.macro-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}
.meal-summary {
    position: relative;
    overflow: hidden;
}
.meal-summary::before {
    content: "";
    position: absolute;
    left: -30%;
    top: -60%;
    width: 160%;
    height: 120%;
    background: none;
    pointer-events: none;
}
.meal-summary .card-title,
.meal-summary .muted,
.meal-summary .meal-boost,
.meal-summary .macro-row {
    position: relative;
    z-index: 1;
}
.meal-profile-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}
.meal-profile-chip {
    border-radius: 999px;
    padding: 8px 12px;
    border: 1px solid color-mix(in oklab, var(--accent-strong) 18%, var(--border));
    background: var(--card2);
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
}
.meal-boost {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--muted);
    margin-top: 6px;
}
.meal-boost .boost-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--accent-strong);
    box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 45%, transparent);
}
.pill {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--card2);
    font-size: 13px;
    font-weight: 700;
}
.pill b {
    font-weight: 800;
}

/* Fields */
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
}
.field span {
    font-size: 12px;
    color: var(--muted);
    font-weight: 650;
}
input,
select,
textarea {
    width: 100%;
    padding: 12px 12px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    outline: none;
    font-size: 14px;
    box-shadow: none;
}
select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2311120f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6l6-6'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px 16px;
    padding-right: 36px;
}
select::-ms-expand {
    display: none;
}
textarea {
    resize: none;
    min-height: 92px;
}
input::placeholder,
textarea::placeholder {
    color: color-mix(in oklab, var(--muted) 85%, transparent);
}
input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent-strong);
    box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 42%, transparent);
}

.grid2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Segmented */
.segmented {
    display: flex;
    background: var(--card2);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 4px;
    gap: 4px;
}
.seg {
    flex: 1;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--muted);
    padding: 10px 10px;
    font-weight: 750;
    font-size: 12px;
    cursor: pointer;
    transition:
        background 0.12s ease,
        color 0.12s ease,
        transform 0.12s ease;
}
.seg:hover {
    color: var(--text);
}
.seg:active {
    transform: scale(0.99);
}
.seg.active {
    background: var(--ink);
    color: #fff;
    box-shadow: var(--shadow2);
}

.settings-theme {
    border: 0;
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}

/* Accordion */
.accordion {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}
details {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--card);
    overflow: hidden;
}
summary {
    list-style: none;
    padding: 12px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
summary::-webkit-details-marker {
    display: none;
}
.sum-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.sum-title {
    font-weight: 800;
}
.sum-sub {
    font-size: 12px;
    color: var(--muted);
}
.sum-ic {
    width: 28px;
    height: 28px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--card2);
    display: grid;
    place-items: center;
}
.sum-ic svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    opacity: 0.92;
}
.details-body {
    padding: 0 12px 12px;
}
.meal-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 10px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--card2);
    margin-top: 8px;
}
.meal-row.clickable {
    cursor: pointer;
}
.meal-row.clickable:hover {
    border-color: var(--accent-strong);
    background: var(--card);
}
.meal-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.meal-title {
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 6px;
}
.meal-text {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.35;
}
.meal-right {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
    flex: 0 0 auto;
}
.kcal {
    font-weight: 900;
    font-size: 12px;
    color: var(--text);
}
.replace-btn {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    border-radius: 12px;
    padding: 8px 10px;
    font-weight: 750;
    font-size: 12px;
    cursor: pointer;
}
.replace-btn.loading {
    opacity: 0.8;
    cursor: default;
}
.meal-row.swap-out {
    opacity: 0.5;
    transform: translateY(2px);
}
.meal-row.swap-in {
    animation: swapIn 0.22s ease;
}
@keyframes swapIn {
    from {
        opacity: 0.2;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.replace-btn:hover {
    color: var(--text);
    background: var(--card);
}
.replace-btn:active {
    transform: scale(0.99);
}
.meal-ic {
    width: 22px;
    height: 22px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
}
.meal-ic svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
}
.meal-ic.breakfast {
    color: var(--warning);
    background: color-mix(in oklab, var(--warning) 30%, var(--card));
}
.meal-ic.lunch {
    color: var(--info);
    background: color-mix(in oklab, var(--info) 18%, var(--card));
}
.meal-ic.snack {
    color: var(--accent);
    background: var(--card2);
}
.meal-ic.dinner {
    color: var(--success);
    background: color-mix(in oklab, var(--success) 16%, var(--card));
}
.meal-detail-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 16px;
    border: 1px solid var(--border);
    margin-bottom: 10px;
}
.meal-detail-meta {
    font-size: 12px;
    color: var(--muted);
    margin-top: 6px;
}
.recipe-body {
    font-size: 13px;
    line-height: 1.55;
    color: var(--text);
}
.recipe-body p {
    margin: 8px 0;
}
.recipe-body h3,
.recipe-body h4 {
    margin: 12px 0 6px;
    font-size: 14px;
}
.recipe-body img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin: 8px 0;
}

/* History */
.history {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--card);
    cursor: pointer;
    transition:
        transform 0.12s ease,
        background 0.12s ease;
}
.history-item:hover {
    background: var(--card2);
}
.history-item:active {
    transform: scale(0.99);
}
.thumb {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: #0b0b0d;
    border: 1px solid var(--border);
    object-fit: cover;
    flex: 0 0 auto;
}
.hi-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.hi-title {
    font-weight: 800;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hi-sub {
    font-size: 12px;
    color: var(--muted);
}
.hi-kcal {
    margin-left: auto;
    font-weight: 900;
    font-size: 12px;
    color: var(--text);
    padding: 8px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--card2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    white-space: nowrap;
    line-height: 1;
}

.empty {
    padding: 10px 6px 0;
    font-size: 12px;
}

/* Workout cards */
.day-card {
    padding: 12px;
    border-radius: 18px;
    border: 0;
    background: transparent;
    box-shadow: none;
}
.day-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}
.day-title {
    font-weight: 900;
}
.day-sub {
    font-size: 12px;
    color: var(--muted);
}
.exercise {
    margin-top: 12px;
    padding: 12px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--card);
    box-shadow: var(--shadow2);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ex-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.ex-name {
    font-weight: 800;
    font-size: 14px;
}
.ex-meta {
    font-size: 12px;
    color: var(--muted);
    text-align: right;
    padding: 6px 8px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--card2);
    min-width: 78px;
}
.ex-actions {
    display: flex;
    justify-content: flex-start;
}
.exercise-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.step-params {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}
.step-param {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--card2);
    padding: 10px 8px;
    text-align: center;
}
.step-param-value {
    font-weight: 850;
    font-size: 16px;
    line-height: 1.1;
}
.step-param-label {
    margin-top: 4px;
    font-size: 11px;
    color: var(--muted);
}
.steps-list {
    display: grid;
    gap: 12px;
}
.step-gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 8px;
}
.step-videos {
    display: grid;
    gap: 10px;
}
.step-video-frame {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 0;
    border-radius: 12px;
    background: #0b0b0d;
}
.step-card {
    display: grid;
    gap: 10px;
    padding: 12px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--card);
}
.step-photo {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 12px;
    background: #0b0b0d;
}
.step-row {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 10px;
    align-items: start;
}
.step-num {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: var(--ink);
    color: var(--accent);
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
}
.step-text {
    font-size: 14px;
    line-height: 1.4;
}
.media-btn {
    border: 1px solid var(--border);
    background: transparent;
    border-radius: 16px;
    padding: 0;
    overflow: hidden;
    cursor: pointer;
    width: 100%;
}
.media-thumb {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
    background: #0b0b0d;
}
.media-ph {
    height: 140px;
    display: grid;
    place-items: center;
    color: var(--muted);
    background: #0b0b0d;
}
.media-ph svg {
    width: 34px;
    height: 34px;
    stroke: currentColor;
    fill: none;
    opacity: 0.85;
}
.media-cap {
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--text);
    background: color-mix(in oklab, var(--card) 72%, transparent);
}
.media-cap span {
    font-size: 12px;
    color: var(--muted);
}

/* Tabbar */
.tabbar {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(12px + var(--safe-bot));
    width: min(calc(var(--container) - 28px), calc(100% - 28px));
    padding: 8px;
    display: flex;
    gap: 6px;
    background: rgba(17, 18, 15, 0.94);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    box-shadow: var(--shadow);
    z-index: 20;
}
.tab {
    flex: 1;
    position: relative;
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.66);
    border-radius: 18px;
    padding: 6px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    box-shadow: none;
    transition:
        transform 0.12s ease,
        color 0.12s ease;
}
.tab:hover {
    color: #fff;
}
.tab:active {
    transform: scale(0.99);
}
.tab.active {
    color: var(--accent);
}
.tab-ic {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    border: 1px solid transparent;
}
.tab.active .tab-ic {
    background: rgba(169, 241, 15, 0.15);
    border-color: rgba(169, 241, 15, 0.42);
}
.tab-ic svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    opacity: 0.95;
}
.tab-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Modal */
body.modal-open {
    overflow: hidden;
}
.modal-root {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 50;
}
.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(8, 10, 6, 0.7);
    backdrop-filter: blur(16px) saturate(1.08);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 14px;
    padding-bottom: calc(14px + var(--safe-bot));
    pointer-events: auto;
    animation: modalOverlayIn 0.18s ease;
    overscroll-behavior: contain;
}
@keyframes modalOverlayIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal {
    width: min(var(--container), 100%);
    position: relative;
    isolation: isolate;
    border-radius: 28px;
    border: 1px solid color-mix(in oklab, var(--accent) 12%, var(--border));
    background:
        radial-gradient(
            120% 120% at 12% 0%,
            color-mix(in oklab, var(--accent) 14%, transparent),
            transparent 44%
        ),
        linear-gradient(
            180deg,
            color-mix(in oklab, var(--card2) 94%, var(--bg-elev)) 0%,
            color-mix(in oklab, var(--card) 90%, var(--bg)) 100%
        );
    box-shadow:
        0 28px 72px rgba(0, 0, 0, 0.42),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    overflow: hidden;
    max-height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
    animation: modalCardIn 0.22s cubic-bezier(0.2, 0.9, 0.25, 1);
}
.modal::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 28%),
        radial-gradient(
            90% 70% at 50% 100%,
            rgba(169, 241, 15, 0.05),
            transparent 70%
        );
    pointer-events: none;
    z-index: 0;
}
@keyframes modalCardIn {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 18px 18px 10px;
    background: transparent;
    position: relative;
    z-index: 1;
}
.modal-title {
    font-size: 18px;
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -0.02em;
    max-width: calc(100% - 64px);
}
.modal-body {
    padding: 8px 18px 0;
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    position: relative;
    z-index: 1;
}
.modal-body .muted {
    line-height: 1.55;
}
.modal-body > .muted:first-child:last-child {
    padding: 18px 18px 20px;
    border-radius: 22px;
    border: 1px solid rgba(169, 241, 15, 0.12);
    background:
        linear-gradient(
            180deg,
            rgba(255, 255, 255, 0.025),
            rgba(255, 255, 255, 0.01)
        ),
        color-mix(in oklab, var(--card2) 72%, var(--bg));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}
.modal-close {
    width: 52px;
    height: 52px;
    border-radius: 18px;
    border: 1px solid color-mix(in oklab, var(--accent) 10%, var(--border));
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent),
        color-mix(in oklab, var(--card2) 82%, var(--bg));
    color: var(--text);
    display: grid;
    place-items: center;
    cursor: pointer;
    flex: 0 0 auto;
    box-shadow:
        0 10px 24px rgba(0, 0, 0, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transition:
        transform 0.12s ease,
        border-color 0.12s ease,
        background 0.12s ease,
        box-shadow 0.12s ease;
}
.modal-close svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    opacity: 0.92;
}
.modal-close:hover {
    transform: translateY(-1px);
    border-color: color-mix(in oklab, var(--accent) 26%, var(--border));
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent),
        color-mix(in oklab, var(--accent) 10%, var(--card2));
    box-shadow:
        0 14px 28px rgba(0, 0, 0, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.modal-close:active {
    transform: scale(0.98);
}

.modal-footer {
    padding: 16px 18px 18px;
    background: transparent;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    position: relative;
    z-index: 1;
}
.modal-footer .btn {
    box-shadow: none;
    min-height: 58px;
    border-radius: 18px;
}
.modal-footer .trial-upsell-btn {
    min-height: 66px;
    gap: 14px;
    font-size: 17px;
    font-weight: 850;
}
.modal-footer .trial-upsell-btn img.emoji {
    width: 24px;
    height: 24px;
    margin: 0;
}
.modal-footer .btn.secondary,
.modal-footer .btn.ghost {
    background: color-mix(in oklab, var(--card2) 82%, var(--bg));
}
@media (max-width: 420px) {
    .modal {
        border-radius: 26px;
    }
    .modal-head {
        padding: 16px 16px 8px;
    }
    .modal-body {
        padding: 8px 16px 0;
    }
    .modal-footer {
        padding: 14px 16px 16px;
    }
}

/* Media modal */
.media-view {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.media-full {
    width: 100%;
    border-radius: 18px;
    border: 1px solid var(--border);
    overflow: hidden;
    background: #0b0b0d;
}
.media-full img,
.media-full video {
    width: 100%;
    height: auto;
    display: block;
}

/* Crop modal */
.crop-wrap {
    width: 100%;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #0b0b0d;
}
.crop-wrap img {
    width: 100%;
    height: auto;
    display: block;
}

/* Toasts */
.toast-root {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    top: 0;
    width: min(var(--container), 100%);
    padding: 10px 14px;
    padding-top: calc(10px + var(--safe-top));
    z-index: 60;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    pointer-events: auto;
    padding: 12px 12px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: color-mix(in oklab, var(--card) 96%, transparent);
    box-shadow: var(--shadow2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    animation: toastIn 0.14s ease;
}
@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.toast .t-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.toast .t-title {
    font-weight: 900;
    font-size: 13px;
}
.toast .t-msg {
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.toast .t-x {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    width: 34px;
    height: 34px;
    border-radius: 12px;
    cursor: pointer;
}
.toast.success {
    border-color: color-mix(in oklab, var(--success) 55%, var(--border));
}
.toast.error {
    border-color: color-mix(in oklab, var(--danger) 55%, var(--border));
}

/* Skeleton */
.skeleton-card {
    height: 88px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: var(--card2);
    animation: pulse 1.05s ease-in-out infinite;
}
.skeleton-line {
    height: 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--card2);
    animation: pulse 1.05s ease-in-out infinite;
}
.w60 {
    width: 60%;
}
.w70 {
    width: 70%;
}
.w85 {
    width: 85%;
}
@keyframes pulse {
    0%,
    100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
}

/* Tight screens */
@media (max-width: 360px) {
    .grid2 {
        grid-template-columns: 1fr;
    }
    .macro-top {
        align-items: flex-start;
    }
    .photo-actions {
        grid-template-columns: 1fr;
    }
}
