/* =========================================================
   NEXA HEALTH — iOS design system (mode terang)
   ========================================================= */
:root {
  --bg: #F2F2F7; --bg2: #FFFFFF; --card: #FFFFFF; --elev: #FFFFFF;
  --label: #000; --label2: rgba(60,60,67,.62); --label3: rgba(60,60,67,.32);
  --sep: rgba(60,60,67,.16); --fill: rgba(120,120,128,.14); --fill2: rgba(120,120,128,.09); --fill3: rgba(118,118,128,.06);
  --blue: #007AFF; --green: #34C759; --red: #FF3B30; --orange: #FF9500; --yellow: #FFCC00; --purple: #AF52DE;
  --indigo: #5856D6; --pink: #FF2D55; --teal: #30B0C7; --mint: #00C7BE; --cyan: #32ADE6; --gray: #8E8E93;
  --glass: rgba(249,249,249,.78); --shadow: 0 1px 2px rgba(0,0,0,.03), 0 6px 24px rgba(0,0,0,.05);
  --shadow-float: 0 12px 40px rgba(0,0,0,.14), 0 2px 8px rgba(0,0,0,.06);
  --r-card: 22px; --ease: cubic-bezier(.32,.72,0,1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, "Segoe UI", Roboto, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 58px;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--label); font-family: var(--font);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; font-size: 16px; line-height: 1.35; letter-spacing: -.01em; }
body { min-height: 100vh; overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; margin: 0; }
a { color: var(--blue); text-decoration: none; }
h1, h2, h3, p { margin: 0; }
.hidden { display: none !important; }
.b { font-weight: 600; } .muted { color: var(--label2); } .faint { color: var(--label3); }
.c-blue { color: var(--blue); } .c-green { color: var(--green); } .c-red { color: var(--red); } .c-orange { color: var(--orange); } .c-purple { color: var(--purple); } .c-gray { color: var(--gray); }
a.srow { color: var(--label); }
.t-title3 { font-size: 20px; letter-spacing: -.02em; } .t-sub { font-size: 15px; } .t-foot { font-size: 13px; } .t-cap { font-size: 12px; }
.icon-tile { width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 14px; flex: none; }
.bg-blue { background: var(--blue); } .bg-green { background: var(--green); } .bg-red { background: var(--red); } .bg-orange { background: var(--orange); }
.bg-purple { background: var(--purple); } .bg-cyan { background: var(--cyan); } .bg-indigo { background: var(--indigo); } .bg-pink { background: var(--pink); }
.bg-teal { background: var(--teal); } .bg-yellow { background: var(--yellow); } .bg-gray { background: var(--gray); } .bg-mint { background: var(--mint); }

/* ---------- Lock ---------- */
.lock { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px 16px;
  background: radial-gradient(120% 80% at 50% 0%, rgba(52,199,89,.22), transparent 60%), var(--bg); }
.lock-card { width: 100%; max-width: 340px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.lock-card.shake { animation: shake .4s; }
@keyframes shake { 20%,60% { transform: translateX(-10px) } 40%,80% { transform: translateX(10px) } }
.lock-logo { width: 72px; height: 72px; border-radius: 18px; background: linear-gradient(145deg, #34C759, #00C7BE); color: #fff; font-size: 32px;
  display: flex; align-items: center; justify-content: center; margin-bottom: 10px; box-shadow: 0 10px 30px rgba(52,199,89,.35); }
.pin-dots { display: flex; gap: 14px; margin: 22px 0 26px; min-height: 14px; }
.pin-dots span { width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid var(--label); transition: background .15s; }
.pin-dots span.on { background: var(--label); }
.pin-dots.busy span { animation: pulse 1s infinite alternate; }
@keyframes pulse { to { opacity: .3 } }
.pin-pad { display: grid; grid-template-columns: repeat(3, 76px); gap: 16px 24px; }
.pin-pad button { width: 76px; height: 76px; border-radius: 50%; background: var(--fill); font-size: 30px; font-weight: 400; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; transition: background .1s; }
.pin-pad button small { font-size: 9px; letter-spacing: .15em; font-weight: 600; margin-top: 2px; }
.pin-pad button:active { background: var(--label3); }
.pin-pad button[data-del] { background: none; font-size: 22px; }
.lock-err { color: var(--red); font-size: 14px; min-height: 20px; margin-top: 14px; }
.lock-back { font-size: 14px; margin-top: 10px; }

/* ---------- Nav ---------- */
.nav { position: sticky; top: 0; z-index: 30; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: calc(var(--safe-t) + 8px) 12px 8px; background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: .5px solid transparent; transition: border-color .2s; }
.nav.scrolled { border-bottom-color: var(--sep); }
.nav-back { display: inline-flex; align-items: center; gap: 4px; font-size: 17px; }
.nav-back i { font-size: 18px; }
.nav-title { font-weight: 600; font-size: 17px; opacity: 0; transition: opacity .2s; }
.nav.scrolled .nav-title { opacity: 1; }
.nav-right { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.nav-btn { width: 34px; height: 34px; border-radius: 50%; background: var(--fill2); color: var(--blue); font-size: 16px; }
.sync-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--label2); background: var(--fill2); padding: 6px 10px; border-radius: 99px; }
.sync-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gray); }
.sync-pill.on .dot { background: var(--green); } .sync-pill.off .dot { background: var(--orange); } .sync-pill.err .dot { background: var(--red); }

/* ---------- Layout ---------- */
main { max-width: 720px; margin: 0 auto; padding: 0 16px calc(var(--tabbar-h) + var(--safe-b) + 40px); }
.tab { display: flex; flex-direction: column; gap: 14px; animation: fadeIn .25s var(--ease); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px) } }
.large-title-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding-top: 4px; }
.large-title { font-size: 34px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--label2); text-transform: uppercase; letter-spacing: .02em; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 4px 0; }
.section-head h2 { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.card { background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow); }
.link { color: var(--blue); font-size: 15px; }
.link:disabled { color: var(--label3); }

/* Buttons */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 50px; border-radius: 14px; font-weight: 600; font-size: 17px; transition: transform .1s, opacity .2s; }
.btn:active { transform: scale(.98); opacity: .85; }
.btn:disabled { opacity: .45; }
.btn-filled { background: var(--blue); color: #fff; }
.btn-tinted { background: color-mix(in srgb, var(--blue) 14%, transparent); color: var(--blue); }
.btn-gray { background: var(--fill); color: var(--label); }
.btn-green { background: var(--green); color: #fff; }
.btn-sm { min-height: 36px; font-size: 15px; border-radius: 10px; padding: 0 14px; width: auto; }
.btn-col { display: flex; flex-direction: column; gap: 10px; }
.btn-icon { width: 36px; height: 36px; border-radius: 50%; background: var(--blue); color: #fff; flex: none; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg) } }

/* Date nav */
.date-nav { display: flex; align-items: center; gap: 4px; background: var(--card); border-radius: 99px; padding: 4px; box-shadow: var(--shadow); }
.date-nav button { width: 32px; height: 32px; border-radius: 50%; color: var(--blue); }
.date-nav button:disabled { color: var(--label3); }
.date-pick { position: relative; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; color: var(--blue); }
.date-pick input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }

/* Hero ring */
.hero-card { display: flex; align-items: center; gap: 18px; padding: 18px; }
.ring-wrap { width: 168px; height: 168px; flex: none; position: relative; }
.ring-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.ring-center .big { font-size: 34px; font-weight: 700; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.ring-center .lbl { font-size: 12px; color: var(--label2); margin-top: 4px; font-weight: 500; }
.hero-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.hero-row { display: flex; gap: 10px; align-items: flex-start; }
.dotc { width: 10px; height: 10px; border-radius: 50%; margin-top: 4px; flex: none; }
.hero-num { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.hero-num.sm { font-size: 16px; }

/* Nutrient tiles */
.nutri-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.ntile { background: var(--card); border-radius: 18px; padding: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; text-align: left; }
.ntile .top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.ntile .name { font-size: 13px; font-weight: 600; color: var(--label2); }
.ntile .val { font-size: 22px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ntile .val small { font-size: 13px; color: var(--label2); font-weight: 500; }
.bar { height: 6px; border-radius: 99px; background: var(--fill); overflow: hidden; position: relative; }
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; transition: width .5s var(--ease); }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 99px; white-space: nowrap; }
.st-aman { color: var(--green); background: color-mix(in srgb, var(--green) 15%, transparent); }
.st-waspada { color: var(--orange); background: color-mix(in srgb, var(--orange) 16%, transparent); }
.st-berlebih { color: var(--red); background: color-mix(in srgb, var(--red) 14%, transparent); }
.st-kurang { color: var(--label2); background: var(--fill); }
.st-cukup { color: var(--green); background: color-mix(in srgb, var(--green) 15%, transparent); }
.ntile.over { box-shadow: inset 0 0 0 1.5px var(--red), var(--shadow); }

/* Lists */
.list { overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; position: relative; min-height: 50px; width: 100%; text-align: left; }
.row + .row::before { content: ''; position: absolute; top: 0; left: 58px; right: 0; height: .5px; background: var(--sep); }
.list.plain .row + .row::before { left: 16px; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { font-size: 13px; color: var(--label2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .val { font-variant-numeric: tabular-nums; color: var(--label2); font-size: 15px; text-align: right; }
.row .chev { color: var(--label3); font-size: 13px; }
button.row:active { background: var(--fill2); }
.nrow .bar { margin-top: 6px; }
.empty { padding: 22px 16px; text-align: center; color: var(--label2); font-size: 14px; }

/* Water */
.water-card { padding: 14px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.water-info { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 150px; }
.water-glasses { display: flex; gap: 3px; flex-wrap: wrap; flex: 2; min-width: 120px; }
.water-glasses i { font-size: 18px; color: var(--fill); } .water-glasses i.on { color: var(--cyan); }
.stepper { display: flex; background: var(--fill2); border-radius: 10px; overflow: hidden; }
.stepper button { width: 44px; height: 34px; font-size: 14px; } .stepper button + button { border-left: .5px solid var(--sep); }

/* Meals */
.meal-sec .head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 6px; }
.meal-sec .head .t { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; }
.meal-sec .head .k { font-size: 14px; color: var(--label2); font-variant-numeric: tabular-nums; }
.meal-add { color: var(--blue); font-size: 15px; display: flex; align-items: center; gap: 8px; padding: 12px 16px; width: 100%; text-align: left; position: relative; }
.meal-add::before { content: ''; position: absolute; top: 0; left: 16px; right: 0; height: .5px; background: var(--sep); }
.thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex: none; background: var(--fill); display: flex; align-items: center; justify-content: center; color: var(--label2); }
.vdot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 4px; }

/* Segmented */
.segmented { display: flex; background: var(--fill2); border-radius: 10px; padding: 2px; gap: 2px; }
.segmented button { flex: 1; min-height: 32px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--label); transition: background .2s; }
.segmented button.on { background: var(--elev); box-shadow: 0 1px 4px rgba(0,0,0,.12); }

/* Stats */
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.stat { background: var(--card); border-radius: 18px; padding: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; }
.stat .num { font-size: 24px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .num small { font-size: 13px; font-weight: 500; color: var(--label2); }
.stat .lbl { font-size: 13px; color: var(--label2); }

/* Charts */
.chart-card { padding: 14px 14px 10px; }
.chart-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; padding: 0 2px; }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--font); font-size: 10px; fill: var(--label2); }
.chart .grid { stroke: var(--sep); stroke-width: .5; }
.chart .target { stroke: var(--label2); stroke-width: 1; stroke-dasharray: 4 4; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart-empty { padding: 30px 0; text-align: center; color: var(--label2); font-size: 14px; }
.tooltip { position: fixed; z-index: 90; pointer-events: none; background: var(--elev); color: var(--label); border-radius: 12px; padding: 8px 10px; font-size: 13px;
  box-shadow: var(--shadow-float); max-width: 220px; transform: translate(-50%, calc(-100% - 10px)); }
.tooltip .tt-v { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }

/* Forms */
.form-card { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.form-title { font-weight: 700; font-size: 17px; display: flex; gap: 8px; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fld { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fld > span { font-size: 13px; color: var(--label2); font-weight: 500; padding-left: 4px; }
.fld input, .fld textarea, .fld select, .input-row input, .search input {
  width: 100%; min-height: 44px; border: 0; border-radius: 12px; background: var(--fill2); padding: 10px 12px; font-size: 16px; outline: none; -webkit-appearance: none; appearance: none; }
.fld textarea { resize: none; line-height: 1.4; }
.fld input:focus, .fld textarea:focus, .input-row input:focus { box-shadow: 0 0 0 2px color-mix(in srgb, var(--blue) 45%, transparent); }
.fld.big input { font-size: 28px; font-weight: 700; min-height: 56px; font-variant-numeric: tabular-nums; }
.more summary { color: var(--blue); font-size: 15px; cursor: pointer; padding: 2px 4px; list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.more summary::before { content: '\f078'; font-family: 'Font Awesome 6 Free'; font-weight: 900; font-size: 11px; margin-right: 6px; display: inline-block; transition: transform .2s; }
.more[open] summary::before { transform: rotate(180deg); }
.more[open] .grid2 { margin-top: 10px; }
.input-row { display: flex; gap: 8px; align-items: center; }
.search { position: relative; } .search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--label2); font-size: 14px; }
.search input { padding-left: 34px; min-height: 38px; }

/* Suggest chips */
.suggest { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: -2px -16px 0; padding: 0 16px; }
.suggest::-webkit-scrollbar { display: none; }
.suggest:empty { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; background: var(--fill2); border-radius: 99px; padding: 7px 12px; font-size: 14px; white-space: nowrap; }
.chip small { color: var(--label2); font-size: 12px; }
.chip:active { background: var(--fill); }

/* Sheets */
.backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.35); display: flex; align-items: flex-end; justify-content: center; animation: fade .25s; }
.backdrop.closing { animation: fade .25s reverse forwards; }
.backdrop.closing .sheet { animation: slideUp .3s var(--ease) reverse forwards; }
@keyframes fade { from { opacity: 0 } }
.sheet { width: 100%; max-width: 640px; max-height: 92vh; background: var(--bg); border-radius: 14px 14px 0 0; display: flex; flex-direction: column; animation: slideUp .38s var(--ease); box-shadow: var(--shadow-float); }
.sheet.tall { height: 92vh; }
@keyframes slideUp { from { transform: translateY(100%) } }
.grabber { width: 36px; height: 5px; border-radius: 99px; background: var(--label3); margin: 6px auto 0; flex: none; }
.sheet-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 10px 16px 12px; font-size: 17px; flex: none; }
.sheet-head > :last-child { justify-self: end; } .sheet-head .link { font-size: 17px; }
.sheet-body { overflow-y: auto; padding: 0 16px calc(var(--safe-b) + 24px); display: flex; flex-direction: column; gap: 14px; -webkit-overflow-scrolling: touch; }

.capture-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.capture-btn { background: var(--card); border-radius: 16px; padding: 14px; display: flex; align-items: center; gap: 10px; font-weight: 600; box-shadow: var(--shadow); }
.capture-btn .icon-tile { width: 36px; height: 36px; border-radius: 10px; font-size: 16px; }
.photo-preview { position: relative; border-radius: 18px; overflow: hidden; background: var(--fill); }
.photo-preview img { width: 100%; max-height: 280px; object-fit: cover; display: block; }
.photo-x { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border-radius: 50%; background: rgba(0,0,0,.5); color: #fff; backdrop-filter: blur(10px); }

/* Analysis result */
.result { display: flex; flex-direction: column; gap: 12px; }
.result.anim { animation: fadeIn .3s var(--ease); }
.res-head { padding: 16px; display: flex; gap: 14px; align-items: center; }
.score { width: 56px; height: 56px; border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; flex: none; font-weight: 800; font-size: 22px; line-height: 1; }
.score small { font-size: 9px; font-weight: 600; margin-top: 3px; opacity: .9; }
.v-baik { background: var(--green); } .v-batasi { background: var(--orange); } .v-hindari { background: var(--red); }
.res-title { font-weight: 700; font-size: 18px; letter-spacing: -.02em; }
.totals { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 1px; background: var(--sep); border-radius: 16px; overflow: hidden; }
.totals > div { background: var(--card); padding: 10px 6px; text-align: center; }
.totals .v { font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; } .totals .l { font-size: 11px; color: var(--label2); }
.item-row { padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; position: relative; }
.item-row + .item-row::before { content: ''; position: absolute; top: 0; left: 16px; right: 0; height: .5px; background: var(--sep); }
.item-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.item-name { font-weight: 600; } .item-meta { font-size: 13px; color: var(--label2); }
.qty { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.qty button { min-width: 38px; height: 28px; border-radius: 8px; background: var(--fill2); font-size: 13px; font-weight: 600; padding: 0 8px; }
.qty button.on { background: var(--blue); color: #fff; }
.qty .del { color: var(--red); margin-left: auto; background: none; }
.note-card { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
.note-card .nh { display: flex; gap: 8px; align-items: center; font-weight: 700; }
.note-card ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.note-card .meta { font-size: 12px; color: var(--label3); }
.pur-tag { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px; }

/* Alert strip */
.alert-strip { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 16px; font-size: 14px;
  background: color-mix(in srgb, var(--red) 12%, var(--card)); color: var(--label); }
.alert-strip i { color: var(--red); margin-top: 2px; }
.alert-strip.warn { background: color-mix(in srgb, var(--orange) 14%, var(--card)); } .alert-strip.warn i { color: var(--orange); }
.alert-strip.info { background: color-mix(in srgb, var(--blue) 10%, var(--card)); } .alert-strip.info i { color: var(--blue); }
#alertStrip { display: flex; flex-direction: column; gap: 8px; } #alertStrip:empty { display: none; }

.tip-card { padding: 16px; font-size: 14px; display: flex; flex-direction: column; gap: 8px; }
.tip-card ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }

/* Settings */
.set-group { display: flex; flex-direction: column; gap: 6px; }
.set-group > .gh { font-size: 13px; color: var(--label2); text-transform: uppercase; padding: 0 16px; letter-spacing: .02em; }
.set-group > .gf { font-size: 12px; color: var(--label2); padding: 0 16px; }
.srow { display: flex; align-items: center; gap: 12px; padding: 8px 16px; min-height: 48px; position: relative; }
.srow + .srow::before { content: ''; position: absolute; top: 0; left: 16px; right: 0; height: .5px; background: var(--sep); }
.srow .grow { flex: 1; min-width: 0; }
.srow input[type=number], .srow input[type=time], .srow input[type=text], .srow input[type=password], .srow select {
  width: 120px; text-align: right; border: 0; background: transparent; font-size: 16px; color: var(--label2); outline: none; padding: 6px 0; }
.srow input[type=text], .srow input[type=password] { width: 160px; }
.srow select { width: auto; -webkit-appearance: none; appearance: none; }
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--fill); border-radius: 99px; transition: background .2s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; width: 27px; height: 27px; left: 2px; top: 2px; background: #fff; border-radius: 50%; box-shadow: 0 3px 8px rgba(0,0,0,.15); transition: transform .25s var(--ease); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(20px); }

/* Tabbar */
.tabbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--safe-b) + 10px); z-index: 40; display: flex; align-items: center; gap: 2px;
  padding: 6px; border-radius: 99px; background: var(--glass); backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px);
  box-shadow: var(--shadow-float); border: .5px solid var(--sep); width: min(440px, calc(100% - 24px)); justify-content: space-between; }
.tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; border-radius: 99px; color: var(--label2); font-size: 10px; font-weight: 600; transition: color .2s, background .2s; }
.tabbar button i { font-size: 19px; }
.tabbar button.on { color: var(--blue); background: var(--fill2); }
.tabbar .tab-add { flex: none; width: 52px; height: 52px; border-radius: 50%; background: var(--blue); color: #fff; justify-content: center; margin: 0 4px; box-shadow: 0 6px 18px color-mix(in srgb, var(--blue) 45%, transparent); }
.tabbar .tab-add i { font-size: 22px; }

/* Camera */
.camera { position: fixed; inset: 0; z-index: 80; background: #000; display: flex; flex-direction: column; }
.camera video { flex: 1; width: 100%; height: 100%; object-fit: cover; }
.cam-top { position: absolute; top: 0; left: 0; right: 0; padding: calc(var(--safe-t) + 12px) 16px 12px; display: flex; justify-content: space-between; align-items: center; color: #fff; font-size: 13px; }
.cam-top span { background: rgba(0,0,0,.45); padding: 6px 12px; border-radius: 99px; backdrop-filter: blur(10px); }
.cam-top button { width: 40px; height: 40px; border-radius: 50%; background: rgba(0,0,0,.45); color: #fff; font-size: 18px; backdrop-filter: blur(10px); }
.cam-bottom { position: absolute; bottom: 0; left: 0; right: 0; padding: 20px 0 calc(var(--safe-b) + 30px); display: flex; justify-content: center; }
.shutter { width: 76px; height: 76px; border-radius: 50%; border: 4px solid #fff; display: flex; align-items: center; justify-content: center; }
.shutter span { width: 60px; height: 60px; border-radius: 50%; background: #fff; transition: transform .1s; }
.shutter:active span { transform: scale(.88); }
.camera.flash::after { content: ''; position: absolute; inset: 0; background: #fff; animation: flash .3s forwards; }
@keyframes flash { to { opacity: 0 } }

/* Banner & alert */
.banner { position: fixed; top: calc(var(--safe-t) + 8px); left: 50%; transform: translate(-50%, -150%); z-index: 95; width: min(420px, calc(100% - 20px));
  background: var(--glass); backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px); border-radius: 20px;
  box-shadow: var(--shadow-float); padding: 12px 14px; display: flex; gap: 12px; align-items: center; transition: transform .45s var(--ease); font-size: 14px; }
.banner.show { transform: translate(-50%, 0); }
.banner .bt { font-weight: 700; font-size: 15px; }
.alert-wrap { position: fixed; inset: 0; z-index: 99; background: rgba(0,0,0,.3); display: flex; align-items: center; justify-content: center; padding: 24px; animation: fade .2s; }
.alert { width: 270px; background: var(--glass); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); border-radius: 14px; overflow: hidden; text-align: center; animation: pop .25s var(--ease); }
@keyframes pop { from { transform: scale(1.12); opacity: 0 } }
.alert-body { padding: 18px 16px; display: flex; flex-direction: column; gap: 4px; }
.alert-body .t-sub { font-size: 13px; }
.alert-btns { display: flex; border-top: .5px solid var(--sep); }
.alert-btns button { flex: 1; min-height: 44px; color: var(--blue); font-size: 17px; }
.alert-btns button + button { border-left: .5px solid var(--sep); }
.alert-btns button.bold { font-weight: 600; } .alert-btns button.danger { color: var(--red); }

@media (min-width: 600px) {
  .nutri-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .stat-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
}
@media (max-width: 380px) {
  .ring-wrap { width: 140px; height: 140px; }
  .ring-center .big { font-size: 28px; }
  .hero-card { gap: 12px; padding: 14px; }
  .large-title { font-size: 30px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
