/* Dark theme (default and only mode for now).
   All colors flow through these variables — to add a light mode later,
   override this block under a [data-theme="light"] selector. */
:root {
    color-scheme: dark;                 /* native controls (date/time pickers, scrollbars) render dark */
    --bg: #010104;                      /* page background (near-black) */
    --surface: #0e0e13;                 /* cards, header, tables */
    --surface-2: #17171e;               /* insets: inputs, table headers */
    --chat-user: #2b2b34;               /* user's chat bubble (distinct dark gray) */
    --ink: #f4f4f7;                     /* primary text */
    --muted: #9a9aa6;                   /* secondary text */
    --line: #26262e;                    /* borders / dividers */
    --accent: #cffe25;                  /* lime accent */
    --accent-dark: #b7e820;             /* accent hover */
    --accent-ink: #010104;              /* text on accent surfaces */
    --good: #cffe25;                    /* progress fill — lime accent */
    --danger: #f0476b;                  /* over-limit / destructive (rose-red, leans magenta) */
    --radius: 12px;
    --shadow: 0 1px 2px rgba(0,0,0,.5), 0 10px 30px rgba(0,0,0,.4);
    --maxw: 860px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Lexend', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-weight: 300;              /* light by default; explicit weights below add emphasis */
    color: var(--ink);
    background: var(--bg);
    line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 { font-family: 'Montserrat', 'Lexend', sans-serif; font-weight: 300; }
strong, b, th { font-weight: 400; }   /* no bold anywhere — cap emphasis at medium */

a { color: var(--accent); }

/* ---------- header / footer ---------- */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;   /* brand left, account actions right */
    gap: 1rem;
    padding: calc(.85rem + env(safe-area-inset-top)) clamp(1rem, 4vw, 2rem) .85rem;
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 10;
}
.brand { display: inline-flex; align-items: center; gap: .35rem; font-family: 'Montserrat', 'Lexend', sans-serif; font-weight: 400; font-size: 1.4rem; text-decoration: none; color: var(--ink); }
.brand-bolt { width: 1.05em; height: 1.05em; fill: var(--accent); flex: none; }
.site-header nav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.site-header nav a { text-decoration: none; color: var(--ink); font-weight: 400; }
.site-header nav a:hover { color: var(--accent); }
.site-header nav a.active { color: var(--accent); font-weight: 400; }   /* current page */
.site-header nav a.btn { color: var(--accent-ink); }                    /* keep the pill button's dark text */
.site-header nav a.who { color: var(--muted); font-weight: 400; }       /* greeting reads quieter... */
.site-header nav a.who:hover { color: var(--accent); }
.site-header nav a.who.active { color: var(--accent); }                 /* ...but greens on the profile page */
/* header menu button (opens the fullscreen nav overlay) — shown at all widths.
   Two bars that rotate into an X when open (tied to aria-expanded, so it morphs
   instantly on click). */
.header-menu { display: inline-flex; align-items: center; justify-content: center; background: none; border: none; color: var(--ink); cursor: pointer; padding: .3rem; }
.header-menu .hb { position: relative; display: block; width: 26px; height: 18px; }
.header-menu .hb i {
    position: absolute; left: 0; right: 0; height: 2px; background: currentColor; border-radius: 2px;
    transition: transform .3s ease, top .3s ease;
}
.header-menu .hb i:nth-child(1) { top: 5px; }
.header-menu .hb i:nth-child(2) { top: 11px; }
.header-menu[aria-expanded="true"] .hb i:nth-child(1) { top: 8px; transform: rotate(45deg); }
.header-menu[aria-expanded="true"] .hb i:nth-child(2) { top: 8px; transform: rotate(-45deg); }
body.nav-open .site-header { z-index: 90; }   /* keep the hamburger above the overlay to close */
.who { color: var(--muted); font-size: .9rem; }

/* floating navigation (white bolt FAB, bottom-left) */
/* pull-to-refresh (touch app pages) — disable native overscroll so ours owns the gesture */
body.has-ptr { overscroll-behavior-y: contain; }
.ptr {
    position: fixed; left: 0; right: 0; top: -54px; height: 54px; z-index: 55;
    display: flex; align-items: center; justify-content: center;
    pointer-events: none; will-change: transform;
}
.ptr.snap { transition: transform .25s cubic-bezier(.2,.7,.2,1); }
.ptr-circle {
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--surface-2); border: 1px solid var(--line);
    box-shadow: 0 8px 22px rgba(0,0,0,.55);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity .15s ease;
}
.ptr.active .ptr-circle { opacity: 1; }
.ptr-icon { width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ptr.ready .ptr-icon { stroke: var(--accent); }
.ptr.refreshing .ptr-icon { stroke: var(--accent); animation: ptrSpin .7s linear infinite; transform-origin: 50% 50%; }
@keyframes ptrSpin { to { transform: rotate(360deg); } }

.navfab { position: relative; }
.navfab-toggle {
    position: relative; z-index: 2;
    width: 58px; height: 58px; border-radius: 50%;
    background: #fff; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 24px rgba(0,0,0,.55);
    transition: transform .15s ease, box-shadow .15s ease;
}
.navfab-toggle:hover { transform: translateY(-1px); box-shadow: 0 11px 28px rgba(0,0,0,.62); }
.navfab-bolt { width: 28px; height: 28px; fill: #010104; }
/* fullscreen menu overlay — opened by the bolt FAB, sits BELOW the fab-bar (z 80)
   so the floating toolbar stays crisp and visible on top */
.navmenu {
    position: fixed; inset: 0; z-index: 70;
    display: flex; align-items: center; justify-content: center;
    padding: 2rem 2rem 6rem;
    background: var(--bg);   /* solid overlay (no live backdrop blur — it janks on iOS) */
    opacity: 0; visibility: hidden;   /* revealed by GSAP; .open is the no-JS fallback */
}
.navmenu.open { opacity: 1; visibility: visible; }
.navmenu-nav { display: flex; flex-direction: column; align-items: center; gap: clamp(1rem, 3.5vh, 1.9rem); text-align: center; }
.navmenu-form { margin: 0; }
.navmenu-item {
    font-family: 'Montserrat', 'Lexend', sans-serif; font-weight: 300;
    font-size: clamp(2.2rem, 9vw, 3.75rem); line-height: 1;
    color: var(--ink); text-decoration: none;
    background: none; border: none; cursor: pointer; padding: 0;
    transition: color .18s ease, transform .18s ease;
}
.navmenu-item:hover, .navmenu-item:focus-visible { color: var(--accent); outline: none; }
.navmenu-item.active { color: var(--accent); }
body.nav-open { overflow: hidden; }

.site-footer {
    text-align: center;
    color: var(--muted);
    font-size: .85rem;
    padding: 2.5rem 1rem;
}

.container { max-width: var(--maxw); margin: 0 auto; padding: clamp(0.625rem, 2vw, 1.25rem) clamp(0.5rem, 2vw, 0.75rem); }

/* ---------- buttons ---------- */
.btn {
    display: inline-block;
    background: var(--accent);
    color: var(--accent-ink);
    border: 1px solid var(--accent);
    padding: .55rem 1rem;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 400;
    font-size: .95rem;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}
.btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-lg { padding: .75rem 1.5rem; font-size: 1.05rem; }
.btn-sm { padding: .35rem .8rem; font-size: .85rem; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: rgba(207,254,37,.10); border-color: var(--accent); color: var(--ink); }
.link-btn {
    background: none; border: none; color: var(--accent);
    cursor: pointer; font: inherit; padding: 0; text-decoration: underline;
}
.link-btn.danger { color: var(--danger); }
.inline { display: inline; }
/* rows beyond the first 5 are hidden until "Show N more" */
.acc-item.entry-extra { display: none; }
.show-more-wrap { text-align: center; margin-top: .85rem; }

/* delete now lives at the bottom-right of the expanded entry detail */
.entry-detail-actions { display: flex; justify-content: flex-end; margin-top: .85rem; }
.entry-del-btn {
    background: none; border: none; cursor: pointer; font: inherit; font-size: .85rem;
    color: var(--muted); padding: .35rem .6rem; border-radius: 8px;
    display: inline-flex; align-items: center; gap: .4rem;
    transition: color .15s ease, background .15s ease;
}
.entry-del-btn:hover, .entry-del-btn:focus { color: var(--danger); background: rgba(240,71,107,.12); outline: none; }
.entry-del-btn span { font-size: .95em; }

/* ---------- flash / alerts ---------- */
.flash {
    max-width: var(--maxw); margin: 1rem auto 0;
    background: rgba(116,214,143,.12); border: 1px solid rgba(116,214,143,.30); color: #a9e9c0;
    padding: .7rem 1rem; border-radius: var(--radius);
}
.alert {
    background: rgba(240,71,107,.12); border: 1px solid rgba(240,71,107,.35); color: #ffb0c2;
    padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: 1rem;
}

/* ============================ landing page ============================ */
body.landing-page {
    background:
        radial-gradient(58% 42% at 50% -6%, rgba(207,254,37,.11), transparent 62%),
        radial-gradient(45% 35% at 92% 6%, rgba(207,254,37,.06), transparent 55%),
        var(--bg);
}
/* header blends into the gradient (transparent, floats over the hero) */
body.landing-page .site-header { display: none; }   /* no header on the landing — logo lives above the hero headline */
body.landing-page .container { max-width: 1080px; padding-left: clamp(1.25rem, 5vw, 2rem); padding-right: clamp(1.25rem, 5vw, 2rem); }
/* clip the decorative phone backlight so it can't cause horizontal scroll on mobile */
.landing { overflow-x: clip; }

/* shared gradient CTA with lift + shine sweep */
.btn-cta {
    position: relative; overflow: hidden; border: none; color: var(--accent-ink);
    background: linear-gradient(135deg, #e6ff6b 0%, #cffe25 45%, #a8e30b 100%);
    box-shadow: 0 12px 34px rgba(207,254,37,.26), 0 2px 8px rgba(0,0,0,.4);
    transition: transform .18s ease, box-shadow .18s ease;
}
.btn-cta > span { position: relative; z-index: 1; }
.btn-cta::after {
    content: ""; position: absolute; top: 0; left: -75%; width: 55%; height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255,255,255,.5), transparent);
    transform: skewX(-20deg); pointer-events: none;
}
.btn-cta:hover { transform: translateY(-2px); box-shadow: 0 18px 46px rgba(207,254,37,.4), 0 4px 12px rgba(0,0,0,.5); }
.btn-cta:hover::after { animation: authShine .75s ease; }
.btn-cta:active { transform: translateY(0) scale(.99); }

/* ---- hero ---- */
.lp-hero { display: flex; flex-direction: column; align-items: center; text-align: center; padding: clamp(2.5rem, 7vh, 4.5rem) 0 0; }
.lp-hero-copy { max-width: 960px; animation: authIn .7s cubic-bezier(.2,.7,.2,1) both; }
/* centered brand logo above the headline (landing has no header) */
.lp-brand { display: inline-flex; align-items: center; gap: .55rem; font-family: 'Montserrat', 'Lexend', sans-serif; font-weight: 400; font-size: clamp(1.9rem, 4.2vw, 2.5rem); color: var(--ink); text-decoration: none; margin-bottom: clamp(2rem, 6vw, 3.5rem); }
.lp-brand .brand-bolt { width: 1.5em; height: 1.5em; fill: var(--accent); flex: none; filter: drop-shadow(0 0 10px rgba(207,254,37,.55)); }
.lp-eyebrow { display: inline-flex; align-items: center; gap: .55rem; font-size: .72rem; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: .42rem .95rem; background: rgba(255,255,255,.02); }
.lp-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px rgba(207,254,37,.85); }
.lp-title { font-family: 'Montserrat', 'Lexend', sans-serif; font-weight: 400; font-size: clamp(2.2rem, 6vw, 4.2rem); line-height: 1.05; letter-spacing: -.025em; margin: 1.7rem 0 0; }
.lp-lede { font-size: clamp(1.05rem, 2vw, 1.24rem); line-height: 1.6; color: var(--muted); max-width: 46ch; margin: 1.4rem auto 0; }
.lp-cta { display: flex; flex-direction: column; align-items: center; gap: 1rem; margin-top: 2.3rem; }
.lp-cta-alt { display: inline-block; color: var(--muted); text-decoration: none; font-size: .95rem; border-bottom: 1px solid transparent; transition: color .15s ease, border-color .15s ease; }
.lp-cta-alt:hover { color: var(--ink); border-bottom-color: var(--line); }
/* the closing CTA reuses .lp-cta; the title already provides the top gap */
.lp-closing .lp-cta { margin-top: 0; }

/* ---- product preview (built from the app's own components) ---- */
.lp-preview { position: relative; margin-top: clamp(3.5rem, 8vw, 5.5rem); width: 100%; max-width: 390px; animation: authIn .8s cubic-bezier(.2,.7,.2,1) .12s both; }
.lp-glow { position: absolute; inset: -18% -12% -8%; z-index: 0; background: radial-gradient(50% 50% at 50% 42%, rgba(207,254,37,.22), transparent 70%); filter: blur(22px); pointer-events: none; }
.lp-card { position: relative; z-index: 1; background: linear-gradient(180deg, rgba(24,25,31,.92), rgba(13,13,18,.92)); border: 1px solid var(--line); border-radius: 22px; padding: 1.6rem 1.6rem 1.9rem; box-shadow: 0 34px 80px rgba(0,0,0,.55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.lp-card-head { text-align: center; font-size: .95rem; margin-bottom: 1.1rem; }
.lp-card-head .lp-muted { color: var(--muted); }
.lp-ring-wrap { position: relative; width: 152px; height: 152px; margin: 0 auto 1.5rem; }
.lp-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.lp-ring-track { fill: none; stroke: var(--line); stroke-width: 7; }
.lp-ring-arc { fill: none; stroke: var(--accent); stroke-width: 7; stroke-linecap: round; filter: drop-shadow(0 0 6px rgba(207,254,37,.5)); }
.lp-ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.lp-ring-num { font-size: 2rem; font-variant-numeric: tabular-nums; }
.lp-ring-unit { font-size: .78rem; color: var(--muted); margin-top: .1rem; }
.lp-macros { display: flex; flex-direction: column; gap: .9rem; }
.lp-macro-top { display: flex; justify-content: space-between; font-size: .82rem; margin-bottom: .38rem; }
.lp-macro-pct { color: var(--accent); font-variant-numeric: tabular-nums; }
.lp-macro-bar { height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.lp-macro-bar > span { display: block; height: 100%; border-radius: 4px; background: var(--good); }

/* ---- product preview: real screenshot in a phone frame ---- */
.lp-preview-shot { max-width: 300px; }
/* two-tone backlight — lime from the upper-left, dark magenta from the lower-right */
.lp-preview-shot .lp-glow {
    inset: -6% -30% -6%;
    background:
        radial-gradient(42% 52% at 20% 34%, rgba(207,254,37,.26), transparent 70%),
        radial-gradient(48% 58% at 82% 68%, rgba(190,42,132,.24), transparent 70%);
    filter: blur(26px);
}
.lp-phone {
    position: relative; z-index: 1; border-radius: 42px; padding: 9px;
    background: linear-gradient(160deg, #26272e, #0b0b0f);
    border: 1px solid rgba(255,255,255,.09);
    box-shadow: 0 42px 90px rgba(0,0,0,.6), inset 0 0 0 1px rgba(255,255,255,.03);
}
.lp-shot-img { display: block; width: 100%; height: auto; border-radius: 34px; }

/* ---- hero stage: phone + floating benefit cards ---- */
.lp-stage { position: relative; width: 100%; max-width: 880px; margin: clamp(3.5rem, 8vw, 5.5rem) auto 0; display: flex; justify-content: center; }
.lp-stage .lp-preview { margin-top: 0; }
.lp-float {
    position: absolute; z-index: 3;
    background: linear-gradient(180deg, rgba(27,28,34,.95), rgba(14,14,19,.95));
    border: 1px solid var(--line); border-radius: 16px;
    box-shadow: 0 22px 48px rgba(0,0,0,.5);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    animation: lpFloat 6.5s ease-in-out infinite;
}
/* trend card (top-left) */
.lp-float-trend { top: 20%; left: 0; width: 208px; padding: .95rem 1.05rem 1.05rem; }
.lp-float-label { font-size: .7rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.lp-trend-val { font-family: 'Montserrat', 'Lexend', sans-serif; font-size: 1.5rem; line-height: 1; margin: .35rem 0 .1rem; font-variant-numeric: tabular-nums; }
.lp-trend-val span { font-family: 'Lexend', sans-serif; font-size: .72rem; color: var(--muted); }
.lp-spark { display: block; width: 100%; height: 32px; margin: .5rem 0 .5rem; filter: drop-shadow(0 0 5px rgba(207,254,37,.4)); }
.lp-float-sub { font-size: .76rem; color: var(--muted); }
/* round % badge (lower-left) */
/* AI assistant chat card (lower-left) */
.lp-float-ai { top: 60%; left: 0; width: 208px; padding: .85rem .9rem .9rem; animation-delay: .9s; }
.lp-ai-row { display: flex; align-items: flex-end; gap: .4rem; }
.lp-ai-row + .lp-ai-row { margin-top: .5rem; }
.lp-ai-user { justify-content: flex-end; }
.lp-ai-bubble { margin: 0; font-size: .76rem; line-height: 1.35; padding: .45rem .6rem; border-radius: 13px; max-width: 84%; }
.lp-ai-user .lp-ai-bubble { background: var(--surface-2); border: 1px solid var(--line); border-bottom-right-radius: 4px; text-align: right; }
.lp-ai-bubble-bot { background: rgba(207,254,37,.12); border: 1px solid rgba(207,254,37,.28); color: var(--ink); border-bottom-left-radius: 4px; text-align: left; }
.lp-ai-ic { flex: 0 0 auto; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--accent); display: inline-flex; align-items: center; justify-content: center; }
.lp-ai-ic svg { width: .8rem; height: .8rem; fill: var(--accent-ink); }
/* benefit card (right) */
/* calories card (right) */
.lp-float-cal { top: 47%; right: 0; width: 208px; padding: 1rem 1.05rem 1.1rem; animation-delay: 1.5s; }
.lp-cal-head { display: flex; align-items: center; gap: .5rem; font-size: .9rem; }
.lp-cal-ic { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 1.6rem; height: 1.6rem; border-radius: 8px; background: rgba(207,254,37,.12); border: 1px solid rgba(207,254,37,.28); }
.lp-cal-ic svg { width: .95rem; height: .95rem; fill: var(--accent); }
.lp-gauge-wrap { position: relative; width: 138px; margin: .55rem auto .1rem; }
.lp-gauge { display: block; width: 100%; height: auto; overflow: visible; }
.lp-gauge-track { fill: none; stroke: var(--line); stroke-width: 9; stroke-linecap: round; }
.lp-gauge-arc { fill: none; stroke: var(--accent); stroke-width: 9; stroke-linecap: round; filter: drop-shadow(0 0 5px rgba(207,254,37,.45)); }
.lp-gauge-center { position: absolute; left: 0; right: 0; bottom: 0; text-align: center; }
.lp-gauge-num { display: block; font-family: 'Montserrat', 'Lexend', sans-serif; font-size: 1.4rem; line-height: 1; font-variant-numeric: tabular-nums; }
.lp-gauge-cap { display: block; font-size: .66rem; color: var(--muted); margin-top: .22rem; }
.lp-cal-cells { display: flex; gap: .7rem; margin-top: .85rem; }
.lp-cal-cell { flex: 1; }
.lp-cal-cv { font-size: .84rem; font-variant-numeric: tabular-nums; }
.lp-cal-cv span { display: block; font-size: .66rem; color: var(--muted); }
.lp-cal-cbar { height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; margin-top: .4rem; }
.lp-cal-cbar i { display: block; height: 100%; border-radius: 4px; background: var(--good); }
/* chip (top-right) */
/* MCP connectivity card (top-right) */
.lp-float-mcp { top: 17%; right: 0; width: 208px; padding: .9rem 1rem 1rem; animation-delay: 2.1s; }
.lp-mcp-link { display: flex; align-items: center; margin: .75rem 0 .65rem; }
.lp-mcp-node { flex: 0 0 auto; width: 2.4rem; height: 2.4rem; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); border: 1px solid var(--line); }
.lp-mcp-node svg { width: 1.2rem; height: 1.2rem; }
.lp-mcp-node-app svg { fill: var(--accent); }
.lp-mcp-node-ai svg { fill: var(--accent); }
.lp-mcp-wire { position: relative; flex: 1; height: 2px; margin: 0 .2rem; border-radius: 2px; background: linear-gradient(90deg, var(--line), rgba(207,254,37,.55), var(--line)); }
.lp-mcp-wire i { position: absolute; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px rgba(207,254,37,.9); animation: lpWire 2.4s ease-in-out infinite; }
@keyframes lpWire { 0% { left: 2%; opacity: 0; } 15% { opacity: 1; } 82% { opacity: 1; } 100% { left: 90%; opacity: 0; } }

@keyframes lpFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@media (max-width: 920px) { .lp-float { display: none; } }

/* ---- feature trio ---- */
.lp-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(2rem, 4vw, 3.5rem); padding: clamp(3rem, 8vw, 6rem) 0; border-top: 1px solid var(--line); }
.lp-feature { display: flex; flex-direction: column; }
.lp-ficon { display: inline-flex; align-items: center; justify-content: center; width: 3rem; height: 3rem; border-radius: 14px; background: rgba(207,254,37,.10); border: 1px solid rgba(207,254,37,.25); margin-bottom: 1.2rem; }
.lp-ficon svg { width: 1.45rem; height: 1.45rem; fill: none; stroke: var(--accent); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.lp-feature h3 { font-size: 1.16rem; margin: 0 0 .55rem; font-weight: 400; }
.lp-feature p { margin: 0; color: var(--muted); line-height: 1.62; font-size: .95rem; }

/* ---- how it works ---- */
.lp-how { padding: clamp(3rem, 8vw, 6rem) 0; border-top: 1px solid var(--line); }
.lp-h2 { font-family: 'Montserrat', 'Lexend', sans-serif; font-weight: 400; font-size: clamp(1.8rem, 4vw, 2.6rem); letter-spacing: -.015em; text-align: center; margin: 0 0 clamp(2.5rem, 6vw, 4rem); }
.lp-steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(2rem, 4vw, 3.5rem); }
.lp-stepn { display: block; font-family: 'Montserrat', 'Lexend', sans-serif; font-size: 2.4rem; font-weight: 300; color: var(--accent); margin-bottom: .55rem; }
.lp-step h3 { font-size: 1.1rem; margin: 0 0 .4rem; font-weight: 400; }
.lp-step p { margin: 0; color: var(--muted); line-height: 1.62; font-size: .95rem; }

/* ---- closing ---- */
.lp-closing { position: relative; text-align: center; overflow: hidden; padding: clamp(3.5rem, 8vw, 5.5rem) 1.5rem clamp(4.5rem, 11vw, 7.5rem); }
.lp-glow-closing { position: absolute; inset: auto 0 -45% 0; height: 130%; background: radial-gradient(50% 60% at 50% 100%, rgba(207,254,37,.15), transparent 70%); filter: blur(12px); pointer-events: none; }
.lp-closing-title { position: relative; font-family: 'Montserrat', 'Lexend', sans-serif; font-weight: 400; font-size: clamp(1.8rem, 4.5vw, 3rem); letter-spacing: -.02em; line-height: 1.12; max-width: 20ch; margin: 0 auto clamp(2rem, 4vw, 2.5rem); }
.lp-closing .btn-cta { position: relative; }
.lp-closing-sub { position: relative; color: var(--muted); font-size: .9rem; margin: 1.4rem 0 0; }

@media (max-width: 760px) {
    .lp-features, .lp-steps { grid-template-columns: 1fr; }
}

/* ---------- auth pages (login / register) — immersive, card-less ---------- */
/* full-bleed gradient backdrop; header + footer hidden for a focused experience */
body.auth-page {
    background:
        radial-gradient(135% 95% at 50% -20%, rgba(207,254,37,.13), transparent 55%),
        radial-gradient(90% 70% at 88% 118%, rgba(207,254,37,.055), transparent 55%),
        var(--bg);
}
body.auth-page .site-header,
body.auth-page .site-footer { display: none; }

/* fixed "Back" link, top-left — arrow slides on hover */
.auth-back {
    position: fixed; z-index: 30;
    top: clamp(1rem, 3vw, 1.6rem); left: clamp(1rem, 3vw, 1.6rem);
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .45rem .55rem;
    color: var(--muted); text-decoration: none;
    font-weight: 300; font-size: .95rem;
    transition: color .18s ease;
}
.auth-back svg {
    width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor;
    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
    transition: transform .28s cubic-bezier(.2, .7, .2, 1);
}
.auth-back span { transition: transform .28s cubic-bezier(.2, .7, .2, 1); }
.auth-back:hover { color: var(--ink); }
.auth-back:hover svg { transform: translateX(-4px); }
.auth-back:hover span { transform: translateX(-1px); }

.container.auth-page {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 1.9rem; min-height: 100svh;
}

/* stacked, glowing logo */
.auth-brand {
    display: flex; flex-direction: column; align-items: center; gap: .55rem;
    font-family: 'Montserrat', 'Lexend', sans-serif; font-weight: 400; font-size: 2rem;
    color: var(--ink); text-decoration: none;
    animation: authIn .7s cubic-bezier(.2, .7, .2, 1) both;
}
.auth-brand .brand-bolt { width: 4.6rem; height: 4.6rem; animation: boltGlow 3.6s ease-in-out infinite; }

/* the form — no card, floats on the gradient */
.auth {
    width: 100%; max-width: 360px; margin: 0;
    background: none; border: none; box-shadow: none; padding: 0;
    animation: authIn .7s cubic-bezier(.2, .7, .2, 1) .09s both;
}
.auth h1 { margin: 0 0 .3rem; font-size: 1.5rem; font-weight: 400; text-align: center; }
.auth-sub { margin: 0 0 1.7rem; text-align: center; color: var(--muted); font-size: .92rem; }
.auth .stack { display: flex; flex-direction: column; gap: 1.05rem; }

.auth label { display: flex; flex-direction: column; gap: .45rem; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.auth label small { text-transform: none; letter-spacing: 0; font-size: .8rem; }
.auth input {
    width: 100%; background: rgba(255,255,255,.035); border: 1px solid var(--line);
    border-radius: 12px; padding: .85rem .95rem; color: var(--ink); font-size: 1rem;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.auth input::placeholder { color: var(--muted); }
.auth input:focus {
    outline: none; border-color: var(--accent); background: rgba(255,255,255,.06);
    box-shadow: 0 0 0 3px rgba(207,254,37,.16);
}
.auth input:-webkit-autofill {
    -webkit-text-fill-color: var(--ink); caret-color: var(--ink);
    -webkit-box-shadow: 0 0 0 1000px #0e0f12 inset;
}

/* gradient CTA with lift + shine sweep */
.auth .btn {
    position: relative; overflow: hidden; margin-top: .6rem; width: 100%;
    border: none; border-radius: 999px; cursor: pointer;
    padding: .95rem 1.5rem; font-family: 'Lexend', sans-serif; font-size: 1rem; font-weight: 400;
    color: var(--accent-ink);
    background: linear-gradient(135deg, #e6ff6b 0%, #cffe25 45%, #a8e30b 100%);
    box-shadow: 0 12px 34px rgba(207,254,37,.28), 0 2px 8px rgba(0,0,0,.45);
    transition: transform .18s ease, box-shadow .18s ease;
}
.auth .btn > span { position: relative; z-index: 1; }
.auth .btn::after {
    content: ""; position: absolute; top: 0; left: -75%; width: 55%; height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255,255,255,.55), transparent);
    transform: skewX(-20deg); pointer-events: none;
}
.auth .btn:hover { transform: translateY(-2px); box-shadow: 0 18px 46px rgba(207,254,37,.42), 0 4px 12px rgba(0,0,0,.5); }
.auth .btn:hover::after { animation: authShine .75s ease; }
.auth .btn:active { transform: translateY(0) scale(.99); }

.auth p.muted, .auth label small { font-weight: 300; }
.auth p.muted { text-align: center; margin: 1.5rem 0 0; }
.auth p.muted a { color: var(--accent); text-decoration: none; }
.auth p.muted a:hover { text-decoration: underline; }
.auth .alert { margin-bottom: 1.1rem; }

/* ---------- OAuth consent screen (standalone) ---------- */
.oauth-consent { width: 100%; max-width: 420px; margin: 0; text-align: center; animation: authIn .5s cubic-bezier(.2,.7,.2,1) both; }
.oauth-consent h1 { font-family: 'Montserrat', 'Lexend', sans-serif; font-weight: 400; font-size: 1.5rem; margin: 0 0 .35rem; }
.oauth-consent .auth-sub { color: var(--muted); margin: 0 0 1.5rem; }
.oauth-asuser { display: flex; flex-direction: column; gap: .1rem; font-size: .92rem; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.02); margin-bottom: 1.4rem; }
.oauth-asuser span { color: var(--muted); font-size: .82rem; }
.oauth-scopes { list-style: none; padding: 0; margin: 0 0 1.7rem; text-align: left; display: flex; flex-direction: column; gap: .8rem; }
.oauth-scopes li { display: flex; gap: .7rem; align-items: flex-start; font-size: .92rem; line-height: 1.5; color: var(--ink); }
.oauth-check { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 1.6rem; height: 1.6rem; border-radius: 8px; background: rgba(207,254,37,.12); border: 1px solid rgba(207,254,37,.28); margin-top: .05rem; }
.oauth-check svg { width: .95rem; height: .95rem; fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.oauth-actions { display: flex; flex-direction: column; gap: .7rem; margin: 0 0 1.4rem; }
.oauth-actions .btn { width: 100%; text-align: center; }
.oauth-client-meta { font-size: .78rem; color: var(--muted); margin: 0 0 .8rem; word-break: break-word; }
.oauth-client-meta a { color: var(--muted); }
.oauth-client-meta code { font-size: .92em; color: var(--ink); }

@keyframes authIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes boltGlow {
    0%, 100% { filter: drop-shadow(0 0 13px rgba(207,254,37,.40)); }
    50%      { filter: drop-shadow(0 0 22px rgba(207,254,37,.62)); }
}
@keyframes authShine { from { left: -75%; } to { left: 135%; } }

/* ---------- forms ---------- */
.stack { display: grid; gap: 1rem; }
.stack label, .row-form label, .grid-2 label, .grid-3 label, .row label, .nutrient-input {
    display: grid; gap: .3rem; font-weight: 400; font-size: .9rem;
}
input, select {
    font: inherit; padding: .55rem .65rem;
    border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--ink);
    width: 100%;
}
input:focus, select:focus { outline: 2px solid rgba(207,254,37,.35); border-color: var(--accent); }
.muted { color: var(--muted); font-weight: 400; }
small.muted { font-size: .8rem; }
.hint { color: var(--muted); font-size: .85rem; margin: .4rem 0 0; }

fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.15rem 1.25rem; margin: 0; }
legend { font-weight: 400; padding: 0 .4rem; }

.grid-2 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid-3 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.row { display: flex; gap: 1rem; flex-wrap: wrap; align-items: end; }
.row > label { flex: 1 1 140px; }

.nutrient-grid { display: grid; gap: .75rem 1rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.more-nutrients { margin-top: 1rem; }
.more-nutrients summary { cursor: pointer; font-weight: 400; color: var(--accent); }
.more-nutrients h4 { margin: 1rem 0 .5rem; }

/* ---------- cards & food page ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); margin-bottom: 1.5rem; }
.card h2 { margin-top: 0; }
.row-form { display: flex; gap: 1rem; flex-wrap: wrap; align-items: end; }
.row-form .grow { flex: 1 1 240px; }
.food form.stack { margin-top: .5rem; }

/* ---------- dashboard ---------- */
.day-head { display: none; }   /* top date nav hidden (markup kept) */
.day-nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; width: 100%; }
.day-nav input[type=date] { width: auto; }
.day-nav .day-arrow { padding-left: 1.35rem; padding-right: 1.35rem; }
.day-nav .nav-arrow { font-size: 1.35em; line-height: 1; vertical-align: -.06em; }

/* floating "Add food" action button */
/* floating toolbar (bottom-right): Add food + date nav + menu */
.fab-bar {
    position: fixed;
    right: clamp(1rem, 4vw, 1.75rem);
    bottom: clamp(1rem, 4vw, 1.75rem);
    z-index: 80;
    display: flex; align-items: center; gap: .45rem;
    padding: .45rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: 0 12px 34px rgba(0,0,0,.55);
}
.fab {
    display: inline-flex; align-items: center; gap: .4rem;
    height: 58px; padding: 0 1.2rem; font-size: 1rem;
    background: var(--accent); color: var(--accent-ink);
    border-radius: 999px; text-decoration: none; white-space: nowrap;
    box-shadow: 0 6px 22px rgba(0,0,0,.5);
    transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
}
.fab-round {
    display: inline-flex; align-items: center; justify-content: center; padding: 0;
    width: 58px; height: 58px; border-radius: 50%;
    background: #fff; border: none; color: #010104;
    cursor: pointer; text-decoration: none;
    box-shadow: 0 8px 24px rgba(0,0,0,.55);
    transition: transform .15s ease, box-shadow .15s ease;
}
.fab-round:hover { transform: translateY(-1px); box-shadow: 0 11px 28px rgba(0,0,0,.62); }
.fab-round svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.datepick { position: relative; overflow: hidden; }
.datepick input[type=date] { position: absolute; inset: 0; opacity: 0; border: 0; padding: 0; margin: 0; cursor: pointer; }
.fab:hover { background: var(--accent-dark); transform: translateY(-1px); box-shadow: 0 9px 26px rgba(0,0,0,.55); }
.fab .fab-plus { font-size: 1.6em; line-height: 1; }

.empty { text-align: center; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 3rem 1rem; }
.empty p { color: var(--muted); font-size: .9rem; margin: 0; }

.nutrient-table, .entry-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.nutrient-table th, .nutrient-table td, .entry-table th, .entry-table td { padding: .8rem .9rem; text-align: left; border-bottom: 1px solid var(--line); font-size: .85rem; }
.nutrient-table thead th, .entry-table thead th { background: var(--surface-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.nutrient-table tr:last-child td, .entry-table tr:last-child td { border-bottom: none; }
.nutrient-table tbody tr:hover { background: rgba(255,255,255,.025); }
.num { text-align: right; white-space: nowrap; }
.entry-time { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; width: 4rem; }

/* "What you ate" — accordion */
.accordion { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.acc-item { border-bottom: 1px solid var(--line); }
.acc-item:last-child { border-bottom: none; }
/* open item: tinted block + lime food name so it reads as selected */
.acc-item.open { background: var(--surface-2); }
.acc-item.open .acc-title { color: var(--accent); }
.acc-head { display: flex; align-items: flex-start; gap: .55rem; padding: .8rem .9rem; cursor: pointer; }
.acc-head:hover { background: rgba(255,255,255,.03); }
.acc-item.open .acc-head:hover { background: transparent; }
.acc-head .caret { flex: 0 0 auto; color: var(--muted); font-size: 1.5rem; line-height: 1; transition: transform .15s ease; }
.acc-head.open .caret { transform: rotate(90deg); color: var(--accent); }
.acc-main { flex: 1 1 auto; min-width: 0; }
.acc-title { font-size: .9rem; }
.acc-amount { margin-top: .2rem; font-size: .82rem; color: var(--muted); }
.acc-time { display: inline-flex; align-items: center; gap: .28rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.acc-clock { width: .92em; height: .92em; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.acc-panel { padding: .9rem .9rem 1.1rem; background: var(--surface); border-top: 1px solid var(--line); }
.acc-panel[hidden] { display: none; }
.entry-nutrients { border-collapse: collapse; width: 100%; margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.entry-nutrients thead th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); padding: .4rem .7rem; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.entry-nutrients td { padding: .4rem .7rem; border-bottom: 1px solid var(--line); color: var(--ink); font-size: .85rem; }
.entry-nutrients tbody tr:last-child td { border-bottom: none; }
.entry-nutrients .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.entry-nutrients .nut-child td { font-size: .78rem; }
.entry-nutrients .nut-child td:first-child { padding-left: 1.5rem; color: var(--muted); }
.unit { color: var(--muted); font-size: .85rem; }
.prog { width: 150px; }
.bar { background: var(--line); border-radius: 999px; height: 3px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--good); }
.bar-over span { background: var(--danger); }
.prog-line { display: block; font-size: .78rem; }
.prog .bar { margin-top: .35rem; }
.prog-pct { color: var(--ink); font-variant-numeric: tabular-nums; }
.prog-pct.over { color: var(--danger); }
.prog-goal { color: var(--muted); }
.totals, .entries { margin-bottom: 2rem; }
.totals h2, .entries h2 { font-size: 1.15rem; }

/* Child "of which" rows read as indented, quieter sub-items */
.nutrient-table tr.row-child .nutrient-name {
    padding-left: 2rem;
    color: var(--muted);
    font-weight: 400;
}
.nutrient-table tr.row-child td { font-size: .78rem; }
.nutrient-table tr.row-child .num { font-weight: 400; }
.nutrient-table tr.row-child .num strong { font-weight: 400; }

/* ---------- API tokens (profile) ---------- */
.token-reveal { background: rgba(207,254,37,.08); border: 1px solid var(--accent); border-radius: 8px; padding: .8rem 1rem; margin-bottom: 1rem; }
.token-value { display: flex; align-items: center; gap: .6rem; margin-top: .5rem; flex-wrap: wrap; }
.token-value code { background: var(--surface-2); padding: .45rem .6rem; border-radius: 6px; font-size: .9rem; word-break: break-all; color: var(--accent); }
.token-table { width: 100%; border-collapse: collapse; margin: .25rem 0 1rem; }
.token-table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); padding: .4rem .5rem; border-bottom: 1px solid var(--line); }
.token-table td { padding: .45rem .5rem; border-bottom: 1px solid var(--line); }
.token-table tr:last-child td { border-bottom: none; }
.token-create { align-items: end; }

/* ---------- confirm modal ---------- */
.modal[hidden] { display: none; }
.modal {
    position: fixed; inset: 0; z-index: 100;
    display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.6); }
.modal-box {
    position: relative; z-index: 1; width: 100%; max-width: 360px;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem;
    animation: modal-in .14s ease-out;
}
@keyframes modal-in { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-box h3 { margin: 0 0 .5rem; }
.modal-box p { margin: 0 0 1.35rem; color: var(--muted); }
.modal-box p strong { color: var(--ink); font-weight: 400; }
.modal-actions { display: flex; justify-content: flex-end; gap: .6rem; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #d83a5f; border-color: #d83a5f; }

/* ---------- macro rings ---------- */
.macro-rings { display: none; }   /* superseded by the .overview card */
.macro-rings h2 { font-size: 1.15rem; margin: .5rem 0 1rem; }
.day-title .is-today { color: var(--accent); }
.macro-swiper { overflow: hidden; }
.macro-swiper .swiper-slide { height: auto; }
.ring-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 1rem .75rem 1.1rem; text-align: center; height: 100%;
}
.ring-wrap { position: relative; width: 168px; height: 168px; margin: 0 auto .7rem; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--line); stroke-width: 7; }
.ring-fill  { fill: none; stroke: var(--accent); stroke-width: 7; stroke-linecap: round; }
.ring-over  { fill: none; stroke: var(--danger); stroke-width: 7; stroke-linecap: round; } /* overflow past 100% */
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-value { font-size: 1.3rem; font-weight: 400; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ring-unit  { font-size: .72rem; color: var(--muted); margin-top: .12rem; }
.ring-label { font-weight: 400; }
.ring-sub   { font-size: .78rem; }
.ring-sub .over-pct { color: var(--danger); font-weight: 400; }

/* ---------- overview: calories ring + four main macros (one card) ---------- */
.overview {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 1.5rem; margin-bottom: 1.75rem;
}
.overview .day-title {
    text-align: center; margin: 0 0 1.25rem;
    white-space: nowrap;                       /* keep the date on one line */
    font-size: clamp(1rem, 3.6vw, 1.2rem);     /* scales down on narrow phones */
}
.overview-ring { position: relative; display: flex; justify-content: center; padding-bottom: 1.6rem; }
.overview-ring .ring-card { border: none; background: none; box-shadow: none; padding: 0; }
.overview-ring .ring-sub { margin-top: .35rem; }
.overview-ring .ring-value { font-size: 2.1rem; }
.overview-ring .ring-value.over { color: var(--danger); }
.overview-ring .ring-unit  { font-size: .9rem; margin-top: .2rem; }
/* faded divider between the ring and the macro grid */
.overview-ring::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; pointer-events: none;
    background: linear-gradient(to right, transparent, var(--line) 18%, var(--line) 82%, transparent);
}
.macro-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.4rem 2rem;
    margin-top: 1.6rem;
}
.macro-cell { background: none; border: none; padding: 0; }
.macro-cell-top { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.macro-cell-label { color: var(--muted); font-size: .68rem; letter-spacing: .05em; text-transform: uppercase; }
.macro-cell-pct { color: var(--accent); font-size: .68rem; font-variant-numeric: tabular-nums; }
.macro-cell-pct.over-pct { color: var(--danger); }
.macro-cell-val { margin-top: .5rem; font-size: 1.2rem; line-height: 1; font-variant-numeric: tabular-nums; }
.macro-cell-val .unit { font-size: .78rem; color: var(--muted); }
.macro-cell-goal { color: var(--muted); font-size: .82em; }
.macro-cell-bar { margin-top: .55rem; height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; }
.macro-cell-bar > span { display: block; height: 100%; border-radius: 3px; background: var(--good); }
.macro-cell-bar > span.over { background: var(--danger); }

/* ---------- sliding day strip (±30 days of kcal vs goal) ---------- */
.week-strip {
    position: relative; display: flex; gap: .3rem; margin-bottom: 1.25rem;
    overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: .3rem;
    -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.week-strip::-webkit-scrollbar { height: 6px; }
.week-strip::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; }
.week-day {
    flex: 0 0 auto; width: 44px; scroll-snap-align: center;
    display: flex; flex-direction: column; align-items: center; gap: .35rem;
    padding: .5rem .2rem; border-radius: 10px; text-decoration: none;
    border: 1px solid transparent; transition: background .15s ease, border-color .15s ease;
}
.week-day:hover .week-dom { color: var(--ink); }
.week-day.future { opacity: .45; }
.week-dow { font-size: .64rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.week-dom {
    font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; line-height: 1;
    padding: .16rem .4rem; border-radius: 999px; transition: background .15s ease, color .15s ease;
}
.week-day.today .week-dow { color: var(--accent); }
.week-day.today .week-dom { color: var(--accent); }
/* selected day: a compact lime chip on the date — no tall container */
.week-day.current .week-dom { background: var(--accent); color: var(--accent-ink); }
/* subtle dot marking days that have any logged record (reserved slot keeps rows aligned) */
.week-day::after { content: ""; width: 5px; height: 5px; border-radius: 50%; background: transparent; margin-top: .05rem; }
.week-day.has::after { background: var(--accent); opacity: .6; }
.week-day.has.current::after { opacity: 1; }

/* ---------- water tracker (own card) ---------- */
.water-card { padding: 1.25rem 1.5rem 1.35rem; }
.water-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.water-label { display: inline-flex; align-items: center; gap: .5rem; font-size: .95rem; }
.water-glass { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.water-glass-fill { opacity: .55; }
.water-amt { font-size: .9rem; font-variant-numeric: tabular-nums; }
.water-bar { margin-top: .55rem; height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; }
.water-bar > span { display: block; height: 100%; border-radius: 6px; background: var(--accent); transition: width .3s ease; }
.water-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .8rem; }
.water-add, .water-reset {
    font: inherit; font-size: .8rem; cursor: pointer; border-radius: 999px;
    padding: .35rem .8rem; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
    transition: border-color .15s ease, background .15s ease;
}
.water-add:hover { border-color: var(--accent); }
.water-reset-form { margin-left: auto; }
.water-reset-form[hidden] { display: none; }   /* beat .inline's display:inline */
.water-reset { color: var(--muted); background: none; }
.water-reset:hover { color: var(--danger); border-color: var(--danger); }

/* ---------- eating-trend chart ---------- */
.trend { margin-bottom: 2rem; }
.trend h2 { font-size: 1.15rem; }
.trend .hint { margin-bottom: 1.1rem; }
.kcal-chart {
    width: 100%; height: auto; display: block;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: .5rem;
}
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-label { fill: var(--muted); font-size: 11px; }
.chart-value { fill: var(--ink); font-size: 10px; font-weight: 400; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { fill: var(--accent); opacity: .10; }
.chart-dot { fill: var(--accent); stroke: var(--bg); stroke-width: 1.5; cursor: pointer; }
.chart-dot:hover, .chart-dot:focus { stroke: var(--accent); stroke-width: 3; outline: none; }
.chart-goal { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 5 5; opacity: .55; }
.chart-goal-label { fill: var(--muted); font-size: 10px; }

.chart-wrap { position: relative; }
.chart-tip {
    position: absolute; z-index: 20; min-width: 170px; max-width: 260px;
    background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
    padding: .6rem .7rem; box-shadow: var(--shadow); pointer-events: none; font-size: .85rem;
}
.chart-tip[hidden] { display: none; }
.chart-tip .tip-head { font-weight: 400; color: var(--accent); margin-bottom: .4rem; }
.chart-tip .tip-delta { color: var(--muted); }
.chart-tip .tip-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.chart-tip .tip-list li { display: flex; flex-direction: column; }
.chart-tip .tip-name { color: var(--ink); }
.chart-tip .tip-meta { color: var(--muted); font-size: .8rem; }

/* ---------- settings / goals ---------- */
.settings { max-width: 720px; margin: 0 auto; }
.settings h1 { margin-bottom: .35rem; }
.settings > .hint { margin: 0 0 1.5rem; color: var(--muted); }
.goal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 2rem; }
.goal-grid .goal-field {   /* beat the generic ".stack label { display:grid }" rule */
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .55rem 0; border-bottom: 1px solid var(--line); margin: 0;
}
.goal-field.is-child .goal-name { padding-left: 1rem; color: var(--muted); }
.goal-name { flex: 1; min-width: 0; }
.goal-input { display: inline-flex; align-items: center; gap: .5rem; flex: 0 0 auto; }
.goal-input input { width: 92px; text-align: right; }
.goal-unit { color: var(--muted); font-size: .85rem; min-width: 2.4rem; }
.settings-actions { margin-top: .5rem; }

@media (max-width: 560px) {
    /* Daily totals: tighter on mobile; Goal now lives inside the Progress cell */
    .prog { width: 118px; }
    .nutrient-table th, .nutrient-table td { padding: .65rem .5rem; }
    .nutrient-table td.num { white-space: nowrap; }
    .nutrient-table tr.row-child .nutrient-name { padding-left: 1rem; }
    /* Mobile nav: standard fixed header (logo left, menu icon right); the
       floating bottom toolbar is temporarily hidden (markup/CSS kept). */
    .site-header { display: flex; }          /* was hidden — now the mobile nav */
    .header-menu { display: inline-flex; }   /* the hamburger that opens the overlay */
    .brand { font-size: 1.65rem; }           /* bigger logo on mobile */
    /* bigger hamburger on mobile */
    .header-menu .hb { width: 30px; height: 22px; }
    .header-menu .hb i:nth-child(1) { top: 6px; }
    .header-menu .hb i:nth-child(2) { top: 14px; }
    .header-menu[aria-expanded="true"] .hb i:nth-child(1) { top: 10px; }
    .header-menu[aria-expanded="true"] .hb i:nth-child(2) { top: 10px; }
    .fab-bar { display: none; }              /* hide the floating bottom menu for now */
    body.nav-open .site-header { z-index: 90; }   /* keep the hamburger tappable to close */
    /* (landing & auth pages still hide the header via their own higher-specificity rules) */
    .fab .fab-label { display: none; }
    .fab { width: 58px; padding: 0; gap: 0; justify-content: center; }
    /* hide the main vertical page scrollbar on mobile (page still scrolls) */
    html { scrollbar-width: none; }
    html::-webkit-scrollbar, body::-webkit-scrollbar { display: none; }
    /* goals: single column on narrow screens */
    .goal-grid { grid-template-columns: 1fr; }
}

/* ============================ Assistant (chat) ============================ */
/* Fill the viewport below the header; the thread scrolls, the composer is pinned. */
/* Height fallback chain: 100vh works everywhere; 100dvh refines on capable
   browsers; --app-height (JS, from visualViewport) is the most accurate and also
   shrinks when the on-screen keyboard opens so the composer stays visible. */
body.chat-page { height: 100vh; height: 100dvh; height: var(--app-height, 100dvh); display: flex; flex-direction: column; overflow: hidden; }
body.chat-page main.container { flex: 1 1 auto; min-height: 0; max-width: none; margin: 0; padding: 0; display: flex; }
body.chat-page .site-footer { display: none; }
/* raise the floating nav bolt above the composer */
body.chat-page .fab-bar { bottom: 88px; }

.chat { flex: 1 1 auto; display: flex; min-height: 0; width: 100%; background: var(--bg); }

/* conversation list */
.chat-side {
    flex: 0 0 260px; display: flex; flex-direction: column;
    background: var(--bg); min-height: 0;
}
.chat-side-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1rem .6rem; font-family: 'Montserrat', sans-serif; color: var(--muted);
    font-size: .8rem; text-transform: uppercase; letter-spacing: .08em;
}
.chat-new {
    background: none; border: 1px solid var(--line); color: var(--ink);
    border-radius: 999px; padding: .25rem .7rem; font: inherit; font-size: .85rem; cursor: pointer;
}
.chat-new:hover { border-color: var(--accent); color: var(--accent); }
.chat-convs { overflow-y: auto; padding: .3rem .5rem 1rem; display: flex; flex-direction: column; gap: .15rem; }
.chat-convs-empty { padding: .55rem 1.05rem; color: var(--muted); font-size: .9rem; }
.chat-convs-empty[hidden] { display: none; }
.chat-conv-row { display: flex; align-items: center; border-radius: 10px; }
.chat-conv-row:hover, .chat-conv-row.active { background: var(--surface-2); }
.chat-conv {
    flex: 1 1 auto; min-width: 0; padding: .55rem .2rem .55rem .7rem; color: var(--ink);
    text-decoration: none; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-conv-row.active .chat-conv { color: var(--accent); }
.chat-conv-del {
    flex: 0 0 auto; background: none; border: none; color: var(--muted); cursor: pointer;
    padding: .4rem .55rem; opacity: .5; display: inline-flex; align-items: center;
}
.chat-conv-del:hover, .chat-conv-row:hover .chat-conv-del { opacity: 1; color: var(--danger); }
.chat-conv-del svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; fill: none; }
.chat-side-scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 60; }

/* main pane */
.chat-main { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-top {
    flex: 0 0 auto; display: flex; align-items: center; gap: .6rem;
    padding: .7rem 1rem; background: var(--bg);
}
.chat-side-toggle {
    display: none; background: none; border: none; color: var(--ink); cursor: pointer; padding: .2rem;
}
.chat-side-toggle svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 2; fill: none; }
.chat-title {
    margin: 0; font-size: 1rem; font-weight: 400; color: var(--ink);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    flex: 1 1 auto; min-width: 0;
}
.chat-usage {
    flex: 0 0 auto; font-size: .8rem; color: var(--muted);
    font-variant-numeric: tabular-nums; letter-spacing: .01em;
}
.chat-usage.low { color: var(--danger); }
.chat-close {
    flex: 0 0 auto; display: inline-flex; padding: .2rem; color: var(--muted);
    background: none; border: none; cursor: pointer;
}
.chat-close:hover { color: var(--ink); }
.chat-close svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 2; fill: none; }

.chat-scroll { flex: 1 1 auto; overflow-y: auto; min-height: 0; }
.chat-thread { max-width: 780px; margin: 0 auto; padding: 1.2rem 1rem 1.6rem; display: flex; flex-direction: column; gap: .7rem; }

/* bubbles */
.msg { display: flex; }
.msg-user { justify-content: flex-end; }
.msg-bot  { justify-content: flex-start; }
.bubble {
    max-width: 84%; padding: .68rem 1rem; border-radius: 18px; line-height: 1.55;
    font-size: .96rem; word-wrap: break-word; overflow-wrap: anywhere;
}
.msg-user .bubble { background: var(--chat-user); color: var(--ink); border-bottom-right-radius: 5px; }
.msg-bot  .bubble { background: var(--surface-2); color: var(--ink); border-bottom-left-radius: 5px; }
.bubble code { background: rgba(255,255,255,.08); padding: .05em .35em; border-radius: 5px; font-size: .9em; }

/* typing dots + status + errors */
.chat-dots { display: inline-flex; gap: 4px; padding: .15rem 0; }
.chat-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: chatdot 1s infinite ease-in-out; }
.chat-dots i:nth-child(2) { animation-delay: .15s; }
.chat-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes chatdot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.chat-status { display: block; margin-top: .35rem; color: var(--muted); font-size: .85rem; font-style: italic; }
.chat-err { color: var(--danger); }

/* empty state */
.chat-empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.chat-empty-bolt { width: 54px; height: 54px; margin: 0 auto 1rem; display: grid; place-items: center;
    background: var(--surface-2); border-radius: 16px; }
.chat-empty-bolt svg { width: 26px; height: 26px; fill: var(--accent); }
.chat-empty h2 { color: var(--ink); font-size: 1.4rem; margin: 0 0 .4rem; }
.chat-empty p { max-width: 34ch; margin: 0 auto 1.3rem; }
.chat-suggests { display: flex; flex-direction: column; gap: .5rem; max-width: 340px; margin: 0 auto; }
.chat-suggest {
    background: var(--surface-2); border: 1px solid var(--line); color: var(--ink);
    border-radius: 12px; padding: .6rem .9rem; font: inherit; font-size: .9rem; cursor: pointer; text-align: left;
}
.chat-suggest:hover { border-color: var(--accent); }

/* images in bubbles */
.chat-img { display: block; max-width: 260px; max-height: 300px; width: auto; border-radius: 12px; margin-bottom: .4rem; }
.bubble > .chat-img:last-child { margin-bottom: 0; }

/* composer */
.chat-composer {
    flex: 0 0 auto; display: flex; flex-direction: column; gap: .5rem;
    padding: .6rem .8rem calc(.6rem + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line); background: var(--surface);
    max-width: 780px; margin: 0 auto; width: 100%;
}
.chat-composer-row { display: flex; align-items: flex-end; gap: .5rem; }
.chat-attach {
    flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line);
    background: var(--surface-2); color: var(--muted); cursor: pointer; display: grid; place-items: center;
}
.chat-attach:hover { border-color: var(--accent); color: var(--accent); }
.chat-attach:disabled { opacity: .4; cursor: not-allowed; }
.chat-attach svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.8; fill: none; }
.chat-preview { position: relative; width: max-content; }
.chat-preview img { max-height: 90px; border-radius: 10px; display: block; border: 1px solid var(--line); }
.chat-preview-x {
    position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 50%;
    border: none; background: var(--danger); color: #fff; cursor: pointer; font-size: 15px; line-height: 1;
}
.chat-composer textarea {
    flex: 1 1 auto; resize: none; min-height: 44px; max-height: 160px;
    background: var(--surface-2); border: 1px solid var(--line); border-radius: 22px;
    padding: .65rem 1rem; color: var(--ink); font: inherit; font-size: 16px; line-height: 1.4;
}
.chat-composer textarea:focus { outline: none; border-color: var(--accent); }
.chat-send {
    flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; border: none;
    background: var(--accent); color: var(--accent-ink); cursor: pointer; display: grid; place-items: center;
}
.chat-send:hover { background: var(--accent-dark); }
.chat-send:disabled { opacity: .4; cursor: not-allowed; }
.chat-send svg { width: 21px; height: 21px; fill: currentColor; stroke: none; }
.chat-unconfigured { text-align: center; color: var(--danger); font-size: .85rem; padding: .3rem; }

@media (max-width: 720px) {
    .chat-side {
        position: fixed; top: 0; left: 0; bottom: 0; z-index: 61; width: 82%; max-width: 300px;
        transform: translateX(-100%); transition: transform .25s ease;
    }
    .chat-side.open { transform: translateX(0); }
    .chat-side-toggle { display: inline-flex; }
}

/* ===================== Assistant dock (every logged-in page) ===================== */
/* The dock is a persistent bottom composer that expands into a full chat sheet. */
body.has-dock main.container { padding-bottom: calc(var(--dock-h, 66px) + 14px); }
/* the floating bottom bar is retired now that nav lives in the header + dock */
body.has-dock .fab-bar { display: none; }
/* no footer inside the app (kept on the homepage / logged-out pages) */
body.has-dock .site-footer { display: none; }
/* fade + slide the dock down/up with the menu (instead of an abrupt display toggle) */
body.nav-open .assistant-composer { opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(100%); }
/* discourage the background page from scrolling while the sheet is open */
body.assistant-open { overflow: hidden; }

/* One fixed container sized to the VISIBLE viewport (--app-height, measured from
   visualViewport), with the dock composer as its bottom flex item — so the
   composer always lands at the visible bottom, even with iOS's bottom URL bar,
   safe areas, or on-screen keyboard. Closed: passes clicks through (only the
   composer stays interactive); open: captures interaction. */
.assistant {
    position: fixed; top: 0; left: 0; right: 0; bottom: var(--kb-inset, 0px); z-index: 101;
    display: flex; flex-direction: column; justify-content: flex-end;
    pointer-events: none;
}
.assistant.open { pointer-events: auto; }

.assistant-scrim {
    position: fixed; inset: 0; z-index: -1; background: rgba(0,0,0,.55);
    opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility .25s ease;
}
.assistant.open .assistant-scrim { opacity: 1; visibility: visible; }

/* the transcript sheet — fills the space above the dock; fades/rises in when open */
.assistant-sheet {
    flex: 1 1 auto; min-height: 0;
    display: flex; flex-direction: column;
    background: var(--bg);
    padding-top: env(safe-area-inset-top);   /* clear the notch/status bar when open */
    pointer-events: none;
    opacity: 0; visibility: hidden; transform: translateY(22px);
    transition: opacity .3s ease, visibility .3s ease, transform .3s cubic-bezier(.2,.7,.2,1);
}
.assistant.open .assistant-sheet { opacity: 1; visibility: visible; transform: none; pointer-events: auto; }
.assistant-sheet .chat-top { flex: 0 0 auto; }
/* content area below the header — the sidebar overlays only this, not the header */
.assistant-sheet .chat-body { position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.assistant-sheet .chat-scroll { flex: 1 1 auto; overflow-y: auto; min-height: 0; overscroll-behavior: contain; }

/* the dock composer — a static flex item at the bottom of .assistant (always visible) */
.assistant-composer {
    flex: 0 0 auto; pointer-events: auto;
    max-width: none; margin: 0;
    background: var(--bg); border-top: none;
    padding: .95rem .8rem calc(.95rem + env(safe-area-inset-bottom));
    box-shadow: 0 -6px 24px rgba(0,0,0,.35);
    transition: opacity .3s ease, visibility .3s ease, transform .3s ease;
}
.assistant-composer .chat-composer-row,
.assistant-composer .chat-preview { max-width: 820px; margin-left: auto; margin-right: auto; width: 100%; }
/* a bit more breathing room on the dock on desktop */
@media (min-width: 561px) {
    .assistant-composer { padding-top: 2.7rem; padding-bottom: calc(2.7rem + env(safe-area-inset-bottom)); }
}

.assistant .modal { z-index: 120; pointer-events: auto; }

/* the close chevron in the sheet header */
#asstClose { flex: 0 0 auto; display: inline-flex; padding: .2rem; color: var(--muted); background: none; border: none; cursor: pointer; }
#asstClose:hover { color: var(--ink); }
#asstClose svg { width: 24px; height: 24px; stroke: currentColor; stroke-width: 2; fill: none; }

/* conversation sidebar is a slide-over at all widths inside the sheet */
.assistant-sheet .chat-side {
    position: absolute; top: 0; left: 0; bottom: 0; z-index: 5;
    flex: none; width: 82%; max-width: 300px;
    transform: translateX(-100%); transition: transform .25s ease;
}
.assistant-sheet .chat-side.open { transform: translateX(0); }
.assistant-sheet .chat-side-scrim { position: absolute; z-index: 4; background: transparent; }
/* on mobile, dim the chat behind the open sidebar */
@media (max-width: 560px) {
    .assistant-sheet .chat-side-scrim { background: rgba(0,0,0,.5); }
}
.assistant-sheet .chat-side-toggle { display: inline-flex; }
