:root {
  --bg: #f4f6f5; --card: #fff; --card2: #eef2f1; --text: #14181b; --muted: #66707a; --line: #e2e7e6;
  --accent: #0f766e; --accent-2: #14b8a6; --accent-text: #fff; --warn: #b45309; --ok: #15803d; --danger: #b91c1c;
  --paper: #fffdf8; --shadow: 0 1px 2px rgb(0 0 0 / .04), 0 8px 24px rgb(15 40 38 / .06);
  --r: 18px; --ease: cubic-bezier(.2, .8, .2, 1);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0d1012; --card: #171b1e; --card2: #1f2427; --text: #e9ecee; --muted: #929ca5; --line: #262c30;
    --accent: #2dd4bf; --accent-2: #5eead4; --accent-text: #052522; --warn: #fbbf24; --ok: #4ade80; --danger: #f87171;
    --paper: #f3efe4; --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 10px 30px rgb(0 0 0 / .25); }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
body { margin: 0; font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  background: var(--bg); color: var(--text); padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
body::before { /* soft accent glow behind the hero */
  content: ""; position: fixed; inset: -20vh -20vw auto; height: 60vh; pointer-events: none; z-index: -1;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 16%, transparent), transparent); }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
h2 { font-size: 19px; margin: 0; } h3 { font-size: 15px; margin: 0; }

/* ---------- header ---------- */
.top { display: flex; align-items: center; justify-content: space-between; max-width: 720px; margin: 0 auto;
  padding: calc(12px + env(safe-area-inset-top)) 16px 4px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { margin: 0; font-size: 21px; letter-spacing: -.02em; }
.logo { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; font-weight: 800;
  color: var(--accent-text); background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; margin: 0; border-radius: 50%;
  border: 0; background: var(--card); color: var(--muted); box-shadow: var(--shadow); }

main { padding: 8px 16px; max-width: 720px; margin: 0 auto; }
.tab { display: none; } .tab.active { display: block; animation: rise .35s var(--ease); }
.page-title { font-size: 26px; letter-spacing: -.02em; margin: 6px 0 12px; }
.card { background: var(--card); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.stack > * + * { margin-top: 10px; }

/* ---------- controls ---------- */
label { display: block; margin: 10px 0; font-size: 13px; color: var(--muted); }
input, select, button { font: inherit; color: var(--text); }
input, select { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card2);
  margin-top: 4px; outline: none; transition: border-color .15s; }
input:focus, select:focus { border-color: var(--accent); }
button, .button { display: inline-block; text-align: center; padding: 12px 16px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--card); cursor: pointer; margin: 6px 0; color: var(--text); font-size: 16px; font-weight: 500;
  transition: transform .12s var(--ease), opacity .15s; }
button:active, .button:active { transform: scale(.97); }
button.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-text);
  border: 0; width: 100%; font-weight: 650; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); }
button.danger { color: var(--danger); width: 100%; }
button.link { border: 0; background: none; color: var(--accent); padding: 6px 0; font-size: 15px; }
button:disabled { opacity: .4; box-shadow: none; }
.muted { color: var(--muted); font-size: 14px; margin: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row2 > .button, .row2 > button { width: 100%; }

/* ---------- month chips ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 4px 0 12px; margin: 0 -16px; padding-inline: 16px; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; margin: 0; padding: 7px 14px; border-radius: 99px; font-size: 14px; background: var(--card);
  border: 1px solid var(--line); color: var(--muted); }
.chips button.on { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ---------- hero ring ---------- */
.hero { display: grid; grid-template-columns: 1fr; gap: 14px; padding: 20px; }
@media (min-width: 560px) { .hero { grid-template-columns: 220px 1fr; align-items: center; } }
.ring { position: relative; width: 220px; max-width: 100%; aspect-ratio: 1; margin: 0 auto; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 12; stroke-linecap: butt;
  transition: stroke-dasharray .9s var(--ease), stroke-dashoffset .9s var(--ease), opacity .2s; }
.ring circle.track { stroke: var(--card2); }
.ring circle.dim { opacity: .2; }
.ring-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-center strong { font-size: 32px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.ring-center small { color: var(--muted); font-size: 12px; }
.legend { display: grid; gap: 4px; }
.legend button { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 10px; margin: 0;
  padding: 8px 10px; border: 0; border-radius: 12px; background: none; text-align: left; font-size: 15px; }
.legend button.on { background: var(--card2); }
.legend .dot { width: 10px; height: 10px; border-radius: 50%; }
.legend .amt { font-variant-numeric: tabular-nums; font-weight: 600; }
.legend .pct { color: var(--muted); font-size: 12px; margin-left: 6px; font-weight: 400; }
.legend .bar { grid-column: 2 / 4; height: 4px; border-radius: 4px; background: var(--card2); overflow: hidden; margin-top: -2px; }
.legend .bar i { display: block; height: 100%; width: 0; border-radius: 4px; transition: width .8s var(--ease); }

.section-head { display: flex; justify-content: space-between; align-items: baseline; margin: 22px 2px 4px; }

/* ---------- receipt list ---------- */
.list { list-style: none; padding: 0; margin: 0; }
.list > li { background: var(--card); border-radius: 16px; margin: 8px 0; box-shadow: var(--shadow); overflow: hidden;
  animation: rise .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms); }
.list .row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; width: 100%; margin: 0; border: 0;
  border-radius: 0; background: none; text-align: left; font-weight: 400; }
.avatar { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  font-weight: 700; color: #fff; font-size: 16px; }
.list .meta { flex: 1; min-width: 0; }
.list .meta strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .meta small { color: var(--muted); font-size: 13px; }
.list .total { font-weight: 650; font-variant-numeric: tabular-nums; }
.stripe { display: flex; height: 4px; gap: 2px; margin-top: 6px; border-radius: 4px; overflow: hidden; }
.stripe i { display: block; height: 100%; }
.month-label { list-style: none; color: var(--muted); font-size: 13px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; margin: 18px 4px 4px; }

/* expanded receipt = a paper slip */
.slip { display: none; margin: 0 14px 14px; padding: 14px 14px 22px; background: var(--paper); color: #2b2a26;
  font: 13px/1.6 ui-monospace, "SF Mono", Menlo, monospace; border-radius: 6px 6px 0 0; position: relative;
  -webkit-mask: radial-gradient(6px at 50% 100%, #0000 98%, #000) 50% / 14px 100% repeat-x; }
li.open .slip { display: block; animation: unroll .35s var(--ease); }
.slip .ln { display: grid; grid-template-columns: 8px 1fr auto; gap: 8px; align-items: center; }
.slip .ln .dot { width: 8px; height: 8px; border-radius: 50%; }
.slip .sum { border-top: 1px dashed #b9b4a6; margin-top: 8px; padding-top: 6px; font-weight: 700; }
.slip button { font: 600 13px system-ui, sans-serif; margin: 12px 0 0; padding: 6px 12px; border-radius: 10px;
  background: transparent; border: 1px solid #d9d3c3; color: #b91c1c; }

/* ---------- empty state ---------- */
.empty { text-align: center; padding: 30px 10px; }
.empty .muted { max-width: 300px; margin: 8px auto 20px; }
.empty .primary { max-width: 280px; }
.paper.demo { width: 120px; margin: 10px auto 22px; padding: 18px 16px 26px; background: var(--paper); border-radius: 6px 6px 0 0;
  transform: rotate(-4deg); box-shadow: var(--shadow); animation: float 4s ease-in-out infinite;
  -webkit-mask: radial-gradient(6px at 50% 100%, #0000 98%, #000) 50% / 14px 100% repeat-x; }
.paper.demo i { display: block; height: 6px; border-radius: 3px; background: #d9d3c3; margin: 8px 0; }
.paper.demo i:nth-child(1) { background: #22c55e; width: 70%; } .paper.demo i:nth-child(2) { background: #a78bfa; }
.paper.demo i:nth-child(3) { background: #38bdf8; width: 85%; } .paper.demo i.short { width: 45%; }

/* ---------- dock ---------- */
.dock { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom));
  width: min(440px, calc(100% - 20px)); display: grid; grid-template-columns: 1fr 1fr auto 1fr 1fr; align-items: center;
  padding: 6px 8px; column-gap: 2px; border-radius: 26px; z-index: 10;
  background: color-mix(in srgb, var(--card) 82%, transparent); backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4); box-shadow: 0 10px 30px rgb(0 0 0 / .18); border: 1px solid var(--line); }
.dock button { border: 0; background: none; margin: 0; padding: 6px 0; display: grid; justify-items: center; gap: 2px; color: var(--muted); }
.dock button span { font-size: 11px; }
.dock button.active { color: var(--accent); }
.dock .fab { width: 60px; height: 60px; border-radius: 20px; margin-top: -26px; place-items: center; color: var(--accent-text);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 45%, transparent), 0 0 0 5px var(--bg); }
.dock .fab svg { width: 28px; height: 28px; stroke-width: 2; }

/* ---------- scan sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 20; }
.sheet .scrim { position: absolute; inset: 0; background: rgb(0 0 0 / .45); animation: fade .25s; }
.sheet .panel { position: absolute; left: 0; right: 0; bottom: 0; max-width: 720px; margin: 0 auto; max-height: 92vh;
  overflow-y: auto; background: var(--bg); border-radius: 24px 24px 0 0; padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
  animation: up .35s var(--ease); overscroll-behavior: contain; }
.sheet.closing .panel { animation: down .25s ease-in forwards; } .sheet.closing .scrim { animation: fade .25s reverse forwards; }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 10px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.drop { display: grid; justify-items: center; gap: 4px; text-align: center; padding: 26px 16px; border-radius: var(--r);
  border: 2px dashed color-mix(in srgb, var(--accent) 40%, var(--line)); background: color-mix(in srgb, var(--accent) 6%, var(--card));
  color: var(--text); cursor: pointer; margin: 0; }
.drop span:last-child { color: var(--muted); font-size: 13px; }
.drop-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 18px; margin-bottom: 6px;
  color: var(--accent-text); background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.drop-icon svg { width: 28px; height: 28px; }
.thumbs { display: flex; gap: 10px; overflow-x: auto; margin: 12px 0; padding-top: 8px; }
.thumbs:empty { display: none; }
.thumbs div { position: relative; flex: none; border-radius: 10px; overflow: hidden; animation: pop .3s var(--ease); }
.thumbs img { display: block; width: 76px; height: 104px; object-fit: cover; }
.thumbs button { position: absolute; top: 4px; right: 4px; margin: 0; padding: 0; width: 22px; height: 22px; border-radius: 50%;
  border: 0; background: rgb(0 0 0 / .6); color: #fff; font-size: 14px; line-height: 22px; }
/* scanning beam while the receipt is being read */
.thumbs.scanning div::after { content: ""; position: absolute; left: 0; right: 0; height: 30%; top: -30%;
  background: linear-gradient(transparent, color-mix(in srgb, var(--accent-2) 70%, transparent), transparent);
  animation: beam 1.4s ease-in-out infinite; }
.thumbs.scanning div:nth-child(2)::after { animation-delay: .2s; } .thumbs.scanning div:nth-child(3)::after { animation-delay: .4s; }
.thumbs.scanning button { display: none; }
.status { color: var(--muted); min-height: 1.4em; font-size: 14px; text-align: center; }
.status.error { color: var(--danger); }

/* review lines as cards */
.items { display: grid; gap: 8px; margin: 6px 0; }
.item { display: grid; grid-template-columns: 1fr 96px 28px; gap: 6px 8px; align-items: center; padding: 10px;
  background: var(--card); border-radius: 14px; border-left: 4px solid var(--c, var(--line));
  animation: rise .35s var(--ease) both; animation-delay: calc(var(--i, 0) * 35ms); }
.item input, .item select { margin: 0; padding: 7px 9px; font-size: 15px; }
.item .amt { text-align: right; font-variant-numeric: tabular-nums; }
.item .cat { grid-column: 1 / 2; font-size: 13px; padding: 5px 9px; width: auto; justify-self: start; border-radius: 99px;
  background: color-mix(in srgb, var(--c) 16%, var(--card)); border-color: transparent; color: var(--text); }
.item small { grid-column: 2 / 4; text-align: right; color: var(--muted); font-size: 11px; font-family: ui-monospace, monospace;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .x { grid-row: 1; grid-column: 3; border: 0; background: none; padding: 0; margin: 0; color: var(--muted); }
.item .x svg { width: 18px; height: 18px; }
.check { font-weight: 600; font-size: 14px; padding: 10px 12px; border-radius: 12px; margin: 8px 0; }
.check.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.check.bad { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.sticky-actions { position: sticky; bottom: calc(-20px - env(safe-area-inset-bottom)); background: var(--bg);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); margin: 0 -2px; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); z-index: 30;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 10px 16px; border-radius: 14px;
  background: var(--text); color: var(--bg); font-size: 14px; font-weight: 500; transition: .3s var(--ease); white-space: nowrap; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes pop { from { opacity: 0; transform: scale(.85); } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(100%); } }
@keyframes down { to { transform: translateY(100%); } }
@keyframes unroll { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes beam { to { top: 100%; } }
@keyframes float { 50% { transform: rotate(-2deg) translateY(-6px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- category icons ---------- */
.cat-ic { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: var(--c);
  background: color-mix(in srgb, var(--c) 18%, transparent); }
.cat-ic svg { width: 17px; height: 17px; stroke-width: 2; }
.mini-ic { display: inline-grid; place-items: center; width: 18px; height: 18px; color: var(--c); flex: none; }
.mini-ic svg { width: 15px; height: 15px; stroke-width: 2; }
.legend button { grid-template-columns: 30px 1fr auto; }
.legend .bar { grid-column: 2 / 4; }
.slip .ln { grid-template-columns: 18px 1fr auto; }
.slip .mini-ic { color: color-mix(in srgb, var(--c) 75%, #000); }
.cat-wrap { grid-column: 1 / 2; display: flex; align-items: center; gap: 4px; }
.cat-wrap .cat { grid-column: auto; }

/* ---------- activity card + search ---------- */
.activity { padding: 6px 14px 8px; }
.activity .section-head { margin: 4px 0 2px; align-items: center; }
.activity .list > li { box-shadow: none; background: var(--card2); }
.icon-btn.flat { box-shadow: none; background: var(--card2); width: 36px; height: 36px; }
.icon-btn.flat svg { width: 18px; height: 18px; }
.search { display: flex; align-items: center; gap: 8px; margin: 6px 0 4px; padding: 0 12px; border-radius: 12px;
  background: var(--card2); border: 1px solid var(--line); color: var(--muted); animation: rise .25s var(--ease); }
.search[hidden] { display: none; }
.search:focus-within { border-color: var(--accent); }
.search svg { width: 18px; height: 18px; flex: none; }
.search input { border: 0; background: none; margin: 0; padding: 11px 0; }
.see-all { display: block; width: 100%; text-align: center; }
.none { text-align: center; padding: 14px 0; }
.hits { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; font-size: 12px; color: var(--muted); }
.hits > span { display: inline-flex; align-items: center; gap: 3px; }
.hits b { color: var(--text); font-weight: 600; }

/* ---------- category page ---------- */
.back { display: inline-flex; align-items: center; gap: 2px; border: 0; background: none; color: var(--accent);
  padding: 4px 0; margin: 0 0 6px; font-size: 15px; }
.back svg { width: 20px; height: 20px; }
.cat-hero { position: relative; overflow: hidden; padding: 18px; }
.cat-hero::before { content: ""; position: absolute; inset: 0 0 auto; height: 110px; pointer-events: none;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c, var(--accent)) 22%, transparent), transparent); }
.cat-hero > * { position: relative; }
.cat-head { display: flex; align-items: center; gap: 12px; }
.cat-head h2 { font-size: 20px; } .cat-head small { color: var(--muted); font-size: 13px; }
.cat-ic.big { width: 48px; height: 48px; border-radius: 14px; }
.cat-ic.big svg { width: 26px; height: 26px; }
.cat-total { display: block; font-size: 36px; letter-spacing: -.03em; margin: 12px 0 8px; font-variant-numeric: tabular-nums; }
.chips.small { margin: 0; padding: 0 0 12px; }
.chips.small button { padding: 5px 12px; font-size: 13px; }
.stores { display: grid; gap: 6px; }
.store-pill { position: relative; display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 12px; background: var(--card2); overflow: hidden; font-size: 15px; }
.store-pill i { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--c, var(--accent)); border-radius: 3px; }
.store-pill b { font-variant-numeric: tabular-nums; }
.avatar.sm { width: 26px; height: 26px; border-radius: 8px; font-size: 12px; }
#cat-items .meta small code { font-size: 11px; opacity: .8; }
.chev { width: 16px; height: 16px; color: var(--muted); transform: rotate(180deg); flex: none; }
#donut [data-cat] { cursor: pointer; }

/* ---------- receipt viewer ---------- */
.rs-body .slip { display: block; margin: 4px 0 10px; animation: unroll .4s var(--ease); }
.slip-head { display: flex; justify-content: space-between; border-bottom: 1px dashed #b9b4a6; padding-bottom: 6px; margin-bottom: 6px; }
.slip .ln.mark { background: #fde68a; margin: 0 -8px; padding: 2px 8px; border-radius: 6px;
  animation: flash 1.2s ease-out 2; }
@keyframes flash { 50% { background: #fcd34d; } }

/* ---------- receipt photos ---------- */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: var(--card2); margin-bottom: 10px; }
.seg button { margin: 0; padding: 8px; border: 0; border-radius: 9px; background: none; color: var(--muted); font-size: 14px; }
.seg button.on { background: var(--card); color: var(--text); box-shadow: var(--shadow); font-weight: 600; }
.slip-actions { display: flex; justify-content: space-between; gap: 8px; }
.slip .photo-btn { color: #0f766e; border-color: #cfe5e1; }
.photos { display: grid; gap: 8px; }
.photos img { display: block; width: 100%; border-radius: 10px; background: #fff; cursor: zoom-in; animation: rise .3s var(--ease); }
.hint { text-align: center; margin: 0 0 8px; font-size: 13px; }
.attach { width: 100%; margin-top: 10px; }
.attach.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-text); border: 0; font-weight: 650; }
.no-photo { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 24px 8px; }
.no-photo .muted { max-width: 280px; margin-bottom: 6px; }
.viewer { position: fixed; inset: 0; z-index: 40; background: #fff; overflow: auto; touch-action: pinch-zoom pan-x pan-y;
  animation: fade .2s; }
.viewer img { display: block; width: 100%; min-height: 100%; object-fit: contain; }
.viewer .icon-btn { position: fixed; top: calc(12px + env(safe-area-inset-top)); right: 12px; z-index: 1;
  background: rgb(0 0 0 / .6); color: #fff; }

/* ---------- sign in ---------- */
.auth { position: fixed; inset: 0; z-index: 50; overflow-y: auto; background: var(--bg);
  display: grid; place-items: center; padding: calc(24px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom)); }
.auth::before { content: ""; position: fixed; inset: -30vh -30vw auto; height: 80vh; pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 22%, transparent), transparent); }
.auth-card { position: relative; width: 100%; max-width: 380px; text-align: center; }
.auth-card > div:not(.auth-art) { animation: rise .4s var(--ease); }
.auth-art { height: 150px; margin-bottom: 4px; }
.auth-art .paper.demo { margin: 0 auto; }
.auth h1 { font-size: 26px; letter-spacing: -.02em; margin: 14px 0 6px; }
.auth .muted { margin: 0 auto 22px; max-width: 320px; }
.logo.big { width: 52px; height: 52px; border-radius: 16px; font-size: 24px; margin: 0 auto; }
.auth input[type="email"] { padding: 14px 16px; font-size: 17px; border-radius: 14px; text-align: center; margin: 0 0 10px; }
.auth .primary { padding: 14px; }
.auth-msg { min-height: 1.4em; margin: 14px 0 0; color: var(--danger); font-size: 14px; }
.auth-links { display: flex; justify-content: space-between; margin-top: 16px; }
.auth-links .link { font-size: 14px; }
.auth-links .link:disabled { color: var(--muted); opacity: 1; }
.dev-note { font-size: 13px; color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent);
  padding: 10px 12px; border-radius: 12px; margin: 16px 0 0; }

/* 6 boxes drawn over one real input, so iOS can autofill the code from Mail */
.otp { position: relative; display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin: 0; color: var(--text); }
.otp input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; font-size: 16px; caret-color: transparent; }
.otp span { display: grid; place-items: center; height: 56px; border-radius: 14px; background: var(--card); border: 1.5px solid var(--line);
  font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; transition: border-color .15s, transform .15s var(--ease); }
.otp span:not(:empty) { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); animation: pop .2s var(--ease); }
.otp span.cur { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.otp.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* ---------- account card ---------- */
.account { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 12px; }
.account strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account button { margin: 0; padding: 8px 14px; font-size: 14px; }

/* app icon image used as the logo */
img.logo { display: block; background: none; object-fit: cover; box-shadow: 0 2px 8px rgb(0 0 0 / .25); }
.app-icon { display: block; width: 112px; height: 112px; border-radius: 26px; margin: 0 auto 8px;
  box-shadow: 0 16px 40px rgb(0 0 0 / .35), 0 0 0 1px rgb(255 255 255 / .06); animation: float 5s ease-in-out infinite; }
.r-photos { display: flex; gap: 6px; overflow-x: auto; }
.r-photos:empty { display: none; }
.r-photos img { width: 44px; height: 60px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); flex: none; }

/* ---------- items spotted in stores ---------- */
#scan-mode { margin-bottom: 12px; }
.thumb { position: relative; flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px;
  overflow: hidden; background: color-mix(in srgb, var(--c) 16%, var(--card2)); }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb img:not([src]) { display: none; }
.bought { display: inline-block; margin-top: 4px; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600;
  color: var(--muted); background: var(--card2); }
.bought.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.bought.drop { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); margin-left: 4px; }
.spot-photos { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; }
.spot-photos img { height: 160px; border-radius: 12px; flex: none; cursor: zoom-in; background: #fff; }
.price-hint { font-size: 14px; padding: 10px 12px; border-radius: 12px; margin: 0 0 12px;
  color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.sub-head { margin: 4px 2px 6px; }
.buys > li { box-shadow: none; background: var(--card); }
.details { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 16px 2px; font-size: 14px; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }
.slip .edit { color: #334155; }
