/* SDOS v2 design tokens — from the SDOS Workspace design handoff.
   Light values on :root; dark overrides under html.sdos-darkmode. */
@layer tokens {
  :root {
    /* surfaces */
    --bg: oklch(0.97 0.006 240);
    --surface: #ffffff;
    --surface-2: #f4f7fb;
    --surface-3: #eef2f6;
    --line: #e7ebf1;
    --line-strong: #d6dee3;

    /* text */
    --text: #232b36;
    --text-2: #56636f;
    --muted: #8a95a3;

    /* brand */
    --primary: #1c75bc;
    --primary-soft: #e3eef7;
    --primary-border: #bcd7ec;
    --rail: #16364f;
    --rail-active: rgba(255, 255, 255, 0.14);

    /* statuses */
    --st-new-bg: #e3eef7;        --st-new-fg: #1c75bc;
    --st-verified-bg: oklch(0.94 0.045 165); --st-verified-fg: oklch(0.38 0.1 165);
    --st-planned-bg: oklch(0.94 0.04 290);   --st-planned-fg: oklch(0.44 0.11 290);
    --st-delivered-bg: #eef1f4;  --st-delivered-fg: #61707f;
    --st-cancelled-bg: oklch(0.95 0.03 30);  --st-cancelled-fg: oklch(0.5 0.16 30);

    --ok-bg: oklch(0.93 0.045 155);  --ok-fg: oklch(0.38 0.1 155);  --ok: oklch(0.55 0.12 155);
    --warn-bg: oklch(0.96 0.035 85); --warn-fg: oklch(0.44 0.09 70); --warn: oklch(0.72 0.13 70);
    --danger-bg: oklch(0.95 0.03 30); --danger-fg: oklch(0.5 0.16 30); --danger: oklch(0.55 0.18 30);
    --urgent: oklch(0.55 0.18 30);

    /* geometry */
    --r-sm: 7px; --r-md: 10px; --r-lg: 14px; --r-pill: 999px;
    --shadow-card: 0 1px 2px rgba(15, 25, 40, 0.05);
    --shadow-pop: 0 12px 36px rgba(15, 25, 40, 0.16);

    /* type */
    --font-sans: "IBM Plex Sans Thai", "Noto Sans Thai", "Sukhumvit Set", -apple-system, sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  }

  html.sdos-darkmode {
    color-scheme: dark;
    --bg: oklch(0.19 0.015 250);
    --surface: oklch(0.24 0.015 250);
    --surface-2: oklch(0.27 0.015 250);
    --surface-3: oklch(0.3 0.018 250);
    --line: oklch(0.32 0.02 250);
    --line-strong: oklch(0.38 0.02 250);

    --text: oklch(0.9 0.01 250);
    --text-2: oklch(0.78 0.015 250);
    --muted: oklch(0.62 0.02 250);

    --primary: oklch(0.68 0.12 250);
    --primary-soft: oklch(0.3 0.05 250);
    --primary-border: oklch(0.42 0.07 250);
    --rail: #10222f;

    --st-new-bg: oklch(0.3 0.05 250);   --st-new-fg: oklch(0.78 0.1 250);
    --st-verified-bg: oklch(0.3 0.05 165); --st-verified-fg: oklch(0.8 0.1 165);
    --st-planned-bg: oklch(0.3 0.05 290);  --st-planned-fg: oklch(0.8 0.09 290);
    --st-delivered-bg: oklch(0.29 0.012 250); --st-delivered-fg: oklch(0.7 0.015 250);
    --st-cancelled-bg: oklch(0.3 0.05 30); --st-cancelled-fg: oklch(0.75 0.12 30);

    --ok-bg: oklch(0.3 0.05 155);  --ok-fg: oklch(0.8 0.11 155);
    --warn-bg: oklch(0.32 0.05 85); --warn-fg: oklch(0.82 0.11 85);
    --danger-bg: oklch(0.3 0.06 30); --danger-fg: oklch(0.78 0.13 30);

    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-pop: 0 12px 36px rgba(0, 0, 0, 0.55);
  }

  /* dark maps: invert tiles only, never markers/lines */
  html.sdos-darkmode .leaflet-tile { filter: invert(0.93) hue-rotate(180deg); }
}
