/* =========================================================
   Catalog Lab — local prototype UI
   ========================================================= */

:root {
  --bg: #06070d;
  --bg-2: #0a0c16;
  --surface: #0f1220;
  --surface-2: #151a2c;
  --surface-3: #1e2439;
  --border: rgba(255, 255, 255, .07);
  --border-2: rgba(255, 255, 255, .14);
  --accent: #8b5cf6;
  --accent-2: #22d3ee;
  --accent-h: #a78bfa;
  --grad-accent: linear-gradient(135deg, #8b5cf6 0%, #6366f1 48%, #22d3ee 100%);
  --success: #34d399;
  --warn: #fbbf24;
  --danger: #fb7185;
  --text: #eef0fb;
  --muted: #8b90ad;
  --muted-2: #b6bad6;
  --radius: 16px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --shadow-sm: 0 2px 10px rgba(2, 3, 10, .35);
  --shadow: 0 18px 50px rgba(2, 3, 10, .55);
  --shadow-lg: 0 30px 80px rgba(2, 3, 10, .65);
  --glass: rgba(17, 21, 36, .62);
  --glass-2: rgba(17, 21, 36, .9);
  --topbar-h: 68px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { color-scheme: dark; scroll-behavior: smooth; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(58% 46% at 82% -6%, rgba(34, 211, 238, .13), transparent 68%),
    radial-gradient(54% 44% at 6% 2%, rgba(139, 92, 246, .18), transparent 70%),
    radial-gradient(70% 55% at 50% 112%, rgba(99, 102, 241, .12), transparent 72%),
    var(--bg);
}
body::after {
  content: '';
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .018) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(120% 80% at 50% -10%, #000 0%, transparent 72%);
  mask-image: radial-gradient(120% 80% at 50% -10%, #000 0%, transparent 72%);
}

.bg-aurora {
  position: fixed; inset: -20vmax; z-index: -1; pointer-events: none;
  overflow: hidden; filter: blur(75px); opacity: .4;
}
.bg-aurora span { position: absolute; display: block; width: 46vmax; height: 46vmax; border-radius: 50%; mix-blend-mode: screen; }
.bg-aurora span:nth-child(1) { top: -8%; left: -6%; background: radial-gradient(circle, rgba(139, 92, 246, .5), transparent 62%); animation: drift-a 28s ease-in-out infinite; }
.bg-aurora span:nth-child(2) { top: 18%; right: -12%; background: radial-gradient(circle, rgba(34, 211, 238, .36), transparent 62%); animation: drift-b 34s ease-in-out infinite; }
.bg-aurora span:nth-child(3) { bottom: -18%; left: 22%; background: radial-gradient(circle, rgba(99, 102, 241, .34), transparent 64%); animation: drift-c 40s ease-in-out infinite; }
@keyframes drift-a { 0%, 100% { transform: translate3d(0, 0, 0) scale(1); } 50% { transform: translate3d(6vmax, 4vmax, 0) scale(1.12); } }
@keyframes drift-b { 0%, 100% { transform: translate3d(0, 0, 0) scale(1.05); } 50% { transform: translate3d(-5vmax, 6vmax, 0) scale(.95); } }
@keyframes drift-c { 0%, 100% { transform: translate3d(0, 0, 0) scale(.98); } 50% { transform: translate3d(4vmax, -5vmax, 0) scale(1.1); } }

a { color: var(--accent-h); text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
img { max-width: 100%; display: block; }
::selection { background: rgba(139, 92, 246, .4); color: #fff; }
:focus-visible { outline: 2px solid rgba(139, 92, 246, .85); outline-offset: 3px; border-radius: 8px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

* { scrollbar-width: thin; scrollbar-color: rgba(139, 92, 246, .4) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: rgba(139, 92, 246, .32); border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(139, 92, 246, .55); }

/* ---------------- Topbar ---------------- */

.topbar {
  position: sticky; top: 0; z-index: 60;
  height: var(--topbar-h);
  background: rgba(6, 7, 13, .72);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}
.topbar-inner {
  max-width: 1480px; margin: 0 auto; padding: 0 22px;
  height: 100%; display: flex; align-items: center; gap: 20px;
}
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; letter-spacing: -.02em; white-space: nowrap; }
.logo:hover { color: var(--text); }
.logo-mark {
  width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center;
  background: var(--grad-accent); font-size: 18px; box-shadow: 0 8px 22px rgba(99, 102, 241, .35);
}
.logo-text { font-size: 16px; }
.logo-text b { color: var(--accent-h); }

.topbar-search {
  position: relative; flex: 1; max-width: 640px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
  height: 44px; padding: 0 12px;
  background: rgba(15, 18, 32, .76);
  border: 1px solid var(--border-2);
  border-radius: 14px;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.topbar-search:focus-within {
  border-color: rgba(139, 92, 246, .65);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, .13);
  background: rgba(17, 21, 36, .95);
}
.search-ico { width: 19px; height: 19px; color: var(--muted); flex: none; }
.topbar-search input {
  flex: 1; min-width: 0; height: 100%; background: transparent; border: 0; outline: none;
  font-size: 14.5px; color: var(--text);
}
.topbar-search input::placeholder { color: #6e7390; }
.search-kbd {
  padding: 2px 7px; border: 1px solid var(--border-2); border-radius: 6px;
  font-size: 11px; color: var(--muted); background: rgba(255, 255, 255, .03);
}
.search-clear {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  color: var(--muted); background: rgba(255, 255, 255, .06); font-size: 15px;
}
.search-clear:hover { color: var(--text); background: rgba(255, 255, 255, .12); }

.topbar-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.icon-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 12px; border-radius: 11px;
  border: 1px solid var(--border); background: rgba(255, 255, 255, .025);
  color: var(--muted-2); font-size: 13px; font-weight: 600;
  transition: .18s;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-2); background: rgba(255, 255, 255, .06); }
.lang-btn { min-width: 46px; justify-content: center; letter-spacing: .04em; }
.cart-btn { position: relative; }
.cart-badge {
  min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px;
  display: grid; place-items: center; background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700;
}

/* Search suggestions */
.suggest {
  position: absolute; top: calc(100% + 10px); left: 0; right: 0; z-index: 90;
  max-height: min(520px, 70vh); overflow: auto;
  background: rgba(13, 16, 29, .98);
  border: 1px solid var(--border-2); border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 8px;
}
.sg-label { padding: 8px 10px 5px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.sg-item {
  width: 100%; display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: 11px; text-align: left; color: var(--text);
}
.sg-item:hover, .sg-item.active { background: rgba(139, 92, 246, .12); }
.sg-mark {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff;
  background: linear-gradient(140deg, var(--brand, #6366f1), color-mix(in srgb, var(--brand, #6366f1) 45%, #05060c));
}
.sg-main { flex: 1; min-width: 0; }
.sg-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-price { font-size: 12.5px; font-weight: 700; color: var(--muted-2); white-space: nowrap; }
.sg-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 10px; margin: 2px 4px 2px 0; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted-2); font-size: 12px;
}
.sg-chip:hover { color: var(--text); border-color: var(--border-2); background: rgba(255, 255, 255, .05); }
.sg-chip.active { color: #fff; border-color: rgba(139, 92, 246, .6); background: rgba(139, 92, 246, .18); }
.sg-hint { padding: 8px 10px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--border); margin-top: 5px; }

/* ---------------- Page layout ---------------- */

.page {
  max-width: 1480px; margin: 0 auto; padding: 24px 22px 72px;
  display: grid; grid-template-columns: 272px minmax(0, 1fr); gap: 26px;
  align-items: start;
}

.sidebar {
  position: sticky; top: calc(var(--topbar-h) + 18px);
  max-height: calc(100vh - var(--topbar-h) - 36px);
  overflow: auto; padding: 18px;
  background: linear-gradient(180deg, rgba(17, 21, 36, .8), rgba(12, 15, 27, .68));
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.side-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.side-title { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.filters-close, .filters-toggle { display: none; }
.side-block { padding: 14px 0; border-top: 1px solid var(--border); }
.side-block:first-of-type { border-top: 0; padding-top: 0; }
.side-label, .side-label-row { margin-bottom: 9px; }
.side-label { font-size: 10.5px; letter-spacing: .11em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.side-label-row { display: flex; align-items: baseline; justify-content: space-between; }
.side-label-row .side-label { margin-bottom: 0; }
.side-count { font-size: 10.5px; color: var(--muted); }

.cat-list { display: flex; flex-direction: column; gap: 3px; }
.cat-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border-radius: 11px; color: var(--muted-2);
  font-size: 13.5px; font-weight: 500; text-align: left;
  transition: .15s;
}
.cat-btn:hover { background: rgba(255, 255, 255, .045); color: var(--text); }
.cat-btn.active { background: rgba(139, 92, 246, .14); color: #fff; box-shadow: inset 0 0 0 1px rgba(139, 92, 246, .28); }
.cat-ico { width: 17px; height: 17px; flex: none; color: currentColor; opacity: .85; }
.cat-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-count { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

.side-search {
  width: 100%; height: 34px; padding: 0 10px; margin-bottom: 7px;
  background: rgba(255, 255, 255, .035); border: 1px solid var(--border);
  border-radius: 9px; font-size: 12.5px; outline: none;
}
.side-search:focus { border-color: rgba(139, 92, 246, .55); }
.side-search::placeholder { color: #676c87; }

.brand-list, .region-list { display: flex; flex-direction: column; gap: 2px; }
.brand-list { max-height: 270px; overflow: auto; }
.region-list { max-height: 260px; overflow: auto; }
.facet {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 6px 8px; border-radius: 9px; color: var(--muted-2);
  font-size: 12.5px; text-align: left;
}
.facet:hover { background: rgba(255, 255, 255, .04); color: var(--text); }
.facet.active { background: rgba(34, 211, 238, .1); color: #fff; }
.facet-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.facet-flag { width: 17px; height: 12px; object-fit: cover; border-radius: 2px; flex: none; background: rgba(255, 255, 255, .08); }
.facet-globe { width: 17px; text-align: center; font-size: 11px; flex: none; }
.facet-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.facet-count { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.side-more { margin-top: 6px; font-size: 11.5px; font-weight: 600; color: var(--accent-h); }
.side-more:hover { color: #c9b8ff; }

.switch-row { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 12.5px; color: var(--muted-2); }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track {
  width: 36px; height: 20px; border-radius: 999px; flex: none;
  background: rgba(255, 255, 255, .1); border: 1px solid var(--border-2);
  position: relative; transition: .18s;
}
.switch-thumb {
  position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: #9aa0bd; transition: .18s;
}
.switch-row input:checked + .switch-track { background: rgba(139, 92, 246, .55); border-color: rgba(139, 92, 246, .8); }
.switch-row input:checked + .switch-track .switch-thumb { transform: translateX(16px); background: #fff; }

.price-row { display: flex; align-items: center; gap: 6px; }
.price-input {
  width: 100%; height: 34px; padding: 0 9px;
  background: rgba(255, 255, 255, .035); border: 1px solid var(--border);
  border-radius: 9px; font-size: 12.5px; outline: none; -moz-appearance: textfield;
}
.price-input::-webkit-outer-spin-button, .price-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.price-input:focus { border-color: rgba(139, 92, 246, .55); }
.price-dash { color: var(--muted); font-size: 12px; }
.price-presets { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.preset {
  padding: 4px 8px; border-radius: 999px; border: 1px solid var(--border);
  font-size: 10.5px; color: var(--muted); background: rgba(255, 255, 255, .02);
}
.preset:hover, .preset.active { color: var(--text); border-color: rgba(139, 92, 246, .45); background: rgba(139, 92, 246, .1); }

.reset-btn {
  width: 100%; height: 36px; margin-top: 4px; border-radius: 10px;
  border: 1px solid var(--border); color: var(--muted-2); font-size: 12.5px; font-weight: 600;
}
.reset-btn:hover { color: var(--text); border-color: var(--border-2); background: rgba(255, 255, 255, .04); }

/* ---------------- Content ---------------- */

.content { min-width: 0; }
.content-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 7px; margin-bottom: 8px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-h);
}
.pulse-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--success);
  box-shadow: 0 0 0 0 rgba(52, 211, 153, .5); animation: pulse 2.4s infinite;
}
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(52, 211, 153, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); } }
h1 { font-size: clamp(26px, 3.2vw, 40px); line-height: 1.05; letter-spacing: -.035em; font-weight: 800; }
.page-sub { margin-top: 8px; max-width: 620px; color: var(--muted); font-size: 13.5px; }

.hero-stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 12px; }
.stat-pill {
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: rgba(255, 255, 255, .025);
  font-size: 11.5px; color: var(--muted);
}
.stat-pill b { font-size: 13px; color: var(--text); font-variant-numeric: tabular-nums; }

.quick-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 16px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 31px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--border); background: rgba(255, 255, 255, .025);
  color: var(--muted-2); font-size: 12px; font-weight: 500; transition: .15s;
}
.chip:hover { color: var(--text); border-color: var(--border-2); background: rgba(255, 255, 255, .05); transform: translateY(-1px); }
.chip.active { color: #fff; border-color: rgba(139, 92, 246, .55); background: rgba(139, 92, 246, .16); }
.chip-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand, var(--accent)); flex: none; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.result-count { font-size: 12.5px; color: var(--muted); }
.result-count b { color: var(--text); }
.toolbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.group-toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12px; color: var(--muted-2); user-select: none; }
.group-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.check-box {
  width: 16px; height: 16px; border-radius: 5px; border: 1px solid var(--border-2);
  display: grid; place-items: center; transition: .15s; background: rgba(255, 255, 255, .03);
}
.group-toggle input:checked + .check-box { background: var(--accent); border-color: var(--accent); }
.group-toggle input:checked + .check-box::after { content: '✓'; font-size: 10px; font-weight: 900; color: #fff; }
.select {
  height: 34px; padding: 0 32px 0 11px; border-radius: 9px;
  background: rgba(255, 255, 255, .035); border: 1px solid var(--border);
  font-size: 12.5px; color: var(--muted-2); outline: none; cursor: pointer;
}
.select:focus { border-color: rgba(139, 92, 246, .55); }

.active-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 9px; border-radius: 8px;
  border: 1px solid rgba(139, 92, 246, .3); background: rgba(139, 92, 246, .1);
  color: #dcd3ff; font-size: 11.5px;
}
.filter-chip:hover { background: rgba(139, 92, 246, .18); }
.filter-chip b { font-weight: 600; }

/* ---------------- Cards ---------------- */

.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(218px, 1fr));
  gap: 14px;
}
.card {
  position: relative; display: flex; flex-direction: column; min-height: 196px;
  padding: 14px; border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(23, 28, 48, .78), rgba(13, 16, 29, .86));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  cursor: pointer; overflow: hidden;
  transition: transform .18s ease, border-color .18s, box-shadow .18s;
}
.card::before {
  content: ''; position: absolute; inset: -40% -25% auto -25%; height: 110px;
  background: radial-gradient(60% 100% at 50% 0%, color-mix(in srgb, var(--brand, #6366f1) 34%, transparent), transparent 72%);
  opacity: .7; pointer-events: none; transition: opacity .2s;
}
.card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--brand, #8b5cf6) 45%, var(--border-2));
  box-shadow: 0 20px 46px rgba(2, 3, 10, .55), 0 0 0 1px color-mix(in srgb, var(--brand, #8b5cf6) 18%, transparent);
}
.card:hover::before { opacity: 1; }
.card.is-oos { opacity: .6; }
.card.is-oos:hover { opacity: .78; }

.card-top { display: flex; align-items: flex-start; gap: 9px; position: relative; z-index: 1; }
.card-mark {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(140deg, var(--brand, #6366f1), color-mix(in srgb, var(--brand, #6366f1) 38%, #05060c));
  color: #fff; font-size: 13px; font-weight: 800; letter-spacing: -.03em;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--brand, #6366f1) 26%, transparent), inset 0 1px 0 rgba(255, 255, 255, .22);
  text-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}
.card-cat {
  flex: 1; min-width: 0; padding-top: 3px;
  font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fav-btn {
  width: 26px; height: 26px; border-radius: 8px; flex: none;
  display: grid; place-items: center; color: var(--muted); transition: .15s;
}
.fav-btn svg { width: 15px; height: 15px; }
.fav-btn:hover { color: var(--danger); background: rgba(251, 113, 133, .1); }
.fav-btn.active { color: var(--danger); }

.card-title {
  position: relative; z-index: 1;
  margin: 12px 0 8px; font-size: 14.5px; line-height: 1.25; font-weight: 650;
  letter-spacing: -.015em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-title mark { background: rgba(251, 191, 36, .22); color: #ffe8a3; border-radius: 3px; padding: 0 1px; }

.card-badges { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 9px; position: relative; z-index: 1; }
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 21px; padding: 0 7px; border-radius: 6px;
  font-size: 10.5px; font-weight: 600; color: var(--muted-2);
  background: rgba(255, 255, 255, .045); border: 1px solid rgba(255, 255, 255, .05);
}
.badge.stock { color: #8cf0c7; background: rgba(52, 211, 153, .1); border-color: rgba(52, 211, 153, .18); }
.badge.low { color: #ffd88a; background: rgba(251, 191, 36, .1); border-color: rgba(251, 191, 36, .2); }
.badge.oos { color: #ffa8b7; background: rgba(251, 113, 133, .1); border-color: rgba(251, 113, 133, .2); }
.badge.platform { color: #c7c9ff; background: rgba(99, 102, 241, .12); border-color: rgba(99, 102, 241, .18); }
.flag-stack { display: inline-flex; align-items: center; }
.flag-stack img {
  width: 15px; height: 11px; border-radius: 2px; object-fit: cover;
  border: 1px solid rgba(0, 0, 0, .35); margin-left: -3px; background: rgba(255, 255, 255, .1);
}
.flag-stack img:first-child { margin-left: 0; }
.flag-stack .flag-more { margin-left: 3px; font-size: 10px; color: var(--muted); }

.card-denoms { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; padding-top: 4px; position: relative; z-index: 1; }
.denom-chip {
  padding: 2px 6px; border-radius: 5px; font-size: 10.5px; color: var(--muted-2);
  background: rgba(255, 255, 255, .04); white-space: nowrap; max-width: 132px;
  overflow: hidden; text-overflow: ellipsis;
}
.denom-chip.more { color: var(--accent-h); background: rgba(139, 92, 246, .1); }

.card-foot {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  margin-top: 11px; padding-top: 10px; border-top: 1px solid var(--border); position: relative; z-index: 1;
}
.card-price-label { font-size: 10.5px; color: var(--muted); }
.card-price { font-size: 16px; font-weight: 800; letter-spacing: -.02em; }
.card-price small { font-size: 10px; font-weight: 500; color: var(--muted); }
.card-arrow { color: var(--muted); font-size: 15px; transition: transform .15s, color .15s; }
.card:hover .card-arrow { transform: translateX(3px); color: var(--accent-h); }

.status-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 54px 20px; margin: 8px 0;
  border: 1px dashed var(--border-2); border-radius: var(--radius-lg);
  color: var(--muted); font-size: 13px; text-align: center;
}
.status-card.error { border-color: rgba(251, 113, 133, .35); color: #ffb3c0; }
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .12); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.load-more-wrap { display: flex; justify-content: center; margin-top: 24px; }
.load-more {
  height: 42px; padding: 0 22px; border-radius: 12px;
  border: 1px solid var(--border-2); background: rgba(255, 255, 255, .03);
  color: var(--muted-2); font-size: 13px; font-weight: 600;
}
.load-more:hover { color: var(--text); border-color: rgba(139, 92, 246, .5); background: rgba(139, 92, 246, .1); }

.empty { text-align: center; padding: 70px 20px; border: 1px dashed var(--border-2); border-radius: var(--radius-lg); }
.empty-ico { font-size: 36px; margin-bottom: 10px; opacity: .8; }
.empty h2 { font-size: 19px; margin-bottom: 6px; }
.empty p { color: var(--muted); font-size: 13px; }
.empty-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 7px; margin-top: 16px; }

/* ---------------- Modal ---------------- */

.modal {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; padding: 22px;
  background: rgba(3, 4, 10, .72); backdrop-filter: blur(8px);
  animation: fade-in .16s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  position: relative; width: min(920px, 100%); max-height: min(88vh, 900px);
  display: flex; flex-direction: column;
  background: linear-gradient(165deg, rgba(23, 28, 48, .98), rgba(10, 12, 22, .99));
  border: 1px solid var(--border-2); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  animation: pop-in .18s cubic-bezier(.2, .8, .3, 1);
  overflow: hidden;
}
@keyframes pop-in { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-close {
  position: absolute; top: 13px; right: 13px; z-index: 5;
  width: 32px; height: 32px; border-radius: 10px;
  display: grid; place-items: center; font-size: 20px; color: var(--muted);
  background: rgba(255, 255, 255, .05); border: 1px solid var(--border);
}
.modal-close:hover { color: var(--text); background: rgba(255, 255, 255, .1); }
.modal-body { overflow: auto; padding: 24px; }

.modal-head { display: flex; gap: 15px; align-items: flex-start; padding-right: 38px; }
.modal-mark {
  width: 58px; height: 58px; border-radius: 16px; flex: none;
  display: grid; place-items: center; color: #fff; font-size: 18px; font-weight: 800;
  background: linear-gradient(140deg, var(--brand, #6366f1), color-mix(in srgb, var(--brand, #6366f1) 38%, #05060c));
  box-shadow: 0 12px 28px color-mix(in srgb, var(--brand, #6366f1) 26%, transparent);
}
.modal-head h2 { font-size: 22px; line-height: 1.15; letter-spacing: -.03em; font-weight: 750; }
.modal-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.modal-region-tabs { display: flex; gap: 7px; overflow-x: auto; padding: 16px 0 4px; margin-bottom: 6px; }
.region-tab {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  height: 34px; padding: 0 11px; border-radius: 10px;
  border: 1px solid var(--border); background: rgba(255, 255, 255, .025);
  color: var(--muted-2); font-size: 12px; white-space: nowrap;
}
.region-tab:hover { color: var(--text); border-color: var(--border-2); }
.region-tab.active { color: #fff; border-color: rgba(139, 92, 246, .55); background: rgba(139, 92, 246, .16); }
.region-tab .tab-price { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.region-tab.active .tab-price { color: #cfc6ff; }
.tab-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); flex: none; }
.tab-dot.oos { background: var(--danger); }

.modal-section-title {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  margin: 16px 0 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700;
}
.modal-section-title span { font-size: 11px; letter-spacing: 0; text-transform: none; color: var(--muted); font-weight: 400; }

.denom-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.denom-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 12px;
  background: rgba(255, 255, 255, .028); border: 1px solid var(--border);
  transition: .15s;
}
.denom-row:hover { border-color: var(--border-2); background: rgba(255, 255, 255, .045); }
.denom-row.is-oos { opacity: .5; }
.denom-main { flex: 1; min-width: 0; }
.denom-label { font-size: 13px; font-weight: 550; line-height: 1.3; word-break: break-word; }
.denom-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.denom-tag {
  padding: 1px 5px; border-radius: 4px; font-size: 9.5px; font-weight: 600;
  color: #d7ccff; background: rgba(139, 92, 246, .14);
}
.denom-tag.stock { color: #8cf0c7; background: rgba(52, 211, 153, .1); }
.denom-tag.low { color: #ffd88a; background: rgba(251, 191, 36, .1); }
.denom-tag.oos { color: #ffa8b7; background: rgba(251, 113, 133, .1); }
.denom-price { flex: none; text-align: right; font-size: 14px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.denom-price small { display: block; font-size: 9.5px; font-weight: 400; color: var(--muted); }
.denom-actions { flex: none; display: flex; align-items: center; gap: 4px; }
.add-btn {
  height: 30px; padding: 0 11px; border-radius: 8px;
  background: var(--grad-accent); color: #fff; font-size: 11.5px; font-weight: 700;
  box-shadow: 0 6px 16px rgba(99, 102, 241, .25);
}
.add-btn:hover { filter: brightness(1.08); }
.add-btn:disabled { opacity: .4; box-shadow: none; cursor: not-allowed; }
.qty-btn {
  width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center;
  border: 1px solid var(--border-2); background: rgba(255, 255, 255, .04);
  color: var(--text); font-size: 14px; line-height: 1;
}
.qty-btn:hover { background: rgba(139, 92, 246, .16); border-color: rgba(139, 92, 246, .5); }
.qty-btn:disabled { opacity: .35; cursor: not-allowed; }
.qty-val { min-width: 17px; text-align: center; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------------- Cart ---------------- */

.overlay { position: fixed; inset: 0; z-index: 90; background: rgba(3, 4, 10, .66); backdrop-filter: blur(4px); }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 95;
  width: min(420px, 100vw); display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(19, 23, 40, .99), rgba(9, 11, 20, .99));
  border-left: 1px solid var(--border-2); box-shadow: var(--shadow-lg);
  transform: translateX(102%); transition: transform .24s cubic-bezier(.2, .8, .3, 1);
}
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 12px; border-bottom: 1px solid var(--border); }
.drawer-head h2 { font-size: 17px; font-weight: 700; }
.drawer-head .modal-close { position: static; }
.cart-items { flex: 1; overflow: auto; padding: 10px 14px; }
.cart-empty { padding: 60px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.cart-item {
  display: flex; align-items: center; gap: 10px; padding: 10px;
  border-bottom: 1px solid var(--border);
}
.cart-item:last-child { border-bottom: 0; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-item-denom { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-item-qty { display: flex; align-items: center; gap: 3px; }
.cart-item-price { font-size: 12.5px; font-weight: 700; min-width: 58px; text-align: right; font-variant-numeric: tabular-nums; }
.cart-item-remove { width: 24px; height: 24px; border-radius: 6px; color: var(--muted); font-size: 14px; }
.cart-item-remove:hover { color: var(--danger); background: rgba(251, 113, 133, .1); }
.cart-footer { padding: 14px 18px 18px; border-top: 1px solid var(--border); }
.cart-total { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
.cart-total strong { font-size: 20px; color: var(--text); letter-spacing: -.03em; }
.cart-btn-primary {
  width: 100%; height: 42px; border-radius: 11px;
  background: var(--grad-accent); color: #fff; font-size: 13px; font-weight: 700;
  box-shadow: 0 10px 24px rgba(99, 102, 241, .28);
}
.cart-btn-primary:hover { filter: brightness(1.08); }
.cart-btn-ghost {
  width: 100%; height: 38px; margin-top: 7px; border-radius: 10px;
  border: 1px solid var(--border); color: var(--muted-2); font-size: 12.5px; font-weight: 600;
}
.cart-btn-ghost:hover { color: var(--text); border-color: var(--border-2); background: rgba(255, 255, 255, .04); }

/* ---------------- Toast ---------------- */

.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 120;
  padding: 10px 16px; border-radius: 11px;
  background: rgba(23, 28, 48, .98); border: 1px solid var(--border-2);
  box-shadow: var(--shadow); font-size: 12.5px; color: var(--text);
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  transition: .22s; max-width: min(90vw, 520px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- Production page additions ---------------- */

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  flex: none;
}
.topbar-nav a {
  color: var(--muted-2);
  font-size: 12.5px;
  font-weight: 600;
  transition: color .15s;
}
.topbar-nav a:hover { color: var(--text); }

.info-section {
  border-top: 1px solid var(--border);
  padding: 34px 22px;
  background: rgba(8, 10, 19, .35);
}
.info-inner {
  max-width: 1480px;
  margin: 0 auto;
}
.info-section h2 {
  font-size: 20px;
  letter-spacing: -.02em;
  margin-bottom: 16px;
}
.crypto-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.crypto-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, .025);
  color: var(--muted-2);
  font-size: 12.5px;
  font-weight: 500;
}
.crypto-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}
.faq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.faq-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(23, 28, 48, .62), rgba(13, 16, 29, .72));
}
.faq-num {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  color: var(--accent-h);
}
.faq-card h3 { font-size: 14px; margin-bottom: 5px; }
.faq-card p { color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.site-footer {
  border-top: 1px solid var(--border);
  padding: 18px 22px 28px;
  color: var(--muted);
  font-size: 12px;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.site-footer a { color: var(--accent-h); }
.site-footer a:hover { color: #c9b8ff; }

@media (max-width: 1180px) {
  .topbar-nav { display: none; }
}

@media (max-width: 700px) {
  .info-section { padding: 26px 14px; }
  .site-footer { padding: 16px 14px 24px; }
}

/* ---------------- Responsive ---------------- */

@media (max-width: 1180px) {
  .page { grid-template-columns: 248px minmax(0, 1fr); gap: 20px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

@media (max-width: 960px) {
  .page { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 92;
    width: min(340px, 92vw); max-height: none; border-radius: 0;
    border-right: 1px solid var(--border-2);
    transform: translateX(-103%); transition: transform .24s cubic-bezier(.2, .8, .3, 1);
    padding-top: 20px;
  }
  body.filters-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  body.filters-open::after {
    content: ''; position: fixed; inset: 0; z-index: 91; background: rgba(3, 4, 10, .62);
    backdrop-filter: blur(4px);
  }
  .filters-toggle {
    display: inline-flex; align-items: center; gap: 7px; flex: none;
    height: 36px; padding: 0 13px; border-radius: 10px;
    border: 1px solid var(--border-2); background: rgba(255, 255, 255, .04);
    color: var(--muted-2); font-size: 12.5px; font-weight: 600;
  }
  .filters-toggle:hover { color: var(--text); border-color: rgba(139, 92, 246, .5); }
  .filters-close {
    display: grid; place-items: center; width: 30px; height: 30px;
    border-radius: 9px; border: 1px solid var(--border); color: var(--muted); font-size: 18px;
  }
  .content-head { align-items: flex-start; }
  .denom-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .topbar { height: auto; }
  .topbar-inner { flex-wrap: wrap; padding: 10px 14px; gap: 10px; }
  .topbar-search { order: 3; flex-basis: 100%; max-width: none; }
  .search-kbd { display: none; }
  .logo-text { display: none; }
  .cart-btn-label { display: none; }
  .page { padding: 16px 14px 60px; }
  h1 { font-size: 28px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 10px; }
  .card { min-height: 178px; padding: 12px; }
  .card-mark { width: 36px; height: 36px; border-radius: 10px; font-size: 11px; }
  .card-title { font-size: 13px; }
  .modal { padding: 10px; }
  .modal-body { padding: 18px 15px; }
  .modal-head h2 { font-size: 18px; }
  .modal-mark { width: 48px; height: 48px; border-radius: 13px; font-size: 15px; }
  .toolbar { align-items: flex-start; }
  .toolbar-right { width: 100%; justify-content: space-between; }
  .result-count { width: 100%; }
}

@media (max-width: 430px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .card-price { font-size: 14px; }
  .card-cat { display: none; }
}
