body.theme-dark {
  color-scheme: dark;
  --bg: #0f1419;
  --panel: #171d24;
  --panel-2: #1f2730;
  --text: #edf2f7;
  --muted: #94a3b8;
  --accent: #3b82f6;
  --accent-2: #22c55e;
  --danger: #ef4444;
  --border: #2d3748;
  --header-bg: rgba(15, 20, 25, 0.9);
  --body-gradient: radial-gradient(circle at top, #1a2332 0%, var(--bg) 45%);
  --input-bg: #0b1016;
  --step-active-bg: #132033;
  --brand-tag-bg: #132033;
  --brand-tag-text: #93c5fd;
  --price-color: #86efac;
  --banner-bg: #2a1f05;
  --banner-border: #854d0e;
  --banner-text: #fde68a;
  --filter-banner-bg: #0f2740;
  --filter-banner-border: #2563eb;
  --filter-banner-text: #bfdbfe;
  --btn-checkout: #1e2d5a;
  --btn-success-text: #ffffff;
}

body.theme-light {
  color-scheme: light;
  --bg: #eef2f7;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --text: #1a1f2e;
  --muted: #5c667a;
  --accent: #1f6feb;
  --accent-2: #1a7f37;
  --danger: #c0392b;
  --border: #d8dee8;
  --header-bg: rgba(255, 255, 255, 0.95);
  --body-gradient: linear-gradient(180deg, #ffffff 0%, var(--bg) 220px);
  --input-bg: #ffffff;
  --step-active-bg: #eef4ff;
  --brand-tag-bg: #eef4ff;
  --brand-tag-text: #1f6feb;
  --price-color: #1a7f37;
  --banner-bg: #fff8e6;
  --banner-border: #f0d080;
  --banner-text: #9a6700;
  --filter-banner-bg: #e8f1ff;
  --filter-banner-border: #93c5fd;
  --filter-banner-text: #1e40af;
  --btn-checkout: #1e2d5a;
  --btn-success-text: #ffffff;
}

:root {
  --font: "Play", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--body-gradient);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

button, .btn, input, select, textarea {
  font-family: inherit;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  position: sticky;
  top: 0;
  backdrop-filter: blur(8px);
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.brand-logo-link {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  line-height: 0;
}

.brand-logo {
  height: 52px;
  width: auto;
  max-width: 190px;
  object-fit: contain;
}

.brand-text {
  min-width: 0;
}

header h1 {
  margin: 0;
  font-size: 1.25rem;
}

header .sub {
  color: var(--muted);
  font-size: 0.85rem;
}

.auth-box {
  display: flex;
  gap: 12px;
  align-items: center;
}

button, .btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
}

.btn-primary { background: var(--accent); color: white; }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-success { background: var(--btn-checkout); color: var(--btn-success-text); }
.btn-success:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-ghost { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }

.layout {
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  gap: 16px;
  padding: 16px;
  flex: 1 0 auto;
  min-height: calc(100vh - 72px);
}

.site-footer {
  flex-shrink: 0;
  margin-top: 8px;
  background: var(--panel);
  color: var(--text);
  font-family: var(--font);
}

.site-footer:empty {
  display: none;
}

.site-footer #footer,
.site-footer .js-footer {
  width: 100%;
  margin: 0;
}

.site-footer a {
  color: var(--muted);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
}

.steps { display: flex; flex-direction: column; gap: 8px; }
.step-btn {
  text-align: left;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 12px;
}
.step-btn.active { border-color: var(--accent); background: var(--step-active-bg); }
.step-btn.done { border-color: var(--accent-2); }

.step-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 12px;
}

.browse-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.browse-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

#attribute-filters.hidden {
  display: none;
}

#attribute-filters select {
  flex: 0 1 180px;
  min-width: 140px;
}

.browse-toolbar input[type="search"],
.browse-toolbar select {
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
}

.browse-toolbar input[type="search"] {
  flex: 1 1 240px;
  min-width: 200px;
}

.browse-toolbar select {
  flex: 0 1 220px;
  min-width: 160px;
}

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.btn-sm {
  padding: 8px 12px;
  font-size: 0.85rem;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.brand-tag {
  display: inline-block;
  align-self: flex-start;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--brand-tag-bg);
  color: var(--brand-tag-text);
  font-size: 0.75rem;
  font-weight: 600;
}

.no-image, .empty-state {
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.product-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.product-card img {
  width: 100%;
  height: 140px;
  object-fit: contain;
  background: var(--input-bg);
  border-radius: 10px;
}

.product-card h3 {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.3;
}

.price { color: var(--price-color); font-weight: 700; }
.muted { color: var(--muted); font-size: 0.85rem; }

.summary-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.total {
  display: flex;
  justify-content: space-between;
  font-size: 1.2rem;
  font-weight: 700;
  margin-top: 12px;
}

.banner {
  margin: 16px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--banner-bg);
  border: 1px solid var(--banner-border);
  color: var(--banner-text);
}

.banner.filter-info {
  background: var(--filter-banner-bg);
  border-color: var(--filter-banner-border);
  color: var(--filter-banner-text);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  flex-shrink: 0;
}

.theme-toggle .theme-icon {
  width: 20px;
  height: 20px;
  display: block;
}

.hidden { display: none !important; }

@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  header {
    flex-direction: column;
    align-items: stretch;
  }

  .brand {
    flex-direction: column;
    align-items: flex-start;
  }

  .brand-logo {
    height: 44px;
    max-width: 160px;
  }

  .auth-box {
    justify-content: space-between;
    width: 100%;
  }
}
