/* Eclyzer Router v2 — Design Tokens (Surplus Intelligence Dual-Theme Architecture) */

@font-face {
  font-family: "Inter";
  src: url("/static/v2/fonts/inter-latin.woff2?v=20261121-rc1") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/static/v2/fonts/jetbrains-mono-latin.woff2?v=20261121-rc1") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Manrope";
  src: url("/static/v2/fonts/manrope-latin.woff2?v=20261121-rc1") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;

  /* Typography */
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Warm-Stone Light Surfaces (Surplus Intelligence Match) */
  --surface-page: #ffffff;
  --surface-canvas: #ffffff;
  --surface-sidebar: #fafaf9;
  --surface-card: #fafaf9;
  --surface-card-alt: #f4f4f1;
  --surface-card-deeper: #f4f4f1;
  --surface-row: #fafaf9;
  --surface-hover: #f0f0f3;
  --surface-menu-active: #edebe7;
  --ui-seg-thumb: #ffffff;
  --ui-thumb-shadow: 0 1px 2px rgba(27, 27, 30, 0.08);
  --surface-sunken: #f2f1ee;
  --surface-raised: #eceae6;
  --surface-popover: #ffffff;
  --surface-field: #ffffff;
  --surface-code: #111318;
  --surface-receipt: #ffffff;
  --surface-glass: rgba(255, 255, 255, 0.86);
  --surface-sheet: rgba(255, 255, 255, 0.96);

  /* Dividers & Borders */
  --divider-subtle: #e7e5e0;
  --divider: #e0ded8;
  --divider-strong: #d3d1ca;
  --border-subtle: #e7e5e0;
  --border: #e0ded8;
  --border-strong: #d3d1ca;
  --card-specular: none;
  --card-shadow: none;

  /* Framed Workspace & Cohesion Card Tokens (Light Mode — Surplus Warm Stone) */
  --ws-outer-bg: #f0efeb;
  --ws-canvas-bg: #faf9f6;
  --ws-header-bg: rgba(250, 249, 246, 0.94);
  --ws-card-bg: #ffffff;
  --ws-card-bg-alt: #f4f3ef;
  --ws-card-border: #e5e3dc;
  --ws-card-border-strong: #d2cfc6;
  --ws-card-specular: none;
  --ws-card-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  --ws-frame-shadow: 0 12px 36px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --ws-tab-active-bg: rgba(0, 105, 189, 0.10);
  --ws-tab-active-border: rgba(0, 105, 189, 0.24);

  /* Ink Scale */
  --ink: #1b1b1e;
  --ink-secondary: #363b45;
  --ink-muted: #5f5d66;
  --ink-faint: #67666d;
  --ui-faint: #67666d;
  --ui-money-text: #0a7241;
  --ui-chart-paid: #3d8fdb;
  --ui-blue-soft: rgba(0, 105, 189, 0.11);

  /* Semantic Accents (WCAG AA Calibrated for Light) */
  --primary: #0069bd;
  --primary-text: #005ea8;
  --primary-soft: rgba(0, 105, 189, 0.11);
  --primary-ring: rgba(0, 105, 189, 0.36);

  --success: #076b3c;
  --confirm: #065a32;
  --success-soft: rgba(7, 107, 60, 0.10);
  --success-ring: rgba(7, 107, 60, 0.34);

  --warn: #a16207;
  --warn-soft: rgba(161, 98, 7, 0.12);

  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.10);

  /* Elevation & Rings */
  --ui-card-ring: 0 0 0 1px #e7e5e0, 0 1px 2px rgba(15, 23, 42, 0.04);
  --ui-outline-ring: inset 0 0 0 1px #d3d1ca;
  --ui-control-ring: inset 0 0 0 1px #e0ded8;
  --ui-glass-ring: 0 0 0 1px rgba(15, 23, 42, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 12px 28px rgba(15, 23, 42, 0.08);
  --ui-dialog-shadow: 0 0 0 1px rgba(15, 23, 42, 0.10), 0 24px 60px rgba(15, 23, 42, 0.18);
  --ui-hero-card-shadow: 0 0 0 1px #e0ded8, 0 24px 60px rgba(15, 23, 42, 0.09);

  /* Tactile 3D Buttons (WCAG AA >= 4.5:1 for #ffffff text across Light/Dark & hover) */
  --ui-btn-primary-bg: linear-gradient(180deg, #1a5cd0 0%, #144db6 48%, #0f3f9a 100%);
  --ui-btn-primary-hover-bg: linear-gradient(180deg, #1f64db 0%, #1752bc 48%, #11439f 100%);
  --ui-btn-primary-edge: #0c3584;
  --ui-btn-primary-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), inset 0 -1px 0 rgba(8, 52, 130, 0.26), 0 2px 0 #0a2d6f, 0 8px 18px rgba(15, 63, 154, 0.22);

  --ui-btn-neutral-bg: linear-gradient(180deg, #ffffff 0%, #f4f3f1 52%, #e8e6e2 100%);
  --ui-btn-neutral-ink: #0d0f14;
  --ui-btn-neutral-shadow: inset 0 1px 0 #ffffff, 0 2px 0 #c6c3bc, 0 0 0 1px #d3d1ca;

  /* Focus Ring */

  /* Subtle Bento Grid Paper & Highlight */
  --grid-line-x: rgba(15, 23, 42, 0.045);
  --grid-line-y: rgba(15, 23, 42, 0.035);
  --grid-radial-blue: rgba(0, 105, 189, 0.07);
  --hand-highlight: rgba(12, 132, 75, 0.14);

  /* Radii Scale */
  --r-chip: 5px;
  --r-badge: 6px;
  --r-control: 8px;
  --r-mark: 9px;
  --r-menu: 12px;
  --r-card: 13px;
  --r-cta: 14px;
  --r-dialog: 16px;
  --r-footer: 20px;
  --r-pill: 9999px;

  /* Easing & Timing */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

.dark {
  color-scheme: dark;

  /* Obsidian Charcoal Dark Surfaces (Default — Surplus Intelligence Match) */
  --surface-page: #0e0e0e;
  --surface-canvas: #0e0e0e;
  --surface-sidebar: #121216;
  --surface-card: #121216;
  --surface-card-alt: #17171c;
  --surface-card-deeper: #0e0e0e;
  --surface-row: #121216;
  --surface-hover: #17171c;
  --surface-menu-active: #25262d;
  --ui-seg-thumb: #2a2b33;
  --ui-thumb-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  --surface-sunken: #1a1a20;
  --surface-raised: #1f1f27;
  --surface-popover: #202024;
  --surface-field: #0e0e0e;
  --surface-code: #0a0b0e;
  --surface-receipt: #15161b;
  --surface-glass: rgba(14, 14, 14, 0.86);
  --surface-sheet: rgba(18, 18, 22, 0.96);

  /* Hairline Dividers & Borders */
  --divider-subtle: #1f2024;
  --divider: #24252a;
  --divider-strong: #34353b;
  --border-subtle: #1f2024;
  --border: #24252a;
  --border-strong: #34353b;
  --card-specular: none;
  --card-shadow: none;

  /* Framed Workspace & Cohesion Card Tokens (Dark Mode — Surplus Neutral Obsidian) */
  --ws-outer-bg: #09090b;
  --ws-canvas-bg: #0e0e11;
  --ws-header-bg: rgba(14, 14, 17, 0.94);
  --ws-card-bg: #141418;
  --ws-card-bg-alt: #1a1a20;
  --ws-card-border: #222229;
  --ws-card-border-strong: #32323c;
  --ws-card-specular: inset 0 1px 0 rgba(255, 255, 255, 0.035);
  --ws-card-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
  --ws-frame-shadow: 0 20px 52px rgba(0, 0, 0, 0.50), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --ws-tab-active-bg: rgba(0, 142, 250, 0.14);
  --ws-tab-active-border: rgba(0, 142, 250, 0.30);

  /* Calibrated Dark-Mode Ink Scale */
  --ink: #f4f4f5;
  --ink-secondary: #b4b2bd;
  --ink-muted: #8a8893;
  --ink-faint: #8a8893;
  --ui-faint: #8a8893;
  --ui-money-text: #2fd07f;
  --ui-chart-paid: #3a9ceb;
  --ui-blue-soft: rgba(0, 142, 250, 0.14);

  /* Electric Blue & Emerald Accents */
  --primary: #008efa;
  --primary-text: #5abeff;
  --primary-soft: rgba(0, 142, 250, 0.14);
  --primary-ring: rgba(0, 142, 250, 0.42);

  --success: #2fd07f;
  --confirm: #34d399;
  --success-soft: rgba(47, 208, 127, 0.12);
  --success-ring: rgba(47, 208, 127, 0.32);

  --warn: #e0a13a;
  --warn-soft: rgba(224, 161, 58, 0.13);

  --danger: #f87171;
  --danger-soft: rgba(242, 119, 127, 0.14);

  /* Elevation & Rings */
  --ui-card-ring: 0 0 0 1px #1f2024;
  --ui-outline-ring: inset 0 0 0 1px #34353b;
  --ui-control-ring: inset 0 0 0 1px #24252a;
  --ui-glass-ring: 0 0 0 1px rgba(255, 255, 255, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 16px 36px rgba(0, 0, 0, 0.42);
  --ui-dialog-shadow: 0 0 0 1px rgba(255, 255, 255, 0.10), 0 24px 60px rgba(0, 0, 0, 0.58);
  --ui-hero-card-shadow: 0 0 0 1px #24252a, 0 28px 68px rgba(0, 0, 0, 0.52);

  /* Tactile 3D Buttons (WCAG AA >= 4.5:1 for #ffffff text) */
  --ui-btn-primary-bg: linear-gradient(180deg, #1d62d8 0%, #1753be 48%, #1245a3 100%);
  --ui-btn-primary-hover-bg: linear-gradient(180deg, #216be0 0%, #1a59c8 48%, #144bad 100%);
  --ui-btn-primary-edge: #0e3889;
  --ui-btn-primary-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), inset 0 -1px 0 rgba(8, 48, 120, 0.28), 0 2px 0 #0b2f76, 0 8px 18px rgba(18, 69, 163, 0.28);

  --ui-btn-neutral-bg: linear-gradient(180deg, #2a2b33 0%, #202128 100%);
  --ui-btn-neutral-ink: #f4f4f5;
  --ui-btn-neutral-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 2px 0 #090a0d, 0 0 0 1px #34353b;


  /* Bento Grid Paper & Highlight */
  --grid-line-x: rgba(255, 255, 255, 0.032);
  --grid-line-y: rgba(255, 255, 255, 0.025);
  --grid-radial-blue: rgba(51, 126, 248, 0.11);
  --hand-highlight: rgba(47, 208, 127, 0.18);
}

/* Global Base & Themed Browser Surfaces */
*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-family: var(--font-sans);
  font-size: 16px;
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background-color: var(--surface-page);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  caret-color: var(--primary);
  overflow-x: clip;
}

::selection {
  background-color: rgba(0, 142, 250, 0.28);
  color: #ffffff;
}

:root:not(.dark) ::selection {
  background-color: rgba(0, 105, 189, 0.18);
  color: #0d0f14;
}

/* Subtle Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--divider-strong);
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--ink-muted);
}

a {
  color: inherit;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

code,
pre,
.mono,
.tnum {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.tnum {
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
}

:focus-visible {
  outline: 2px solid var(--primary-text);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms;
    animation-iteration-count: 1;
    transition-duration: 0.01ms;
  }
}
