:root {
  color-scheme: light dark;
  --bg: #f8f7f4;
  --panel: #ffffff;
  --text: #1b1b1b;
  --muted: #6d6a64;
  --line: #dfddd7;
  --accent: #7f5a44;
  --accent-strong: #2f6f62;
  --danger: #b13d3d;
  --shadow: 0 18px 50px rgba(20, 20, 20, .08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141414;
    --panel: #20201f;
    --text: #f4f0e8;
    --muted: #b7b0a6;
    --line: #343331;
    --accent: #d0a47d;
    --accent-strong: #82c7b4;
    --shadow: 0 18px 50px rgba(0, 0, 0, .28);
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
main { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 34px 0 60px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: auto minmax(260px, 340px) 1fr;
  gap: 16px;
  align-items: center;
  padding: 14px clamp(16px, 4vw, 42px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; }
.brand img { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; }
.site-header nav { display: flex; align-items: center; justify-content: flex-end; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: .94rem; }
.site-header nav a:hover { color: var(--text); }
.search { display: flex; gap: 8px; width: min(340px, 100%); }
.search input {
  height: 40px;
  min-width: 0;
  padding: 0 11px;
}
.search button {
  min-height: 40px;
  height: 40px;
  padding: 0 13px;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 8px;
  padding: 11px 12px;
  font: inherit;
}
button, .button {
  border: 0;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  padding: 11px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
}
button:hover, .button:hover { opacity: .88; }
button:disabled, .disabled { opacity: .45; pointer-events: none; }
.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.link { background: transparent; color: var(--accent); padding: 0; min-height: auto; }
.danger { color: var(--danger); }

.hero {
  position: relative;
  min-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  text-align: center;
  border-bottom: 1px solid var(--line);
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .58);
  z-index: 1;
}
.hero-content {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: 12px;
  max-width: 760px;
  padding: 40px 20px;
}
.hero-content h1 {
  color: #fff;
  max-width: 860px;
  margin: 0;
  font-size: clamp(2.25rem, 6vw, 5.5rem);
  line-height: .96;
}
.hero-content p {
  color: #fff;
  font-size: 1.08rem;
  max-width: 620px;
  margin: 0;
}
.eyebrow, small { color: var(--accent-strong); text-transform: uppercase; font-size: .76rem; font-weight: 800; }

.banner-carousel {
  position: relative;
  margin: 30px 0;
  border-radius: 8px;
  aspect-ratio: 16 / 7;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.banner-carousel img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .45s ease;
}
.banner-carousel img.active { opacity: 1; }
.hero-carousel-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  margin: 0;
  border-radius: 0;
  aspect-ratio: auto;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.hero-carousel-bg img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.banner-dots {
  position: absolute;
  left: 50%;
  bottom: 12px;
  display: flex;
  gap: 7px;
  transform: translateX(-50%);
}
.banner-dots span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .58);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .16);
}
.banner-dots span.active { background: #fff; }
.banner-admin img { border-radius: 8px; aspect-ratio: 16 / 7; object-fit: cover; width: 100%; }
.categories { display: flex; gap: 10px; flex-wrap: wrap; margin: 30px 0; }
.categories a {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--muted);
}
.categories a.active { background: var(--text); color: var(--bg); }

.grid-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.product-card {
  display: grid;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  box-shadow: var(--shadow);
}
.product-card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: var(--bg); }
.product-card h2 { font-size: 1.06rem; margin: 6px 0; }
.product-card p { color: var(--muted); min-height: 54px; margin: 0; }
.product-card strong, .product-detail strong, .summary strong { font-size: 1.35rem; color: var(--accent); }

.section-head { display: flex; justify-content: space-between; gap: 16px; align-items: end; margin-bottom: 26px; }
.section-head h1 { margin: 0; font-size: clamp(2rem, 4vw, 3.4rem); }
.section-head p { color: var(--muted); margin: 0; }
.product-detail { display: grid; grid-template-columns: minmax(280px, .9fr) 1fr; gap: 42px; align-items: start; }
.product-detail > img { border-radius: 8px; aspect-ratio: 1; object-fit: cover; box-shadow: var(--shadow); }
.product-detail h1 { font-size: clamp(2rem, 5vw, 4.5rem); line-height: 1; margin: 10px 0 16px; }
.product-detail p { color: var(--muted); line-height: 1.7; }
.product-detail form { display: flex; gap: 10px; margin-top: 22px; }
.product-form { align-items: flex-start; }
.product-form select,
.product-form input[type="number"],
.product-form button,
.product-form .button {
  height: 44px;
  min-height: 44px;
  padding-top: 0;
  padding-bottom: 0;
  box-sizing: border-box;
}
.product-form button,
.product-form .button {
  display: inline-flex;
  align-items: center;
}
.product-form:has(.fragrance-field) > input[type="number"],
.product-form:has(.fragrance-field) > button,
.product-form:has(.fragrance-field) > .button {
  margin-top: 26px;
}
.product-detail input { max-width: 110px; }
.stock { display: block; color: var(--muted); margin-top: 10px; }
.fragrance-field { display: grid; gap: 6px; min-width: 220px; }
.fragrance-stock { margin-top: 0; font-size: .9rem; }

.auth-box, .payment-box, .summary {
  max-width: 520px;
  margin: 40px auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 26px;
  box-shadow: var(--shadow);
}
.auth-box form, .admin-form { display: grid; gap: 14px; }
label { display: grid; gap: 7px; color: var(--muted); font-weight: 650; }
label small[data-cep-status] {
  min-height: 1rem;
  text-transform: none;
  color: var(--muted);
}
label small[data-cep-status][data-state="success"] { color: var(--accent-strong); }
label small[data-cep-status][data-state="error"] { color: var(--danger); }
.flash { width: min(1180px, calc(100% - 32px)); margin: 16px auto; padding: 13px 16px; border-radius: 8px; background: var(--accent-strong); color: #fff; }
.flash.error { background: var(--danger); }
.account-grid { display: grid; grid-template-columns: .8fr 1fr; gap: 24px; align-items: start; margin-bottom: 24px; }
.account-panel, .address-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}
.account-panel h2, .address-box h2, .table-wrap h2 { margin-top: 0; }
.address-form { display: grid; gap: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.address-block, .address-box p { color: var(--muted); line-height: 1.6; margin-bottom: 0; }
.data-zone {
  max-width: 720px;
  margin: 0 0 24px;
}
.data-zone p {
  color: var(--muted);
  line-height: 1.6;
}
.danger-zone {
  max-width: 720px;
  margin: 0 0 24px;
  border-color: color-mix(in srgb, var(--danger) 32%, var(--line));
}
.danger-zone p {
  color: var(--muted);
  line-height: 1.6;
}
.danger-button {
  background: var(--danger);
  color: #fff;
}

.cart-layout, .admin-grid { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }
.cart-list { display: grid; gap: 12px; }
.cart-item {
  display: grid;
  grid-template-columns: 86px 1fr auto auto;
  gap: 16px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}
.cart-item img { width: 86px; height: 86px; object-fit: cover; border-radius: 8px; }
.cart-item h2 { margin: 0 0 5px; font-size: 1rem; }
.cart-item form { display: flex; gap: 8px; }
.cart-item input { width: 76px; }
.summary { margin: 0; position: sticky; top: 98px; display: grid; gap: 16px; }
.summary.wide { max-width: 720px; position: static; }
.line { display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); padding: 11px 0; }
.line.total { border-bottom: 0; font-size: 1.2rem; }
.shipping-options {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}
.shipping-options h2 { margin: 0 0 4px; }
.shipping-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
}
.shipping-option:has(input:checked) { border-color: var(--accent-strong); }
.shipping-option input { width: auto; }
.shipping-option span { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.payment-box textarea { min-height: 120px; margin: 16px 0; }
.qr { width: 240px; border-radius: 8px; margin: 16px auto; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.stats article, .admin-form, .table-wrap, .banner-admin article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.stats span { color: var(--muted); display: block; }
.stats strong { font-size: 2rem; }
.admin-form { order: 2; }
.admin-form.narrow { max-width: 760px; }
.check { display: flex; flex-direction: row; align-items: center; gap: 9px; }
.check input { width: auto; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { text-align: left; border-bottom: 1px solid var(--line); padding: 12px; vertical-align: middle; }
th { color: var(--muted); font-size: .82rem; text-transform: uppercase; }
.inline { display: inline-flex; gap: 8px; align-items: center; }
.stock-inline input { width: 86px; }
.banner-admin { display: grid; gap: 14px; }
.banner-admin article { display: grid; gap: 10px; }
.empty { color: var(--muted); }
.legal-page {
  max-width: 860px;
  margin: 0 auto;
}
.legal-page article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(18px, 4vw, 34px);
  box-shadow: var(--shadow);
}
.legal-page p, .legal-page li {
  color: var(--muted);
  line-height: 1.75;
}
.legal-page h2 {
  margin: 28px 0 8px;
  font-size: 1.2rem;
}
.legal-page ul {
  padding-left: 22px;
}
.legal-page a {
  color: var(--accent);
  font-weight: 700;
}
.delete-account-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}
.data-removal-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}
.site-footer { display: flex; justify-content: space-between; gap: 12px; padding: 28px clamp(16px, 4vw, 42px); border-top: 1px solid var(--line); color: var(--muted); }

@media (min-width: 861px) {
  .site-header,
  .site-footer {
    width: min(1180px, calc(100% - 32px));
    margin-left: auto;
    margin-right: auto;
  }

  .site-header { padding-left: 0; padding-right: 0; }
  .site-footer { padding-left: 0; padding-right: 0; }
}

@media (max-width: 860px) {
  .site-header { grid-template-columns: auto minmax(180px, 1fr); gap: 10px 12px; padding: calc(env(safe-area-inset-top, 0px) + 14px) 14px 10px; }
  .brand img { width: 40px; height: 40px; }
  .search { justify-self: end; width: min(320px, 100%); }
  .search input, .search button { height: 38px; min-height: 38px; }
  .site-header nav { grid-column: 1 / -1; justify-content: flex-end; gap: 10px; font-size: .9rem; }
  .hero, .product-detail, .cart-layout, .admin-grid, .account-grid { grid-template-columns: 1fr; }
  .hero { min-height: 360px; }
  .cart-item { grid-template-columns: 72px 1fr; }
  .cart-item form { grid-column: 1 / -1; }
  .summary { position: static; }
  .section-head { align-items: start; flex-direction: column; }
}

@media (max-width: 520px) {
  main { width: min(100% - 22px, 1180px); }
  .brand { gap: 8px; font-size: .92rem; }
  .brand img { width: 36px; height: 36px; }
  .search { gap: 6px; }
  .search input { height: 36px; padding: 0 9px; font-size: .92rem; }
  .search button { width: auto; height: 36px; min-height: 36px; padding: 0 10px; font-size: .9rem; }
  .site-header nav { justify-content: center; }
  .product-detail form, .inline { flex-direction: column; }
  .product-form:has(.fragrance-field) > input[type="number"],
  .product-form:has(.fragrance-field) > button,
  .product-form:has(.fragrance-field) > .button { margin-top: 0; }
  .form-row { grid-template-columns: 1fr; }
  button, .button { width: 100%; }
  .search button { width: auto; }
  .site-footer { flex-direction: column; }
}
