/* ZivBrielle's Variety Store — shared styles (admin + customer). Mobile first. */
@font-face { font-family: Inter; src: url(/fonts/inter-regular.woff) format('woff'); font-weight: 400; font-display: swap; }
@font-face { font-family: Inter; src: url(/fonts/inter-medium.woff) format('woff'); font-weight: 500; font-display: swap; }
@font-face { font-family: Inter; src: url(/fonts/inter-semibold.woff) format('woff'); font-weight: 600; font-display: swap; }
@font-face { font-family: Inter; src: url(/fonts/inter-bold.woff) format('woff'); font-weight: 700; font-display: swap; }
@font-face { font-family: Poppins; src: url(/fonts/poppins-medium.woff) format('woff'); font-weight: 500; font-display: swap; }
@font-face { font-family: Poppins; src: url(/fonts/poppins-bold.woff) format('woff'); font-weight: 600 700; font-display: swap; }

/* Brand palette — warm, friendly, neighbourhood-store feel.
   brand = tomato coral (actions), accent = mango (stars, highlights), ok = leaf green (good news), ink = deep plum. */
:root {
  --bg: #FFF7EC; --surface: #FFFFFF; --surface-2: #FFFBF5; --ink: #2B2238; --muted: #6B6275; --faint: #A39BAA;
  --line: #F0E3D3; --line-2: #F6EDE2;
  --brand: #CF4630; --brand-ink: #B8432C; --brand-soft: #FDE8E2; --on-brand: #FFFFFF;
  --accent: #FFB938; --accent-ink: #8A5A00; --accent-soft: #FFF1D6;
  --ok: #1E7A52; --ok-soft: #E1F3EA;
  --red: #B42318; --red-soft: #FDE7E4; --blue: #2F5E8A; --blue-soft: #E4EEF8;
  --radius: 16px; --radius-sm: 12px; --shadow: 0 1px 2px rgba(43,34,56,.05), 0 6px 18px rgba(43,34,56,.06);
  --shadow-lg: 0 12px 40px rgba(43,34,56,.18);
  --display: Poppins, Inter, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --sans: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1A1620; --surface: #24202B; --surface-2: #1F1B25; --ink: #F3EEF5; --muted: #B1A8B8; --faint: #857C8C;
    --line: #362F3E; --line-2: #2C2633; --brand: #F08A6F; --brand-ink: #F59C84; --brand-soft: #3B2420; --on-brand: #24120D;
    --accent: #FFC861; --accent-ink: #FFD58A; --accent-soft: #3A2C12; --ok: #6FCF9F; --ok-soft: #173026;
    --red: #FF8A7A; --red-soft: #3D1E1B; --blue: #8DB8E0; --blue-soft: #1B2B3A;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1A1620; --surface: #24202B; --surface-2: #1F1B25; --ink: #F3EEF5; --muted: #B1A8B8; --faint: #857C8C;
  --line: #362F3E; --line-2: #2C2633; --brand: #F08A6F; --brand-ink: #F59C84; --brand-soft: #3B2420; --on-brand: #24120D;
  --accent: #FFC861; --accent-ink: #FFD58A; --accent-soft: #3A2C12; --ok: #6FCF9F; --ok-soft: #173026;
  --red: #FF8A7A; --red-soft: #3D1E1B; --blue: #8DB8E0; --blue-soft: #1B2B3A;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--sans); -webkit-font-smoothing: antialiased; font-feature-settings: 'tnum' 1; }
a { color: var(--brand-ink); }
h1, h2, h3 { font-family: var(--display); font-weight: 700; letter-spacing: -0.015em; margin: 0; line-height: 1.2; }
h1 { font-size: 26px; } h2 { font-size: 20px; } h3 { font-size: 16px; font-family: var(--sans); font-weight: 600; letter-spacing: 0; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 13px; } .tiny { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.hidden { display: none !important; }
.row { display: flex; gap: 10px; align-items: center; } .row.wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; }
.stack { display: grid; gap: 12px; } .stack-sm { display: grid; gap: 6px; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- controls ---------- */
button, input, select, textarea { font: inherit; color: inherit; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-weight: 600; cursor: pointer; text-decoration: none; -webkit-tap-highlight-color: transparent; transition: transform .06s, background .15s; white-space: nowrap; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.amber { background: var(--accent); border-color: var(--accent); color: #2B2238; }
.btn.danger { background: var(--red-soft); border-color: transparent; color: var(--red); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--brand-ink); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; } .btn.lg { min-height: 54px; font-size: 17px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.icon-btn { width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 12px; border: 0; background: transparent; color: var(--ink); cursor: pointer; }
.icon-btn:hover { background: var(--line-2); }
svg.i { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.i.sm { width: 18px; height: 18px; }

label.field { display: grid; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
.input, select.input, textarea.input { width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  font-size: 16px; /* 16px stops iPhone from zooming in */ color: var(--ink); font-weight: 400; outline: none; }
textarea.input { min-height: 90px; resize: vertical; }
.input:focus { border-color: var(--brand-ink); box-shadow: 0 0 0 3px var(--brand-soft); }
.input-group { display: flex; } .input-group .input { border-radius: 12px 0 0 12px; } .input-group .btn { border-radius: 0 12px 12px 0; }
.check { display: flex; gap: 10px; align-items: center; font-size: 15px; font-weight: 500; color: var(--ink); min-height: 40px; }
.check input { width: 22px; height: 22px; accent-color: var(--brand); }
.grid-2 { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.grid-3 { display: grid; gap: 10px; grid-template-columns: repeat(3, 1fr); }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.card h2 + *, .card h3 + * { margin-top: 10px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 22px 2px 10px; }
.section-title h2 { font-size: 18px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap; color: var(--ink); }
.chip.on { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--line-2); color: var(--muted); white-space: nowrap; }
.badge.green { background: var(--ok-soft); color: var(--ok); } .badge.amber { background: var(--accent-soft); color: var(--accent-ink); }
.badge.red { background: var(--red-soft); color: var(--red); } .badge.blue { background: var(--blue-soft); color: var(--blue); }

.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list > .item { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-top: 1px solid var(--line-2); min-height: 60px; text-decoration: none; color: inherit; }
.list > .item:first-child { border-top: 0; }
.list > button.item { width: 100%; border-left: 0; border-right: 0; border-bottom: 0; background: none; text-align: left; cursor: pointer; }
.list > .item:active { background: var(--surface-2); }
.item .title { font-weight: 600; } .item .sub { font-size: 13px; color: var(--muted); }
.avatar { width: 40px; height: 40px; border-radius: 12px; background: var(--brand-soft); display: grid; place-items: center; font-size: 20px; flex: none; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat .label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stat .value { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .delta { font-size: 12px; margin-top: 2px; }
.stat.hero { background: var(--brand); color: var(--on-brand); border-color: var(--brand); grid-column: span 2; }
.stat.hero .label { color: var(--on-brand); opacity: .8; } .stat.hero .value { font-size: 32px; font-family: var(--display); }

.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty .big { font-size: 40px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.table td.r, .table th.r { text-align: right; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.bar { height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--brand-ink); border-radius: 99px; }

/* ---------- sheets, toasts ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(15,20,17,.45); z-index: 60; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { background: var(--surface); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 22px 22px 0 0; padding: 8px 18px calc(18px + var(--safe-b)); box-shadow: var(--shadow-lg); animation: up .2s ease-out; -webkit-overflow-scrolling: touch; }
.sheet .grabber { width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: 4px auto 10px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; position: sticky; top: -8px; background: var(--surface); padding: 6px 0; z-index: 2; }
@media (min-width: 720px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 20px; } }
@keyframes up { from { transform: translateY(30px); opacity: .4; } } @keyframes fade { from { opacity: 0; } }
.toasts { position: fixed; left: 50%; transform: translateX(-50%); top: calc(10px + var(--safe-t)); z-index: 90; display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: 12px 14px; border-radius: 14px; box-shadow: var(--shadow-lg); font-weight: 500; animation: up .2s; pointer-events: auto; display: flex; gap: 10px; align-items: center; }
.toast.err { background: var(--red); color: #fff; } .toast.warn { background: var(--accent); color: #1d1206; } .toast.ok { background: var(--ok); color: #fff; }

/* ---------- scanner ---------- */
.scanner { position: relative; background: #000; border-radius: 18px; overflow: hidden; aspect-ratio: 4 / 3; }
.scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner .frame { position: absolute; left: 10%; right: 10%; top: 28%; bottom: 28%; border: 3px solid rgba(255,255,255,.9); border-radius: 14px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }
.scanner .laser { position: absolute; left: 12%; right: 12%; top: 50%; height: 2px; background: var(--accent); box-shadow: 0 0 12px var(--accent); animation: laser 1.6s ease-in-out infinite alternate; }
@keyframes laser { from { transform: translateY(-40px); } to { transform: translateY(40px); } }
.scanner .hint { position: absolute; bottom: 10px; left: 0; right: 0; text-align: center; color: #fff; font-size: 13px; text-shadow: 0 1px 3px #000; }
.scanner .tools { position: absolute; top: 10px; right: 10px; display: flex; gap: 8px; }
.scanner .tools button { background: rgba(0,0,0,.5); color: #fff; border: 0; border-radius: 10px; height: 38px; padding: 0 12px; font-weight: 600; }

/* ---------- stars ---------- */
.stars { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.star { aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 2px dashed var(--line); color: var(--faint); font-size: 13px; font-weight: 600; }
.star.on { background: var(--accent); border: 2px solid var(--accent); color: #2B2238; font-size: 24px; }

/* Keep everything inside the phone width: grid/flex children may shrink, scroll rows scroll internally. */
.stack > *, .stack-sm > *, .grid-2 > *, .grid-3 > *, .two-col > *, .pos > *, .stats > *, .row > .grow { min-width: 0; }
main.page, main.shop { overflow-x: clip; }

/* product photos */
.thumb { border-radius: 12px; object-fit: cover; background: var(--surface-2); border: 1px solid var(--line-2); flex: none; display: block; }
.prod .ph { width: 100%; aspect-ratio: 4 / 3; border-radius: 10px; object-fit: contain; background: var(--surface-2); margin-bottom: 4px; }

/* shared by the staff app and the customer shop: quantity steppers, size pickers, totals */
.cart-line { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 12px 0; border-top: 1px solid var(--line-2); }
.cart-line:first-child { border-top: 0; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.qty button { width: 40px; height: 38px; border: 0; background: var(--surface-2); font-size: 20px; cursor: pointer; color: var(--ink); }
.qty input { width: 52px; height: 38px; border: 0; text-align: center; font-size: 16px; background: var(--surface); color: var(--ink); }
.unit-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.unit-pick button { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 6px 10px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--ink); }
.unit-pick button.on { background: var(--brand-soft); border-color: var(--brand-ink); color: var(--brand-ink); }
.total-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; padding: 4px 0; }
.total-row.big { font-size: 26px; font-weight: 700; font-family: var(--display); }
.keypad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.keypad button { min-height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; font-size: 15px; cursor: pointer; color: var(--ink); }
