/* Critical theme tokens — first paint before theme-engine.js (sync FALLBACK Horizon) */
html[data-theme="dark"],
html:not([data-theme]) {
  color-scheme: dark;
  --bg: #131210;
  --surface: #1c1a17;
  --surface-2: #252219;
  --surface-raised: #252219;
  --border: #342f28;
  --text: #ede9e2;
  --text-dim: #9c958a;
  --text-muted: #9c958a;
  --accent: #c45c26;
  --teal: #3d8f5f;
  --danger: #c44a4a;
  --error: #c44a4a;
  --success: #3d8f5f;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --gap: 12px;
  --gap-sm: 8px;
  --pad: 16px;
  --page-pad: 16px;
  --field-gap: 8px;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-card: 14px;
  --radius-el: 10px;
  --text-xs: 13px;
  --text-sm: 13px;
  --text-body: 15px;
  --text-md: 15px;
  --text-lg: 19px;
  --text-xl: 23px;
  --font-ui: "DM Sans", system-ui, sans-serif;
  --font-display: "Source Serif 4", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --lh-body: 1.5;
  --border-width: 1px;
  --border-w: 1px;
  --control-h: 40px;
  --icon-btn-size: 36px;
  --sidebar: 190px;
  --sidebar-collapsed: 64px;
  --shell-header-h: 52px;
  --transition: 140ms ease;
  --motion-fast: 140ms ease;
  --focus-ring: 0 0 0 2px rgba(196, 92, 38, 0.35);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.18);
  --shadow-elev-1: var(--shadow-card);
  --shadow-elev-2: 0 4px 16px rgba(0, 0, 0, 0.22);
  --shadow-modal: 0 12px 40px rgba(0, 0, 0, 0.42);
  --accent-soft: rgba(196, 92, 38, 0.14);
  --accent-text: #ffffff;
  --accent-hover: #ad4f21;
  --border-subtle: rgba(237, 233, 226, 0.04);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f1eb;
  --surface: #ffffff;
  --surface-2: #eae6de;
  --surface-raised: #ffffff;
  --border: #d4cec4;
  --text: #1c1916;
  --text-dim: #5c564e;
  --text-muted: #5c564e;
  --accent: #a84e1f;
  --teal: #2d7a4a;
  --danger: #b83a3a;
  --error: #b83a3a;
  --success: #2d7a4a;
  --focus-ring: 0 0 0 2px rgba(168, 78, 31, 0.35);
  --shadow-card: 0 1px 2px rgba(28, 25, 22, 0.06);
  --shadow-elev-2: 0 4px 16px rgba(28, 25, 22, 0.08);
  --shadow-modal: 0 12px 40px rgba(28, 25, 22, 0.12);
  --accent-soft: rgba(168, 78, 31, 0.12);
  --accent-text: #ffffff;
  --accent-hover: #94421b;
  --border-subtle: rgba(28, 25, 22, 0.06);
}

html.theme-no-transition,
html.theme-no-transition *,
html.theme-no-transition *::before,
html.theme-no-transition *::after {
  transition: none !important;
  animation-duration: 0.001ms !important;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
