:root {
  --bg: #f6f3ec; --card: #ffffff; --ink: #1f2a24; --ink2: #5c665f; --ink3: #8b938d;
  --line: #e7e2d8; --brand: #2f7d62; --brand-ink: #ffffff; --brand-soft: #e3f1ea;
  --boy: #2a78d6; --boy-soft: #e4effb; --girl: #d4537e; --girl-soft: #fbeaf0;
  --ok: #2f7d62; --ok-soft: #e3f1ea; --warn: #9a6208; --warn-soft: #fbf0da; --bad: #b3312f; --bad-soft: #fbe7e6;
  --r: 14px; --shadow: 0 1px 2px rgba(31, 42, 36, .06), 0 6px 20px rgba(31, 42, 36, .05);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: Nunito, system-ui, sans-serif; font-size: 16px; }
main { max-width: 520px; margin: 0 auto; padding: 16px 16px calc(32px + env(safe-area-inset-bottom)); min-height: 100vh; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 18px; font-weight: 800; }
.muted { color: var(--ink2); }
.small { font-size: 13px; }
.tiny { font-size: 12px; color: var(--ink3); }
.card { background: var(--card); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stack > * + * { margin-top: 10px; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 18px; border-radius: 12px; font-weight: 700; background: var(--brand); color: var(--brand-ink); width: 100%; transition: transform .1s, filter .15s; }
.btn:active { transform: scale(.98); }
.btn:disabled { filter: grayscale(.5) opacity(.6); }
.btn.ghost { background: transparent; color: var(--ink2); }
.btn.soft { background: var(--brand-soft); color: var(--brand); }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink2); }
.icon-btn:active { background: var(--line); }
label.f { display: block; font-size: 13px; font-weight: 700; color: var(--ink2); margin-bottom: 6px; }
input[type=text], input[type=number], input[type=date] { width: 100%; height: 48px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; padding: 0 14px; font: inherit; font-size: 18px; color: var(--ink); outline: none; transition: border-color .15s; }
input:focus { border-color: var(--brand); }
.unit { position: relative; }
.unit span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--ink3); font-size: 14px; pointer-events: none; }
.unit input { padding-right: 44px; }
.err { color: var(--bad); font-size: 13px; min-height: 0; }
.err:not(:empty) { margin-top: 8px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { height: 38px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; font-weight: 700; font-size: 14px; color: var(--ink2); display: inline-flex; align-items: center; gap: 6px; }
.chip.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.seg { display: flex; background: var(--bg); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { flex: 1; height: 38px; border-radius: 9px; font-weight: 700; font-size: 14px; color: var(--ink2); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; flex: none; }
.avatar.s1 { background: var(--boy-soft); color: var(--boy); }
.avatar.s2 { background: var(--girl-soft); color: var(--girl); }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }
.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.pill.success { background: var(--ok-soft); color: var(--ok); }
.pill.warning { background: var(--warn-soft); color: var(--warn); }
.pill.danger { background: var(--bad-soft); color: var(--bad); }
.kid { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer; }
.kid:first-of-type { border-top: 0; }
.kid .name { font-weight: 800; }
.kid .chev { margin-left: auto; color: var(--ink3); }
.top { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 16px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 20px; color: var(--brand); }
.me { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--line); }
.date-line { display: flex; align-items: center; gap: 8px; color: var(--ink2); font-weight: 700; font-size: 14px; }
.date-line input { width: auto; height: 32px; font-size: 14px; padding: 0 8px; border-radius: 8px; }
.metric { background: var(--bg); border-radius: 12px; padding: 12px; }
.metric .big { font-size: 30px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.gauge { position: relative; height: 12px; border-radius: 999px; margin: 14px 0 6px; background: linear-gradient(90deg, #f6dfb0 0 2.3%, #cfe8dc 2.3% 97.7%, #f6dfb0 97.7%); }
.gauge .dot { position: absolute; top: 50%; left: 0; width: 22px; height: 22px; margin-left: -11px; border-radius: 50%; background: var(--ink); border: 4px solid #fff; transform: translateY(-50%); box-shadow: 0 2px 6px rgba(0,0,0,.25); transition: left 1.4s cubic-bezier(.2, .8, .2, 1); }
.gauge-l { position: relative; height: 14px; font-size: 11px; color: var(--ink3); }
.gauge-l span { position: absolute; transform: translateX(-50%); }
.gauge-l span:first-child { transform: none; margin-left: -2px; }
.gauge-l span:last-child { transform: translateX(-100%); margin-left: 2px; }
.chart-wrap { position: relative; height: 300px; margin-top: 8px; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--ink2); margin-top: 12px; }
.legend i { display: inline-block; width: 16px; height: 0; border-top: 2px solid; vertical-align: middle; margin-right: 5px; }
.hist { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.hist .d { flex: 1; }
.empty { text-align: center; padding: 28px 16px; }
.empty .ic { font-size: 40px; margin-bottom: 6px; }
.login { min-height: calc(100vh - 48px); display: flex; flex-direction: column; justify-content: center; text-align: center; }
.login .hero { margin: 0 auto 20px; width: 220px; }
#gbtn { display: flex; justify-content: center; min-height: 44px; margin-top: 24px; }
.sheet-bg { position: fixed; inset: 0; background: rgba(20, 28, 24, .45); display: flex; align-items: flex-end; justify-content: center; z-index: 50; animation: fade .2s; }
.sheet { background: var(--card); width: 100%; max-width: 520px; border-radius: 20px 20px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); animation: up .25s cubic-bezier(.2, .8, .2, 1); max-height: 92vh; overflow: auto; }
.price { font-size: 34px; font-weight: 800; margin: 8px 0 2px; }
#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; font-weight: 700; font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 60; max-width: 90vw; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.boot { min-height: 80vh; display: flex; align-items: center; justify-content: center; }
.spinner { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite; }
.enter { animation: up .35s cubic-bezier(.2, .8, .2, 1) both; }
.enter2 { animation: up .35s .08s cubic-bezier(.2, .8, .2, 1) both; }
.enter3 { animation: up .35s .16s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
