/* FitInFlow Food Tracker — phone-first app shell. Tokens first, light and dark. */
:root{
  --bg:#F3F6F2; --surface:#FFFFFF; --surface-2:#E8EEE7; --line:#D5DED4;
  --ink:#17241D; --muted:#5D6B63; --accent:var(--brand,#1F6B57); --accent-ink:#FFFFFF; --accent-soft:#D6EAE2;
  --protein:#5CC46A; --carbs:#E0443A; --fat:#F2C230; --alcohol:#9B6BD6; --supp:#F28A1E; --period:#E0457B; --fert:#2BB5A3; --water:#3FA9E8; --left:#DDE6EE; --left-ink:#4E7A9E;
  --good:#1E8A4C; --ok:#7BAA2E; --mid:#C9A227; --warn:#D9822B; --bad:#C8423A; --on-color:#FFFFFF;
  --shadow:0 1px 2px rgba(23,36,29,.06),0 8px 24px rgba(23,36,29,.08);
  --f-display:"Bricolage Grotesque","Avenir Next",system-ui,sans-serif;
  --f-body:"Figtree",system-ui,-apple-system,"Segoe UI",sans-serif;
  --f-data:"IBM Plex Mono",ui-monospace,"SF Mono",Menlo,monospace;
  --r:14px; color-scheme:light;
}
@media (prefers-color-scheme: dark){:root:not([data-theme="light"]){
  --bg:#0F1613; --surface:#18221D; --surface-2:#22302A; --line:#2E3D36;
  --ink:#E7EFE9; --muted:#9AABA2; --accent:#5CC4A3; --accent-ink:#0B1A14; --accent-soft:#1E3A31;
  --protein:#7BD889; --carbs:#F26A5F; --fat:#F5D25A; --alcohol:#B98CF0; --supp:#F7A34B; --period:#F2709D; --fert:#4FD1BE; --water:#6CC3F5; --left:#2B3A44; --left-ink:#9CC3E0;
  --good:#4CC27E; --ok:#A6CF5C; --mid:#D9BC4A; --warn:#F0A458; --bad:#EF7468; --on-color:#0B1A14;
  --shadow:0 1px 2px rgba(0,0,0,.3),0 8px 24px rgba(0,0,0,.35); color-scheme:dark}}
:root[data-theme="dark"]{
  --bg:#0F1613; --surface:#18221D; --surface-2:#22302A; --line:#2E3D36;
  --ink:#E7EFE9; --muted:#9AABA2; --accent:#5CC4A3; --accent-ink:#0B1A14; --accent-soft:#1E3A31;
  --protein:#7BD889; --carbs:#F26A5F; --fat:#F5D25A; --alcohol:#B98CF0; --supp:#F7A34B; --period:#F2709D; --fert:#4FD1BE; --water:#6CC3F5; --left:#2B3A44; --left-ink:#9CC3E0;
  --good:#4CC27E; --ok:#A6CF5C; --mid:#D9BC4A; --warn:#F0A458; --bad:#EF7468; --on-color:#0B1A14;
  --shadow:0 1px 2px rgba(0,0,0,.3),0 8px 24px rgba(0,0,0,.35); color-scheme:dark}

*{box-sizing:border-box}
html,body{margin:0;min-height:100%}
body{background:var(--bg);color:var(--ink);font-family:var(--f-body);font-size:15px;line-height:1.45;-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:transparent;padding-top:env(safe-area-inset-top,0px)}
body::before{content:"";position:fixed;inset:0 0 auto;height:env(safe-area-inset-top,0px);z-index:10;background:var(--bg)}
button,input,select,textarea{font:inherit;color:inherit}
button{cursor:pointer}
a{color:var(--accent)}
img{max-width:100%}
[hidden]{display:none!important}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.num{font-family:var(--f-data);font-variant-numeric:tabular-nums}
.wrap{max-width:560px;margin:0 auto;padding-left:max(16px,env(safe-area-inset-left,0px));padding-right:max(16px,env(safe-area-inset-right,0px));padding-block:0 120px}
.boot{display:flex;gap:10px;align-items:center;justify-content:center;padding:80px 16px;color:var(--muted)}

/* welcome (logged out) */
.welcome{max-width:420px;margin:0 auto;padding:12vh max(20px,env(safe-area-inset-right,0px)) 40px max(20px,env(safe-area-inset-left,0px));text-align:center}
.welcome-icon{border-radius:18px;box-shadow:var(--shadow)}
.welcome h1{font-family:var(--f-display);font-size:32px;margin:18px 0 8px;text-wrap:balance}
.welcome-lead{color:var(--muted);margin:0 0 24px}
.welcome-actions{display:grid;gap:10px;margin-bottom:18px}

/* header */
.top{position:sticky;top:env(safe-area-inset-top,0px);z-index:5;background:var(--bg);padding-block:12px 10px;display:flex;align-items:center;gap:8px}
.brand{font-family:var(--f-display);font-weight:700;font-size:22px;letter-spacing:-.01em;flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.brand small{display:block;font-family:var(--f-body);font-weight:500;font-size:12px;color:var(--muted);letter-spacing:.02em}
.datebar{display:flex;align-items:center;gap:2px;background:var(--surface);border:1px solid var(--line);border-radius:999px;padding:3px;flex:none}
.datebar button{border:0;background:none;width:34px;height:34px;border-radius:999px;display:grid;place-items:center}
.datebar button:hover{background:var(--surface-2)}
.datebar .d{font-weight:600;font-size:14px;min-width:92px;width:auto;padding:0 6px}

/* summary */
.summary{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);padding:16px;display:grid;grid-template-columns:auto 1fr;gap:18px;align-items:center;box-shadow:var(--shadow)}
.ring{position:relative;width:118px;height:118px}
.ring svg{transform:rotate(-90deg)}
.ring .c{position:absolute;inset:0;display:grid;place-content:center;text-align:center}
.ring .big{font-family:var(--f-display);font-weight:700;font-size:26px;line-height:1}
.ring .sm{font-size:11px;color:var(--muted);margin-top:3px;letter-spacing:.04em;text-transform:uppercase}
.macros{display:grid;gap:10px;min-width:0}
.mrow{display:grid;gap:4px}
.mrow .lbl{display:flex;justify-content:space-between;gap:6px;font-size:13px}
.mrow .lbl b{font-weight:600}
.mrow .lbl .pct{color:var(--muted)}
.bar{height:7px;border-radius:99px;background:var(--surface-2);overflow:hidden}
.bar i{display:block;height:100%;border-radius:99px;transition:width .4s ease}


/* sections and cards */
.section-h{display:flex;align-items:baseline;justify-content:space-between;margin:22px 2px 8px;gap:8px}
.section-h h2{font-family:var(--f-display);font-weight:700;font-size:19px;margin:0}
.section-h .meta{font-size:13px;color:var(--muted)}
.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);padding:6px 14px}
.meal{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);overflow:hidden}
.meal + .meal{margin-top:10px}
.meal-h{display:flex;align-items:center;gap:8px;padding:12px 12px 10px 14px}
.meal-h h3{margin:0;font-size:15px;font-weight:700;flex:1}
.meal-h .kc{font-size:13px;color:var(--muted)}
.iconbtn{border:1px solid var(--line);background:var(--surface);width:34px;height:34px;border-radius:10px;display:grid;place-items:center;color:var(--muted);flex:none;padding:0}
.iconbtn:hover{color:var(--ink);background:var(--surface-2)}
.mealphoto{display:block;width:100%;max-height:220px;object-fit:cover;border-top:1px solid var(--line)}
.entry,.item{display:flex;align-items:center;gap:12px;width:100%;text-align:left;border:0;background:none;padding:10px 14px}
.entry{border-top:1px solid var(--line)}
.item{padding:10px 4px;border-bottom:1px solid var(--line)}
.entry:hover,.item:hover{background:var(--surface-2)}
.thumb{width:40px;height:40px;border-radius:10px;background:var(--surface-2);display:grid;place-items:center;font-size:22px;flex:none;overflow:hidden}
.thumb img{width:100%;height:100%;object-fit:cover}
.t{flex:1;min-width:0}
.n{display:block;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.s{display:block;font-size:12.5px;color:var(--muted)}
.k{font-size:14px;flex:none}
.rep{font-size:11px;color:var(--accent);font-weight:700;letter-spacing:.04em;text-transform:uppercase;margin-left:4px}
.addrow{display:flex;align-items:center;gap:8px;width:100%;border:0;border-top:1px dashed var(--line);background:none;padding:11px 14px;color:var(--accent);font-weight:600;text-align:left}
.addrow:hover{background:var(--accent-soft)}
.mini{border:0;background:none;color:var(--accent);font-weight:600;font-size:13px;padding:4px 6px;border-radius:8px}
.mini:hover{background:var(--accent-soft)}

.tiles{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.tile{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);padding:12px 14px;display:grid;gap:8px;min-width:0}
.tile h3{margin:0;font-size:14px;font-weight:700;display:flex;justify-content:space-between;gap:6px}
.tile h3 span{font-weight:500;color:var(--muted);font-size:12.5px}
.tile .val{font-family:var(--f-display);font-size:24px;font-weight:700;line-height:1}
.tile .val small{font-family:var(--f-body);font-size:13px;color:var(--muted);font-weight:500}
.stepper{display:flex;gap:6px}
.stepper button{flex:1;border:1px solid var(--line);background:var(--surface-2);border-radius:10px;padding:7px 0;font-weight:700}
@media (max-width:340px){.tiles{grid-template-columns:1fr}}

.nrow{display:grid;grid-template-columns:1fr auto;gap:4px 10px;padding:10px 0;border-bottom:1px solid var(--line)}
.nrow:last-child{border-bottom:0}
.nrow .nm{font-weight:600;font-size:14px}
.nrow .v{font-size:13px;color:var(--muted);text-align:right}
.nrow .bar{grid-column:1/-1}
.tag{display:inline-block;font-size:10.5px;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);border:1px solid var(--line);border-radius:6px;padding:1px 5px;margin-left:6px;vertical-align:1px;font-weight:600}
details.report > summary{list-style:none;cursor:pointer}
details.report > summary::-webkit-details-marker{display:none}
details.report > summary .meta::after{content:" ▾"}
details.report[open] > summary .meta::after{content:" ▴"}

/* charts */
.chart{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);padding:14px 12px 10px}
.chart h3{margin:0 2px 2px;font-size:15px}
.chart .sub{margin:0 2px 8px;font-size:12.5px;color:var(--muted)}
.chart svg{display:block;width:100%;height:auto}
.legend{display:flex;gap:14px;flex-wrap:wrap;font-size:12.5px;color:var(--muted);margin:6px 2px 0}
.legend i{display:inline-block;width:10px;height:10px;border-radius:3px;margin-right:5px;vertical-align:-1px}
.stats{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-bottom:12px}
.stat{background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:10px;text-align:center}
.stat b{display:block;font-family:var(--f-display);font-size:20px}
.stat span{font-size:11.5px;color:var(--muted)}

/* lists */
.search{width:100%;border:1px solid var(--line);background:var(--surface);border-radius:12px;padding:11px 14px;min-width:0}
.list{display:grid}
.grp{margin:14px 2px 2px;font-size:12px;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);font-weight:600}
.empty{text-align:center;color:var(--muted);padding:26px 12px;font-size:14px}
.empty strong{display:block;color:var(--ink);font-size:15px;margin-bottom:4px}

/* tab bar */
.tabs{position:fixed;left:0;right:0;bottom:0;z-index:20;background:var(--surface);border-top:1px solid var(--line);padding-bottom:env(safe-area-inset-bottom,0px);padding-left:max(8px,env(safe-area-inset-left,0px));padding-right:max(8px,env(safe-area-inset-right,0px))}
.tabs .in{max-width:560px;margin:0 auto;display:grid;grid-template-columns:repeat(5,1fr);align-items:end}
.tab{border:0;background:none;padding:8px 0 9px;display:grid;justify-items:center;gap:2px;font-size:11px;font-weight:600;color:var(--muted)}
.tab svg{width:22px;height:22px}
.tab[aria-current="page"]{color:var(--accent)}
.scanbtn{justify-self:center;width:58px;height:58px;border-radius:18px;border:0;background:var(--accent);color:var(--accent-ink);display:grid;place-items:center;transform:translateY(-14px);box-shadow:var(--shadow)}
.scanbtn svg{width:26px;height:26px}

/* sheets */
.backdrop{position:fixed;inset:0;background:rgba(10,18,14,.45);z-index:40;opacity:0;transition:opacity .2s}
.backdrop.show{opacity:1}
.sheet{position:fixed;left:0;right:0;bottom:0;z-index:41;max-height:92vh;max-height:92dvh;display:flex;flex-direction:column;background:var(--bg);border-radius:20px 20px 0 0;transform:translateY(100%);transition:transform .25s ease;box-shadow:0 -8px 30px rgba(0,0,0,.2)}
.sheet.show{transform:none}
.sheet .grab{width:40px;height:4px;border-radius:9px;background:var(--line);margin:8px auto 0;flex:none}
.sheet-h{display:flex;align-items:center;gap:8px;padding:10px max(16px,env(safe-area-inset-right,0px)) 10px max(16px,env(safe-area-inset-left,0px));max-width:600px;margin:0 auto;width:100%;flex:none}
.sheet-h h2{flex:1;margin:0;font-family:var(--f-display);font-size:20px;font-weight:700;text-wrap:balance;min-width:0}
.sheet-b{overflow-y:auto;-webkit-overflow-scrolling:touch;padding:4px max(16px,env(safe-area-inset-right,0px)) calc(24px + env(safe-area-inset-bottom,0px)) max(16px,env(safe-area-inset-left,0px));max-width:600px;margin:0 auto;width:100%}
@media (prefers-reduced-motion:reduce){.sheet,.backdrop,.bar i{transition:none}}

/* forms */
.seg{display:flex;background:var(--surface-2);border-radius:12px;padding:3px;gap:3px;margin-bottom:14px;overflow-x:auto}
.seg button{flex:1;border:0;background:none;border-radius:9px;padding:8px 10px;font-weight:600;font-size:13.5px;color:var(--muted);white-space:nowrap}
.seg button[aria-pressed="true"]{background:var(--surface);color:var(--ink);box-shadow:0 1px 2px rgba(0,0,0,.08)}
.field{display:grid;gap:5px;margin-bottom:12px;min-width:0}
.field label,.lab{font-size:12.5px;font-weight:600;color:var(--muted);letter-spacing:.02em}
.inp{width:100%;border:1px solid var(--line);background:var(--surface);border-radius:10px;padding:10px 12px;min-width:0;font-size:16px}
textarea.inp{min-height:84px;resize:vertical}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.btn{border:0;border-radius:12px;padding:12px 16px;font-weight:700;background:var(--accent);color:var(--accent-ink);display:inline-flex;align-items:center;justify-content:center;gap:8px;text-decoration:none;font-size:15px}
.btn.wide{width:100%}
.btn.ghost{background:var(--surface);color:var(--ink);border:1px solid var(--line)}
.btn.danger{background:none;color:var(--bad);border:1px solid var(--line)}
.btn.danger.arm{background:var(--bad);color:var(--on-color);border-color:var(--bad)}
.btn:disabled{opacity:.5;cursor:default}
.row{display:flex;gap:10px;flex-wrap:wrap}
.row > *{flex:1}
.chips{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:12px}
.chip{border:1px solid var(--line);background:var(--surface);border-radius:999px;padding:6px 11px;font-size:13px;font-weight:600}
.chip[aria-pressed="true"]{background:var(--accent-soft);border-color:var(--accent);color:var(--accent)}
.days{display:grid;grid-template-columns:repeat(7,1fr);gap:4px;margin-bottom:12px}
.days .chip{padding:7px 0;text-align:center}
.emojis{display:grid;grid-template-columns:repeat(8,1fr);gap:4px;margin-bottom:12px}
.emojis button{border:1px solid transparent;background:var(--surface);border-radius:10px;font-size:22px;aspect-ratio:1;display:grid;place-items:center;padding:0;max-width:100%}
.emojis button[aria-pressed="true"]{border-color:var(--accent);background:var(--accent-soft)}
details.more{border-top:1px solid var(--line);padding-top:10px;margin-bottom:12px}
details.more summary{font-weight:600;cursor:pointer;margin-bottom:10px;color:var(--accent)}
.hint{font-size:12.5px;color:var(--muted);margin:0 0 12px}
.preview{display:grid;grid-template-columns:repeat(4,1fr);gap:6px;background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:10px;margin-bottom:14px;text-align:center}
.preview b{display:block;font-family:var(--f-data);font-size:16px}
.preview span{font-size:11px;color:var(--muted);text-transform:uppercase;letter-spacing:.05em}
.photo-pick{display:flex;align-items:center;gap:12px;margin-bottom:12px}
.photo-pick .thumb{width:64px;height:64px;font-size:32px;border-radius:14px}
.switch{display:flex;align-items:center;gap:10px;margin-bottom:10px;font-weight:600}
.switch input{width:20px;height:20px;accent-color:var(--accent)}
.status{font-size:13.5px;color:var(--muted);display:flex;align-items:center;gap:8px;margin:8px 0 12px}
.spin{width:16px;height:16px;border:2px solid var(--line);border-top-color:var(--accent);border-radius:50%;animation:sp .8s linear infinite;flex:none;display:inline-block}
@keyframes sp{to{transform:rotate(360deg)}}
@media (prefers-reduced-motion:reduce){.spin{animation-duration:3s}}
.ingr{display:flex;align-items:center;gap:10px;padding:8px 0;border-bottom:1px solid var(--line)}
.ingr .inp{width:78px;flex:none;padding:7px 8px}

/* scanner */
.cam{position:relative;border-radius:16px;overflow:hidden;background:#000;aspect-ratio:4/3;max-width:100%;margin-bottom:12px}
.cam video{width:100%;height:100%;object-fit:cover;display:block}
.cam .frame{position:absolute;left:12%;right:12%;top:34%;bottom:34%;border:3px solid rgba(255,255,255,.9);border-radius:12px;box-shadow:0 0 0 999px rgba(0,0,0,.35)}
.cam .msg{position:absolute;left:0;right:0;bottom:10px;text-align:center;color:#fff;font-size:13px;font-weight:600;text-shadow:0 1px 3px rgba(0,0,0,.6)}

/* product score */
.score{display:grid;grid-template-columns:auto 1fr;gap:14px;align-items:center;background:var(--surface);border:1px solid var(--line);border-radius:var(--r);padding:14px;margin-bottom:12px}
.dial{width:84px;height:84px;border-radius:50%;display:grid;place-content:center;text-align:center;color:var(--on-color)}
.dial b{font-family:var(--f-display);font-size:30px;line-height:1}
.dial span{font-size:10px;letter-spacing:.06em;text-transform:uppercase;opacity:.9}
.score h3{margin:0 0 2px;font-size:17px}
.score .br{font-size:12.5px;color:var(--muted)}
.facts{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);padding:4px 14px;margin-bottom:12px}
.fact{display:flex;align-items:center;gap:10px;padding:9px 0;border-bottom:1px solid var(--line);font-size:14px}
.fact:last-child{border-bottom:0}
.fact .pip{width:10px;height:10px;border-radius:50%;flex:none}
.fact .nm{flex:1;min-width:0}
.fact .vl{color:var(--muted);font-size:13px;text-align:right}
.facts h4{margin:10px 0 2px;font-size:12px;letter-spacing:.06em;text-transform:uppercase;color:var(--muted)}
.ngrade{display:inline-grid;place-items:center;width:22px;height:22px;border-radius:6px;color:var(--on-color);font-weight:700;font-size:12px;margin-left:6px;vertical-align:1px}
.prodimg{width:84px;height:84px;object-fit:contain;border-radius:12px;background:#fff}

/* more */
.menu{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);overflow:hidden}
.menu button,.menu a{display:flex;align-items:center;gap:12px;width:100%;padding:14px;border:0;border-bottom:1px solid var(--line);background:none;text-align:left;text-decoration:none;color:var(--ink);font-weight:600}
.menu > :last-child{border-bottom:0}
.menu button:hover,.menu a:hover{background:var(--surface-2)}
.menu .s{font-weight:400}
.steps{margin:0 0 12px;padding-left:20px}
.steps li{margin-bottom:8px}
pre.csv{max-height:40vh;overflow:auto;background:var(--surface);border:1px solid var(--line);border-radius:10px;padding:10px;font-size:11.5px;font-family:var(--f-data)}

.toast{position:fixed;left:50%;bottom:calc(92px + env(safe-area-inset-bottom,0px));transform:translateX(-50%) translateY(20px);background:var(--ink);color:var(--bg);padding:10px 16px;border-radius:12px;font-size:14px;font-weight:600;z-index:60;opacity:0;transition:.2s;pointer-events:none;max-width:calc(100% - 32px)}
.toast.show{opacity:1;transform:translateX(-50%)}
.note{font-size:12px;color:var(--muted);margin-top:14px}

/* brand color from Settings, Food Tracker */
@supports (color: color-mix(in srgb, red 50%, white)){
  :root{--accent-soft:color-mix(in srgb,var(--accent) 14%,var(--surface))}
  @media (prefers-color-scheme: dark){:root:not([data-theme="light"]){--accent:color-mix(in srgb,var(--brand,#1F6B57) 55%,white);--accent-soft:color-mix(in srgb,var(--brand,#1F6B57) 30%,var(--surface))}}
  :root[data-theme="dark"]{--accent:color-mix(in srgb,var(--brand,#1F6B57) 55%,white);--accent-soft:color-mix(in srgb,var(--brand,#1F6B57) 30%,var(--surface))}
}
.brand{font-family:var(--f-display);font-weight:700;font-size:20px}

/* sign-up and log-in */
.auth{max-width:420px;margin:0 auto;padding:8vh max(20px,env(safe-area-inset-right,0px)) 40px max(20px,env(safe-area-inset-left,0px));text-align:center}
.auth-icon{border-radius:18px;box-shadow:var(--shadow);object-fit:cover}
.auth h1{font-family:var(--f-display);font-size:30px;margin:16px 0 6px;text-wrap:balance}
.auth h2{font-family:var(--f-display);font-size:20px;margin:0 0 6px}
.auth-lead{color:var(--muted);margin:0 0 22px}
.auth-tabs{display:flex;width:100%}
.auth-tabs button[aria-selected="true"]{background:var(--surface);color:var(--ink);box-shadow:0 1px 2px rgba(0,0,0,.08)}
.auth-form{display:grid;gap:4px;text-align:left;background:var(--surface);border:1px solid var(--line);border-radius:var(--r);padding:18px 16px;margin-bottom:14px}
.auth-form .btn{margin-top:6px}
.linkbtn{border:0;background:none;color:var(--accent);font-weight:600;padding:10px 0 0;justify-self:center}
.auth-msg{margin:6px 0 0;font-size:14px;min-height:1px}
.auth-msg.bad{color:var(--bad)} .auth-msg.ok{color:var(--good)}
.auth .switch{font-weight:500;font-size:14px;margin:6px 0}
.auth-foot{margin-top:18px;line-height:1.7}
.hp{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}

/* amount, units, nutrition facts */
.qtyrow{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.stepq{display:flex;gap:6px}
.stepq button{flex:none;width:44px;border:1px solid var(--line);background:var(--surface-2);border-radius:10px;font-size:20px;font-weight:700}
.stepq .inp{text-align:center}
.ftable-wrap{overflow-x:auto;margin:4px 0 8px}
.ftable{width:100%;border-collapse:collapse;font-size:13.5px}
.ftable th{font-size:11.5px;font-weight:700;color:var(--muted);text-align:right;padding:6px 4px;vertical-align:bottom;line-height:1.25}
.ftable th span{display:block;font-weight:500;font-family:var(--f-data)}
.ftable td{padding:7px 4px;border-top:1px solid var(--line);text-align:right;white-space:nowrap}
.ftable td:first-child{text-align:left;font-weight:600;white-space:normal}
.nrow2{display:grid;grid-template-columns:minmax(0,1.2fr) 1fr 1fr;gap:8px;align-items:center;margin-bottom:8px}
.nrow2 label{font-size:13.5px;font-weight:600}
.nrow2 label span{color:var(--muted);font-weight:500;font-size:12px}
.nrow2 .inp{padding:8px 10px;text-align:right}
.nhead span{font-size:11.5px;font-weight:700;color:var(--muted);text-align:right;line-height:1.25}
.urow{display:grid;grid-template-columns:minmax(0,1fr) auto 80px auto 34px;gap:6px;align-items:center;margin-bottom:8px}
.urow .inp{padding:8px 10px}

/* 1.2.1 */
.btn.small{padding:8px 12px;font-size:13.5px;border-radius:10px}
.sheet.nudge{animation:nudge .3s ease}
@keyframes nudge{30%{transform:translateY(8px)}}
@media (prefers-reduced-motion:reduce){.sheet.nudge{animation:none}}
.star{color:var(--muted)} .star.on{color:#E2A400}
.starbtn{font-size:20px;color:#E2A400}
.account{display:flex;align-items:center;gap:12px;padding:12px 14px}
.avatar{width:44px;height:44px;border-radius:50%;background:var(--accent);color:var(--accent-ink);display:grid;place-items:center;font-weight:700;font-size:18px;flex:none}
.ed-sec{border-top:1px solid var(--line);padding-top:14px;margin-top:6px;margin-bottom:12px}
.ed-h{font-family:var(--f-display);font-weight:700;font-size:16px;margin-bottom:10px}
.ed-h span{color:var(--muted);font-weight:500;font-family:var(--f-body);font-size:14px}
.typeahead{position:relative}
.ta-list{position:absolute;left:0;right:0;top:calc(100% + 4px);z-index:5;background:var(--surface);border:1px solid var(--line);border-radius:12px;box-shadow:var(--shadow);max-height:52vh;overflow-y:auto;padding:0 10px 6px}
.readout{border:1px dashed var(--line);border-radius:10px;padding:10px 12px;font-weight:600;background:var(--surface-2)}
.ingr2{display:flex;align-items:center;gap:8px;background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:6px 6px 6px 8px;margin-bottom:8px}
.ingr-main{flex:1;min-width:0;display:flex;align-items:center;gap:10px;border:0;background:none;text-align:left;padding:2px 0}
.pf-results{margin:10px 0 6px}
.cam{aspect-ratio:3/4;max-height:56vh;width:100%}
.cam .frame{left:7%;right:7%;top:29%;bottom:29%}
.cam .frame i{position:absolute;left:6%;right:6%;top:50%;height:2px;background:rgba(255,80,80,.85);box-shadow:0 0 8px rgba(255,80,80,.8)}
.camtools{position:absolute;top:10px;right:10px;display:flex;gap:8px}
.camb{border:0;border-radius:999px;background:rgba(0,0,0,.55);color:#fff;font-weight:700;min-width:44px;height:44px;padding:0 12px;font-size:15px}
.camb[aria-pressed="true"]{background:#fff;color:#000}
.auth-social{display:grid;gap:8px;justify-items:center;margin-bottom:14px}
.auth-or{display:flex;align-items:center;gap:10px;width:100%;color:var(--muted);font-size:13px}
.auth-or::before,.auth-or::after{content:"";flex:1;height:1px;background:var(--line)}

/* 1.2.2 diary */
.ring{width:124px;height:124px}
.ring .big{font-size:27px}
.ring .left{font-size:12.5px;font-weight:700;margin-top:3px}
.k small{display:block;font-size:10.5px;color:var(--muted);font-family:var(--f-body);text-align:right}
.mchips{display:flex;flex-wrap:wrap;gap:4px 10px;margin-top:3px;font-size:12px;font-weight:600}
.mc{display:inline-flex;align-items:center;gap:5px;color:var(--muted)}
.mc::before{content:"";width:8px;height:8px;border-radius:50%;flex:none}
.mc.p::before{background:var(--protein)} .mc.c::before{background:var(--carbs)} .mc.f::before{background:var(--fat)} .mc.a::before{background:var(--alcohol)}
.bodycard{display:flex;flex-direction:column;align-items:stretch;gap:8px;width:100%;text-align:left;cursor:pointer;padding:12px 14px;color:var(--ink)}
.bodycard .t{display:block}
.bcs{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.bc{display:grid;gap:2px;text-align:center}
.bc b{font-family:var(--f-display);font-size:21px}
.bc span{font-size:11.5px;color:var(--muted)}
.bodycard > .s{text-align:center;color:var(--accent);font-weight:600}
.linktile{text-decoration:none;color:var(--ink);text-align:left;cursor:pointer}
.linktile h3::after{content:" ↗";color:var(--accent)}
.row.three > *{flex:1 1 0;padding-left:8px;padding-right:8px;font-size:14px}

.ai-card{padding:12px 14px;margin-bottom:12px}
.ai-h{font-size:15px;margin-bottom:8px}
.btn.small.wide{width:100%}

/* 1.2.3 swipe to delete */
.meal{position:relative}
.entry{position:relative;z-index:1;background:var(--surface);touch-action:pan-y}
.swipe-bg{position:absolute;left:0;right:0;background:#B9B9B9;display:flex;justify-content:space-between;align-items:center;padding:0 18px;color:#fff;font-weight:700;font-size:14px;transition:background .15s}
.swipe-bg.ready{background:var(--bad)}
.undo{position:fixed;left:50%;bottom:calc(92px + env(safe-area-inset-bottom,0px));transform:translateX(-50%) translateY(20px);opacity:0;pointer-events:none;transition:.2s;background:var(--ink);color:var(--bg);border-radius:12px;padding:8px 8px 8px 16px;display:flex;align-items:center;gap:14px;font-size:14px;font-weight:600;z-index:61;max-width:calc(100% - 32px)}
.undo.show{opacity:1;transform:translateX(-50%);pointer-events:auto}
.undo button{border:0;background:none;color:var(--bg);font-weight:800;text-decoration:underline;padding:6px 8px}
.hint-swipe{font-size:12px;color:var(--muted);text-align:center;margin:6px 0 0}

.ring .water{font-size:11px;font-weight:700;color:var(--water);margin-top:1px}

.ring{width:150px;height:150px}
.ring .big{font-size:25px}
.ring .sm{font-size:9.5px;margin-top:2px}
.ring .left{font-size:11.5px;margin-top:2px}
.ring .water{font-size:10.5px;font-family:var(--f-body)}
.summary{gap:14px;padding:14px}


/* food details */
.detailsbtn{display:flex;align-items:center;justify-content:space-between;width:100%;border:1px solid var(--line);background:var(--surface);border-radius:12px;padding:10px 12px;margin-bottom:12px;font-weight:600;color:var(--accent);text-align:left}
.detailsbtn svg{flex:none}
.ingr-text{font-size:13.5px;line-height:1.55;color:var(--ink);margin:0 0 10px}

/* 1.3.0 · alcohol and supplements */
.drinkcard{margin-top:10px;padding:12px 14px}
.drinkcard .s{font-size:13px;color:var(--muted)}
.supps{padding:6px 14px 4px}
.stime{padding:8px 0;border-bottom:1px solid var(--line)}
.stime:last-of-type{border-bottom:0}
.sth{display:flex;justify-content:space-between;font-size:13px;font-weight:700;color:var(--muted);margin-bottom:4px}
.supp{display:flex;align-items:center;gap:12px;width:100%;padding:8px 0;background:none;border:0;text-align:left;color:var(--ink);font:inherit;cursor:pointer;min-height:44px}
.supp .t{min-width:0;display:flex;flex-direction:column}
.supp .n{font-weight:600}
.supp .s{font-size:12.5px;color:var(--muted)}
.supp .tick{flex:none;width:26px;height:26px;border-radius:50%;border:2px solid var(--line);display:grid;place-items:center;font-weight:800;font-size:14px;color:#fff;transition:background .15s,border-color .15s}
.supp.on .tick{background:var(--supp);border-color:var(--supp)}
.supp.on .n{text-decoration:line-through;text-decoration-color:var(--muted);color:var(--muted)}
.supp:disabled{opacity:.6}
.ringwrap{display:flex;flex-direction:column;align-items:center;gap:6px}
.rlegend{display:flex;flex-direction:column;gap:2px;font-size:11.5px;font-weight:600;color:var(--muted);width:150px}
.rlegend span{display:flex;align-items:center;gap:6px;white-space:nowrap}
.rlegend i{width:8px;height:8px;border-radius:50%;background:var(--c);flex:none}
.rlegend .bad{color:var(--bad)}

/* 1.3.2 · ring that adapts to the screen, with a size setting */
.summary{grid-template-columns:auto minmax(0,1fr);gap:12px}
.summary{--ring:clamp(104px,29vw,136px)}
.summary.ring-s{--ring:clamp(86px,23vw,108px)}
.summary.ring-l{--ring:clamp(124px,37vw,168px)}
.ring{width:var(--ring);height:var(--ring);container-type:size}
.ring svg{width:100%;height:100%;display:block}
.ring .big{font-size:18cqw}
.ring .sm{font-size:6.6cqw;margin-top:1cqw}
.ring .left{font-size:8cqw;margin-top:1.5cqw}
.rlegend{width:var(--ring);font-size:11px}
.summary.ring-s .rlegend{font-size:10.5px}
.mrow .lbl{flex-wrap:wrap;column-gap:6px;row-gap:0}
.mrow .lbl .num{margin-left:auto;white-space:nowrap}
@media (max-width:300px){.summary{grid-template-columns:1fr;justify-items:center}.macros{width:100%}}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}

/* 1.4.0 · themes: accent palettes chosen in Settings (the site color stays the default) */
:root[data-accent="ocean"]{--brand:#1F5F8B}
:root[data-accent="berry"]{--brand:#8E3A6E}
:root[data-accent="sunset"]{--brand:#C2571A}
:root[data-accent="forest"]{--brand:#2F6B2F}
:root[data-accent="slate"]{--brand:#44515C}
.swatches{display:flex;flex-wrap:wrap;gap:10px}
.swatch{width:40px;height:40px;border-radius:50%;border:3px solid var(--surface);box-shadow:0 0 0 1px var(--line);background:var(--sw);display:grid;place-items:center;color:#fff;font-weight:800}
.swatch[aria-pressed="true"]{box-shadow:0 0 0 2px var(--ink)}
.setrow{display:grid;gap:8px;margin-bottom:14px}
.setrow:last-child{margin-bottom:0}
.setrow > b{font-size:14px}
.wlist{display:grid;gap:6px}
.wrow{display:flex;align-items:center;gap:8px;padding:6px 0;border-bottom:1px solid var(--line)}
.wrow:last-child{border-bottom:0}
.wrow label{flex:1;display:flex;align-items:center;gap:10px;font-weight:600;min-height:40px}
.wrow input{width:20px;height:20px;accent-color:var(--accent)}
.wrow .iconbtn{width:36px;height:36px}
.plan{display:flex;align-items:center;gap:12px}
.plan .badge{border-radius:999px;padding:4px 10px;font-size:12px;font-weight:800;background:var(--accent-soft);color:var(--accent)}
.fastcard{margin-top:10px;padding:12px 14px}
.fast-t{display:flex;flex-direction:column;align-items:flex-start;gap:2px;flex:1;min-width:0;padding:0;text-align:left;color:var(--ink)}
.fast-t b{font-size:15px}
.fast-t .s{font-size:13px;color:var(--muted);font-weight:400}
.fastcard.on{border-color:color-mix(in srgb,var(--accent) 45%,var(--line))}
.auth-lang{display:flex;justify-content:center;margin-top:14px}.auth-lang select{width:auto;min-width:160px}
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.exlist{padding:4px 14px}
.exrow{display:flex;align-items:center;gap:12px;padding:8px 0;border-bottom:1px solid var(--line)}
.exrow .t{flex:1;min-width:0;display:flex;flex-direction:column}
.exrow .n{font-weight:600}
.exrow .s{font-size:12.5px;color:var(--muted)}
.exrow .k{color:var(--good);text-align:right}
.burnnote{color:var(--good);font-size:12px}
.mc.zero{color:var(--muted);opacity:.65}.mc.zero::before{background:var(--line)!important}
.section-h{flex-wrap:wrap;row-gap:2px}.section-h h2{white-space:nowrap}
#view > * + .summary{margin-top:10px}

/* 1.5.0 · cycle tracking */
.cyclecard{margin-top:10px;padding:12px 14px}
.cy-fert{color:var(--fert)!important;font-weight:600!important}
.cy-strip{display:grid;grid-template-columns:repeat(14,1fr);gap:3px;margin-top:10px}
.cy-d{display:grid;place-items:center;aspect-ratio:1;border-radius:50%;font-size:11px;color:var(--muted);background:var(--surface-2);font-family:var(--f-data)}
.cy-d.period,.cy-cell.period{background:var(--period);color:#fff}
.cy-d.spot,.cy-cell.spot{box-shadow:inset 0 0 0 2px var(--period)}
.cy-d.pred,.cy-cell.pred{background:color-mix(in srgb,var(--period) 22%,var(--surface));color:var(--ink);border:1px dashed var(--period)}
.cy-d.fert,.cy-cell.fert{background:color-mix(in srgb,var(--fert) 22%,var(--surface));color:var(--ink)}
.cy-d.ov,.cy-cell.ov{background:var(--fert);color:#fff}
.cy-d.today,.cy-cell.today{outline:2px solid var(--ink);outline-offset:1px}
.cy-nav{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}
.cy-nav b{font-size:16px;text-transform:capitalize}
.cy-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:5px}
.cy-wk span{text-align:center;font-size:11px;color:var(--muted);font-weight:700;padding-bottom:2px}
.cy-cell{position:relative;aspect-ratio:1;border:0;border-radius:50%;background:var(--surface-2);color:var(--ink);font-family:var(--f-data);font-size:13px;display:grid;place-items:center;padding:0}
.cy-cell:disabled{opacity:.45}
.cy-cell b{position:absolute;bottom:4px;left:50%;width:4px;height:4px;margin-left:-2px;border-radius:50%;background:currentColor}
.cy-legend{display:flex;flex-wrap:wrap;gap:6px 14px;margin:10px 0 4px;font-size:12px;color:var(--muted)}
.cy-legend span{display:flex;align-items:center;gap:6px}
.cy-legend i{width:12px;height:12px;border-radius:50%;display:inline-block}
.cy-legend i.period{background:var(--period)} .cy-legend i.pred{border:1px dashed var(--period);background:color-mix(in srgb,var(--period) 22%,var(--surface))}
.cy-legend i.fert{background:color-mix(in srgb,var(--fert) 30%,var(--surface))} .cy-legend i.ov{background:var(--fert)}
.chip.cy-flow[aria-pressed="true"]{background:var(--period);border-color:var(--period);color:#fff}
/* 1.6.0 · cycle day log, modes */
.cy-week{display:grid;grid-template-columns:28px repeat(7,1fr) 28px;align-items:center;gap:2px;margin-bottom:12px}
.cy-week .iconbtn{width:28px;height:36px}
.cy-wd{border:0;background:none;display:flex;flex-direction:column;align-items:center;gap:3px;padding:2px 0;color:var(--ink)}
.cy-wd span{font-size:11px;color:var(--muted)}
.cy-wd b{width:34px;height:34px;border-radius:50%;display:grid;place-items:center;font-family:var(--f-data);font-weight:600}
.cy-wd.period b{background:color-mix(in srgb,var(--period) 25%,var(--surface))}
.cy-wd.sel b{background:var(--period);color:#fff}
.cy-wd:disabled{opacity:.4}
.cy-big{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:10px}
.cy-bigbtn{border:1px solid var(--line);background:var(--surface);border-radius:16px;padding:14px 8px;display:flex;flex-direction:column;align-items:center;gap:8px;font-weight:700;color:var(--ink)}
.cy-bigbtn span{width:48px;height:48px;border-radius:50%;background:var(--period);color:#fff;display:grid;place-items:center;font-size:18px}
.cy-bigbtn:disabled{opacity:.45}
.cy-tiles{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.cy-tile{border:1px solid var(--line);background:var(--surface);border-radius:16px;padding:12px 6px;display:flex;flex-direction:column;align-items:center;gap:6px;color:var(--ink);min-height:104px;text-align:center}
.cy-tile .ic{width:44px;height:44px;border-radius:50%;display:grid;place-items:center;font-size:21px}
.cy-tile b{font-size:13px;font-weight:600;line-height:1.2}
.cy-tile small{font-size:11px;color:var(--muted);line-height:1.25;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.cy-tile.has{border-color:color-mix(in srgb,var(--period) 50%,var(--line));background:color-mix(in srgb,var(--period) 6%,var(--surface))}
.cy-cell em{position:absolute;top:2px;right:4px;font-size:8.5px;font-style:normal;color:var(--muted);font-family:var(--f-data)}
.cy-cell.period em,.cy-cell.ov em{color:#fff}
.cy-cell.due{background:var(--water);color:#fff}
.cy-legend i.due{background:var(--water)}
.cy-modes{display:grid;border-radius:20px;overflow:hidden;border:1px solid var(--line)}
.cy-mode{position:relative;border:0;text-align:left;padding:14px 44px 14px 16px;display:flex;flex-direction:column;gap:3px;color:var(--ink);background:linear-gradient(90deg,color-mix(in srgb,var(--mc) 14%,var(--surface)),color-mix(in srgb,var(--mc) 55%,var(--surface)))}
.cy-mode + .cy-mode{border-top:1px solid color-mix(in srgb,var(--ink) 8%,transparent)}
.cy-mode b{font-size:16px}
.cy-mode span{font-size:13px;color:var(--muted)}
.cy-mode i{position:absolute;right:14px;top:50%;transform:translateY(-50%);width:26px;height:26px;border-radius:50%;background:#fff;color:var(--mc);display:grid;place-items:center;font-style:normal;font-weight:800}
.cy-mode.on{background:linear-gradient(90deg,color-mix(in srgb,var(--mc) 30%,var(--surface)),var(--mc))}
.cyclecard .row .btn{white-space:nowrap}
/* 1.6.1 · collapsible diary sections */
.colbtn{flex:none;width:30px;height:30px;border:0;background:none;color:var(--muted);display:grid;place-items:center;border-radius:8px;padding:0;margin-left:-6px}
.colbtn svg{transition:transform .18s ease;transform:rotate(90deg)}
.colbtn[aria-expanded="false"] svg{transform:rotate(0deg)}
.collapsed > .colbody,.collapsed .colbody{display:none!important}
.section-h .colbtn{margin-left:auto;order:9}
.colwrap.collapsed > .section-h{margin-bottom:0}
.meal.collapsed .meal-h{border-bottom:0}
.meal-h .colbtn{margin-right:2px}
@media (prefers-reduced-motion:reduce){.colbtn svg{transition:none}}
.steps{padding-left:20px;margin:6px 0}.steps li{margin-bottom:10px;line-height:1.5}
.mtot{display:inline-flex;gap:8px;margin-left:8px;font-size:12px}
.mtot .mc{color:var(--muted)}
.applock{position:fixed;inset:0;z-index:100;background:var(--bg);display:grid;place-items:center;padding:24px}
.applock .in{width:100%;max-width:320px;text-align:center;display:grid;gap:12px}
.applock .lockic{font-size:46px}
.applock h1{font-family:var(--f-display);margin:0;font-size:24px}
.applock p{margin:0;color:var(--muted)}
