:root {
  --ink: #16181d;
  --ink-2: #2a2e37;
  --muted: #6b7180;
  --line: #e4e6eb;
  --bg: #f5f6f8;
  --card: #fff;
  --accent: #ffb400;
  --accent-ink: #16181d;
  --wa: #1fa855;
  --wa-dark: #178a45;
  --danger: #d33a2c;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body {
  margin: 0;
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  padding-bottom: 96px;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* header */
.top { background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 20; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); display: grid; place-items: center; flex: none; }
.logo svg { width: 22px; height: 22px; fill: var(--ink); }
.brand-text { font-size: 18px; font-weight: 600; letter-spacing: .2px; white-space: nowrap; }
.brand-text b { color: var(--accent); font-weight: 800; }
.top-contacts { display: flex; align-items: center; gap: 14px; }
.phone { text-decoration: none; font-weight: 600; white-space: nowrap; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 10px; padding: 10px 16px; font-weight: 600; cursor: pointer; text-decoration: none; transition: background .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn.wa { background: var(--wa); color: #fff; }
.btn.wa:hover { background: var(--wa-dark); }
.btn.small { padding: 7px 12px; font-size: 14px; }
.btn.big { width: 100%; padding: 14px 18px; font-size: 16px; }
.btn.ghost { background: #fff; border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--ink-2); }
.wa-ico { width: 18px; height: 18px; fill: currentColor; flex: none; }
.link-btn { background: none; border: 0; padding: 4px 0; color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-btn.danger { color: var(--danger); }
.icon-btn { background: none; border: 0; font-size: 20px; width: 40px; height: 40px; border-radius: 10px; cursor: pointer; }
.icon-btn:hover { background: var(--bg); }

/* hero */
.hero { background: linear-gradient(180deg, var(--ink) 0%, var(--ink-2) 100%); color: #fff; padding: 36px 0 44px; }
.hero h1 { font-size: clamp(26px, 4.4vw, 42px); line-height: 1.12; margin: 0 0 12px; letter-spacing: -.5px; }
.hero h1 span { color: var(--accent); }
.lead { max-width: 640px; color: #c9ccd3; margin: 0 0 24px; font-size: 16px; }
.facts { list-style: none; display: flex; flex-wrap: wrap; gap: 12px; margin: 0; padding: 0; }
.facts li { background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); border-radius: 12px; padding: 10px 16px; display: flex; flex-direction: column; min-width: 130px; }
.facts b { font-size: 20px; color: var(--accent); }
.facts span { color: #c9ccd3; font-size: 13px; }

/* catalog */
.catalog { margin-top: -20px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; background: var(--card); padding: 12px; border-radius: var(--radius); box-shadow: var(--shadow); position: sticky; top: 68px; z-index: 10; }
.search { flex: 1 1 320px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; background: #fff; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 180, 0, .2); }
.search svg { width: 18px; height: 18px; fill: var(--muted); flex: none; }
.search input { border: 0; outline: 0; padding: 11px 0; width: 100%; background: none; }
#sort { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; }
.instock { display: flex; align-items: center; gap: 6px; color: var(--ink-2); padding: 0 4px; white-space: nowrap; }
.instock input { width: 16px; height: 16px; accent-color: var(--ink); }

.groups { display: flex; gap: 8px; overflow-x: auto; padding: 14px 0 4px; scrollbar-width: thin; }
.chip { flex: none; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 14px; cursor: pointer; white-space: nowrap; font-size: 14px; }
.chip small { color: var(--muted); margin-left: 4px; }
.chip:hover { border-color: var(--ink-2); }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip.active small { color: var(--accent); }
.result-info { color: var(--muted); font-size: 14px; margin: 8px 2px; }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.item { background: var(--card); border-radius: 12px; border: 1px solid var(--line); padding: 12px 14px; display: grid; grid-template-columns: 1fr auto auto; gap: 6px 16px; align-items: center; }
.item.in-cart { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.item-name { font-weight: 550; overflow-wrap: anywhere; }
.item-meta { grid-column: 1; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--muted); }
.stock-ok { color: #17803d; }
.stock-low { color: #b26b00; }
.stock-none { color: var(--danger); }
.item-price { grid-row: 1 / span 2; grid-column: 2; text-align: right; font-weight: 700; font-size: 17px; white-space: nowrap; }
.item-price small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.item-buy { grid-row: 1 / span 2; grid-column: 3; }
.add-btn { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 10px; padding: 10px 14px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.add-btn:hover { filter: brightness(.95); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.stepper button { width: 36px; height: 38px; border: 0; background: var(--bg); font-size: 18px; cursor: pointer; }
.stepper button:hover { background: var(--line); }
.stepper input { width: 52px; height: 38px; border: 0; text-align: center; font-weight: 600; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
mark { background: rgba(255, 180, 0, .35); color: inherit; border-radius: 3px; padding: 0 1px; }

.more-wrap { display: flex; justify-content: center; margin: 18px 0; }
.empty { text-align: center; color: var(--muted); padding: 30px 0; }

/* how */
.how { margin-top: 36px; }
.how h2 { font-size: 24px; margin: 0 0 14px; }
.how ol { list-style: none; counter-reset: s; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.how li { counter-increment: s; background: var(--card); border-radius: var(--radius); padding: 18px; border: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.how li::before { content: counter(s); width: 32px; height: 32px; border-radius: 50%; background: var(--accent); font-weight: 800; display: grid; place-items: center; margin-bottom: 6px; }
.how li span { color: var(--muted); }

/* footer */
.foot { background: var(--ink); color: #c9ccd3; margin-top: 40px; padding: 28px 0; }
.foot-row { display: flex; flex-wrap: wrap; gap: 16px 40px; justify-content: space-between; }
.foot .brand-text { color: #fff; }
.foot p { margin: 6px 0 0; }
.foot-contacts { display: flex; flex-direction: column; gap: 4px; }
.foot-contacts a { color: #fff; text-decoration: none; }
.foot-contacts a:hover { color: var(--accent); }
.note { flex-basis: 100%; font-size: 13px; color: #8a8f9a; }

/* cart bar */
.cart-bar { position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 30; display: flex; align-items: center; gap: 12px; width: min(560px, calc(100% - 24px)); background: var(--ink); color: #fff; border: 0; border-radius: 14px; padding: 12px 16px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); cursor: pointer; text-align: left; }
.cart-bar-count { background: var(--accent); color: var(--ink); border-radius: 999px; min-width: 28px; height: 28px; display: grid; place-items: center; font-weight: 800; padding: 0 8px; }
.cart-bar-text { flex: 1; }
.cart-bar-sum { font-weight: 700; }
.cart-bar-go { color: var(--accent); font-weight: 700; white-space: nowrap; }
.cart-bar.bump { animation: bump .3s; }
@keyframes bump { 50% { transform: translateX(-50%) scale(1.04); } }

/* drawer */
.drawer { position: fixed; inset: 0; z-index: 50; visibility: hidden; }
.drawer.open { visibility: visible; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(10, 12, 16, .5); opacity: 0; transition: opacity .2s; }
.drawer.open .drawer-backdrop { opacity: 1; }
.drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(480px, 100%); background: #fff; display: flex; flex-direction: column; transform: translateX(100%); transition: transform .25s ease; }
.drawer.open .drawer-panel { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 20px; }
.cart-list { list-style: none; margin: 0; padding: 8px 18px; overflow-y: auto; flex: 1; }
.cart-item { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cart-item-name { font-size: 14px; font-weight: 550; }
.cart-item-sum { font-weight: 700; white-space: nowrap; text-align: right; }
.cart-item-row { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); }
.cart-item .warn { color: #b26b00; font-size: 12px; grid-column: 1 / -1; }
.remove { background: none; border: 0; color: var(--danger); cursor: pointer; font-size: 13px; }
.drawer-foot { border-top: 1px solid var(--line); padding: 14px 18px calc(14px + env(safe-area-inset-bottom)); display: grid; gap: 10px; background: #fafbfc; }
.total { display: flex; justify-content: space-between; align-items: baseline; font-size: 18px; }
.total b { font-size: 22px; }
.field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.field input, .field textarea { border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: #fff; color: var(--ink); resize: vertical; }
.field input:focus, .field textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 180, 0, .2); }
.drawer-actions { display: flex; justify-content: space-between; }
.cart-empty { color: var(--muted); text-align: center; padding: 40px 0; }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; opacity: 0; pointer-events: none; transition: .2s; z-index: 60; max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 640px) {
  .phone { display: none; }
  .brand-text { font-size: 16px; }
  .hero { padding: 26px 0 36px; }
  .toolbar { top: 64px; padding: 10px; }
  #sort { flex: 1; }
  .item { grid-template-columns: 1fr auto; }
  .item-price { grid-row: auto; grid-column: 1; text-align: left; }
  .item-price small { display: inline; margin-left: 6px; }
  .item-buy { grid-row: 3; grid-column: 2; align-self: end; }
  .item-meta { grid-column: 1 / -1; }
  .cart-bar-text { display: none; }
  .cart-bar-sum { flex: 1; }
}
