/* Basket — shared look for the family and helper apps */
:root {
  --bg: #f6f3ec;
  --card: #ffffff;
  --ink: #1d2420;
  --muted: #5a625d;
  --line: #e7e2d6;
  --brand: #0e6b4f;
  --brand-ink: #ffffff;
  --brand-soft: #e2f1ea;
  --warn: #b8560f;
  --warn-soft: #fbeadb;
  --amazon: #f3a847;
  --amazon-soft: #fff3df;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(29, 36, 32, .06), 0 4px 14px rgba(29, 36, 32, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111513;
    --card: #1a201d;
    --ink: #eef1ef;
    --muted: #9aa49f;
    --line: #2a322e;
    --brand: #3fbf8e;
    --brand-ink: #08130e;
    --brand-soft: #173328;
    --warn: #f0a466;
    --warn-soft: #3a2616;
    --amazon: #f3a847;
    --amazon-soft: #33270f;
    --shadow: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.4 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100dvh;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: var(--brand); text-decoration: none; }
.wrap { max-width: 560px; margin: 0 auto; padding: 0 16px; }

/* header */
.top { padding: calc(14px + env(safe-area-inset-top)) 0 8px; display: flex; align-items: center; gap: 12px; }
.top h1 { font-size: 24px; margin: 0; letter-spacing: -.02em; flex: 1; }
.top small { display: block; font-size: 13px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.faces { display: flex; }
.face {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: #fff; border: 2px solid var(--bg); margin-left: -8px;
}

/* add bar */
.add { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px; margin: 8px 0 18px; }
.add-row { display: flex; gap: 8px; }
.add input {
  flex: 1; min-width: 0; border: 0; background: transparent; padding: 10px 8px; font-size: 17px; outline: none;
}
.add input.qty { flex: 0 0 64px; text-align: center; background: var(--bg); border-radius: 12px; }
.seg { display: flex; gap: 6px; margin-top: 8px; }
.seg button {
  flex: 1; padding: 9px; border-radius: 12px; font-weight: 600; font-size: 14px; background: var(--bg); color: var(--muted);
}
.seg button[aria-pressed="true"].out { background: var(--warn-soft); color: var(--warn); }
.seg button[aria-pressed="true"].need { background: var(--brand-soft); color: var(--brand); }
.btn {
  background: var(--brand); color: var(--brand-ink); border-radius: 14px; padding: 12px 18px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px;
}
.btn.ghost { background: var(--brand-soft); color: var(--brand); }
.btn.amazon { background: var(--amazon); color: #1a1205; }
.btn.block { width: 100%; }

/* sections + rows */
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 22px 4px 8px; display: flex; justify-content: space-between; }
.list { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.tick {
  flex: 0 0 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center;
}
.tick svg { width: 16px; height: 16px; opacity: 0; }
.row.done .tick { background: var(--brand); border-color: var(--brand); }
.row.done .tick svg { opacity: 1; stroke: var(--brand-ink); }
.row.done .name { text-decoration: line-through; color: var(--muted); }
.main { flex: 1; min-width: 0; }
.name { font-weight: 600; overflow-wrap: anywhere; }
.meta { font-size: 13px; color: var(--muted); }
.qty-pill { font-size: 13px; font-weight: 600; color: var(--muted); background: var(--bg); padding: 2px 8px; border-radius: 999px; margin-left: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 13px; font-weight: 600;
  padding: 4px 10px; border-radius: 12px; background: var(--brand-soft); color: var(--brand);
}
.chip.amazon { background: var(--amazon-soft); color: #8a5300; }
@media (prefers-color-scheme: dark) { .chip.amazon { color: var(--amazon); } }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.tag-out { font-size: 11px; font-weight: 700; color: var(--warn); background: var(--warn-soft); padding: 2px 7px; border-radius: 6px; margin-left: 6px; vertical-align: 2px; white-space: nowrap; display: inline-block; }

/* store cards (plan) */
.hero { background: var(--brand); color: var(--brand-ink); border-radius: 22px; padding: 18px; margin-top: 8px; }
.hero .big { font-size: 34px; font-weight: 800; letter-spacing: -.02em; }
.hero p { margin: 2px 0 14px; opacity: .85; font-size: 14px; }
.hero .btn { background: var(--brand-ink); color: var(--brand); }
@media (prefers-color-scheme: dark) { .hero .btn { background: #08130e; color: var(--brand); } }
.store { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-top: 12px; overflow: hidden; }
.store-head { display: flex; align-items: center; gap: 12px; padding: 14px; }
.logo { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px; flex: 0 0 40px; }
.store-head .main b { font-size: 17px; }
.total { font-weight: 800; font-size: 17px; }
.line { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 15px; }
.line .was { color: var(--muted); text-decoration: line-through; font-size: 13px; margin-right: 6px; }
.line .src { font-size: 12px; color: var(--muted); display: block; }
.store-foot { display: flex; gap: 8px; padding: 12px 14px 14px; border-top: 1px solid var(--line); }
.store-foot .btn { flex: 1; min-height: 44px; padding: 10px; font-size: 15px; }
.saving { font-size: 13px; font-weight: 700; color: var(--brand); }

/* compare sheet */
.cmp { width: 100%; border-collapse: collapse; font-size: 14px; }
.cmp td { padding: 8px 14px; border-top: 1px solid var(--line); }
.cmp td:last-child { text-align: right; font-weight: 700; }
.cmp tr.best td { color: var(--brand); }

/* tabs */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line);
  display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom); z-index: 5;
}
.tabs button { flex: 1; max-width: 186px; padding: 10px 0 12px; font-size: 12px; font-weight: 600; color: var(--muted); display: grid; justify-items: center; gap: 3px; }
.tabs button svg { width: 24px; height: 24px; }
.tabs button[aria-selected="true"] { color: var(--brand); }
.badge { background: var(--warn); color: var(--card); border-radius: 999px; font-size: 11px; padding: 0 6px; margin-left: 2px; }

/* circle */
.code { font: 800 30px/1 ui-monospace, "SF Mono", Consolas, monospace; letter-spacing: .14em; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-top: 12px; }
.card p { margin: 4px 0 12px; color: var(--muted); font-size: 14px; }
/* size sheet */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet-up {
  background: var(--card); width: 100%; max-width: 560px; border-radius: 24px 24px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); animation: up .22s cubic-bezier(.2, .8, .2, 1);
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet-up { animation: none; } }
.sheet-up h3 { margin: 0 0 2px; font-size: 20px; }
.sheet-up p { margin: 0 0 14px; color: var(--muted); font-size: 14px; }
.best-btn { width: 100%; text-align: left; display: block; padding: 14px 16px; border-radius: 16px; background: var(--brand); color: var(--brand-ink); font-weight: 700; font-size: 17px; }
.best-btn small { display: block; font-weight: 500; opacity: .85; font-size: 13px; margin-top: 2px; }
.sizes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.sizes button { padding: 12px 14px; border-radius: 14px; background: var(--bg); font-weight: 600; font-size: 15px; border: 1px solid var(--line); }
.sizes input { flex: 1 1 140px; padding: 12px 14px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); font-size: 15px; outline: none; }
.size-pill { font-size: 13px; font-weight: 600; color: var(--brand); background: var(--brand-soft); padding: 2px 8px; border-radius: 999px; margin-left: 6px; white-space: nowrap; display: inline-block; }
.chip.searching { background: var(--bg); color: var(--muted); }
.spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* join */
.join { padding-top: calc(48px + env(safe-area-inset-top)); }
.join h1 { font-size: 34px; margin: 0; letter-spacing: -.02em; }
.join .card { display: grid; gap: 10px; }
.join input { width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 14px; padding: 14px; font-size: 17px; outline: none; }
.join .err { color: var(--warn); margin: 0; font-size: 14px; }
.join .err:empty { display: none; }
button:disabled { opacity: .55; cursor: progress; }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
