/* ==========================================================================
   FNF UI v2 preview — ported from mockups/css/mockup.css
   Used only by templates/app_v2.html (/dev/ui-v2). Not prod SPA CSS.
   No CDN, no webfonts, no floating theme bar.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
    /* Sage scale — sidebar surface and soft accents */
    --sage-50: #F3F7F4;
    --sage-100: #E6EFE9;
    --sage-200: #D2E2D8;
    --sage-300: #B8D2C2;
    --sage-400: #9CC0A9;
    --sage-500: #7FAA90;
    --sage-600: #5F8E72;
    --sage-700: #47705A;
    --sage-800: #345343;

    /* Surfaces */
    --page: #F6F8F6;
    --surface: #FFFFFF;
    --surface-2: #FBFCFB;
    --surface-sunken: #F1F5F2;
    --sidebar: linear-gradient(180deg, #A6C6B1 0%, #9CC0A9 55%, #93B9A1 100%);
    --sidebar-solid: #9CC0A9;
    --brand-panel: linear-gradient(160deg, #A9C8B5 0%, #9CC0A9 100%);
    --header-bg: rgba(255, 255, 255, .94);
    --hero-bg: linear-gradient(165deg, var(--sage-100) 0%, var(--surface-2) 70%);
    --auth-bg: linear-gradient(165deg, var(--sage-100) 0%, var(--surface-2) 60%);
    --code-bg: #F4F7F5;

    /* Text */
    --text: #23302A;
    --text-2: #56675D;
    --text-muted: #8A998F;
    --text-on-sage: #1E2E25;
    --text-invert: #FFFFFF;
    --text-on-brand: #FFFFFF;
    --nav-active-fg: #345343;

    /* Lines */
    --border: #E5EBE6;
    --border-strong: #D3DDD6;
    --hairline: #EDF1EE;

    /* Brand / semantic */
    --accent: #3C8C63;
    --accent-strong: #2F7351;
    --accent-soft: #E8F2EC;
    --ring-green: #6FBF92;
    --ring-orange: #E9A63F;
    --ring-blue: #46B3D6;
    --info: #46B3D6;
    --info-soft: #E7F5FA;
    --warn: #C98A21;
    --warn-soft: #FDF4E3;
    --danger: #C0503F;
    --danger-soft: #FBECE9;
    --water: #4FA9DC;
    --burn: #E0754A;
    --theme-name: "Sage (default)";

    /* Radius */
    --r-xs: 6px;
    --r-sm: 8px;
    --r-md: 12px;
    --r-card: 16px;
    --r-lg: 20px;
    --r-pill: 999px;

    /* Shadows — soft, low contrast */
    --sh-1: 0 1px 2px rgba(26, 44, 34, .05);
    --sh-2: 0 2px 6px rgba(26, 44, 34, .06);
    --sh-3: 0 10px 28px rgba(26, 44, 34, .08);
    --sh-fab: 0 8px 20px rgba(47, 115, 81, .28);

    /* Spacing scale */
    --s-1: 4px;
    --s-2: 8px;
    --s-3: 12px;
    --s-4: 16px;
    --s-5: 20px;
    --s-6: 24px;
    --s-7: 32px;
    --s-8: 40px;
    --s-9: 56px;

    /* Type */
    --font: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

    /* Layout */
    --sidebar-w: 232px;
    --rail-w: 320px;
    --content-max: 1180px;
    --site-max: 1280px; /* public header + .wrap — same width always */
}

/* --------------------------------------------------------------------------
   1b. Theme packs (token overrides only)
   Source palettes adapted from mockups/temp/* — not a layout import.
   Default sage = :root above (no data-theme, or data-theme="sage").
   -------------------------------------------------------------------------- */

/* MintFresh Precision — clinical emerald light */
[data-theme="mint"] {
    --sage-50: #F0FDF4;
    --sage-100: #DCFCE7;
    --sage-200: #BBF7D0;
    --sage-300: #86EFAC;
    --sage-400: #34D399;
    --sage-500: #10B981;
    --sage-600: #047857;
    --sage-700: #065F46;
    --sage-800: #064E3B;
    --page: #F7FDF9;
    --surface: #FFFFFF;
    --surface-2: #F0FDF4;
    --surface-sunken: #E8F8EF;
    --sidebar: linear-gradient(180deg, #34D399 0%, #10B981 45%, #047857 100%);
    --sidebar-solid: #10B981;
    --brand-panel: linear-gradient(160deg, #059669 0%, #047857 100%);
    --header-bg: rgba(255, 255, 255, .96);
    --hero-bg: linear-gradient(165deg, #DCFCE7 0%, #F7FDF9 70%);
    --auth-bg: linear-gradient(165deg, #DCFCE7 0%, #F7FDF9 60%);
    --code-bg: #ECFDF5;
    --text: #022C22;
    --text-2: #065F46;
    --text-muted: #6B8F7D;
    --text-on-sage: #ECFDF5;
    --text-on-brand: #ECFDF5;
    --border: #BBF7D0;
    --border-strong: #86EFAC;
    --hairline: #DCFCE7;
    --accent: #047857;
    --accent-strong: #065F46;
    --accent-soft: #DCFCE7;
    --ring-green: #10B981;
    --ring-orange: #F59E0B;
    --ring-blue: #0EA5E9;
    --water: #0EA5E9;
    --burn: #F97316;
    --sh-fab: 0 8px 20px rgba(4, 120, 87, .28);
    --nav-active-fg: #064E3B;
    --theme-name: "MintFresh";
}

/* Salmon Living — rose / endocrine light */
[data-theme="salmon"] {
    --sage-50: #FFF1F2;
    --sage-100: #FFE4E6;
    --sage-200: #FECDD3;
    --sage-300: #FDA4AF;
    --sage-400: #FB7185;
    --sage-500: #F43F5E;
    --sage-600: #E11D48;
    --sage-700: #BE123C;
    --sage-800: #881337;
    --page: #FFF7F8;
    --surface: #FFFFFF;
    --surface-2: #FFF1F2;
    --surface-sunken: #FFE4E6;
    --sidebar: linear-gradient(180deg, #FB7185 0%, #F43F5E 50%, #E11D48 100%);
    --sidebar-solid: #E11D48;
    --brand-panel: linear-gradient(160deg, #BE123C 0%, #881337 100%);
    --header-bg: rgba(255, 255, 255, .96);
    --hero-bg: linear-gradient(165deg, #FFE4E6 0%, #FFF7F8 70%);
    --auth-bg: linear-gradient(165deg, #FFE4E6 0%, #FFF7F8 60%);
    --code-bg: #FFF1F2;
    --text: #4C0519;
    --text-2: #9F1239;
    --text-muted: #9F7A84;
    --text-on-sage: #FFF1F2;
    --text-on-brand: #FFF1F2;
    --border: #FECDD3;
    --border-strong: #FDA4AF;
    --hairline: #FFE4E6;
    --accent: #E11D48;
    --accent-strong: #BE123C;
    --accent-soft: #FFE4E6;
    --ring-green: #10B981;
    --ring-orange: #F59E0B;
    --ring-blue: #38BDF8;
    --water: #38BDF8;
    --burn: #EA580C;
    --danger: #BE123C;
    --danger-soft: #FFE4E6;
    --sh-fab: 0 8px 20px rgba(225, 29, 72, .3);
    --nav-active-fg: #881337;
    --theme-name: "Salmon Living";
}

/* Peach Executive — warm peach / velvet (mockups/temp/Peach Executive.html) */
[data-theme="peach"] {
    --sage-50: #FFF7ED;
    --sage-100: #FFEDD5;
    --sage-200: #FED7AA;
    --sage-300: #FDBA74;
    --sage-400: #FB923C;
    --sage-500: #F97316;
    --sage-600: #EA580C;
    --sage-700: #C2410C;
    --sage-800: #9A3412;
    --page: #FFFDFB;
    --surface: #FFFFFF;
    --surface-2: #FFF7ED;
    --surface-sunken: #FFEDD5;
    --sidebar: linear-gradient(180deg, #FB923C 0%, #F97316 45%, #C2410C 100%);
    --sidebar-solid: #F97316;
    --brand-panel: linear-gradient(160deg, #C2410C 0%, #EA580C 100%);
    --header-bg: rgba(255, 253, 251, .96);
    --hero-bg: linear-gradient(165deg, #FFEDD5 0%, #FFFDFB 70%);
    --auth-bg: linear-gradient(165deg, #FFEDD5 0%, #FFFDFB 60%);
    --code-bg: #FFF7ED;
    --text: #0F172A;
    --text-2: #475569;
    --text-muted: #78716C;
    --text-on-sage: #FFF7ED;
    --text-on-brand: #FFF7ED;
    --border: #FED7AA;
    --border-strong: #FDBA74;
    --hairline: #FFEDD5;
    --accent: #EA580C;
    --accent-strong: #C2410C;
    --accent-soft: #FFEDD5;
    --ring-green: #10B981;
    --ring-orange: #F97316;
    --ring-blue: #0EA5E9;
    --water: #0EA5E9;
    --burn: #F97316;
    --sh-fab: 0 8px 20px rgba(249, 115, 22, .28);
    --nav-active-fg: #9A3412;
    --theme-name: "Peach Executive";
}

/* Executive Balance — violet primary + emerald accent */
[data-theme="executive"] {
    --sage-50: #F5F3FF;
    --sage-100: #EDE9FE;
    --sage-200: #DDD6FE;
    --sage-300: #C4B5FD;
    --sage-400: #A78BFA;
    --sage-500: #8B5CF6;
    --sage-600: #6D28D9;
    --sage-700: #5B21B6;
    --sage-800: #4C1D95;
    --page: #F8FAFC;
    --surface: #FFFFFF;
    --surface-2: #F1F5F9;
    --surface-sunken: #E2E8F0;
    --sidebar: linear-gradient(180deg, #8B5CF6 0%, #6D28D9 55%, #5B21B6 100%);
    --sidebar-solid: #6D28D9;
    --brand-panel: linear-gradient(160deg, #5B21B6 0%, #6D28D9 100%);
    --header-bg: rgba(255, 255, 255, .96);
    --hero-bg: linear-gradient(165deg, #EDE9FE 0%, #F8FAFC 70%);
    --auth-bg: linear-gradient(165deg, #EDE9FE 0%, #F8FAFC 60%);
    --code-bg: #F1F5F9;
    --text: #0F172A;
    --text-2: #475569;
    --text-muted: #64748B;
    --text-on-sage: #F5F3FF;
    --text-on-brand: #F5F3FF;
    --border: #E2E8F0;
    --border-strong: #CBD5E1;
    --hairline: #F1F5F9;
    --accent: #6D28D9;
    --accent-strong: #5B21B6;
    --accent-soft: #EDE9FE;
    --ring-green: #059669;
    --ring-orange: #D97706;
    --ring-blue: #38BDF8;
    --water: #38BDF8;
    --burn: #EA580C;
    --sh-fab: 0 8px 20px rgba(109, 40, 217, .3);
    --nav-active-fg: #4C1D95;
    --theme-name: "Executive Balance";
}

/* Blueberry Boost — dark navy + sky + amber CTA */
[data-theme="blueberry"] {
    --sage-50: #1E293B;
    --sage-100: #1E293B;
    --sage-200: #334155;
    --sage-300: #475569;
    --sage-400: #38BDF8;
    --sage-500: #3B82F6;
    --sage-600: #1D4ED8;
    --sage-700: #1E40AF;
    --sage-800: #172554;
    --page: #0F172A;
    --surface: #1E293B;
    --surface-2: #182238;
    --surface-sunken: #0B1220;
    --sidebar: linear-gradient(180deg, #1E40AF 0%, #1D4ED8 50%, #172554 100%);
    --sidebar-solid: #1E40AF;
    --brand-panel: linear-gradient(160deg, #1E3A8A 0%, #1D4ED8 100%);
    --header-bg: rgba(15, 23, 42, .94);
    --hero-bg: linear-gradient(165deg, #1E293B 0%, #0F172A 70%);
    --auth-bg: linear-gradient(165deg, #1E293B 0%, #0F172A 60%);
    --code-bg: #0B1220;
    --text: #F8FAFC;
    --text-2: #CBD5E1;
    --text-muted: #94A3B8;
    --text-on-sage: #F8FAFC;
    --text-on-brand: #F8FAFC;
    --border: #334155;
    --border-strong: #475569;
    --hairline: #243044;
    --accent: #F59E0B;
    --accent-strong: #D97706;
    --accent-soft: #422006;
    --ring-green: #34D399;
    --ring-orange: #F59E0B;
    --ring-blue: #38BDF8;
    --info: #38BDF8;
    --info-soft: #0C4A6E;
    --warn: #F59E0B;
    --warn-soft: #422006;
    --danger: #F87171;
    --danger-soft: #450A0A;
    --water: #38BDF8;
    --burn: #F59E0B;
    --sh-1: 0 1px 2px rgba(0, 0, 0, .35);
    --sh-2: 0 2px 8px rgba(0, 0, 0, .4);
    --sh-3: 0 12px 32px rgba(0, 0, 0, .45);
    --sh-fab: 0 8px 20px rgba(245, 158, 11, .35);
    --theme-name: "Blueberry Boost";
}

/* ForestWell AI — dark forest + gold */
[data-theme="forest"] {
    --sage-50: #064E3B;
    --sage-100: #064E3B;
    --sage-200: #047857;
    --sage-300: #059669;
    --sage-400: #34D399;
    --sage-500: #10B981;
    --sage-600: #059669;
    --sage-700: #047857;
    --sage-800: #022C22;
    --page: #022C22;
    --surface: #064E3B;
    --surface-2: #033B2E;
    --surface-sunken: #011F18;
    --sidebar: linear-gradient(180deg, #059669 0%, #047857 50%, #022C22 100%);
    --sidebar-solid: #047857;
    --brand-panel: linear-gradient(160deg, #064E3B 0%, #047857 100%);
    --header-bg: rgba(2, 44, 34, .94);
    --hero-bg: linear-gradient(165deg, #033B2E 0%, #022C22 70%);
    --auth-bg: linear-gradient(165deg, #033B2E 0%, #022C22 60%);
    --code-bg: #011F18;
    --text: #ECFDF5;
    --text-2: #A7F3D0;
    --text-muted: #6EE7B7;
    --text-on-sage: #ECFDF5;
    --text-on-brand: #ECFDF5;
    --border: #059669;
    --border-strong: #34D399;
    --hairline: #0A5C45;
    --accent: #D97706;
    --accent-strong: #B45309;
    --accent-soft: #451A03;
    --ring-green: #34D399;
    --ring-orange: #D97706;
    --ring-blue: #5EEAD4;
    --info: #5EEAD4;
    --info-soft: #042F2E;
    --warn: #D97706;
    --warn-soft: #451A03;
    --danger: #F87171;
    --danger-soft: #450A0A;
    --water: #5EEAD4;
    --burn: #D97706;
    --sh-1: 0 1px 2px rgba(0, 0, 0, .35);
    --sh-2: 0 2px 8px rgba(0, 0, 0, .4);
    --sh-3: 0 12px 32px rgba(0, 0, 0, .45);
    --sh-fab: 0 8px 20px rgba(217, 119, 6, .35);
    --theme-name: "ForestWell";
}

/* Dark themes: keep active nav readable */
[data-theme="blueberry"] .nav__item--active,
[data-theme="forest"] .nav__item--active,
[data-theme="blueberry"] .nav__sub .nav__item--active,
[data-theme="forest"] .nav__sub .nav__item--active {
    background: rgba(255, 255, 255, .16);
    color: #fff;
    box-shadow: none;
}

[data-theme="blueberry"] .btn--primary,
[data-theme="forest"] .btn--primary {
    color: #0F172A;
}

[data-theme="forest"] .btn--primary {
    color: #022C22;
}

[data-theme="blueberry"] .badge--green,
[data-theme="forest"] .badge--green {
    background: var(--accent-soft);
    color: var(--accent);
}

[data-theme="blueberry"] .pill-left,
[data-theme="forest"] .pill-left {
    background: var(--accent-soft);
    color: var(--accent);
}

[data-theme="blueberry"] .msg--user .msg__bubble,
[data-theme="forest"] .msg--user .msg__bubble {
    background: var(--accent-soft);
    border-color: var(--border-strong);
    color: var(--text);
}

/* --------------------------------------------------------------------------
   2. Reset / base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

/* Hide fixture/bound stats until first post-auth paint (033 flash-to-zero). */
html:not(.app-ready) .content [data-bind],
html.auth-pending:not(.ssr-authed) .user__name,
html.auth-pending:not(.ssr-authed) .user__meta {
    visibility: hidden;
}

/* SSR signed-in: never hide chrome name while auth settles. */
html.ssr-authed.auth-pending .user__name,
html.ssr-authed.auth-pending .user__meta {
    visibility: visible;
}

/* Guest gate redirect — never show Guest home shell (038/039). */
html.auth-redirecting .app-shell {
    visibility: hidden;
    pointer-events: none;
}

/* Boot JSON present → never lock shell via redirect overlay. */
html.ssr-authed.auth-redirecting .app-shell {
    visibility: visible;
    pointer-events: auto;
}
html.ssr-authed .auth-redirect-overlay {
    display: none !important;
    pointer-events: none !important;
}

.auth-redirect-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-content: center;
    gap: 12px;
    padding: 24px;
    text-align: center;
    background: var(--page, #F6F8F6);
    color: var(--text, #23302A);
}

.auth-redirect-overlay[hidden] {
    display: none !important;
    pointer-events: none !important;
}

.auth-redirect-overlay__title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.auth-redirect-overlay__text {
    margin: 0;
    max-width: 28rem;
    color: var(--text-muted, #8A998F);
    font-size: 14px;
}

.auth-redirect-overlay__actions {
    margin: 8px 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

body {
    margin: 0;
    background: var(--page);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

img,
svg {
    max-width: 100%;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

a {
    color: var(--accent-strong);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
figure {
    margin: 0;
}

ul.plain,
ol.plain {
    list-style: none;
    padding: 0;
}

hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: var(--s-5) 0;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--r-xs);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 100;
    background: var(--surface);
    color: var(--text);
    padding: 10px 14px;
    border-radius: var(--r-sm);
    box-shadow: var(--sh-3);
}

.skip-link:focus {
    left: 12px;
    top: 12px;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}

/* --------------------------------------------------------------------------
   3. Typography helpers
   -------------------------------------------------------------------------- */
.t-h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.2;
}

.t-h2 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -.015em;
    line-height: 1.25;
}

.t-h3 {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -.01em;
}

.t-h4 {
    font-size: 15px;
    font-weight: 600;
}

.t-body {
    font-size: 14px;
}

.t-small {
    font-size: 13px;
}

.t-xs {
    font-size: 12px;
}

.t-num {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

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

.t-2 {
    color: var(--text-2);
}

.t-accent {
    color: var(--accent-strong);
}

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

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

.t-upper {
    text-transform: uppercase;
    letter-spacing: .06em;
    font-size: 11px;
    font-weight: 600;
}

/* --------------------------------------------------------------------------
   4. Icons
   -------------------------------------------------------------------------- */
.icon {
    width: 18px;
    height: 18px;
    flex: none;
    display: inline-block;
    vertical-align: middle;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon--sm {
    width: 14px;
    height: 14px;
}

.icon--lg {
    width: 22px;
    height: 22px;
}

.icon--xl {
    width: 28px;
    height: 28px;
}

.icon--fill {
    fill: currentColor;
    stroke: none;
}

/* --------------------------------------------------------------------------
   5. App shell + sidebar
   -------------------------------------------------------------------------- */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-w);
    flex: none;
    background: var(--sidebar);
    color: var(--text-on-sage);
    padding: var(--s-5) var(--s-3) var(--s-4);
    display: flex;
    flex-direction: column;
    gap: var(--s-4);
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    overflow: hidden;
}

.sidebar__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-2);
}

.sidebar__close {
    display: none;
    flex: none;
    color: #fff;
}

/* Beat `.btn { display: inline-flex }` — Close is mobile-drawer only (096). */
.btn.sidebar__close,
.sidebar .sidebar__close {
    display: none;
}

.nav-backdrop {
    display: none;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    padding: 0 var(--s-2);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -.02em;
    color: #fff;
    background: transparent;
    border: 0;
    box-shadow: none;
    text-decoration: none;
}

.sidebar__brand:hover,
.sidebar__brand.nav__item--active {
    background: transparent;
    color: #fff;
    box-shadow: none;
    text-decoration: none;
}

.brand-mark {
    width: 28px;
    height: 28px;
    border-radius: var(--r-sm);
    background: rgba(255, 255, 255, .28);
    display: grid;
    place-items: center;
    color: #fff;
    border: 0;
    box-shadow: none;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 1px;
    overflow-x: hidden;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
    scrollbar-width: none; /* hide until overflow is truly needed */
}

.nav:hover {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .28) transparent;
}

.nav::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.nav:hover::-webkit-scrollbar {
    width: 5px;
}

.nav:hover::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .28);
    border-radius: 999px;
}

.nav__item {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    width: 100%;
    min-height: 34px;
    padding: 0 var(--s-3);
    border: 0;
    border-radius: var(--r-md);
    background: transparent;
    color: color-mix(in srgb, var(--text-on-sage) 88%, transparent);
    font-size: 13.5px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
}

.nav__item:hover {
    background: rgba(255, 255, 255, .32);
    color: var(--text-on-sage);
    text-decoration: none;
}

.nav__item--active {
    background: rgba(255, 255, 255, .82);
    color: var(--nav-active-fg, var(--sage-800));
    font-weight: 600;
    box-shadow: var(--sh-1);
}

.nav__item .nav__chev {
    margin-left: auto;
    transition: transform .15s ease;
}

.nav__group[open] .nav__chev,
.nav__item[aria-expanded="true"] .nav__chev {
    transform: rotate(90deg);
}

.nav__sub {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 2px 0 var(--s-2) 0;
    padding-left: 26px;
}

.nav__sub .nav__item {
    min-height: 32px;
    font-size: 13px;
    border-left: 2px solid rgba(255, 255, 255, .45);
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    padding-left: var(--s-3);
}

.nav__sub .nav__item--active {
    border-left-color: #fff;
    background: rgba(255, 255, 255, .82);
}

.nav__section {
    margin: var(--s-3) var(--s-3) var(--s-1);
    color: color-mix(in srgb, var(--text-on-sage) 65%, transparent);
    text-transform: uppercase;
    letter-spacing: .07em;
    font-size: 10.5px;
    font-weight: 700;
}

.sidebar__foot {
    border-top: 1px solid rgba(255, 255, 255, .35);
    padding-top: var(--s-2);
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
    flex: none;
}

.streak {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-2);
}

.sidebar .streak {
    color: var(--text-on-sage);
}

.streak__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ring-orange);
    flex: none;
}

.user {
    display: flex;
    align-items: center;
    gap: var(--s-3);
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .55);
    color: var(--sage-800);
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
    flex: none;
}

.user__name {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.25;
}

.user__meta {
    font-size: 11.5px;
    color: rgba(30, 46, 37, .68);
}

/* Sidebar collapsed variant (components demo) */
.sidebar--collapsed {
    width: 68px;
    align-items: center;
}

.sidebar--collapsed .nav__item {
    justify-content: center;
    padding: 0;
}

.sidebar--collapsed .nav__label,
.sidebar--collapsed .sidebar__brand span,
.sidebar--collapsed .nav__chev,
.sidebar--collapsed .user__text,
.sidebar--collapsed .nav__section {
    display: none;
}

/* --------------------------------------------------------------------------
   6. Topbar / content
   -------------------------------------------------------------------------- */
.app-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    padding: var(--s-4) var(--s-6);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar__title {
    font-size: 15px;
    font-weight: 600;
}

.topbar__spacer {
    margin-left: auto;
}

.topbar__actions {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    margin-left: auto;
}

.topbar__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    text-decoration: none;
    color: inherit;
}

.topbar__avatar:hover .avatar,
.topbar__avatar:focus-visible .avatar {
    box-shadow: 0 0 0 2px var(--accent-soft), 0 0 0 3px var(--accent);
}

.topbar__avatar .avatar {
    width: 32px;
    height: 32px;
    background: var(--sage-100);
    color: var(--sage-800);
}

.menu-btn {
    display: none;
}

/* Beat `.btn { display: inline-flex }` so the hamburger stays desktop-hidden (094). */
.btn.menu-btn,
.topbar .menu-btn {
    display: none;
}

.content {
    padding: var(--s-6);
    max-width: var(--content-max);
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--s-5);
}

.page-head {
    display: flex;
    align-items: flex-start;
    gap: var(--s-4);
    flex-wrap: wrap;
    margin-bottom: var(--s-5);
}

.page-head__text {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
    min-width: 0;
}

.page-head__actions {
    margin-left: auto;
    display: flex;
    gap: var(--s-2);
    flex-wrap: wrap;
}

.page-sub {
    color: var(--text-2);
    font-size: 13.5px;
    margin: 0;
    line-height: 1.45;
}

.wrap {
    display: flex;
    flex-direction: column;
    gap: var(--s-5);
}

.wrap > .page-head {
    margin-bottom: 0; /* gap on .wrap handles spacing to the next block */
}

.section {
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
}

.section__head {
    display: flex;
    align-items: baseline;
    gap: var(--s-3);
}

.section__head .section__link {
    margin-left: auto;
    font-size: 13px;
}

/* Grids */
.grid {
    display: grid;
    gap: var(--s-4);
}

.grid--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid--4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.layout--rail {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--rail-w);
    gap: var(--s-4);
    align-items: start;
}

.rail {
    display: flex;
    flex-direction: column;
    gap: var(--s-4);
    position: sticky;
    top: 84px;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
}

.stack--lg {
    gap: var(--s-5);
}

.row {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    flex-wrap: wrap;
}

.row--tight {
    gap: var(--s-2);
}

.row--between {
    justify-content: space-between;
}

.push {
    margin-left: auto;
}

/* --------------------------------------------------------------------------
   7. Cards
   -------------------------------------------------------------------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    box-shadow: var(--sh-1);
    padding: var(--s-5);
}

.card--flush {
    padding: 0;
    overflow: hidden;
}

.card--sunken {
    background: var(--surface-sunken);
    box-shadow: none;
}

.card--sage {
    background: var(--brand-panel);
    border-color: transparent;
    color: var(--text-on-brand);
}

.card--sage .t-muted,
.card--sage .t-2 {
    color: rgba(30, 46, 37, .78);
}

.card--accent-line {
    border-left: 3px solid var(--accent);
}

.card__head {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    margin-bottom: var(--s-4);
}

.card__title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -.01em;
}

.card__head .card__action {
    margin-left: auto;
    font-size: 13px;
}

.card__foot {
    margin-top: var(--s-4);
    padding-top: var(--s-4);
    border-top: 1px solid var(--hairline);
}

.card-link {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    text-decoration: none;
    color: inherit;
}

.card-link:hover {
    text-decoration: none;
    border-color: var(--border-strong);
}

/* --------------------------------------------------------------------------
   8. Buttons & actions
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-2);
    min-height: 38px;
    padding: 0 var(--s-4);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--text);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.btn:hover {
    background: var(--sage-50);
    border-color: var(--sage-300);
    color: var(--accent-strong);
    text-decoration: none;
}

.btn--primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn--primary:hover {
    background: var(--accent-strong);
    border-color: var(--accent-strong);
    color: #fff;
}

.btn--secondary {
    background: var(--surface);
}

.btn--ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-2);
}

.btn--ghost:hover {
    background: var(--sage-50);
    border-color: transparent;
}

.btn--danger {
    background: var(--surface);
    border-color: #EBC6BF;
    color: var(--danger);
}

.btn--danger:hover {
    background: var(--danger-soft);
    border-color: #E0AFA6;
    color: var(--danger);
}

.btn--sm {
    min-height: 32px;
    padding: 0 var(--s-3);
    font-size: 12.5px;
}

.btn--lg {
    min-height: 46px;
    padding: 0 var(--s-5);
    font-size: 15px;
}

.btn--block {
    width: 100%;
}

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

.btn[disabled],
.btn[aria-disabled="true"] {
    opacity: .55;
    cursor: not-allowed;
}

.btn--icon {
    min-height: 34px;
    width: 34px;
    padding: 0;
    border-radius: var(--r-md);
}

.btn--icon-round {
    border-radius: 50%;
}

.btn--loading {
    pointer-events: none;
    color: transparent;
    position: relative;
}

.btn--loading::after {
    content: "";
    position: absolute;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .55);
    border-top-color: #fff;
    animation: mk-spin .7s linear infinite;
}

.btn--secondary.btn--loading::after,
.btn--ghost.btn--loading::after {
    border-color: var(--sage-300);
    border-top-color: var(--accent);
}

@keyframes mk-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes plan-gen-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .55; }
}

.plan-generate-banner {
    align-items: center;
    gap: var(--s-2);
}

.plan-generate-banner[hidden] {
    display: none !important;
}

.plan-generate-banner.is-busy:not([hidden]) {
    display: inline-flex;
    animation: plan-gen-pulse 1.4s ease-in-out infinite;
}

.plan-generate-banner__spin {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 2px solid var(--sage-300);
    border-top-color: var(--accent);
    animation: mk-spin .7s linear infinite;
}

[data-action="generate-meal-plan"].is-building,
[data-action="generate-meal-plan"][aria-busy="true"] {
    animation: plan-gen-pulse 1.4s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
    .plan-generate-banner.is-busy:not([hidden]),
    [data-action="generate-meal-plan"].is-building,
    [data-action="generate-meal-plan"][aria-busy="true"] {
        animation: none;
    }
}

/* Quick Add FAB */
.fab {
    position: fixed;
    right: var(--s-6);
    bottom: var(--s-6);
    z-index: 40;
    display: inline-flex;
    align-items: center;
    gap: var(--s-3);
    min-height: 48px;
    padding: 0 var(--s-5) 0 var(--s-2);
    border: 0;
    border-radius: var(--r-pill);
    background: var(--sage-500);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    box-shadow: var(--sh-fab);
    cursor: pointer;
}

.fab:hover {
    background: var(--sage-600);
}

.fab__plus {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .26);
    display: grid;
    place-items: center;
}

.fab--static {
    position: static;
    box-shadow: var(--sh-2);
}

/* Stepper — hug content (don't stretch inside .field flex columns) */
.stepper {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    width: max-content;
    max-width: 100%;
    gap: var(--s-2);
    padding: var(--s-1);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-pill);
    background: var(--surface);
}

.stepper__btn {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: var(--sage-50);
    color: var(--accent-strong);
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    display: grid;
    place-items: center;
}

.stepper__btn:hover {
    background: var(--sage-100);
}

.stepper__value {
    min-width: 74px;
    text-align: center;
    font-family: var(--font-mono);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* Editable value: no second box border inside the pill */
input.stepper__value,
.stepper input.stepper__value,
.stepper .input.stepper__value {
    flex: none;
    width: 5.5rem;
    max-width: 5.5rem;
    min-height: 32px;
    margin: 0;
    padding: 0.25rem 0.35rem;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: inherit;
    -moz-appearance: textfield;
    appearance: textfield;
}

input.stepper__value:focus,
input.stepper__value:focus-visible {
    outline: none;
    box-shadow: none;
}

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

/* --------------------------------------------------------------------------
   9. Navigation bits
   -------------------------------------------------------------------------- */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    font-size: 12.5px;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.breadcrumbs a {
    color: var(--text-2);
}

.tabs {
    display: flex;
    gap: var(--s-1);
    border-bottom: 1px solid var(--border);
}

.tab {
    border: 0;
    background: transparent;
    padding: var(--s-3) var(--s-4);
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.tab:hover {
    color: var(--text);
}

.tab[aria-selected="true"] {
    color: var(--accent-strong);
    border-bottom-color: var(--accent);
}

.segmented {
    display: inline-flex;
    padding: 3px;
    gap: 2px;
    background: var(--surface-sunken);
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
}

.segmented__btn {
    border: 0;
    background: transparent;
    border-radius: var(--r-pill);
    padding: 6px var(--s-4);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-2);
    cursor: pointer;
}

.segmented__btn[aria-pressed="true"],
.segmented__btn.active {
    background: var(--surface);
    color: var(--accent-strong);
    box-shadow: var(--sh-1);
}

.bars--scroll {
    overflow-x: auto;
    max-width: 100%;
    padding-bottom: var(--s-2);
}

.bars--scroll .bars__col {
    flex: 0 0 auto;
    width: 2.75rem;
    min-width: 2.75rem;
}

.filters {
    display: flex;
    gap: var(--s-2);
    flex-wrap: wrap;
}

.pager {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    flex-wrap: wrap;
}

.pager__btn {
    min-width: 34px;
    min-height: 34px;
    padding: 0 var(--s-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    background: var(--surface);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.pager__btn[aria-current="page"] {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.pager__info {
    color: var(--text-muted);
    font-size: 12.5px;
    margin-left: var(--s-2);
}

/* Mobile drawer demo */
.drawer-nav {
    width: 260px;
    background: var(--sidebar);
    border-radius: var(--r-card);
    padding: var(--s-4) var(--s-3);
    box-shadow: var(--sh-3);
}

/* --------------------------------------------------------------------------
   10. Forms
   -------------------------------------------------------------------------- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s-4);
}

.form-grid--1 {
    grid-template-columns: minmax(0, 1fr);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.field--wide {
    grid-column: 1 / -1;
}

.label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-2);
}

.label .req {
    color: var(--danger);
    margin-left: 2px;
}

.hint {
    font-size: 12px;
    color: var(--text-muted);
}

.error-text {
    font-size: 12px;
    color: var(--danger);
    display: flex;
    align-items: center;
    gap: 6px;
}

.input,
.select,
.textarea {
    width: 100%;
    min-height: 40px;
    padding: 0 var(--s-3);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    background: var(--surface);
    font-size: 14px;
}

.textarea {
    min-height: 92px;
    padding: var(--s-3);
    resize: vertical;
    line-height: 1.5;
}

.select {
    appearance: none;
    padding-right: var(--s-7);
    background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
        linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
    background-position: calc(100% - 18px) 18px, calc(100% - 13px) 18px;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    cursor: pointer;
}

/* Custom select — same visual language as .dropdown__menu */
.select-wrap {
    position: relative;
    width: 100%;
}

.select-wrap > .select {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

.select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-2);
    width: 100%;
    min-height: 40px;
    padding: 0 var(--s-3);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    background: var(--surface);
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.select-trigger:hover {
    border-color: var(--sage-300);
}

.select-wrap.is-open .select-trigger {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.select-trigger__chev {
    flex: none;
    color: var(--text-muted);
    transition: transform .15s ease;
}

.select-wrap.is-open .select-trigger__chev {
    transform: rotate(180deg);
}

.select-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    bottom: auto;
    z-index: 60;
    min-width: 100%;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--sh-3);
}

.select-wrap.is-drop-up .select-menu {
    top: auto;
    bottom: calc(100% + 6px);
}

.select-menu[hidden] {
    display: none;
}

.select-option {
    display: flex;
    align-items: center;
    width: 100%;
    padding: var(--s-2) var(--s-3);
    border: 0;
    border-radius: var(--r-sm);
    background: transparent;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.select-option:hover,
.select-option:focus-visible {
    background: var(--sage-50);
    color: var(--accent-strong);
    outline: none;
}

.select-option[aria-selected="true"] {
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-weight: 600;
}

.select-wrap.is-disabled .select-trigger {
    background: var(--surface-sunken);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* Custom date picker — popover matches dropdown / select-menu */
.date-wrap {
    position: relative;
    width: 100%;
}

.date-wrap > input[type="date"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

.date-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-2);
    width: 100%;
    min-height: 40px;
    padding: 0 var(--s-3);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    background: var(--surface);
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    text-align: left;
    cursor: pointer;
    font-variant-numeric: tabular-nums;
}

.date-trigger:hover {
    border-color: var(--sage-300);
}

.date-wrap.is-open .date-trigger {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.date-trigger__icon {
    flex: none;
    color: var(--text-muted);
}

.date-wrap.is-disabled .date-trigger {
    background: var(--surface-sunken);
    color: var(--text-muted);
    cursor: not-allowed;
}

.date-popover {
    position: absolute;
    left: 0;
    top: calc(100% + 6px);
    bottom: auto;
    z-index: 60;
    width: min(292px, calc(100vw - 32px));
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--sh-3);
}

.date-wrap.is-drop-up .date-popover {
    top: auto;
    bottom: calc(100% + 6px);
}

.date-popover[hidden] {
    display: none;
}

.date-popover__head {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    margin-bottom: 10px;
}

.date-popover__title {
    flex: 1 1 auto;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -.01em;
    min-width: 0;
}

.date-popover__nav {
    display: flex;
    gap: 4px;
}

.date-nav {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--text-2);
    display: grid;
    place-items: center;
    cursor: pointer;
}

.date-nav:hover {
    background: var(--sage-50);
    color: var(--accent-strong);
}

.date-weekdays,
.date-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.date-weekdays span {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    padding: 4px 0 8px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.date-day {
    aspect-ratio: 1;
    min-height: 34px;
    border: 0;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
}

.date-day:hover {
    background: var(--sage-50);
    color: var(--accent-strong);
}

.date-day.is-muted {
    color: var(--text-muted);
    font-weight: 500;
    opacity: .55;
}

.date-day.is-today:not(.is-selected) {
    box-shadow: inset 0 0 0 1px var(--border-strong);
}

.date-day.is-selected {
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-weight: 700;
}

.date-day.is-selected:hover {
    background: var(--accent-soft);
}

.date-popover__foot {
    display: flex;
    justify-content: space-between;
    gap: var(--s-2);
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--hairline);
}

.date-popover__foot .btn {
    min-height: 32px;
    padding: 0 var(--s-3);
    font-size: 12.5px;
}

.input:hover,
.select:hover,
.textarea:hover {
    border-color: var(--sage-300);
}

.input:disabled,
.select:disabled,
.textarea:disabled {
    background: var(--surface-sunken);
    color: var(--text-muted);
    cursor: not-allowed;
}

.input--invalid {
    border-color: #DFA79C;
    background: var(--danger-soft);
}

.input-unit {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    background: var(--surface);
    overflow: hidden;
}

.input-unit .input {
    border: 0;
    border-radius: 0;
}

.input-unit__unit {
    display: grid;
    place-items: center;
    padding: 0 var(--s-3);
    background: var(--surface-sunken);
    border-left: 1px solid var(--border);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
}

.search {
    position: relative;
    flex: 1 1 240px;
    min-width: 0;
}

.search .icon {
    position: absolute;
    left: 12px;
    top: 11px;
    color: var(--text-muted);
}

.search .input {
    padding-left: 38px;
}

/* Food Log Quick add typeahead */
.log-food-search .search {
    flex: 1 1 auto;
    width: 100%;
}

.food-suggest {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    z-index: 40;
    max-height: 260px;
    overflow: auto;
    padding: 4px;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    background: var(--surface);
    box-shadow: var(--sh-2, 0 10px 28px rgba(26, 44, 34, .12));
}

.food-suggest__item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    width: 100%;
    margin: 0;
    padding: var(--s-2) var(--s-3);
    border: 0;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.food-suggest__item:hover,
.food-suggest__item:focus {
    background: var(--accent-soft);
    outline: none;
}

.food-suggest__name {
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.3;
}

.food-suggest__meta {
    font-size: 11.5px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    line-height: 1.3;
}

.quick-add-actions {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
}

.dish-builder {
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
    padding-top: var(--s-3);
    border-top: 1px solid var(--border);
}

.dish-builder > .t-small {
    margin: 0;
    font-weight: 600;
}

.dish-basket {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
    max-height: 220px;
    overflow: auto;
}

.dish-basket:empty {
    display: none;
}

.dish-basket__row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--s-2);
    align-items: start;
    padding: var(--s-2) var(--s-3);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface-2, var(--sage-50));
}

.dish-basket__main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dish-basket__name {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dish-basket__meta {
    font-size: 11.5px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    line-height: 1.3;
}

.dish-basket__remove {
    flex: 0 0 auto;
    min-width: 32px;
    min-height: 32px;
    padding: 0 var(--s-2);
    border: 0;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--text-2);
    font: inherit;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.dish-basket__remove:hover,
.dish-basket__remove:focus {
    background: var(--danger-soft, #f8e8e4);
    color: var(--danger);
    outline: none;
}

/* Radio cards */
.radio-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--s-3);
}

.radio-card {
    display: flex;
    align-items: flex-start;
    gap: var(--s-3);
    padding: var(--s-3) var(--s-4);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    background: var(--surface);
    cursor: pointer;
}

.radio-card:hover {
    border-color: var(--sage-300);
    background: var(--sage-50);
}

.radio-card input {
    margin: 3px 0 0;
    accent-color: var(--accent);
}

.radio-card > span:last-of-type {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.radio-card__title {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.3;
}

.radio-card__desc {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.35;
}

.radio-card--selected {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 1px var(--accent);
}

/* Chips */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-2);
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 0 var(--s-3);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-pill);
    background: var(--surface);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-2);
    cursor: pointer;
}

.chip:hover {
    border-color: var(--sage-300);
    background: var(--sage-50);
}

.chip[aria-pressed="true"],
.chip--on {
    background: var(--accent-soft);
    border-color: var(--sage-400);
    color: var(--accent-strong);
}

.chip--static {
    cursor: default;
}

/* Checkbox / switch rows */
.check {
    display: flex;
    align-items: flex-start;
    gap: var(--s-3);
    font-size: 13.5px;
}

.check input {
    margin: 2px 0 0;
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

.switch-row {
    display: flex;
    align-items: center;
    gap: var(--s-4);
    padding: var(--s-3) 0;
    border-bottom: 1px solid var(--hairline);
}

.switch-row:last-child {
    border-bottom: 0;
}

.switch {
    margin-left: auto;
    position: relative;
    width: 42px;
    height: 24px;
    flex: none;
    border: 0;
    border-radius: var(--r-pill);
    background: var(--border-strong);
    cursor: pointer;
    transition: background .15s ease;
}

.switch::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: var(--sh-1);
    transition: transform .15s ease;
}

.switch[aria-checked="true"] {
    background: var(--accent);
}

.switch[aria-checked="true"]::after {
    transform: translateX(18px);
}

/* --------------------------------------------------------------------------
   11. Data display
   -------------------------------------------------------------------------- */
/* Food photo thumb — CSS-only placeholder, optional real photo via <img> */
.thumb {
    position: relative;
    width: 56px;
    height: 56px;
    flex: none;
    border-radius: var(--r-md);
    overflow: hidden;
    background:
        radial-gradient(circle at 32% 30%, rgba(255, 255, 255, .75) 0 18%, transparent 19%),
        radial-gradient(circle at 68% 62%, rgba(255, 255, 255, .35) 0 14%, transparent 15%),
        linear-gradient(140deg, var(--sage-200) 0%, var(--sage-300) 45%, #C8D9BE 100%);
    box-shadow: inset 0 0 0 1px rgba(26, 44, 34, .06);
}

.thumb::after {
    content: "";
    position: absolute;
    inset: 30% 26% 26% 30%;
    border-radius: 50%;
    background: linear-gradient(150deg, rgba(255, 255, 255, .5), rgba(255, 255, 255, 0));
    z-index: 0;
    pointer-events: none;
}

/* Real photo must sit above the shine placeholder (084). */
.thumb:has(img)::after {
    content: none;
    display: none;
}

.thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.thumb--lg {
    width: 76px;
    height: 76px;
}

.thumb--sm {
    width: 40px;
    height: 40px;
    border-radius: var(--r-sm);
}

.thumb--wide {
    width: 100%;
    height: 148px;
    border-radius: var(--r-md);
}

.thumb--hero {
    width: 100%;
    height: 260px;
    border-radius: var(--r-card);
}

.thumb--warm {
    background:
        radial-gradient(circle at 35% 32%, rgba(255, 255, 255, .7) 0 16%, transparent 17%),
        linear-gradient(140deg, #F0DCC0 0%, #E7C79C 55%, #D8B183 100%);
}

.thumb--berry {
    background:
        radial-gradient(circle at 35% 32%, rgba(255, 255, 255, .6) 0 16%, transparent 17%),
        linear-gradient(140deg, #E9C6CC 0%, #D9A2B0 55%, #C58496 100%);
}

/* Meal row */
.meal-row {
    display: flex;
    align-items: center;
    gap: var(--s-4);
    padding: var(--s-3) var(--s-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    box-shadow: var(--sh-1);
}

.meal-row + .meal-row {
    margin-top: var(--s-3);
}

.meal-row__body {
    min-width: 0;
    flex: 1 1 auto;
}

.meal-row__title {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    flex-wrap: wrap;
    font-size: 14.5px;
    font-weight: 600;
}

.meal-row__meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.meal-row__time {
    font-size: 11.5px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.meal-row__remove {
    flex: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--sage-300);
    background: var(--surface);
    color: var(--sage-600);
    display: grid;
    place-items: center;
    cursor: pointer;
}

.meal-row__remove:hover {
    background: var(--danger-soft);
    border-color: #E0AFA6;
    color: var(--danger);
}

/* Micro tag next to meal name */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 9px 2px 6px;
    border-radius: var(--r-pill);
    background: var(--surface-sunken);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-2);
}

.tag__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ring-orange);
    flex: none;
}

.tag--fiber .tag__dot {
    background: var(--ring-orange);
}

.tag--vitamins .tag__dot {
    background: #B0577F;
}

.tag--magnesium .tag__dot {
    background: var(--ring-blue);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: var(--r-pill);
    font-size: 11.5px;
    font-weight: 700;
    background: var(--surface-sunken);
    color: var(--text-2);
}

.badge--green {
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.badge--blue {
    background: var(--info-soft);
    color: #24788F;
}

.badge--orange {
    background: var(--warn-soft);
    color: var(--warn);
}

.badge--red {
    background: var(--danger-soft);
    color: var(--danger);
}

.badge--outline {
    background: transparent;
    box-shadow: inset 0 0 0 1px var(--border-strong);
}

/* Big kcal number */
.kcal-big {
    display: flex;
    align-items: baseline;
    gap: var(--s-2);
}

.kcal-big__value {
    font-family: var(--font-mono);
    font-size: 44px;
    font-weight: 700;
    letter-spacing: -.03em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.kcal-big__unit {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
}

.kcal-big__goal {
    font-size: 13px;
    color: var(--text-muted);
}

/* Macro bars */
.macro + .macro {
    margin-top: var(--s-4);
}

.macro__head {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    margin-bottom: 6px;
    font-size: 13px;
}

.macro__name {
    font-weight: 600;
}

.macro__values {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--text-2);
}

.macro__bar {
    height: 8px;
    border-radius: var(--r-pill);
    background: var(--surface-sunken);
    overflow: hidden;
}

.macro__fill {
    height: 100%;
    width: calc(var(--pct, 0) * 1%);
    border-radius: var(--r-pill);
    background: var(--ring-green);
}

.macro--protein .macro__fill {
    background: var(--ring-green);
}

.macro--carbs .macro__fill {
    background: var(--ring-orange);
}

.macro--fat .macro__fill {
    background: var(--ring-blue);
}

.macro--fiber .macro__fill {
    background: var(--sage-500);
}

.macro__fill--over {
    background: var(--danger);
}

.pill-left,
.pill-over {
    padding: 2px 8px;
    border-radius: var(--r-pill);
    font-size: 11px;
    font-weight: 700;
}

.pill-left {
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.pill-over {
    background: var(--danger-soft);
    color: var(--danger);
}

/* Rings */
.rings {
    display: flex;
    gap: var(--s-4);
    flex-wrap: wrap;
    justify-content: space-around;
}

.ring {
    position: relative;
    width: 96px;
    height: 96px;
    flex: none;
    text-align: center;
}

.ring--sm {
    width: 68px;
    height: 68px;
}

.ring--lg {
    width: 168px;
    height: 168px;
}

.ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.ring__track {
    fill: none;
    stroke: var(--surface-sunken);
    stroke-width: 7;
}

.ring__value {
    fill: none;
    stroke: var(--ring-green);
    stroke-width: 7;
    stroke-linecap: round;
    stroke-dasharray: calc(var(--pct, 0) * 2.827) 999;
}

.ring--orange .ring__value {
    stroke: var(--ring-orange);
}

.ring--blue .ring__value {
    stroke: var(--ring-blue);
}

.ring--water .ring__value {
    stroke: var(--water);
}

.ring--burn .ring__value {
    stroke: var(--burn);
}

.ring__label {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    gap: 2px;
}

.ring__num {
    font-family: var(--font-mono);
    font-size: 17px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.ring--lg .ring__num {
    font-size: 30px;
}

.ring__cap {
    font-size: 11px;
    color: var(--text-muted);
}

.ring-legend {
    display: flex;
    justify-content: space-around;
    gap: var(--s-3);
    margin-top: var(--s-3);
    font-size: 12px;
    color: var(--text-2);
    text-align: center;
}

/* Mini stats */
.ministat {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    padding: var(--s-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    box-shadow: var(--sh-1);
}

.ministat__icon {
    width: 38px;
    height: 38px;
    flex: none;
    border-radius: var(--r-md);
    display: grid;
    place-items: center;
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.ministat__icon--water {
    background: var(--info-soft);
    color: #2C8AAE;
}

.ministat__icon--burn {
    background: #FBEDE6;
    color: var(--burn);
}

.ministat__icon--weight {
    background: var(--surface-sunken);
    color: var(--text-2);
}

.ministat__value {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.1;
}

.ministat__label {
    font-size: 12px;
    color: var(--text-muted);
}

/* Progress bar */
.progress {
    height: 10px;
    border-radius: var(--r-pill);
    background: var(--surface-sunken);
    overflow: hidden;
}

.progress__fill {
    height: 100%;
    width: calc(var(--pct, 0) * 1%);
    border-radius: var(--r-pill);
    background: var(--water);
}

.progress--burn .progress__fill {
    background: var(--burn);
}

.progress--green .progress__fill {
    background: var(--ring-green);
}

/* Bar chart */
.bars {
    display: flex;
    align-items: flex-end;
    gap: var(--s-2);
    height: 140px;
    padding-top: var(--s-2);
}

.bars__col {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 0;
    height: 100%;
    justify-content: flex-end;
}

.bar {
    width: 100%;
    max-width: 30px;
    /* Height must be inline px — % inside flex column collapses (067). */
    height: 2px;
    min-height: 2px;
    border-radius: var(--r-sm) var(--r-sm) 3px 3px;
    background: var(--sage-400);
    flex-shrink: 0;
}

.bar--water {
    background: var(--water);
    opacity: .85;
}

.bar--burn {
    background: var(--burn);
    opacity: .85;
}

.bar--muted {
    background: var(--sage-200);
}

.bars__label {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    white-space: nowrap;
    line-height: 1.2;
    text-align: center;
}

.spark {
    width: 100%;
    height: 46px;
}

.spark polyline {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Water droplets */
.droplets {
    display: flex;
    align-items: center;
    gap: 6px;
}

.droplet {
    width: 20px;
    height: 24px;
    color: var(--water);
    fill: currentColor;
    stroke: none;
    opacity: .95;
}

.droplet--empty {
    color: var(--border-strong);
}

.droplets__label {
    margin-left: var(--s-2);
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* Burned flames — same row layout as droplets, burn color */
.flames .flame {
    color: var(--burn);
    fill: currentColor;
    stroke: none;
}

.flames .flame--empty {
    color: var(--border-strong);
}

/* Table */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    background: var(--surface);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.table th,
.table td {
    text-align: left;
    padding: var(--s-3) var(--s-4);
    border-bottom: 1px solid var(--hairline);
    white-space: nowrap;
}

.table th {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    background: var(--surface-2);
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

.table td.num {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

/* Definition list for nutrition facts */
.dl {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--s-2) var(--s-4);
    font-size: 13.5px;
}

.dl dt {
    color: var(--text-2);
}

.dl dd {
    margin: 0;
    font-family: var(--font-mono);
    font-weight: 600;
}

/* --------------------------------------------------------------------------
   12. Content blocks
   -------------------------------------------------------------------------- */
.insight {
    background: var(--brand-panel);
    border-radius: var(--r-card);
    padding: var(--s-5);
    color: var(--text-on-brand);
    display: flex;
    gap: var(--s-4);
}

.insight__body {
    min-width: 0;
}

.insight__title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-on-brand);
}

.insight__text {
    font-size: 13.5px;
    color: var(--text-on-brand);
    opacity: .92;
}

.insight__mark {
    margin-left: auto;
    width: 34px;
    height: 34px;
    flex: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .3);
    color: #fff;
    display: grid;
    place-items: center;
}

/* Recipe cards */
.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: var(--s-4);
}

.recipe-card {
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
    padding: var(--s-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    box-shadow: var(--sh-1);
    color: inherit;
}

.recipe-card:hover {
    box-shadow: var(--sh-2);
    text-decoration: none;
}

.recipe-card__title {
    font-size: 14.5px;
    font-weight: 600;
    line-height: 1.3;
}

.recipe-card__meta {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    font-size: 12px;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.recipe-card__foot {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: var(--s-2);
}

/* Ingredients / steps */
.ing-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.ing-list li {
    display: flex;
    gap: var(--s-3);
    padding: var(--s-3) 0;
    border-bottom: 1px solid var(--hairline);
    font-size: 13.5px;
}

.ing-list li:last-child {
    border-bottom: 0;
}

.ing-list .qty {
    margin-left: auto;
    font-family: var(--font-mono);
    color: var(--text-2);
}

.steps {
    list-style: none;
    padding: 0;
    counter-reset: step;
    display: flex;
    flex-direction: column;
    gap: var(--s-4);
}

.steps li {
    counter-increment: step;
    display: flex;
    gap: var(--s-3);
    font-size: 13.5px;
    line-height: 1.55;
}

.steps li::before {
    content: counter(step);
    flex: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    display: grid;
    place-items: center;
}

/* Shopping list */
.shop-item {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    padding: var(--s-3) 0;
    border-bottom: 1px solid var(--hairline);
    font-size: 13.5px;
}

.shop-item:last-child {
    border-bottom: 0;
}

.shop-item input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

.shop-item__qty {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--text-2);
}

.shop-item--done .shop-item__name {
    text-decoration: line-through;
    color: var(--text-muted);
}

/* Meal plan day */
.plan-day {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    box-shadow: var(--sh-1);
    padding: var(--s-4);
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
}

.plan-day__head {
    display: flex;
    align-items: center;
    gap: var(--s-2);
}

.plan-day__date {
    font-size: 14px;
    font-weight: 700;
}

.plan-day__kcal {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--text-2);
}

.plan-slot {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    padding: var(--s-2);
    border: 1px dashed var(--border-strong);
    border-radius: var(--r-md);
}

.plan-slot--filled {
    border-style: solid;
    background: var(--surface-2);
}

.plan-slot__name {
    font-size: 13px;
    font-weight: 600;
    min-width: 0;
}

.plan-slot__meta {
    font-size: 11.5px;
    color: var(--text-muted);
}

.plan-slot__actions {
    margin-left: auto;
    display: flex;
    gap: 4px;
}

.plan-week {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--s-4);
}

/* Calendar strip — mockup .cal-day (not flat SAT/SUN chips) */
.day-strip-row {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    margin-top: var(--s-4);
}

.day-strip-row .cal-strip {
    flex: 1;
    min-width: 0;
    margin: 0;
}

.day-strip-today {
    flex: none;
    white-space: nowrap;
}

.day-strip-hint {
    margin: var(--s-2) 0 0;
}

.cal-strip {
    display: flex;
    gap: var(--s-2);
    overflow-x: auto;
    padding-bottom: var(--s-1);
    -webkit-overflow-scrolling: touch;
}

.cal-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    flex: none;
    width: 52px;
    min-height: 56px;
    padding: var(--s-2) 0;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    text-align: center;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.cal-day:disabled {
    opacity: 0.45;
    cursor: default;
}

.cal-day__dow {
    display: block;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    line-height: 1.2;
}

.cal-day__num {
    display: block;
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
}

.cal-day[aria-pressed="true"],
.cal-day.is-active {
    background: var(--accent-soft);
    border-color: var(--sage-400);
    color: var(--accent-strong);
}

.cal-day[aria-pressed="true"] .cal-day__dow,
.cal-day.is-active .cal-day__dow {
    color: var(--accent-strong);
}

.input-unit__unit {
    min-width: 2.75rem;
    text-align: center;
    white-space: nowrap;
}

.range {
    display: flex;
    align-items: flex-end;
    gap: var(--s-3);
    flex-wrap: wrap;
}

/* Guide / article */
.article {
    max-width: 720px;
}

.article h2 {
    font-size: 20px;
    font-weight: 700;
    margin: var(--s-6) 0 var(--s-2);
}

.article h3 {
    font-size: 16px;
    font-weight: 600;
    margin: var(--s-5) 0 var(--s-2);
}

.article p {
    margin: 0 0 var(--s-4);
    font-size: 14.5px;
    line-height: 1.65;
    color: var(--text-2);
}

.article ul {
    margin: 0 0 var(--s-4) var(--s-5);
    color: var(--text-2);
    line-height: 1.65;
}

.article-meta {
    display: flex;
    gap: var(--s-3);
    font-size: 12.5px;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.toc-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--s-4);
}

/* Tool calculator */
.calc {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: var(--s-5);
    align-items: start;
}

.calc__result {
    background: var(--accent-soft);
    border: 1px solid var(--sage-300);
    border-radius: var(--r-card);
    padding: var(--s-5);
    text-align: center;
}

.calc__value {
    font-family: var(--font-mono);
    font-size: 34px;
    font-weight: 700;
    color: var(--accent-strong);
    line-height: 1.1;
}

/* Empty / skeleton / notice / banner */
.empty {
    text-align: center;
    padding: var(--s-8) var(--s-5);
    border: 1px dashed var(--border-strong);
    border-radius: var(--r-card);
    background: var(--surface-2);
}

.empty__icon {
    width: 48px;
    height: 48px;
    margin: 0 auto var(--s-3);
    border-radius: 50%;
    background: var(--sage-100);
    color: var(--sage-600);
    display: grid;
    place-items: center;
}

.skeleton {
    background: linear-gradient(90deg, var(--surface-sunken) 25%, #E9EFEA 37%, var(--surface-sunken) 63%);
    background-size: 400% 100%;
    animation: mk-shimmer 1.4s ease infinite;
    border-radius: var(--r-sm);
}

.skeleton--line {
    height: 12px;
    margin-bottom: var(--s-2);
}

.skeleton--title {
    height: 18px;
    width: 46%;
    margin-bottom: var(--s-3);
}

.skeleton--thumb {
    width: 56px;
    height: 56px;
    border-radius: var(--r-md);
}

.skeleton--short {
    width: 64%;
}

@keyframes mk-shimmer {
    0% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0 50%;
    }
}

.notice {
    display: flex;
    gap: var(--s-3);
    padding: var(--s-3) var(--s-4);
    border-radius: var(--r-md);
    background: var(--info-soft);
    color: #23708A;
    font-size: 13.5px;
    align-items: flex-start;
}

.notice--warn {
    background: var(--warn-soft);
    color: #96660F;
}

.notice--error {
    background: var(--danger-soft);
    color: var(--danger);
}

.notice--success {
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.banner {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    padding: var(--s-3) var(--s-4);
    border-radius: var(--r-md);
    background: var(--accent-soft);
    border: 1px solid var(--sage-300);
    color: var(--accent-strong);
    font-size: 13.5px;
    font-weight: 600;
}

.banner__actions {
    margin-left: auto;
    display: flex;
    gap: var(--s-2);
}

.banner--warn {
    background: var(--warn-soft);
    border-color: #EBD6A8;
    color: #96660F;
}

/* Chat */
.chat {
    display: flex;
    flex-direction: column;
    gap: var(--s-4);
    padding: var(--s-2) 0;
}

.msg {
    display: flex;
    gap: var(--s-3);
    max-width: 78%;
}

.msg__bubble {
    padding: var(--s-3) var(--s-4);
    border-radius: var(--r-card);
    font-size: 13.5px;
    line-height: 1.55;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--sh-1);
}

.msg__time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    font-family: var(--font-mono);
}

.msg--user {
    margin-left: auto;
    flex-direction: row-reverse;
}

.msg--user .msg__bubble {
    background: var(--accent-soft);
    border-color: var(--sage-300);
}

.msg--ai .avatar {
    background: var(--sage-200);
    color: var(--sage-800);
}

.msg--user .avatar {
    background: var(--surface-sunken);
    color: var(--text-2);
}

.msg--error .msg__bubble {
    border-color: color-mix(in srgb, var(--danger, #b42318) 45%, var(--border));
    color: var(--text-2);
}

.chat-input {
    display: flex;
    align-items: flex-end;
    gap: var(--s-3);
    padding: var(--s-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    box-shadow: var(--sh-1);
}

.chat-input .textarea {
    border: 0;
    min-height: 44px;
    box-shadow: none;
}

/* Key-value list */
.kv {
    display: flex;
    flex-direction: column;
}

.kv__row {
    display: flex;
    align-items: center;
    gap: var(--s-4);
    padding: var(--s-3) 0;
    border-bottom: 1px solid var(--hairline);
    font-size: 13.5px;
}

.kv__row:last-child {
    border-bottom: 0;
}

.kv__key {
    color: var(--text-2);
}

.kv__val {
    margin-left: auto;
    font-weight: 600;
}

/* Milestones / timeline */
.timeline {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--s-4);
}

.timeline li {
    display: flex;
    gap: var(--s-3);
    font-size: 13.5px;
}

.timeline__dot {
    width: 22px;
    height: 22px;
    flex: none;
    border-radius: 50%;
    background: var(--surface-sunken);
    color: var(--text-muted);
    display: grid;
    place-items: center;
}

.timeline__dot--done {
    background: var(--accent-soft);
    color: var(--accent-strong);
}

/* --------------------------------------------------------------------------
   13. Overlays
   -------------------------------------------------------------------------- */
.overlay-demo {
    position: relative;
    min-height: 260px;
    border-radius: var(--r-card);
    background: var(--surface-sunken);
    padding: var(--s-4);
    overflow: hidden;
}

.scrim {
    position: absolute;
    inset: 0;
    background: rgba(26, 44, 34, .32);
}

.modal {
    position: relative;
    width: min(460px, 100%);
    margin: var(--s-6) auto;
    background: var(--surface);
    border-radius: var(--r-card);
    box-shadow: var(--sh-3);
    padding: var(--s-5);
}

.modal__head {
    display: flex;
    align-items: flex-start;
    gap: var(--s-3);
    margin-bottom: var(--s-4);
}

.modal__title {
    font-size: 17px;
    font-weight: 700;
}

.modal__close {
    margin-left: auto;
}

.modal__foot {
    display: flex;
    gap: var(--s-2);
    justify-content: flex-end;
    margin-top: var(--s-5);
}

.modal--recipe {
    width: min(560px, 100%);
    max-height: min(88vh, 720px);
    display: flex;
    flex-direction: column;
}

.modal--recipe .modal__body {
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.modal--recipe .modal__foot {
    flex-wrap: wrap;
    flex-shrink: 0;
}

.drawer {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(340px, 86%);
    background: var(--surface);
    box-shadow: var(--sh-3);
    padding: var(--s-5);
    display: flex;
    flex-direction: column;
    gap: var(--s-4);
}

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown__menu {
    min-width: 200px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--sh-3);
    padding: 6px;
}

.dropdown__item {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    width: 100%;
    padding: var(--s-2) var(--s-3);
    border: 0;
    border-radius: var(--r-sm);
    background: transparent;
    font-size: 13.5px;
    text-align: left;
    cursor: pointer;
}

.dropdown__item:hover {
    background: var(--sage-50);
    color: var(--accent-strong);
    text-decoration: none;
}

.dropdown__sep {
    height: 1px;
    background: var(--hairline);
    margin: 5px 4px;
}

.tooltip {
    display: inline-block;
    padding: 5px 10px;
    border-radius: var(--r-sm);
    background: var(--sage-800);
    color: #fff;
    font-size: 12px;
    box-shadow: var(--sh-2);
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    padding: var(--s-3) var(--s-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--r-md);
    box-shadow: var(--sh-3);
    font-size: 13.5px;
    max-width: 380px;
}

.toast--error {
    border-left-color: var(--danger);
}

.toast--info {
    border-left-color: var(--info);
}

.toast__close {
    margin-left: auto;
}

/* --------------------------------------------------------------------------
   14. Public site
   -------------------------------------------------------------------------- */
.mk-public {
    background: var(--surface-2);
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    backdrop-filter: saturate(140%) blur(6px);
}

.site-header__in,
.wrap {
    max-width: var(--site-max);
    width: 100%;
    margin: 0 auto;
    padding: 0 var(--s-6);
    box-sizing: border-box;
}

.site-header__in {
    display: flex;
    align-items: center;
    gap: var(--s-5);
    min-height: 62px;
}

.site-brand {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    font-size: 17px;
    font-weight: 700;
    color: var(--sage-800);
    letter-spacing: -.02em;
}

.site-brand .brand-mark {
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.site-nav {
    display: flex;
    gap: var(--s-1);
    flex-wrap: wrap;
}

.site-nav a {
    padding: 8px var(--s-3);
    border-radius: var(--r-sm);
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-2);
}

.site-nav a:hover {
    background: var(--sage-50);
    color: var(--accent-strong);
    text-decoration: none;
}

.site-nav a[aria-current="page"] {
    color: var(--accent-strong);
    background: var(--accent-soft);
}

.site-header__cta {
    margin-left: auto;
    display: flex;
    gap: var(--s-2);
    align-items: center;
}

.site-main {
    padding: var(--s-7) 0 var(--s-9);
    display: flex;
    flex-direction: column;
    gap: var(--s-7);
}

.hero {
    background: var(--hero-bg);
    border-radius: var(--r-lg);
    padding: var(--s-9) var(--s-7);
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
    gap: var(--s-7);
    align-items: center;
}

.hero__title {
    font-size: 40px;
    line-height: 1.1;
    font-weight: 700;
    letter-spacing: -.03em;
}

.hero__text {
    margin-top: var(--s-4);
    font-size: 16px;
    color: var(--text-2);
    max-width: 46ch;
}

.hero__actions {
    margin-top: var(--s-5);
    display: flex;
    gap: var(--s-3);
    flex-wrap: wrap;
}

.hero__note {
    margin-top: var(--s-3);
    font-size: 12.5px;
    color: var(--text-muted);
}

.hero__art {
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--s-4);
}

.feature {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    padding: var(--s-5);
    box-shadow: var(--sh-1);
}

.feature__icon {
    width: 40px;
    height: 40px;
    border-radius: var(--r-md);
    background: var(--accent-soft);
    color: var(--accent-strong);
    display: grid;
    place-items: center;
    margin-bottom: var(--s-3);
}

.pricing {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--s-4);
}

.price-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    padding: var(--s-6);
    box-shadow: var(--sh-1);
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
}

.price-card--featured {
    border-color: var(--sage-400);
    box-shadow: var(--sh-2);
}

.price-card__amount {
    font-family: var(--font-mono);
    font-size: 34px;
    font-weight: 700;
    letter-spacing: -.02em;
}

.price-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
    font-size: 13.5px;
    color: var(--text-2);
}

.price-list li {
    display: flex;
    gap: var(--s-2);
    align-items: flex-start;
}

.price-list .icon {
    color: var(--accent);
    margin-top: 2px;
}

.faq {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
}

.faq details {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--s-4);
}

.faq summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 14.5px;
    list-style: none;
    display: flex;
    align-items: center;
    gap: var(--s-3);
}

.faq summary::-webkit-details-marker {
    display: none;
}

.faq summary::after {
    content: "+";
    margin-left: auto;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

.faq details[open] summary::after {
    content: "\2212";
}

.faq p {
    margin-top: var(--s-3);
    color: var(--text-2);
    line-height: 1.6;
}

.auth-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: var(--s-7) var(--s-4);
    background: var(--auth-bg);
}

.auth-card {
    width: min(420px, 100%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-3);
    padding: var(--s-7);
    display: flex;
    flex-direction: column;
    gap: var(--s-4);
}

.auth-sep {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    color: var(--text-muted);
    font-size: 12px;
}

.auth-sep::before,
.auth-sep::after {
    content: "";
    flex: 1 1 auto;
    height: 1px;
    background: var(--border);
}

.adslot {
    border: 1px dashed var(--border-strong);
    border-radius: var(--r-md);
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
    padding: var(--s-6) var(--s-4);
}

.adslot--rail {
    min-height: 250px;
    display: grid;
    place-items: center;
}

.site-footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    padding: var(--s-7) 0;
    color: var(--text-2);
    font-size: 13px;
}

.site-footer__cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--s-5);
}

.site-footer h4 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    margin-bottom: var(--s-2);
}

.site-footer ul {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.site-footer__bottom {
    margin-top: var(--s-6);
    padding-top: var(--s-4);
    border-top: 1px solid var(--hairline);
    display: flex;
    gap: var(--s-4);
    flex-wrap: wrap;
    color: var(--text-muted);
    font-size: 12.5px;
}

/* Public content lists */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--s-4);
}

.tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    padding: var(--s-4);
    box-shadow: var(--sh-1);
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
    color: inherit;
}

.tile:hover {
    box-shadow: var(--sh-2);
    text-decoration: none;
}

.tile__title {
    font-size: 14.5px;
    font-weight: 600;
}

.compare {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--s-4);
}

.error-page {
    min-height: 70vh;
    display: grid;
    place-items: center;
    text-align: center;
}

.error-code {
    font-family: var(--font-mono);
    font-size: 64px;
    font-weight: 700;
    color: var(--sage-400);
    line-height: 1;
}

/* --------------------------------------------------------------------------
   15. Mockup-kit chrome (index / components pages only)
   -------------------------------------------------------------------------- */
.kit {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: var(--s-6);
    max-width: 1320px;
    margin: 0 auto;
    padding: var(--s-6);
}

.kit-toc {
    position: sticky;
    top: var(--s-6);
    align-self: start;
    max-height: calc(100vh - 48px);
    overflow: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    padding: var(--s-4);
}

.kit-toc ul {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.kit-toc a {
    display: block;
    padding: 6px var(--s-3);
    border-radius: var(--r-sm);
    font-size: 13px;
    color: var(--text-2);
    font-weight: 500;
}

.kit-toc a:hover {
    background: var(--sage-50);
    color: var(--accent-strong);
    text-decoration: none;
}

.kit-body {
    display: flex;
    flex-direction: column;
    gap: var(--s-7);
    min-width: 0;
}

.kit-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: var(--s-6);
}

.kit-header__in {
    max-width: 1320px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: var(--s-4);
    flex-wrap: wrap;
}

.kit-group {
    scroll-margin-top: var(--s-5);
}

.kit-group__title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -.02em;
    padding-bottom: var(--s-2);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--s-4);
}

.cmp {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    overflow: hidden;
}

.cmp + .cmp {
    margin-top: var(--s-4);
}

.cmp__head {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    padding: var(--s-3) var(--s-4);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.cmp__name {
    font-size: 13.5px;
    font-weight: 600;
}

.cmp__note {
    font-size: 12px;
    color: var(--text-muted);
}

.cmp__actions {
    margin-left: auto;
    display: flex;
    gap: var(--s-2);
}

.cmp__preview {
    padding: var(--s-5);
    background: var(--page);
    display: flow-root;
}

.cmp__preview--sage {
    background: var(--sage-100);
}

.cmp__code {
    margin: 0;
    padding: var(--s-4);
    background: var(--code-bg);
    border-top: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-2);
    overflow: auto;
    max-height: 320px;
    white-space: pre;
}

.cmp__code[hidden] {
    display: none;
}

.copy-btn[data-copied="1"] {
    background: var(--accent-soft);
    border-color: var(--sage-400);
    color: var(--accent-strong);
}

/* Foundations helpers */
.swatches {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: var(--s-3);
}

.swatch {
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
    background: var(--surface);
}

.swatch__chip {
    height: 54px;
}

.swatch__meta {
    padding: var(--s-2) var(--s-3);
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--text-2);
}

.swatch__meta b {
    display: block;
    color: var(--text);
}

.icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: var(--s-3);
}

.icon-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: var(--s-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--text-muted);
    text-align: center;
}

.spec-row {
    display: flex;
    align-items: center;
    gap: var(--s-4);
    padding: var(--s-3) 0;
    border-bottom: 1px solid var(--hairline);
    font-size: 13px;
}

.spec-row:last-child {
    border-bottom: 0;
}

.spec-row code {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--accent-strong);
}

.spec-demo {
    background: var(--sage-200);
    height: 22px;
    border-radius: var(--r-xs);
}

.shadow-demo {
    width: 120px;
    height: 66px;
    border-radius: var(--r-md);
    background: var(--surface);
}

/* Index page cards */
.mk-index {
    background: var(--page);
}

.index-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: var(--s-3);
}

.index-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: var(--s-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--sh-1);
    color: inherit;
}

.index-card:hover {
    border-color: var(--sage-400);
    box-shadow: var(--sh-2);
    text-decoration: none;
}

.index-card__name {
    font-size: 14px;
    font-weight: 600;
}

.index-card__file {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   16. Utilities
   -------------------------------------------------------------------------- */
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--s-2); }
.mt-3 { margin-top: var(--s-3); }
.mt-4 { margin-top: var(--s-4); }
.mt-5 { margin-top: var(--s-5); }
.mb-2 { margin-bottom: var(--s-2); }
.mb-3 { margin-bottom: var(--s-3); }
.mb-4 { margin-bottom: var(--s-4); }
.w-100 { width: 100%; }
.nowrap { white-space: nowrap; }
.hide { display: none; }

/* Floating mockup theme-bar — disabled in UI v2 (themes live in Settings) */
.theme-bar {
    display: none !important;
}

.theme-swatch {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--surface);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12), 0 0 0 1px var(--border);
    cursor: pointer;
    padding: 0;
    background: var(--sw, var(--accent));
    flex: none;
}

.theme-swatch[aria-pressed="true"] {
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12), 0 0 0 2px var(--accent);
}

.theme-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--s-3);
}

.theme-picker__opt {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    width: 100%;
    padding: var(--s-3);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--text);
    text-align: left;
    cursor: pointer;
    font: inherit;
}

.theme-picker__opt:hover {
    border-color: var(--border-strong);
    background: var(--sage-50);
}

.theme-picker__opt[aria-pressed="true"] {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
    background: var(--accent-soft);
}

.theme-picker__meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.theme-picker__name {
    font-size: 13px;
    font-weight: 700;
}

.theme-picker__id {
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.v2-panel[hidden] {
    display: none !important;
}

[data-bind="plan-days-card"][hidden] {
    display: none !important;
}

.v2-placeholder {
    padding: var(--s-7);
    text-align: center;
    color: var(--text-muted);
}

.badge--preview {
    background: var(--warn-soft);
    color: var(--warn);
}

/* UI v2 overlays (020) */
.v2-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: grid;
    place-items: center;
    padding: var(--s-4);
    background: rgba(26, 44, 34, .4);
}

.v2-overlay[hidden] {
    display: none !important;
}

.v2-toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--s-6) + 56px);
    transform: translateX(-50%);
    z-index: 70;
}

.v2-toast[hidden] {
    display: none !important;
}

/* Sync chip + logout unsynced modal (024 cutover) */
.sync-chip {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    padding: 6px 10px;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    background: var(--surface-2);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: var(--s-2);
}

.sync-chip[data-state="pending"] {
    border-color: var(--accent-soft);
    color: var(--accent-strong);
}

.sync-chip[data-state="error"] {
    border-color: #FECACA;
    color: #B91C1C;
    background: #FEF2F2;
}

.sync-chip[data-state="synced"] {
    border-color: var(--sage-200, var(--border));
    color: var(--sage-700, var(--text-2));
}

.sync-chip__retry {
    margin-left: auto;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: none;
    place-items: center;
    padding: var(--s-4);
    background: rgba(26, 44, 34, .4);
}

.modal-overlay.active {
    display: grid;
}

.modal-overlay .modal {
    margin: 0;
    width: min(420px, 100%);
}

html[data-ui-mode="preview"] #signInBtn,
html[data-ui-mode="preview"] #signOutBtn,
html[data-ui-mode="preview"] #sidebarSyncStatus {
    display: none !important;
}

.recipe-card {
    cursor: pointer;
    text-align: left;
    border: 0;
    font: inherit;
    color: inherit;
}

.recipe-card__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-2);
    width: 100%;
}

.recipe-card .btn.is-fav,
button.is-fav {
    color: var(--ring-orange);
}

.recipe-card .btn.is-fav .icon {
    fill: currentColor;
    stroke: currentColor;
}

/* --------------------------------------------------------------------------
   17. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1180px) {
    .layout--rail {
        grid-template-columns: minmax(0, 1fr);
    }

    .rail {
        position: static;
    }

    .kit {
        grid-template-columns: minmax(0, 1fr);
    }

    .kit-toc {
        position: static;
        max-height: none;
    }
}

@media (max-width: 1024px) {
    :root {
        --sidebar-w: 200px;
    }

    .grid--4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .grid--3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hero {
        grid-template-columns: minmax(0, 1fr);
        padding: var(--s-7) var(--s-5);
    }

    .calc {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        z-index: 60;
        left: 0;
        top: 0;
        bottom: 0;
        height: 100%;
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: var(--sh-3);
    }

    .app-shell[data-nav="open"] .sidebar {
        transform: none;
    }

    /* Real overlay (clickable) — ::after cannot receive clicks reliably (094). */
    .nav-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 50;
        border: 0;
        padding: 0;
        margin: 0;
        background: rgba(26, 44, 34, .34);
        cursor: pointer;
    }

    .app-shell[data-nav="open"] .nav-backdrop {
        display: block;
    }

    .sidebar__close {
        display: inline-flex;
    }

    .btn.sidebar__close,
    .sidebar .sidebar__close {
        display: inline-flex;
    }

    .btn.menu-btn,
    .topbar .menu-btn,
    .menu-btn {
        display: inline-flex;
    }

    .content {
        padding: var(--s-4);
        gap: var(--s-4);
    }

    .topbar {
        padding: var(--s-3) var(--s-4);
    }

    .grid--2,
    .grid--3,
    .grid--4,
    .form-grid,
    .compare {
        grid-template-columns: minmax(0, 1fr);
    }

    .t-h1,
    .hero__title {
        font-size: 26px;
    }

    .kcal-big__value {
        font-size: 36px;
    }

    .card {
        padding: var(--s-4);
    }

    .site-header__in,
    .wrap {
        padding: 0 var(--s-4);
    }

    .site-nav {
        display: none;
    }

    .fab {
        right: var(--s-4);
        bottom: var(--s-4);
    }

    .meal-row {
        gap: var(--s-3);
    }

    .kit {
        padding: var(--s-4);
    }

    .site-main {
        padding: var(--s-5) 0 var(--s-8);
        gap: var(--s-5);
    }
}

@media print {
    .sidebar,
    .fab,
    .topbar,
    .cmp__actions {
        display: none !important;
    }
}
