/* ── Demo phone: hardware ─────────────────────────────────────── */
.phone-host { display: grid; place-items: center; }
.phone {
  --pw: 300px; --ph: 620px;
  width: var(--pw); height: var(--ph); position: relative; transform-style: preserve-3d;
}
.phone::before { /* frame */
  content: ''; position: absolute; inset: -9px; border-radius: 54px;
  background: linear-gradient(140deg, #3b4b52, #11191c 38%, #2c3c42 68%, #0c1215);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .22) inset, 0 40px 70px -30px rgba(8, 40, 52, .55), 0 18px 30px -18px rgba(8, 40, 52, .4);
}
.phone-edge { position: absolute; inset: -9px; border-radius: 54px; background: #0b1215; transform: translateZ(-12px); }
.screen {
  position: absolute; inset: 0; border-radius: 45px; overflow: hidden; transform: translateZ(1px);
  background: #f5f8fb; color: #151c20;
  font-family: Roboto, 'Segoe UI', system-ui, sans-serif; font-size: 13px; line-height: 1.35;
}
.phone.static .screen { pointer-events: none; }
.glare {
  position: absolute; inset: 0; pointer-events: none; border-radius: inherit; z-index: 9;
  background: linear-gradient(118deg, transparent 32%, rgba(255, 255, 255, .22) 44%, transparent 56%);
  mix-blend-mode: soft-light;
}
.status { height: 40px; display: flex; justify-content: space-between; align-items: flex-end; padding: 0 28px 5px; font-size: 12px; font-weight: 600; }
.status-r { display: flex; gap: 3px; align-items: flex-end; }
.status-r i { width: 3px; background: currentColor; border-radius: 1px; }
.status-r i:nth-child(1) { height: 5px; } .status-r i:nth-child(2) { height: 8px; } .status-r i:nth-child(3) { height: 11px; }
.status-r b { width: 18px; height: 9px; border: 1.4px solid currentColor; border-radius: 3px; margin-left: 4px; background: linear-gradient(90deg, currentColor 64%, transparent 64%) 1px 1px / calc(100% - 2px) calc(100% - 2px) no-repeat; }

/* ── App chrome ──────────────────────────────────────────────── */
.app-body { position: absolute; top: 40px; left: 0; right: 0; bottom: 74px; overflow-y: auto; padding: 8px 16px 44px; scrollbar-width: none; }
.app-body::-webkit-scrollbar { display: none; }
.app-body:not(.still) > * { animation: appIn .45s cubic-bezier(.2, .75, .1, 1) both; }
.app-body > *:nth-child(2) { animation-delay: .04s; } .app-body > *:nth-child(3) { animation-delay: .08s; }
.app-body > *:nth-child(4) { animation-delay: .12s; } .app-body > *:nth-child(5) { animation-delay: .16s; } .app-body > *:nth-child(n+6) { animation-delay: .2s; }
@keyframes appIn { from { opacity: 0; transform: translateY(10px); } }

.fab {
  position: absolute; left: 50%; bottom: 40px; width: 58px; height: 58px; margin-left: -29px; z-index: 4;
  border-radius: 18px; background: #0277bd; color: #fff; display: grid; place-items: center;
  box-shadow: 0 10px 20px -8px rgba(2, 119, 189, .75);
  transition: transform .3s cubic-bezier(.2, .75, .1, 1);
}
.fab svg { width: 26px; height: 26px; transition: transform .35s; }
.fab:hover { transform: translateY(-2px); }
.fab.open svg { transform: rotate(45deg); }
.app-nav { position: absolute; left: 0; right: 0; bottom: 0; height: 74px; display: grid; grid-template-columns: 1fr 1fr 58px 1fr 1fr; align-items: center; padding: 0 4px 12px; background: #e9eef3; z-index: 3; }
.app-nav button { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; color: #44525a; }
.app-nav svg { width: 22px; height: 22px; padding: 3px 14px; box-sizing: content-box; border-radius: 14px; transition: background .25s; }
.app-nav button.on { color: #10212b; font-weight: 700; }
.app-nav button.on svg { background: #c5e4f6; color: #0b5d8a; }

/* ── Views ───────────────────────────────────────────────────── */
.a-top { display: flex; justify-content: space-between; align-items: flex-start; }
.a-top > svg { width: 22px; height: 22px; color: #44525a; margin-top: 6px; }
.a-h { font-size: 27px; font-weight: 500; letter-spacing: -.01em; line-height: 1.15; margin: 4px 0 2px; }
.a-sub { font-size: 12px; color: #5b6b73; margin-bottom: 10px; }
.a-sec { font-weight: 600; font-size: 15px; margin: 14px 0 3px; }
.a-sec-row { display: flex; justify-content: space-between; align-items: center; }
.a-sec-row svg { width: 20px; height: 20px; color: #44525a; margin-top: 10px; }
.a-card { background: #fff; border-radius: 18px; padding: 12px 13px; box-shadow: 0 1px 2px rgba(16, 32, 42, .06), 0 6px 14px -8px rgba(16, 32, 42, .16); margin-bottom: 9px; }
.a-note { font-size: 10.5px; color: #6b7a82; margin-top: 8px; }

.metrics { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 10px; padding: 2px 16px 4px; scrollbar-width: none; scroll-snap-type: x mandatory; scroll-padding-inline: 16px; }
.metrics::-webkit-scrollbar { display: none; }
.metric { flex: 0 0 124px; padding: 13px 13px 12px; border-radius: 20px; color: #fff; scroll-snap-align: start; }
.metric svg { width: 24px; height: 24px; }
.metric small { display: block; font-size: 11px; opacity: .72; margin-top: 12px; }
.metric b { display: block; font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.metric span { font-size: 10.5px; opacity: .65; }
.m-rec { background: linear-gradient(160deg, #3b2c7e, #2a1d5c); }
.m-sleep { background: linear-gradient(160deg, #24457f, #1a3464); }
.m-rhr { background: linear-gradient(160deg, #1d3e62, #152b46); }

.streak { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center; }
.streak-ring { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #0277bd; color: #0277bd; display: grid; place-items: center; }
.streak-ring svg { width: 14px; height: 14px; }
.streak b { font-size: 26px; font-weight: 700; }
.streak small { display: block; font-size: 11px; color: #5b6b73; }
.streak-r { text-align: right; }
.streak-dots { display: flex; gap: 3px; justify-content: flex-end; }
.streak-dots i { width: 9px; height: 9px; border-radius: 50%; background: #ff8a3d; }

.today-h { display: flex; justify-content: space-between; font-size: 15px; margin-bottom: 8px; }
.today-h b:first-child { font-weight: 600; }
.today-g { display: grid; grid-template-columns: 88px 1fr; gap: 12px; align-items: center; }
.donut { width: 88px; height: 88px; transform: rotate(-90deg); }
.donut .seg { fill: none; stroke-width: 15; transition: stroke-dasharray .9s cubic-bezier(.2, .75, .1, 1); }
.donut text { transform: rotate(90deg); transform-origin: 44px 44px; font-size: 11px; font-weight: 700; fill: #3c4a52; }
.macro { font-size: 11px; margin-bottom: 7px; }
.macro div:first-child { display: flex; justify-content: space-between; }
.macro span { display: inline-flex; align-items: center; gap: 5px; }
.macro span i { width: 7px; height: 7px; border-radius: 50%; }
.macro em { font-style: normal; font-weight: 600; }
.bar { height: 4px; border-radius: 3px; background: #e3e9ed; margin-top: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 3px; transition: width .9s cubic-bezier(.2, .75, .1, 1); }
.bar-lg { height: 7px; }
.bar-lg i { background: #0b5d8a; }
.kcal-row { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 500; margin-top: 10px; }
.hint { display: flex; gap: 8px; align-items: flex-start; padding: 11px 12px; border-radius: 16px; background: #c9e6fb; color: #1e3a4c; font-size: 11.5px; }
.hint svg { width: 17px; height: 17px; flex-shrink: 0; }

.tabs { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; font-size: 13px; font-weight: 500; color: #3c4a52; border-bottom: 1px solid #d5dde2; margin: 6px -16px 12px; }
.tabs span { padding: 10px 0 9px; }
.tabs .on { color: #0b5d8a; box-shadow: inset 0 -3px 0 #0b5d8a; }
.search-row { display: flex; gap: 8px; align-items: center; }
.search { flex: 1; display: flex; align-items: center; gap: 10px; border: 1px solid #8a979e; border-radius: 6px; padding: 10px 12px; color: #52616a; font-size: 13px; }
.search svg, .scan svg { width: 20px; height: 20px; }
.scan { width: 40px; height: 40px; border: 1px solid #8a979e; border-radius: 50%; display: grid; place-items: center; }
.day-h { color: #0b5d8a; font-weight: 700; font-size: 12.5px; margin: 12px 0 6px; }
.entries { background: #fff; border-radius: 16px; overflow: hidden; box-shadow: 0 1px 2px rgba(16, 32, 42, .06), 0 6px 14px -8px rgba(16, 32, 42, .16); }
.entry { display: grid; grid-template-columns: 22px 1fr auto; gap: 12px; align-items: center; padding: 10px 13px; }
.entry + .entry { border-top: 1px solid #e3e9ed; }
.entry > svg { width: 20px; height: 20px; color: #44525a; }
.entry b { font-weight: 500; font-size: 13px; display: block; }
.entry small { font-size: 11px; color: #6b7a82; }
.entry > span { font-size: 11px; font-weight: 600; }
.entry.new { animation: flash 1.4s ease-out; }
@keyframes flash { from { background: #dcf0f5; } }

.ask-row {
  width: 100%; display: flex; align-items: center; gap: 8px; margin: 4px 0 4px; padding: 10px 12px; border-radius: 14px; text-align: left;
  background: linear-gradient(110deg, #0b3f52, #0b5d8a); color: #fff; font-size: 12.5px; font-weight: 600;
  box-shadow: 0 8px 16px -10px rgba(11, 93, 138, .8);
}
.ask-row svg { width: 16px; height: 16px; color: #7fe0f2; }
.ask-row span { flex: 1; }
.ask-row em { font-style: normal; font-size: 9.5px; font-weight: 600; padding: 3px 7px; border-radius: 99px; background: rgba(127, 224, 242, .18); color: #bff2fb; }
.corr { display: grid; grid-template-columns: 22px 1fr auto 24px; gap: 8px; align-items: center; padding-right: 8px; }
.corr > svg { width: 20px; height: 20px; }
.corr .dn { color: #e53935; } .corr .up { color: #43a047; }
.corr strong { font-size: 13px; font-weight: 600; display: block; line-height: 1.25; }
.corr small { font-size: 10px; color: #52616a; }
.corr-v { font-size: 13px; font-weight: 700; padding: 8px 8px; border-radius: 10px; }
.corr-v.neg { background: #fbe4e2; color: #e53935; }
.corr-v.pos { background: #e1f3e3; color: #43a047; }
.explain { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: #0b5d8a; background: #e2f2f8; transition: transform .2s; }
.explain svg { width: 13px; height: 13px; }
.explain:hover { transform: scale(1.12); }
.info-banner { display: flex; gap: 10px; padding: 12px 13px; border-radius: 16px; background: #0277bd; color: #fff; font-size: 11.5px; margin: 10px 0; }
.info-banner svg { width: 18px; height: 18px; flex-shrink: 0; }
.a-lbl { font-size: 13px; font-weight: 700; margin: 4px 0 7px; }
.a-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.a-chips button { font-size: 11px; padding: 6px 10px; border-radius: 9px; border: 1px solid #8a979e; background: #fff; }
.a-chips button.on { background: #cde8f7; border-color: #0b5d8a; color: #0b3f52; font-weight: 600; }
.mini-plot { width: 100%; height: 120px; display: block; margin-top: 4px; }
.mini-plot rect { fill: #f5f8fb; stroke: #e0e7ec; }
.mini-plot circle { fill: #0277bd; fill-opacity: .5; }
.mini-plot line { stroke-width: 2.2; stroke-linecap: round; }
.mini-plot line.neg { stroke: #e53935; } .mini-plot line.pos { stroke: #43a047; }
.mini-sent { font-size: 11.5px; color: #3c4a52; margin-top: 6px; }

.set-group { background: #fff; border-radius: 16px; overflow: hidden; box-shadow: 0 1px 2px rgba(16, 32, 42, .06), 0 6px 14px -8px rgba(16, 32, 42, .16); margin-top: 6px; transition: box-shadow .5s; }
.set-row { display: flex; align-items: center; gap: 10px; padding: 11px 13px; }
.set-row + .set-row { border-top: 1px solid #e3e9ed; }
.set-row > div { flex: 1; }
.set-row b { display: block; font-weight: 500; font-size: 13px; }
.set-row small { font-size: 10.5px; color: #6b7a82; }
.set-row .val { font-size: 11px; color: #52616a; text-align: right; max-width: 45%; }
.set-row .ok { display: inline-flex; align-items: center; gap: 5px; color: #2e7d32; font-size: 11px; font-weight: 700; }
.set-row .ok::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.syncing svg { width: 18px; height: 18px; color: #0277bd; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.src-mark { width: 30px; height: 30px; border-radius: 9px; background: #10212b; color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.src-mark svg { width: 16px; height: 16px; color: #ff6f61; }
.phone.guarded .set-group.guard { box-shadow: 0 0 0 2px #7fe0f2, 0 10px 24px -8px rgba(26, 156, 189, .6); }

/* ── Quick-add sheet ─────────────────────────────────────────── */
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; background: #fff; border-radius: 26px 26px 0 0;
  padding: 10px 14px 22px; transform: translateY(105%); transition: transform .5s cubic-bezier(.2, .75, .1, 1);
  box-shadow: 0 -20px 40px -20px rgba(16, 32, 42, .35);
}
.sheet.open { transform: none; }
.sheet-grip { width: 36px; height: 4px; border-radius: 2px; background: #cfdbe0; margin: 0 auto 10px; }
.sheet-t { font-weight: 600; font-size: 15px; margin-bottom: 9px; }
.sheet-foods { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.sheet-foods button { text-align: left; font-size: 11.5px; padding: 9px 10px; border-radius: 10px; background: #eef3f6; display: flex; justify-content: space-between; gap: 4px; transition: background .15s, transform .15s; }
.sheet-foods button em { font-style: normal; font-size: 10px; color: #6b7a82; }
.sheet-foods button:hover { background: #d5ecf6; }
.sheet-foods button:active { transform: scale(.96); }
.toast { position: absolute; left: 50%; top: 48px; transform: translateX(-50%); background: #10212b; color: #fff; font-size: 11.5px; padding: 7px 13px; border-radius: 99px; z-index: 8; animation: toast 1.6s ease forwards; white-space: nowrap; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, -8px); } 15%, 80% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }

/* ── AI panel inside the app ─────────────────────────────────── */
.ai-panel {
  position: absolute; left: 0; right: 0; bottom: 0; top: 64px; z-index: 6; display: flex; flex-direction: column;
  background: linear-gradient(180deg, #0c2a35, #081d26); color: #e6f2f5; border-radius: 26px 26px 0 0;
  padding: 14px 14px 12px; transform: translateY(104%); transition: transform .55s cubic-bezier(.2, .75, .1, 1);
  box-shadow: 0 -24px 50px -20px rgba(4, 20, 28, .6);
}
.phone.ai-open .ai-panel { transform: none; }
.ai-head { display: flex; align-items: center; gap: 8px; padding-bottom: 10px; border-bottom: 1px solid rgba(230, 242, 245, .12); }
.ai-mark { width: 26px; height: 26px; border-radius: 9px; display: grid; place-items: center; background: rgba(127, 224, 242, .16); color: #7fe0f2; }
.ai-mark svg { width: 15px; height: 15px; }
.ai-title { font-weight: 700; font-size: 14px; }
.ai-badge { font-size: 9.5px; font-weight: 600; padding: 3px 8px; border-radius: 99px; background: rgba(127, 224, 242, .16); color: #bff2fb; }
.ai-close { margin-left: auto; color: rgba(230, 242, 245, .6); }
.ai-close svg { width: 18px; height: 18px; }
.ai-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 9px; padding: 12px 2px; scrollbar-width: none; }
.ai-log::-webkit-scrollbar { display: none; }
.ai-msg { max-width: 90%; font-size: 12.5px; line-height: 1.45; white-space: pre-wrap; }
.ai-u { align-self: flex-end; background: #0277bd; color: #fff; padding: 8px 11px; border-radius: 14px 14px 4px 14px; }
.ai-a { align-self: flex-start; background: rgba(230, 242, 245, .07); padding: 9px 11px; border-radius: 14px 14px 14px 4px; }
.ai-a.typing::after { content: ''; display: inline-block; width: 6px; height: 12px; margin-left: 2px; background: #7fe0f2; vertical-align: -2px; animation: blink .8s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.ai-err { color: #f5b8ab; }
.ai-wait { display: flex; align-items: center; gap: 8px; font-size: 11px; color: #7fe0f2; }
.ai-wait i { width: 22px; height: 8px; background: radial-gradient(circle, #7fe0f2 2px, transparent 2.5px) 0 50% / 7px 8px repeat-x; animation: dots 1s steps(3) infinite; }
@keyframes dots { from { width: 0; } to { width: 22px; } }
.ai-consent { background: #f3f8f9; color: #10212b; border-radius: 14px; padding: 10px 12px; font-size: 11.5px; }
.ai-consent button { margin-top: 8px; background: #0277bd; color: #fff; font-weight: 600; font-size: 12px; padding: 7px 14px; border-radius: 99px; }
.ai-sugg { display: flex; flex-direction: column; gap: 5px; padding-bottom: 8px; }
.ai-sugg button { text-align: left; font-size: 11.5px; color: #cfe8ee; padding: 7px 10px; border-radius: 10px; border: 1px solid rgba(127, 224, 242, .25); transition: background .2s; }
.ai-sugg button:hover { background: rgba(127, 224, 242, .1); }
.ai-form { display: flex; gap: 6px; }
.ai-form input { flex: 1; min-width: 0; font: inherit; font-size: 12.5px; color: #fff; background: rgba(255, 255, 255, .07); border: 1px solid rgba(230, 242, 245, .16); border-radius: 12px; padding: 9px 11px; outline: none; }
.ai-form input:focus { border-color: #7fe0f2; }
.ai-send { width: 38px; border-radius: 12px; background: #7fe0f2; color: #083f4f; display: grid; place-items: center; }
.ai-send svg { width: 18px; height: 18px; }
.ai-send:disabled { opacity: .4; }
.ai-foot { font-size: 9.5px; color: rgba(230, 242, 245, .4); margin-top: 6px; text-align: center; }

/* ── "Tap me": a pulsing ring on whatever the current step invites you to touch ── */
.tap-hint { animation: tapPulse 1.5s ease-out infinite; }
@keyframes tapPulse {
  0% { box-shadow: 0 0 0 0 rgba(26, 156, 189, .75); }
  70%, 100% { box-shadow: 0 0 0 14px rgba(26, 156, 189, 0); }
}
.fab.tap-hint { animation: tapPulse 1.5s ease-out infinite, fabNudge 1.5s ease-in-out infinite; }
@keyframes fabNudge { 50% { transform: translateY(-3px) scale(1.04); } }
