/* ============================================================
   Svecha Studio — stylesheet (дизайн-система в духе rikouae.com)
   Токены: фон #F2ECDC, заголовки Trirong, body Buenard,
   UI Poppins, акцент #868859, радиус 11px.
   ============================================================ */

:root {
  --bg: #F2ECDC;
  --surface: #FBF8F0;
  --surface-2: #EFE8D6;
  --ink: #2B2A24;
  --ink-soft: #5C594D;
  --ink-muted: #8B8676;
  --line: #DCD3BC;
  --accent: #868859;
  --accent-dark: #6F7148;
  --accent-ink: #FDFBF7;
  --danger: #9C4A3C;
  --ok: #4C7A55;
  --radius: 11px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(43, 42, 36, 0.08);
  --font-display: 'Trirong', Georgia, serif;
  --font-body: 'Buenard', Georgia, serif;
  --font-ui: 'Poppins', 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.55;
}

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

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.2;
  margin: 0 0 0.5em;
  letter-spacing: 0.01em;
}

p { margin: 0 0 1em; }

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Header ---------- */

.site-header {
  background: rgba(242, 236, 220, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 68px;
  flex-wrap: wrap;
  padding-top: 10px;
  padding-bottom: 10px;
}

.logo {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.logo span { color: var(--accent); }
.logo:hover { color: var(--ink); }

.main-nav {
  display: flex;
  gap: 22px;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.04em;
}

.main-nav a {
  color: var(--ink-soft);
  padding: 6px 0;
  border-bottom: 2px solid transparent;
}
.main-nav a:hover { color: var(--ink); }
.main-nav a.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 18px;
  font-family: var(--font-ui);
  font-size: 14px;
}

.account-link { color: var(--ink-soft); }
.account-link:hover { color: var(--ink); }

.cart-icon { position: relative; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-soft); }
.cart-icon:hover { color: var(--ink); }
.cart-badge {
  position: absolute; top: -6px; right: -10px;
  min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 9px; background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 600; line-height: 18px; text-align: center;
}

.inline-form { display: inline; margin: 0; }

/* ---------- Flash ---------- */

.flash {
  margin: 18px 0;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: 14.5px;
}

.flash-success {
  background: #E7EDDD;
  border: 1px solid #B9C9A8;
  color: #35513B;
}

.flash-error {
  background: #F3E1DC;
  border: 1px solid #D6A79C;
  color: #6E3328;
}

/* ---------- Main / Footer ---------- */

.site-main { min-height: 55vh; padding: 34px 0 64px; }

.site-footer {
  border-top: 1px solid var(--line);
  padding: 28px 0 40px;
  font-family: var(--font-ui);
  font-size: 13.5px;
  color: var(--ink-muted);
}

.footer-inner p { margin: 0; }
.footer-note { margin-top: 6px; }

/* ---------- Typography helpers ---------- */

.page-title { font-size: 40px; margin-bottom: 8px; }
.section-title { font-size: 30px; }

.empty-note {
  font-family: var(--font-ui);
  font-size: 15px;
  color: var(--ink-muted);
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 26px;
  text-align: center;
}

.muted { color: var(--ink-muted); font-size: 14px; }
.link-strong { font-weight: 600; }

.error-page { text-align: center; padding: 90px 20px; }
.error-message { color: var(--ink-soft); margin-bottom: 26px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: 0.03em;
  padding: 11px 24px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover { background: var(--accent-dark); color: var(--accent-ink); }

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--line);
}
.btn-ghost:hover { border-color: var(--ink-muted); color: var(--ink); }

.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-lg { padding: 14px 32px; font-size: 15.5px; }
.btn-block { display: block; width: 100%; }

.btn-danger-text { color: var(--danger) !important; }
.btn-danger-text:hover { border-color: var(--danger); }

.btn-disabled {
  background: var(--surface-2);
  color: var(--ink-muted) !important;
  border-color: var(--line);
  cursor: not-allowed;
  user-select: none;
}
.btn-disabled:hover { background: var(--surface-2); }

/* ---------- Hero (home) ---------- */

.hero {
  margin-top: -34px;
  background: transparent;
  border-bottom: 1px solid var(--line);
  padding: 24px 0 32px;
  text-align: center;
}

.hero-inner { max-width: 640px; }

.hero-title { font-size: 52px; font-weight: 400; margin-bottom: 14px; }
.hero-subtitle {
  font-size: 19px;
  color: var(--ink-soft);
  margin-bottom: 30px;
}

/* ---------- Home sections ---------- */

.home-section { padding: 56px 20px; }
.home-section + .home-section { border-top: 1px solid var(--line); }

.home-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.section-description { color: var(--ink-soft); max-width: 640px; }

.section-link {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--accent);
}
.section-link:hover { border-bottom-color: var(--ink); }

.section-preview {
  margin: 6px 0 28px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  max-height: 340px;
}
.section-preview img { width: 100%; height: 340px; object-fit: cover; }

/* ---------- Home bands (чередующийся баннер фото/текст) ---------- */

.home-bands { padding: 8px 0 40px; }

.home-band {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin: 28px 0;
  min-height: 380px;
  background: #FAF7F0;
  border: 1px solid #E5DDD0;
  border-radius: 24px;
  overflow: hidden;
  padding: 0;
}

/* default: фото справа, текст слева (copy-left) */
.home-band-copy   { order: 1; }
.home-band-media  { order: 2; }

.home-band.is-photo-left .home-band-copy  { order: 2; }
.home-band.is-photo-left .home-band-media { order: 1; }

.home-band-media {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.home-band-media img {
  width: 100%;
  height: 100%;
  min-height: 320px;
  object-fit: cover;
}

.home-band-placeholder {
  width: 100%;
  height: 100%;
  min-height: 320px;
  background: #ECE9E1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.placeholder-label {
  font-family: var(--font-ui);
  color: var(--ink-muted);
  font-size: 18px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.home-band-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 14px;
  padding: 48px 40px;
}
.home-band-copy .section-title { font-size: 30px; font-weight: 500; }
.home-band-cta { margin-top: 6px; }

/* Адаптив: на узких экранах — одна колонка, фото сверху */
@media (max-width: 640px) {
  .home-band { flex-direction: column; min-height: auto; gap: 20px; }
  .home-band-media   { order: 1; flex: 0 0 auto; width: 100%; }
  .home-band-copy    { order: 2; flex: 1 1 auto; }
}

/* ---------- Product grid / cards ---------- */

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 26px;
}

.product-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.product-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.product-card:hover .product-card-name { color: var(--accent-dark); }

.product-card-media {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--surface-2);
  overflow: hidden;
}
.product-card-media img { width: 100%; height: 100%; object-fit: cover; }

.product-card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  color: var(--ink-muted);
}

.badge-sale {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--danger);
  color: #FDF3EF;
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 999px;
}

.product-card-body { padding: 14px 16px 18px; }

.product-card-name {
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 500;
  margin: 0 0 8px;
  line-height: 1.35;
}

.product-card-price {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--font-ui);
}

.price-current { font-size: 16px; font-weight: 600; color: var(--ink); }
.price-old { font-size: 13.5px; color: var(--ink-muted); text-decoration: line-through; }

/* ---------- Catalog ---------- */

.catalog-page {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 40px;
  align-items: start;
}

.catalog-sidebar {
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 92px;
  font-family: var(--font-ui);
  font-size: 14.5px;
}

.sidebar-link {
  color: var(--ink-soft);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}
.sidebar-link:hover { background: var(--surface); color: var(--ink); }
.sidebar-link.active {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 500;
}

.catalog-main { min-width: 0; }

/* ---------- Product page ---------- */

.product-page .page-title,
.product-page .breadcrumbs { margin-bottom: 6px; }

.breadcrumbs {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--ink-muted);
  margin-bottom: 24px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.breadcrumbs a { color: var(--ink-soft); }

.product-layout {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 48px;
  align-items: start;
}

.product-gallery {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.gallery-main { background: var(--surface-2); }
.gallery-main img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }

.gallery-placeholder {
  aspect-ratio: 1 / 1;
  font-size: 64px;
}

.gallery-thumbs {
  display: flex;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--line);
  overflow-x: auto;
}

.thumb {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
  cursor: pointer;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.active { border-color: var(--accent); }
.thumb:hover { border-color: var(--accent); }

.product-info { min-width: 0; }

.product-title { font-size: 36px; }

.product-price-block {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  margin: 14px 0 22px;
  font-family: var(--font-ui);
}

.price-lg { font-size: 26px; font-weight: 600; }

.product-price-block .badge-sale {
  position: static;
  padding: 5px 12px;
}

.product-description {
  color: var(--ink-soft);
  max-width: 560px;
  margin-bottom: 26px;
}

.auth-hint {
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--ink-muted);
  margin-bottom: 14px;
}

.cart-add-form {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.qty-label { font-family: var(--font-ui); font-size: 14px; color: var(--ink-soft); }

.cart-add-form input[type="number"],
.qty-form input[type="number"] {
  width: 84px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-family: var(--font-ui);
  font-size: 15px;
  color: var(--ink);
}

.related-section { margin-top: 64px; }
.related-section .section-title { margin-bottom: 22px; }

/* ---------- Cart ---------- */

.cart-page {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  align-items: start;
}

.cart-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cart-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.cart-item-name {
  font-family: var(--font-ui);
  font-size: 15.5px;
  font-weight: 500;
  color: var(--ink);
  display: block;
  margin-bottom: 6px;
}
.cart-item-name:hover { color: var(--accent-dark); }

.cart-item-discount {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-family: var(--font-ui);
}
.cart-item-discount .badge-sale { position: static; }

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.qty-form, .remove-form { display: inline-flex; align-items: center; gap: 8px; margin: 0; }

.cart-item-line {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 14px;
  margin-top: 12px;
  font-family: var(--font-ui);
}

.line-total { font-size: 16.5px; font-weight: 600; }
.line-unit { font-size: 13px; color: var(--ink-muted); }
.qty-count { display: block; font-family: var(--font-ui); font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 2px; }

.cart-summary {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  position: sticky;
  top: 92px;
  font-family: var(--font-ui);
}

.summary-row { font-size: 14.5px; color: var(--ink-soft); margin-bottom: 10px; }
.summary-row strong { color: var(--ink); font-weight: 600; }

.discount-row strong { color: var(--ok); }

.total-row {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 14px;
  margin-bottom: 18px;
  font-size: 16px;
}
.total-row strong { font-size: 19px; }

.cart-summary .btn-block { margin-bottom: 12px; }

/* Корзина — flex-строка: фото | название/кол-во | цена/шт | действия | итог (B1/B3/B5/B6) */
.cart-item {
  display: flex;
  align-items: center;
  gap: 16px;
}
.cart-item.is-removed { overflow: hidden; }

.cart-item-media {
  flex: 0 0 auto;
  width: 72px;
  height: 72px;
  border-radius: 10px;
  overflow: hidden;
  display: block;
  background: var(--surface-2);
}
.cart-item-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }

.cart-item-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: linear-gradient(135deg, rgba(134,136,89,.12), rgba(134,136,89,.04));
}

.cart-item-info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }

.cart-item-snippet {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cart-item-unit { flex: 0 0 auto; text-align: right; min-width: 104px; }
.cart-item-controls { flex: 0 0 auto; display: flex; flex-direction: column; align-items: stretch; gap: 8px; }

.qty-stepper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px;
}
.qty-step {
  width: 28px;
  height: 30px;
  display: grid;
  place-items: center;
  font-size: 17px;
  line-height: 1;
  background: transparent;
  border: none;
  color: var(--ink);
  cursor: pointer;
  border-radius: 8px;
}
.qty-step:hover { background: rgba(134, 136, 89, .18); }
.qty-value { min-width: 32px; text-align: center; font-family: var(--font-ui); font-weight: 600; }

.cart-item-line { flex: 0 0 auto; text-align: right; min-width: 104px; }


/* Подсветка только что добавленного (B2 / B1) */
.is-just-added { animation: cartPulse 1.4s ease-out; }
@keyframes cartPulse {
  0%   { box-shadow: 0 0 0 3px rgba(134, 136, 89, .5); }
  60% { box-shadow: 0 0 0 3px rgba(134, 136, 89, .18); }
  100%{ box-shadow: none; }
}

/* ---------- Auth (login / register) ---------- */

.auth-page { max-width: 460px; margin: 0 auto; }

.auth-form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px 32px 34px;
}

.auth-form .page-title { font-size: 30px; }

.auth-switch {
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--ink-muted);
  text-align: center;
  margin-top: 18px;
  margin-bottom: 0;
}

/* ---------- Forms ---------- */

.field {
  display: block;
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--ink-soft);
  margin-bottom: 16px;
}

.field > span, .field > label { display: block; margin-bottom: 6px; }

.field input,
.field select,
.field textarea,
.auth-form input,
.auth-form select,
.auth-form textarea,
.admin-form input,
.admin-form select,
.admin-form textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #FFFEFB;
  font-family: var(--font-ui);
  font-size: 14.5px;
  color: var(--ink);
}

.field textarea, .auth-form textarea, .admin-form textarea { min-height: 96px; resize: vertical; }

.field input:focus, .field select:focus, .field textarea:focus,
.auth-form input:focus, .admin-form input:focus, .admin-form select:focus, .admin-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(134, 136, 89, 0.15);
}

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.field-check { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.field-check input { width: auto; }
.field-check label { margin: 0; }

.form-actions { display: flex; gap: 12px; align-items: center; margin-top: 6px; }

/* ---------- Profile ---------- */

.profile-page .page-title { margin-bottom: 22px; }

.profile-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 30px;
  align-items: start;
}

.profile-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 26px;
}

.card-title { font-size: 20px; margin-bottom: 14px; }

.profile-rows { font-family: var(--font-ui); font-size: 14.5px; }
.profile-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.profile-row:last-child { border-bottom: none; }
.profile-row dt { color: var(--ink-muted); margin: 0; }
.profile-row dd { margin: 0; font-weight: 500; text-align: right; }

/* ---------- Orders ---------- */

.orders-page .page-title { margin-bottom: 22px; }

.order-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }

.order-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 24px;
}

.order-list-compact .order-card { padding: 14px 18px; }

.order-item { padding: 0; }

.order-head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  font-family: var(--font-ui);
}

.order-date { font-size: 13.5px; color: var(--ink-muted); }
.order-head strong { font-size: 15px; }

.badge-order {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-soft);
  border: 1px solid var(--line);
}
.badge-ok { background: #E7EDDD; border-color: #B9C9A8; color: #35513B; }
.badge-muted { background: var(--surface-2); color: var(--ink-muted); }

.order-items {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--ink-soft);
}

.order-line {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--line);
}
.order-line:last-child { border-bottom: none; }

.order-line-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.order-line-price { white-space: nowrap; }

.order-foot {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  font-family: var(--font-ui);
}

.order-foot .summary-row { margin: 0; }

/* ---------- Admin ---------- */

.admin-page { display: block; }

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.admin-nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px;
  margin-bottom: 30px;
}

.admin-nav-list { display: contents; }

.admin-nav a {
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-soft);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
}
.admin-nav a:hover { background: var(--surface-2); color: var(--ink); }
.admin-nav a.active { background: var(--accent); color: var(--accent-ink); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
  margin-bottom: 34px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
}

.stat-value { font-family: var(--font-display); font-size: 34px; font-weight: 500; }
.stat-label { font-family: var(--font-ui); font-size: 13px; color: var(--ink-muted); letter-spacing: 0.04em; margin-left: 8px; }
.stat-sub { display: block; font-family: var(--font-ui); font-size: 12px; color: var(--ink-muted); margin-top: 4px; }

.admin-dash-table { max-width: 760px; margin-bottom: 30px; }
.dash-title { font-family: var(--font-display); font-size: 20px; margin-bottom: 12px; }
.dash-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.dash-table th, .dash-table td { text-align: left; padding: 12px 16px; font-size: 14px; border-top: 1px solid var(--line); }
.dash-table thead th { background: var(--surface-2); color: var(--ink-muted); font-weight: 600; letter-spacing: 0.03em; }
.dash-num { text-align: right; font-variant-numeric: tabular-nums; }

.revenue-chart-section { margin-bottom: 34px; }
.revenue-chart { display: flex; gap: 6px; align-items: flex-end; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; overflow-x: auto; }
.bar-col { flex: 1 1 0; min-width: 34px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bar-value { font-family: var(--font-ui); font-size: 11px; color: var(--ink-muted); white-space: nowrap; }
.bar { width: 100%; min-width: 14px; max-width: 38px; height: 2px; background: var(--accent); border-radius: 2px 2px 0 0; transition: height .2s ease; }
.bar-label { font-family: var(--font-ui); font-size: 11px; color: var(--ink-muted); white-space: nowrap; }

.admin-form-page { display: block; }

.admin-form-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 28px 30px;
  margin-top: 34px;
  max-width: 720px;
}

.page-note {
  font-family: var(--font-ui);
  font-size: 13.5px;
  color: var(--ink-muted);
  margin-bottom: 18px;
}

/* ---------- Tables ---------- */

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  font-family: var(--font-ui);
  font-size: 14px;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.admin-table th {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  background: var(--surface-2);
}

.admin-table tr:last-child td { border-bottom: none; }

.admin-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.admin-table-wrap .admin-table { min-width: 640px; }

.admin-table .num { text-align: right; }
.admin-table .row-inactive td { opacity: 0.55; }

.row-actions { display: flex; flex-wrap: wrap; gap: 6px; white-space: normal; }
.row-actions form, .row-actions details { display: inline-block; margin: 0; }

details.inline-form summary { list-style: none; }
details.inline-form summary::-webkit-details-marker { display: none; }
details.inline-form[open] { display: inline-block; }

.cell-desc { max-width: 260px; color: var(--ink-soft); }

.cat-preview {
  width: 64px;
  height: 44px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.cat-preview img { width: 100%; height: 100%; object-fit: cover; }

.admin-form { display: block; max-width: 720px; }

/* ---- Admin: product photos ---- */
.admin-product-images { margin: 14px 0 0; }
.admin-product-images-title { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 8px; }
.admin-product-images-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.admin-product-images-grid img {
  width: 84px; height: 84px; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2);
}

/* ---- Admin: product table mini-thumbs ---- */
.prod-cell { display: flex; align-items: center; gap: 12px; }
.prod-thumb {
  flex: 0 0 auto; width: 48px; height: 48px;
  object-fit: cover; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface-2);
}
.prod-thumb-none {
  flex: 0 0 auto; width: 48px; height: 48px; border-radius: 8px;
  border: 1px dashed var(--line); background: var(--surface-2);
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .catalog-page { grid-template-columns: 1fr; gap: 22px; }
  .catalog-sidebar { flex-direction: row; flex-wrap: wrap; position: static; }
  .product-layout { grid-template-columns: 1fr; gap: 28px; }
  .cart-page { grid-template-columns: 1fr; }
  .cart-summary { position: static; }
  .profile-grid { grid-template-columns: 1fr; }
  .hero { padding: 64px 0; }
  .hero-title { font-size: 38px; }
  .page-title { font-size: 32px; }
  .header-inner { gap: 14px; }
  .main-nav { gap: 14px; }
  .field-row { grid-template-columns: 1fr; }
  .admin-table-wrap { overflow-x: auto; }
  .admin-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .admin-nav a { display: block; }
}

/* ---------- Drop zone (загрузка фото: drag&drop + кнопка) ---------- */

.dropzone {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 116px;
  padding: 22px 18px;
  border: 1.5px dashed #cbb48a;
  border-radius: 14px;
  background: #fbf7ef;
  cursor: pointer;
  text-align: center;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.dropzone:hover,
.dropzone.dragover {
  border-color: #a98545;
  background: #f6eede;
  box-shadow: 0 0 0 3px rgba(169, 133, 69, .12);
}
.dropzone.dragover { transform: scale(1.005); }
.dropzone-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.dropzone-ico { font-size: 22px; color: #a98545; }
.dropzone-text { font-size: 14px; color: #5b4a2e; }
.dropzone-or { font-size: 12px; color: #9a8866; }
.dropzone-btn {
  margin-top: 4px;
  padding: 8px 18px;
  font-size: 13px;
  cursor: pointer;
}
.dropzone-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.dropzone-preview:empty { display: none; }
.dropzone-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 240px;
  padding: 6px 10px;
  border: 1px solid #e2d3b4;
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
  color: #3a2f1c;
}
.dropzone-chip img {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border-radius: 7px;
  flex: none;
}
.dropzone-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Превью категории: upload (admin) ---------- */

.cat-image-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.cat-preview-current {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid #e2d3b4;
  background: #f6eede;
  flex: none;
}
.cat-preview-empty {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  border: 1px dashed #cbb48a;
  background: #fbf7ef;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #cbb48a;
  flex: none;
}
.cat-preview-field { flex: 1; min-width: 0; }

.dropzone-hint { font-size: 13px; color: #7a6a4e; margin: 0; }

/* ---------- Admin: each product image item (img + delete) ---------- */
.admin-product-images-item {
  position: relative;
  display: inline-flex;
  align-items: flex-end;
  gap: 4px;
}
.admin-product-images-item img {
  width: 110px;
  height: 110px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid #e2d8c0;
}
.admin-product-images-item .btn-sm {
  position: absolute;
  bottom: -6px;
  right: -6px;
  background: #e8d4f0;
  color: #6b3e8e;
  border: 1px solid #d4b8e4;
}

/* ============================================================
   Animations — тихие 150–400ms, только transform/opacity,
   уважают prefers-reduced-motion (движение выключено = статично)
   1) Появление секций/карточек на скролле
   2) Hover карточки товара (zoom + тень + подчёркивание цены)
   3) «В корзину»: летящая точка + бамп иконки
   4) Лайтбокс галереи + crossfade фото
   ============================================================ */

/* Лайтбокс (статичная часть — без движения, валидна при reduced-motion) */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(27, 26, 20, .82);
  opacity: 0;
  transition: opacity .3s ease-out;
}
.lightbox.is-open { display: flex; }
.lightbox.is-visible { opacity: 1; }
.lightbox figure { margin: 0; max-width: min(78vmin, 720px); }
.lightbox img {
  width: 100%; height: auto; max-height: 84vh;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 30px 60px rgba(0, 0, 0, .35);
}
.lightbox figcaption {
  margin-top: 12px;
  font-family: var(--font-ui);
  font-size: 14px;
  color: #EDE7D8;
  text-align: center;
}
.lightbox .lightbox-nav,
.lightbox .lightbox-close {
  position: absolute;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
  color: #fff;
  font-size: 22px; line-height: 1;
  cursor: pointer;
}
.lightbox .lightbox-nav:hover,
.lightbox .lightbox-close:hover { background: rgba(255, 255, 255, .3); }
.lightbox .lightbox-close { top: 20px; right: 20px; }
.lightbox .lightbox-prev { left: 18px; top: 50%; transform: translateY(-50%); }
.lightbox .lightbox-next { right: 18px; top: 50%; transform: translateY(-50%); }

body.lightbox-lock { overflow: hidden; }

@media (prefers-reduced-motion: no-preference) {
  /* 1) Появление при скролле */
  .is-reveal { opacity: 0; transform: translateY(26px); }
  .is-reveal.is-visible {
    opacity: 1;
    transform: none;
    transition: opacity .5s ease-out, transform .5s ease-out;
  }

  /* 2) Hover карточки товара */
  .product-card-media img { transition: transform .35s ease-out; }
  .product-card:hover .product-card-media img { transform: scale(1.06); }
  .price-current { position: relative; }
  .price-current::after {
    content: "";
    position: absolute;
    left: -2px; right: -2px; bottom: -3px; height: 2px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: left center;
    opacity: .85;
    transition: transform .3s ease-out;
  }
  .product-card:hover .price-current::after { transform: scaleX(1); }

  /* 3) «В корзину» */
  @keyframes cart-bump {
    0%   { transform: scale(1); }
    45% { transform: scale(1.28); }
    100%{ transform: scale(1); }
  }
  .cart-icon.is-bumping { animation: cart-bump .45s ease-out; }
  .fly-dot {
    position: fixed;
    top: 0; left: 0;
    width: 14px; height: 14px;
    margin: -7px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 6px 18px rgba(43, 42, 36, .28);
    pointer-events: none;
    z-index: 9999;
    will-change: transform;
  }

  /* 4) Кроссфейд фото галереи */
  .gallery-main { position: relative; }
  .gallery-cross {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity .45s ease-out;
  }
  .gallery-cross.is-fade { opacity: 1; }
}

/* ============================================================
   FAQ-блок (сразу после блока с каталогами, на главной)
   Плавное появление: переиспользует механизм .is-reveal/.is-visible
   Плавкое раскрытие по клику: max-height transition + поворот chevron
   ============================================================ */

.faq-section { padding: 20px 0 64px; }
.faq-title { font-size: 30px; text-align: center; color: var(--ink); margin-bottom: 28px; letter-spacing: .01em; }
.faq-list { max-width: 720px; margin: 0 auto; display: grid; gap: 0; }

.faq-item { overflow: hidden; }
.faq-item:not(:last-child) { border-bottom: 1px solid var(--line); }
.faq-question { width: 100%; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 18px 22px; background: none; border: 0; cursor: pointer; text-align: left; color: var(--ink); font-family: var(--font-body); font-size: 16.5px; }
.faq-question:hover { background: rgba(134, 136, 89, .07); }
.faq-icon { display: grid; place-items: center; width: 28px; height: 28px; color: var(--accent); flex-shrink: 0; }
.faq-icon svg { width: 22px; height: 22px; }
.faq-chevron { display: grid; place-items: center; width: 20px; height: 20px; color: var(--ink-soft); flex-shrink: 0; }
.faq-chevron svg { width: 18px; height: 18px; }

/* Свёрнутое состояние: ответ скрыт (max-height: 0, overflow hidden). */
.faq-answer { max-height: 0; overflow: hidden; }
/* Высота ответа измеряется в initFaq по содержимому и обновляется при resize. */
.faq-item:not(.is-open) .faq-chevron { transform: rotate(180deg); }
.faq-item.is-open .faq-chevron { transform: none; }
.faq-answer p { margin: 0 0 .4em; padding: 0 22px 18px; color: var(--ink-soft); font-size: 15.5px; line-height: 1.7; }

@media (prefers-reduced-motion: no-preference) {
  /* Переходы max-height и поворота chevron — только при разрешённом движении.
     Под prefers-reduced-motion: reduce состояние меняется мгновенно, без анимации. */
  .faq-answer { transition: max-height .38s ease-out; }
  .faq-chevron { transition: transform .3s ease-out; }
}

/* ---------- Admin shell: sidebar + sticky toolbar (доп. правки) ---------- */
.admin-shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 28px; align-items: start; }
.admin-sidebar { position: sticky; top: 84px; }
.sidebar-nav { display: grid; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; }
.sidebar-nav a { display: block; font-family: var(--font-ui); font-size: 14.5px; color: var(--ink-soft); padding: 9px 12px; border-radius: var(--radius); transition: background .15s ease, color .15s ease; }
.sidebar-nav a:hover { background: var(--surface-2); color: var(--ink); }
.sidebar-nav a.is-active { background: var(--accent); color: var(--accent-ink); }

/* Панель поиска/сортировки над таблицей товаров */
.table-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.table-toolbar .search-input { flex: 1 1 260px; padding: 9px 12px; font-family: var(--font-ui); font-size: 14.5px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink); }
.table-toolbar .search-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(0, 0, 0, .05); }
.table-toolbar .sort-select { padding: 9px 12px; font-family: var(--font-ui); font-size: 14.5px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink); }

/* Закреплённая шапка: таблица в ограниченной по высоте обёртке */
.admin-scroll { max-height: calc(100vh - 236px); overflow: auto; border-radius: var(--radius); }
.admin-scroll .admin-table { overflow: visible; }
.admin-scroll .admin-table thead th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); }

/* Адаптив: на узких экранах sidebar становится верхней панелью */
@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; gap: 14px; }
  .admin-sidebar { position: static; }
  .sidebar-nav { display: flex; flex-wrap: wrap; gap: 6px; }
  .admin-scroll { max-height: calc(100vh - 180px); }
}
