/* 64-bit storefront: shared styles, loaded on every page.
   The component names are a contract: see docs/architecture.md before renaming anything.
   Mobile first. Breakpoints: 640px, 992px, 1280px. */

/* ---------- tokens ---------- */
:root {
  --brand: #1c6ea4;
  --brand-hover: #175b88;
  --brand-dark: #0b3d66;
  --brand-soft: #eef5fb;
  --ink: #14202e;
  --text: #37424f;
  --muted: #667383;
  --line: #e3e8ef;
  --line-strong: #cdd7e2;
  --bg: #fff;
  --bg-soft: #f4f7fa;
  --ok: #17794d;
  --ok-soft: #e7f6ee;
  --warn: #8f5b00;
  --warn-soft: #fff4d9;
  --danger: #c42d2d;
  --danger-soft: #fdecec;
  --info-soft: #e8f2fb;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 12px 32px rgba(11, 61, 102, .14);
  --shadow-sm: 0 1px 3px rgba(11, 61, 102, .10);
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --container: 1280px;
  --header-h: 60px;
  --font: "Segoe UI", system-ui, -apple-system, "Noto Sans Georgian", "Helvetica Neue", Arial, sans-serif;
}
@media (min-width: 992px) { :root { --header-h: 116px; } }

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 15px/1.55 var(--font);
  color: var(--text);
  background: var(--bg);
  overflow-wrap: break-word;
  padding-bottom: 60px; /* room for the mobile tab bar */
}
@media (min-width: 992px) { body { padding-bottom: 0; } }
body.has-drawer { overflow: hidden; }
img, svg, video { max-width: 100%; }
img { height: auto; }
h1, h2, h3, h4 { margin: 0 0 .5em; color: var(--ink); font-weight: 700; line-height: 1.25; }
h1 { font-size: clamp(24px, 3.2vw, 32px); }
h2 { font-size: clamp(20px, 2.4vw, 24px); }
h3 { font-size: 18px; }
p { margin: 0 0 1em; }
a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--brand-dark); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
::selection { background: #cfe3f3; }

.icon {
  width: 1.25em; height: 1.25em; flex: none; vertical-align: -.22em;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 300;
  padding: 10px 16px; border-radius: var(--radius-sm); background: var(--brand-dark); color: #fff;
}
.skip-link:focus { top: 8px; color: #fff; }
/* Wrapper of the hidden anti-spam field in public forms: off screen, still in the DOM. */
.hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- layout ---------- */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 16px; }
.page { padding-block: 20px 40px; }
.narrow { max-width: 560px; margin-inline: auto; }
.narrow-lg { max-width: 860px; margin-inline: auto; }
.split, .with-sidebar { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); align-items: start; }
.split-main, .split-aside, .with-sidebar > * { min-width: 0; }
.stack > * + * { margin-top: 16px; }
.stack-sm > * + * { margin-top: 8px; }
.stack-lg > * + * { margin-top: 32px; }
.row, .row-between, .row-center, .row-end { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.row-between { justify-content: space-between; }
.row-center { justify-content: center; }
.row-end { justify-content: flex-end; }
.grid-2, .grid-3, .grid-4 { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.section { margin-block: 32px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-head h2 { margin: 0; }
@media (min-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 992px) {
  .container { padding-inline: 24px; }
  .page { padding-block: 32px 64px; }
  .split { grid-template-columns: minmax(0, 1fr) 380px; gap: 32px; }
  .split-aside { position: sticky; top: calc(var(--header-h) + 16px); }
  .with-sidebar { grid-template-columns: 260px minmax(0, 1fr); gap: 32px; }
  .grid-2, .grid-3, .grid-4 { gap: 24px; }
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .section { margin-block: 48px; }
}

/* ---------- text ---------- */
.h1 { font-size: clamp(24px, 3.2vw, 32px); font-weight: 700; color: var(--ink); line-height: 1.25; }
.h2 { font-size: clamp(20px, 2.4vw, 24px); font-weight: 700; color: var(--ink); line-height: 1.25; }
.h3 { font-size: 18px; font-weight: 700; color: var(--ink); line-height: 1.3; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 600; color: var(--ink); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.w-full { width: 100%; }
.link { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: var(--brand); text-decoration: none; }
.link:hover { text-decoration: underline; }
.link .icon { width: 1em; height: 1em; }
.price { font-weight: 700; color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.price-old { margin-left: 6px; font-size: .82em; font-weight: 400; color: var(--muted); }

.prose { color: var(--text); font-size: 16px; line-height: 1.7; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose h1, .prose h2, .prose h3, .prose h4 { margin: 1.6em 0 .5em; }
.prose h2 { font-size: 22px; }
.prose h3 { font-size: 18px; }
.prose h4 { font-size: 16px; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose table { margin: 0 0 1em; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: .35em; }
.prose img { border-radius: var(--radius); }
.prose blockquote { padding: 4px 0 4px 16px; border-left: 3px solid var(--brand); color: var(--ink); }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; }
.prose th, .prose td { padding: 8px 12px; border: 1px solid var(--line); text-align: left; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px;
  background: var(--bg-soft); color: var(--text); font-size: 12px; font-weight: 600; line-height: 1.7; white-space: nowrap;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--brand-dark); }
.badge-muted { background: #eceff3; color: var(--muted); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 20px; border: 1px solid transparent; border-radius: 10px;
  background: var(--brand); color: #fff; font-size: 15px; font-weight: 600; line-height: 1.2;
  text-align: center; text-decoration: none; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:hover { background: var(--brand-hover); color: #fff; }
.btn:active { background: var(--brand-dark); }
.btn-outline { background: #fff; border-color: var(--line-strong); color: var(--brand-dark); }
.btn-outline:hover { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); }
.btn-ghost { background: transparent; color: var(--brand-dark); }
.btn-ghost:hover { background: var(--brand-soft); color: var(--brand-dark); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #a82424; }
.btn-sm { min-height: 36px; padding: 6px 14px; font-size: 14px; border-radius: 8px; }
.btn-lg { min-height: 52px; padding: 14px 28px; font-size: 16px; }
.btn-block { display: flex; width: 100%; }
.btn[disabled], .btn.is-disabled, .btn-icon[disabled] { opacity: .5; pointer-events: none; }
.btn.is-loading, .btn-icon.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after, .btn-icon.is-loading::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 18px; height: 18px;
  border: 2px solid #fff; border-right-color: transparent; border-radius: 50%; animation: spin .6s linear infinite;
}
.btn-outline.is-loading::after, .btn-ghost.is-loading::after { border-color: var(--brand); border-right-color: transparent; }
.btn-icon {
  display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; flex: none;
  border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--ink);
  text-decoration: none; cursor: pointer; transition: background-color .15s, color .15s, border-color .15s;
}
.btn-icon:hover { background: var(--bg-soft); color: var(--brand); }
[data-wishlist-toggle].is-active { color: #d6336c; }
[data-wishlist-toggle].is-active .icon { fill: currentColor; }
[data-compare-toggle].is-active { color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- forms ---------- */
.form > * + * { margin-top: 16px; }
.form-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) {
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-2 { grid-column: 1 / -1; }
}
.field { min-width: 0; }
.field > label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; color: var(--ink); }
.field :where(input:not([type="checkbox"], [type="radio"], [type="hidden"], [type="file"]), select, textarea), .input {
  display: block; width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line-strong); border-radius: 10px; background: #fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.field :where(textarea), textarea.input { min-height: 110px; resize: vertical; }
.field :where(input, select, textarea):focus, .input:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(28, 110, 164, .18);
}
.field ::placeholder, .input::placeholder { color: #98a3b1; }
.field.has-error :where(input, select, textarea) { border-color: var(--danger); }
.field-help { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.field-error, .errorlist { margin: 6px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--danger); }
.req { color: var(--danger); }
.check > label { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check input[type="checkbox"], .check input[type="radio"] { flex: none; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--brand); }

.qty { display: inline-flex; align-items: stretch; border: 1px solid var(--line-strong); border-radius: 10px; background: #fff; overflow: hidden; }
.qty > button { width: 40px; border: 0; background: transparent; color: var(--ink); font-size: 18px; line-height: 1; }
.qty > button:hover { background: var(--bg-soft); color: var(--brand); }
.qty > input {
  width: 52px; min-height: 42px; padding: 0; border: 0; border-radius: 0; background: transparent;
  text-align: center; font-weight: 600; color: var(--ink); -moz-appearance: textfield; appearance: textfield;
}
.qty > input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--brand); }
.qty > input::-webkit-outer-spin-button, .qty > input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-sm > button { width: 30px; font-size: 16px; }
.qty-sm > input { width: 38px; min-height: 30px; font-size: 14px; }

.radio-card {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px;
  border: 1px solid var(--line-strong); border-radius: var(--radius); background: #fff; cursor: pointer;
  transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.radio-card + .radio-card { margin-top: 10px; }
.radio-card input { flex: none; width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--brand); }
.radio-card-body { display: grid; gap: 2px; min-width: 0; }
.radio-card-body strong { color: var(--ink); }
.radio-card:hover { border-color: var(--brand); }
.radio-card:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }

/* ---------- surfaces ---------- */
.card { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.card-title { margin: 0 0 16px; font-size: 18px; }
.panel { padding: 16px 20px; border-radius: var(--radius); background: var(--bg-soft); }
@media (min-width: 992px) { .card { padding: 24px; } }
.divider { margin: 24px 0; border: 0; border-top: 1px solid var(--line); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { background: var(--bg-soft); color: var(--ink); font-weight: 600; white-space: nowrap; }
.table tbody tr:last-child > *, .table tfoot tr:last-child > * { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

.summary { display: grid; gap: 10px; margin: 0; }
.summary-row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 600; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }
.summary-total { margin-top: 2px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 18px; }
.summary-total dt { color: var(--ink); font-weight: 700; }
.summary-total dd { font-weight: 800; }

.alert { padding: 12px 16px; border: 1px solid transparent; border-radius: 10px; background: var(--info-soft); color: var(--brand-dark); }
.alert > :last-child { margin-bottom: 0; }
.alert + .alert { margin-top: 8px; }
.alert-success { background: var(--ok-soft); color: #0f5a38; }
.alert-error, .alert-danger { background: var(--danger-soft); color: #8f1f1f; }
.alert-warn, .alert-warning { background: var(--warn-soft); color: #6f4700; }
.alert-info, .alert-debug { background: var(--info-soft); color: var(--brand-dark); }
.messages { margin-top: 16px; }

.empty { display: grid; justify-items: center; gap: 12px; padding: 48px 16px; text-align: center; }
.empty > * { margin: 0; }
.empty-icon { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); }
.empty-icon .icon { width: 32px; height: 32px; }

/* ---------- navigation bits ---------- */
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.breadcrumbs a { color: inherit; text-decoration: none; }
.breadcrumbs a:hover { color: var(--brand); text-decoration: underline; }
.breadcrumbs [aria-current] { color: var(--ink); }

.steps { display: flex; flex-wrap: wrap; gap: 8px 12px; margin: 0 0 24px; padding: 0; list-style: none; counter-reset: step; }
.steps li { display: flex; align-items: center; gap: 8px; counter-increment: step; color: var(--muted); font-weight: 600; }
.steps li::before {
  content: counter(step); display: grid; place-items: center; width: 28px; height: 28px; flex: none;
  border-radius: 50%; background: var(--bg-soft); color: var(--muted); font-size: 13px;
}
.steps li:not(:last-child)::after { content: ""; width: 24px; height: 1px; background: var(--line-strong); }
.steps li.is-active { color: var(--ink); }
.steps li.is-active::before { background: var(--brand); color: #fff; }
.steps li.is-done { color: var(--text); }
.steps li.is-done::before { content: "✓"; background: var(--ok-soft); color: var(--ok); }

.side-nav { display: grid; gap: 2px; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.side-nav form { display: contents; }
.side-nav a, .side-nav button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--text); font-weight: 500; text-align: left; text-decoration: none; cursor: pointer;
}
.side-nav a:hover, .side-nav button:hover { background: var(--bg-soft); color: var(--brand-dark); }
.side-nav .is-active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }

.tabs-nav { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs-nav::-webkit-scrollbar { display: none; }
.tabs-nav > button {
  margin-bottom: -1px; padding: 12px 16px; border: 0; border-bottom: 2px solid transparent; background: none;
  color: var(--muted); font-weight: 600; white-space: nowrap;
}
.tabs-nav > button:hover { color: var(--ink); }
.tabs-nav > button.is-active { border-bottom-color: var(--brand); color: var(--brand-dark); }
.tabs-nav-fill > button { flex: 1; }
.tabs-panel { display: none; padding-top: 16px; }
.tabs-panel.is-active { display: block; }

.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 32px; }
.pagination a, .pagination span {
  display: inline-grid; place-items: center; min-width: 40px; height: 40px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font-weight: 600; text-decoration: none;
}
.pagination a:hover { border-color: var(--brand); color: var(--brand); }
.pagination .is-current { border-color: var(--brand); background: var(--brand); color: #fff; }
.pagination .gap { border-color: transparent; background: none; color: var(--muted); }

/* ---------- product card, grid, carousel ---------- */
.product-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) {
  .product-grid { gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .product-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 992px) {
  .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .product-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .product-grid.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

.pcard {
  position: relative; display: flex; flex-direction: column; min-width: 0; height: 100%;
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff; overflow: hidden;
  transition: box-shadow .2s, border-color .2s;
}
.pcard:hover, .pcard:focus-within { border-color: var(--line-strong); box-shadow: var(--shadow); }
.pcard-media { position: relative; aspect-ratio: 1 / 1; padding: 12px; background: #fff; }
.pcard-media > a { display: block; height: 100%; }
.pcard-media img { display: block; width: 100%; height: 100%; object-fit: contain; }
.pcard-noimg { display: grid; place-items: center; height: 100%; color: #b8c2cf; }
.pcard-noimg .icon { width: 48px; height: 48px; stroke-width: 1.5; }
.pcard-flag { position: absolute; top: 10px; left: 10px; }
.pcard-tools { position: absolute; top: 8px; right: 8px; display: grid; gap: 6px; }
.pcard-tools .btn-icon { width: 36px; height: 36px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); border-color: var(--line); }
.pcard-tools .btn-icon:hover { background: var(--brand-soft); }
.pcard-tools .icon { width: 17px; height: 17px; }
@media (hover: hover) and (min-width: 992px) {
  .pcard-tools .btn-icon:not(.is-active) { opacity: 0; transform: translateX(6px); transition: opacity .15s, transform .15s, background-color .15s; }
  .pcard:hover .pcard-tools .btn-icon, .pcard:focus-within .pcard-tools .btn-icon { opacity: 1; transform: none; }
}
.pcard-body { display: flex; flex-direction: column; flex: 1; gap: 6px; padding: 12px 14px 14px; border-top: 1px solid var(--line); }
.pcard-cat { align-self: flex-start; font-size: 12px; color: var(--muted); text-decoration: none; }
.pcard-cat:hover { color: var(--brand); }
.pcard-title { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.4; }
.pcard-title a {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
  color: var(--ink); text-decoration: none;
}
.pcard-title a:hover { color: var(--brand); }
.pcard-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 6px; min-height: 46px; }
.pcard-foot .price { font-size: 16px; white-space: normal; }
.pcard-buy { background: var(--brand); color: #fff; }
.pcard-buy:hover { background: var(--brand-hover); color: #fff; }
@media (min-width: 640px) { .pcard-foot .price { font-size: 17px; } }

.carousel { position: relative; --per-view: 2; --gap: 12px; }
.carousel-track {
  display: grid; grid-auto-flow: column; gap: var(--gap);
  grid-auto-columns: calc((100% - (var(--per-view) - 1) * var(--gap)) / var(--per-view));
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: none;
  padding: 2px 2px 10px; margin: -2px -2px -10px;
}
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-item { min-width: 0; scroll-snap-align: start; }
.carousel-btn {
  position: absolute; top: 38%; z-index: 2; display: none; place-items: center; width: 40px; height: 40px;
  border: 1px solid var(--line); border-radius: 50%; background: #fff; color: var(--ink); box-shadow: var(--shadow-sm);
}
.carousel-btn:hover { border-color: var(--brand); color: var(--brand); }
.carousel-btn.is-prev { left: -14px; }
.carousel-btn.is-next { right: -14px; }
.carousel-btn[disabled] { opacity: 0; pointer-events: none; }
@media (min-width: 640px) { .carousel { --per-view: 3; --gap: 16px; } }
@media (min-width: 992px) {
  .carousel { --per-view: 4; }
  .carousel-btn { display: grid; }
}
@media (min-width: 1280px) { .carousel { --per-view: 5; } }

/* ---------- top bar and header ---------- */
.topbar { background: var(--brand-dark); color: #d6e4f1; font-size: 13px; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 36px; }
.topbar-group { display: flex; align-items: center; gap: 8px 18px; }
.topbar a { display: inline-flex; align-items: center; gap: 6px; color: inherit; text-decoration: none; }
.topbar a:hover { color: #fff; }
.topbar .icon { width: 14px; height: 14px; }

.header { display: contents; }
.header-bar { position: sticky; top: 0; z-index: 50; background: #fff; border-bottom: 1px solid var(--line); transition: box-shadow .2s; }
.header-bar.is-stuck, .header.is-stuck { box-shadow: 0 4px 16px rgba(11, 61, 102, .10); }
.header-main { display: flex; align-items: center; gap: 8px; min-height: 60px; }
.logo { display: inline-flex; flex: none; }
.logo img { display: block; width: auto; height: 34px; }
.header-search { padding: 10px 0; background: #fff; border-bottom: 1px solid var(--line); }
.header-actions { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.action {
  position: relative; display: grid; justify-items: center; gap: 1px; padding: 6px 10px; border: 0; border-radius: 10px;
  background: none; color: var(--ink); font-size: 12px; line-height: 1.3; text-decoration: none; white-space: nowrap; cursor: pointer;
}
.action:hover { background: var(--bg-soft); color: var(--brand); }
.action .icon { width: 22px; height: 22px; }
.action-cart .action-label { font-weight: 700; }
.count {
  position: absolute; top: 0; left: 50%; margin-left: 3px; display: grid; place-items: center; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: 9px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; line-height: 1;
}
.count.is-zero { display: none; }

.search-slot { flex: 1; min-width: 0; max-width: 640px; }
.search { position: relative; flex: 1; min-width: 0; }
.search > input {
  display: block; width: 100%; height: 44px; padding: 0 50px 0 18px; border: 1.5px solid var(--line-strong); border-radius: 999px;
  background: var(--bg-soft); color: var(--ink); transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.search > input::placeholder { color: #8a96a5; }
.search > input:focus { outline: none; border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(28, 110, 164, .16); }
.search > button {
  position: absolute; top: 4px; right: 4px; display: grid; place-items: center; width: 36px; height: 36px;
  border: 0; border-radius: 50%; background: var(--brand); color: #fff;
}
.search > button:hover { background: var(--brand-hover); }
.search > button .icon { width: 18px; height: 18px; }
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 60; max-height: min(70vh, 560px); overflow-y: auto;
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow);
}
.search-group { padding: 10px 14px 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.search-item { display: flex; align-items: center; gap: 12px; padding: 8px 14px; color: var(--ink); text-decoration: none; }
.search-item:hover, .search-item.is-focused { background: var(--bg-soft); color: var(--ink); }
.search-item img { flex: none; width: 48px; height: 48px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.search-item-name { flex: 1; min-width: 0; font-size: 14px; line-height: 1.35; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.search-item-price { flex: none; font-weight: 700; white-space: nowrap; }
.search-cat { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 14px; color: var(--ink); text-decoration: none; font-size: 14px; }
.search-cat:hover, .search-cat.is-focused { background: var(--bg-soft); }
.search-all { display: block; padding: 12px 14px; border-top: 1px solid var(--line); background: var(--bg-soft); font-weight: 600; text-align: center; text-decoration: none; }
.search-all:hover, .search-all.is-focused { background: var(--brand-soft); }
.search-empty { margin: 0; padding: 16px 14px; color: var(--muted); }

.navbar { background: #fff; border-top: 1px solid var(--line); }
.navbar-inner { position: relative; display: flex; align-items: center; gap: 20px; min-height: 48px; }
.catmenu-toggle {
  display: inline-flex; align-items: center; gap: 10px; height: 38px; padding: 0 16px; border: 0; border-radius: 10px;
  background: var(--brand); color: #fff; font-weight: 600;
}
.catmenu-toggle:hover, .catmenu.is-open .catmenu-toggle { background: var(--brand-hover); }
.catmenu-toggle .icon:last-child { width: 16px; height: 16px; transition: transform .15s; }
.catmenu.is-open .catmenu-toggle .icon:last-child { transform: rotate(180deg); }
.catmenu-panel {
  position: absolute; top: calc(100% + 1px); left: 0; z-index: 55; display: none; align-items: stretch;
  border: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); background: #fff; box-shadow: var(--shadow);
}
.catmenu.is-open .catmenu-panel { display: flex; }
.catmenu-list { width: 300px; max-height: calc(100vh - var(--header-h) - 24px); margin: 0; padding: 8px; overflow-y: auto; list-style: none; }
.catmenu-item > a {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: var(--radius-sm);
  color: var(--ink); font-weight: 500; line-height: 1.3; text-decoration: none;
}
.catmenu-item > a img, .accordion img { flex: none; width: 22px; height: 22px; object-fit: contain; }
.catmenu-item > a > span:not(.catmenu-dot) { flex: 1; min-width: 0; }
.catmenu-item > a .icon { width: 16px; height: 16px; color: var(--muted); }
.catmenu-item > a:hover, .catmenu-item > a.is-current { background: var(--brand-soft); color: var(--brand-dark); }
.catmenu-dot { display: grid; place-items: center; flex: none; width: 22px; height: 22px; }
.catmenu-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); }
.catmenu-subs { display: none; width: 520px; max-height: calc(100vh - var(--header-h) - 24px); padding: 18px 24px; overflow-y: auto; border-left: 1px solid var(--line); }
.catmenu-panel.has-sub .catmenu-subs { display: block; }
.catmenu-sub-title { display: inline-flex; align-items: baseline; gap: 8px; margin-bottom: 12px; color: var(--ink); font-size: 17px; font-weight: 700; text-decoration: none; }
.catmenu-sub-title:hover { color: var(--brand); }
.catmenu-sub ul { margin: 0; padding: 0; list-style: none; columns: 2; column-gap: 28px; }
.catmenu-sub li { break-inside: avoid; }
.catmenu-sub li a { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 7px 0; color: var(--text); text-decoration: none; }
.catmenu-sub li a:hover { color: var(--brand); }
.catmenu-sub .muted { font-size: 12px; font-weight: 400; }
.mainnav { display: flex; flex-wrap: wrap; gap: 2px; margin: 0; padding: 0; list-style: none; }
.mainnav a { display: block; padding: 8px 14px; border-radius: var(--radius-sm); color: var(--ink); font-size: 14px; font-weight: 600; text-decoration: none; }
.mainnav a:hover { background: var(--bg-soft); color: var(--brand); }
.mainnav a.is-active { color: var(--brand); }

@media (min-width: 992px) {
  .header { display: block; position: sticky; top: 0; z-index: 50; background: #fff; }
  .header-bar { position: static; border-bottom: 0; box-shadow: none !important; }
  .header-main { gap: 28px; min-height: 68px; }
  .logo img { height: 42px; }
  .navbar { border-bottom: 1px solid var(--line); }
}

/* ---------- page header band ---------- */
.page-header { padding: 18px 0 20px; background: linear-gradient(120deg, var(--brand-dark), #14568a); color: #fff; }
.page-header h1 { margin: 8px 0 0; color: #fff; }
.page-header .breadcrumbs { color: rgba(255, 255, 255, .72); }
.page-header .breadcrumbs a:hover { color: #fff; }
.page-header .breadcrumbs [aria-current] { color: #fff; }
.page-header-sub { margin: 6px 0 0; color: rgba(255, 255, 255, .82); }
@media (min-width: 992px) { .page-header { padding: 26px 0 30px; } }

/* ---------- drawers ---------- */
.drawer-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(10, 25, 41, .5); opacity: 0; transition: opacity .25s; }
.drawer-backdrop.is-open { opacity: 1; }
.drawer {
  position: fixed; top: 0; bottom: 0; z-index: 100; display: flex; flex-direction: column; width: min(400px, 92vw);
  background: #fff; box-shadow: var(--shadow); visibility: hidden; transition: transform .25s ease, visibility 0s .25s;
}
.drawer-left { left: 0; transform: translateX(-100%); }
.drawer-right { right: 0; transform: translateX(100%); }
.drawer.is-open { transform: none; visibility: visible; transition: transform .25s ease, visibility 0s; }
.drawer:focus { outline: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--line); font-size: 17px; color: var(--ink); }
.drawer-body { flex: 1; min-height: 0; padding: 12px 16px 24px; overflow-y: auto; overscroll-behavior: contain; }
.drawer-loading { padding: 24px 0; text-align: center; }
.drawer-links { margin: 0; padding: 0; list-style: none; }
.drawer-links a { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); color: var(--ink); font-weight: 500; text-decoration: none; }
.drawer-links .icon { color: var(--brand); }
.drawer-contacts { margin-top: 16px; }
.drawer-contacts a { border-bottom: 0; padding-block: 8px; color: var(--text); }

.accordion details { border-bottom: 1px solid var(--line); }
.accordion summary { display: flex; align-items: center; gap: 12px; padding: 12px 4px; color: var(--ink); font-weight: 600; list-style: none; cursor: pointer; }
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary > span:not(.catmenu-dot) { flex: 1; min-width: 0; }
.accordion summary .icon { width: 18px; height: 18px; color: var(--muted); transition: transform .15s; }
.accordion details[open] summary .icon { transform: rotate(180deg); }
.accordion ul { margin: 0; padding: 0 0 10px 38px; list-style: none; }
.accordion li a { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 8px 4px; color: var(--text); text-decoration: none; }
.accordion-link { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); color: var(--ink); font-weight: 600; text-decoration: none; }

/* cart drawer */
.drawer-body[data-cart-drawer] { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.mini-cart { flex: 1; min-height: 0; margin: 0; padding: 4px 16px; overflow-y: auto; overscroll-behavior: contain; list-style: none; }
.mini-cart-line { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 14px 0; border-bottom: 1px solid var(--line); }
.mini-cart-line:last-child { border-bottom: 0; }
.mini-cart-thumb { display: grid; place-items: center; width: 64px; height: 64px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; overflow: hidden; }
.mini-cart-thumb img { width: 100%; height: 100%; object-fit: contain; }
.mini-cart-info { min-width: 0; }
.mini-cart-name { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; color: var(--ink); font-size: 14px; font-weight: 600; line-height: 1.35; text-decoration: none; }
.mini-cart-name:hover { color: var(--brand); }
.mini-cart-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.mini-cart-remove { width: 32px; height: 32px; color: var(--muted); }
.mini-cart-remove:hover { color: var(--danger); background: var(--danger-soft); }
.mini-cart-remove .icon { width: 16px; height: 16px; }
.mini-cart-foot { display: grid; gap: 10px; padding: 16px; border-top: 1px solid var(--line); background: #fff; }
.mini-cart-hint { display: flex; align-items: center; gap: 8px; margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--brand-soft); color: var(--brand-dark); font-size: 13px; }
.mini-cart-hint.is-ok { background: var(--ok-soft); color: var(--ok); }
.mini-cart-total { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 16px; }
.mini-cart-total .price { font-size: 18px; }
.drawer-body[data-cart-drawer] > .empty { margin: auto 0; }
.drawer-body[data-cart-drawer].is-busy { opacity: .6; pointer-events: none; }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 16px; bottom: 76px; z-index: 200; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--radius); background: var(--ink); color: #fff;
  font-size: 14px; line-height: 1.4; box-shadow: var(--shadow); pointer-events: auto; animation: toast-in .2s ease;
}
.toast .icon { margin-top: 1px; color: #7fd1a6; }
.toast-error { background: #a82424; }
.toast-error .icon, .toast-info .icon { color: #fff; }
.toast.is-leaving { opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@media (min-width: 992px) { .toasts { bottom: 24px; right: 24px; } }

/* ---------- footer and mobile tab bar ---------- */
.footer { margin-top: 48px; border-top: 1px solid var(--line); background: var(--bg-soft); font-size: 14px; }
.footer-grid { display: grid; gap: 28px; padding-block: 36px; grid-template-columns: minmax(0, 1fr); }
.footer h2 { margin: 0 0 12px; font-size: 15px; }
.footer ul { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.footer a { color: var(--text); text-decoration: none; }
.footer a:hover { color: var(--brand); }
.footer .logo img { height: 40px; }
.footer-about p { max-width: 38ch; margin: 14px 0 0; color: var(--muted); }
.socials { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.socials a { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: var(--brand-dark); }
.socials a:hover { border-color: var(--brand); background: var(--brand); color: #fff; }
.socials .icon { width: 18px; height: 18px; }
.footer-contacts li { display: flex; align-items: flex-start; gap: 10px; }
.footer-contacts .icon { width: 16px; height: 16px; margin-top: 3px; color: var(--brand); }
.footer-bottom { padding: 16px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
@media (min-width: 640px) { .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 992px) { .footer-grid { grid-template-columns: 1.4fr 1fr 1fr 1.2fr; gap: 40px; padding-block: 48px; } }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 80; display: grid; grid-template-columns: repeat(4, 1fr);
  padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid var(--line); background: #fff;
}
.tabbar > a, .tabbar > button {
  position: relative; display: grid; justify-items: center; gap: 2px; padding: 8px 4px 7px; border: 0; background: none;
  color: var(--text); font-size: 11px; line-height: 1.3; text-decoration: none;
}
.tabbar .icon { width: 22px; height: 22px; }
.tabbar .count { top: 3px; margin-left: 5px; }

/* ---------- helpers ---------- */
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 8px !important; } .mt-2 { margin-top: 16px !important; }
.mt-3 { margin-top: 24px !important; } .mt-4 { margin-top: 32px !important; }
.mb-0 { margin-bottom: 0 !important; } .mb-1 { margin-bottom: 8px !important; } .mb-2 { margin-bottom: 16px !important; }
.mb-3 { margin-bottom: 24px !important; } .mb-4 { margin-bottom: 32px !important; }
@media (max-width: 991.98px) { .hide-mobile { display: none !important; } }
@media (min-width: 992px) { .hide-desktop { display: none !important; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media print {
  .topbar, .header, .header-bar, .header-search, .footer, .tabbar, .drawer, .drawer-backdrop, .toasts { display: none !important; }
  body { padding-bottom: 0; }
}
