:root {
  --bg: #f6f7f9; --surface: #ffffff; --surface-2: #f0f2f5; --text: #14181f; --muted: #5d6573; --line: #e2e5ea;
  --brand: #1d3557; --brand-ink: #ffffff; --accent: #e07a1f; --ok: #1f7a4d; --warn: #a15c00; --bad: #b42318;
  --radius: 14px; --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
  --font: system-ui, -apple-system, "Segoe UI", "Rubik", "Assistant", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #0f1216; --surface: #171b21; --surface-2: #1f242c; --text: #e8ebf0; --muted: #9aa3b2; --line: #2a3039; --brand: #8fb3e6; --brand-ink: #0f1216; --accent: #f0a050; --ok: #4cc38a; --warn: #f0b350; --bad: #ff6b5e; --shadow: 0 1px 2px rgba(0,0,0,.4); }
}
:root[data-theme="dark"] { --bg: #0f1216; --surface: #171b21; --surface-2: #1f242c; --text: #e8ebf0; --muted: #9aa3b2; --line: #2a3039; --brand: #8fb3e6; --brand-ink: #0f1216; --accent: #f0a050; --ok: #4cc38a; --warn: #f0b350; --bad: #ff6b5e; --shadow: 0 1px 2px rgba(0,0,0,.4); }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 16px/1.5 var(--font); -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--brand); }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; inset-inline-start: -999px; }
.skip:focus { inset-inline-start: 8px; top: 8px; z-index: 10; background: var(--surface); padding: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.top { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; gap: 10px; min-height: 60px; flex-wrap: wrap; padding-block: 8px; }
.brand { font-weight: 800; letter-spacing: .12em; font-size: 20px; color: var(--text); text-decoration: none; }
.search { flex: 1 1 260px; display: flex; order: 3; width: 100%; }
@media (min-width: 720px) { .search { order: 0; width: auto; } }
.search input { flex: 1; min-width: 0; height: 42px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); border-radius: 999px; padding: 0 16px; font: inherit; }
.top-actions { display: flex; gap: 6px; margin-inline-start: auto; align-items: center; }
.icon-btn, .chip { height: 40px; min-width: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 999px; font: inherit; cursor: pointer; text-decoration: none; padding: 0 10px; }
.search .icon-btn { margin-inline-start: -44px; border: 0; background: transparent; }
.cart-btn b { background: var(--accent); color: #fff; border-radius: 999px; font-size: 12px; padding: 0 6px; line-height: 18px; }
.banner { background: #fff4e5; color: #6b3d00; text-align: center; padding: 6px 16px; font-size: 14px; }
:root[data-theme="dark"] .banner { background: #3a2a10; color: #ffd9a0; }
main { flex: 1; padding-block: 18px 40px; outline: none; }
main:focus, main:focus-visible { outline: none; }
.foot { color: var(--muted); font-size: 13px; padding-block: 20px; border-top: 1px solid var(--line); }

h1 { font-size: 24px; margin: 4px 0 14px; } h2 { font-size: 19px; margin: 18px 0 10px; } h3 { font-size: 16px; margin: 12px 0 6px; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); } }
.cols { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .cols { grid-template-columns: 1.6fr 1fr; } }

.cats { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; scrollbar-width: none; }
.cats a { white-space: nowrap; }
.chip.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

.prod { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: var(--text); transition: transform .15s ease, box-shadow .15s ease; }
.prod:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.ph { aspect-ratio: 1 / 1; background: linear-gradient(135deg, var(--surface-2), var(--line)); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 34px; font-weight: 700; letter-spacing: .05em; }
.ph img { width: 100%; height: 100%; object-fit: cover; }
.prod .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.prod .t { font-weight: 600; line-height: 1.3; }
.price { font-weight: 700; font-size: 17px; }
.vat { color: var(--muted); font-size: 12px; font-weight: 400; }
.stock { font-size: 12px; } .stock.in { color: var(--ok); } .stock.low { color: var(--warn); } .stock.out { color: var(--bad); }

.btn { height: 46px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.danger { color: var(--bad); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { height: 36px; padding: 0 12px; font-size: 14px; }

label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
input, select, textarea { width: 100%; min-height: 44px; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 10px; padding: 8px 12px; font: inherit; }
textarea { min-height: 80px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; }
.check { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: 15px; }
.fields { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .fields.two { grid-template-columns: 1fr 1fr; } }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.qty button { width: 42px; height: 42px; border: 0; background: var(--surface-2); color: var(--text); font-size: 18px; cursor: pointer; }
.qty input { width: 56px; border: 0; border-radius: 0; text-align: center; min-height: 42px; }

.lines { width: 100%; border-collapse: collapse; }
.lines td, .lines th { padding: 10px 6px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: middle; }
.lines .num { text-align: end; white-space: nowrap; }
.totals div { display: flex; justify-content: space-between; padding: 4px 0; }
.totals .grand { font-weight: 800; font-size: 18px; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); font-size: 13px; }
.pill.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.pill.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.pill.bad { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }
.note { border-inline-start: 3px solid var(--accent); padding: 8px 12px; background: var(--surface-2); border-radius: 8px; }
.err { color: var(--bad); font-size: 14px; min-height: 1em; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 6px 0 6px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.toast { position: fixed; inset-inline: 16px; bottom: 16px; max-width: 420px; margin-inline: auto; background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 12px; opacity: 0; transform: translateY(10px); transition: .2s; pointer-events: none; z-index: 20; }
.toast.on { opacity: 1; transform: none; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.pager { display: flex; justify-content: center; gap: 8px; margin-top: 18px; }
.gallery { display: grid; gap: 8px; }
.detail { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 820px) { .detail { grid-template-columns: 1fr 1fr; } }
.bdi { unicode-bidi: isolate; direction: ltr; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* private mode, not signed in: only the sign-in form (no search, no cart) */
body.locked .search, body.locked #cartBtn, body.locked #accountBtn { display: none; }
