:root {
  --bg: #0b0f17;
  --surface: #131a26;
  --surface-2: #1b2432;
  --line: #263041;
  --text: #eef2f8;
  --muted: #9aa7bd;
  --brand: #f5a524;
  --brand-ink: #1a1205;
  --ok: #16a34a;
  --danger: #ef4444;
  --radius: 14px;
  --maxw: 1180px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---------- Header ---------- */
header.site {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(11, 15, 23, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.bar {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: .2px;
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
}

.brand span { color: var(--brand); }

.bar .spacer { flex: 1; }

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: filter .15s ease, border-color .15s ease;
}

.btn:hover { filter: brightness(1.18); }
.btn:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
}

.btn.ghost { background: transparent; }
.btn.block { width: 100%; }

.cart-btn { position: relative; }

.cart-count {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 21px;
  height: 21px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
  padding: 0 5px;
}

.cart-count[hidden] { display: none; }

/* ---------- Hero ---------- */
.hero {
  padding: 46px 0 26px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(900px 320px at 12% -10%, rgba(245, 165, 36, .16), transparent 70%),
    radial-gradient(700px 280px at 88% 0%, rgba(56, 189, 248, .10), transparent 70%);
}

.hero h1 { margin: 0 0 10px; font-size: clamp(1.7rem, 4.4vw, 2.6rem); line-height: 1.15; }
.hero p { margin: 0; color: var(--muted); max-width: 62ch; }

.pills { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

.pill {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: .85rem;
  color: var(--muted);
}

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 22px 0 6px;
}

input[type="text"], input[type="tel"], input[type="email"], input[type="search"], select, textarea {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  width: 100%;
}

input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }

.toolbar .search { flex: 1 1 260px; max-width: 380px; }
.toolbar .filter { flex: 0 0 auto; width: auto; min-width: 190px; }

/* ---------- Grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
  padding: 18px 0 60px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--surface-2);
  display: block;
}

.card .body { padding: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card h3 { margin: 0; font-size: 1rem; line-height: 1.3; }
.card .desc { color: var(--muted); font-size: .85rem; margin: 0; flex: 1; }
.card .sku { color: var(--muted); font-size: .74rem; letter-spacing: .5px; }

.price-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.price { font-size: 1.28rem; font-weight: 700; color: var(--brand); }
.price small { font-size: .72rem; color: var(--muted); font-weight: 500; }
.market { color: var(--muted); text-decoration: line-through; font-size: .85rem; }

.tiers { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; font-size: .78rem; color: var(--muted); }
.tiers li { display: flex; justify-content: space-between; gap: 8px; }

.qty { display: flex; align-items: center; gap: 8px; }
.qty input { width: 78px; text-align: center; }
.qty label { font-size: .78rem; color: var(--muted); }

.badge-margin {
  align-self: flex-start;
  background: rgba(22, 163, 74, .16);
  border: 1px solid rgba(22, 163, 74, .45);
  color: #4ade80;
  font-size: .74rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 3px 9px;
}

.empty { color: var(--muted); padding: 40px 0; text-align: center; }

/* ---------- Drawer ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  z-index: 40;
}

.overlay[hidden], .drawer[hidden], .modal[hidden] { display: none; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(430px, 100%);
  background: var(--surface);
  border-left: 1px solid var(--line);
  z-index: 50;
  display: flex;
  flex-direction: column;
}

.drawer header, .modal header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
}

.drawer header h2, .modal header h2 { margin: 0; font-size: 1.05rem; flex: 1; }

.drawer .items { flex: 1; overflow-y: auto; padding: 12px 18px; display: grid; gap: 12px; align-content: start; }

.line {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.line img { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: var(--surface-2); }
.line .nm { font-size: .9rem; font-weight: 600; }
.line .meta { font-size: .76rem; color: var(--muted); }
.line .rm { font-weight: 700; white-space: nowrap; }

.line-qty { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.line-qty button {
  width: 26px; height: 26px; border-radius: 7px;
  border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text); cursor: pointer; font-weight: 700; line-height: 1;
}
.line-qty input { width: 54px; padding: 4px 6px; text-align: center; }
.line-qty .rm-line { background: none; border: none; color: var(--danger); cursor: pointer; font-size: .78rem; }

.drawer footer, .modal footer { border-top: 1px solid var(--line); padding: 16px 18px; display: grid; gap: 10px; }

.totals { display: grid; gap: 6px; font-size: .9rem; }
.totals div { display: flex; justify-content: space-between; gap: 10px; }
.totals .grand { font-size: 1.1rem; font-weight: 700; color: var(--brand); border-top: 1px solid var(--line); padding-top: 8px; }

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  z-index: 60;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100% - 28px));
  max-height: min(88vh, 900px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
}

.modal .body { padding: 18px; overflow-y: auto; display: grid; gap: 14px; }

.field { display: grid; gap: 5px; }
.field label { font-size: .82rem; color: var(--muted); font-weight: 600; }
.field .hint { font-size: .74rem; color: var(--muted); }
.field.error input, .field.error textarea, .field.error select { border-color: var(--danger); }
.field .err { color: var(--danger); font-size: .76rem; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.pay-note {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: .86rem;
}

.pay-note strong { color: var(--brand); }
.pay-note code { background: rgba(255,255,255,.06); padding: 1px 6px; border-radius: 5px; }

.ok-box { text-align: center; display: grid; gap: 10px; }
.ok-box .tick { font-size: 2.6rem; color: var(--ok); }
.ok-box .oid { font-family: ui-monospace, Consolas, monospace; font-size: 1.15rem; font-weight: 700; color: var(--brand); }

.alert {
  border-radius: 10px;
  padding: 11px 13px;
  font-size: .85rem;
  border: 1px solid;
}
.alert.bad { background: rgba(239, 68, 68, .12); border-color: rgba(239, 68, 68, .5); color: #fca5a5; }
.alert.warn { background: rgba(245, 165, 36, .12); border-color: rgba(245, 165, 36, .5); color: #fcd34d; }

footer.site { border-top: 1px solid var(--line); padding: 26px 0; color: var(--muted); font-size: .85rem; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (max-width: 520px) {
  .row2 { grid-template-columns: 1fr; }
  .bar { gap: 10px; }
  .brand { font-size: 1rem; }
}
