:root {
  --bg: #12151c;
  --bg-2: #1a1f2b;
  --surface: rgba(255, 255, 255, 0.04);
  --line: rgba(255, 255, 255, 0.08);
  --text: #f4f1ea;
  --muted: #9aa3b5;
  --accent: #f64a04;
  --accent-2: #ff7a3d;
  --ok: #3ecf8e;
  --err: #ff5c5c;
  --radius: 14px;
  --font: "Manrope", sans-serif;
  --display: "Unbounded", sans-serif;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  line-height: 1.5;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { color: #fff; }
img { max-width: 100%; }

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(246, 74, 4, 0.28), transparent 60%),
    radial-gradient(700px 400px at 90% 0%, rgba(40, 80, 160, 0.22), transparent 55%),
    linear-gradient(180deg, #161a24 0%, #0f1218 100%);
}

.wrap { width: min(1120px, calc(100% - 2rem)); margin-inline: auto; }
.section { padding: 2.5rem 0; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.section-head h1, .section-head h2, .page-title {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}
.page-title { font-size: clamp(1.6rem, 3vw, 2.2rem); margin-bottom: 1rem; }
.muted { color: var(--muted); }
.narrow { max-width: 480px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
  background: rgba(18, 21, 28, 0.78);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 0.85rem 0;
}
.logo {
  display: flex;
  align-items: center;
  color: inherit;
}
.logo img {
  display: block;
  height: 48px;
  width: auto;
  border-radius: 10px;
  background: #fff;
}
.brand-hero {
  font-family: var(--display);
  font-size: clamp(2.4rem, 7vw, 4.4rem);
  line-height: 1.02;
  margin: 0 0 1.5rem;
  background: linear-gradient(90deg, #fff 20%, #ffb08a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.header-search {
  display: flex;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.25rem 0.25rem 0.25rem 1rem;
}
.header-search input {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text);
  outline: none;
  font: inherit;
  min-width: 0;
}
.header-search button,
.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  color: #111;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 999px;
  padding: 0.65rem 1.15rem;
  transition: transform .15s ease, filter .15s ease;
}
.header-search button:hover,
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.9rem; }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
.linkish {
  background: none;
  border: 0;
  color: var(--accent-2);
  cursor: pointer;
  font: inherit;
  padding: 0;
}
.header-nav {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  white-space: nowrap;
}
.header-nav a { color: var(--text); font-weight: 600; }
.badge {
  display: inline-grid;
  place-items: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: var(--accent);
  color: #111;
  font-size: 0.75rem;
  font-weight: 800;
}
.inline { display: inline; }

.flashes { padding-top: 1rem; }
.flash {
  padding: 0.85rem 1rem;
  border-radius: 12px;
  margin-bottom: 0.5rem;
  border: 1px solid var(--line);
}
.flash-ok { background: rgba(62, 207, 142, 0.12); color: #b8f5d4; }
.flash-err { background: rgba(255, 92, 92, 0.12); color: #ffc4c4; }

.hero {
  padding: 4.5rem 0 2.5rem;
  border-bottom: 1px solid var(--line);
}
.hero-inner { max-width: 720px; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0 0 0.75rem;
}
.hero-lead {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 36rem;
  margin: 0 0 1.5rem;
}
.hero-search {
  display: flex;
  gap: 0.6rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0.45rem;
  box-shadow: var(--shadow);
}
.hero-search input {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  padding: 0.7rem 0.9rem;
  outline: none;
}

.cat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 600;
  font-size: 0.92rem;
}
.chip span { color: var(--muted); font-weight: 500; }
.chip:hover { border-color: var(--accent); }

.popular-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
.popular-item {
  opacity: 0;
  transform: translateY(18px) scale(0.98);
  animation: popIn 0.55s cubic-bezier(.2,.8,.2,1) forwards;
  animation-delay: calc(var(--i, 0) * 70ms);
}
@keyframes popIn {
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.product-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-height: 220px;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.product-tile:hover {
  transform: translateY(-4px);
  border-color: rgba(246, 74, 4, 0.45);
  box-shadow: 0 16px 40px rgba(0,0,0,0.28);
}
.product-tile h3,
.product-row h3,
.cart-row h3 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.35;
}
.product-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
}
.brand {
  color: var(--accent-2);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.article {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.cat-tag {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  width: fit-content;
}
.product-foot {
  margin-top: auto;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 0.75rem;
}
.price { font-weight: 800; font-size: 1.05rem; }
.stock { display: block; color: var(--muted); font-size: 0.8rem; font-weight: 500; }

.catalog-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.5rem;
}
.catalog-aside {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  height: fit-content;
  position: sticky;
  top: 5.5rem;
}
.catalog-aside h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 0.75rem;
}
.aside-link {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.55rem;
  border-radius: 10px;
  color: var(--text);
  font-size: 0.92rem;
}
.aside-link span { color: var(--muted); }
.aside-link:hover,
.aside-link.is-active {
  background: rgba(246, 74, 4, 0.12);
  color: #fff;
}
.filter-bar {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.filter-bar input,
.auth-form input,
.auth-form textarea,
.checkout-form input,
.checkout-form textarea,
.qty-form input,
.status-form select {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font: inherit;
  padding: 0.7rem 0.85rem;
  outline: none;
}
.filter-bar input:focus,
.auth-form input:focus,
.checkout-form input:focus,
.checkout-form textarea:focus {
  border-color: rgba(246, 74, 4, 0.55);
}

.product-tile__link {
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex: 1;
}
.product-main { color: inherit; }
.product-thumb { display: block; }

.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--muted);
  font-weight: 600;
}
.product-card {
  display: grid;
  grid-template-columns: minmax(240px, 380px) 1fr;
  gap: 2rem;
  align-items: start;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}
.product-card__photo {
  aspect-ratio: 1;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
}
.product-card__photo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #fff;
}
.product-card__title {
  font-family: var(--display);
  font-size: clamp(1.2rem, 2.5vw, 1.7rem);
  line-height: 1.25;
  margin: 0.6rem 0 0.75rem;
}
.product-card__price {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 1rem 0;
}
.product-card__desc {
  color: var(--muted);
  white-space: pre-wrap;
  margin: 0 0 1.25rem;
  line-height: 1.55;
  max-width: 40rem;
}
.product-card__buy {
  display: flex;
  gap: 0.75rem;
  align-items: end;
  flex-wrap: wrap;
}
.product-card__buy label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-weight: 600;
  font-size: 0.9rem;
}
.product-card__buy input {
  width: 5rem;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font: inherit;
  padding: 0.65rem 0.75rem;
}

@media (max-width: 720px) {
  .product-card { grid-template-columns: 1fr; }
}
.product-row {
  display: grid;
  grid-template-columns: 72px 1fr 130px auto;
  gap: 1rem;
  align-items: center;
  padding: 0.95rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.product-thumb,
.product-photo {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.product-photo {
  width: 100%;
  height: 160px;
  margin-bottom: 0.25rem;
}
.product-thumb img,
.product-photo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.product-stock { color: var(--muted); font-size: 0.9rem; }
.product-price { font-weight: 800; text-align: right; }

.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1.25rem;
}
.pager a {
  min-width: 2.2rem;
  height: 2.2rem;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 600;
}
.pager a.is-active {
  background: var(--accent);
  color: #111;
  border-color: transparent;
}

.auth-form,
.checkout-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.auth-form label,
.checkout-form label,
.qty-form label,
.status-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.92rem;
}

.cart-list { display: flex; flex-direction: column; gap: 0.75rem; }
.cart-row {
  display: grid;
  grid-template-columns: 64px 1fr auto auto auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.qty-form { display: flex; align-items: end; gap: 0.5rem; }
.qty-form input { width: 5rem; }
.cart-summary {
  margin-top: 1.5rem;
  padding: 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  max-width: 480px;
}
.total { font-size: 1.2rem; margin-bottom: 1rem; }

.order-list { display: flex; flex-direction: column; gap: 0.65rem; }
.order-card {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: inherit;
}
.order-card.admin-order { grid-template-columns: 1fr auto auto; }
.order-card > a { color: inherit; display: flex; flex-direction: column; gap: 0.2rem; }
.status {
  display: inline-flex;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  background: rgba(255,255,255,0.06);
}
.status-new { color: #ffd18a; }
.status-processing { color: #9ec5ff; }
.status-done { color: #9dffc4; }
.status-cancelled { color: #ffb0b0; }
.order-meta {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.comment-box {
  padding: 1rem;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.status-form { margin: 1rem 0 1.5rem; display: flex; gap: 0.75rem; align-items: end; }
.status-form.inline { margin: 0; }
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.stat {
  padding: 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  flex-direction: column;
}
.stat strong {
  font-family: var(--display);
  font-size: 1.6rem;
}
.stat span { color: var(--muted); font-size: 0.85rem; }
.code-block {
  background: #0b0d12;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
  overflow: auto;
  font-size: 0.85rem;
  color: #d7dde8;
}

.site-footer {
  margin-top: 3rem;
  border-top: 1px solid var(--line);
  padding: 2rem 0 2.5rem;
  color: var(--muted);
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.footer-inner strong { color: var(--text); display: block; margin-bottom: 0.35rem; }
.footer-inner a { color: var(--text); font-weight: 700; font-size: 1.1rem; }

@media (max-width: 960px) {
  .popular-grid { grid-template-columns: repeat(2, 1fr); }
  .catalog-layout { grid-template-columns: 1fr; }
  .catalog-aside { position: static; display: flex; flex-wrap: wrap; gap: 0.35rem; }
  .catalog-aside h2 { width: 100%; }
  .product-row { grid-template-columns: 64px 1fr; }
  .product-price, .product-action { grid-column: 2; }
  .order-meta { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .header-inner { grid-template-columns: 1fr; }
  .header-nav { justify-content: space-between; }
  .popular-grid { grid-template-columns: 1fr; }
  .cart-row { grid-template-columns: 1fr; }
  .hero { padding-top: 2.5rem; }
}
