:root {
  --bg: #f4f4f2; --card: #ffffff; --ink: #161616; --muted: #6b6b6b; --line: #e3e3df;
  --accent: #c8102e; --accent-ink: #ffffff; --ok: #1d7a3a; --bad: #b3261e; --top: #111111;
  --radius: 12px; --tap: 48px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #121212; --card: #1d1d1d; --ink: #f1f1f1; --muted: #a3a3a3; --line: #333; --top: #000; color-scheme: dark; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
a { color: inherit; }
main { max-width: 760px; margin: 0 auto; padding: 12px 16px 120px; }
main.center { display: flex; flex-direction: column; justify-content: center; min-height: 80vh; }
h1 { font-size: 18px; margin: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
h2.section { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 22px 0 8px; }
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--top); color: #fff; padding-top: max(10px, env(safe-area-inset-top)); }
.top .back { font-size: 34px; line-height: 1; text-decoration: none; width: 32px; }
.logo { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 800; font-size: 14px; }
.logo.big { width: 56px; height: 56px; font-size: 22px; border-radius: 12px; }
.brand { display: flex; gap: 12px; align-items: center; margin: 0 auto 18px; }
.brand small { display: block; color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 8px 0; }
.stack > * + * { margin-top: 12px; }
label { display: block; font-size: 14px; color: var(--muted); }
input, select, textarea { display: block; width: 100%; margin-top: 4px; min-height: var(--tap); padding: 10px 12px; font: inherit; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
textarea { min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
button, .primary, .ghost { min-height: var(--tap); padding: 0 18px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; border: 1px solid transparent; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.primary { background: var(--accent); color: var(--accent-ink); }
.primary:disabled { opacity: .45; cursor: default; }
.ghost { background: transparent; color: inherit; border-color: var(--line); }
.top .ghost { color: #fff; border-color: #444; }
.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.danger { color: var(--bad); }
.block { display: flex; width: 100%; margin: 10px 0; }
.muted { color: var(--muted); }
.pad { padding: 14px 4px; }
.err { color: var(--bad); font-size: 14px; }
.ferr { display: block; color: var(--bad); font-size: 13px; min-height: 0; }
.ok { color: var(--ok); } .no { color: var(--bad); }
.tag { display: inline-block; font-size: 12px; padding: 1px 6px; border-radius: 6px; background: var(--line); color: var(--ink); }
.big { font-size: 20px; display: block; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 2fr 1.4fr; gap: 10px; }
.row2 > *, .row3 > * { margin-top: 0 !important; }
@media (max-width: 480px) { .row3 { grid-template-columns: 1fr 2fr; } .row3 > label:last-child { grid-column: 1 / -1; } }
.searchbar { margin: 4px 0 8px; }
.searchbar.sticky { position: sticky; top: 58px; z-index: 5; background: var(--bg); padding: 6px 0; }
.searchbar input { font-size: 17px; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li > a { position: relative; display: block; padding: 12px 40px 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; margin: 6px 0; text-decoration: none; }
.list > li > a small { display: block; color: var(--muted); }
.list > li > a::after { content: "›"; position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 24px; color: var(--muted); }
.badge { position: absolute; right: 34px; top: 12px; background: var(--accent); color: #fff; font-size: 12px; border-radius: 10px; padding: 0 7px; }
.results .prod { width: 100%; text-align: left; display: grid; grid-template-columns: 52px 1fr 36px; gap: 10px; align-items: center; padding: 8px; background: var(--card); color: inherit; border: 1px solid var(--line); border-radius: 10px; margin: 4px 0; font-weight: 400; }
.results .prod:disabled { opacity: .5; }
.prod .plus { font-size: 26px; color: var(--accent); text-align: center; }
img, .noimg { width: 52px; height: 52px; object-fit: contain; border-radius: 8px; background: #fff; border: 1px solid var(--line); }
.info { display: flex; flex-direction: column; min-width: 0; }
.info span { overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.info .price { font-size: 14px; }
.cart .line { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin: 6px 0; }
.line .info { grid-column: 2 / 4; }
.line .qty, .line .acts { display: flex; gap: 6px; align-items: center; }
.line .qty { grid-column: 1 / 3; }
.line .acts { grid-column: 3; justify-content: flex-end; }
.line .qty button { width: var(--tap); padding: 0; font-size: 22px; background: var(--bg); border: 1px solid var(--line); color: inherit; }
.line .qty input { width: 72px; text-align: center; margin: 0; font-size: 18px; }
.bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; padding-bottom: max(10px, env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); }
.bar small { display: block; color: var(--muted); font-size: 12px; }
.bar b { font-size: 20px; }
.mini { list-style: none; padding: 0; margin: 0; }
.mini li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; display: flex; gap: 6px; flex-wrap: wrap; }
.mini .r { margin-left: auto; font-weight: 600; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
.totals b { text-align: right; }
fieldset.pay { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
fieldset.pay legend { color: var(--muted); font-size: 14px; }
.opt { display: flex; align-items: center; gap: 10px; min-height: var(--tap); color: var(--ink); font-size: 16px; }
.opt input { width: 22px; min-height: 22px; margin: 0; }
.sheet-bg { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 520px; background: var(--card); border-radius: 16px 16px 0 0; padding: 18px 16px; padding-bottom: max(18px, env(safe-area-inset-bottom)); }
.sheet h3 { margin: 0; }
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg label { display: flex; gap: 6px; align-items: center; color: var(--ink); }
.seg label input { width: 20px; min-height: 20px; margin: 0; }
.seg .on { background: var(--ink); color: var(--bg); }
#toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px); opacity: 0; transition: .2s; z-index: 60;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; max-width: calc(100% - 32px); pointer-events: none; }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.bad { background: var(--bad); color: #fff; } #toast.good { background: var(--ok); color: #fff; }
.done { text-align: center; }
.check { width: 64px; height: 64px; margin: 0 auto; border-radius: 50%; background: var(--ok); color: #fff; font-size: 36px; display: grid; place-items: center; }
details summary { cursor: pointer; font-weight: 600; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.card:has(table) { overflow-x: auto; }
.nowrap { white-space: nowrap; }
input.pct { width: 80px; display: inline-block; margin: 0; }
.status { padding: 12px; border-radius: 10px; font-weight: 700; }
.status small { display: block; font-weight: 400; }
.okbg { background: #e3f3e7; color: var(--ok); } .badbg { background: #fbe4e2; color: var(--bad); }
form > .primary, .sheet .primary { width: 100%; }
.stack > small { display: block; }
.row2 > button { width: 100%; }
[hidden] { display: none !important; }
