.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.theme-toggle {
  display: grid;
  width: 39px;
  height: 39px;
  flex: 0 0 39px;
  place-items: center;
  margin: 0;
  padding: 0;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 50%;
}

.theme-toggle:hover {
  color: var(--green);
  background: var(--card);
  border-color: var(--green);
}

.theme-toggle:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--green) 40%, transparent);
  outline-offset: 3px;
}

.theme-icon {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-icon-moon { fill: currentColor; stroke: none; }
.theme-icon-sun { display: none; }

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #edf4f0;
  --muted: #a9b9b1;
  --paper: #0d1512;
  --card: #15211d;
  --line: #34443d;
  --green: #72d7b2;
  --lime: #d9f07a;
  --orange: #ff9368;
  --shadow: 0 20px 50px rgba(0, 0, 0, .26);
}

html[data-theme="dark"] .theme-icon-moon { display: none; }
html[data-theme="dark"] .theme-icon-sun { display: block; }
html[data-theme="dark"] .brand-mark { color: var(--lime); background: #24342e; }

html[data-theme="dark"] select,
html[data-theme="dark"] input,
html[data-theme="dark"] textarea {
  color: var(--ink);
  background: #1b2924;
  border-color: var(--line);
}

html[data-theme="dark"] button:not(.theme-toggle):not(.footer-cookie-button) {
  color: #10201a;
  background: #e7f0eb;
}

html[data-theme="dark"] button:not(.theme-toggle):not(.footer-cookie-button):hover {
  background: var(--green);
}

html[data-theme="dark"] :is(
  .metric-card,
  .indicator-list-card,
  .country-observation-grid article,
  .comparison-link-grid a,
  .comparison-directory-grid article,
  .country-directory-grid article,
  .region-directory-grid article,
  .guide-preview-grid article,
  .guide-directory-grid article,
  .directory-sort,
  .release-facts div
) { background: #1a2823; }

html[data-theme="dark"] :is(
  .peer-links a:hover,
  .glossary-index a,
  .live-badge,
  .pulse-facts span,
  .live-badge
) { background: #21322b; }

html[data-theme="dark"] :is(.official-definition, .guide-footer) {
  background: #1b3028;
  border-color: #3a574b;
}

html[data-theme="dark"] .official-definition .definition-source { border-color: #3a574b; }
html[data-theme="dark"] .region-country-list span { background: #1b2924; }
html[data-theme="dark"] .notice { color: #f2dfad; background: #302817; border-color: #6d5930; }
html[data-theme="dark"] .developer-content pre { color: #e8f3ed; background: #07100d; }
html[data-theme="dark"] .pulse-preview { color: #f5f0df; background: #07100d; }
html[data-theme="dark"] .pulse-facts strong { color: var(--ink); }
html[data-theme="dark"] .button-link { color: #14211d; }
html[data-theme="dark"] .interactive-sparkline .sparkline-point { stroke: #15211d; }
html[data-theme="dark"] .interactive-sparkline .sparkline-tooltip rect { fill: #050a08; }

html[data-theme="dark"] .consent-banner { background: var(--card); box-shadow: 0 22px 70px rgba(0, 0, 0, .55); }
html[data-theme="dark"] .consent-button.secondary { color: var(--ink); background: #1b2924; }
html[data-theme="dark"] .consent-button.secondary:hover { color: #10201a; background: var(--green); }
html[data-theme="dark"] .consent-button.primary { color: #10201a; background: #e7f0eb; }
html[data-theme="dark"] .consent-close { color: var(--ink); background: #21322b; }
html[data-theme="dark"] .footer-cookie-button { color: var(--muted); background: none; }
html[data-theme="dark"] .footer-cookie-button:hover { color: var(--green); background: none; }

@media (max-width: 850px) {
  .header-actions { gap: 14px; }
}
