/* spvton — светлая, лёгкая тема. Системные шрифты (без загрузки Google Fonts),
   минимум CSS, ничего лишнего в бандле. */

:root {
  --bg: #faf8f3;
  --surface: #ffffff;
  --border: #e8e2d6;
  --text: #21201c;
  --text-muted: #726c60;
  --accent: #4338ca;
  --accent-hover: #362cab;
  --accent-soft: #ece9fb;
  --danger: #b1432f;
  --success: #2f7a4f;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(30, 26, 14, 0.06), 0 4px 16px rgba(30, 26, 14, 0.05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

h1 { font-size: 1.5rem; margin: 0.4em 0 0.6em; }
h2 { font-size: 1.15rem; margin: 1.4em 0 0.5em; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.container.narrow { max-width: 560px; }

/* ---------- header ---------- */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.15rem; color: var(--text); flex-shrink: 0; }
.logo-badge { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; }
.search-form { flex: 1; display: flex; min-width: 0; }
.search-form input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 999px 0 0 999px;
  padding: 8px 14px;
  font-size: 0.95rem;
  background: var(--bg);
}
.search-form button {
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 999px 999px 0;
  background: var(--bg);
  padding: 8px 12px;
  cursor: pointer;
}
.cart-link {
  position: relative;
  flex-shrink: 0;
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}
.cart-badge {
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  border-radius: 999px;
  padding: 1px 6px;
  margin-left: 4px;
}

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 40px;
  padding: 20px 0 40px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ---------- category chips ---------- */

.category-rail, .subcategory-rail, .status-filter {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 14px 0 4px;
  scrollbar-width: none;
}
.category-rail::-webkit-scrollbar, .subcategory-rail::-webkit-scrollbar { display: none; }

.chip, .chip-sm {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.9rem;
  white-space: nowrap;
}
.chip-sm { padding: 6px 12px; font-size: 0.82rem; }
.chip-active { background: var(--accent); border-color: var(--accent); color: #fff; }
a.chip:hover, a.chip-sm:hover { text-decoration: none; opacity: 0.9; }

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 10px 0 14px;
  color: var(--text-muted);
  font-size: 0.88rem;
}
.sort-form select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  background: var(--surface);
}

/* ---------- product grid ---------- */

.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  padding-bottom: 32px;
}
@media (min-width: 620px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 900px) {
  .product-grid { grid-template-columns: repeat(4, 1fr); }
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.15s ease;
}
.product-card:hover { transform: translateY(-2px); text-decoration: none; }

.product-photo {
  position: relative;
  aspect-ratio: 3 / 4;
  background: var(--bg);
}
.product-photo img { width: 100%; height: 100%; object-fit: contain; }
.no-photo, .no-photo-big {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  background: var(--bg);
}
.no-photo-big { aspect-ratio: 4 / 3; border-radius: var(--radius); }
.no-photo.small { aspect-ratio: 1/1; border-radius: 8px; }

.badge {
  display: inline-block;
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
}
.product-photo .badge { position: absolute; top: 8px; left: 8px; background: rgba(255,255,255,0.92); }
.badge-new { background: #e5f4ea; color: var(--success); }
.badge-status-new { background: var(--accent-soft); color: var(--accent); }
.badge-status-paid { background: #e5f4ea; color: var(--success); }
.badge-status-shipped { background: #fdf1de; color: #8a5a17; }
.badge-status-delivered { background: #e5f4ea; color: var(--success); }
.badge-status-cancelled, .badge-status-hidden, .badge-status-sold { background: #f4e6e2; color: var(--danger); }
.badge-status-active { background: #e5f4ea; color: var(--success); }
.badge-status-reserved { background: #fdf1de; color: #8a5a17; }

.product-info { padding: 10px 12px 14px; }
.product-title {
  font-size: 0.9rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.4em;
}
.product-price { font-weight: 700; margin-top: 6px; }

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

/* ---------- product detail ---------- */

.breadcrumb { color: var(--text-muted); font-size: 0.85rem; margin: 14px 0; }
.product-detail { display: grid; gap: 24px; padding-bottom: 40px; }
@media (min-width: 760px) {
  .product-detail { grid-template-columns: 1.1fr 1fr; align-items: start; }
}

.gallery-main {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--border);
}
.gallery-main img {
  width: 100%;
  flex-shrink: 0;
  scroll-snap-align: start;
  aspect-ratio: 3 / 4;
  object-fit: contain;
}
.gallery-thumbs { display: flex; gap: 8px; margin-top: 8px; overflow-x: auto; }
.gallery-thumb {
  width: 64px; height: 64px; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--border);
  cursor: pointer; flex-shrink: 0;
}

.product-summary h1 { margin-top: 0; }
.product-price-big { font-size: 1.6rem; font-weight: 800; margin-bottom: 8px; }
.product-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.stock-note { color: var(--text-muted); font-size: 0.85rem; }

.add-to-cart-form { display: flex; gap: 10px; align-items: end; margin-bottom: 20px; flex-wrap: wrap; }
.qty-label { display: flex; flex-direction: column; font-size: 0.85rem; gap: 4px; }
.qty-label input { width: 70px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; }
.sold-note { color: var(--danger); font-weight: 600; }
.btn-whatsapp { border-color: #25d366; color: #1a9e4d; margin-bottom: 16px; }
.btn-whatsapp:hover { background: #eafaf1; text-decoration: none; }

.product-description p { white-space: pre-wrap; color: var(--text); }
.shipping-note { color: var(--text-muted); font-size: 0.85rem; margin-top: 20px; }

/* ---------- buttons ---------- */

.btn {
  display: inline-block;
  border: 1px solid var(--accent);
  background: var(--surface);
  color: var(--accent);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); text-decoration: none; }
.btn-outline { background: var(--surface); color: var(--accent); }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.link-danger { background: none; border: none; color: var(--danger); cursor: pointer; padding: 0; font-size: 0.85rem; }

/* ---------- cart / checkout ---------- */

.cart-list { display: flex; flex-direction: column; gap: 12px; margin: 16px 0; }
.cart-row {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 12px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
}
.cart-photo img, .cart-photo .no-photo { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; }
.cart-row-info { min-width: 0; }
.cart-title { color: var(--text); font-weight: 600; display: block; }
.cart-price { color: var(--text-muted); font-size: 0.88rem; margin: 2px 0 6px; }
.cart-qty-form input { width: 60px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 6px; }
.cart-row-total { text-align: right; font-weight: 700; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }

.cart-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 16px 0 32px;
}
.cart-summary-row { display: flex; justify-content: space-between; padding: 4px 0; }
.cart-summary-note { color: var(--text-muted); font-size: 0.85rem; margin: 10px 0 16px; }

.checkout-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 16px 0;
}
.checkout-line { display: flex; justify-content: space-between; font-size: 0.9rem; padding: 3px 0; }
.checkout-total { font-weight: 700; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 8px; }

.checkout-form fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px 6px;
  margin: 0 0 16px;
}
.checkout-form legend { padding: 0 6px; font-weight: 600; color: var(--text-muted); font-size: 0.85rem; }
.checkout-form label, .admin-form label {
  display: block;
  margin-bottom: 12px;
  font-size: 0.88rem;
  color: var(--text-muted);
}
.checkout-form input, .checkout-form textarea,
.admin-form input, .admin-form textarea, .admin-form select {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface);
  font-family: inherit;
}

.shipping-estimate-box {
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 0.95rem;
}
.shipping-estimate-box strong { display: block; font-size: 1.2rem; margin: 4px 0; }
.shipping-estimate-hint { color: var(--text-muted); font-size: 0.8rem; margin: 6px 0 0; }
.checkout-payment-hint { color: var(--text-muted); font-size: 0.85rem; text-align: center; margin-top: 10px; }

/* ---------- order status page ---------- */

.order-number { color: var(--text-muted); }
.order-save-hint { font-size: 0.85rem; color: var(--text-muted); }
.payment-box, .tracking-box, .delivery-recap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 16px 0;
}
.payment-details { padding-left: 18px; }
.payment-details li { margin-bottom: 4px; }
.payment-note { color: var(--text-muted); font-size: 0.82rem; margin: 10px 0; }
.proof-upload-form { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.proof-upload-form label { display: block; font-size: 0.88rem; color: var(--text-muted); margin-bottom: 8px; }
.proof-upload-form input[type=file] { display: block; margin-bottom: 10px; }
.proof-uploaded { color: var(--success); font-weight: 600; margin-top: 14px; }
.payment-proof-preview img { max-width: 220px; border-radius: 8px; border: 1px solid var(--border); }

/* ---------- admin ---------- */

.admin-body { background: var(--bg); }
.admin-login-box {
  max-width: 320px;
  margin: 80px auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  text-align: center;
}
.admin-login-box form { text-align: left; }
.admin-login-logo { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 12px; }
.form-error { color: var(--danger); font-size: 0.88rem; }
.form-success { color: var(--success); font-size: 0.88rem; }

.admin-shell { display: flex; flex-direction: column; min-height: 100vh; }
@media (min-width: 760px) {
  .admin-shell { flex-direction: row; }
}
.admin-nav {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  align-items: center;
}
.admin-nav a { color: var(--text); white-space: nowrap; padding: 6px 10px; border-radius: 8px; }
.admin-nav a:hover { background: var(--bg); text-decoration: none; }
.admin-logo { font-weight: 700; margin-right: 10px; }
.admin-logout-form { margin-left: auto; }
.admin-logout-form button { background: none; border: none; color: var(--text-muted); cursor: pointer; }
@media (min-width: 760px) {
  .admin-nav { flex-direction: column; align-items: stretch; width: 200px; border-right: 1px solid var(--border); border-bottom: none; }
  .admin-logout-form { margin-left: 0; margin-top: auto; }
}
.admin-content { flex: 1; padding: 20px 16px 60px; max-width: 960px; }

.admin-header-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }

.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 16px 0; }
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  color: var(--text);
  display: block;
}
.stat-value { display: block; font-size: 1.6rem; font-weight: 800; }
.stat-label { color: var(--text-muted); font-size: 0.85rem; }
.admin-actions { margin: 16px 0; }

.admin-table { width: 100%; border-collapse: collapse; margin: 12px 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.admin-table th, .admin-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; font-size: 0.88rem; }
.admin-table th { background: var(--bg); color: var(--text-muted); font-weight: 600; }
.admin-table tr:last-child td { border-bottom: none; }

@media (max-width: 640px) {
  .admin-table thead { display: none; }
  .admin-table, .admin-table tbody, .admin-table tr, .admin-table td { display: block; width: 100%; }
  .admin-table tr { border-bottom: 8px solid var(--bg); padding: 6px 0; }
  .admin-table td { display: flex; justify-content: space-between; gap: 12px; border-bottom: none; }
  .admin-table td::before { content: attr(data-label); color: var(--text-muted); font-weight: 600; }
}

.admin-form { max-width: 480px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-hint { color: var(--text-muted); font-size: 0.82rem; margin-top: -6px; margin-bottom: 14px; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 10px; margin: 12px 0; }
.photo-item { text-align: center; }
.photo-item img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); margin-bottom: 4px; }
.photo-upload-form { margin: 16px 0; padding: 14px; border: 1px dashed var(--border); border-radius: var(--radius); }

.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input[type=text] { padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; }
.inline-form select { padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; }

.order-detail-grid { display: grid; gap: 24px; }
@media (min-width: 760px) {
  .order-detail-grid { grid-template-columns: 1.4fr 1fr; align-items: start; }
}
.order-status-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
