/* Design tokens. Light is default; dark via [data-theme=dark] or system preference. */
:root {
  color-scheme: light;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #ffffff;
  --bg-elev: #ffffff;
  --surface: #f6f7f9;
  --surface-2: #eceef2;
  --text: #1b1f24;
  --text-muted: #59626e;
  --border: #e1e4e8;
  --border-strong: #868e99;
  --accent: #3451c7;
  --accent-contrast: #ffffff;
  --accent-soft: #e8ecfb;
  --accent-soft-text: #2a41a3;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --success: #1a7f37;
  --focus: #3451c7;
  --scrim: rgba(15, 20, 28, .45);
  --shadow: 0 8px 28px rgba(15, 20, 28, .16), 0 1px 3px rgba(15, 20, 28, .1);

  --p1: #c4262e;
  --p2: #a84b00;
  --p3: #1566b8;
  --p4: #5f6874;
  --overdue: #c4262e;

  --radius: 10px;
  --radius-sm: 6px;
  --sidebar-w: 272px;
  --panel-w: 400px;
  --details-w: 560px;
  --details-tint: rgba(15, 18, 22, 0.08);
  --tap: 44px;
  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --details-tint: rgba(0, 0, 0, 0.28);
  --bg: #14161a;
  --bg-elev: #1b1e23;
  --surface: #1b1e23;
  --surface-2: #272b33;
  --text: #e9ebee;
  --text-muted: #a1a9b4;
  --border: #2d323a;
  --border-strong: #7d8692;
  --accent: #9db0ff;
  --accent-contrast: #0d1226;
  --accent-soft: #232a4a;
  --accent-soft-text: #c3cfff;
  --danger: #ff8b82;
  --danger-soft: #3a1d1b;
  --success: #56d364;
  --focus: #9db0ff;
  --scrim: rgba(0, 0, 0, .6);
  --shadow: 0 8px 28px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .4);
  --p1: #ff8b82;
  --p2: #ffa94d;
  --p3: #74c0fc;
  --p4: #9aa3af;
  --overdue: #ff8b82;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    color-scheme: dark;
    --bg: #14161a;
    --bg-elev: #1b1e23;
    --surface: #1b1e23;
    --surface-2: #272b33;
    --text: #e9ebee;
    --text-muted: #a1a9b4;
    --border: #2d323a;
    --border-strong: #7d8692;
    --accent: #9db0ff;
    --accent-contrast: #0d1226;
    --accent-soft: #232a4a;
    --accent-soft-text: #c3cfff;
    --danger: #ff8b82;
    --danger-soft: #3a1d1b;
    --success: #56d364;
    --focus: #9db0ff;
    --scrim: rgba(0, 0, 0, .6);
    --shadow: 0 8px 28px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .4);
    --p1: #ff8b82;
    --p2: #ffa94d;
    --p3: #74c0fc;
    --p4: #9aa3af;
    --overdue: #ff8b82;
  }
}
