/* Diet UI — warm, calm, mobile-first. */
@layer reset, tokens, base, layout, components, pages, responsive;

@layer reset {
  *,*::before,*::after{box-sizing:border-box}
  html{font-size:16px;scroll-behavior:smooth}
  body,h1,h2,h3,p,dl,dd{margin:0}
  body{min-width:320px}
  img,svg{display:block;max-width:100%}
  button,input,select,textarea{font:inherit}
  button,a{-webkit-tap-highlight-color:transparent}
}

@layer tokens {
  :root{
    color-scheme:light;
    --canvas:#f7f8f4;--canvas-background:#f7f8f4;--surface:#fff;--surface-soft:#f1f5ec;--surface-warm:#fbfcf8;
    --ink:#1f291f;--ink-soft:#3d493e;--muted:#69736a;--muted-light:#879087;
    --border:#e2e8df;--border-strong:#ccd7c9;
    --green-700:#347b22;--green-600:#55a82f;--green-500:#70b83f;--green-200:#d7edc6;--green-100:#eaf5de;
    --blue:#4a9ad7;--blue-soft:#e7f3fb;--orange:#e99632;--orange-soft:#fff0de;--chart-grid:#e5ebe2;--chart-label:#69736a;
    --bmi-under:#86c5d2;--bmi-healthy:#70b83f;--bmi-over:#e7ba4c;--bmi-obese:#e27d67;
    --red:#b84f4a;--red-soft:#fcebea;--shadow:0 12px 30px rgba(42,67,35,.07);
    --shadow-raised:0 18px 45px rgba(42,67,35,.16);
    --radius-sm:10px;--radius:16px;--radius-lg:22px;--rail:228px;
  }
  :root[data-theme="dark"]{
    color-scheme:dark;
    --canvas:#060d14;--canvas-background:radial-gradient(circle at 50% -18%,#12212e 0,#08121b 38%,#050b11 76%);--surface:#0d1720;--surface-soft:#14212c;--surface-warm:#0a141d;
    --ink:#f3f6f7;--ink-soft:#d0d7dc;--muted:#9ba7af;--muted-light:#74828c;
    --border:#22313c;--border-strong:#344652;
    --green-700:#9cdb55;--green-600:#75b936;--green-500:#8dce47;--green-200:#345023;--green-100:#18291b;
    --blue:#67aef2;--blue-soft:#142c41;--orange:#f2a14a;--orange-soft:#352515;
    --red:#ff898b;--red-soft:#351d23;--chart-grid:#23323d;--chart-label:#87949d;--bmi-under:#75b8c8;--bmi-healthy:#83c948;--bmi-over:#e7b84d;--bmi-obese:#e47f69;--shadow:0 14px 35px rgba(0,0,0,.28);--shadow-raised:0 22px 55px rgba(0,0,0,.52);
  }
  @media(prefers-color-scheme:dark){
    :root[data-theme="system"]{
      color-scheme:dark;
      --canvas:#060d14;--canvas-background:radial-gradient(circle at 50% -18%,#12212e 0,#08121b 38%,#050b11 76%);--surface:#0d1720;--surface-soft:#14212c;--surface-warm:#0a141d;
      --ink:#f3f6f7;--ink-soft:#d0d7dc;--muted:#9ba7af;--muted-light:#74828c;
      --border:#22313c;--border-strong:#344652;
      --green-700:#9cdb55;--green-600:#75b936;--green-500:#8dce47;--green-200:#345023;--green-100:#18291b;
      --blue:#67aef2;--blue-soft:#142c41;--orange:#f2a14a;--orange-soft:#352515;
      --red:#ff898b;--red-soft:#351d23;--chart-grid:#23323d;--chart-label:#87949d;--bmi-under:#75b8c8;--bmi-healthy:#83c948;--bmi-over:#e7b84d;--bmi-obese:#e47f69;--shadow:0 14px 35px rgba(0,0,0,.28);--shadow-raised:0 22px 55px rgba(0,0,0,.52);
    }
  }
}

@layer base {
  body{background:var(--canvas-background,var(--canvas));color:var(--ink);font-family:Inter,ui-rounded,"SF Pro Rounded",-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;line-height:1.5}
  h1,h2,h3,strong{line-height:1.2}
  h1{font-size:clamp(1.75rem,3vw,2.35rem);letter-spacing:-.035em}
  h2{font-size:1.25rem;letter-spacing:-.02em}
  h3{font-size:1rem}
  a{color:var(--green-700);text-underline-offset:3px}
  small,.muted{color:var(--muted)}
  .muted{line-height:1.55}
  .eyebrow{margin-bottom:5px;color:var(--green-700);font-size:.72rem;font-weight:800;letter-spacing:.08em;text-transform:uppercase}
  .sr-only{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}
  [hidden]{display:none!important}
  :focus-visible{outline:3px solid color-mix(in srgb,var(--green-500) 55%,transparent);outline-offset:3px}
  .skip-link{position:fixed;z-index:100;top:8px;left:8px;opacity:0;pointer-events:none;transform:translateY(-160%)}
  .skip-link:focus-visible{opacity:1;pointer-events:auto;transform:none}
  form ul.errorlist{margin:6px 0;padding:0;list-style:none;color:var(--red);font-size:.84rem;font-weight:650}
}

@layer layout {
  .app-shell{width:min(100% - 40px,1440px);min-height:100vh;margin:auto;padding:20px 0 48px calc(var(--rail) + 40px)}
  .app-shell.auth-shell{padding-left:0}
  .shell{width:100%;max-width:1172px;margin:0 auto;padding:20px 0}
  .topbar{position:fixed;z-index:20;top:20px;bottom:20px;left:max(20px,calc((100vw - 1440px)/2));width:var(--rail);display:flex;flex-direction:column;padding:18px 14px;border:1px solid var(--border);border-radius:var(--radius-lg);background:color-mix(in srgb,var(--surface) 92%,transparent);box-shadow:var(--shadow);backdrop-filter:blur(12px)}
  .brand{display:flex;align-items:center;gap:11px;padding:3px 6px 18px;color:var(--ink);text-decoration:none}
  .brand-mark{display:grid;width:42px;height:42px;place-items:center;border-radius:13px;background:var(--ink)}
  .brand img{width:30px;height:30px}
  .brand>span:last-child{display:grid;min-width:0}
  .brand strong{font-size:1.14rem}
  .brand small{font-size:.64rem;letter-spacing:-.01em;white-space:nowrap}
  .nav{display:grid;gap:5px}
  .nav a{display:flex;align-items:center;gap:11px;min-height:46px;padding:9px 11px;border-radius:12px;color:var(--ink-soft);font-size:.9rem;font-weight:650;text-decoration:none}
  .nav a:hover{background:var(--surface-soft)}
  .nav a.is-active{background:var(--green-100);color:var(--green-700)}
  .nav-icon{display:grid;width:22px;height:22px;flex:0 0 22px;place-items:center}
  .nav-icon svg,.button svg,.icon-button svg,.add-icon svg,.mobile-add svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
  .rail-add{width:100%;margin-top:20px}
  .account-menu{display:grid;gap:9px;margin-top:auto;padding:14px 5px 0;border-top:1px solid var(--border)}
  .account-menu>a{display:flex;align-items:center;gap:9px;color:var(--ink);text-decoration:none}
  .account-menu>a>span:last-child{display:grid;min-width:0}
  .account-menu strong{overflow:hidden;font-size:.84rem;text-overflow:ellipsis}
  .account-menu small{font-size:.7rem}
  .avatar{display:grid;width:34px;height:34px;flex:0 0 34px;place-items:center;border-radius:50%;background:var(--green-100);color:var(--green-700);font-weight:800}
  .account-menu form{margin-left:43px}
  .link-button{padding:0;border:0;background:none;color:var(--muted);font-size:.76rem;cursor:pointer}
  .mobile-nav{display:none}
  .grid{display:grid;gap:20px}.grid.two{grid-template-columns:repeat(2,minmax(0,1fr))}
  .dashboard-layout{grid-template-columns:minmax(0,1.75fr) minmax(260px,.75fr);align-items:start}
  .side-cards{display:grid;gap:16px}
}

@layer components {
  .button{display:inline-flex;min-height:42px;align-items:center;justify-content:center;gap:8px;padding:9px 15px;border:1px solid var(--border-strong);border-radius:12px;background:var(--surface);color:var(--ink);font-weight:720;line-height:1.2;text-decoration:none;cursor:pointer;transition:transform .15s ease,box-shadow .15s ease,background .15s ease}
  .button:hover{transform:translateY(-1px);box-shadow:0 5px 14px rgba(42,67,35,.08)}
  .button.primary{border-color:var(--green-600);background:var(--green-600);color:#fff}
  .button.primary:hover{background:var(--green-700)}
  .icon-button{display:inline-grid;width:40px;height:40px;flex:0 0 40px;padding:0;place-items:center;border:1px solid var(--border);border-radius:12px;background:var(--surface);color:var(--muted);text-decoration:none;cursor:pointer;transition:.15s ease}
  .icon-button:hover{border-color:var(--border-strong);background:var(--surface-soft);color:var(--ink)}
  .icon-button.success{color:var(--green-700)}.icon-button.danger{color:var(--red)}
  .card{margin-bottom:20px;padding:22px;border:1px solid var(--border);border-radius:var(--radius);background:var(--surface);box-shadow:0 2px 8px rgba(42,67,35,.025)}
  .page-head{display:flex;align-items:flex-end;justify-content:space-between;gap:20px;margin:0 0 22px}
  .page-head>div:first-child{min-width:0}.page-head .muted{margin-top:5px}
  .page-head .actions{justify-content:flex-end}
  .section-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:18px}
  .section-head .muted{margin-top:5px;font-size:.88rem}
  .actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
  .actions form{display:inline-flex;margin:0}
  .notice{padding:12px 15px;border:1px solid var(--green-200);border-radius:12px;background:var(--green-100);color:var(--green-700);font-weight:650;box-shadow:var(--shadow)}
  .toast-stack{position:fixed;z-index:40;top:20px;right:20px;max-width:min(360px,calc(100vw - 32px))}
  .line{display:flex;align-items:center;justify-content:space-between;gap:15px;padding:11px 0;border-bottom:1px solid var(--border)}
  .line:last-child{border-bottom:0}
  .status-badge,.tag{display:inline-flex;align-items:center;padding:3px 8px;border-radius:999px;background:var(--surface-soft);color:var(--muted);font-size:.7rem;font-weight:750}
  .status-badge.eaten{background:var(--green-100);color:var(--green-700)}
  .status-badge.planned{background:var(--orange-soft);color:#9a601b}
  .status-badge.archived{background:var(--surface-soft);color:var(--muted)}
  .bar{height:7px;margin-top:8px;overflow:hidden;border-radius:99px;background:color-mix(in srgb,var(--muted) 16%,var(--surface))}
  .bar i{display:block;height:100%;border-radius:inherit;background:var(--green-500)}
  .empty-state{display:grid;min-height:160px;place-content:center;justify-items:center;gap:12px;padding:24px;text-align:center}
  .empty-state::before{content:"";width:46px;height:46px;border-radius:15px;background:var(--surface-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2355a82f' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M7 3v7M4 3v7a3 3 0 0 0 6 0V3M7 13v8M16 3v18M16 3c3 1 4 3 4 6v2h-4'/%3E%3C/svg%3E") center/24px no-repeat}
  .empty-state .muted{max-width:390px}
  .pagination{display:flex;align-items:center;justify-content:center;gap:12px;margin:8px 0 24px;color:var(--muted);font-size:.84rem}
  input,select,textarea{width:100%;min-height:46px;padding:10px 12px;border:1px solid var(--border-strong);border-radius:12px;background:var(--surface);color:var(--ink)}
  textarea{min-height:92px;resize:vertical}
  input::placeholder,textarea::placeholder{color:#9aa29a}
  label{display:block;margin-bottom:6px;color:var(--ink-soft);font-size:.82rem;font-weight:720}
  form p{margin:0}
  .form-card{max-width:900px}
  .form-card form{display:flex;flex-direction:column;gap:16px}
  .form-card h1{margin-bottom:8px}.form-card>p.muted{margin-bottom:22px}
  .form-card h2{margin:12px 0 0}.form-card h3{margin-top:16px;padding-top:20px;border-top:1px solid var(--border)}
  .form-card fieldset{min-width:0;margin:0;padding:17px;border:1px solid var(--border);border-radius:14px}
  .form-card legend{padding:0 7px;font-weight:800}
  .form-card fieldset>p+P{margin-top:14px}
  .form-disclosure{padding:15px;border:1px solid var(--border);border-radius:14px;background:var(--surface-warm)}
  .form-disclosure summary{cursor:pointer;font-weight:780}.form-disclosure[open] summary{margin-bottom:16px}
  .form-disclosure>p+P{margin-top:14px}
  .ratio-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
  .field-grid{display:grid;gap:14px;margin-bottom:14px}.field-grid>div{display:flex;min-width:0;flex-direction:column}.field-grid--two{grid-template-columns:repeat(2,minmax(0,1fr))}.field-grid--three{grid-template-columns:repeat(3,minmax(0,1fr))}.field-grid--four{grid-template-columns:repeat(4,minmax(0,1fr))}.field-help{margin-bottom:14px;font-size:.82rem}.sticky-form-actions{display:flex;gap:9px;align-items:center}
  .recipe-component-quantities{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.recipe-component-quantities>div{min-width:0}.recipe-component-optional{margin-top:14px}.recipe-component-optional>label{display:flex;align-items:center;justify-content:space-between;gap:14px;margin:0;padding:11px 13px;border:1px solid var(--border);border-radius:12px;background:var(--surface-soft)}.recipe-component-actions{display:flex;align-items:center;gap:8px;margin-top:12px}.recipe-component-actions .component-remove{margin-left:auto}
  .form-card input.toggle-input{appearance:none;width:48px;height:27px;min-height:27px;flex:0 0 48px;padding:0;border:0;border-radius:999px;background:#d8ded7;position:relative;cursor:pointer}
  .form-card input.toggle-input::after{content:"";position:absolute;top:4px;left:4px;width:19px;height:19px;border-radius:50%;background:#fff;box-shadow:0 1px 3px #0002;transition:.15s}
  .form-card input.toggle-input:checked{background:var(--green-600)}.form-card input.toggle-input:checked::after{transform:translateX(21px)}
  .form-card p:has(>label>input.toggle-input)>label{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:11px 13px;border:1px solid var(--border);border-radius:12px;background:var(--surface-soft)}
  .search{position:relative;display:flex;gap:10px;margin:0 0 16px}
  .search input{padding-right:42px;padding-left:42px;background:var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2369736a' stroke-width='1.8'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m16 16 5 5'/%3E%3C/svg%3E") 13px center/19px no-repeat}
  .search-input-wrap{position:relative;display:block}.search-input-wrap--live{min-width:0;flex:1}.search-input-wrap--live input{width:100%}
  .search-clear-button{position:absolute;right:10px;top:50%;display:grid;width:30px;height:30px;transform:translateY(-50%);place-items:center;padding:0;border:0;border-radius:8px;background:transparent;color:var(--muted);cursor:pointer}
  .search-clear-button:hover,.search-clear-button:focus-visible{background:var(--surface-soft);color:var(--ink)}
  .search-clear-button svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round}
  .search-clear-button[hidden]{display:none}
  .food-mode-toggle{display:inline-flex;gap:4px;margin:0 0 14px;padding:4px;border-radius:13px;background:var(--surface-soft)}
  .food-mode-toggle a{padding:7px 14px;border-radius:10px;color:var(--muted);font-size:.82rem;font-weight:750;text-decoration:none}
  .food-mode-toggle a.active{background:var(--surface);color:var(--green-700);box-shadow:0 2px 7px #263f2112}
  .list{padding-top:4px;padding-bottom:4px}
  .catalog-row{display:grid;grid-template-columns:minmax(0,1fr) auto;min-height:78px;align-items:center;gap:16px;padding:14px 0;border-bottom:1px solid var(--border)}
  .catalog-row:last-child{border-bottom:0}
  .catalog-item{display:flex;min-width:0;max-width:100%;align-items:center;gap:13px}
  .catalog-item>div{min-width:0}
  .catalog-media{display:grid;width:54px;height:54px;flex:0 0 54px;overflow:hidden;place-items:center;border-radius:15px;background:var(--surface-soft)}
  .catalog-thumb{width:100%;height:100%;object-fit:cover}
  .catalog-placeholder{display:grid;width:100%;height:100%;place-items:center;color:var(--green-700)}.catalog-placeholder.recipe{color:var(--orange)}.catalog-placeholder svg{width:25px;height:25px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round}
  .catalog-name{display:inline;color:var(--ink);text-decoration:none}
  .catalog-name:hover{text-decoration:underline}
  .catalog-name strong{font-size:.96rem}
  .catalog-row small{display:block;margin-top:4px;line-height:1.45}
  .is-archived{opacity:.6}
  .quick-log{border-color:var(--green-200);background:var(--green-100);color:var(--green-700)}
  .row-menu{position:relative}.row-menu summary{list-style:none}.row-menu summary::-webkit-details-marker{display:none}.row-menu>div{position:absolute;z-index:8;top:46px;right:0;display:grid;min-width:190px;padding:7px;border:1px solid var(--border);border-radius:13px;background:var(--surface);box-shadow:var(--shadow-raised)}.row-menu a,.row-menu button{display:block;width:100%;padding:9px 10px;border:0;border-radius:8px;background:none;color:var(--ink);font-size:.8rem;text-align:left;text-decoration:none;cursor:pointer}.row-menu a:hover,.row-menu button:hover{background:var(--surface-soft)}.row-menu .danger-text{color:var(--red)}
  .recipe-prefix{color:var(--green-700);font-size:.75rem;font-weight:800}
  .component,.recipe-breakdown{position:relative;padding:16px;border:1px solid var(--border);border-radius:14px;background:var(--surface-soft)}
  .recipe-choice-group{overflow:visible;border:1px solid var(--border);border-radius:17px;background:var(--surface);box-shadow:0 4px 16px #263f2108}.recipe-choice-group+.recipe-choice-group{margin-top:14px}.recipe-choice-group-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:13px 15px;border-bottom:1px solid var(--border);background:var(--surface-warm);border-radius:16px 16px 0 0}.recipe-choice-group-head>div{display:grid;gap:2px}.recipe-choice-group-head strong{font-size:.84rem}.recipe-choice-group-head small{color:var(--muted);font-size:.72rem;line-height:1.4}.recipe-choice-group.has-alternatives .recipe-choice-group-head{background:linear-gradient(135deg,var(--green-100),var(--surface))}.recipe-choice-options{display:grid;gap:10px;padding:12px}.recipe-component{padding:14px;background:var(--surface)}.recipe-component.is-default-alternative{border-color:var(--green-300);box-shadow:0 0 0 2px color-mix(in srgb,var(--green-200) 40%,transparent)}.recipe-component.is-alternative{margin-left:24px;border-style:dashed;background:var(--surface-soft)}.recipe-component-meta{display:flex;align-items:center;min-height:26px;gap:10px;margin:0 42px 10px 0}.recipe-component-role{padding:3px 8px;border-radius:999px;background:var(--surface-soft);color:var(--muted);font-size:.68rem;font-weight:800;text-transform:uppercase;letter-spacing:.04em}.is-default-alternative .recipe-component-role{background:var(--green-100);color:var(--green-800)}.recipe-make-default{margin-left:auto;padding:5px 8px;border:1px solid var(--green-200);border-radius:8px;background:var(--green-100);color:var(--green-800);font-size:.7rem;font-weight:800;cursor:pointer}.recipe-make-default:hover{border-color:var(--green-400);background:color-mix(in srgb,var(--green-100) 72%,var(--surface))}.recipe-component .component-remove{position:static}.recipe-component-actions{margin-top:12px}.recipe-component-actions .component-remove{margin-left:auto}.recipe-component[hidden],.recipe-choice-group[hidden]{display:none}
  .recipe-ingredient-overrides{display:grid;gap:12px;padding:16px;border:1px solid var(--border);border-radius:17px;background:var(--surface-warm)}.recipe-ingredient-overrides>.section-head{margin-bottom:0}.recipe-ingredient-overrides>.section-head h2{margin-top:0}.recipe-ingredient-overrides>.section-head>.button{white-space:nowrap}.recipe-ingredient{padding:16px;background:var(--surface)}.recipe-ingredient-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:14px}.recipe-ingredient-head>div:first-child{display:grid;min-width:0;gap:3px}.recipe-ingredient-head strong{overflow-wrap:anywhere}.recipe-ingredient-kicker{color:var(--green-700);font-size:.67rem;font-weight:850;text-transform:uppercase;letter-spacing:.06em}.recipe-ingredient-head input[type="checkbox"]{display:none}.recipe-ingredient-actions{display:flex;flex:0 0 auto;align-items:center;gap:7px}.recipe-ingredient-actions .button{min-height:36px;padding:7px 10px;font-size:.75rem}.recipe-ingredient-toggle{flex:none}.recipe-ingredient.is-skipped{opacity:.52}.recipe-ingredient.is-skipped .recipe-ingredient-toggle{opacity:1}.recipe-ingredient.is-skipped [data-ingredient-name]::after{content:" · skipped";font-weight:500}.recipe-alternative-picker{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:8px;margin:0 0 14px;padding:10px;border:1px solid var(--border);border-radius:13px;background:var(--surface-soft)}.recipe-alternative-option{display:grid;width:100%;min-width:0;grid-template-columns:auto minmax(0,1fr) 22px;align-items:center;gap:9px;padding:9px;border:1px solid transparent;border-radius:11px;background:var(--surface);color:var(--ink);text-align:left;cursor:pointer}.recipe-alternative-option:hover{border-color:var(--green-200)}.recipe-alternative-option.is-selected{border-color:var(--green-500);background:color-mix(in srgb,var(--green-100) 62%,var(--surface));box-shadow:0 2px 9px #38652710}.recipe-alternative-option>img{width:38px;height:38px;object-fit:cover;border-radius:10px}.recipe-alternative-option>span{display:grid;min-width:0;gap:2px}.recipe-alternative-option strong{overflow:hidden;font-size:.77rem;line-height:1.25;text-overflow:ellipsis}.recipe-alternative-option small{color:var(--muted);font-size:.65rem}.recipe-alternative-option i{display:grid;width:20px;height:20px;place-items:center;border:1px solid var(--border-strong);border-radius:50%;color:transparent;font-style:normal;font-size:.72rem}.recipe-alternative-option.is-selected i{border-color:var(--green-600);background:var(--green-600);color:#fff}.log-quantity-grid,.recipe-log-quantity-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.log-quantity-grid>div,.recipe-log-quantity-grid>div{min-width:0}.recipe-ingredient-swap-search{position:relative;margin-bottom:12px}
  .recipe-detail-groups{display:grid;gap:12px}.recipe-detail-group{overflow:hidden;border:1px solid var(--border);border-radius:15px;background:var(--surface)}.recipe-detail-primary{padding:14px}.recipe-detail-group.has-alternatives .recipe-detail-primary{background:linear-gradient(135deg,color-mix(in srgb,var(--green-100) 55%,var(--surface)),var(--surface))}.recipe-detail-name-line{display:flex;align-items:center;gap:7px;flex-wrap:wrap}.recipe-detail-alternatives{display:grid;gap:7px;margin:0 14px 14px 40px;padding:10px 0 0 14px;border-top:1px solid var(--border);border-left:2px solid var(--green-200)}.recipe-detail-alternatives>p{margin:0 0 2px;color:var(--muted);font-size:.7rem;font-weight:750}.recipe-detail-alternative{padding:8px 10px;border-radius:11px;background:var(--surface-soft)}.recipe-detail-alternative .catalog-media{width:38px;height:38px;flex-basis:38px;border-radius:10px}.recipe-detail-alternative .catalog-name strong{font-size:.82rem}.recipe-detail-alternative small{display:block;margin-top:2px;font-size:.7rem}
  .component+.component{margin-top:12px}
  .recipe-choice-options .component+.component{margin-top:0}
  .component-remove{position:absolute;top:12px;right:12px}
  .component:has(.component-remove)>p{padding-right:48px}.component p:has(input[name$="-DELETE"]){display:none}
  .serving-editor-head{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;margin-bottom:14px}.serving-editor-head .field-help{max-width:610px;margin:0}.serving-add{flex:none}.serving-add svg{width:17px;height:17px}
  .default-quantity{display:grid;gap:10px;margin-bottom:20px;padding:15px;border:1px solid var(--green-200);border-radius:14px;background:linear-gradient(135deg,color-mix(in srgb,var(--green-100) 64%,var(--surface)),var(--surface))}.default-quantity>div>strong{font-size:.92rem}.default-quantity .field-help{margin:3px 0 0}.default-quantity-choice{display:flex;align-items:center;gap:11px;padding:11px 12px;border:1px solid var(--border);border-radius:11px;background:var(--surface);cursor:pointer}.default-quantity-choice>input{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}.default-quantity-choice>span:nth-of-type(1){display:flex;flex:1;min-width:0;flex-direction:column}.default-quantity-choice strong{font-size:.84rem}.default-quantity-choice small{color:var(--muted);font-size:.73rem}.default-quantity-check{display:grid;width:23px;height:23px;flex:0 0 23px;place-items:center;border:1.5px solid var(--border-strong);border-radius:50%;color:transparent}.default-quantity-check svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:2.4}.default-quantity-choice:has(input:checked){border-color:var(--green-500);background:color-mix(in srgb,var(--green-100) 48%,var(--surface))}.default-quantity-choice:has(input:checked) .default-quantity-check{border-color:var(--green-600);background:var(--green-600);color:#fff}
  .serving-list{display:grid;gap:12px}.serving-card{padding:15px;border:1px solid var(--border);border-radius:14px;background:var(--surface-soft)}.serving-card-top{display:flex;align-items:center;gap:8px;margin-bottom:12px}.serving-number{font-size:.78rem;font-weight:850;letter-spacing:.04em;text-transform:uppercase;color:var(--green-700)}.serving-source{padding:3px 8px;border-radius:999px;background:var(--green-100);color:var(--green-800);font-size:.7rem;font-weight:750}.serving-card-top .serving-remove{margin-left:auto}
  .serving-card .field-grid{margin-bottom:10px}.serving-default-choice{display:flex;align-items:center;gap:11px;padding:10px 12px;border:1px solid var(--border);border-radius:11px;background:var(--surface);cursor:pointer}.serving-default-choice>input{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}.serving-default-choice>span:nth-of-type(1){display:flex;flex:1;min-width:0;flex-direction:column}.serving-default-choice strong{font-size:.84rem}.serving-default-choice small{color:var(--muted);font-size:.73rem}.serving-default-check{display:grid;width:23px;height:23px;flex:0 0 23px;place-items:center;border:1.5px solid var(--border-strong);border-radius:50%;color:transparent}.serving-default-check svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:2.4}.serving-default-choice:has(input:checked){border-color:var(--green-500);background:color-mix(in srgb,var(--green-100) 48%,var(--surface))}.serving-default-choice:has(input:checked) .serving-default-check{border-color:var(--green-600);background:var(--green-600);color:#fff}
  .serving-empty{display:flex;min-height:118px;align-items:center;justify-content:center;flex-direction:column;gap:4px;border:1px dashed var(--border-strong);border-radius:14px;color:var(--muted);text-align:center}.serving-empty[hidden]{display:none}.serving-empty strong{color:var(--text);font-size:.88rem}.serving-empty span:last-child{font-size:.78rem}.serving-empty-icon{display:grid;width:34px;height:34px;place-items:center;border-radius:50%;background:var(--surface-soft);color:var(--green-700)}.serving-empty-icon svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.8}
  .serving-detail-list{display:grid;gap:8px;margin-bottom:22px}.serving-detail-list>div{display:grid;grid-template-columns:minmax(0,1fr) auto auto;align-items:center;gap:8px;padding:10px 12px;border-radius:11px;background:var(--surface-soft)}.serving-detail-list span{font-size:.86rem}.serving-detail-list strong{font-size:.84rem}.serving-detail-list small{padding:3px 7px;border-radius:999px;background:var(--green-100);color:var(--green-800);font-size:.68rem;font-weight:800}
  .autocomplete,.food-search-row{position:relative}.autocomplete input,.food-search-row input{padding-right:42px}.autocomplete-results{position:absolute;z-index:10;top:calc(100% + 6px);right:0;left:0;max-height:min(340px,42vh);overflow:auto;overscroll-behavior:contain;border:1px solid var(--border);border-radius:14px;background:var(--surface);box-shadow:var(--shadow-raised)}
  .autocomplete-results:empty{display:none}.autocomplete-option{display:grid;width:100%;min-height:70px;grid-template-columns:48px minmax(0,1fr);align-items:center;gap:11px;padding:10px 12px;border:0;border-bottom:1px solid var(--border);background:var(--surface);color:var(--ink);text-align:left;cursor:pointer}.autocomplete-option:last-child{border-bottom:0}.autocomplete-option:hover,.autocomplete-option:focus-visible{background:var(--surface-soft)}
  .autocomplete-media{display:grid;width:48px;height:48px;overflow:hidden;place-items:center;border-radius:12px;background:var(--green-100);color:var(--green-700)}.autocomplete-media--recipe{background:var(--orange-soft);color:var(--orange)}.autocomplete-media svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round}.autocomplete-thumb{width:100%;height:100%;object-fit:cover}.autocomplete-copy{display:grid;min-width:0;gap:2px}.autocomplete-heading{display:flex;min-width:0;align-items:flex-start;gap:7px}.autocomplete-title{min-width:0;font-size:.84rem;font-weight:780;line-height:1.3;white-space:normal}.autocomplete-badges{display:flex;flex:0 0 auto;gap:4px}.search-badge{padding:2px 6px;border-radius:99px;background:var(--surface-soft);color:var(--muted);font-size:.6rem;font-weight:780;text-transform:capitalize}.search-badge--recipe{background:var(--orange-soft);color:var(--orange)}.search-badge--hydration{background:var(--blue-soft);color:var(--blue)}.autocomplete-brand,.autocomplete-detail{color:var(--muted);font-size:.7rem;line-height:1.35;white-space:normal}.autocomplete-state{padding:17px;color:var(--muted);font-size:.8rem;text-align:center}
  .image-field-preview{display:flex;align-items:flex-start;gap:14px;flex-wrap:wrap;margin:8px 0}.image-field-preview img{width:150px;height:150px;object-fit:cover;border-radius:16px;background:var(--surface-soft)}
  .image-clear{display:inline-flex;align-items:center;gap:7px;padding:8px 10px;border:1px solid #e5bbb9;border-radius:10px;color:var(--red);font-size:.8rem;font-weight:650}.image-clear input{width:auto;min-height:0;margin:0}
  .nutrition-capture-lab{max-width:760px}.nutrition-camera-capture{display:grid;gap:12px;margin:0 0 20px;padding:18px;border:1px solid var(--green-300);border-radius:16px;background:linear-gradient(135deg,var(--green-100),var(--surface))}.nutrition-camera-capture strong{font-size:1rem}.nutrition-camera-capture .field-help{margin-top:4px}.nutrition-camera-capture>.button{justify-self:start}.nutrition-camera-capture>.button svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.capture-progress{display:flex;align-items:center;gap:9px;margin:0;color:var(--green-700);font-weight:720}.capture-spinner{width:17px;height:17px;border:2px solid color-mix(in srgb,var(--green-700) 25%,transparent);border-top-color:var(--green-700);border-radius:50%;animation:capture-spin .8s linear infinite}@keyframes capture-spin{to{transform:rotate(360deg)}}.capture-error{margin-top:16px;padding:12px 14px;border:1px solid #e5bbb9;border-radius:12px;background:var(--red-soft);color:var(--red);font-weight:650}.nutrition-camera-capture .capture-error{margin:0}.nutrition-camera-capture #capture-nutrition-status{margin:0}.nutrition-capture-result{max-width:900px}.capture-values{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px;margin:0 0 18px}.capture-values>div{padding:12px;border:1px solid var(--border);border-radius:12px;background:var(--surface-soft)}.capture-values dt{color:var(--muted);font-size:.72rem;font-weight:750}.capture-values dd{margin:4px 0 0;font-size:.98rem;font-weight:800}.nutrition-capture-result pre{max-height:340px;overflow:auto;white-space:pre-wrap;overflow-wrap:anywhere;color:var(--ink-soft);font:inherit;font-size:.82rem;line-height:1.5}
  .add-sheet{width:min(520px,calc(100% - 28px));padding:22px;border:0;border-radius:22px;background:var(--surface);color:var(--ink);box-shadow:var(--shadow-raised)}
  .add-sheet::backdrop{background:rgba(25,39,25,.34);backdrop-filter:blur(3px)}
  .add-sheet .sheet-handle{display:none}.add-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:10px}
  .add-grid>a{display:flex;align-items:center;gap:12px;padding:14px;border:1px solid var(--border);border-radius:14px;color:var(--ink);text-decoration:none}
  .add-grid>a:hover{border-color:var(--green-200);background:var(--surface-soft)}
  .add-grid>a>span:last-child{display:grid}.add-grid small{margin-top:2px;font-size:.73rem}
  .add-icon{display:grid;width:44px;height:44px;flex:0 0 44px;place-items:center;border-radius:13px;background:var(--green-100);color:var(--green-700)}
  .add-icon--water{background:var(--blue-soft);color:var(--blue)}.add-icon--weight{background:var(--orange-soft);color:var(--orange)}
}

@layer pages {
  .date-nav{display:flex;align-items:center;gap:8px;margin:-7px 0 18px}
  .date-picker{position:relative}.date-picker-input{position:absolute!important;width:1px!important;height:1px!important;min-height:0!important;padding:0!important;opacity:0;pointer-events:none}
  .day-strip{display:grid;grid-template-columns:repeat(7,1fr);gap:6px;margin-bottom:18px}
  .day-pill{display:grid;min-height:58px;place-items:center;padding:6px 2px;border-radius:14px;color:var(--muted);text-decoration:none}
  .day-pill small{font-size:.66rem;font-weight:750;text-transform:uppercase}.day-pill strong{display:grid;width:30px;height:30px;margin-top:2px;place-items:center;border-radius:50%;font-size:.82rem}
  .day-pill:hover{background:var(--surface-soft)}.day-pill.is-selected strong{background:var(--green-600);color:#fff}.day-pill.is-selected small{color:var(--green-700)}
  .daily-summary{display:grid;grid-template-columns:minmax(0,1.3fr) minmax(260px,.7fr);gap:22px;margin-bottom:20px;padding:24px;border:1px solid var(--border);border-radius:var(--radius-lg);background:var(--surface);box-shadow:var(--shadow)}
  .calorie-overview{display:flex;align-items:center;justify-content:space-between;gap:20px}
  .summary-label{color:var(--muted);font-size:.82rem;font-weight:700}.summary-number{display:block;margin:5px 0 4px;color:var(--green-700);font-size:clamp(2.25rem,5vw,3.35rem);font-weight:820;letter-spacing:-.05em;line-height:1}.summary-caption{color:var(--muted);font-size:.8rem}
  .progress-ring{--progress:0;display:grid;width:110px;height:110px;flex:0 0 110px;place-items:center;border-radius:50%;background:conic-gradient(var(--green-600) calc(var(--progress)*1%),color-mix(in srgb,var(--muted) 16%,var(--surface)) 0)}
  .progress-ring::before{content:"";grid-area:1/1;width:84px;height:84px;border-radius:50%;background:var(--surface)}
  .progress-ring span{z-index:1;grid-area:1/1;color:var(--green-700);font-weight:820}
  .summary-number.is-over-target,.progress-ring.is-over-target span{color:var(--red)}.progress-ring.is-over-target{background:conic-gradient(var(--red) calc(var(--progress)*1%),color-mix(in srgb,var(--red) 16%,var(--surface)) 0)}
  .macro-stack{display:grid;align-content:center;gap:14px}.macro-row{display:grid;grid-template-columns:70px minmax(80px,1fr) auto;align-items:center;gap:11px;font-size:.78rem}
  .macro-row>span:first-child{font-weight:750}.macro-row .bar{margin:0}.macro-row--carbs .bar i{background:var(--blue)}.macro-row--fat .bar i{background:var(--orange)}
  .summary-foot{display:flex;gap:16px;margin-top:15px;padding-top:13px;border-top:1px solid var(--border);color:var(--muted);font-size:.75rem}.summary-foot strong{color:var(--ink)}
  .dashboard-insights{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.dashboard-log{padding-bottom:8px}.dashboard-log .section-head{margin-bottom:4px}
  .entry{display:flex;align-items:center;gap:12px;padding:14px 0;border-bottom:1px solid var(--border)}.entry:last-child{border-bottom:0}.entry-info{min-width:0;flex:1}
  .nutrition-grid{display:grid;grid-template-columns:minmax(0,1fr) 62px 66px;gap:10px;align-items:center}.nutrition-header{padding:8px 52px 8px 0;color:var(--muted);font-size:.68rem;text-align:right}.nutrition-header span:first-child{text-align:left}
  .dashboard-item{display:flex;min-width:0;align-items:center;gap:11px}.dashboard-item>div{display:grid;min-width:0}.dashboard-thumb{width:48px;height:48px;flex:0 0 48px;border-radius:14px;background:var(--surface-soft);object-fit:cover}
  .dashboard-item time{color:var(--muted);font-size:.68rem}.dashboard-item-link{overflow:hidden;color:var(--ink);text-decoration:none;text-overflow:ellipsis;white-space:nowrap}.dashboard-item small{margin-top:3px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .calorie-detail{padding:0;border:0;background:none;color:var(--ink);font-weight:800;text-align:right;cursor:pointer}.macro-popover{position:absolute;z-index:5;top:calc(50% + 12px);right:66px;padding:7px 9px;border:1px solid var(--border);border-radius:9px;background:var(--surface);box-shadow:var(--shadow);color:var(--muted);font-size:.72rem;white-space:nowrap}.macro-popover[hidden]{display:none}
  .nutrition-parent,.nutrition-child{position:relative}.nutrition-child{grid-template-columns:minmax(0,1fr) 62px 66px;padding:6px 0;font-size:.75rem}.nutrition-mobile-macros{display:none}
  .entry>.actions{flex-wrap:nowrap}.recipe-breakdown{margin-top:8px;padding:10px 12px}
  .compact-card{min-height:150px}.compact-card-icon{display:grid;width:42px;height:42px;margin-bottom:16px;place-items:center;border-radius:14px;background:var(--blue-soft);color:var(--blue)}.compact-card-icon svg{width:23px;height:23px;fill:none;stroke:currentColor;stroke-width:1.8}.compact-card--weight .compact-card-icon{background:var(--orange-soft);color:var(--orange)}
  .hydration strong,.compact-value{display:block;margin-bottom:3px;font-size:1.65rem;font-variant-numeric:tabular-nums}.hydration>span{font-size:.78rem;color:var(--muted)}
  .bmi-summary{display:flex;align-items:center;gap:7px;margin:4px 0 6px}.bmi-summary>strong{font-size:.82rem}.bmi-class{display:inline-flex;align-items:center;padding:3px 7px;border-radius:99px;font-size:.68rem;font-weight:800}.bmi-class--underweight{background:color-mix(in srgb,var(--bmi-under) 18%,var(--surface));color:var(--bmi-under)}.bmi-class--healthy{background:color-mix(in srgb,var(--bmi-healthy) 18%,var(--surface));color:var(--green-700)}.bmi-class--overweight{background:color-mix(in srgb,var(--bmi-over) 18%,var(--surface));color:color-mix(in srgb,var(--bmi-over) 75%,var(--ink))}.bmi-class--obese{background:color-mix(in srgb,var(--bmi-obese) 18%,var(--surface));color:var(--bmi-obese)}
  .hydration-breakdown{margin-top:10px;font-size:.75rem}.hydration-breakdown .line{padding:6px 0}
  .history-status{display:flex;align-items:center;gap:6px;margin-top:5px}.history-entry-type{color:var(--muted);font-size:.72rem}
  .food-detail-layout{grid-template-columns:minmax(0,1.45fr) minmax(260px,.55fr);align-items:start}.food-detail-image{width:100%;height:170px;margin-bottom:22px;border-radius:18px;background:var(--surface);object-fit:contain}.food-create-overview{display:grid;justify-items:center;gap:22px}.food-create-overview>div:last-child{width:min(100%,620px)}.food-create-overview .form-disclosure{margin-top:16px}.food-image-picker{width:190px;min-width:0}.food-image-picker input[type="file"]{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}.food-image-picker-target{display:grid;overflow:hidden;min-height:190px;place-items:center;border:1px dashed var(--border-strong);border-radius:18px;background:var(--surface-soft);color:var(--green-700);cursor:pointer}.food-image-picker-target:hover{border-color:var(--green-600);background:var(--green-100)}.food-image-picker-target>img,.food-image-picker-placeholder{grid-area:1/1;width:100%;height:190px;object-fit:contain}.food-image-picker-placeholder{display:grid;place-items:center}.food-image-picker-placeholder svg{width:54px;height:54px;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round}.food-image-picker-copy{z-index:1;grid-area:1/1;align-self:end;width:100%;padding:8px;background:color-mix(in srgb,var(--surface) 90%,transparent);color:var(--ink);text-align:center}.food-image-picker-copy strong,.food-image-picker-copy small{display:block}.food-image-picker-copy small{margin-top:2px;color:var(--muted);font-size:.7rem}.nutrition-detail{display:grid;grid-template-columns:1fr auto;gap:0 20px;margin-top:14px}.nutrition-detail dt,.nutrition-detail dd{padding:10px 0;border-bottom:1px solid var(--border)}.nutrition-detail dt{color:var(--muted)}.nutrition-detail dd{text-align:right;font-weight:700}.source-actions{display:inline-flex;align-items:center;justify-content:flex-end;gap:7px}.source-sync{display:inline-grid;width:26px;height:26px;padding:0;place-items:center;border:0;border-radius:8px;background:transparent;color:var(--muted);cursor:pointer}.source-sync:hover{background:var(--surface-soft);color:var(--green-700)}.source-sync:disabled{cursor:wait;opacity:.65}.source-sync svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.source-sync[aria-busy="true"] svg{animation:source-spin .8s linear infinite}.source-sync-status{display:block;max-width:220px;margin-top:5px;color:var(--muted);font-size:.72rem;font-weight:500;line-height:1.35;text-align:right}@keyframes source-spin{to{transform:rotate(360deg)}}
  .food-detail-foods{margin-top:0}.food-mode-toggle+.search{margin-top:0}
  .metrics{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:10px}.metric{padding:17px;border:1px solid var(--border);border-radius:14px;background:var(--surface)}.metric span{color:var(--muted);font-size:.75rem}.metric strong{display:block;margin-top:5px;font-size:1.3rem}.metric.accent{background:var(--green-100);color:var(--green-700)}
  .chart-card{overflow:hidden;padding:24px}.chart-controls{display:flex;gap:5px;flex-wrap:wrap}.chart-control{min-height:35px;padding:6px 10px;border:1px solid var(--border);border-radius:10px;background:var(--surface);color:var(--muted);font-size:.76rem;font-weight:700;cursor:pointer}.chart-control.active{border-color:var(--green-200);background:var(--green-100);color:var(--green-700)}.chart-control-divider{width:1px;margin:3px 5px;background:var(--border)}
  .chart-wrap{position:relative;min-height:260px}.chart-wrap canvas{width:100%;height:260px}.chart-wrap .empty-state{min-height:220px}.chart-tooltip{display:none;position:absolute;z-index:2;padding:9px 11px;border:1px solid var(--border-strong);border-radius:10px;background:color-mix(in srgb,var(--surface) 94%,transparent);box-shadow:var(--shadow-raised);color:var(--ink);font-size:.72rem;line-height:1.5;pointer-events:none;backdrop-filter:blur(10px)}.chart-legend{display:flex;gap:13px;margin:0 0 8px 58px;color:var(--muted);font-size:.72rem}.chart-legend span{display:flex;align-items:center;gap:5px}.chart-legend i{width:8px;height:8px;border-radius:50%;box-shadow:0 0 9px currentColor}.chart-legend .target-key i,.chart-target-key i{width:18px;height:0;border-top:2px dashed var(--green-700);border-radius:0;background:none;box-shadow:none}.chart-reference-keys{display:flex;gap:12px;flex-wrap:wrap}.chart-target-key{display:inline-flex;align-items:center;gap:6px;margin-top:7px;color:var(--muted);font-size:.7rem;font-weight:700}.chart-target-key--maintenance i{border-color:var(--blue)}
  .progress-tabs{display:flex;gap:5px;margin:-6px 0 20px;padding:4px;overflow-x:auto;border-radius:13px;background:var(--surface-soft)}.progress-tabs a{flex:1;padding:8px 12px;border-radius:10px;color:var(--muted);font-size:.82rem;font-weight:750;text-align:center;text-decoration:none;white-space:nowrap}.progress-tabs a.is-active{background:var(--surface);color:var(--green-700);box-shadow:var(--shadow)}
  .intro-card{background:var(--green-100);color:var(--green-700)}.schedule-list a{color:var(--ink)}
  .apply-plan{display:flex;align-items:center;gap:8px}.apply-plan label{margin:0;white-space:nowrap}.apply-plan input{width:auto}
  .plan-actions{justify-content:flex-end}.tag-list{display:flex;gap:6px;flex-wrap:wrap}
  .plan-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}.plan-card{display:flex;min-height:250px;flex-direction:column}.plan-card .section-head{margin-bottom:12px}.plan-card-icon{display:grid;width:46px;height:46px;place-items:center;border-radius:14px;background:var(--green-100);color:var(--green-700)}.plan-card-icon svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.8}.plan-card h2{margin:10px 0 5px}.plan-card h2 a{color:var(--ink);text-decoration:none}.plan-card .apply-plan{margin-top:auto;padding-top:18px}.plan-card .apply-plan input{min-width:0}.plan-empty{grid-column:1/-1}
  .auth-card{width:min(440px,100%);margin:8vh auto 0;padding:36px;border:1px solid var(--border);border-radius:var(--radius-lg);background:var(--surface);box-shadow:var(--shadow)}.auth-card::before{content:"d.";display:grid;width:52px;height:52px;margin-bottom:22px;place-items:center;border-radius:16px;background:var(--ink);color:var(--green-500);font-size:1.6rem;font-weight:850}.auth-card h1{margin-bottom:24px}.auth-card form{display:grid;gap:16px}.narrow{max-width:640px;margin-inline:auto}
  .appearance-card{display:flex;align-items:center;justify-content:space-between;gap:28px}.appearance-copy{display:flex;min-width:0;align-items:center;gap:14px}.appearance-icon{display:grid;width:48px;height:48px;flex:0 0 48px;place-items:center;border-radius:15px;background:var(--green-100);color:var(--green-700)}.appearance-icon svg{width:25px;height:25px;fill:none;stroke:currentColor;stroke-width:1.8}.appearance-form{display:flex;align-items:center;gap:12px}.appearance-form>div{display:flex;gap:4px;padding:4px;border-radius:13px;background:var(--surface-soft)}.appearance-form>div>div{margin:0}.appearance-form label{position:relative;margin:0;padding:8px 11px;border-radius:10px;color:var(--muted);cursor:pointer}.appearance-form label:has(input:checked){background:var(--surface);color:var(--green-700);box-shadow:var(--shadow)}.appearance-form input{position:absolute;width:1px;height:1px;min-height:0;opacity:0}.appearance-status{min-width:52px;font-size:.75rem;font-weight:700}.profile-card{display:grid;grid-template-columns:minmax(240px,.7fr) minmax(420px,1.3fr);align-items:end;gap:28px}.profile-card form{display:flex;align-items:end;gap:12px}.profile-fields{display:grid;min-width:0;flex:1;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}.profile-fields>div{margin:0}.target-settings{display:grid;grid-template-columns:minmax(0,1.35fr) minmax(310px,.65fr);align-items:start;gap:20px}.target-main,.target-side{display:grid;gap:20px}.target-main .card,.target-side .card{margin-bottom:0}.settings-history{margin-top:20px;padding-top:14px;border-top:1px solid var(--border)}.settings-history summary{color:var(--muted);font-size:.82rem;font-weight:750;cursor:pointer}.settings-history[open] summary{margin-bottom:8px}.settings-history-row{display:grid;grid-template-columns:1fr auto auto;gap:10px;align-items:center}.settings-history-row .actions{display:flex;gap:6px}.dashboard-log-cost{margin:3px 0 0;color:var(--muted);font-size:.82rem}.dashboard-log-cost strong{color:var(--text)}
  .bmi-spectrum{margin-top:22px;padding-top:20px;border-top:1px solid var(--border)}.bmi-spectrum-head{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;margin-bottom:18px}.bmi-current{display:flex;align-items:center;gap:8px}.bmi-current>strong{font-size:1.35rem}.bmi-category-labels,.bmi-thresholds{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:4px}.bmi-category-labels{margin-bottom:7px;font-size:.67rem;font-weight:750;text-align:center}.bmi-category-labels span:nth-child(1){color:var(--bmi-under)}.bmi-category-labels span:nth-child(2){color:var(--bmi-healthy)}.bmi-category-labels span:nth-child(3){color:var(--bmi-over)}.bmi-category-labels span:nth-child(4){color:var(--bmi-obese)}.bmi-track{position:relative;display:grid;height:17px;grid-template-columns:repeat(4,1fr);border:2px solid color-mix(in srgb,var(--ink) 13%,transparent);border-radius:99px;box-shadow:inset 0 2px 4px #0002}.bmi-segment:first-child{border-radius:99px 0 0 99px}.bmi-segment:last-of-type{border-radius:0 99px 99px 0}.bmi-segment--underweight{background:var(--bmi-under)}.bmi-segment--healthy{background:var(--bmi-healthy)}.bmi-segment--overweight{background:var(--bmi-over)}.bmi-segment--obese{background:var(--bmi-obese)}.bmi-indicator{position:absolute;top:50%;width:18px;height:18px;border:3px solid var(--surface);border-radius:50%;background:var(--ink);box-shadow:0 2px 8px #0007;transform:translate(-50%,-50%)}.bmi-thresholds{margin-top:7px;color:var(--muted);font-size:.62rem;text-align:right}.bmi-thresholds span:first-child{text-align:left}.bmi-note,.bmi-profile-prompt{margin-top:13px;font-size:.72rem}
  .dashboard-swipe-viewport,.dashboard-swipe-track,.dashboard-swipe{min-width:0}
}

@layer responsive {
  @media(max-width:1023px) and (min-width:761px){
    :root{--rail:84px}.app-shell{padding-left:calc(var(--rail) + 28px)}.topbar{align-items:center}.brand{padding-inline:0}.brand>span:last-child,.account-menu>a>span:last-child,.account-menu form{display:none}.nav a{justify-content:center;font-size:0}.rail-add{width:46px;padding:0;font-size:0}.dashboard-layout{grid-template-columns:minmax(0,1.5fr) minmax(230px,.5fr)}
  }
  @media(max-width:760px){
    body{padding-bottom:calc(76px + env(safe-area-inset-bottom))}
    .app-shell{width:100%;padding:0}.shell{padding:20px 16px 30px}.topbar{display:none}
    .mobile-nav{position:fixed;z-index:30;right:0;bottom:0;left:0;display:grid;grid-template-columns:repeat(5,1fr);align-items:end;min-height:68px;padding:7px 6px max(7px,env(safe-area-inset-bottom));border-top:1px solid var(--border);background:color-mix(in srgb,var(--surface) 95%,transparent);box-shadow:0 -8px 30px rgba(0,0,0,.1);backdrop-filter:blur(12px)}
    .mobile-nav>a,.mobile-nav>button:not(.mobile-add){display:grid;min-width:0;place-items:center;gap:2px;padding:3px;border:0;background:none;color:var(--muted);font-size:.68rem;text-decoration:none;cursor:pointer}
    .mobile-nav .nav-icon{width:22px;height:22px}.mobile-nav .is-active{color:var(--green-700)}
    .mobile-add{display:grid;align-self:end;place-items:center;gap:1px;margin-top:-23px;padding:0;border:0;background:none;color:var(--green-700);cursor:pointer}.mobile-add>span{display:grid;width:52px;height:52px;place-items:center;border:4px solid var(--canvas);border-radius:50%;background:var(--green-600);box-shadow:0 7px 17px rgba(55,117,33,.25);color:#fff}.mobile-add small{color:var(--green-700);font-size:.68rem;font-weight:750}
    .mobile-more-menu{position:fixed;z-index:31;right:10px;bottom:calc(70px + env(safe-area-inset-bottom));display:grid;min-width:210px;padding:8px;border:1px solid var(--border);border-radius:15px;background:var(--surface);box-shadow:var(--shadow-raised)}.mobile-more-menu[hidden]{display:none}.mobile-more-menu a,.mobile-more-menu button{display:block;width:100%;padding:11px;border:0;border-radius:9px;background:none;color:var(--ink);font-size:.85rem;text-align:left;text-decoration:none}.mobile-more-menu form{margin:0}
    .add-sheet{width:100%;max-width:none;margin:auto 0 0;padding:14px 18px calc(24px + env(safe-area-inset-bottom));border-radius:24px 24px 0 0}.add-sheet .sheet-handle{display:block;width:42px;height:4px;margin:0 auto 16px;border-radius:99px;background:var(--border-strong)}.add-grid{grid-template-columns:1fr}
    .page-head{align-items:flex-start;flex-wrap:wrap;margin-bottom:18px}.page-head>div:first-child{flex:1 1 180px}.page-head>div:not(:first-child){display:flex;gap:8px;flex-wrap:wrap}.page-head .actions{width:100%;max-width:none;justify-content:flex-start}.page-head .button{min-height:40px;padding:8px 12px;font-size:.84rem}.dashboard-swipe .page-head>.button.primary{display:none}
    .grid.two,.dashboard-layout,.food-detail-layout{grid-template-columns:1fr}.dashboard-layout{gap:0}
    .card{padding:19px;margin-bottom:16px}.section-head{margin-bottom:14px}
    .date-nav{justify-content:flex-end;margin:-54px 0 14px}.date-nav .button{display:none}
    .day-strip{gap:2px;margin-top:8px}.day-pill{min-height:54px}
    .daily-summary{grid-template-columns:1fr;gap:18px;padding:19px}.calorie-overview{gap:12px}.progress-ring{width:96px;height:96px;flex-basis:96px}.progress-ring::before{width:72px;height:72px}.macro-stack{gap:11px}.macro-row{grid-template-columns:58px minmax(60px,1fr) auto;gap:8px}.summary-foot{flex-wrap:wrap;gap:7px 16px}
    .nutrition-header{display:none}.nutrition-grid{grid-template-columns:minmax(0,1fr) 50px}.nutrition-grid>:last-child{display:none}.nutrition-mobile-macros{display:block}.entry{align-items:flex-start;flex-wrap:wrap}.entry>.actions{width:100%;justify-content:flex-end;padding-top:8px;border-top:1px solid var(--border)}.dashboard-thumb{width:44px;height:44px;flex-basis:44px}.dashboard-item small{white-space:normal}.nutrition-child{grid-template-columns:minmax(0,1fr) 50px}.nutrition-child>:last-child{display:none}.macro-popover{right:0}
    .dashboard-insights{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.side-cards{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.compact-card{min-height:150px;padding:16px}.compact-card .section-head h2{font-size:1.05rem}.hydration-breakdown{display:none}
    .catalog-row{align-items:start;gap:10px}.catalog-row>.actions{flex-wrap:nowrap;justify-content:flex-end}.catalog-media{width:50px;height:50px;flex-basis:50px}.catalog-row small{font-size:.74rem}
    .search .button{width:48px;padding:0;font-size:0}.search .button::after{content:"Go";font-size:.78rem}
    .ratio-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.form-card{padding:18px}.form-card form>.button.primary{width:100%}
    .field-grid--two,.field-grid--three,.field-grid--four,.food-create-overview{grid-template-columns:1fr}.food-image-picker{max-width:260px}.food-image-picker-target,.food-image-picker-target>img,.food-image-picker-placeholder{min-height:150px;height:150px}.sticky-form-actions{position:sticky;z-index:6;bottom:calc(70px + env(safe-area-inset-bottom));margin:4px 0 0;padding:12px 0 0;border-top:1px solid var(--border);background:color-mix(in srgb,var(--surface) 95%,transparent);backdrop-filter:blur(10px)}.sticky-form-actions .button.primary{flex:1}.log-form .sticky-form-actions{position:static}.serving-editor-head{align-items:stretch;flex-direction:column}.serving-add{align-self:flex-start}.serving-default-choice small{max-width:230px}.recipe-component.is-alternative{margin-left:12px}.recipe-ingredient-head{flex-direction:column}.recipe-ingredient-actions{width:100%;justify-content:flex-end;flex-wrap:wrap}.recipe-detail-alternatives{margin-left:22px}.recipe-alternative-picker{grid-template-columns:1fr}
    .chart-card{padding:19px}.chart-card .section-head{flex-direction:column}.chart-controls{width:100%}.chart-wrap{min-height:220px}.chart-wrap canvas{height:230px}.chart-wrap .empty-state{min-height:190px}.chart-legend{margin-left:0}
    .apply-plan{width:100%;flex-wrap:wrap}.apply-plan input{min-width:0;flex:1}.plan-actions{width:100%;margin-top:8px}.plan-actions .apply-plan{width:auto;flex:1}.plan-actions .apply-plan input{max-width:160px}
    .plan-grid{grid-template-columns:1fr}.plan-card{min-height:230px}
    .food-detail-image{height:170px}.auth-card{margin:4vh auto 0;padding:26px}.toast-stack{top:12px;right:12px;left:12px}.appearance-card{align-items:flex-start;flex-direction:column}.appearance-form{width:100%;align-items:stretch;flex-direction:column}.appearance-form>div{display:grid;grid-template-columns:repeat(3,1fr)}.appearance-form label{text-align:center}.appearance-form .button{width:100%}.profile-card{grid-template-columns:1fr}.profile-card form{align-items:stretch;flex-direction:column}.profile-fields{width:100%;grid-template-columns:1fr}.profile-card .button{width:100%}.target-settings{grid-template-columns:1fr}.bmi-category-labels{font-size:.59rem}.bmi-thresholds{font-size:.56rem}
    .dashboard-swipe-viewport{overflow:hidden}.dashboard-swipe-track{display:flex;transform:translateX(-100%);will-change:transform}.dashboard-swipe{width:100%;flex:0 0 100%;touch-action:pan-y}.dashboard-swipe-adjacent{display:none}.dashboard-swipe-track.is-interacting .dashboard-swipe-adjacent{display:block}.dashboard-swipe-track.is-dragging{user-select:none}.dashboard-swipe-track.is-settling{transition:transform .22s cubic-bezier(.22,.8,.3,1)}.dashboard-swipe-loading{min-height:240px}
  }
  @media(max-width:430px){
    .dashboard-swipe .date-nav{justify-content:flex-end;margin:0 0 14px}
  }
  @media(max-width:380px){
    .shell{padding-inline:14px}.page-head .actions{max-width:none}.dashboard-insights,.side-cards{grid-template-columns:1fr}.day-pill strong{width:28px;height:28px}.progress-tabs{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));overflow:visible}.progress-tabs a{min-width:0;padding:7px 2px;font-size:.68rem}.summary-number{font-size:2.25rem}.ratio-grid{grid-template-columns:1fr}.dashboard-item-link{overflow:visible;text-overflow:clip;white-space:normal}.autocomplete-option{grid-template-columns:44px minmax(0,1fr);padding-inline:9px}.autocomplete-media{width:44px;height:44px}.autocomplete-badges{display:none}.recipe-ingredient-overrides{padding:10px}.recipe-ingredient{padding:12px}.recipe-alternative-picker{padding:6px}.recipe-alternative-option{grid-template-columns:32px minmax(0,1fr) 18px;gap:6px;padding:7px}.recipe-alternative-option>img{width:32px;height:32px}.recipe-alternative-option i{width:18px;height:18px}.recipe-ingredient-actions .button{flex:1}.recipe-component-actions .component-add-alternative{max-width:calc(100% - 50px);white-space:normal}
  }
  @media(prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;transition:none!important}}
}
@layer components {
  .nutrition-capture-actions{display:flex;gap:8px}.nutrition-capture-actions .nutrition-capture-action{display:inline-grid;width:48px;min-height:48px;padding:0;place-items:center;border-radius:14px}.nutrition-capture-action svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.nutrition-capture-actions #capture-nutrition-camera-button{background:var(--green-600);color:#fff}.nutrition-capture-actions #capture-nutrition-button{border-color:var(--green-300);background:var(--surface);color:var(--green-700)}
}
