/* Design tokens. Light values live on bare :root; dark values are redefined
   under both the prefers-color-scheme fallback and the explicit
   [data-theme="dark"] override so the in-app toggle wins in both directions. */

:root {
  --ui-font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eef0f3;
  --surface-hover: #e7eaef;
  --border: #e3e6eb;
  --border-strong: #ccd1da;

  --text: #1f2328;
  --text-dim: #656d78;
  --text-faint: #99a0aa;

  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-weak: #dfe8ff;
  --on-accent: #ffffff;

  --danger: #e5484d;
  --danger-weak: #fde7e7;
  --warn: #b7791f;
  --ok: #2f9e44;

  --canvas-bg: #ffffff;
  --grid-dot: #e6e8ec;

  --sym-stroke: #1a1a1a;
  --sym-fill: #1a1a1a;
  --wire: #1a1a1a;
  --sel: #2563eb;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .08);
  --shadow: 0 2px 6px rgba(15, 23, 42, .10), 0 8px 28px rgba(15, 23, 42, .10);

  --radius: 8px;
  --radius-sm: 6px;
  --topbar-h: 48px;
  --status-h: 26px;
  --left-w: 236px;
  --right-w: 264px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161616;
    --surface: #1f1f1f;
    --surface-2: #262626;
    --surface-hover: #2f2f2f;
    --border: #343434;
    --border-strong: #454545;

    --text: #e7e7e7;
    --text-dim: #9aa1ab;
    --text-faint: #6b7280;

    --accent: #4f9dff;
    --accent-hover: #6aabff;
    --accent-weak: #22354d;
    --on-accent: #0b1220;

    --danger: #ff6b6b;
    --danger-weak: #3a2323;
    --warn: #e0a458;
    --ok: #51cf66;

    --canvas-bg: #1e1e1e;
    --grid-dot: #2e2e2e;

    --sym-stroke: #d3d3d3;
    --sym-fill: #d3d3d3;
    --wire: #d3d3d3;
    --sel: #4f9dff;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 2px 6px rgba(0, 0, 0, .45), 0 8px 28px rgba(0, 0, 0, .4);

    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #161616;
  --surface: #1f1f1f;
  --surface-2: #262626;
  --surface-hover: #2f2f2f;
  --border: #343434;
  --border-strong: #454545;

  --text: #e7e7e7;
  --text-dim: #9aa1ab;
  --text-faint: #6b7280;

  --accent: #4f9dff;
  --accent-hover: #6aabff;
  --accent-weak: #22354d;
  --on-accent: #0b1220;

  --danger: #ff6b6b;
  --danger-weak: #3a2323;
  --warn: #e0a458;
  --ok: #51cf66;

  --canvas-bg: #1e1e1e;
  --grid-dot: #2e2e2e;

  --sym-stroke: #d3d3d3;
  --sym-fill: #d3d3d3;
  --wire: #d3d3d3;
  --sel: #4f9dff;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 2px 6px rgba(0, 0, 0, .45), 0 8px 28px rgba(0, 0, 0, .4);

  color-scheme: dark;
}
