:root,
html[data-theme="light"] {
  color-scheme: light;
  --theme-page-bg: #f3f4f0;
  --theme-surface: #fffdf6;
  --theme-surface-solid: #ffffff;
  --theme-surface-muted: #e9ecef;
  --theme-surface-strong: #e6e8e3;
  --theme-control-bg: #ffffff;
  --theme-control-muted: #edf0f3;
  --theme-text: #15171b;
  --theme-text-secondary: #3a4148;
  --theme-text-muted: #646b73;
  --theme-border: #d9d9d1;
  --theme-border-strong: #b9c8e2;
  --theme-header-bg: rgba(255, 253, 246, 0.94);
  --theme-header-border: rgba(21, 23, 27, 0.1);
  --theme-primary-bg: #092f87;
  --theme-primary-hover: #0b2867;
  --theme-primary-text: #ffffff;
  --theme-link: #092f87;
  --theme-warning: #ffbf18;
  --theme-warning-soft: rgba(255, 191, 24, 0.28);
  --theme-warning-highlight: rgba(255, 191, 24, 0.55);
  --theme-warning-text: #111111;
  --theme-danger: #a33434;
  --theme-danger-bg: #9d2f2f;
  --theme-success: #22663a;
  --theme-success-bg: #17643a;
  --theme-info-bg: #174a87;
  --theme-info-surface: #f6f9ff;
  --theme-info-border: #d8e1f1;
  --theme-inverse-bg: #15171b;
  --theme-inverse-border: #1a1e22;
  --theme-inverse-text: #ffffff;
  --theme-inverse-muted: rgba(255, 255, 255, 0.74);
  --theme-inverse-line: rgba(255, 255, 255, 0.16);
  --theme-inverse-hover: rgba(255, 255, 255, 0.25);
  --theme-blue-section: #0b2867;
  --theme-logistics-bg: #e6e8e3;
  --theme-logo-bg: #ffffff;
  --theme-shadow: rgba(7, 30, 73, 0.3);
  --theme-floating-shadow: rgba(9, 47, 135, 0.25);
  --theme-focus: #b96d00;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --theme-page-bg: #0f141b;
  --theme-surface: #171e27;
  --theme-surface-solid: #1d2632;
  --theme-surface-muted: #222c38;
  --theme-surface-strong: #121a23;
  --theme-control-bg: #111821;
  --theme-control-muted: #263240;
  --theme-text: #f4f7fb;
  --theme-text-secondary: #d2d9e3;
  --theme-text-muted: #aeb8c5;
  --theme-border: #3a4758;
  --theme-border-strong: #596b82;
  --theme-header-bg: rgba(15, 20, 27, 0.94);
  --theme-header-border: rgba(255, 255, 255, 0.12);
  --theme-primary-bg: #2a5cbc;
  --theme-primary-hover: #356fd3;
  --theme-primary-text: #ffffff;
  --theme-link: #8eb6ff;
  --theme-warning: #ffc94d;
  --theme-warning-soft: rgba(255, 201, 77, 0.18);
  --theme-warning-highlight: rgba(255, 201, 77, 0.36);
  --theme-warning-text: #17130a;
  --theme-danger: #ff9a9a;
  --theme-danger-bg: #8f3038;
  --theme-success: #83d9a3;
  --theme-success-bg: #17643a;
  --theme-info-bg: #245797;
  --theme-info-surface: #18273c;
  --theme-info-border: #3b5e89;
  --theme-inverse-bg: #090e14;
  --theme-inverse-border: #303b49;
  --theme-inverse-text: #ffffff;
  --theme-inverse-muted: rgba(255, 255, 255, 0.76);
  --theme-inverse-line: rgba(255, 255, 255, 0.18);
  --theme-inverse-hover: rgba(255, 255, 255, 0.28);
  --theme-blue-section: #0d2a5e;
  --theme-logistics-bg: #121a23;
  --theme-logo-bg: #ffffff;
  --theme-shadow: rgba(0, 0, 0, 0.5);
  --theme-floating-shadow: rgba(0, 0, 0, 0.42);
  --theme-focus: #ffc94d;
}

html {
  background: var(--theme-page-bg);
  scrollbar-color: var(--theme-border-strong) var(--theme-page-bg);
}

body {
  accent-color: var(--theme-primary-bg);
}

::selection {
  background: var(--theme-warning-highlight);
  color: var(--theme-text);
}

:where(a, button, input, textarea, select, summary):focus-visible {
  outline: 3px solid var(--theme-focus);
  outline-offset: 3px;
}

:where(input, textarea, select) {
  color-scheme: inherit;
}

:where(input, textarea)::placeholder {
  color: var(--theme-text-muted);
  opacity: 0.82;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  min-width: 0;
}

.theme-toggle {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid var(--theme-border);
  border-radius: 8px;
  background: var(--theme-control-bg);
  color: var(--theme-text);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
}

.theme-toggle:hover {
  border-color: var(--theme-link);
  color: var(--theme-link);
}

.theme-toggle:active {
  background: var(--theme-surface-muted);
}

.theme-toggle[aria-pressed="true"] {
  border-color: var(--theme-border-strong);
  background: var(--theme-surface-muted);
}

.theme-toggle-icon {
  width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--theme-warning-soft);
  color: var(--theme-link);
  font-size: 16px;
  line-height: 1;
}

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

  .theme-toggle {
    width: 38px;
    padding: 0;
    justify-content: center;
  }

  .theme-toggle-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}

@media (prefers-reduced-motion: no-preference) {
  body,
  .site-header,
  .theme-toggle,
  input,
  textarea,
  button {
    transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease;
  }
}
