html[data-theme="light"] { color-scheme: light; }

html[data-theme="dark"] {
  color-scheme: dark;
  --primary-red: #ef8588;
  --text-dark: #ece8e4;
  --text-gray: #bcb6b0;
  --bg-light: #1b1b1e;
  --white: #141416;
  --border: #3d383a;
  --red: #ef8588;
  --ink: #ece8e4;
  --muted: #bcb6b0;
  --line: #3d383a;
  --cream: #141416;
  --night-surface: #222225;
  --night-line: #3d383a;
  --night-red: #a91b1f;
  --banner-red: #651b23;
}

html[data-theme="dark"] body { background-color: #141416; color: #ece8e4; }

/* Existing mobile headers use !important, so the night color must match it. */
html[data-theme="dark"] header,
html[data-theme="dark"] header:hover,
html[data-theme="dark"] header.scrolled {
  background: rgba(24, 24, 27, 0.98) !important;
}

html[data-theme="dark"] :is(.mobile-drawer, .drawer-header, .mobile-drawer li,
  .mobile-drawer li.phone-item, .product-card, .product-item, .favorite-card,
  .cms-detail-image, .cms-detail .cms-specs, .cms-news-placeholder) {
  background: var(--night-surface);
}

html[data-theme="dark"] :is(.store-block, .news-item, .product-card,
  .brand-grid, .brand-item, .card-meta, .drawer-header, .mobile-drawer li) {
  border-color: var(--night-line);
}

html[data-theme="dark"] :is(.cms-empty, .cms-summary, .cms-detail time) { color: var(--text-gray); }
html[data-theme="dark"] :is(.cms-read, .cms-back, .cms-news-placeholder) { color: var(--primary-red); }
html[data-theme="dark"] :is(.news-copy h3 a:hover, .product-info h3 a:hover) { color: var(--primary-red); }

html[data-theme="dark"] :is(.store-call-link, .card-badge, .standard-band) {
  background: var(--night-red);
  color: #fff;
}
html[data-theme="dark"] .btn-red:hover { background: var(--night-red); color: #fff; }
html[data-theme="dark"] :is(.toggle.active #bar1, .toggle.active #bar3, .toggle:hover .bars) {
  background-color: var(--primary-red);
}

/* Photos, product images and QR codes keep their original colors. */
html[data-theme="dark"] .prod-img-box,
html[data-theme="dark"] .product-image { background: #fff; }
html[data-theme="dark"] :is(.splash-logo-img, .logo-img, .drawer-logo img, .brand img) {
  background: #f6f2ed;
  border-radius: 6px;
}

/* Admin surfaces and form controls share the same schedule. */
html[data-theme="dark"] :is(.login-panel, .sidebar, .topbar, .stats > div,
  .content-panel, .secondary, dialog, input, textarea, select) {
  background: var(--night-surface);
  color: var(--ink);
  border-color: var(--line);
}
html[data-theme="dark"] :is(.dialog-actions, .image-preview) {
  background: #1b1b1e;
  border-color: var(--line);
}
html[data-theme="dark"] :is(.nav-button, .stats span, .stats small,
  .row-actions a, .row-actions .delete, .image-preview, .login-note) { color: var(--muted); }
html[data-theme="dark"] .nav-button.active { background: #43272b; color: var(--red); }
html[data-theme="dark"] .primary { background: var(--night-red); color: #fff; }
html[data-theme="dark"] .primary:hover { background: #861519; }
html[data-theme="dark"] .login-brand { background: #651b23; }
html[data-theme="dark"] .badge { background: #263c2b; color: #b8d9b9; }
html[data-theme="dark"] .badge.draft { background: #403727; color: #e1c894; }
