/* =========================================================================
   POLYPHARMACY CLINICAL SUITE — design tokens
   Dual theme (dark / cream) + swappable accent.
   ========================================================================= */

:root {
  /* type */
  --font-ui: "Space Grotesk", "IRANSansX", -apple-system, system-ui, sans-serif;
  --font-fa: "IRANSansX", "Space Grotesk", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* density (overridable by Tweaks) */
  --density: 1;
  --row-h: calc(58px * var(--density));
  --gap: calc(16px * var(--density));

  /* radii */
  --r-sm: 5px;
  --r-md: 8px;
  --r-lg: 12px;

  /* accent — AMBER default. swapped via [data-accent] */
  --accent: #e6a93a;
  --accent-strong: #f0b441;
  --accent-ink: #1a1305;          /* text on accent fills */
  --accent-soft: rgba(230,169,58,.14);
  --accent-line: rgba(230,169,58,.42);

  /* clinical semantic */
  --crit: #df5a4d;
  --crit-soft: rgba(223,90,77,.14);
  --warn: #e0a435;
  --safe: #46a079;
  --safe-soft: rgba(70,160,121,.14);
  --info: #5b91d8;

  --motion: 240ms cubic-bezier(.22,.61,.36,1);
}

/* ===================== DARK (default) ===================== */
:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0d11;
  --bg-deep: #07080b;
  --surface: #111419;
  --surface-2: #161a20;
  --surface-3: #1c2128;
  --rail: #0e1116;

  --line: rgba(255,255,255,.075);
  --line-2: rgba(255,255,255,.13);
  --line-strong: rgba(255,255,255,.22);

  --ink: #eae7df;          /* warm off-white */
  --ink-2: #b6b3ab;
  --muted: #8b8d93;
  --faint: #5b5e65;
  --ghost: #3a3d44;

  --grid-dot: rgba(255,255,255,.035);
  --shadow: 0 1px 0 rgba(255,255,255,.03), 0 18px 48px -24px rgba(0,0,0,.8);
}

/* ===================== CREAM LIGHT ===================== */
[data-theme="light"] {
  color-scheme: light;
  --bg: #f1ece1;           /* warm cream, not white */
  --bg-deep: #e8e1d2;
  --surface: #faf6ee;      /* milky paper */
  --surface-2: #f5efe3;
  --surface-3: #efe7d8;
  --rail: #ece5d7;

  --line: rgba(60,48,28,.10);
  --line-2: rgba(60,48,28,.16);
  --line-strong: rgba(60,48,28,.28);

  --ink: #2a2620;
  --ink-2: #4d4840;
  --muted: #756f64;
  --faint: #9a9384;
  --ghost: #c2bbac;

  --accent: #bf8413;
  --accent-strong: #a9740c;
  --accent-ink: #fffaf0;
  --accent-soft: rgba(191,132,19,.13);
  --accent-line: rgba(191,132,19,.40);

  --crit: #c14436;
  --crit-soft: rgba(193,68,54,.12);
  --warn: #b07d12;
  --safe: #2f7d54;
  --safe-soft: rgba(47,125,84,.12);
  --info: #3f6fb0;

  --grid-dot: rgba(60,48,28,.05);
  --shadow: 0 1px 0 rgba(255,255,255,.6), 0 18px 44px -26px rgba(80,60,20,.30);
}

/* ===================== ACCENT VARIANTS ===================== */
[data-accent="blue"] {
  --accent: #4f8fd6; --accent-strong: #62a0e6; --accent-ink: #06121f;
  --accent-soft: rgba(79,143,214,.15); --accent-line: rgba(79,143,214,.42);
}
[data-theme="light"][data-accent="blue"] {
  --accent: #2f6bb0; --accent-strong: #265c9c; --accent-ink: #f4f9ff;
  --accent-soft: rgba(47,107,176,.13); --accent-line: rgba(47,107,176,.4);
}
[data-accent="emerald"] {
  --accent: #3fae7d; --accent-strong: #4dc08d; --accent-ink: #04140d;
  --accent-soft: rgba(63,174,125,.15); --accent-line: rgba(63,174,125,.42);
}
[data-theme="light"][data-accent="emerald"] {
  --accent: #1f7e54; --accent-strong: #186a46; --accent-ink: #f2fbf6;
  --accent-soft: rgba(31,126,84,.13); --accent-line: rgba(31,126,84,.4);
}
[data-accent="indigo"] {
  --accent: #8a82e6; --accent-strong: #9a92f2; --accent-ink: #0c0a1e;
  --accent-soft: rgba(138,130,230,.16); --accent-line: rgba(138,130,230,.42);
}
[data-theme="light"][data-accent="indigo"] {
  --accent: #5b51c8; --accent-strong: #4d44b4; --accent-ink: #f6f5ff;
  --accent-soft: rgba(91,81,200,.13); --accent-line: rgba(91,81,200,.4);
}
