/* Authenticated pages receive data-theme from the user's database preference. */
html { color-scheme: dark; }
html[data-theme="light"] {
  color-scheme: light;
  --theme-scheme: light;
  --light-page-bg: #f4f6fa;
  --light-panel-bg: #ffffff;
  --light-field-bg: #edf1f7;
  --light-text: #202b3c;
  --light-muted: #596579;
  --light-line: #ccd4e1;
  --light-accent: #275fd5;
  --light-primary: #275fd5;
  --light-accent-soft: #e4edff;
  --light-row-total: #e7edf7;
  --light-row-sub: #f0f3f8;
  --light-row-plan: #eaf3fa;
  --light-notice-bg: #fff3d6;
  --light-notice-text: #805208;
  --light-notice-border: #b88730;
  --light-error-bg: #fce8e6;
  --light-error-text: #b8312f;
  --light-success-bg: #e0f3e7;
  --light-success-text: #137a43;
  --light-info-bg: #e0f2fa;
  --light-info-text: #086a96;
  --light-info-border: #79a9c1;
  --light-wb-text: #8b0874;
  --light-ozon-text: #174ea6;
  --light-ym-text: #775000;
  --light-site-text: #096b60;
  --heat-text: #172333;
  --heat-shadow: none;
}
.theme-control { display:inline-flex; position:relative; align-items:center; flex-shrink:0; vertical-align:middle; }
button.theme-toggle {
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  width:auto; margin:0; padding:6px 10px; border-radius:6px;
  background:var(--surface2, var(--light-field-bg, #22263a));
  color:var(--text, var(--light-text, #e8eaf0));
  border:1px solid var(--border, var(--light-line, #2a2d3e));
  font:500 12px/1.4 system-ui,sans-serif; white-space:nowrap; cursor:pointer;
}
button.theme-toggle:hover { border-color:var(--accent, var(--light-accent, #5b8fff)); }
button.theme-toggle:focus-visible { outline:2px solid var(--accent, var(--light-accent, #5b8fff)); outline-offset:3px; }
button.theme-toggle:disabled { opacity:.6; cursor:wait; }
.theme-feedback {
  position:absolute; right:0; top:calc(100% + 8px); z-index:150;
  width:260px; padding:10px 12px; border:1px solid var(--light-notice-border, #b88730);
  background:var(--light-notice-bg, #443718); color:var(--light-notice-text, #ffe3a0);
  border-radius:6px; font:12px/1.5 system-ui; white-space:normal;
}
.theme-feedback[hidden] { display:none; }
header { flex-wrap:wrap; }
header nav { align-items:center; flex-wrap:wrap; }
.box .theme-control { margin-bottom:20px; }
html[data-theme="light"] .seg a.active,
html[data-theme="light"] nav a.active { background:var(--light-accent-soft); color:var(--light-accent); }
html[data-theme="light"] .seg.wb a.active { background:#f8def3; color:var(--light-wb-text); }
html[data-theme="light"] .seg.ozon a.active { background:#dfebff; color:var(--light-ozon-text); }
html[data-theme="light"] .color-choice:has(input:checked),
html[data-theme="light"] .quick-periods button.active,
html[data-theme="light"] body:has(#calculation) .brand-switch a.active { color:var(--light-accent); }
html[data-theme="light"] #catalog-results button { color:var(--light-accent); }
html[data-theme="light"] #cart-send { color:#fff; }
html[data-theme="light"] th.ch-total { background:var(--light-row-total); }
html[data-theme="light"] td[style*="--heat-text"] b { color:inherit; }
@media (max-width:900px) {
  header { gap:10px; }
  header nav { width:100%; margin-left:0; gap:4px; }
}
