:root { color-scheme:light; --bg:#f6f4ee; --card:#fffefa; --ink:#24372b; --muted:#647064; --line:#e2e5db; --green:#285640; --on-green:#fffefa; --sage:#e7ede3; --soft:#eceee5; --orange:#a46639; --danger:#a34438; --shadow:0 14px 45px #2637230b; --safe-top:max(env(safe-area-inset-top),var(--telegram-safe-top,0px)); --safe-bottom:max(env(safe-area-inset-bottom),var(--telegram-safe-bottom,0px)); }
:root[data-theme="dark"] { color-scheme:dark; --bg:#152019; --card:#202e24; --ink:#ecf0e4; --muted:#aebba9; --line:#3c4b3e; --green:#b9d4a5; --on-green:#16291d; --sage:#304532; --soft:#293c2e; --orange:#edb183; --danger:#ffad9e; --shadow:none; }
* { box-sizing:border-box; }
body { margin:0; background:var(--bg); color:var(--ink); font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; font-size:15px; line-height:1.5; -webkit-font-smoothing:antialiased; padding-top:var(--safe-top); padding-left:max(env(safe-area-inset-left),var(--telegram-safe-left,0px)); padding-right:max(env(safe-area-inset-right),var(--telegram-safe-right,0px)); }
button,input,select,textarea { font:inherit; }
button { cursor:pointer; color:inherit; border:0; background:none; -webkit-tap-highlight-color:transparent; }
button:disabled { opacity:.5; cursor:not-allowed; }
button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,summary:focus-visible { outline:3px solid var(--orange); outline-offset:4px; }
h1,h2,h3,p { margin:0; overflow-wrap:anywhere; }
h1,h2,h3 { font-weight:500; }
h1 { font-family:Georgia,serif; font-size:42px; line-height:1.15; letter-spacing:-1.4px; }
h2 { font-size:23px; letter-spacing:-.6px; }
h3 { font-size:17px; font-weight:600; }
.app-shell { width:min(100% - 64px,1060px); margin:auto; }
.brand-bar { height:94px; display:flex; align-items:center; justify-content:space-between; gap:12px; border-bottom:1px solid var(--line); }
.brand { display:flex; align-items:center; gap:10px; font-family:Georgia,serif; font-size:32px; letter-spacing:-1.7px; }
.brand-mark { background:var(--green); color:var(--on-green); width:36px; height:36px; line-height:31px; font-style:italic; border-radius:11px; text-align:center; font-size:32px; }
.brand-dot { font:10px sans-serif; align-self:flex-start; margin-top:9px; margin-left:-5px; }
main { padding:32px 0 calc(126px + var(--safe-bottom)); min-height:calc(100dvh - 95px); }
main:focus { outline:none; }
.page-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:26px; }
.eyebrow { font-size:10px; font-weight:650; letter-spacing:1.7px; text-transform:uppercase; color:var(--muted); margin-bottom:10px; }
.muted { color:var(--muted); }
.small { font-size:12px; }
.subheading { margin-top:8px; color:var(--muted); }
.button { display:inline-flex; align-items:center; justify-content:center; gap:9px; min-height:48px; padding:12px 20px; border-radius:14px; font-weight:600; font-size:14px; border:1px solid transparent; transition:background .15s,transform .15s; }
.button:active { transform:translateY(1px); }
.primary { background:var(--green); color:var(--on-green); }
.secondary { background:var(--sage); color:var(--ink); }
.outline { border-color:var(--line); background:var(--card); }
.quiet { color:var(--muted); }
.danger { color:var(--danger); }
.full { width:100%; }
.row { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.between { justify-content:space-between; }
.stack { display:grid; gap:16px; }
.day-controls { display:flex; align-items:center; gap:7px; }
.day-controls input { border:1px solid var(--line); border-radius:12px; padding:9px 10px; background:var(--card); color:var(--ink); min-height:44px; width:150px; }
.dashboard { display:grid; grid-template-columns:340px minmax(0,1fr); gap:32px; align-items:start; }
.summary-card { background:var(--sage); padding:26px; border-radius:25px; position:relative; overflow:hidden; }
.summary-top { display:flex; justify-content:space-between; align-items:center; font-size:13px; }
.summary-decoration { position:absolute; right:-23px; top:39px; width:138px; height:138px; border:1px solid color-mix(in srgb,var(--green) 20%,transparent); border-radius:50%; pointer-events:none; }
.summary-decoration:before,.summary-decoration:after { content:""; position:absolute; border:inherit; border-radius:50%; inset:12px; }
.summary-decoration:after { inset:26px; }
.calories { font-size:66px; line-height:1.1; font-weight:450; letter-spacing:-3px; font-variant-numeric:tabular-nums; margin:28px 0 4px; position:relative; }
.calories span { font-size:17px; letter-spacing:0; margin-left:5px; color:var(--muted); }
.summary-note { font-size:12px; color:var(--muted); margin-bottom:28px; }
.macros { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; font-variant-numeric:tabular-nums; }
.macro { display:grid; gap:5px; }
.macro span { font-size:11px; color:var(--muted); }
.macro strong { font-size:20px; font-weight:550; overflow-wrap:anywhere; }
.macro strong small { font-size:12px; font-weight:400; }
.macro:before { content:""; height:3px; width:24px; border-radius:3px; background:#547c5d; margin-bottom:3px; }
.macro:nth-child(2):before { background:#ba8f54; }.macro:nth-child(3):before { background:#a18fba; }
.add-card { margin-top:18px; }
.side-note { padding:20px 6px; color:var(--muted); font-size:12px; line-height:1.7; }
.section-title { display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; gap:12px; }
.count { font-size:12px; color:var(--muted); background:var(--soft); border-radius:8px; padding:3px 8px; }
.meal-card { display:block; width:100%; text-align:left; background:var(--card); border:1px solid var(--line); border-radius:20px; overflow:hidden; padding:0; box-shadow:var(--shadow); }
.meal-content { padding:18px 20px; }
.meal-meta { display:flex; align-items:center; justify-content:space-between; gap:12px; color:var(--muted); font-size:11px; margin-bottom:6px; }
.meal-title { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:12px; }
.meal-nutrients { font-size:12px; color:var(--muted); display:flex; gap:12px; flex-wrap:wrap; }
.meal-nutrients strong { color:var(--ink); font-weight:600; }
.meal-list { display:grid; gap:18px; }
.bottom-nav { position:fixed; bottom:calc(12px + var(--safe-bottom)); left:50%; transform:translateX(-50%); width:min(440px,calc(100% - 32px)); display:grid; grid-template-columns:repeat(2,1fr); padding:7px; background:var(--card); border:1px solid var(--line); border-radius:22px; z-index:10; box-shadow:0 8px 36px #14251916; }
.nav-item { display:grid; justify-items:center; align-content:center; gap:4px; min-height:56px; border-radius:16px; font-size:12px; color:var(--muted); }
.nav-item.active { background:var(--sage); color:var(--green); font-weight:650; }
.empty { text-align:center; border:1px dashed var(--line); border-radius:20px; padding:40px 20px; }
.empty p { color:var(--muted); margin:8px 0 20px; font-size:13px; }
.review { width:min(100%,640px); margin:auto; }
.review-hero { border-radius:21px; overflow:hidden; margin-bottom:20px; background:var(--sage); }
.review-hero img { display:block; width:100%; height:205px; object-fit:cover; }
.photo-placeholder { min-height:130px; display:grid; place-items:center; background:var(--sage); color:var(--muted); font-size:12px; padding:20px; }
.review-caption { font-size:11px; padding:10px 15px; color:var(--muted); background:var(--card); }
.review-total { padding:20px; border:1px solid var(--line); border-radius:18px; margin-bottom:22px; background:var(--card); }
.review-total .calories { font-size:30px; letter-spacing:-1px; margin:8px 0; }
.review-total .macros { margin-top:14px; }
.review-total .macro strong { font-size:16px; }
.review-total .macro:before { display:none; }
.ingredient { display:flex; align-items:center; gap:12px; padding:14px 0; border-bottom:1px solid var(--line); }
.ingredient-main { display:block; flex:1; text-align:left; min-width:0; padding:5px 0; }
.ingredient-name { display:block; font-weight:550; font-size:14px; overflow-wrap:anywhere; }
.ingredient-main small { display:block; font-size:11px; color:var(--muted); margin-top:3px; }
.inline-action { display:flex; align-items:center; justify-content:center; gap:8px; width:100%; min-height:48px; color:var(--green); font-weight:550; font-size:13px; border:1px dashed var(--line); border-radius:12px; margin:14px 0; }
.sticky-save { position:sticky; bottom:calc(100px + var(--safe-bottom)); background:var(--bg); padding:12px 0; margin-top:18px; border-top:1px solid var(--line); z-index:5; display:grid; gap:8px; }
.review-fields { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-bottom:20px; }
.review-fields > :first-child { grid-column:1/-1; }
.field { display:block; font-size:12px; font-weight:550; min-width:0; }
.field input,.field select,.field textarea { display:block; width:100%; min-height:48px; margin-top:6px; border:1px solid var(--line); background:var(--card); color:var(--ink); border-radius:12px; padding:12px; font-size:16px; font-weight:400; }
.field input[aria-invalid="true"] { border-color:var(--danger); }
.field-error { display:block; color:var(--danger); font-size:11px; font-weight:400; margin-top:4px; }
.help { font-size:12px; color:var(--muted); line-height:1.6; }
.notice { background:var(--sage); border-radius:12px; padding:12px 14px; color:var(--muted); font-size:12px; }
.nutrition-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.basis { display:flex; padding:4px; gap:4px; background:var(--soft); border-radius:12px; }
.basis button { flex:1; padding:10px; border-radius:9px; font-size:13px; min-height:44px; }
.basis button.active { background:var(--card); box-shadow:0 2px 7px #0000000a; color:var(--green); font-weight:600; }
dialog { background:var(--card); color:var(--ink); padding:0; border:1px solid var(--line); border-radius:25px; width:min(500px,calc(100% - 32px)); max-height:calc(100dvh - 48px - var(--safe-top)); overflow:auto; box-shadow:0 24px 100px #0003; overscroll-behavior:contain; }
dialog::backdrop { background:#14231b77; backdrop-filter:blur(3px); }
body:has(dialog[open]) { overflow:hidden; }
.sheet-top { position:sticky; top:0; z-index:2; display:flex; align-items:center; justify-content:space-between; gap:12px; padding:20px 24px 12px; background:var(--card); }
.sheet-top h2 { font-size:22px; }
.sheet-body { padding:8px 24px 20px; display:grid; gap:16px; }
.sheet-footer { display:flex; gap:8px; position:sticky; bottom:0; background:var(--card); border-top:1px solid var(--line); padding:14px 24px max(14px,var(--safe-bottom)); z-index:2; }
.sheet-footer .primary { flex:1; }
.sheet-error { color:var(--danger); font-size:12px; }
.checkbox { display:flex; gap:10px; font-size:12px; align-items:flex-start; line-height:1.5; }
.checkbox input { width:20px; height:20px; flex-shrink:0; accent-color:var(--green); }
[hidden] { display:none!important; }
.profile { max-width:560px; margin:auto; }
.profile-card { padding:22px; border:1px solid var(--line); border-radius:20px; background:var(--card); margin-bottom:18px; }
.toast { position:fixed; bottom:calc(100px + var(--safe-bottom)); left:50%; transform:translateX(-50%); background:var(--ink); color:var(--bg); padding:12px 18px; border-radius:12px; font-size:13px; z-index:30; max-width:calc(100% - 32px); width:max-content; pointer-events:none; }
.toast:empty { display:none; }
body:has(main input:focus,main textarea:focus,main select:focus) .bottom-nav { display:none; }
body:has(main input:focus,main textarea:focus,main select:focus) .sticky-save { bottom:var(--safe-bottom); }
.error-banner { padding:16px; border:1px solid var(--danger); border-radius:14px; margin-bottom:20px; display:grid; gap:12px; }
@media (max-width:760px) {
  .app-shell { width:calc(100% - 40px); max-width:480px; }
  .brand-bar { height:74px; }.brand { font-size:29px; }.brand-mark { width:31px; height:31px; font-size:28px; line-height:29px; border-radius:9px; }
  main { padding-top:24px; }.page-heading { margin-bottom:22px; align-items:flex-start; }h1 { font-size:36px; }
  .dashboard { grid-template-columns:1fr; gap:26px; }.summary-card { padding:23px; }.calories { margin-top:15px; font-size:60px; }.summary-note { margin-bottom:20px; }
  .day-controls input { width:135px; font-size:14px; }
  .side-note { display:none; }.add-card { margin-top:14px; }.review-hero img { height:185px; }
  .review .page-heading { align-items:center; }.review h1 { font-size:30px; }
}
@media (max-width:540px) {
  dialog { width:100%; max-width:100%; margin:auto 0 0; max-height:calc(100dvh - 24px - var(--safe-top)); border-radius:24px 24px 0 0; border-bottom:0; }
  .sheet-top { padding:18px 20px 12px; }.sheet-body { padding:8px 20px 16px; }.sheet-footer { padding-left:20px; padding-right:20px; }
}
@media (max-width:360px) { .page-heading { flex-wrap:wrap; }.review-fields { grid-template-columns:1fr; }.app-shell { width:calc(100% - 24px); } }
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { transition:none!important; animation:none!important; } }
