:root {
  --bg: #f2f4f3; --card: #fff; --text: #17201d; --muted: #5d6b66; --line: #e3e8e6;
  --brand: #0f766e; --brand-2: #14a08c; --brand-ink: #fff; --brand-soft: #e3f3f0;
  --danger: #b42318; --danger-bg: #fdecea;
  --caution: #a15c07; --caution-bg: #fef4e2;
  --safe: #067647; --safe-bg: #e7f6ee;
  --score-mid: #e0a800;
  --unknown: #475467; --unknown-bg: #eef1f4;
  --bar: rgba(255, 255, 255, 0.88);
  --shadow: 0 1px 2px rgba(16, 24, 20, 0.06), 0 4px 16px rgba(16, 24, 20, 0.06);
  /* --safe-area-inset-* are set by the Android store app (Capacitor); browsers use env(). */
  --top: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
  --bottom: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  --appbar-h: 58px; --tabbar-h: 64px; --oryxun: #d0182c; --am: #6d3bc9;
  --carbs: #f2a90c; --protein: #0e9f8c; --fat: #7c6ce4;
  color-scheme: light;
}
/* Dark palette: used when the phone is in dark mode (unless the user picked Light),
   or when the user picked Dark. The two blocks must stay identical. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --am: #c7a6ff;
    --bg: #0b100e; --card: #161e1b; --text: #e7ecea; --muted: #94a39e; --line: #26302c;
    --brand: #2dd4bf; --brand-2: #14a08c; --brand-ink: #062b27; --brand-soft: #0f2a26;
    --danger: #f97066; --danger-bg: #3a1714;
    --caution: #fdb022; --caution-bg: #33260c;
    --safe: #47cd89; --safe-bg: #0f2b1d;
    --unknown: #b0bac5; --unknown-bg: #222a30;
    --bar: rgba(22, 30, 27, 0.88);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --am: #c7a6ff;
  --bg: #0b100e; --card: #161e1b; --text: #e7ecea; --muted: #94a39e; --line: #26302c;
  --brand: #2dd4bf; --brand-2: #14a08c; --brand-ink: #062b27; --brand-soft: #0f2a26;
  --danger: #f97066; --danger-bg: #3a1714;
  --caution: #fdb022; --caution-bg: #33260c;
  --safe: #47cd89; --safe-bg: #0f2b1d;
  --unknown: #b0bac5; --unknown-bg: #222a30;
  --bar: rgba(22, 30, 27, 0.88);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  overscroll-behavior-y: none; -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
button { font: inherit; color: inherit; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* ---------- app bar ---------- */
.appbar {
  position: fixed; inset: 0 0 auto; z-index: 20;
  height: calc(var(--appbar-h) + var(--top)); padding: var(--top) 12px 0;
  display: flex; align-items: center; gap: 8px;
  background: var(--bar); backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; flex: 1; padding-left: 4px; }
.brand > img { border-radius: 9px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.wordmark { font-size: 21px; font-weight: 700; letter-spacing: -0.5px; }
.wordmark b { color: var(--brand); }
.byline {
  display: flex; align-items: center; gap: 4px; margin-top: 3px;
  font-size: 9.5px; font-weight: 600; letter-spacing: 1.6px; color: var(--muted); text-transform: uppercase;
}
.byline img { margin: 0 1px; }
.byline b { color: var(--oryxun); font-weight: 800; }
.made-by { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 8px 0 4px; }
.made-by span { font-size: 11px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }
/* The ORYXUN wordmark is light-grey outline text drawn for white: always sit it on a white plate. */
.made-by img {
  width: 120px; height: auto; max-width: 72%; background: #fff; border-radius: 10px; padding: 5px 9px;
  box-shadow: var(--shadow);
}
.appbar-title { flex: 1; margin: 0; font-size: 18px; font-weight: 650; }
.icon-btn, .avatar {
  width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent;
  display: grid; place-items: center; cursor: pointer;
}
.icon-btn:active, .avatar:active { background: var(--line); }
.avatar { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.avatar svg { width: 22px; height: 22px; }
.icon-btn.refresh { width: 34px; height: 34px; color: var(--muted); }
.icon-btn.refresh svg { width: 18px; height: 18px; }
.icon-btn.refresh.spin svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- views ---------- */
main {
  padding: calc(var(--appbar-h) + var(--top) + 12px) 16px calc(var(--tabbar-h) + var(--bottom) + 24px);
  max-width: 600px; margin: 0 auto;
}
.view { animation: view-in 0.22s ease-out; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .view { animation: none; } }

.greeting { margin: 4px 0 0; color: var(--muted); }
.headline { margin: 0 0 16px; font-size: 26px; letter-spacing: -0.5px; }
.am { color: var(--am); font-weight: 700; font-style: normal; }
.section-label { margin: 22px 4px 8px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.verify-icon { font-size: 44px; text-align: center; }
#sheet-verify h3, #sheet-verify p { text-align: center; }
.forgot-btn { margin-top: 10px; color: var(--brand); font-size: 14px; }
.admin-settings { margin-bottom: 14px; }
.admin-settings h3 { margin: 0; font-size: 16px; }
.admin-settings .row { padding: 4px 0; }
.admin-settings .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.admin-settings .mail-line { margin: 0; font-size: 14px; }
.fineprint { font-size: 12px; color: var(--muted); text-align: center; margin: 20px 8px; }

.card { background: var(--card); border-radius: 18px; padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.card-head h3 { margin: 0; font-size: 16px; }
.card-head a { font-size: 14px; font-weight: 600; }

.hero {
  display: flex; align-items: center; gap: 14px; padding: 20px; margin-bottom: 12px; border-radius: 20px;
  background: linear-gradient(135deg, var(--brand-2), #0b5e57); color: #fff;
  box-shadow: 0 8px 24px rgba(15, 118, 110, 0.3); transition: transform 0.12s;
}
.hero:active { transform: scale(0.98); }
.hero-icon { width: 52px; height: 52px; border-radius: 16px; background: rgba(255, 255, 255, 0.18); display: grid; place-items: center; }
.hero-icon svg { width: 30px; height: 30px; }
.hero b { display: block; font-size: 18px; }
.hero small { opacity: 0.85; font-size: 14px; }
.hero .chev { margin-left: auto; opacity: 0.8; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
/* Launch screen (installed web app / store apps only: html.with-splash). */
.splash { display: none; }
html.with-splash .splash {
  display: flex; position: fixed; inset: 0; z-index: 100; background: var(--bg);
  flex-direction: column; align-items: center; justify-content: center; transition: opacity 0.35s ease;
}
.splash-mark { position: relative; border-radius: 24px; box-shadow: var(--shadow); animation: sp-pop 0.6s ease-out both; }
/* The stage stays exactly centred, like the shield on the native splash before it. */
.sp-stage { position: relative; width: 300px; height: 300px; display: grid; place-items: center; }
.sp-food { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px;
           display: grid; place-items: center; font-size: 28px; border-radius: 50%; background: var(--card);
           box-shadow: var(--shadow); animation: sp-out 0.85s cubic-bezier(.2, .9, .3, 1.25) var(--d) both; }
.sp-food i { position: absolute; right: -4px; bottom: -4px; width: 22px; height: 22px; border-radius: 50%;
             display: grid; place-items: center; font: 800 13px/1 system-ui, sans-serif; color: #fff;
             border: 2px solid var(--bg); animation: sp-pop 0.4s ease-out calc(var(--d) + 1.1s) both; }
.sp-food i.ok { background: var(--safe); }
.sp-food i.bad { background: var(--danger); }
.sp-wave { position: absolute; left: 50%; top: 50%; width: 100px; height: 100px; margin: -50px 0 0 -50px;
           border-radius: 50%; border: 3px solid var(--brand); opacity: 0; animation: sp-wave 1.4s ease-out 1.3s; }
.sp-wave2 { animation-delay: 1.9s; }
.sp-text { position: absolute; left: 16px; right: 16px; top: calc(50% + 150px); display: flex; flex-direction: column;
           align-items: center; gap: 12px; }
.sp-word { font-size: 30px; animation: sp-fade 0.7s ease-out 0.45s both; }
.sp-pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: 330px; }
.sp-pills span { padding: 5px 11px; border-radius: 99px; background: var(--brand-soft); color: var(--brand);
                 font-size: 13px; font-weight: 700; animation: sp-pop 0.45s ease-out var(--d) both; }
@keyframes sp-pop { from { transform: scale(0.4); opacity: 0; } 70% { transform: scale(1.12); opacity: 1; } }
@keyframes sp-out { from { transform: translate(0, 0) scale(0.2); opacity: 0; }
                    to { transform: translate(var(--x), var(--y)) scale(1); opacity: 1; } }
@keyframes sp-wave { from { transform: scale(1); opacity: 0.7; } to { transform: scale(2.6); opacity: 0; } }
@keyframes sp-fade { from { opacity: 0; transform: translateY(8px); } }
@media (max-height: 760px) { .sp-stage { transform: scale(0.8); } .sp-text { top: calc(50% + 128px); } .splash .splash-by { display: none; } }
@media (prefers-reduced-motion: reduce) { .splash *, .splash *::before { animation: none !important; }
  .sp-food { transform: translate(var(--x), var(--y)); } }
.splash-by { position: absolute; left: 0; right: 0; bottom: calc(var(--bottom) + 2vh); display: flex;
             flex-direction: column; align-items: center; gap: 5px; }
.splash-by span { font-size: 10px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); }
.splash-by img { background: #fff; border-radius: 10px; padding: 5px 10px; box-shadow: var(--shadow); }
.splash .splash-by.tight img { width: 96px; height: auto; padding: 4px 8px; border-radius: 8px; }
.splash.gone { opacity: 0; pointer-events: none; }
.splash .splash-by.no-room { display: none; }
/* What the app checks: a grid on Home, a list on the welcome screen. */
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.feature { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 4px 10px; border: 0;
           border-radius: 14px; background: var(--bg); color: var(--text); font: inherit; font-size: 12px;
           font-weight: 600; line-height: 1.2; text-align: center; cursor: pointer; }
.feature span:first-child { font-size: 24px; line-height: 1.1; }
.feature:active { transform: scale(0.96); }
.intro { position: fixed; inset: 0; z-index: 60; background: var(--bg); overflow-y: auto;
         padding: calc(var(--top) + 24px) 20px calc(var(--bottom) + 24px); animation: intro-in 0.3s ease-out; }
@keyframes intro-in { from { opacity: 0; transform: translateY(12px); } }
@media (prefers-reduced-motion: reduce) { .intro { animation: none; } }
.intro-body { max-width: 480px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; text-align: center; }
.intro-mark { border-radius: 20px; box-shadow: var(--shadow); }
.intro-word { font-size: 34px; margin: 10px 0 2px; }
.intro-tag { color: var(--muted); margin: 0 0 18px; font-size: 16px; }
.intro-list { list-style: none; margin: 0 0 18px; padding: 4px 14px; width: 100%; text-align: left;
              background: var(--card); border-radius: 18px; box-shadow: var(--shadow); }
.intro-list li { display: flex; gap: 14px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.intro-list li:last-child { border-bottom: 0; }
.intro-list .f-emoji { font-size: 26px; width: 34px; text-align: center; flex: none; }
.intro-list b { display: block; font-size: 15px; }
.intro-list small { display: block; color: var(--muted); font-size: 13px; line-height: 1.35; }
.intro .primary-btn { width: 100%; }
.intro-second { margin-top: 10px; width: 100%; color: var(--brand); }
.intro .made-by { margin-top: 22px; }
body.intro-open { overflow: hidden; }
.tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px; border: 0; border-radius: 18px;
  background: var(--card); box-shadow: var(--shadow); font-weight: 600; font-size: 15px; cursor: pointer; text-align: left;
  transition: transform 0.12s;
}
.tile:active { transform: scale(0.97); }
.tile svg { color: var(--brand); background: var(--brand-soft); padding: 8px; width: 40px; height: 40px; border-radius: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border-radius: 999px; padding: 5px 12px; font-size: 14px; background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.chips .empty { color: var(--muted); font-size: 14px; }

/* ---------- lists / rows ---------- */
.list { list-style: none; margin: 0 0 14px; padding: 4px 0; }
.list > li, .row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 16px;
  border: 0; background: none; text-align: left; cursor: pointer; color: var(--text);
}
.list > * + * { border-top: 1px solid var(--line); }
.list > li:active, .row:active { background: var(--bg); }
.row span { flex: 1; min-width: 0; }
.row b { display: block; font-weight: 600; }
.row small { display: block; color: var(--muted); font-size: 13px; }
.row .chev { color: var(--muted); width: 20px; height: 20px; }
.row-icon { color: var(--brand); }
.row.danger, .row.danger .row-icon { color: var(--danger); }
.row-details summary { list-style: none; }
.row-details summary::-webkit-details-marker { display: none; }
.row-details[open] .chev { transform: rotate(90deg); }
.details-body { padding: 0 16px 12px 52px; font-size: 14px; color: var(--muted); }
.details-body p { margin: 0 0 10px; }

.h-main { flex: 1; min-width: 0; }
.h-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-date { font-size: 12px; color: var(--muted); }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.dot.danger { background: var(--danger); } .dot.caution { background: var(--caution); }
.dot.safe { background: var(--safe); } .dot.unknown { background: var(--unknown); }
.list .empty-row { color: var(--muted); font-size: 14px; cursor: default; justify-content: center; }

/* iOS-style switch */
.switch {
  appearance: none; -webkit-appearance: none; flex: none; width: 51px; height: 31px; margin: 0;
  border-radius: 999px; background: var(--line); position: relative; cursor: pointer; transition: background 0.2s;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); transition: transform 0.2s;
}
.switch:checked { background: var(--brand-2); }
.switch:checked::after { transform: translateX(20px); }
.switch-row { cursor: pointer; }

/* ---------- segmented / forms / buttons ---------- */
.segmented { display: flex; background: var(--line); padding: 3px; border-radius: 12px; margin-bottom: 14px; }
.segmented button { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; }
.segmented button[aria-selected="true"], .segmented button[aria-checked="true"] { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }

.form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
input:not([type="checkbox"]), textarea, select {
  width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input:disabled { opacity: 0.7; }
.form-error { margin: 0; color: var(--danger); font-size: 14px; }

.primary-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; border: 0; border-radius: 14px;
  padding: 14px; font-weight: 650; font-size: 16px; background: var(--brand); color: var(--brand-ink); cursor: pointer;
  transition: transform 0.12s, opacity 0.12s;
}
.primary-btn:active { transform: scale(0.98); }
.primary-btn:disabled { opacity: 0.6; }
.danger-btn { background: var(--danger); color: #fff; }
.ghost-btn {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid rgba(255, 255, 255, 0.4); background: rgba(255, 255, 255, 0.12);
  color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 600; cursor: pointer;
}
.text-btn { display: block; margin: 0 auto; border: 0; background: none; font-weight: 600; padding: 10px; cursor: pointer; }
.text-btn.danger { color: var(--danger); }

/* ---------- account ---------- */
.auth-hero { text-align: center; padding: 8px 12px 18px; }
.auth-hero img { border-radius: 16px; box-shadow: var(--shadow); }
.auth-hero h2 { margin: 12px 0 4px; font-size: 22px; }
.auth-hero p { margin: 0; }
.profile { display: flex; align-items: center; gap: 14px; padding: 4px 4px 6px; }
.profile-avatar {
  width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; font-weight: 700;
  background: linear-gradient(135deg, var(--brand-2), #0b5e57); color: #fff;
}
.profile b { font-size: 19px; }
.about { display: flex; align-items: center; gap: 12px; justify-content: center; margin: 26px 0 6px; font-size: 13px; text-align: left; }
.about img { border-radius: 9px; }

/* ---------- scan ---------- */
body.scanning { background: #000; }
body.scanning .appbar { background: rgba(0, 0, 0, 0.55); border-color: transparent; color: #fff; }
.view-scan { position: fixed; inset: 0; background: #000; }
.camera { position: absolute; inset: 0; }
.camera video { width: 100%; height: 100%; object-fit: cover; }
.reticle {
  position: absolute; left: 50%; top: 42%; width: min(78vw, 340px); height: min(46vw, 200px); transform: translate(-50%, -50%);
  border-radius: 20px; border: 3px solid rgba(255, 255, 255, 0.9); box-shadow: 0 0 0 200vmax rgba(0, 0, 0, 0.5);
}
.reticle span { position: absolute; left: 8%; right: 8%; top: 50%; height: 2px; background: #ff4d4d; box-shadow: 0 0 12px #ff4d4d; animation: laser 1.8s ease-in-out infinite; }
@keyframes laser { 0%, 100% { transform: translateY(-60px); } 50% { transform: translateY(60px); } }
.camera-hint { position: absolute; left: 0; right: 0; top: calc(42% + min(23vw, 100px) + 20px); text-align: center; color: #fff; font-weight: 600; text-shadow: 0 1px 4px #000; padding: 0 24px; margin: 0; }
.scan-actions { position: absolute; left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--bottom) + 24px); text-align: center; }
.scan-actions svg { width: 20px; height: 20px; }
.scan-actions #camera-allow { margin: 0 auto 12px; width: auto; padding-left: 28px; padding-right: 28px; }

/* ---------- result ---------- */
/* Result: headline + product, one tile per check, then the reasons. */
.result-hero { border-radius: 22px; padding: 18px 16px 12px; margin-bottom: 12px; }
.result-hero.danger { background: var(--danger-bg); color: var(--danger); }
/* Official recalls: on the result (above the headline) and as alerts on Home. */
/* Health score: green / yellow / red */
.score-card { --sc: var(--unknown); padding: 14px 16px; margin-bottom: 12px; }
.score-card.good { --sc: var(--safe); } .score-card.moderate { --sc: var(--score-mid); } .score-card.high_risk { --sc: var(--danger); }
.score-top { display: flex; align-items: center; gap: 14px; }
.score-ring { flex: none; width: 74px; height: 74px; border-radius: 50%; display: grid; place-content: center; text-align: center;
  background: radial-gradient(closest-side, var(--card) 78%, transparent 80%),
              conic-gradient(var(--sc) calc(var(--p) * 1%), var(--line) 0); }
.score-ring b { font-size: 24px; line-height: 1; color: var(--sc); }
.score-ring small { font-size: 11px; color: var(--muted); }
.score-word { display: block; font-size: 20px; color: var(--sc); }
.score-parts { display: grid; gap: 8px; margin-top: 12px; }
.score-part { display: grid; grid-template-columns: 78px 1fr; align-items: center; column-gap: 8px; font-size: 14px; }
.score-part small { text-align: right; }
.score-bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 3px; }
.score-bar i { display: block; height: 100%; background: var(--sc); border-radius: 3px; }
.score-additives { margin-top: 10px; }
.score-additives summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.score-additives .row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.score-additives .row .dot { flex: none; width: 10px; height: 10px; }
.score-additives .row .badge { flex: none; }
.score-additives small { display: block; color: var(--muted); font-size: 12px; }
.dot.risk-high { background: var(--danger); } .dot.risk-moderate { background: var(--score-mid); } .dot.risk-low { background: var(--safe); }
.badge.risk-high { background: var(--danger-bg); color: var(--danger); }
.badge.risk-moderate { background: var(--caution-bg); color: var(--caution); }
.badge.risk-low { background: var(--safe-bg); color: var(--safe); }
.recall-card { border-radius: 22px; padding: 16px; margin-bottom: 12px; border: 2px solid; }
.recall-card.danger { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.recall-card.caution { background: var(--caution-bg); border-color: var(--caution); color: var(--caution); }
.recall-card.past { background: var(--card); border-color: var(--line); color: var(--muted); }
.recall-head { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.recall-head .v-icon { font-size: 34px; line-height: 1; flex: none; }
.recall-head b { display: block; font-size: 19px; line-height: 1.2; }
.recall-head small { display: block; font-size: 13px; margin-top: 2px; }
.recall-facts { background: var(--card); color: var(--text); border-radius: 14px; padding: 4px 12px; margin: 0; }
.recall-facts div { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.recall-facts div:last-child { border-bottom: 0; }
.recall-facts dt { flex: 0 0 34%; color: var(--muted); }
.recall-facts dd { margin: 0; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.recall-facts dd.strong { font-weight: 650; color: var(--danger); }
.recall-card.caution .recall-facts dd.strong { color: var(--caution); }
.recall-facts details summary { cursor: pointer; color: var(--brand); }
.recall-note { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; font-weight: 600; margin: 12px 2px 0; }
.recall-card .primary-btn { margin-top: 12px; background: var(--danger); }
.recall-card.caution .primary-btn { background: var(--caution); }
.recall-card.past .primary-btn { background: var(--muted); }
.recall-id { display: block; text-align: center; font-size: 12px; margin-top: 6px; opacity: 0.8; }
.recall-alert { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; font: inherit; cursor: pointer;
                background: var(--danger-bg); color: var(--danger); border: 2px solid var(--danger); border-radius: 18px;
                padding: 12px 14px; margin-bottom: 10px; }
.recall-alert .v-icon { font-size: 28px; flex: none; }
.recall-alert b { display: block; }
.recall-alert small { display: block; font-size: 13px; opacity: 0.9; }
.result-hero.caution { background: var(--caution-bg); color: var(--caution); }
.result-hero.safe { background: var(--safe-bg); color: var(--safe); }
.result-hero.unknown { background: var(--unknown-bg); color: var(--unknown); }
.hero-head { display: flex; align-items: center; gap: 14px; padding: 0 4px 14px; }
.hero-head .v-icon { font-size: 40px; line-height: 1; flex: none; }
.hero-head b { display: block; font-size: 22px; line-height: 1.2; }
.hero-head small { display: block; font-size: 14px; margin-top: 2px; }
.hero-product { display: flex; gap: 14px; align-items: center; background: var(--card); color: var(--text);
                border-radius: 16px; padding: 12px; }
.hero-product img { width: 60px; height: 60px; object-fit: contain; border-radius: 12px; background: #fff; flex: none; }
.hero-product .p-name { font-weight: 650; font-size: 17px; line-height: 1.25; }
.hero-product .p-kind { font-size: 13px; font-weight: 650; color: var(--muted); }
.hero-product .p-source { color: var(--muted); font-size: 12px; margin-top: 2px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.check-tile { flex: 1 1 calc(33% - 8px); min-width: 96px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 6px 10px; border: 0;
        border-radius: 16px; font: inherit; cursor: pointer; text-align: center; box-shadow: var(--shadow); }
.check-tile .t-emoji { font-size: 24px; line-height: 1.2; }
.check-tile .t-label { font-size: 12px; font-weight: 600; opacity: 0.85; }
.check-tile .t-under.badge { margin-top: 4px; background: var(--card); font-size: 11px; padding: 2px 8px; }
.check-tile b { font-size: 15px; line-height: 1.2; }
.check-tile.danger { background: var(--danger-bg); color: var(--danger); }
.check-tile.caution { background: var(--caution-bg); color: var(--caution); }
.check-tile.safe { background: var(--safe-bg); color: var(--safe); }
.check-tile.unknown { background: var(--unknown-bg); color: var(--unknown); }
.check-tile.neutral { background: var(--card); color: var(--muted); }
.check-tile:active { transform: scale(0.97); }
.why .g-icon { flex: none; width: 28px; font-size: 22px; text-align: center; }
.why .row.ask { padding-left: 56px; font-size: 14px; color: var(--muted); flex-wrap: wrap; gap: 8px; }
.why .row.flash { animation: flash 1.2s ease-out; }
.why .why-action { display: block; width: 100%; padding: 0 16px 12px 56px; text-align: left; }
@keyframes flash { from { background: var(--brand-soft); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .why .row.flash { animation: none; } }
.chip.fast { background: var(--safe-bg); color: var(--safe); }
.switch-row small { display: block; font-size: 13px; color: var(--muted); }
.detected .row { cursor: default; min-height: 48px; }
.detected .row:active { background: none; }
.badge, .row .badge { flex: none; font-size: 12px; font-weight: 650; padding: 3px 10px; border-radius: 999px; }
.badge.contains { background: var(--danger-bg); color: var(--danger); }
.badge.may_contain { background: var(--caution-bg); color: var(--caution); }
.badge.none { background: var(--unknown-bg); color: var(--muted); font-weight: 500; }
.badge.safe { background: var(--safe-bg); color: var(--safe); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.caution { background: var(--caution-bg); color: var(--caution); }
.badge.unknown, .badge.neutral { background: var(--unknown-bg); color: var(--muted); }
.ask-btns { display: flex; gap: 8px; }
.pill { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 999px;
        padding: 6px 16px; font: inherit; font-weight: 600; cursor: pointer; }
.pill.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.yours { display: inline-block; margin-left: 6px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; padding: 2px 6px; border-radius: 6px; background: var(--danger); color: #fff; vertical-align: 2px; }
.ingredients summary { cursor: pointer; font-weight: 600; }
.ingredients p { color: var(--muted); font-size: 14px; margin: 10px 0 0; }
.ad { border: 1px dashed var(--line); box-shadow: none; text-align: center; font-size: 13px; color: var(--muted); }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; inset: auto 0 0; z-index: 20; display: flex; justify-content: space-around; align-items: flex-end;
  height: calc(var(--tabbar-h) + var(--bottom)); padding: 0 6px var(--bottom);
  background: var(--bar); backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px);
  border-top: 1px solid var(--line); user-select: none; -webkit-user-select: none;
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 8px;
  font-size: 11px; font-weight: 600; color: var(--muted);
}
.tabbar a[aria-current="page"] { color: var(--brand); }
.tabbar a:active svg { transform: scale(0.9); }
.tab-scan span {
  width: 58px; height: 58px; margin-top: -26px; margin-bottom: 1px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-2), #0b5e57); color: #fff;
  box-shadow: 0 6px 18px rgba(15, 118, 110, 0.45), 0 0 0 5px var(--bg); transition: transform 0.12s;
}
.tab-scan:active span { transform: scale(0.94); }
.tab-scan span svg { width: 28px; height: 28px; }
body.scanning .tabbar { background: rgba(0, 0, 0, 0.6); border-color: transparent; }
body.scanning .tab-scan span { box-shadow: 0 0 0 5px rgba(0, 0, 0, 0.6); }

/* ---------- sheets / overlays ---------- */
.sheet {
  border: 0; padding: 0; margin: auto 0 0; width: 100%; max-width: 100%; max-height: 90vh;
  background: var(--card); color: var(--text); border-radius: 22px 22px 0 0;
}
@media (min-width: 640px) { .sheet { margin: auto; max-width: 480px; border-radius: 22px; } }
.sheet[open] { animation: sheet-up 0.25s cubic-bezier(0.2, 0.9, 0.3, 1); }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
.sheet::backdrop { background: rgba(0, 0, 0, 0.4); }
.sheet-body { display: flex; flex-direction: column; gap: 12px; padding: 10px 20px calc(20px + var(--bottom)); }
.sheet-body h3 { margin: 4px 0 0; font-size: 19px; }
.sheet-body p { margin: 0; font-size: 14px; }
.sheet-x { position: absolute; top: 8px; right: 8px; z-index: 1; }
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 6px; }

.loading {
  position: fixed; inset: 0; z-index: 50; display: grid; place-content: center; justify-items: center; gap: 8px;
  background: rgba(0, 0, 0, 0.35); color: #fff; font-weight: 600;
}
.loading p { margin: 0; }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, 0.35); border-top-color: #fff; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--bottom) + 16px); z-index: 60; transform: translateX(-50%);
  max-width: calc(100% - 32px); background: #17201d; color: #fff; padding: 12px 18px; border-radius: 14px; font-size: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.toast.error { background: var(--danger); }

/* ---------- gates: welcome / paywall ---------- */
body.gated main { padding-bottom: calc(var(--bottom) + 24px); }
.view-gate .auth-hero { padding-top: 16px; }
.view-gate .auth-hero img { border-radius: 20px; }
.trial-pill {
  display: inline-block; margin: 12px 0 0; padding: 6px 14px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand); font-weight: 650; font-size: 14px;
}
.hint { margin: -4px 0 0; font-size: 13px; color: var(--muted); }
.small { font-size: 13px; }
.paywall-card { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 22px 18px; }
.paywall-card p { margin: 0; }
.paywall-icon { width: 40px; height: 40px; color: var(--caution); }
.paywall-card #paywall-info { font-size: 17px; font-weight: 600; }

/* ---------- iPhone install guide ---------- */
.ios-guide-head { display: flex; align-items: center; gap: 14px; }
.ios-guide-head img { flex: none; border-radius: 13px; box-shadow: var(--shadow); }
.ios-guide-head h3 { margin: 0 0 2px; }
.ios-steps { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ios-steps li { display: flex; align-items: flex-start; gap: 12px; padding: 12px; border-radius: 14px; background: var(--bg); font-size: 16px; line-height: 1.5; }
.ios-steps small { display: block; margin-top: 2px; font-size: 13px; color: var(--muted); }
.step-n { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font-weight: 700; font-size: 15px; }
.ios-icon { display: inline-grid; place-items: center; width: 28px; height: 28px; margin: 0 2px; border-radius: 8px; background: var(--card); color: #0a84ff; vertical-align: middle; box-shadow: 0 0 0 1px var(--line); }
.ios-icon svg { width: 18px; height: 18px; }
.ios-arrow { display: grid; place-items: center; color: var(--brand); animation: ios-bounce 1.1s ease-in-out infinite; }
.ios-arrow svg { width: 34px; height: 34px; stroke-width: 2.6; }
@keyframes ios-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .ios-arrow { animation: none; } }

/* ---------- nutrition ---------- */
.nutrition { display: flex; flex-direction: column; gap: 18px; padding: 16px; }
.nut-per { margin-bottom: 0; }
.nut-energy-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.nut-energy-top b { font-size: 30px; line-height: 1; }
.nut-energy-top b small { font-size: 15px; font-weight: 600; color: var(--muted); }
.nut-pct { font-size: 14px; font-weight: 650; color: var(--brand); }
.meter { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 99px; background: var(--brand); }
.nut-split-label { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.split-bar { display: flex; gap: 2px; height: 12px; border-radius: 99px; overflow: hidden; }
.split-bar span { display: block; min-width: 0; }
.split-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 13px; font-weight: 600; }
.split-legend span { display: inline-flex; align-items: center; gap: 6px; }
.split-legend i { width: 10px; height: 10px; border-radius: 3px; }
.seg-carbs { background: var(--carbs); } .seg-protein { background: var(--protein); } .seg-fat { background: var(--fat); }
.nut-row { display: grid; grid-template-columns: 1fr auto 52px; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 15px; }
.nut-row.nut-head { border-top: 0; padding-top: 0; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.nut-name { font-weight: 600; }
.nut-row.sub .nut-name { padding-left: 14px; font-weight: 500; color: var(--muted); }
.nut-val, .nut-dv { text-align: right; font-variant-numeric: tabular-nums; }
.nut-dv { font-weight: 650; }
.nut-row.high .nut-dv { color: var(--danger); }
.nut-row.good .nut-dv { color: var(--safe); }
.nut-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.nut-tags > span { display: flex; flex-direction: column; padding: 8px 12px; border-radius: 12px; background: var(--unknown-bg); }
.nut-tags small { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; opacity: 0.85; }
.nut-tags b { font-size: 14px; }
.nutriscore b { font-size: 20px; line-height: 1.1; }
.nut-tags .ns-a { background: #038141; color: #fff; } .nut-tags .ns-b { background: #85bb2f; color: #fff; }
.nut-tags .ns-c { background: #fecb02; color: #3d2f00; } .nut-tags .ns-d { background: #ee8100; color: #fff; }
.nut-tags .ns-e { background: #e63e11; color: #fff; }
.nova-1, .nova-2 { color: var(--safe); } .nova-3 { color: var(--caution); } .nova-4 { color: var(--danger); }
.nut-note { margin: 0; font-size: 12px; color: var(--muted); }

/* ---------- install card (Home) ---------- */
.install-card { display: flex; align-items: center; gap: 12px; padding: 12px 8px 12px 14px; }
.install-card img { flex: none; border-radius: 11px; }
.install-text { flex: 1; min-width: 0; }
.install-text b { display: block; font-size: 15px; }
.install-text small { display: block; font-size: 13px; color: var(--muted); }
.primary-btn.small { flex: none; width: auto; margin: 0; padding: 8px 16px; min-height: 0; font-size: 14px; }
.install-close { flex: none; width: 32px; height: 32px; padding: 6px; border: 0; background: none; color: var(--muted); }
.install-close svg { width: 20px; height: 20px; }

/* ---------- subscription ---------- */
.banner {
  display: block; margin-bottom: 14px; padding: 12px 16px; border-radius: 14px;
  background: var(--caution-bg); color: var(--caution); font-weight: 600; font-size: 14px;
}
.sub-card p { margin: 6px 0 0; }
.pay-box:empty, .promo-box:empty { display: none; }
.promo-box { margin-top: 6px; text-align: center; }
.promo-form { display: flex; gap: 8px; margin-top: 6px; }
.promo-form input { flex: 1; min-width: 0; text-transform: uppercase; }
.promo-form .secondary-btn { width: auto; padding: 0 16px; }
#promo-field input { text-transform: uppercase; }
.promo-admin { display: grid; gap: 8px; }
.promo-row { display: flex; align-items: center; gap: 6px; padding: 8px 0; border-top: 1px solid var(--line); }
.promo-row > div { flex: 1; min-width: 0; }
.promo-row b { display: block; font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: 0.5px; }
.promo-row small { display: block; overflow-wrap: anywhere; }
.promo-row.off b { color: var(--muted); text-decoration: line-through; }
.promo-new { display: grid; gap: 8px; }
.pay-box { display: flex; flex-direction: column; align-items: stretch; gap: 6px; width: 100%; margin-top: 10px; }
.pay-box small { color: var(--muted); font-size: 12px; text-align: center; }
.admin-settings h4 { margin: 8px 0 0; font-size: 14px; }
.admin-settings .mail-line { overflow-wrap: anywhere; }
.admin-settings .field { margin-top: 10px; }
.sub-line { font-size: 17px; font-weight: 650; }
.sub-pill, .pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.4px;
}
.pill-active { background: var(--safe-bg); color: var(--safe); }
.pill-trial { background: var(--brand-soft); color: var(--brand); }
.pill-expired { background: var(--danger-bg); color: var(--danger); }
.pill-disabled { background: var(--unknown-bg); color: var(--muted); }
.pill-admin { background: #ede9fe; color: #6d28d9; }

/* ---------- admin ---------- */
.admin-entry { display: flex; align-items: center; gap: 12px; color: var(--text); }
.admin-entry > svg:first-child { color: #6d28d9; background: #ede9fe; padding: 8px; width: 40px; height: 40px; border-radius: 12px; }
.admin-entry span { flex: 1; }
.admin-entry b { display: block; }
.admin-entry small { color: var(--muted); font-size: 13px; }
.admin-entry .chev { color: var(--muted); width: 20px; height: 20px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.stat { background: var(--card); border-radius: 14px; padding: 10px 6px; text-align: center; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 22px; }
.stat span { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.search { display: flex; align-items: center; gap: 8px; background: var(--card); border-radius: 14px; padding: 0 12px; margin-bottom: 12px; box-shadow: var(--shadow); }
.search svg { color: var(--muted); width: 20px; height: 20px; }
.search input { border: 0; background: transparent; padding: 12px 0; box-shadow: none !important; }
.small-seg button { font-size: 13px; padding: 7px 4px; }
.u-main { flex: 1; min-width: 0; }
.u-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.u-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.au-head { display: flex; align-items: center; gap: 12px; }
.au-head .profile-avatar { width: 48px; height: 48px; font-size: 20px; flex: none; }
.au-head b { display: block; font-size: 17px; }
.au-status { background: var(--bg); border-radius: 14px; padding: 12px 14px; }
.au-status p { margin: 4px 0 0; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.secondary-btn {
  border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 14px;
  padding: 12px; font-weight: 600; cursor: pointer;
}
.secondary-btn:active { background: var(--bg); }
.ocr-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; }
.ocr-btn svg { width: 22px; height: 22px; color: var(--brand); flex: none; }
.ocr-btn[disabled] { opacity: 0.7; }
.ocr-or { display: block; text-align: center; margin: 2px 0 -4px; }
.sheet-note { margin: -4px 0 0; }
.secondary-btn.danger { color: var(--danger); }
.big-btn { padding: 16px; font-size: 17px; }
.au-devices { font-size: 13px; color: var(--muted); }
.au-devices div { padding: 2px 0; }
.temp-pw {
  font: 700 24px/1.2 ui-monospace, "SF Mono", Consolas, monospace; letter-spacing: 1px; text-align: center;
  background: var(--brand-soft); color: var(--brand); border-radius: 14px; padding: 14px; user-select: all;
}
.sheet .field textarea { min-height: 70px; }
.sheet-body h3.section-label { margin: 10px 0 0; font-size: 13px; }
.stats.single { grid-template-columns: 1fr; }
.guest-hide { display: none !important; }
.no-data { display: grid; gap: 6px; text-align: center; }
.no-data button { margin-top: 6px; }
a.row { color: inherit; }
.share-label { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; color: var(--muted); }
.share-label input { flex: none; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--brand); }
.label-review { display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); }
.label-review img { width: 100%; max-height: 480px; object-fit: contain; border-radius: 10px; background: var(--bg); }
.label-btns { display: flex; align-items: center; gap: 12px; }
.metrics { display: grid; gap: 8px; }
.metrics h3, .metrics h4 { margin: 0; }
.metrics h4 { margin-top: 12px; }
.metric-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.metric-tile { display: grid; padding: 10px 12px; border-radius: 12px; background: var(--bg); min-width: 0; }
.metric-tile b { font-size: 24px; line-height: 1.2; }
.metric-tile span { font-size: 14px; }
.metric-tile small { font-size: 12px; min-height: 15px; }
.metric-chart { display: flex; align-items: flex-end; gap: 2px; height: 120px; border-bottom: 1px solid var(--line); }
.metric-col { flex: 1; min-width: 0; height: 100%; display: flex; align-items: flex-end; padding: 0; border: 0; background: none; cursor: pointer; }
.metric-col i { display: block; width: 100%; min-height: 2px; max-width: 16px; margin: 0 auto; border-radius: 4px 4px 0 0; background: var(--brand-2); }
.metric-col:hover i, .metric-col:focus-visible i { background: var(--brand); }
.metric-readout { display: block; min-height: 18px; }
.metric-share { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; font-size: 14px; }
.metric-track { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--bg); overflow: hidden; }
.metric-track i { display: block; height: 100%; border-radius: 3px; background: var(--brand-2); }
.metric-track .s-safe, .metric-track .s-good { background: var(--safe); }
.metric-track .s-caution, .metric-track .s-moderate { background: var(--score-mid); }
.metric-track .s-danger, .metric-track .s-high_risk { background: var(--danger); }
.metric-track .s-unknown { background: var(--muted); }
.metric-list { margin-top: 12px; }
.metric-list summary { font-weight: 700; cursor: pointer; }
.metric-name { display: block; overflow-wrap: anywhere; }
.made-by span { font-size: 10px; }
.dish-tile { grid-column: 1 / -1; }
.dish-card { display: grid; gap: 6px; margin-top: 12px; }
.dish-kcal { font-size: 28px; font-weight: 800; }
.dish-warn { margin: 8px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--caution-bg); color: var(--caution); font-size: 14px; }
.feature span .am { font-size: inherit; line-height: inherit; }
