/* FitBhai — black & white, Mona Sans, rounded. Color only where it means something. */

@font-face {
  font-family: 'Mona Sans';
  src: url('/fonts/mona-sans-latin-standard-normal.woff2') format('woff2');
  font-weight: 200 900;
  font-stretch: 75% 125%;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Mona Sans';
  src: url('/fonts/mona-sans-latin-ext-standard-normal.woff2') format('woff2');
  font-weight: 200 900;
  font-stretch: 75% 125%;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --font: 'Mona Sans', -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
  --bg: #ffffff;
  --ink: #000000;
  --ink-2: #666666;
  --ink-3: #a6a6a6;
  --line: #e6e6e6;
  --surface: #f4f4f4;
  --surface-2: #e9e9e9;
  --water: #1a56ff;      /* the only blue: water */
  --warn: #e0362f;       /* the only red: overdue / errors */
  --r-sheet: 24px;
  --r-card: 16px;
  --r-pill: 999px;
  --tab-h: 60px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; overscroll-behavior: none; }
body {
  margin: 0; height: 100%; width: 100%; position: fixed; inset: 0; overflow: hidden;
  background: var(--bg); color: var(--ink);
  font: 400 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none;
}
input, textarea, [contenteditable], .selectable { -webkit-user-select: text; user-select: text; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
svg.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

#app { position: fixed; top: 0; left: 0; width: 100%; height: 100%; display: flex; flex-direction: column; }
#screens { position: relative; flex: 1; min-height: 0; }
.screen {
  position: absolute; inset: 0; display: none; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: calc(var(--sat) + 14px) 20px calc(var(--tab-h) + var(--sab) + 28px);
}
.screen.active { display: block; }
.screen[data-screen="coach"] { padding-bottom: calc(var(--tab-h) + var(--sab) + 112px); }
.screen[data-screen="pin"], .screen[data-screen="setup"] { padding-bottom: calc(var(--sab) + 24px); }

/* ---------- type ---------- */
.eyebrow { font-size: 13px; color: var(--ink-2); }
.h-screen { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; font-stretch: 105%; }
.h-section { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 26px 0 4px; }
.h-section small { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 13px; }
.num { font-variant-numeric: lining-nums; }
.bn { font-family: -apple-system, system-ui, 'Noto Sans Bengali', sans-serif; }
.wide { font-stretch: 112%; }

/* ---------- header ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.topbar .date { font-size: 13px; color: var(--ink-2); }
.iconbtn { width: 44px; height: 44px; margin: -11px; border: 0; background: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--ink); }
.iconbtn:active { background: var(--surface); }

/* ---------- hero ---------- */
.hero { padding: 6px 0 2px; }
.hero .row-kg { display: flex; align-items: baseline; justify-content: space-between; }
.hero .kg { font-size: 68px; font-weight: 700; font-stretch: 115%; letter-spacing: -0.035em; line-height: 1; }
.hero .kg small { font-size: 22px; font-weight: 600; color: var(--ink-2); letter-spacing: 0; font-stretch: 100%; margin-left: 4px; }
.hero .goal { text-align: right; color: var(--ink-2); font-size: 13px; line-height: 1.3; }
.hero .goal b { display: block; color: var(--ink); font-size: 22px; font-weight: 700; font-stretch: 110%; letter-spacing: -0.02em; }
.track { position: relative; height: 3px; background: var(--line); border-radius: 2px; margin: 16px 0 10px; }
.track i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ink); border-radius: 2px; }
.track b { position: absolute; top: 50%; width: 11px; height: 11px; border-radius: 50%; background: var(--ink); transform: translate(-50%, -50%); box-shadow: 0 0 0 3px #fff; }
.hero .meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); }
.headline { font-size: 18px; font-weight: 550; line-height: 1.35; letter-spacing: -0.01em; margin: 16px 0 4px; }

/* ---------- banners ---------- */
.banner { background: var(--ink); color: #fff; border-radius: var(--r-card); padding: 14px 16px; margin: 16px 0 4px; }
.banner.warn { background: var(--warn); }
.banner p { font-size: 15px; line-height: 1.35; }
.banner .actions { display: flex; gap: 8px; margin-top: 12px; }
.banner .btn { background: #fff; color: var(--ink); }
.banner .btn.ghost { background: rgba(255,255,255,.18); color: #fff; }
.note { background: var(--surface); border-radius: var(--r-card); padding: 14px 16px; margin: 12px 0; }
.note p + p { margin-top: 6px; }

/* ---------- lists ---------- */
.list { margin: 0; padding: 0; list-style: none; }
.row { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line); min-height: 56px; }
.list > .row:last-child { border-bottom: 0; }
.row .body { flex: 1; min-width: 0; }
.row .title { font-size: 16px; font-weight: 550; letter-spacing: -0.01em; }
.row .sub { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.row .right { text-align: right; font-size: 13px; color: var(--ink-2); flex: none; }
.row .right b { display: block; color: var(--ink); font-size: 15px; font-weight: 600; }
.row.tap { cursor: pointer; }
.row.tap:active .title { color: var(--ink-2); }
.row.done .title { color: var(--ink-2); }

/* status circle for sessions and meals */
.check { width: 28px; height: 28px; border-radius: 50%; border: 1.8px solid var(--ink); display: inline-flex; align-items: center; justify-content: center; flex: none; background: #fff; color: #fff; padding: 0; }
.check svg { width: 16px; height: 16px; stroke-width: 2.4; }
.check.on { background: var(--ink); }
.check.overdue { border-color: var(--warn); color: var(--warn); }
.check.skipped { border-color: var(--ink-3); color: var(--ink-3); background: var(--surface); }
.check.missed { border-color: var(--ink-3); background: var(--surface); }
.typeic { width: 40px; height: 40px; border-radius: 12px; background: var(--surface); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.typeic svg { width: 22px; height: 22px; }
.typeic.done { background: var(--ink); color: #fff; }

.details { margin: 2px 0 0; padding: 0 0 0 54px; list-style: none; }
.details li { font-size: 14px; color: var(--ink-2); padding: 3px 0; border-left: 2px solid var(--line); padding-left: 10px; }
.session-actions { display: flex; gap: 8px; padding: 10px 0 14px 54px; }
.verdict { padding: 8px 0 12px 54px; font-size: 14px; }
.verdict.rejected { color: var(--warn); }
.verdict.accepted { color: var(--ink-2); }

/* ---------- buttons ---------- */
.btn {
  appearance: none; border: 0; border-radius: var(--r-pill); padding: 12px 18px; min-height: 46px;
  font: 600 15px/1.2 var(--font); background: var(--ink); color: #fff; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; letter-spacing: -0.005em;
}
.btn:active { opacity: .85; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.ghost { background: var(--surface); color: var(--ink); }
.btn.line { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.btn.sm { padding: 8px 14px; min-height: 36px; font-size: 14px; }
.btn.xs { padding: 6px 11px; min-height: 30px; font-size: 13px; }
.btn.block { width: 100%; }
.btn.danger { background: var(--warn); color: #fff; }
.btn.water { background: var(--water); color: #fff; }
.btn svg.ic { width: 18px; height: 18px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row.end { justify-content: flex-end; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; display: inline-block; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -20px; padding: 0 20px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { border: 1.5px solid var(--line); background: #fff; border-radius: var(--r-pill); padding: 8px 14px; font-size: 14px; font-weight: 500; white-space: nowrap; min-height: 36px; display: inline-flex; align-items: center; gap: 6px; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip.sm { padding: 5px 10px; font-size: 12px; min-height: 28px; }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: var(--r-pill); background: var(--surface); }
.tag .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink); }
.tag.careful .dot { background: var(--ink-3); }
.tag.avoid .dot { background: var(--warn); }
.tag.ok .dot { background: var(--ink-2); }

/* ---------- water ---------- */
.water { display: flex; align-items: center; gap: 16px; background: var(--surface); border-radius: var(--r-card); padding: 14px 16px; margin-top: 12px; }
.ring { width: 64px; height: 64px; flex: none; }
.ring circle { fill: none; stroke-width: 6; }
.ring .bg { stroke: #fff; }
.ring .fg { stroke: var(--water); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dashoffset .4s ease; }
.water .body { flex: 1; }
.water .amt { font-size: 22px; font-weight: 700; font-stretch: 108%; letter-spacing: -0.02em; line-height: 1.1; }
.water .amt small { font-size: 13px; font-weight: 500; color: var(--ink-2); letter-spacing: 0; font-stretch: 100%; }
.water .btns { display: flex; gap: 6px; margin-top: 8px; }
.water .btn { background: #fff; color: var(--ink); }

/* ---------- meals ---------- */
.meal { padding: 12px 0; border-bottom: 1px solid var(--line); }
.meal:last-child { border-bottom: 0; }
.meal .head { display: flex; align-items: center; gap: 12px; }
.meal .head .title { font-size: 16px; font-weight: 600; flex: 1; }
.meal .head .time { font-size: 13px; color: var(--ink-2); }
.meal.eaten .head .title { color: var(--ink-2); }
.items { margin: 8px 0 0; padding: 0; list-style: none; }
.items li { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0 5px 40px; font-size: 15px; }
.items li .n { flex: 1; min-width: 0; }
.items li .n span { color: var(--ink-2); font-size: 13px; margin-left: 6px; }
.items li .k { color: var(--ink-2); font-size: 13px; white-space: nowrap; }
.meal .mnote { padding-left: 40px; font-size: 13px; color: var(--ink-2); margin-top: 4px; }
.bar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ink); border-radius: 3px; }
.bar.over i { background: var(--warn); }
.targets { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 10px; }
.targets .t b { font-size: 24px; font-weight: 700; font-stretch: 108%; letter-spacing: -0.02em; }
.targets .t b small { font-size: 13px; font-weight: 500; color: var(--ink-2); letter-spacing: 0; font-stretch: 100%; }
.targets .t .lbl { font-size: 13px; color: var(--ink-2); margin: 2px 0 6px; }

/* ---------- week strip & bars ---------- */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 10px 0 4px; }
.week .d { text-align: center; font-size: 12px; color: var(--ink-2); }
.week .d.today { color: var(--ink); font-weight: 650; }
.week .d i { display: block; width: 26px; height: 26px; margin: 6px auto 0; border-radius: 50%; border: 1.8px solid var(--line); }
.week .d i.full { background: var(--ink); border-color: var(--ink); }
.week .d i.part { border-color: var(--ink); background: linear-gradient(90deg, var(--ink) 50%, #fff 50%); }
.week .d i.none { border-color: var(--ink-3); }
.week .d i.rest { border-color: var(--line); background: var(--surface); }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: var(--font); font-size: 11px; fill: var(--ink-2); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: var(--line); }
.chart .bar { fill: var(--ink); }
.chart .bar.empty { fill: var(--surface-2); }
.chart .line { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: #fff; stroke: var(--ink); stroke-width: 2; }
.chart .dot.last { fill: var(--ink); }
.chart .goal { stroke: var(--ink-3); stroke-dasharray: 3 4; }
.chart .focus text { fill: var(--ink); font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.stats .s { background: var(--surface); border-radius: 12px; padding: 10px 12px; }
.stats .s b { display: block; font-size: 20px; font-weight: 700; font-stretch: 108%; letter-spacing: -0.02em; }
.stats .s span { font-size: 12px; color: var(--ink-2); }

/* ---------- forms ---------- */
.field { margin: 14px 0; }
.field label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.field input[type=text], .field input[type=number], .field input[type=time], .field input[type=password], .field select, .field textarea {
  width: 100%; font: 400 16px/1.3 var(--font); padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); appearance: none; -webkit-appearance: none; min-height: 48px;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--ink); outline: none; }
.field textarea { resize: none; }
.field .unit { position: relative; }
.field .unit span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-2); font-size: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid2 .field { margin: 8px 0; }
.seg { display: flex; background: var(--surface); border-radius: 12px; padding: 3px; }
.seg button { flex: 1; border: 0; background: none; border-radius: 10px; padding: 10px 6px; font-size: 14px; font-weight: 550; color: var(--ink-2); min-height: 42px; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.stepper { display: inline-flex; align-items: center; gap: 0; background: var(--surface); border-radius: var(--r-pill); }
.stepper button { width: 44px; height: 44px; border: 0; background: none; font-size: 22px; font-weight: 500; border-radius: 50%; }
.stepper b { min-width: 36px; text-align: center; font-size: 18px; font-weight: 650; }
.toggle { width: 50px; height: 30px; border-radius: 15px; background: var(--surface-2); border: 0; position: relative; flex: none; padding: 0; transition: background .2s; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.toggle.on { background: var(--ink); }
.toggle.on::after { transform: translateX(20px); }
.err { color: var(--warn); font-size: 14px; margin-top: 8px; min-height: 1.2em; }
.help { font-size: 13px; color: var(--ink-2); line-height: 1.45; }
.help p + p { margin-top: 6px; }

/* ---------- PIN ---------- */
.pin-wrap { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px 0; }
.brand { font-size: 34px; font-weight: 800; font-stretch: 118%; letter-spacing: -0.03em; }
.brand span { color: var(--ink-3); }
.dots { display: flex; gap: 14px; margin: 26px 0 30px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; border: 1.8px solid var(--ink); }
.dots i.on { background: var(--ink); }
.dots.shake { animation: shake .4s; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 76px); gap: 14px; }
.keypad button { width: 76px; height: 76px; border-radius: 50%; border: 0; background: var(--surface); font-size: 28px; font-weight: 500; font-stretch: 105%; display: inline-flex; align-items: center; justify-content: center; }
.keypad button:active { background: var(--surface-2); }
.keypad button.blank { background: none; }
.keypad button svg { width: 26px; height: 26px; }

/* ---------- setup ---------- */
.progress { height: 3px; background: var(--line); border-radius: 2px; margin: 4px 0 22px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--ink); transition: width .3s ease; }
.setup-foot { display: flex; gap: 10px; margin-top: 26px; }
.access { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- tab bar ---------- */
#tabbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 20;
  height: calc(var(--tab-h) + var(--sab)); padding: 0 6px var(--sab);
  background: rgba(255,255,255,.96); -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
}
#tabbar[hidden] { display: none; }
.tab { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--ink-3); font-size: 10.5px; font-weight: 600; padding: 6px 0; height: var(--tab-h); justify-content: center; }
.tab svg.ic { width: 24px; height: 24px; }
.tab.active { color: var(--ink); }
.tab.active svg.ic { stroke-width: 2.3; }
.tab.badge { position: relative; }
.tab.badge::after { content: ''; position: absolute; top: 9px; right: calc(50% - 16px); width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.tab-scan { display: flex; align-items: center; justify-content: center; }
.tab-scan button { width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; display: inline-flex; align-items: center; justify-content: center; margin-top: -22px; box-shadow: 0 0 0 5px #fff; }
.tab-scan button svg.ic { width: 26px; height: 26px; stroke-width: 1.9; }
.tab-scan button:active { transform: scale(.96); }

/* ---------- chat ---------- */
.chat { display: flex; flex-direction: column; gap: 10px; padding-top: 6px; }
.msg { max-width: 86%; padding: 11px 14px; border-radius: 20px; font-size: 15px; line-height: 1.4; white-space: pre-wrap; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 6px; }
.msg.coach { align-self: flex-start; background: var(--surface); border-bottom-left-radius: 6px; }
.msg.error { background: #fff; box-shadow: inset 0 0 0 1.5px var(--warn); color: var(--warn); }
.msg img { border-radius: 12px; margin-bottom: 8px; max-height: 220px; width: auto; }
.msg .verd { font-size: 12px; font-weight: 600; margin-bottom: 4px; color: var(--ink-2); }
.msg .verd.rejected { color: var(--warn); }
.acts { display: flex; flex-wrap: wrap; gap: 6px; align-self: flex-start; max-width: 86%; margin-top: -4px; }
.acts span { font-size: 12px; font-weight: 500; padding: 5px 10px; border-radius: var(--r-pill); border: 1.5px solid var(--line); color: var(--ink-2); }
.acts span::before { content: '✓ '; }
.typing { align-self: flex-start; background: var(--surface); border-radius: 20px; border-bottom-left-radius: 6px; padding: 14px 16px; display: flex; gap: 5px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
.chat-empty { text-align: center; padding: 60px 20px 20px; color: var(--ink-2); }
.chat-empty b { display: block; color: var(--ink); font-size: 20px; font-weight: 700; margin-bottom: 6px; }
#composer {
  position: absolute; left: 0; right: 0; bottom: calc(var(--tab-h) + var(--sab)); z-index: 15;
  background: #fff; border-top: 1px solid var(--line); padding: 8px 12px 8px;
}
#composer[hidden] { display: none; }
.composer-row { display: flex; gap: 8px; align-items: flex-end; }
.composer-row textarea { flex: 1; font: 400 16px/1.3 var(--font); padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 22px; min-height: 44px; max-height: 120px; resize: none; background: var(--surface); color: var(--ink); }
.composer-row textarea:focus { outline: none; border-color: var(--ink); background: #fff; }
.composer-row .iconbtn { margin: 0; background: var(--surface); }
.composer-row .send { background: var(--ink); color: #fff; }
.composer-row .send[disabled] { opacity: .35; }
.composer .preview { display: flex; align-items: center; gap: 10px; padding: 0 0 8px; font-size: 13px; color: var(--ink-2); }
.composer .preview img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; }
.quick { padding: 0 0 8px; }

/* ---------- sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 40; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; background: #fff; border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  padding: 10px 20px calc(var(--sab) + 22px); max-height: 90%; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
}
.sheet .grab { width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 14px; }
.sheet .h-sheet { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 4px; }
.sheet .sub { color: var(--ink-2); font-size: 14px; }
@media (prefers-reduced-motion: no-preference) {
  .sheet { animation: up .28s cubic-bezier(.2,.8,.2,1); }
  .sheet-backdrop { animation: fade .2s ease; }
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } }

/* scan */
.scan-pick { display: grid; gap: 10px; margin-top: 16px; }
.scan-pick .btn { min-height: 60px; font-size: 16px; }
.scan-preview { position: relative; border-radius: var(--r-card); overflow: hidden; background: var(--surface); margin-top: 14px; }
.scan-preview img { width: 100%; max-height: 300px; object-fit: cover; }
.scan-wait { display: flex; align-items: center; gap: 10px; color: var(--ink-2); padding: 14px 0; }
.scan-result .items li { padding-left: 0; }
.scan-result .tot { display: flex; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--line); margin-top: 4px; font-weight: 600; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 14px; margin-top: 8px; }
.kv dt { color: var(--ink-2); } .kv dd { margin: 0; font-weight: 550; }
.coach-note { background: var(--surface); border-radius: var(--r-card); padding: 12px 14px; margin-top: 12px; font-size: 15px; line-height: 1.4; }

/* settings groups */
.group { margin-top: 22px; }
.group .gh { font-size: 13px; color: var(--ink-2); margin-bottom: 4px; }
.group .row { min-height: 52px; padding: 10px 0; }
.group .row .title { font-size: 15px; font-weight: 500; }
.group .row .val { color: var(--ink-2); font-size: 14px; }
.chev { color: var(--ink-3); }
.memory li { font-size: 14px; padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: flex-start; }
.memory li span { flex: 1; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--ink-2); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- toast ---------- */
#toast { position: fixed; left: 50%; top: calc(var(--sat) + 14px); transform: translateX(-50%) translateY(-20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--r-pill); font-size: 14px; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60; max-width: 90%; text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.bad { background: var(--warn); }

.empty { text-align: center; color: var(--ink-2); padding: 28px 16px; font-size: 14px; }
.empty b { display: block; color: var(--ink); font-size: 17px; margin-bottom: 4px; }
.center { text-align: center; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; } .mb8 { margin-bottom: 8px; }
.icon-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.icon-list button { border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 4px 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; }
.icon-list button.on { border-color: var(--ink); background: var(--ink); color: #fff; }
.install-steps { counter-reset: s; margin: 10px 0 0; padding: 0; list-style: none; }
.install-steps li { counter-increment: s; display: flex; gap: 12px; padding: 8px 0; font-size: 14px; }
.install-steps li::before { content: counter(s); width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: none; }

@media (min-width: 560px) {
  #app { max-width: 480px; left: 50%; transform: translateX(-50%); border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
  .sheet { left: calc(50% - 240px); width: 480px; right: auto; }
  #toast { left: 50%; }
}
