:root {
  --bg: #FBF8F1; --card: #FFFFFF; --ink: #2B2A28; --ink2: #5E5A54; --muted: #8A847B; --line: #ECE5D8;
  --green: #2F7D4F; --green-soft: #E6F2EA; --yellow: #B7791F; --yellow-soft: #FBF1DC; --red: #B23A2E; --red-soft: #F9E3E0;
  --accent: #C8643B; --radius: 16px; --tap: 52px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; border: 0; }
input, select { font: inherit; }
.muted { color: var(--muted); } .small { font-size: 14px; } .err { color: var(--red); min-height: 1.2em; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { background: var(--card); border-radius: 24px; padding: 28px 22px; width: 100%; max-width: 380px; text-align: center; box-shadow: 0 6px 30px rgba(60,40,10,.08); }
.login-logo { width: 72px; height: 72px; border-radius: 18px; }
.login h1 { font-size: 24px; margin: 12px 0 4px; }
.who { display: flex; gap: 12px; margin: 16px 0; }
.who-btn { flex: 1; height: 64px; border-radius: 14px; background: var(--bg); font-size: 20px; font-weight: 600; border: 2px solid var(--line); }
.who-btn.sel { border-color: var(--green); background: var(--green-soft); color: var(--green); }
#pin { width: 100%; height: var(--tap); border-radius: 12px; border: 2px solid var(--line); padding: 0 16px; font-size: 22px; letter-spacing: 6px; text-align: center; margin-bottom: 12px; }

/* top */
.top { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px 8px; padding-top: calc(14px + env(safe-area-inset-top, 0px)); position: sticky; top: 0; background: var(--bg); z-index: 5; }
.hello { font-size: 24px; font-weight: 700; } .sub { color: var(--muted); font-size: 14px; }
.icon-btn { width: 48px; height: 48px; border-radius: 50%; background: var(--card); font-size: 22px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.icon-btn.off { opacity: .45; }
.banner { margin: 0 14px 8px; padding: 10px 14px; border-radius: 12px; background: var(--yellow-soft); color: #6B4A12; font-size: 14px; }
main { padding: 4px 14px calc(96px + var(--safe-b)); max-width: 640px; margin: 0 auto; }
.h2 { font-size: 22px; margin: 18px 4px 4px; }
.section { font-size: 17px; margin: 20px 4px 8px; color: var(--ink2); }
.pill { background: var(--green-soft); color: var(--green); border-radius: 99px; padding: 1px 10px; font-size: 14px; }
.card { background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: 0 1px 6px rgba(60,40,10,.06); margin-bottom: 12px; }

/* buttons */
.primary { background: var(--green); color: #fff; border-radius: 14px; font-weight: 700; }
.big { width: 100%; height: var(--tap); font-size: 18px; }
.ghost { background: var(--card); color: var(--ink); border: 2px solid var(--line); border-radius: 12px; min-height: 44px; padding: 0 14px; font-weight: 600; }
.ghost.sel { border-color: var(--green); color: var(--green); background: var(--green-soft); }
.sticky-cta { position: sticky; bottom: calc(78px + var(--safe-b)); margin-top: 14px; box-shadow: 0 6px 20px rgba(47,125,79,.35); }

/* add */
.add-card { background: var(--card); border-radius: 20px; padding: 16px; box-shadow: 0 2px 10px rgba(60,40,10,.06); }
.add-label { font-weight: 700; font-size: 18px; display: block; margin-bottom: 8px; }
.add-row { display: flex; gap: 10px; margin-bottom: 10px; }
.add-row input { flex: 1; min-width: 0; height: 56px; border-radius: 14px; border: 2px solid var(--line); padding: 0 14px; font-size: 18px; background: var(--bg); }
.add-row input:focus { outline: none; border-color: var(--green); }
.mic { width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 24px; flex: none; }
.mic.live { animation: pulse 1s infinite; background: var(--red); }
@keyframes pulse { 50% { transform: scale(1.08); } }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; }
.chip { flex: none; display: flex; align-items: center; gap: 8px; background: var(--card); border: 2px solid var(--line); border-radius: 99px; padding: 4px 14px 4px 4px; min-height: 48px; font-size: 15px; }
.chip img, .chip .noimg { width: 38px; height: 38px; border-radius: 50%; object-fit: contain; background: #fff; }
.chip.on { opacity: .45; }

/* list */
.list { list-style: none; padding: 0; margin: 0; }
.li { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 14px; padding: 10px 12px; margin-bottom: 8px; min-height: 64px; box-shadow: 0 1px 4px rgba(60,40,10,.05); }
.li .what { flex: 1; min-width: 0; }
.li .name { font-weight: 650; font-size: 18px; text-transform: capitalize; }
.li .cat { font-size: 13px; color: var(--muted); background: none; padding: 0; text-align: left; text-decoration: underline dotted; }
.li .note { font-size: 13px; color: var(--yellow); }
.qty { display: flex; align-items: center; gap: 4px; }
.qty button { width: 40px; height: 40px; border-radius: 50%; background: var(--bg); font-size: 20px; font-weight: 700; }
.qty span { min-width: 22px; text-align: center; font-weight: 700; }
.del { width: 40px; height: 40px; border-radius: 50%; background: none; color: var(--muted); font-size: 20px; }

/* review */
.summary { background: var(--green); color: #fff; border-radius: 20px; padding: 16px; margin-bottom: 12px; }
.summary .big-num { font-size: 30px; font-weight: 800; }
.summary .row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; font-size: 15px; opacity: .95; }
.modes { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.modes select { height: 44px; border-radius: 12px; border: 2px solid var(--line); padding: 0 10px; background: var(--card); }
.tradeoff { background: var(--yellow-soft); color: #5E4210; border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; font-size: 15px; }
.store-head { display: flex; justify-content: space-between; align-items: baseline; margin: 18px 4px 6px; }
.store-head h3 { margin: 0; font-size: 19px; } .store-head .why { font-size: 13px; color: var(--muted); }
.prod { display: flex; gap: 12px; background: var(--card); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; box-shadow: 0 1px 6px rgba(60,40,10,.06); }
.photo { width: 92px; height: 92px; border-radius: 12px; background: #fff; border: 1px solid var(--line); flex: none; display: grid; place-items: center; overflow: hidden; }
.photo img { width: 100%; height: 100%; object-fit: contain; }
.noimg { font-size: 11px; color: var(--muted); text-align: center; padding: 6px; background: #F4EFE6; display: grid; place-items: center; }
.pinfo { flex: 1; min-width: 0; }
.pinfo .for { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.pinfo .pname { font-weight: 700; font-size: 16px; line-height: 1.25; }
.pinfo .brand { font-size: 14px; color: var(--ink2); }
.pinfo .price { font-size: 17px; font-weight: 750; margin-top: 2px; }
.pinfo .unit { font-size: 13px; color: var(--muted); font-weight: 400; }
.badge { display: flex; gap: 6px; align-items: flex-start; font-size: 14px; margin-top: 6px; border-radius: 10px; padding: 6px 8px; }
.badge .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; margin-top: 4px; }
.badge.green { background: var(--green-soft); color: #1F5A37; } .badge.green .dot { background: var(--green); }
.badge.yellow { background: var(--yellow-soft); color: #6B4A12; } .badge.yellow .dot { background: var(--yellow); }
.badge.red { background: var(--red-soft); color: #7D2219; } .badge.red .dot { background: var(--red); }
.why-btn { margin-top: 8px; background: none; color: var(--green); font-weight: 700; padding: 6px 0; min-height: 40px; }
.tag { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 6px; padding: 1px 6px; margin-right: 4px; }
.tag.rec { background: var(--green); color: #fff; } .tag.usual { background: var(--accent); color: #fff; } .tag.sample { background: #EEE7DA; color: var(--ink2); }
.opts { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 8px; margin: -2px 0 10px; }
.opt { flex: none; width: 168px; background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 8px; text-align: left; }
.opt.sel { border-color: var(--green); }
.opt .photo { width: 100%; height: 96px; }
.opt .pname { font-size: 14px; font-weight: 650; margin-top: 6px; line-height: 1.2; }
.opt .price { font-weight: 750; }
.opts-title { font-size: 14px; color: var(--ink2); margin: 0 4px 4px; }
.missing { border-left: 4px solid var(--red); }
.approve-bar { position: sticky; bottom: calc(68px + var(--safe-b)); margin: 16px -14px 0; padding: 10px 14px 12px; background: var(--bg); box-shadow: 0 -8px 16px rgba(251,247,240,.9); }
.approve-note { text-align: center; font-size: 13px; color: var(--muted); margin-top: 6px; }

/* sheet */
.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet-back { position: absolute; inset: 0; background: rgba(30,25,15,.45); }
.sheet-body { position: absolute; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow: auto; background: var(--bg); border-radius: 22px 22px 0 0; padding: 18px 16px calc(24px + var(--safe-b)); }
.sheet-close { position: absolute; right: 12px; top: 10px; width: 44px; height: 44px; border-radius: 50%; background: var(--card); font-size: 18px; }
.rule { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rule .dot { width: 14px; height: 14px; border-radius: 50%; margin-top: 4px; flex: none; }
.rule .dot.pass { background: var(--green); } .rule .dot.fail { background: var(--red); } .rule .dot.unknown { background: var(--yellow); }
.rule .t { font-weight: 650; } .rule .tip { font-size: 14px; color: var(--ink2); margin-top: 2px; }
.tier { font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; border-radius: 6px; padding: 1px 6px; margin-left: 6px; }
.tier.hard { background: var(--red-soft); color: var(--red); } .tier.strong { background: var(--yellow-soft); color: var(--yellow); }
.tier.soft { background: #EEF0F6; color: #4A5578; } .tier.promote { background: var(--green-soft); color: var(--green); }
.panel { font-size: 14px; background: var(--card); border-radius: 12px; padding: 10px; color: var(--ink2); }

/* spending (single-series bars: <=24px thick, 4px rounded data-end, square at baseline) */
.hero { display: flex; gap: 10px; } .hero .card { flex: 1; }
.hero .num { font-size: 28px; font-weight: 800; } .hero .lbl { color: var(--muted); font-size: 14px; }
.bars h3 { font-size: 16px; margin: 4px 0 10px; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 72px; gap: 8px; align-items: center; min-height: 32px; }
.bar-row .bl { font-size: 14px; color: var(--ink2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 14px; position: relative; }
.bar { height: 14px; background: #2F7D4F; border-radius: 0 4px 4px 0; min-width: 2px; }
.bar-row .bv { text-align: right; font-weight: 700; font-size: 14px; }
.bar-row:hover .bar, .bar-row:focus .bar { background: #24633E; }

/* learn */
details.lc { background: var(--card); border-radius: 14px; margin-bottom: 8px; padding: 0 12px; }
details.lc summary { min-height: 52px; display: flex; align-items: center; font-weight: 650; list-style: none; }
details.lc summary::after { content: "›"; margin-left: auto; font-size: 22px; color: var(--muted); }
details.lc[open] summary::after { transform: rotate(90deg); }
.set-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); gap: 10px; }
.set-row:last-child { border-bottom: 0; }

/* tabs */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--card); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); z-index: 20; }
.tabbtn { flex: 1; height: 68px; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 12px; font-weight: 600; }
.tabbtn .ti { font-size: 22px; filter: grayscale(1); opacity: .7; }
.tabbtn.active { color: var(--green); } .tabbtn.active .ti { filter: none; opacity: 1; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(92px + var(--safe-b)); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; z-index: 60; max-width: 90vw; font-size: 15px; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.recall { background: var(--red-soft); border-radius: 12px; padding: 10px 12px; color: #7D2219; margin-bottom: 10px; }

.thumb { width: 52px; height: 52px; border-radius: 10px; background: #fff; border: 1px solid var(--line); flex: none; overflow: hidden; display: grid; place-items: center; font-size: 9px; }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.thumb.noimg:empty { background: var(--bg); border-style: dashed; }
.li .picked { font-size: 13px; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tlist { margin: 6px 0 0; padding-left: 18px; } .tlist li { margin-bottom: 4px; }
.rule .dot.info { background: #CFC6B6; }
.code-input { font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 1px; }
.label-btn { width: 100%; margin-top: 10px; min-height: 48px; font-size: 16px; }
.update-bar { display: block; text-align: center; text-decoration: none; }
.code-input::placeholder { font-family: inherit; letter-spacing: 0; }
/* Sign-in: Ray's storybook bee (brand/bee_logo_v3_storybook.jpg), as-is and centered on its own cream */
.login-card { background: #FBF8F1; box-shadow: none; padding-top: 4px; }
.login-art { display: block; width: min(300px, 78vw); height: auto; margin: 0 auto -6px; }
.login-card h1 { margin-top: 0; }

/* Phase 2 */
.two-btns { display: flex; gap: 8px; } .two-btns .label-btn { flex: 1; }
.grade { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; border-radius: 10px; padding: 4px 8px; margin-top: 6px; }
.grade .dot { width: 10px; height: 10px; border-radius: 50%; }
.grade.great { background: var(--green-soft); color: #1F5A37; } .grade.great .dot { background: var(--green); }
.grade.ok { background: var(--yellow-soft); color: #6B4A12; } .grade.ok .dot { background: var(--yellow); }
.grade.heads_up { background: #F6ECE8; color: #7A3F2E; } .grade.heads_up .dot { background: #C27A62; }
.grade.unknown { background: #EFEDE8; color: var(--ink2); } .grade.unknown .dot { background: #B9B2A6; }
.badge.unknown { background: #EFEDE8; color: var(--ink2); } .badge.unknown .dot { background: #B9B2A6; }
.calm { background: #F3EFE6; color: var(--ink2); border-radius: 12px; padding: 8px 12px; font-size: 14px; margin-top: 8px; }
.local-tip { background: var(--green-soft); color: #1F5A37; border-radius: 12px; padding: 8px 12px; font-size: 14px; margin-top: 8px; }
.purpose { display: flex; gap: 8px; margin: 10px 0 2px; } .purpose .ghost { flex: 1; min-height: 52px; line-height: 1.15; }
.purpose .ghost small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.store-row { display: flex; gap: 10px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.store-row:last-child { border-bottom: 0; }
.store-row .sinfo { flex: 1; min-width: 0; } .store-row .sname { font-weight: 700; }
.store-row .sline { font-size: 14px; color: var(--ink2); } .store-row .smeta { font-size: 12px; color: var(--muted); }
.sdot { width: 12px; height: 12px; border-radius: 50%; flex: none; background: #CFC6B6; }
.sdot.connected, .sdot.needs_code { background: var(--green); } .sdot.working { background: var(--yellow); }
.sdot.needs_login, .sdot.blocked { background: #C27A62; }
.store-row .sbtns { display: flex; gap: 6px; flex-direction: column; }
.store-row .sbtns .ghost { min-height: 40px; font-size: 14px; }
.field { width: 100%; height: 52px; border-radius: 12px; border: 2px solid var(--line); padding: 0 14px; margin: 6px 0; background: var(--card); font-size: 17px; }
.timeline { display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap; }
.timeline .step { flex: 1; min-width: 56px; text-align: center; font-size: 11px; color: var(--muted); }
.timeline .step .bar2 { height: 6px; border-radius: 3px; background: var(--line); margin-bottom: 4px; }
.timeline .step.done { color: var(--green); } .timeline .step.done .bar2 { background: var(--green); }
.timeline .step.problem .bar2 { background: #C27A62; } .timeline .step.problem { color: #7A3F2E; }
.order-card .ohead { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.order-card .osplit { font-size: 14px; color: var(--ink2); margin-top: 4px; }
.res { display: flex; gap: 10px; background: var(--card); border-radius: 14px; padding: 10px; margin-bottom: 8px; }
.res .photo { width: 72px; height: 72px; }
.res .addb { flex: none; align-self: center; }
.local-card .lk { font-size: 13px; color: var(--muted); }
.local-card .sells { display: flex; gap: 4px; flex-wrap: wrap; margin: 6px 0; }
.local-card .sells span { font-size: 12px; background: var(--bg); border-radius: 99px; padding: 2px 8px; }
.vbadge { font-size: 11px; font-weight: 800; border-radius: 6px; padding: 1px 6px; margin-left: 6px; }
.vbadge.v { background: var(--green-soft); color: var(--green); } .vbadge.u { background: #EFEDE8; color: var(--muted); }
.chip.sel { border-color: var(--green); background: var(--green-soft); color: var(--green); }
.tabbtn { font-size: 11px; }
.lv-wrap { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; min-height: 200px; touch-action: none; }
.lv-wrap img { display: block; width: 100%; height: auto; user-select: none; -webkit-user-select: none; }
.lv-row { display: flex; gap: 6px; margin-top: 8px; } .lv-row .field { margin: 0; flex: 1; } .lv-row .ghost { flex: none; }
