/* Metyup Website Demo — Cal AI-style black & white theme.
   DEMO: static site, no backend. All data lives in localStorage. */

:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-alt: #f4f4f2;
  --text: #0a0a0a;
  --dim: #8a8a85;
  --border: #ececea;
  --accent: #0a0a0a;
  --accent-soft: #f0f0ee;
  --ink: #0a0a0a;
  --on-ink: #ffffff;
  --radius: 16px;
  --macro-p: #4f8ef7;
  --macro-c: #f5a524;
  --macro-f: #f45d5d;
  --demo: #b45309;
  --demo-bg: #fef3c7;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --surface: #121212;
  --surface-alt: #1f1f1f;
  --text: #f5f5f3;
  --dim: #9c9c97;
  --border: #262626;
  --accent: #f5f5f3;
  --accent-soft: #1f1f1f;
  --ink: #f5f5f3;
  --on-ink: #000000;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Nunito", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; position: relative; background: var(--bg); }

/* ---------- screens ---------- */
.screen { display: none; min-height: 100vh; padding-bottom: 96px; }
.screen.active { display: block; }
.screen.no-nav { padding-bottom: 24px; }
.pad { padding: 16px 20px; }

/* ---------- demo chip ---------- */
.demo-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--demo-bg); color: var(--demo);
  font-size: 12px; font-weight: 800; letter-spacing: .4px;
  padding: 6px 12px; border-radius: 999px; text-transform: uppercase;
}
.demo-note {
  background: var(--demo-bg); color: var(--demo);
  border-radius: 12px; padding: 10px 14px; font-size: 13px; font-weight: 600;
  margin: 12px 0;
}

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 48px 28px 32px; text-align: center; }
.login-logo { width: 210px; max-width: 70%; margin: 18px 0 8px; }
:root[data-theme="dark"] .login-logo { filter: invert(1); }
.login-title { font-size: 26px; font-weight: 900; margin: 10px 0 26px; line-height: 1.25; }
.login-btns { width: 100%; display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  border: none; border-radius: 14px; padding: 15px 18px;
  font-size: 16px; font-weight: 800; cursor: pointer; width: 100%;
  font-family: inherit;
}
.btn-black { background: var(--ink); color: var(--on-ink); }
.btn-outline { background: var(--surface); color: var(--text); border: 1.5px solid var(--border); }
.btn-ghost { background: transparent; color: var(--dim); font-weight: 700; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.g-logo {
  width: 20px; height: 20px; border-radius: 50%; flex: none;
  background: conic-gradient(from 0deg, #4285f4, #ea4335, #fbbc05, #34a853, #4285f4);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 900; font-size: 13px;
}
.login-foot { margin-top: auto; padding-top: 24px; font-size: 12px; color: var(--dim); }

/* ---------- sheets (bottom) ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40;
  display: none; align-items: flex-end; justify-content: center;
}
.sheet-backdrop.open { display: flex; }
.sheet {
  background: var(--surface); color: var(--text);
  width: 100%; max-width: 480px; border-radius: 24px 24px 0 0;
  padding: 12px 22px 28px; max-height: 88vh; overflow-y: auto;
}
.sheet-handle { width: 44px; height: 5px; border-radius: 999px; background: var(--border); margin: 4px auto 14px; }
.sheet h3 { margin: 4px 0 4px; font-size: 20px; font-weight: 900; }
.sheet p.sub { color: var(--dim); font-size: 14px; margin: 0 0 16px; }

/* ---------- forms ---------- */
.field { margin-bottom: 14px; text-align: left; }
.field label { display: block; font-size: 13px; font-weight: 800; color: var(--dim); margin-bottom: 6px; }
.field input, .field select {
  width: 100%; padding: 13px 14px; border-radius: 12px;
  border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 15px; font-family: inherit;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--ink); }
.pass-wrap { position: relative; }
.pass-wrap button {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--dim); font-weight: 800; font-size: 13px; cursor: pointer;
}
.tabs { display: flex; background: var(--surface-alt); border-radius: 12px; padding: 4px; margin-bottom: 18px; }
.tabs button {
  flex: 1; border: none; background: none; padding: 10px; border-radius: 9px;
  font-weight: 800; font-size: 14px; color: var(--dim); cursor: pointer; font-family: inherit;
}
.tabs button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.form-err { color: #dc2626; font-size: 13px; font-weight: 700; margin: 8px 0 0; min-height: 18px; }

/* ---------- header ---------- */
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px 6px; position: sticky; top: 0; z-index: 10;
  background: var(--bg);
}
.app-header img.wordmark { height: 26px; }
:root[data-theme="dark"] .app-header img.wordmark { filter: invert(1); }
.streak-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--surface-alt); border-radius: 999px; padding: 7px 13px;
  font-weight: 900; font-size: 14px;
}
.credit-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--surface-alt); border-radius: 999px; padding: 7px 13px;
  font-weight: 900; font-size: 14px; cursor: pointer; border: none; font-family: inherit; color: var(--text);
}
.header-right { display: flex; gap: 8px; align-items: center; }

/* ---------- week strip ---------- */
.week-strip { display: flex; gap: 6px; padding: 10px 20px 4px; }
.week-day {
  flex: 1; border: none; background: none; cursor: pointer; font-family: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 0; border-radius: 12px; color: var(--dim);
}
.week-day .dow { font-size: 11px; font-weight: 800; text-transform: uppercase; }
.week-day .dnum { font-size: 15px; font-weight: 900; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.week-day.sel .dnum { background: var(--ink); color: var(--on-ink); }
.week-day.today .dnum { border: 2px solid var(--ink); }
.week-day .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--ink); }

/* ---------- calorie card ---------- */
.cal-card {
  margin: 12px 20px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 20px; display: flex; align-items: center; gap: 18px;
}
.ring-wrap { position: relative; width: 118px; height: 118px; flex: none; }
.ring-wrap svg { transform: rotate(-90deg); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-center .big { font-size: 24px; font-weight: 900; }
.ring-center .small { font-size: 11px; color: var(--dim); font-weight: 700; }
.cal-meta .lbl { font-size: 13px; color: var(--dim); font-weight: 700; }
.cal-meta .val { font-size: 15px; font-weight: 800; margin-top: 2px; }

/* ---------- macro cards ---------- */
.macro-row { display: flex; gap: 10px; padding: 2px 20px 8px; }
.macro-card {
  flex: 1; background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 12px 10px; text-align: center;
}
.macro-card .mring { width: 52px; height: 52px; margin: 0 auto 6px; position: relative; }
.macro-card .mring svg { transform: rotate(-90deg); }
.macro-card .mval { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 900; }
.macro-card .mname { font-size: 12px; font-weight: 800; }
.macro-card .msub { font-size: 11px; color: var(--dim); font-weight: 600; }

/* ---------- sections & lists ---------- */
.sec-title { font-size: 17px; font-weight: 900; padding: 14px 20px 8px; }
.entry {
  display: flex; gap: 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 12px; margin: 0 20px 10px;
}
.entry img.thumb { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; background: var(--surface-alt); flex: none; }
.entry .einfo { flex: 1; min-width: 0; }
.entry .ename { font-weight: 800; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry .esub { font-size: 12px; color: var(--dim); font-weight: 600; }
.entry .ekcal { font-weight: 900; font-size: 15px; white-space: nowrap; }
.entry .edel { border: none; background: none; color: var(--dim); font-size: 18px; cursor: pointer; padding: 6px; }
.empty { text-align: center; color: var(--dim); padding: 26px 20px; font-size: 14px; font-weight: 600; }

/* ---------- bottom nav ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; z-index: 30;
  background: var(--surface); border-top: 1px solid var(--border);
  display: flex; align-items: flex-end; justify-content: space-around;
  padding: 8px 6px calc(10px + env(safe-area-inset-bottom));
}
.nav-btn {
  border: none; background: none; cursor: pointer; font-family: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--dim); font-size: 10px; font-weight: 800; padding: 4px 10px;
}
.nav-btn .nic { font-size: 21px; }
.nav-btn.on { color: var(--text); }
.scan-fab {
  width: 62px; height: 62px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--ink); display: flex; align-items: center; justify-content: center;
  margin-top: -26px; box-shadow: 0 6px 18px rgba(0,0,0,.25);
}
.scan-fab img { width: 34px; height: 34px; }
.scan-fab span { color: var(--on-ink); font-size: 30px; font-weight: 300; line-height: 1; }

/* ---------- scan overlay ---------- */
.scan-overlay {
  position: fixed; inset: 0; z-index: 50; background: #000;
  display: none; flex-direction: column; align-items: center; justify-content: center; color: #fff;
}
.scan-overlay.open { display: flex; }
.scan-frame { position: relative; width: 78%; max-width: 340px; aspect-ratio: 4/5; border-radius: 20px; overflow: hidden; background: #111; }
.scan-frame img { width: 100%; height: 100%; object-fit: cover; opacity: .85; }
.scan-line {
  position: absolute; left: 4%; right: 4%; height: 3px; border-radius: 2px;
  background: #4ade80; box-shadow: 0 0 18px #4ade80;
  animation: scanline 2.4s ease-in-out infinite;
}
@keyframes scanline { 0% { top: 6%; } 50% { top: 90%; } 100% { top: 6%; } }
.scan-status { margin-top: 18px; font-weight: 800; font-size: 16px; }
.scan-steps { margin-top: 8px; font-size: 13px; color: #9ca3af; font-weight: 600; min-height: 20px; }

/* ---------- result screen ---------- */
.result-photo { width: 100%; max-height: 300px; object-fit: cover; border-radius: 0 0 24px 24px; background: var(--surface-alt); }
.result-body { padding: 16px 20px 110px; }
.score-pill {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; padding: 7px 14px; font-weight: 900; font-size: 13px;
  background: var(--surface-alt); margin: 12px 0 4px;
}
.result-title { font-size: 22px; font-weight: 900; margin: 6px 0 12px; }
.kcal-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  padding: 16px; display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px;
}
.kcal-card .big { font-size: 34px; font-weight: 900; }
.kcal-card .unit { font-size: 14px; color: var(--dim); font-weight: 700; }
.stepper { display: flex; align-items: center; gap: 14px; }
.stepper button {
  width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 20px; font-weight: 800; cursor: pointer;
}
.stepper .pval { font-weight: 900; font-size: 16px; min-width: 52px; text-align: center; }
.macro-bar { margin-bottom: 10px; }
.macro-bar .mrow { display: flex; justify-content: space-between; font-size: 13px; font-weight: 800; margin-bottom: 5px; }
.macro-bar .track { height: 9px; border-radius: 999px; background: var(--surface-alt); overflow: hidden; }
.macro-bar .fill { height: 100%; border-radius: 999px; }
.ing { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.ing input {
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 9px;
  font-size: 13px; font-family: inherit; background: var(--surface); color: var(--text);
}
.ing .iname { flex: 1; }
.ing .igram { width: 64px; }
.ing .ikcal { width: 74px; text-align: right; font-weight: 800; }
.ing .ix { border: none; background: none; color: var(--dim); font-size: 16px; cursor: pointer; }
.coach-tip {
  background: var(--surface-alt); border-radius: 14px; padding: 12px 14px;
  font-size: 13px; font-weight: 600; margin: 14px 0; line-height: 1.5;
}

/* ---------- scan menu ---------- */
.menu-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.menu-item {
  display: flex; align-items: center; gap: 14px; width: 100%;
  background: var(--surface); border: 1.5px solid var(--border); border-radius: 16px;
  padding: 15px 16px; cursor: pointer; font-family: inherit; color: var(--text); text-align: left;
}
.menu-item .mi { font-size: 24px; }
.menu-item .mt { font-weight: 800; font-size: 15px; }
.menu-item .ms { font-size: 12px; color: var(--dim); font-weight: 600; }

/* ---------- analytics ---------- */
.stat-cards { display: flex; gap: 10px; padding: 4px 20px 8px; }
.stat-card { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 12px; text-align: center; }
.stat-card .sv { font-size: 19px; font-weight: 900; }
.stat-card .sl { font-size: 11px; color: var(--dim); font-weight: 700; margin-top: 2px; }
.chart-card { margin: 6px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 16px; }
#chart7 { width: 100%; height: 190px; display: block; }

/* ---------- profile ---------- */
.profile-head { display: flex; align-items: center; gap: 14px; padding: 6px 20px 4px; }
.avatar {
  width: 58px; height: 58px; border-radius: 50%; background: var(--ink); color: var(--on-ink);
  display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 900; flex: none;
}
.profile-head .pn { font-size: 18px; font-weight: 900; }
.profile-head .pe { font-size: 13px; color: var(--dim); font-weight: 600; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 16px; margin: 12px 20px;
}
.card h4 { margin: 0 0 12px; font-size: 15px; font-weight: 900; }
.seg { display: flex; background: var(--surface-alt); border-radius: 12px; padding: 4px; }
.seg button {
  flex: 1; border: none; background: none; padding: 10px; border-radius: 9px;
  font-weight: 800; font-size: 14px; color: var(--dim); cursor: pointer; font-family: inherit;
}
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* ---------- pricing ---------- */
.pack {
  background: var(--surface); border: 1.5px solid var(--border); border-radius: 18px;
  padding: 18px; margin: 0 20px 12px; position: relative;
}
.pack.hot { border-color: var(--ink); }
.pack .badge {
  position: absolute; top: -11px; right: 16px; background: var(--ink); color: var(--on-ink);
  font-size: 11px; font-weight: 900; padding: 4px 12px; border-radius: 999px; letter-spacing: .4px;
}
.pack .pname { font-size: 17px; font-weight: 900; }
.pack .pcredits { font-size: 13px; color: var(--dim); font-weight: 700; margin: 2px 0 10px; }
.pack .prow { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.pack .pprice { font-size: 24px; font-weight: 900; }
.pack .porig { font-size: 15px; color: var(--dim); text-decoration: line-through; font-weight: 700; }
.pack .pper { font-size: 12px; color: var(--dim); font-weight: 700; }
.balance-card {
  margin: 12px 20px; background: var(--ink); color: var(--on-ink);
  border-radius: 20px; padding: 20px;
}
.balance-card .bl { font-size: 13px; font-weight: 700; opacity: .75; }
.balance-card .bv { font-size: 36px; font-weight: 900; margin: 2px 0; }
.balance-card .bs { font-size: 13px; font-weight: 600; opacity: .85; }

/* ---------- misc ---------- */
.back-row { display: flex; align-items: center; gap: 10px; padding: 14px 20px 4px; }
.back-btn { border: none; background: var(--surface-alt); width: 38px; height: 38px; border-radius: 12px; font-size: 18px; cursor: pointer; color: var(--text); }
.back-row h2 { margin: 0; font-size: 19px; font-weight: 900; }
.hint { font-size: 12px; color: var(--dim); font-weight: 600; margin-top: 10px; text-align: center; }
.linklike { background: none; border: none; color: var(--text); font-weight: 800; cursor: pointer; font-size: 14px; font-family: inherit; text-decoration: underline; }
.kv { display: flex; justify-content: space-between; font-size: 14px; font-weight: 700; padding: 7px 0; border-bottom: 1px solid var(--border); }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--dim); }
.toast {
  position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--on-ink); padding: 12px 20px; border-radius: 999px;
  font-weight: 800; font-size: 14px; opacity: 0; transition: all .25s; z-index: 60; pointer-events: none;
  max-width: 90%; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.hidden { display: none !important; }

/* ---- production additions (forms used by real sheets) ---- */
.field textarea { width: 100%; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 12px; font: inherit; background: var(--surface); color: var(--text); resize: vertical; }
.field textarea:focus { outline: none; border-color: var(--ink); }
.frow { display: flex; gap: 10px; }
.frow .field { flex: 1; min-width: 0; }
