:root {
  --bg: #f5f7f7; --card: #fff; --text: #14201f; --muted: #5d6b6a; --line: #dfe6e5;
  --brand: #0f766e; --brand-d: #0b5a54; --warn: #b45309; --warn-bg: #fef3c7;
  --ok: #15803d; --ok-bg: #dcfce7; --bad: #b91c1c;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e1615; --card: #172221; --text: #eaf2f1; --muted: #93a5a3; --line: #263533;
    --brand: #2dd4bf; --brand-d: #14b8a6; --warn: #fbbf24; --warn-bg: #3a2c0a;
    --ok: #4ade80; --ok-bg: #0d2e1b; --bad: #f87171; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
[hidden] { display: none !important; }
.top { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 10px 12px 6px;
  border-bottom: 1px solid var(--line); }
.top.row { display: flex; align-items: center; gap: 8px; }
.top h1 { font-size: 19px; margin: 0; }
#search { width: 100%; font-size: 17px; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); color: var(--text); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 8px 0 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font-size: 15px; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
@media (prefers-color-scheme: dark) { .chip.on { color: #04211e; } }

.item { display: flex; align-items: center; gap: 10px; padding: 12px; background: var(--card);
  border-bottom: 1px solid var(--line); }
.item.in { background: color-mix(in srgb, var(--brand) 9%, var(--card)); }
.info { flex: 1; min-width: 0; }
.name { font-weight: 600; overflow-wrap: anywhere; }
.meta { color: var(--muted); font-size: 14px; margin-top: 2px; }
.price { color: var(--text); font-weight: 600; }
.tag { display: inline-block; font-size: 12px; padding: 1px 7px; border-radius: 6px;
  background: var(--warn-bg); color: var(--warn); margin-left: 4px; vertical-align: 1px; }
.qty { display: flex; align-items: center; gap: 6px; flex: none; }
.qty button { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font-size: 24px; line-height: 1; }
.qty button.plus { background: var(--brand); border-color: var(--brand); color: #fff; }
@media (prefers-color-scheme: dark) { .qty button.plus { color: #04211e; } }
.qty input { width: 52px; height: 44px; text-align: center; font-size: 18px; font-weight: 700;
  border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--text);
  -moz-appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; }
.carton { margin-top: 6px; font-size: 13px; padding: 4px 10px; border-radius: 8px;
  border: 1px dashed var(--brand); color: var(--brand); background: transparent; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.spacer { height: 110px; }

.bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--card);
  border-top: 1px solid var(--line); padding: 0 12px calc(10px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 14px rgba(0,0,0,.08); }
.progress { height: 6px; background: var(--line); margin: 0 -12px 8px; }
#progress-fill { height: 100%; width: 0; background: var(--warn); transition: width .25s; }
.bar.ok #progress-fill { background: var(--ok); }
.bar-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bar-total { font-size: 22px; font-weight: 800; }
.bar-hint { font-size: 13px; color: var(--warn); font-weight: 600; }
.bar.ok .bar-hint { color: var(--ok); }

.btn { border: 0; border-radius: 12px; padding: 13px 18px; font-size: 16px; font-weight: 700; }
.btn.primary { background: var(--brand); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.primary { color: #04211e; } }
.btn.primary:disabled { opacity: .45; }
.btn.ghost { background: transparent; color: var(--brand); padding: 10px 8px; }
.btn.ghost.danger { color: var(--bad); width: 100%; margin-top: 4px; }
.btn.big { width: 100%; padding: 16px; font-size: 18px; margin-top: 12px; }

#summary-view main .item { align-items: flex-start; }
.line-total { font-weight: 700; white-space: nowrap; text-align: right; margin-top: 6px; }
.rm { background: none; border: 0; color: var(--bad); font-size: 13px; padding: 6px 0 0; }
.sum { padding: 14px 14px 40px; }
.sum-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 16px; }
.sum-row.total { font-size: 22px; font-weight: 800; border-top: 2px solid var(--line); margin-top: 6px; padding-top: 10px; }
.minbox { margin-top: 10px; padding: 12px; border-radius: 12px; font-weight: 600;
  background: var(--warn-bg); color: var(--warn); }
.minbox.ok { background: var(--ok-bg); color: var(--ok); }
.note { display: block; margin-top: 16px; font-size: 14px; color: var(--muted); }
.note textarea { width: 100%; margin-top: 6px; font: inherit; padding: 10px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--text); }

.toast { position: fixed; left: 12px; right: 12px; bottom: 100px; z-index: 20; padding: 14px;
  border-radius: 12px; background: var(--bad); color: #fff; font-weight: 600; text-align: center; }
.done { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.55); display: flex;
  align-items: center; justify-content: center; padding: 20px; }
.done-card { background: var(--card); border-radius: 18px; padding: 24px; text-align: center; max-width: 380px; width: 100%; }
.tick { width: 64px; height: 64px; margin: 0 auto 10px; border-radius: 50%; background: var(--ok);
  color: #fff; font-size: 38px; line-height: 64px; }
