﻿/* ============================================================
   Nourish — stylesheet
   Palette + type scale derived from the decompiled design system
   (pastel windows, blueGrey text ramp, macro colors, Yettie greens)
   ============================================================ */

:root {
  /* --- surface / text ramp (from colors.xml) --- */
  --window: #f9fafb;              /* pastelWindowBackground */
  --surface: #ffffff;
  --ink: #37474f;                 /* blueGrey800  – primary text */
  --ink-70: rgba(55,71,79,.7);    /* blueGrey800Alpha70 – secondary */
  --ink-50: #9aa2a6;              /* blueGrey800Alpha50 – disabled */
  --divider: rgba(55,71,79,.10);
  --ring-track: #eceff1;          /* blueGrey50 */

  /* --- brand accent --- */
  --accent: #03a9f4;              /* lightBlue500 – colorPrimary */
  --accent-dark: #0288d1;
  --energy: #ef6c00;              /* orange800 – dietary energy */

  /* --- macros --- */
  --carbs: #3949ab;               /* indigo600 */
  --protein: #7986cb;             /* indigo300 */
  --fat: #9fa8da;                 /* indigo200 */

  /* --- accent bits --- */
  --heat: #26a69a;                /* teal400 – active energy */
  --water-c: #01579b;             /* lightBlue900 */

  /* --- pastels (pastelBlue/Green/Orange/Pink/Purple + Yettie) --- */
  --blue-1:#e7f6fd; --blue-4:#4d6c7a;
  --green-1:#f3faea; --green-3:#9aae84; --green-4:#5b6e45;
  --orange-1:#fef4e6; --orange-4:#836230;
  --pink-1:#fdecf2; --pink-4:#7b4c5c;
  --purple-1:#f2ecfd; --purple-4:#5d4d7a;
  --yettie-green:#00ad85; --yettie-deep:#005c46;

  --danger:#e06e6b;

  --r-card: 18px;
  --r-btn: 14px;
  --r-chip: 999px;
  --shadow: 0 2px 10px rgba(31,42,55,.06);
  --shadow-lg: 0 -8px 40px rgba(31,42,55,.18);
  --nav-h: 62px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
button:focus-visible, .meal-item:focus-visible, .foodrow:focus-visible,
.recipe:focus-visible, .calcell:focus-visible, .scan-chip:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
html, body { margin: 0; height: 100%; }
body {
  font-family: Rubik, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #e9edf1;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 12px;
}

/* ---------- brand bar ---------- */
.brandbar {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 6px;
  padding: calc(14px + env(safe-area-inset-top)) 14px 6px;
  background: var(--window);
  position: relative;
}
.brand { display: flex; align-items: center; gap: 9px; flex: 1; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(140deg, var(--yettie-green), var(--yettie-deep));
  color: #fff;
  box-shadow: 0 3px 10px rgba(0,173,133,.32);
  flex: 0 0 auto;
}
.brand-mark svg { width: 19px; height: 19px; display: block; }
.brand-word {
  font-size: 21px; font-weight: 700; letter-spacing: 2.4px;
  color: var(--ink); line-height: 1;
  background: linear-gradient(100deg, var(--ink) 30%, var(--yettie-deep));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
/* ---------- phone frame ---------- */
.stage { width: 100%; display: flex; justify-content: center; }
.phone {
  position: relative;
  width: min(400px, 100%);
  height: min(860px, calc(100vh - 48px));
  background: var(--window);
  border-radius: 34px;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(31,42,55,.28), 0 2px 0 1px rgba(255,255,255,.6) inset;
  display: flex; flex-direction: column;
}

/* ---------- screens ---------- */
.screen { display: none; flex: 1 1 auto; min-height: 0; flex-direction: column; }
.screen.is-active { display: flex; }
.scroll { overflow-y: auto; overflow-x: hidden; flex: 1 1 auto; padding: 0 14px; scrollbar-width: none; }
.scroll::-webkit-scrollbar { display: none; }
.scroll-pad { height: calc(var(--nav-h) + env(safe-area-inset-bottom) + 84px); }

.ic { width: 22px; height: 22px; display: block; color: currentColor; }
.iconbtn {
  border: 0; background: transparent; color: var(--ink);
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  transition: background .16s;
}
.iconbtn:hover { background: rgba(55,71,79,.07); }
.iconbtn-danger { color: var(--danger); }
.spacer { flex: 1; }

/* ---------- app bar ---------- */
.appbar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 2px;
  padding: 6px 12px 10px; background: var(--window);
}
.appbar-plain { padding-bottom: 6px; }
.screen-title { font-size: 22px; font-weight: 600; margin: 8px 0 4px 6px; letter-spacing: -.2px; flex: 1; }
.dateblock { display: flex; flex-direction: column; align-items: center; min-width: 118px; }
.dateblock-label { font-size: 15px; font-weight: 600; }
.dateblock-sub { font-size: 11.5px; color: var(--ink-70); }
.streak {
  display: flex; align-items: center; gap: 4px;
  background: var(--orange-1); color: var(--orange-4);
  padding: 5px 11px; border-radius: var(--r-chip); font-size: 12.5px; font-weight: 600;
  flex: 0 0 auto;
}
.streak-ic { width: 15px; height: 15px; }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border-radius: var(--r-card);
  padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow);
}

/* ---------- summary ---------- */
.summary-top { display: flex; align-items: center; gap: 14px; }
.ringwrap { position: relative; width: 130px; height: 130px; flex: 0 0 auto; }
.ring { width: 130px; height: 130px; transform: rotate(-90deg); }
.ring-track, .ring-fill { fill: none; stroke-width: 11; stroke-linecap: round; }
.ring-track { stroke: var(--ring-track); }
.ring-fill { stroke: var(--accent); stroke-dasharray: 326.7; stroke-dashoffset: 326.7; transition: stroke-dashoffset .5s cubic-bezier(.4,0,.2,1), stroke .3s; }
.ring-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-num { font-size: 27px; font-weight: 600; line-height: 1; }
.ring-cap { font-size: 10.5px; color: var(--ink-70); margin-top: 3px; letter-spacing: .2px; }
.summary-stats { flex: 1; display: flex; flex-direction: column; gap: 9px; }
.stat { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.stat-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.stat-label { color: var(--ink-70); }
.stat-val { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }

.macros { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-top: 16px; }
.macro-bar { height: 6px; border-radius: 3px; background: var(--ring-track); overflow: hidden; }
.macro-bar i { display: block; height: 100%; width: 0; border-radius: 3px; transition: width .5s cubic-bezier(.4,0,.2,1); }
.macro-text { display: flex; flex-direction: column; gap: 1px; margin-top: 6px; }
.macro-text b { font-size: 12px; font-weight: 600; }
.macro-text span { font-size: 11px; color: var(--ink-70); font-variant-numeric: tabular-nums; }
.encouragement { margin: 14px 0 0; font-size: 12.5px; color: var(--ink-70); text-align: center; }

/* ---------- water ---------- */
.water-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.water-title { display: flex; align-items: center; gap: 8px; }
.water-title h3 { margin: 0; font-size: 15px; font-weight: 600; }
.water-drop { width: 10px; height: 14px; background: var(--water-c); border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%; }
.water-count { font-size: 12.5px; color: var(--ink-70); }
.water-count b { color: var(--ink); font-size: 14px; }
.water-glasses { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 13px; }
.glass {
  width: 26px; height: 32px; border-radius: 4px 4px 7px 7px;
  border: 1.5px dashed rgba(1,87,155,.38); background: transparent; cursor: pointer;
  display: grid; place-items: center; transition: transform .12s;
}
.glass:active { transform: scale(.92); }
.glass.on { border-style: solid; border-color: var(--water-c); background: linear-gradient(180deg,#4fc3f7,#0277bd); }
.water-actions { display: flex; gap: 8px; }
.chip {
  border: 0; background: var(--blue-1); color: var(--blue-4);
  padding: 8px 13px; border-radius: var(--r-chip); font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer;
  transition: filter .15s;
}
.chip:hover { filter: brightness(.97); }
.chip-ghost { background: transparent; color: var(--ink-50); }

/* ---------- meals ---------- */
.meal { background: var(--surface); border-radius: var(--r-card); margin-bottom: 12px; box-shadow: var(--shadow); overflow: hidden; }
.meal-head { display: flex; align-items: center; gap: 11px; padding: 13px 15px; cursor: pointer; }
.meal-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: 0 0 auto; }
.meal-name { font-size: 15px; font-weight: 600; }
.meal-meta { font-size: 11.5px; color: var(--ink-70); margin-top: 1px; }
.meal-kcal { margin-left: auto; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.meal-add {
  border: 0; background: var(--green-1); color: var(--green-4);
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  margin-left: 8px; transition: transform .12s;
}
.meal-add:active { transform: scale(.9); }
.meal-add .ic { width: 17px; height: 17px; }
.meal-items { border-top: 1px solid var(--divider); }
.meal-item { display: flex; align-items: center; gap: 11px; padding: 10px 15px; cursor: pointer; }
.meal-item:hover { background: #fafbfc; }
.meal-item + .meal-item { border-top: 1px solid var(--divider); }
.meal-item .dot { width: 8px; height: 8px; border-radius: 3px; flex: 0 0 auto; }
.meal-item .txt { flex: 1; min-width: 0; }
.meal-item .nm { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meal-item .qt { font-size: 11px; color: var(--ink-70); }
.meal-item .kc { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.meal-empty { padding: 12px 15px; font-size: 12.5px; color: var(--ink-50); border-top: 1px solid var(--divider); }

/* ---------- insight ---------- */
.insight { position: relative; overflow: hidden; background: linear-gradient(150deg,#e6f2d9,#eef8fd); }
.insight-glow { position: absolute; width: 180px; height: 180px; right: -60px; top: -70px; background: radial-gradient(circle,rgba(0,173,133,.28),transparent 68%); }
.tag { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase; color: var(--yettie-deep); background: rgba(255,255,255,.72); padding: 4px 9px; border-radius: var(--r-chip); }
.insight h3 { position: relative; margin: 11px 0 5px; font-size: 16px; font-weight: 600; }
.insight p { position: relative; margin: 0 0 13px; font-size: 12.5px; color: var(--ink-70); line-height: 1.45; }

/* ---------- buttons ---------- */
.btn { border: 0; font: inherit; font-weight: 600; font-size: 13.5px; padding: 12px 20px; border-radius: var(--r-btn); cursor: pointer; transition: transform .12s, filter .15s; }
.btn:active { transform: scale(.98); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { filter: brightness(1.12); }
.btn-light { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.btn-block { width: 100%; }
.btn:disabled { background: var(--ring-track); color: var(--ink-50); cursor: not-allowed; }

/* ---------- FAB ---------- */
.fab {
  position: absolute; right: 18px; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 18px);
  width: 56px; height: 56px; border: 0; border-radius: 50%;
  background: var(--ink); color: #fff; display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 8px 22px rgba(31,42,55,.34); z-index: 30;
  transition: transform .16s;
}
.fab:hover { transform: translateY(-2px); }
.fab:active { transform: scale(.94); }
.fab .ic { width: 26px; height: 26px; }

/* ---------- bottom nav ---------- */
.bottomnav {
  flex: 0 0 calc(var(--nav-h) + env(safe-area-inset-bottom)); display: flex; background: #fff;
  border-top: 1px solid var(--divider); position: absolute; left: 0; right: 0; bottom: 0; z-index: 25;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
}
.navitem {
  flex: 1; border: 0; background: transparent; color: var(--ink-50);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font: inherit; font-size: 10.5px; font-weight: 500; cursor: pointer; transition: color .16s;
}
.navitem .ic { width: 23px; height: 23px; }
.navitem.is-active { color: var(--ink); }
.navitem.is-active .ic { color: var(--accent); }

/* ---------- recipes ---------- */
.searchbar { display: flex; align-items: center; gap: 9px; background: var(--surface); border-radius: 13px; padding: 10px 13px; box-shadow: var(--shadow); margin: 4px 0 12px; }
.searchbar .ic { width: 19px; height: 19px; color: var(--ink-50); flex: 0 0 auto; }
.searchbar input { border: 0; outline: 0; background: transparent; font: inherit; font-size: 16px; color: var(--ink); width: 100%; }
.searchbar:focus-within { box-shadow: 0 0 0 2px var(--accent); }
.searchbar input::placeholder { color: var(--ink-50); }
.catrow { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 12px; scrollbar-width: none; }
.catrow::-webkit-scrollbar { display: none; }
.cat { border: 0; white-space: nowrap; padding: 8px 14px; border-radius: var(--r-chip); font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer; background: #fff; color: var(--ink-70); box-shadow: var(--shadow); }
.cat.is-active { background: var(--ink); color: #fff; }
.recipe-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.recipe { background: #fff; border-radius: var(--r-card); overflow: hidden; box-shadow: var(--shadow); cursor: pointer; transition: transform .16s; }
.recipe:hover { transform: translateY(-2px); }
.recipe-img { height: 124px; display: grid; place-items: center; font-size: 34px; overflow: hidden; }
.recipe-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.meal-item .food-thumb { width: 38px; height: 38px; border-radius: 10px; font-size: 18px; }
.recipe-body { padding: 10px 12px 13px; }
.recipe-body h4 { margin: 0 0 4px; font-size: 13.5px; font-weight: 600; line-height: 1.28; }
.recipe-body .meta { font-size: 11px; color: var(--ink-70); }
.recipe-body .kcal { margin-top: 7px; font-size: 12px; font-weight: 600; }

/* ---------- profile ---------- */
.profile-head { display: flex; align-items: center; gap: 14px; }
.avatar { width: 58px; height: 58px; border-radius: 50%; background: linear-gradient(140deg,var(--yettie-green),var(--yettie-deep)); color: #fff; display: grid; place-items: center; font-size: 23px; font-weight: 600; }
.profile-id h3 { margin: 0 0 3px; font-size: 17px; font-weight: 600; }
.profile-id span { font-size: 12px; color: var(--ink-70); }
.profile-id .profile-account { display: block; font-size: 11.5px; color: var(--ink-50); margin: 0 0 2px; }
.row-logout { color: var(--danger); }
.statgrid { display: grid; grid-template-columns: repeat(3,1fr); text-align: center; padding: 15px 8px; }
.statcell { display: flex; flex-direction: column; gap: 4px; }
.statcell + .statcell { border-left: 1px solid var(--divider); }
.statcell span { font-size: 11px; color: var(--ink-70); }
.statcell b { font-size: 17px; font-weight: 600; }
.statcell small { font-size: 11px; font-weight: 400; color: var(--ink-70); }
.probanner { background: linear-gradient(150deg,var(--purple-1),var(--pink-1)); }
.probadge { display: inline-block; background: var(--purple-4); color: #fff; font-size: 10px; font-weight: 700; letter-spacing: 1px; padding: 4px 9px; border-radius: var(--r-chip); }
.probanner h3 { margin: 11px 0 5px; font-size: 16px; font-weight: 600; }
.probanner p { margin: 0 0 13px; font-size: 12.5px; color: var(--ink-70); line-height: 1.45; }
.list { background: #fff; border-radius: var(--r-card); overflow: hidden; box-shadow: var(--shadow); }
.row { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: transparent; font: inherit; font-size: 14px; color: var(--ink); padding: 13px 15px; cursor: pointer; text-align: left; }
.row + .row { border-top: 1px solid var(--divider); }
.row:hover { background: #fafbfc; }
.row-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: 0 0 auto; }
.row-ic .ic { width: 19px; height: 19px; }
.row-chev { margin-left: auto; width: 18px; height: 18px; color: var(--ink-50); }

/* ---------- sheets ---------- */
.scrim { position: absolute; inset: 0; background: rgba(31,42,55,.42); opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 40; }
.scrim.is-open { opacity: 1; pointer-events: auto; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--window); border-radius: 24px 24px 0 0;
  transform: translateY(105%); transition: transform .3s cubic-bezier(.32,.72,0,1);
  display: flex; flex-direction: column; max-height: 88%;
  box-shadow: var(--shadow-lg);
}
.sheet.is-open { transform: translateY(0); }
.sheet-tall { max-height: 92%; }
.sheet-grab { width: 40px; height: 4px; border-radius: 2px; background: var(--ring-track); margin: 8px auto 2px; flex: 0 0 auto; }
.sheet-head { display: flex; align-items: center; gap: 4px; padding: 4px 12px 8px; flex: 0 0 auto; }
.sheet-head h3 { flex: 1; text-align: center; margin: 0; font-size: 15.5px; font-weight: 600; }
.sheet-tools { padding: 0 14px; flex: 0 0 auto; }
.toolrow { display: flex; gap: 10px; margin-bottom: 12px; }
.roundtool {
  flex: 1; border: 0; background: #fff; box-shadow: var(--shadow); border-radius: 15px;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 12px 6px; font: inherit; font-size: 11px; font-weight: 500; color: var(--ink); cursor: pointer;
  transition: transform .14s;
}
.roundtool:active { transform: scale(.96); }
.roundtool .ic { width: 21px; height: 21px; }
.roundtool .barcode-glyph { width: 22px; height: 21px; background: repeating-linear-gradient(90deg,var(--ink) 0 2px,transparent 2px 4px,var(--ink) 4px 5px,transparent 5px 8px); border-radius: 2px; }
.tabs { display: flex; gap: 4px; padding: 0 14px 8px; flex: 0 0 auto; }
.tab { border: 0; background: transparent; font: inherit; font-size: 13px; font-weight: 500; color: var(--ink-70); padding: 7px 12px; border-radius: var(--r-chip); cursor: pointer; }
.tab.is-active { background: var(--blue-1); color: var(--blue-4); }
.sheetlist { overflow-y: auto; padding: 0 14px 20px; flex: 1 1 auto; scrollbar-width: none; }
.sheetlist::-webkit-scrollbar { display: none; }
.foodrow { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 14px; padding: 11px 13px; margin-bottom: 8px; cursor: pointer; box-shadow: var(--shadow); transition: transform .14s; }
.foodrow:active { transform: scale(.985); }
.food-thumb { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; font-size: 21px; flex: 0 0 auto; }
.food-info { flex: 1; min-width: 0; }
.food-info .nm { font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.food-info .br { font-size: 11px; color: var(--ink-70); }
.food-add { border: 0; background: var(--green-1); color: var(--green-4); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; }
.food-add .ic { width: 17px; height: 17px; }
.empty { text-align: center; color: var(--ink-50); font-size: 13px; padding: 34px 10px; }

/* ---------- quantity ---------- */
.qty-body { padding: 6px 16px 14px; overflow-y: auto; flex: 1 1 auto; }
.qty-hero { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 0 18px; }
.qty-hero .em { width: 66px; height: 66px; border-radius: 20px; display: grid; place-items: center; font-size: 32px; margin-bottom: 6px; }
.qty-hero .nm { font-size: 17px; font-weight: 600; text-align: center; }
.qty-hero .br { font-size: 12px; color: var(--ink-70); }
.field { display: flex; align-items: center; justify-content: space-between; background: #fff; border-radius: 13px; padding: 12px 14px; margin-bottom: 9px; }
.field label { font-size: 13.5px; color: var(--ink-70); }
.field .ctrl { display: flex; align-items: center; gap: 10px; }
.stepper { border: 0; background: var(--ring-track); width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; cursor: pointer; color: var(--ink); }
.stepper:active { background: #dfe4e7; }
.qty-input { width: 62px; text-align: center; border: 0; outline: 0; background: transparent; font: inherit; font-size: 16px; font-weight: 600; color: var(--ink); -moz-appearance: textfield; }
.qty-input::-webkit-outer-spin-button, .qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.select { border: 0; background: transparent; font: inherit; font-size: 14px; font-weight: 500; color: var(--ink); outline: 0; text-align: right; }
.servlabel { font-size: 14px; font-weight: 500; text-align: right; }
.field > span { flex: 1; min-width: 0; padding-right: 10px; }
.field input[type="text"],
.field input[type="number"] {
  border: 0; outline: 0; background: transparent; font: inherit;
  font-size: 16px; font-weight: 600; color: var(--ink);
  text-align: right; width: 7.5rem; flex: 0 0 auto; min-width: 0;
}
.field input[type="number"] { -moz-appearance: textfield; }
.field input[type="number"]::-webkit-outer-spin-button,
.field input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-note { margin: 8px 2px 0; font-size: 12px; color: var(--ink-70); text-align: center; line-height: 1.4; }
.insight-row {
  background: #fff; border-radius: 14px; padding: 12px 14px; margin-bottom: 8px;
  box-shadow: var(--shadow); font-size: 13.5px; line-height: 1.45;
}
img.food-thumb, .qty-hero img.em { object-fit: cover; }
.macrorow { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-top: 6px; }
.macropill { background: #fff; border-radius: 13px; padding: 11px 8px; text-align: center; }
.macropill span { font-size: 11px; color: var(--ink-70); display: block; }
.macropill b { font-size: 14px; font-weight: 600; display: block; margin-top: 2px; font-variant-numeric: tabular-nums; }
.macropill.kcal b { color: var(--energy); }
.kcaltotal { display: flex; align-items: baseline; justify-content: center; gap: 5px; padding: 14px 0 4px; }
.kcaltotal b { font-size: 27px; font-weight: 600; }
.kcaltotal span { font-size: 13px; color: var(--ink-70); }
.sheet-foot { padding: 10px 16px calc(16px + env(safe-area-inset-bottom)); flex: 0 0 auto; border-top: 1px solid var(--divider); }

/* ---------- calendar ---------- */
.cal-dow { display: grid; grid-template-columns: repeat(7,1fr); text-align: center; font-size: 11px; color: var(--ink-50); padding: 4px 14px 8px; }
.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 4px; padding: 0 14px 12px; overflow-y: auto; }
.calcell { aspect-ratio: 1; border: 0; background: transparent; border-radius: 11px; font: inherit; font-size: 13px; color: var(--ink); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
.calcell:hover { background: var(--ring-track); }
.calcell.out { color: var(--ink-50); opacity: .45; }
.calcell.today { box-shadow: inset 0 0 0 1.6px var(--accent); }
.calcell.sel { background: var(--ink); color: #fff; }
.calcell.sel i { background: #fff; }
.calcell i { width: 5px; height: 5px; border-radius: 50%; background: var(--green-3); }
.calcell.done i { background: var(--green-3); }
.cal-legend { display: flex; gap: 16px; justify-content: center; font-size: 11px; color: var(--ink-70); padding: 4px 0 calc(20px + env(safe-area-inset-bottom)); }
.cal-legend span { display: flex; align-items: center; gap: 6px; }
.cal-legend i { width: 9px; height: 9px; border-radius: 3px; }

/* ---------- language toggle ---------- */
.langcard { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 15px; }
.langlabel { font-size: 14px; font-weight: 500; }
.seg { display: inline-flex; background: var(--ring-track); border-radius: 11px; padding: 3px; gap: 3px; }
.segbtn {
  border: 0; background: transparent; font: inherit; font-size: 12.5px; font-weight: 500;
  color: var(--ink-70); padding: 7px 14px; border-radius: 8px; cursor: pointer; transition: all .16s;
}
.segbtn.is-active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(31,42,55,.14); }

/* ---------- barcode scanner ---------- */
.scan-body { padding: 0 16px 20px; overflow-y: auto; flex: 1 1 auto; scrollbar-width: none; }
.scan-body::-webkit-scrollbar { display: none; }

.scan-view {
  position: relative; width: 100%; aspect-ratio: 4 / 3; border-radius: 16px; overflow: hidden;
  background: #1f2a37; display: grid; place-items: center; margin-bottom: 10px;
}
.scan-view video { width: 100%; height: 100%; object-fit: cover; display: none; }
.scan-view.is-live video { display: block; }
.scan-view.is-live .scan-note { display: none; }
.scan-note { color: rgba(255,255,255,.78); font-size: 12.5px; text-align: center; padding: 0 24px; }
.scan-reticle {
  position: absolute; width: 62%; height: 34%; border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(15,23,32,.34);
  border: 2px solid rgba(255,255,255,.9); display: none;
}
.scan-view.is-live .scan-reticle { display: block; }
.scan-reticle::after {
  content: ""; position: absolute; left: 8%; right: 8%; top: 50%; height: 2px;
  background: linear-gradient(90deg, transparent, #ff3346, transparent);
  animation: scanline 1.9s ease-in-out infinite;
}
@keyframes scanline { 0%,100% { transform: translateY(-26px); } 50% { transform: translateY(26px); } }

.scan-hint { margin: 0 0 12px; font-size: 12px; color: var(--ink-70); line-height: 1.45; }

.scan-manual { background: #fff; border-radius: 14px; padding: 13px 14px; box-shadow: var(--shadow); margin-bottom: 14px; }
.scan-manual-label { display: block; font-size: 12px; color: var(--ink-70); margin-bottom: 8px; }
.scan-manual-row { display: flex; gap: 8px; align-items: center; }
.scan-manual-row input {
  flex: 1; min-width: 0; border: 1.5px solid var(--ring-track); border-radius: 11px;
  padding: 11px 13px; font: inherit; font-size: 15px; font-weight: 500; letter-spacing: .5px;
  color: var(--ink); outline: 0; background: var(--window); transition: border-color .16s;
}
.scan-manual-row input:focus { border-color: var(--accent); }
.scan-manual-row input::placeholder { color: var(--ink-50); font-weight: 400; letter-spacing: 0; }
.scan-manual-row .btn { padding: 11px 15px; flex: 0 0 auto; }
.scan-valid { display: block; height: 14px; font-size: 12px; font-weight: 600; margin-top: 6px; }
.scan-valid.ok { color: var(--yettie-green); }
.scan-valid.bad { color: var(--danger); }

.scan-examples-label { display: block; font-size: 12px; color: var(--ink-70); margin-bottom: 8px; }
.scan-chips { display: flex; flex-direction: column; gap: 7px; }
.scan-chip {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 0; background: #fff; box-shadow: var(--shadow); border-radius: 12px;
  padding: 10px 13px; font: inherit; cursor: pointer; text-align: left; transition: transform .14s;
}
.scan-chip:active { transform: scale(.985); }
.scan-chip-code { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: .4px; }
.scan-chip-name { font-size: 11.5px; color: var(--ink-70); text-align: right; }

.scan-result { margin-bottom: 14px; }
.scan-hit { background: #fff; border-radius: 14px; padding: 13px; box-shadow: var(--shadow); }
.scan-hit-head { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--yettie-green); margin-bottom: 10px; }
.scan-hit-check { width: 18px; height: 18px; }
.scan-hit-row { box-shadow: none; margin-bottom: 12px; padding: 0; }
.btn-ghost { background: transparent; color: var(--ink-70); margin-top: 6px; }
.btn-ghost:hover { background: rgba(55,71,79,.06); }

.scan-miss { background: #fff; border-radius: 14px; padding: 22px 16px; box-shadow: var(--shadow); text-align: center; }
.scan-miss-ic {
  width: 46px; height: 46px; border-radius: 50%; background: var(--orange-1); color: var(--orange-4);
  display: grid; place-items: center; font-size: 22px; font-weight: 600; margin: 0 auto 11px;
}
.scan-miss-title { font-size: 14px; font-weight: 600; margin-bottom: 5px; }
.scan-miss-sub { font-size: 12px; color: var(--ink-70); }

/* ---------- scanner: loading / source ---------- */
.scan-loading {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  background: #fff; border-radius: 14px; padding: 22px 16px; box-shadow: var(--shadow);
  font-size: 13px; color: var(--ink-70); text-align: center;
}
.scan-loading.scan-warn { color: var(--orange-4); background: var(--orange-1); box-shadow: none; line-height: 1.45; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%; flex: 0 0 auto;
  border: 2px solid var(--ring-track); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.scan-thumb { object-fit: cover; background: var(--ring-track); }
.scan-source { text-align: center; font-size: 10.5px; color: var(--ink-50); margin-top: 10px; }
.scan-hit .macrorow { margin-bottom: 13px; }

/* ---------- install card ---------- */
.installcard { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.install-ic {
  width: 40px; height: 40px; border-radius: 12px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: linear-gradient(140deg, var(--yettie-green), var(--yettie-deep));
  color: #fff;
  box-shadow: 0 3px 10px rgba(0,173,133,.28);
}
.install-ic .ic { width: 21px; height: 21px; }
.install-text { flex: 1 1 150px; min-width: 0; }
.install-text h3 { margin: 0 0 3px; font-size: 14.5px; font-weight: 600; }
.install-text p { margin: 0; font-size: 12px; color: var(--ink-70); line-height: 1.4; }
.installcard .btn { flex: 0 0 auto; margin-left: auto; padding: 10px 15px; font-size: 13px; }

/* ---------- toast ---------- */
.toast {
  position: absolute; left: 50%; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 88px); transform: translate(-50%, 14px);
  background: var(--ink); color: #fff; font-size: 12.5px; font-weight: 500;
  padding: 10px 18px; border-radius: var(--r-chip); opacity: 0; pointer-events: none;
  transition: opacity .22s, transform .22s; z-index: 80; white-space: normal; text-align: center;
  max-width: calc(100% - 48px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- boot: loading + login ---------- */
#appShell {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}
.gate {
  position: absolute;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  color: #fff;
  background:
    radial-gradient(120% 70% at 50% -10%, rgba(255,255,255,.22), transparent 52%),
    linear-gradient(165deg, #14c4a0 0%, #00ad85 46%, #005c46 100%);
  padding: calc(32px + env(safe-area-inset-top)) 28px calc(28px + env(safe-area-inset-bottom));
  opacity: 1;
  transition: opacity .32s ease;
}
.gate.is-leaving { opacity: 0; pointer-events: none; }
.gate-load, .gate-auth {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.gate-load { align-items: center; justify-content: center; }
.gate-brand { display: flex; flex-direction: column; align-items: center; text-align: center; }
.gate-mark {
  width: 78px; height: 78px; border-radius: 24px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.16);
  box-shadow: 0 10px 30px rgba(0,40,30,.18);
}
.gate-mark svg { width: 40px; height: 40px; display: block; }
.gate-load .gate-mark { animation: gate-float 1.8s ease-in-out infinite; }
@keyframes gate-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.gate-word {
  margin-top: 16px;
  font-size: 28px; font-weight: 700; letter-spacing: 3.2px; line-height: 1;
}
.gate-status {
  margin: 28px 0 14px;
  font-size: 13px; font-weight: 500; letter-spacing: .4px;
  color: rgba(255,255,255,.88);
}
.gate-track {
  width: min(220px, 68%);
  height: 4px; border-radius: 99px;
  background: rgba(255,255,255,.28);
  overflow: hidden;
}
.gate-track i {
  display: block; height: 100%; width: 0;
  background: #fff; border-radius: inherit;
}
.gate-auth { justify-content: center; width: 100%; overflow-y: auto; }
.gate-auth .gate-brand { align-self: center; }
.gate-auth .gate-mark { width: 58px; height: 58px; border-radius: 18px; }
.gate-auth .gate-mark svg { width: 30px; height: 30px; }
.gate-auth .gate-word { font-size: 22px; letter-spacing: 2.6px; margin-top: 12px; }
.gate-tabs {
  display: flex;
  background: rgba(255,255,255,.16);
  border-radius: 999px;
  padding: 4px;
  margin: 22px 0 16px;
}
.gate-tab {
  flex: 1;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,.82);
  font: inherit;
  font-weight: 600;
  font-size: 13.5px;
  padding: 8px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.gate-tab.is-active { background: #fff; color: var(--yettie-deep); }
.gate-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(255,255,255,.96);
  color: var(--ink);
  border-radius: 14px;
  padding: 10px 14px;
  margin-bottom: 10px;
}
.gate-field span {
  font-size: 11px; font-weight: 600; letter-spacing: .4px;
  text-transform: uppercase; color: var(--ink-70);
}
.gate-field input {
  border: 0; outline: 0; background: transparent;
  font: inherit; font-size: 16px; font-weight: 600; color: var(--ink);
  width: 100%; padding: 0;
}
.gate-field:focus-within { box-shadow: 0 0 0 2px #fff; }
.gate-error {
  min-height: 2.5em;
  margin: 2px 4px 0;
  font-size: 12.5px;
  line-height: 1.35;
  text-align: center;
  color: #ffe8e4;
}
.gate-auth .btn {
  margin-top: 4px;
  background: #fff;
  color: var(--yettie-deep);
}
.gate-auth .btn:disabled { background: rgba(255,255,255,.45); color: rgba(0,92,70,.55); }
.gate-hint {
  margin: 16px 8px 0;
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
  color: rgba(255,255,255,.84);
}
.gate-lang { display: flex; justify-content: center; gap: 8px; margin-top: 16px; }
.gate-langbtn {
  border: 0;
  background: transparent;
  color: rgba(255,255,255,.75);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.gate-langbtn.is-active { background: rgba(255,255,255,.2); color: #fff; }

/* ---------- responsive ---------- */
@media (max-width: 430px) {
  body { padding: 0; }
  .phone { width: 100%; height: 100vh; height: 100dvh; border-radius: 0; box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
