/* Foodi-AI web app styles. Colour has meaning: green = navigation / selection, orange = the one primary action and links,
   nutrients keep fixed colours (energy green, carbs orange, protein blue, fat violet, water blue, steps orange, exercise teal). */
:root {
  --bg: #f3f6f4; --card: #ffffff; --text: #0f1a14; --muted: #56625c; --line: #e2e8e4; --fill: #eef2ef;
  --brand: #0f6b3a; --brand-soft: #e2f1e8; --orange: #f26522; --od: #c9470a; --oi: #c9470a; --orange-soft: #fdeadf;
  --blue: #0a6fb0; --blue-soft: #e0f0fb; --violet: #5b3fc4; --violet-soft: #ebe7fb; --pink: #c0266b; --pink-soft: #fbe4ee; --amber: #a0500a; --amber-soft: #fcefd2;
  --red: #b91c1c; --red-soft: #fde5e5; --teal: #0b7d74; --teal-soft: #d9f2ef; --green-fg: #166534; --green-soft: #dcfce7;
  --g-mid: #16a34a; --a-mid: #d97706; --r-mid: #dc2626; color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0c1710; --card: #15231a; --text: #eef3ee; --muted: #a3b3a8; --line: #27392e; --fill: #1c2d23;
  --brand: #56c98a; --brand-soft: rgba(86,201,138,.16); --orange: #ff8348; --oi: #ff8f5a; --orange-soft: rgba(255,131,72,.16);
  --blue: #5bb8f0; --blue-soft: rgba(91,184,240,.16); --violet: #a995f5; --violet-soft: rgba(169,149,245,.18); --pink: #f27bb0; --pink-soft: rgba(242,123,176,.16);
  --amber: #f2b34c; --amber-soft: rgba(242,179,76,.16); --red: #f58a8a; --red-soft: rgba(245,138,138,.16);
  --teal: #4fd1c5; --teal-soft: rgba(79,209,197,.16); --green-fg: #86efac; --green-soft: rgba(74,222,128,.16);
  --g-mid: #4ade80; --a-mid: #fbbf24; --r-mid: #f87171; color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.4 "Plus Jakarta Sans", -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.ic { fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; display: block; }
.serif { font-family: "Playfair Display", Georgia, serif; font-weight: 700; letter-spacing: .005em; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.sm { font-size: 13px; }
.xs { font-size: 12px; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.eyebrow, .group-label, .card h3 { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.group-label { margin: 10px 2px 0; }
.disclaimer { text-align: center; color: var(--muted); font-size: 12px; margin-top: 8px; }
.form-error { color: var(--red); font-size: 14px; }
.form-error:empty, .form-info:empty { display: none; }
.form-info { color: var(--green-fg); font-size: 14px; text-align: center; }

/* ---- screens ---- */
.screen { display: flex; flex-direction: column; gap: 12px; padding: 8px 16px 24px; max-width: 560px; margin: 0 auto; }
body.has-tabs .screen { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
.screen.center { align-items: center; text-align: center; padding-top: 60px; }
.screen.slide-left { animation: slideLeft .28s ease-out; }
.screen.slide-right { animation: slideRight .28s ease-out; }
@keyframes slideLeft { from { transform: translateX(48px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slideRight { from { transform: translateX(-48px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---- top bar: Home = logo + date + greeting + bell; tabs = serif page title; sub-screens = back + title + help ---- */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; padding: calc(10px + env(safe-area-inset-top)) 12px 6px; background: var(--bg); max-width: 584px; margin: 0 auto; }
.top-title { flex: 1; min-width: 0; }
.top-title h1 { font-size: 21px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-date { font-size: 12px; font-weight: 700; color: var(--muted); }
body[data-view="home"] .top-title h1, body[data-view="tab"] .top-title h1 { font-size: 26px; line-height: 1.15; }
body[data-view="home"] .topbar { padding: calc(16px + env(safe-area-inset-top)) 16px 4px; gap: 12px; }
body[data-view="tab"] .topbar { padding: calc(16px + env(safe-area-inset-top)) 16px 6px; }
.logo-sm { display: none; width: 44px; height: 44px; border-radius: 30%; overflow: hidden; flex: none; background: #fff; border: 1px solid var(--line); }
.logo-sm img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.75) translateY(10%); display: block; }
body[data-view="home"] .logo-sm { display: block; }
.topbar #topDate, .topbar #backBtn, .topbar #rxBtn, .topbar #helpTop, .topbar .lang-toggle { display: none; }
body[data-view="home"] .topbar #topDate { display: block; }
body[data-view="home"] .topbar #rxBtn { display: flex; }
body[data-view="sub"] .topbar #backBtn:not([hidden]), body[data-view="sub"] .topbar #helpTop { display: flex; }
body[data-view="auth"] .topbar { justify-content: flex-end; padding-top: calc(14px + env(safe-area-inset-top)); }
body[data-view="auth"] .topbar .lang-toggle { display: flex; }
body[data-view="auth"] .top-title { display: none; }
.ibtn { width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--text); display: flex; align-items: center; justify-content: center; flex: none; position: relative; padding: 0; }
.ibtn.plain { border: 0; background: none; }
.ibtn[disabled] { opacity: .4; }
.badge { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
:root[data-theme="dark"] .badge { color: #1a0a0a; }
.badge:empty { display: none; }

/* ---- segmented controls (tabs, language, sex) ---- */
.seg, .tabs, .lang-toggle { display: flex; background: var(--fill); border-radius: 14px; padding: 4px; gap: 4px; }
.seg button, .tab, .lang-btn { flex: 1; min-height: 44px; border: 0; background: none; border-radius: 10px; font-size: 14px; font-weight: 700; color: var(--muted); padding: 0 10px; }
.seg button.on, .seg button.active, .tab.active, .lang-btn.active, .choice.sex-choice label:has(input:checked) { background: var(--card); color: var(--brand); box-shadow: 0 1px 3px rgba(15,26,20,.14); }
:root[data-theme="dark"] .seg button.on, :root[data-theme="dark"] .tab.active, :root[data-theme="dark"] .lang-btn.active, :root[data-theme="dark"] .choice.sex-choice label:has(input:checked) { box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.lang-toggle { width: 112px; padding: 3px; border-radius: 12px; gap: 3px; flex: none; }

/* ---- bottom tab bar ---- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: none; justify-content: center; gap: 4px; border-top: 1px solid var(--line); background: var(--card); padding: 8px max(8px, calc((100% - 560px) / 2)) calc(8px + env(safe-area-inset-bottom)); }
body.has-tabs .tabbar { display: flex; }
.tabbar button { flex: 1; min-height: 50px; background: none; border: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 700; color: var(--muted); }
.tabbar button.on { color: var(--brand); }

/* ---- cards, tiles, pills, bars ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 16px; }
.card > :not([hidden]) ~ :not([hidden]) { margin-top: 10px; }
.card h3 { margin-bottom: 0; }
.card h2 { font-family: "Playfair Display", Georgia, serif; font-weight: 700; font-size: 24px; line-height: 1.2; }
.tile { width: 44px; height: 44px; border-radius: 14px; display: flex; align-items: center; justify-content: center; flex: none; }
.tile.sm { width: 36px; height: 36px; border-radius: 11px; }
.t-o { background: var(--orange-soft); color: var(--oi); } .t-g { background: var(--brand-soft); color: var(--brand); }
.t-b { background: var(--blue-soft); color: var(--blue); } .t-v { background: var(--violet-soft); color: var(--violet); }
.t-a { background: var(--amber-soft); color: var(--amber); } .t-t { background: var(--teal-soft); color: var(--teal); }
.t-p { background: var(--pink-soft); color: var(--pink); }
.t-r { background: var(--red-soft); color: var(--red); }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--fill); color: var(--text); white-space: nowrap; }
#verdict, #giCat, #glCat, #bmiCat, #portionConf { text-transform: capitalize; }
.pill.low, .pill.healthy, .pill.nevo { background: var(--green-soft); color: var(--green-fg); }
.pill.med, .pill.medium, .pill.moderate { background: var(--amber-soft); color: var(--amber); }
.pill.high, .pill.caution, .pill.hidden-mark { background: var(--red-soft); color: var(--red); }
.pill.blue, .pill.home { background: var(--blue-soft); color: var(--blue); }
.pill.own { background: var(--orange-soft); color: var(--oi); }
.pill.hidden-mark { text-transform: none; }
.bar { height: 8px; border-radius: 99px; background: var(--fill); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: 99px; transition: width .4s ease; }
.bar i.done { background: var(--g-mid) !important; }
.bar i.over { background: var(--r-mid) !important; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.dot.kcal { background: var(--brand); } .dot.carb, .dot.orange { background: var(--orange); } .dot.prot { background: var(--blue); } .dot.fat { background: var(--violet); }
.dot.green { background: var(--g-mid); } .dot.red { background: var(--r-mid); } .dot.teal { background: var(--teal); }
.dot.dashed { width: 14px; height: 0; border-radius: 0; background: none; border: 0; border-top: 2px dashed var(--teal); vertical-align: middle; }
.macros { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.macros.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.macro { background: var(--fill); border-radius: 14px; padding: 12px 6px; text-align: center; min-width: 0; }
.macro b { display: block; font-size: 19px; line-height: 1.15; overflow-wrap: anywhere; }
.macro b small { font-size: 11px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.macro > span { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.macro em { display: block; margin-top: 3px; font-style: normal; font-size: 11px; font-weight: 700; }
.macro em.ok { color: var(--green-fg); } .macro em.over { color: var(--red); }
.macro .sub { display: block; font-size: 11px; font-weight: 700; margin-top: 2px; }
.sub.good { color: var(--green-fg); } .sub.ok { color: var(--amber); } .sub.bad { color: var(--red); }
.empty-note { text-align: center; color: var(--muted); padding: 36px 12px; }

/* ---- buttons, chips ---- */
.btn { height: 54px; border-radius: 16px; border: 0; background: var(--od); color: #fff; font-size: 17px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 0 18px; text-decoration: none; }
.btn.ghost { background: var(--card); color: var(--text); border: 1px solid var(--line); }
.btn.danger { color: var(--red); }
.btn[disabled] { opacity: .6; }
.btn:active, .chip-btn:active, .action:active { transform: scale(.98); }
.linklike { background: none; border: 0; color: var(--oi); font: inherit; font-weight: 700; padding: 0; min-height: 44px; cursor: pointer; }
.chip-btn { flex: 1; min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-size: 14px; font-weight: 700; color: var(--text); white-space: nowrap; }
.chip-btn.active, .chip-btn.solid { background: var(--brand); border-color: var(--brand); color: var(--card); }
.chip-btn[disabled] { opacity: .5; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-row .chip-btn { flex: 1 1 auto; min-height: 44px; padding: 0 8px; }
.fx > * { margin-top: 0 !important; }
.rowbtn { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border-radius: 20px; text-align: left; font-size: 15px; font-weight: 600; text-decoration: none; color: var(--text); }
.rowbtn .grow b { display: block; font-size: 15px; }
.rowbtn .ic.chev, .li .ic.chev { color: var(--muted); }

/* ---- lists (history, recipes, settings): one card, hairline rows ---- */
.list { list-style: none; margin: 0; padding: 4px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; }
.list > li, .list > .li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); min-height: 56px; }
.list > li:first-child, .list > .li:first-child { border-top: 0; }
.list > li.clickable { cursor: pointer; }
.list > li.day { min-height: 0; padding: 14px 0 6px; border-top: 0; }
.list > li.day + li { border-top: 0; }
.list .main { flex: 1; min-width: 0; }
.list .main b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .meta, .meta { font-size: 12px; color: var(--muted); }
.list .when { font-size: 12px; color: var(--muted); }
.list .del { background: none; border: 0; color: var(--muted); width: 44px; height: 44px; margin-right: -12px; display: flex; align-items: center; justify-content: center; flex: none; }
.list .del.note-btn { margin-right: -14px; }
.list .del.has-note { color: var(--brand); }
.list .note { display: flex; gap: 5px; margin-top: 4px; font-size: 12.5px; font-style: italic; color: var(--muted); }
.list .note .ic { flex: none; margin-top: 2px; }
.list .note span { white-space: pre-wrap; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.list > li.noting { flex-wrap: wrap; }
.list .note-edit { flex: 0 0 100%; cursor: auto; }
.list .note-edit textarea { display: block; }
.list .note-actions { display: flex; gap: 6px; margin-top: 8px; }
.list > li.empty { justify-content: center; color: var(--muted); padding: 30px 0; }
.score { min-width: 40px; height: 32px; padding: 0 8px; border-radius: 10px; justify-content: center; font-weight: 800; font-size: 14px; }

/* ---- fields ---- */
.field { display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); color: var(--muted); }
.field:focus-within, .rf-input:focus, .dlg-field input:focus, .tr-actions input:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
.field input, .field select { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 16px; color: var(--text); outline: none; height: 100%; padding: 0; }
.field input::placeholder { color: var(--muted); }
.field select { font-weight: 600; cursor: pointer; }
.field select option { background: var(--card); color: var(--text); }
.field select:invalid { color: var(--muted); }
.eye { margin-right: -12px; color: var(--muted); }
.eye.on { color: var(--brand); }
.mini { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); min-width: 0; }
.mini:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.mini > span { font-size: 12px; font-weight: 600; color: var(--muted); }
.mini input, .mini select { width: 100%; min-width: 0; border: 0; background: transparent; padding: 0; font-size: 17px; font-weight: 700; color: var(--text); outline: none; height: 28px; }
.mini input::placeholder { color: var(--muted); font-weight: 400; }
.mini select:invalid { color: var(--muted); }
.mini select option { background: var(--card); color: var(--text); font-weight: 400; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

/* ---- sign in / forms ---- */
.screen.auth { padding: 20px 24px 28px; gap: 14px; }
.auth-hero { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 14px; text-align: center; }
.auth-logo { display: block; width: 92px; height: 92px; border-radius: 28%; overflow: hidden; background: #fff; border: 1px solid var(--line); }
.auth-logo img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.75) translateY(10%); display: block; }
.brand { font-family: "Playfair Display", Georgia, serif; font-weight: 700; font-size: 36px; margin-top: 14px; letter-spacing: .01em; }
.brand em { color: var(--oi); font-style: italic; }
.tagline { color: var(--muted); }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-links { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.auth-links .xs { flex: 1; }
.auth-note { text-align: center; color: var(--muted); }
.auth-note b { color: var(--text); word-break: break-all; }
#vCode, #rCode { letter-spacing: 6px; font-weight: 700; }
.auth-switch { display: flex; flex-direction: column; gap: 14px; margin-top: 6px; }
.divider { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-back { text-align: center; }
.role-field { display: flex; flex-direction: column; gap: 8px; }
/* Continue with Google: Google renders the button (an iframe); this only centres it and keeps room while it loads */
.google-row { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.google-btn { display: flex; justify-content: center; min-height: 44px; width: 100%; }
.google-why { text-align: center; }
#gLinkCode, #gdCode, #delCode { letter-spacing: 6px; font-weight: 700; }
.settings .li .li-sub { display: block; font-weight: 500; word-break: break-all; }
.del-code { display: flex; flex-direction: column; gap: 10px; }
#gdStep1 { margin: 14px 0 6px; }

/* radio list with a green check; the sex choice is a segmented control */
.choice { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 2px 16px; }
.choice label { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 8px 0; border-top: 1px solid var(--line); font-weight: 600; cursor: pointer; }
.choice label:first-child { border-top: 0; }
.choice input { appearance: none; -webkit-appearance: none; order: 2; width: 22px; height: 22px; margin: 0; flex: none; background: none center / 22px no-repeat; }
.choice input:checked { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230f6b3a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E"); }
:root[data-theme="dark"] .choice input:checked { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2356c98a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E"); }
.choice:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.choice.sex-choice { flex-direction: row; background: var(--fill); border: 0; border-radius: 14px; padding: 4px; gap: 4px; }
.choice.sex-choice label { flex: 1; justify-content: center; min-height: 44px; padding: 0; border: 0; border-radius: 10px; color: var(--muted); font-size: 14px; font-weight: 700; }
.choice.sex-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-row { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 16px; font-weight: 600; cursor: pointer; }
.switch-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-row:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.switch { width: 50px; height: 30px; border-radius: 99px; background: var(--line); position: relative; flex: none; display: block; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch-row input:checked + .switch, [aria-checked="true"] > .switch { background: var(--brand); }
.switch-row input:checked + .switch::after, [aria-checked="true"] > .switch::after { transform: translateX(20px); }

/* profile */
.prof-head { display: flex; align-items: center; gap: 12px; }
.av { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 22px; background: var(--brand); color: var(--card); flex: none; }
.prof-head b { display: block; font-size: 17px; }
.bmi-card b { display: block; font-family: "Playfair Display", Georgia, serif; font-size: 28px; line-height: 1.1; }
.bmi-label { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.bmi-scale { position: relative; display: flex; gap: 2px; height: 8px; margin-top: 14px; }
.bmi-scale i { border-radius: 99px; }
.bmi-scale i:nth-child(1) { flex: 18; background: var(--blue); } .bmi-scale i:nth-child(2) { flex: 26; background: var(--g-mid); }
.bmi-scale i:nth-child(3) { flex: 20; background: var(--a-mid); } .bmi-scale i:nth-child(4) { flex: 36; background: var(--r-mid); }
.bmi-scale span { position: absolute; top: -4px; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: var(--card); border: 3px solid var(--text); }
.targets-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.targets-head .group-label { margin: 0; }
.targets-note { font-size: 13px; line-height: 1.45; color: var(--muted); }
.targets-note b { color: var(--text); }
.bmr-box { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.bmr-box b { font-size: 22px; }
.bmr-box small { color: var(--muted); font-size: 12px; }
.bmr-box p { margin-top: 4px; font-size: 13px; line-height: 1.45; color: var(--muted); }
.targets-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.target-cell { display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px; cursor: text; min-width: 0; }
.target-cell:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.target-cell.custom { border-color: var(--brand); background: var(--brand-soft); }
.target-cell > span { font-size: 12px; font-weight: 600; color: var(--muted); }
.target-cell > div { display: flex; align-items: baseline; gap: 4px; }
.target-cell input { flex: 1; min-width: 0; width: 100%; border: 0; padding: 0; background: transparent; color: var(--text); font: inherit; font-size: 19px; font-weight: 700; outline: none; -moz-appearance: textfield; }
.target-cell input::-webkit-outer-spin-button, .target-cell input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.target-cell input::placeholder { color: var(--text); opacity: .5; }
.target-cell small { color: var(--muted); font-size: 12px; }
.target-cell em { font-style: normal; font-size: 11px; color: var(--muted); min-height: 14px; }
.care-list { list-style: none; margin: 0; padding: 0; }
.care-list > li { padding: 12px 0; border-top: 1px solid var(--line); }
.care-list > li:first-child { border-top: 0; }
.care-head { display: flex; align-items: flex-start; gap: 12px; }
.care-head .main { flex: 1; min-width: 0; word-break: break-word; }
.care-head .main b { display: block; }
.care-head .chip-btn { flex: none; min-height: 44px; color: var(--red); }
.care-rx { margin: 8px 0 0; padding-left: 18px; font-size: 14px; }
.care-rx li { white-space: pre-wrap; word-break: break-word; margin-bottom: 4px; }
.care-list p.meta { margin: 6px 0 0 48px; }
.settings .li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); min-height: 56px; width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; font-size: 15px; font-weight: 600; }
.settings .li:first-child { border-top: 0; }
.settings { padding: 4px 16px; }
.settings .lang-toggle { margin-left: auto; }

/* ---- home ---- */
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.today-body { display: flex; align-items: center; gap: 16px; margin-top: 12px; }
.today-ring { position: relative; width: 104px; height: 104px; flex: none; }
.today-ring svg { display: block; width: 104px; height: 104px; }
.today-ring .rg-bg, .ring .rg-bg { fill: none; stroke: var(--fill); }
.today-ring .rg-fg { fill: none; stroke: var(--brand); stroke-linecap: round; transition: stroke-dasharray .5s ease; }
.today-ring .rg-fg.over { stroke: var(--r-mid); }
.ring-c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.ring-c b { font-size: 24px; line-height: 1; }
.today-bars { display: flex; flex-direction: column; gap: 10px; }
.mbar .row { justify-content: space-between; gap: 6px; }
.mbar .row span { font-size: 12px; font-weight: 700; }
.mbar .bar { margin-top: 5px; height: 6px; }
.rx-banner { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); text-align: left; font-size: 14px; }
.rx-banner b { display: block; font-size: 14px; }
.rx-banner small { display: block; font-size: 12px; color: var(--muted); }
.actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.action { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; text-align: left; padding: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; }
.action .label { display: block; font-size: 15px; font-weight: 700; }
.action .sub { display: block; font-size: 12px; color: var(--muted); }
.action.wide { grid-column: 1 / -1; flex-direction: row; align-items: center; }
.action.wide > span:nth-child(2) { flex: 1; min-width: 0; }
.action.wide .ic.chev { color: var(--muted); }
.trackers { display: grid; gap: 12px; }
.tr-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tr-title b { font-size: 15px; }
.tr-val { font-size: 13px; color: var(--muted); }
.tracker .bar { margin: 12px 0; }
.tracker.water .bar i { background: var(--blue); } .tracker.steps .bar i { background: var(--orange); }
.tr-actions { display: flex; gap: 8px; align-items: center; }
.tr-actions[hidden], #stepsForm[hidden] { display: none; }
#stepsAuto { flex-wrap: wrap; }
#stepsAuto .small { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); }
#stepsAuto .linkbtn { background: none; border: 0; padding: 8px 4px; font-size: 13px; font-weight: 700; color: var(--brand); }
.cupbtn { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 48px; padding: 0 6px; gap: 0; }
.cupbtn .cup-name { font-size: 12px; font-weight: 600; color: var(--muted); line-height: 1.2; }
.cupbtn .cup-ml { color: var(--blue); line-height: 1.2; }
.tr-actions input { flex: 1.6; min-width: 0; height: 44px; border: 1px solid var(--line); background: transparent; color: var(--text); border-radius: 12px; padding: 0 12px; font-size: 15px; outline: none; }

/* ---- capture screens: camera, barcode, voice ---- */
.camera-box, .scanner { position: relative; background: #16211b; border-radius: 24px; overflow: hidden; aspect-ratio: 3/4; max-height: 62vh; width: 100%; border: 1px solid var(--line); }
.camera-box video, .scanner video { width: 100%; height: 100%; object-fit: cover; }
.cam-guide { position: absolute; inset: 8%; pointer-events: none; }
.cam-guide.label { inset: 18% 8%; }
.cam-guide i { position: absolute; width: 34px; height: 34px; border: 0 solid #ff8348; }
.cam-guide i:nth-child(1) { top: 0; left: 0; border-top-width: 3px; border-left-width: 3px; border-top-left-radius: 10px; }
.cam-guide i:nth-child(2) { top: 0; right: 0; border-top-width: 3px; border-right-width: 3px; border-top-right-radius: 10px; }
.cam-guide i:nth-child(3) { bottom: 0; left: 0; border-bottom-width: 3px; border-left-width: 3px; border-bottom-left-radius: 10px; }
.cam-guide i:nth-child(4) { bottom: 0; right: 0; border-bottom-width: 3px; border-right-width: 3px; border-bottom-right-radius: 10px; }
.reticle { position: absolute; inset: 30% 10%; border: 3px solid #ff8348; border-radius: 12px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }
.status, .lead { text-align: center; color: var(--muted); font-size: 14px; }
.cam-controls { display: flex; align-items: center; justify-content: center; gap: 40px; padding-bottom: 8px; }
.cam-controls .ibtn { width: 52px; height: 52px; border-radius: 50%; }
.shutter { width: 78px; height: 78px; border-radius: 50%; border: 4px solid var(--card); background: var(--orange); box-shadow: 0 0 0 3px var(--orange); }
.shutter:active { transform: scale(.92); }
.capture-row { display: flex; flex-direction: column; gap: 10px; }
.capture-row .field { flex: none; }
.hold { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; margin: 12px auto; width: 156px; height: 156px; border-radius: 50%; border: 0; background: var(--od); color: #fff; font-size: 13px; font-weight: 700; user-select: none; -webkit-user-select: none; touch-action: none; box-shadow: 0 0 0 10px var(--orange-soft); }
.hold.recording { background: var(--red); animation: pulse 1s infinite; }
:root[data-theme="dark"] .hold.recording { color: #1a0a0a; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.transcript { min-height: 48px; text-align: center; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 16px; }
.transcript:empty { display: none; }
.spinner { width: 44px; height: 44px; border: 4px solid var(--line); border-top-color: var(--brand); border-radius: 50%; margin: 0 auto 16px; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.preview { max-width: 60%; border-radius: 18px; margin-top: 16px; }
#loadingText { font-weight: 600; }
.tile.big { width: 72px; height: 72px; border-radius: 22px; margin-bottom: 8px; }

/* ---- result ---- */
.verdict-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.verdict-row .pill { margin-top: 4px; }
.data-sources { font-size: 12px; color: var(--muted); }
.glycemic-note { margin: 8px 0 0; color: var(--muted); }
.product { display: flex; gap: 12px; align-items: center; }
.product > * { margin-top: 0 !important; }
.product-badges { margin-top: 6px; }
.product img { width: 72px; height: 72px; object-fit: contain; border-radius: 14px; background: var(--fill); }
.product .meta { font-size: 13px; }
.nutri { display: inline-block; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 6px; margin-right: 6px; color: #fff; background: #6b7280; text-transform: uppercase; }
.nutri.a { background: #038141; } .nutri.b { background: #5f8d1a; } .nutri.c { background: #fecb02; color: #333; } .nutri.d { background: #c96a00; } .nutri.e { background: #e63e11; }
.score-box { display: flex; align-items: center; gap: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.ring { position: relative; width: 88px; height: 88px; flex: none; }
.ring svg { display: block; width: 88px; height: 88px; }
.ring .rg-fg { fill: none; stroke: var(--g-mid); stroke-linecap: round; }
.ring[data-band="ok"] .rg-fg { stroke: var(--a-mid); } .ring[data-band="bad"] .rg-fg { stroke: var(--r-mid); }
.ring .ring-c b { font-size: 26px; }
.score-text { flex: 1; min-width: 0; }
.score-text b { display: block; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.score-label { font-weight: 800; font-size: 18px; color: var(--green-fg); }
.score-label[data-band="ok"] { color: var(--amber); } .score-label[data-band="bad"] { color: var(--red); }
.score-text .meta { font-size: 13px; }
.portion-head { display: flex; align-items: center; gap: 12px; }
.assumptions { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.assumptions .meta { display: block; font-weight: 600; margin-bottom: 4px; }
.assumptions ul { margin: 0; padding-left: 18px; font-size: 13px; }
.assumptions li { margin: 2px 0; }
.clarify { margin: 8px 0 0; font-size: 13px; font-weight: 600; }
.status-note { font-size: 13px; font-weight: 600; color: var(--a-mid, #b45309); margin: 6px 0 0; }
.curve-note { margin: 8px 0 0; }
.curve-unavailable { margin: 4px 0 0; padding: 12px; border: 1px dashed var(--line); border-radius: 12px; font-size: 14px; color: var(--muted); }
.portion-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.portion-title b { font-size: 17px; }
.portion-adjust .meta { display: block; font-weight: 600; margin-bottom: 6px; }
.factor-row { display: flex; gap: 6px; }
.factor-row .chip-btn { padding: 0; min-height: 44px; }
.ingredients-toggle, .card details summary, .more-btn { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 44px; background: none; border: 0; border-top: 1px solid var(--line); padding: 12px 0 0; font: inherit; font-size: 14px; font-weight: 700; color: var(--brand); cursor: pointer; }
.ingredients-toggle { margin-top: 14px; }
.more-btn { border: 1px solid var(--line); border-radius: 16px; background: var(--card); padding: 0 16px; min-height: 52px; }
.ingredients-toggle .ic, .more-btn .ic, details[open] > summary .ic { transition: transform .2s; }
.ingredients-toggle.open .ic { transform: rotate(180deg); }
details[open] > summary .ic { transform: rotate(90deg); }
.card details summary { list-style: none; margin-top: 12px; }
.card details summary::-webkit-details-marker { display: none; }
#ingredientRows { list-style: none; margin: 6px 0 0; padding: 0; }
#ingredientRows li { display: flex; align-items: center; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ing-main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-wrap: anywhere; }
.ing-main b { font-size: 14px; line-height: 1.3; }
.ing-main .meta { font-weight: 400; margin: 0; }
#ingredientRows .ing-btn { border: 1px solid var(--line); background: transparent; color: var(--text); border-radius: 12px; width: 44px; height: 44px; flex: none; display: flex; align-items: center; justify-content: center; padding: 0; }
#ingredientRows .ing-btn:disabled { opacity: .35; }
#ingredientRows li.removed .ing-main { opacity: .6; }
#ingredientRows li.removed b { text-decoration: line-through; }
#ingredientRows li.removed .link-btn { flex: none; }
.ing-tag { display: inline-block; font-size: 11px; font-weight: 700; line-height: 1; padding: 3px 7px; border-radius: 999px; vertical-align: 1px; white-space: nowrap; }
.ing-tag.edited { background: var(--amber-soft); color: var(--amber); }
.ing-tag.new { background: var(--brand-soft); color: var(--brand); }
.ing-tag.swapped { background: var(--blue-soft); color: var(--blue); }
.ing-add { margin-top: 10px; }
.ing-search { padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--fill); }
.ing-search-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ing-search-head b { font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
.ing-search-head .link-btn { flex: none; }
.ing-hint { margin: 8px 0 0; }
.portion-busy { display: flex; align-items: center; gap: 14px; margin-top: 14px; padding: 14px 0 2px; border-top: 1px solid var(--line); }
.portion-busy .spinner { width: 28px; height: 28px; border-width: 3px; margin: 0; flex: none; }
.portion-busy b { display: block; font-size: 14px; }
.portion-banner { margin: 12px 0 0; padding: 8px 12px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); font-size: 13px; font-weight: 700; }
@media (max-width: 400px) { #ingredientsForm .ing-input input { width: 60px; } #ingredientRows .ing-btn { width: 40px; } }
.ing-input { display: flex; align-items: center; gap: 4px; flex: none; }
.ing-input input { width: 70px; height: 44px; padding: 0 8px; border: 1px solid var(--line); border-radius: 12px; font: inherit; font-size: 16px; text-align: right; background: var(--card); color: var(--text); }
.ing-input input:focus { border-color: var(--brand); outline: none; }
.ing-input span { font-size: 13px; color: var(--muted); }
.ingredients-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.ingredients-actions .meta { flex: 1; font-weight: 700; color: var(--text); }
.ingredients-actions .chip-btn { flex: none; }
.plain { padding-left: 18px; margin: 8px 0 0; font-size: 14px; }
.share-list { display: flex; flex-direction: column; gap: 12px; }
.care-box { padding: 4px 16px; margin-top: 8px; }
.share-bar .row { justify-content: space-between; gap: 8px; }
.share-bar .row span { font-size: 13px; font-weight: 600; }
.share-bar .row span + span { font-weight: 700; }
.share-bar .bar { margin-top: 6px; }
.calshare { display: flex; height: 8px; border-radius: 99px; overflow: hidden; gap: 2px; margin-top: 12px; }
.calshare i { display: block; }
.gauges { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.gauge { display: flex; flex-direction: column; align-items: center; gap: 4px; background: var(--fill); border-radius: 14px; padding: 14px 10px; }
.g-label { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.g-val { font-family: "Playfair Display", Georgia, serif; font-size: 34px; font-weight: 700; line-height: 1.1; }
.legend-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px 16px; font-size: 13px; }
.legend-row > span { position: relative; padding-left: 22px; line-height: 1.4; }
.legend-row .dot { position: absolute; left: 0; top: 0.55em; margin: 0; }
.legend-row .dot.dashed { top: 0.7em; }
@media (min-width: 480px) { .legend-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.exercise .ex-head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; align-items: center; }
.exercise .ex-head > div { min-width: 0; }
.exercise .ex-head b { display: block; font-size: 16px; }
.exercise .ex-badge { grid-column: 2; justify-self: start; margin-top: 4px; }
.exercise .meta { font-size: 13px; }
.ex-badge { background: var(--teal-soft); color: var(--teal); font-weight: 700; font-size: 12px; padding: 4px 10px; border-radius: 999px; }
.rx-card { border-width: 2px; }
.rx-card .rx-head { display: flex; align-items: center; gap: 10px; font-size: 17px; }
.rx-card.ok { border-color: var(--brand); }
.rx-card.ok .rx-head { color: var(--brand); }
.rx-card.warning { border-color: var(--a-mid); background: var(--amber-soft); }
.rx-card.warning .rx-head { color: var(--amber); }
.rx-card.conflict { border-color: var(--r-mid); background: var(--red-soft); }
.rx-card.conflict .rx-head { color: var(--red); }
.rx-conflicts { list-style: none; margin: 10px 0 0; padding: 0; }
.rx-conflicts:empty { display: none; }
.rx-conflicts li { padding-top: 8px; border-top: 1px solid var(--line); margin-top: 8px; font-size: 14px; }
.rx-rule { font-weight: 700; }
.kidney-rows { display: grid; gap: 12px; }
.k-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 14px; }
.k-head b { font-size: 16px; }
.k-row .bar { margin: 5px 0 3px; }
.k-row .bar i.low, .k-row .bar i.info { background: var(--g-mid); } .k-row .bar i.medium { background: var(--a-mid); } .k-row .bar i.high { background: var(--r-mid); }
.k-pct { font-size: 12px; font-weight: 700; }
.k-pct.low, .k-pct.info { color: var(--green-fg); } .k-pct.medium { color: var(--amber); } .k-pct.high { color: var(--red); }
.kidney-flag { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--red-soft); color: var(--red); font-size: 14px; font-weight: 600; }
.kidney-sub { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
#kidneySwaps, .details ul { margin: 0; padding-left: 20px; }
.details h4 { margin-top: 14px; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.details li { margin-bottom: 4px; }
.shop-list { list-style: none; margin: 0; padding: 0; }
.shop-list li { padding: 10px 0; border-top: 1px solid var(--line); }
.shop-list li:first-child { border-top: 0; padding-top: 0; }
.shop-ing { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.shop-ing span, .shop-none { color: var(--muted); font-size: 13px; }
.shop-product { display: flex; align-items: baseline; gap: 8px; font-size: 13px; padding: 2px 0; }
.shop-store { flex: none; width: 86px; font-weight: 700; color: var(--brand); }
.shop-name { flex: 1; min-width: 0; }
.shop-name small { color: var(--muted); }
.shop-price { flex: none; font-weight: 700; }
.today-intake .group-label { margin: 0 0 8px 2px; }
.today-intake .macro b { font-size: 16px; }
.today-intake .macro b small { display: block; margin: 0; }
#tips, ul.warn { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
#tips li, ul.warn li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
#tips li .ic { color: var(--brand); margin-top: 1px; } ul.warn li .ic { color: var(--red); margin-top: 1px; }
ul.warn:empty, #tips:empty { display: none; }
#moreSection { display: flex; flex-direction: column; gap: 12px; }
#calShareNote { margin-top: 6px; }
#todayIntakeNote { margin-top: 8px; }
#savedNote { text-align: center; font-weight: 600; color: var(--green-fg); }
#savedNote:empty { display: none; }
.add-log-row { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }
.add-log-row p { text-align: center; }

/* ---- reports ---- */
.rep-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rep-nav b { flex: 1; text-align: center; font-size: 16px; }
.rep-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rep-stats .stats-caption { grid-column: 1 / -1; margin: 0 0 0 2px; }
.rep-stats .macro { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 6px; }
.rep-stats .macro b { font-size: 20px; }
.insights { list-style: none; margin: 0; padding: 4px 16px; }
.insights li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; min-height: 56px; }
.insights li:first-child { border-top: 0; }
.chart-card .chart-wrap { position: relative; height: 200px; margin-top: 10px; }
.chart-card.tall .chart-wrap { height: 230px; }
.chart-card .legend-note { margin-top: 8px; font-size: 12px; color: var(--muted); }
#repCharts { display: flex; flex-direction: column; gap: 12px; }

/* ---- dialogs ---- */
.install-dialog { width: min(92vw, 380px); border: 1px solid var(--line); border-radius: 24px; padding: 22px; color: var(--text); background: var(--card); box-shadow: 0 16px 48px rgba(0,0,0,.25); }
.install-dialog::backdrop { background: rgba(0,0,0,.5); }
.install-dialog h2 { font-family: "Playfair Display", Georgia, serif; font-size: 22px; margin-bottom: 10px; }
.install-dialog > p { margin-bottom: 18px; }
.doctor-dialog { width: min(92vw, 400px); }
.doctor-dialog .muted { margin-bottom: 14px; font-size: 14px; }
.doctor-dialog .form-error, .doctor-dialog .form-info { text-align: left; margin-bottom: 10px; }
.range-chips { display: flex; gap: 8px; margin-bottom: 12px; }
.date-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.dlg-field { display: block; min-width: 0; margin-bottom: 12px; font-size: 13px; font-weight: 600; color: var(--muted); }
.dlg-field input { display: block; width: 100%; min-width: 0; height: 52px; margin-top: 4px; padding: 0 12px; border: 1px solid var(--line); border-radius: 14px; font: inherit; font-size: 16px; font-weight: 400; color: var(--text); background: var(--bg); outline: none; }
.date-row .dlg-field input { padding: 0 8px; font-size: 15px; }
.dlg-note { margin: -4px 0 12px; font-size: 12px; }
.dlg-actions { display: flex; gap: 10px; margin-top: 6px; }
.dlg-actions .btn { flex: 1; height: 50px; font-size: 16px; }
.consent-dialog { width: min(92vw, 400px); max-height: 90vh; overflow-y: auto; }
.consent-points { margin: 0 0 14px; padding-left: 18px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.consent-points li + li { margin-top: 4px; }
.report-reasons { border: 0; margin: 0 0 8px; padding: 0; min-width: 0; }
.report-reasons legend { font-size: 14px; font-weight: 600; margin-bottom: 4px; padding: 0; }
.report-reasons label { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; font-size: 14px; line-height: 1.4; cursor: pointer; }
.report-reasons input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--brand); }
.report-counter { text-align: right; margin: 2px 0 10px; }
#reportComment { display: block; width: 100%; margin-top: 4px; font-weight: 400; }
.btn.report-btn { width: 100%; margin-top: 10px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.report-done { display: flex; justify-content: center; color: var(--brand); margin-bottom: 8px; }
.consent-policy, .auth-privacy { margin: 0 0 14px; font-size: 13px; }
.auth-privacy { text-align: center; margin: 16px 0 0; }
a.privacy-link { color: var(--brand, inherit); text-decoration: underline; }
.consent-check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.4; cursor: pointer; margin-bottom: 16px; }
.consent-check input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--brand); }
.rx-dialog { width: min(92vw, 440px); max-height: 85vh; }
.rx-list { list-style: none; margin: 0 0 8px; padding: 0; }
.rx-list > li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.rx-list > li:first-child { padding-top: 0; }
.rx-list .empty { color: var(--muted); }
.rx-from b { display: block; }
.rx-text { margin: 8px 0; padding: 10px 12px; border-radius: 12px; background: var(--fill); white-space: pre-wrap; word-break: break-word; }
.rx-list .dlg-actions { margin-top: 10px; }
.rx-dialog .btn.ghost { margin-top: 6px; }
.help-dialog { width: min(92vw, 480px); max-height: 85vh; display: flex; flex-direction: column; }
.help-dialog:not([open]) { display: none; }
.help-body { overflow-y: auto; margin: 0 -4px 14px; padding: 0 4px; }
.help-page { margin: 4px 0 8px; font-size: 17px; color: var(--brand); }
.help-lead { margin-bottom: 12px; font-size: 14px; }
.help-list { margin: 0; padding-left: 20px; }
.help-list li { margin: 0 0 8px; line-height: 1.45; font-size: 15px; }
.help-list .ic { display: inline-block; vertical-align: -5px; color: var(--brand); margin-right: 2px; }
.help-topic { border: 1px solid var(--line); border-radius: 14px; margin: 0 0 8px; padding: 0 12px; }
.help-topic summary { cursor: pointer; font-weight: 600; padding: 12px 0; color: var(--brand); min-height: 44px; }
.help-topic[open] summary { border-bottom: 1px solid var(--line); margin-bottom: 10px; }

/* ---- recipes ---- */
.rec-find { margin: 0; }
.pick-list > li { cursor: pointer; }
.pick-list .store { font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.rec-list .main b { white-space: normal; }
.rec-credit { font-size: 11px; color: var(--muted); text-align: center; line-height: 1.4; }
.rec-origin { font-size: 12px; color: var(--muted); }
.rec-portion { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.rec-portion input { width: 90px; height: 44px; padding: 0 10px; border: 1px solid var(--line); border-radius: 12px; background: transparent; color: var(--text); font: inherit; }
.rec-hidden { color: var(--red); font-weight: 600; }
.rec-totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.rec-totals .rt { background: var(--fill); border-radius: 14px; padding: 10px 6px; text-align: center; min-width: 0; }
.rec-totals .rt b { display: block; font-size: 17px; white-space: nowrap; }
.rec-totals .rt b small { font-size: 11px; font-weight: 600; color: var(--muted); }
.rec-totals .rt span { display: block; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-totals .rt.kidney { box-shadow: inset 0 0 0 1.5px var(--violet); }
.rec-note { font-size: 12px; color: var(--muted); line-height: 1.4; }
.rec-ings { list-style: none; margin: 0; padding: 0; }
.rec-ings li { display: flex; align-items: center; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.rec-ings li:last-child { border-bottom: 0; }
.rec-ings .ing-name { flex: 1; min-width: 0; font-size: 14px; line-height: 1.3; }
.rec-ings input { width: 66px; height: 44px; padding: 0 8px; border: 1px solid var(--line); border-radius: 12px; background: transparent; color: var(--text); font: inherit; text-align: right; }
.rec-ings .ing-unit { font-size: 12px; color: var(--muted); }
.rec-ings .ing-btn { border: 1px solid var(--line); background: transparent; color: var(--text); border-radius: 12px; width: 44px; height: 44px; flex: none; display: flex; align-items: center; justify-content: center; padding: 0; }
.rec-ings .ing-btn:disabled { opacity: .35; }
.rec-actions { display: flex; gap: 8px; margin-top: 10px; }
.rec-actions .chip-btn { flex: none; }
.rec-search { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.rec-search .field { height: 50px; }
.rec-prep { white-space: pre-wrap; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.rv-avg { font-size: 16px; }
.rv-avg .ic, .rv-stars-ro .ic, .stars .ic { display: inline-block; vertical-align: -2px; }
.stars { color: var(--orange); }
.rv-list { padding: 0; border: 0; background: none; }
.rv-list li { align-items: flex-start; }
.rv-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rv-stars-ro { color: var(--oi); margin-left: auto; white-space: nowrap; }
.rv-comment { font-size: 14px; margin: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.rv-title { margin-top: 14px; font-size: 14px; }
.rv-pick { display: flex; align-items: center; gap: 12px; }
.rv-stars { display: flex; gap: 0; }
.rv-stars button { border: 0; background: transparent; color: var(--muted); width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; padding: 0; }
.rv-stars button.on { color: var(--oi); }
.rv-stars button.on .ic { fill: currentColor; }
.rv-val { font-weight: 700; font-size: 14px; color: var(--muted); }
.rf-label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 700; margin-bottom: 10px; flex: 1 1 110px; min-width: 0; }
.rf-row { display: flex; gap: 8px; flex-wrap: wrap; }
.rf-input { width: 100%; padding: 0 14px; height: 56px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); color: var(--text); font: inherit; font-weight: 400; font-size: 16px; }
textarea.rf-input { height: auto; padding: 12px 14px; resize: vertical; }
.rf-error { color: var(--red); font-size: 13px; }
.rf-error:empty { display: none; }
@media (max-width: 360px) { .rec-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (prefers-reduced-motion: reduce) { .screen.slide-left, .screen.slide-right, .spinner, .hold.recording { animation: none; } }

/* ---- challenges (challenges.js) ---- */
.tabbar .tab-ic { position: relative; display: flex; }
.tabbar .tab-ic .badge { top: -6px; right: -10px; }
@media (max-width: 380px) {
  .tabbar { gap: 0; padding-left: 2px; padding-right: 2px; }
  .tabbar button { min-width: 0; font-size: 10.5px; }
  .tabbar .tl { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
.ch-stack, .ch-form { display: flex; flex-direction: column; gap: 12px; }
.ch-sec { display: flex; flex-direction: column; gap: 10px; }
.ch-sec > .group-label { margin: 8px 2px 0; }
.ch-sub { margin: -2px 2px 0; font-size: 14px; font-weight: 600; color: var(--muted); }
.ch-sub:empty, .pills:empty { display: none; }
.ch-hint { font-size: 13px; line-height: 1.45; color: var(--muted); }
.ch-hint:empty { display: none; }
.ch-form .group-label { margin-bottom: -4px; }
.ch-card { display: block; width: 100%; text-align: left; font: inherit; color: inherit; }
button.ch-card > * { display: block; }
button.ch-card > .ch-head, button.ch-card > .ch-dots { display: flex; }
button.ch-card { cursor: pointer; }
button.ch-card:active { transform: scale(.99); }
.ch-head { display: flex; align-items: center; gap: 12px; width: 100%; min-width: 0; }
.ch-head .grow b { display: block; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-head .meta { display: block; font-size: 12.5px; }
button.ch-head { background: none; border: 0; padding: 0; text-align: left; font: inherit; color: inherit; min-height: 44px; }
.ch-card .bar { display: block; }
.ch-prog { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); font-weight: 600; margin-top: 6px; }
.ch-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 32px 20px; }
.ch-empty > * { margin-top: 0 !important; }
.ch-empty p { color: var(--muted); max-width: 320px; }
.ch-row { width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; font: inherit; color: inherit; }
.ch-row .main .meta { display: block; }
.ch-win { font-weight: 700; color: var(--green-fg); }

/* day dots: ok = green check, miss = amber, none = empty outline, future = faint; one group per week so long challenges wrap per week */
.ch-dots { display: flex; flex-wrap: wrap; gap: 6px 10px; }
.ch-wk { display: flex; gap: 3px; }
.cd { width: 14px; height: 14px; border-radius: 50%; flex: none; box-sizing: border-box; display: flex; align-items: center; justify-content: center; }
.cd .ic { stroke-width: 3.2; }
.cd.ok { background: var(--g-mid); color: #fff; }
:root[data-theme="dark"] .cd.ok { color: #0c1710; }
.cd.miss { background: var(--a-mid); }
.cd.none { border: 1.5px solid var(--muted); opacity: .6; }
.cd.partial { border: 2.5px solid var(--violet); }
.cd.unknown { border: 1.5px dashed var(--muted); }
.cd.future { background: var(--fill); }
.ch-dots.compact .cd { width: 11px; height: 11px; }
.ch-dots.compact .cd .ic { display: none; }
.ch-dots.compact .ch-wk { gap: 2px; }
.ch-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); }
.ch-lg { display: inline-flex; align-items: center; gap: 6px; }

/* detail: hero, winner banner, stats */
.ch-hero { display: flex; align-items: center; gap: 14px; }
.ch-hero h2 { font-size: 24px; }
.ch-hero p { margin-top: 2px; }
.ch-hero .tile.big, .ch-banner .tile.big { margin-bottom: 0; }
.ch-rank { width: 60px; height: 60px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 18px; background: var(--brand-soft); color: var(--brand); }
.ch-rank.lead { background: var(--brand); color: var(--card); }
.ch-banner { display: flex; align-items: center; gap: 14px; background: var(--amber-soft); border-color: transparent; }
.ch-banner .tile { background: var(--card); color: var(--amber); }
.ch-banner h2 { font-size: 22px; }
.ch-banner p { margin-top: 2px; color: var(--muted); }
.ch-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ch-stats .macro { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 6px; }
.ch-stats .macro b { font-size: 19px; }

/* leaderboard */
.ch-board { list-style: none; margin: 4px -8px 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.ch-board > li { margin-top: 0 !important; }
.ch-r { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; padding: 8px; border-radius: 14px; min-height: 48px; }
.ch-r.me { background: var(--orange-soft); }
.ch-rk { width: 20px; flex: none; text-align: center; font-weight: 800; font-size: 13px; color: var(--muted); }
.ch-av { width: 32px; height: 32px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; background: var(--fill); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.ch-r.me .ch-av { background: var(--od); color: #fff; }
.ch-av.inv { background: none; border: 1.5px dashed var(--muted); color: var(--muted); }
.ch-consent { margin: 0 0 14px; padding-left: 20px; font-size: 14px; line-height: 1.5; } .ch-consent li { margin-bottom: 6px; }
.ch-start { margin-top: 8px; gap: 10px; } .ch-start span { flex: none; } .ch-start input { flex: 1; min-width: 0; border: 0; background: none; font: inherit; color: inherit; padding: 0; }
.ch-nm { flex: 1; min-width: 0; }
.ch-nm b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-nm .meta { display: block; }
.ch-nm .bar { display: block; height: 6px; margin-top: 5px; }
.ch-nm .bar i { background: var(--muted); opacity: .5; }
.ch-r.me .ch-nm .bar i { background: var(--orange); opacity: 1; }
.ch-val { flex: none; text-align: right; white-space: nowrap; font-weight: 800; font-size: 14px; }
.ch-val small { font-size: 11px; font-weight: 600; color: var(--muted); }
.ch-r .ch-dots { flex: 0 0 100%; padding-left: 40px; }
.ch-r .linklike { flex: none; font-size: 14px; padding: 0 4px; }
.ch-r .linklike[disabled] { color: var(--muted); cursor: default; }
.ch-owner { margin-left: 6px; vertical-align: 1px; padding: 1px 7px; font-size: 10.5px; }

/* new challenge form */
.ch-types { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ch-type { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; min-height: 44px; padding: 14px; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 20px; }
.ch-type b { display: block; font-size: 15px; }
.ch-type small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
.ch-type .ch-check { position: absolute; top: 10px; right: 10px; display: none; color: var(--brand); }
.ch-type[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 1px var(--brand); }
.ch-type[aria-pressed="true"] .ch-check { display: block; }
.ch-emails { display: flex; flex-direction: column; gap: 8px; }
.ch-addrow { display: flex; gap: 8px; }
.ch-addrow .field { flex: 1; min-width: 0; height: 52px; }
.ch-addrow .chip-btn { flex: none; min-width: 76px; min-height: 52px; }
.ch-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ch-chips:empty { display: none; }
.ch-chip { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; height: 36px; padding: 0 4px 0 12px; border-radius: 999px; background: var(--fill); font-size: 13.5px; font-weight: 600; }
.ch-chip span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-chip button { position: relative; flex: none; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.ch-chip button::after { content: ""; position: absolute; inset: -8px; }
.doctor-dialog .ch-emails { margin-bottom: 10px; }

/* global step challenge */
#glBanner:empty { display: none; }
.gl-banner { border: 2px solid var(--brand); }
.gl-banner > .btn { margin-top: 12px; }
button.gl-banner > .gl-stats { display: grid; }
.gl-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.gl-stats .macro { background: var(--fill); border-radius: 14px; padding: 10px 6px; text-align: center; min-width: 0; }
.gl-stats .macro b { font-size: 19px; }
.gl-stats .macro > span { display: block; font-size: 11.5px; }
button.gl-banner > .bar { margin-top: 12px; }
.gl-banner .ch-head .tile { background: var(--brand-soft); color: var(--brand); }
.gl-top { display: flex; align-items: center; gap: 12px; }
.gl-top .ch-sub { flex: 1; min-width: 0; margin: 0 2px; }
.gl-top .ibtn[hidden] { display: none; }
.gl-rank.long { font-size: 14px; }
.gl-rk { width: auto; min-width: 22px; }
.gl-crown { background: var(--amber-soft); color: var(--amber); }
.ch-r.me .gl-crown { background: var(--od); color: #fff; }
.gl-gap { text-align: center; color: var(--muted); letter-spacing: .2em; font-weight: 800; line-height: 1; padding: 2px 0; }
.gl-dialog { max-height: 90vh; overflow-y: auto; }
.gl-dialog .group-label { margin: 4px 2px 8px; }
.gl-dialog .seg { margin-bottom: 10px; }
.gl-dialog .seg button { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; padding: 0 6px; }
.gl-dialog .field { margin-bottom: 10px; height: 52px; }
.gl-dialog .ch-hint { margin-bottom: 10px; }

/* AI-report excerpt field and the report button on the error screen */
#reportExcerptField { display: block; margin-bottom: 12px; }
#reportExcerptField[hidden], #errorReportBtn[hidden] { display: none; }
#reportExcerptField textarea { margin: 6px 0; }
#errorReportBtn { margin-top: 10px; }

/* ---------- Community: rules, reporting, blocking ---------- */
.link-btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 2px; border: 0; background: none; font: inherit; font-weight: 600; color: var(--brand); text-decoration: underline; cursor: pointer; }
.dlg-sub { margin: 12px 0 4px; font-size: 14px; }
a.rules-link { color: var(--brand, inherit); text-decoration: underline; display: inline-flex; align-items: center; min-height: 44px; }
.report-reasons label { min-height: 44px; }
.more-actions { margin-top: 8px; }
.more-actions > summary { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-size: 14px; font-weight: 700; color: var(--text); cursor: pointer; list-style: none; }
.more-actions > summary::-webkit-details-marker { display: none; }
.more-actions[open] > summary { background: var(--fill); }
.more-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.more-btns .chip-btn { flex: 1 1 auto; white-space: normal; }
.rv-more { margin-top: 4px; }
.rv-more > summary { padding: 0 14px; font-size: 18px; line-height: 1; }
.blocked-list { list-style: none; margin: 0 0 8px; padding: 0; }
.blocked-list > li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.blocked-list > li.empty { color: var(--muted); display: block; border-bottom: 0; }
.blocked-list .main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.blocked-list .chip-btn { flex: none; }
#communityRulesDialog .dlg-actions, #communityReportDialog .dlg-actions, #communityBlockDialog .dlg-actions, #blockedDialog .dlg-actions { margin-top: 10px; }
#creportComment { display: block; width: 100%; margin-top: 4px; font-weight: 400; }
#cblockTitle, #crulesTitle, #blockedTitle { overflow-wrap: anywhere; }
#crulesTitle:focus, #blockedTitle:focus, #creportDone h2:focus { outline: none; }
.advice-stale { margin: 0 0 8px; }
.original-advice { margin-top: 8px; }
.original-advice summary { cursor: pointer; font-size: .85rem; color: var(--muted, inherit); }

/* Registration password requirements */
.pw-rules { list-style: none; margin: -4px 0 0; padding: 0 4px; display: grid; gap: 2px; }
.pw-rules li::before { content: "○"; display: inline-block; width: 1.4em; }
.pw-rules li.ok { color: var(--green-fg); }
.pw-rules li.ok::before { content: "✓"; }
.pw-rules[hidden] { display: none; }
.ch-mod { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.ch-modrow { display: flex; align-items: center; gap: 8px; }
.ch-modrow .grow { min-width: 0; overflow-wrap: anywhere; }

/* ---- What can I eat? (numbers grid reuses .macros / .macro; pills reuse .pill) ---- */
.wcie-badges { justify-content: center; }
.wcie-badges button.pill { border: 0; min-height: 32px; cursor: pointer; font-family: inherit; }
.wcie-out { display: flex; flex-direction: column; gap: 12px; }
.wcie-out:empty { display: none; }
.wcie-item .verdict-row b { overflow-wrap: anywhere; }
.wcie-item .macro b { font-size: 17px; }
.wcie-item a { color: var(--oi); font-weight: 600; }
.wcie-allergen { background: var(--fill); }
.wcie-allergen .verdict-row b, .wcie-allergen .meta { color: var(--muted); }
.wcie-warn { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; border-radius: 12px; background: var(--red-soft); color: var(--red); font-size: 13px; font-weight: 600; }
.wcie-warn .ic { margin-top: 1px; }
.wcie-warn.soft { background: var(--amber-soft); color: var(--amber); }
.wcie-reasons { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.wcie-reasons li { position: relative; padding-left: 16px; }
.wcie-reasons li + li { margin-top: 4px; }
.wcie-reasons li::before { content: ""; position: absolute; left: 2px; top: .5em; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.wcie-reasons li.wcie-lvl-good::before { background: var(--g-mid); }
.wcie-reasons li.wcie-lvl-moderate::before { background: var(--a-mid); }
.wcie-reasons li.wcie-lvl-avoid::before { background: var(--r-mid); }
.wcie-tips { font-size: 14px; padding: 8px 10px; border-radius: 12px; background: var(--brand-soft); }
.wcie-tips b { color: var(--brand); }
