/* MedLink design tokens — "Clinical Precision"
 * Warm-neutral greys, single teal accent, tabular figures everywhere.
 */

:root {
  /* Surfaces — subtly warm neutrals (saturation ≤ 0.01) */
  --bg:         oklch(99.2% 0.002 95);
  --bg-sunken:  oklch(97.5% 0.003 95);
  --bg-raised:  oklch(100% 0 0);
  --bg-hover:   oklch(96.5% 0.004 95);
  --bg-active:  oklch(94.5% 0.006 95);

  /* Text */
  --fg:         oklch(22% 0.01 260);
  --fg-muted:   oklch(48% 0.012 260);
  --fg-subtle:  oklch(62% 0.012 260);
  --fg-faint:   oklch(78% 0.008 260);

  /* Borders — hairlines */
  --border:         oklch(90% 0.005 260);
  --border-strong:  oklch(82% 0.008 260);
  --border-focus:   var(--accent);

  /* Accent (clinical teal) */
  --accent:         oklch(58% 0.09 200);
  --accent-hover:   oklch(52% 0.1 200);
  --accent-fg:      oklch(99% 0 0);
  --accent-tint:    oklch(96% 0.02 200);
  --accent-border:  oklch(85% 0.04 200);

  /* Semantic — icon + color + word (never color alone) */
  --success:        oklch(55% 0.11 155);
  --success-tint:   oklch(96% 0.025 155);
  --success-border: oklch(86% 0.05 155);

  --warning:        oklch(62% 0.13 75);
  --warning-tint:   oklch(96% 0.035 75);
  --warning-border: oklch(86% 0.07 75);

  --danger:         oklch(55% 0.17 25);
  --danger-tint:    oklch(96% 0.025 25);
  --danger-border:  oklch(86% 0.06 25);

  --info:           oklch(55% 0.11 250);
  --info-tint:      oklch(96% 0.025 250);
  --info-border:    oklch(86% 0.05 250);

  --neutral-tint:   oklch(95% 0.004 260);
  --neutral-border: oklch(88% 0.006 260);

  /* Radii */
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 10px;
  --r-xl: 14px;

  /* Shadow — minimal, tool-feel */
  --shadow-sm: 0 1px 1px oklch(0% 0 0 / 0.04), 0 1px 2px oklch(0% 0 0 / 0.04);
  --shadow-md: 0 2px 4px oklch(0% 0 0 / 0.04), 0 4px 12px oklch(0% 0 0 / 0.06);
  --shadow-lg: 0 4px 8px oklch(0% 0 0 / 0.05), 0 12px 32px oklch(0% 0 0 / 0.10);
  --shadow-pop: 0 8px 24px oklch(0% 0 0 / 0.12), 0 24px 64px oklch(0% 0 0 / 0.18);

  /* Density */
  --row-h: 40px;
  --row-h-compact: 32px;
  --sidebar-w: 232px;
  --sidebar-w-icon: 56px;

  /* Type */
  --font-sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-serif: "Newsreader", ui-serif, Georgia, serif;

  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-md: 13px;
  --fs-lg: 14px;
  --fs-xl: 16px;
  --fs-2xl: 20px;
  --fs-3xl: 28px;

  --lh-tight: 1.2;
  --lh-base: 1.45;
}

[data-theme="dark"] {
  --bg:         oklch(18% 0.01 260);
  --bg-sunken:  oklch(15% 0.01 260);
  --bg-raised:  oklch(22% 0.01 260);
  --bg-hover:   oklch(25% 0.012 260);
  --bg-active:  oklch(28% 0.014 260);

  --fg:         oklch(96% 0.003 95);
  --fg-muted:   oklch(72% 0.008 260);
  --fg-subtle:  oklch(58% 0.01 260);
  --fg-faint:   oklch(40% 0.01 260);

  --border:        oklch(28% 0.01 260);
  --border-strong: oklch(38% 0.012 260);

  --accent:        oklch(72% 0.1 200);
  --accent-hover:  oklch(78% 0.1 200);
  --accent-fg:     oklch(15% 0.01 260);
  --accent-tint:   oklch(28% 0.04 200);
  --accent-border: oklch(38% 0.06 200);

  --success:        oklch(72% 0.12 155);
  --success-tint:   oklch(26% 0.04 155);
  --success-border: oklch(38% 0.06 155);

  --warning:        oklch(78% 0.13 75);
  --warning-tint:   oklch(28% 0.05 75);
  --warning-border: oklch(42% 0.08 75);

  --danger:         oklch(72% 0.14 25);
  --danger-tint:    oklch(28% 0.05 25);
  --danger-border:  oklch(42% 0.08 25);

  --info:           oklch(72% 0.11 250);
  --info-tint:      oklch(26% 0.04 250);
  --info-border:    oklch(38% 0.06 250);

  --neutral-tint:   oklch(24% 0.006 260);
  --neutral-border: oklch(32% 0.008 260);

  --shadow-sm: 0 1px 1px oklch(0% 0 0 / 0.2), 0 1px 2px oklch(0% 0 0 / 0.25);
  --shadow-md: 0 2px 4px oklch(0% 0 0 / 0.25), 0 4px 12px oklch(0% 0 0 / 0.35);
  --shadow-lg: 0 4px 8px oklch(0% 0 0 / 0.3), 0 12px 32px oklch(0% 0 0 / 0.5);
  --shadow-pop: 0 8px 24px oklch(0% 0 0 / 0.5), 0 24px 64px oklch(0% 0 0 / 0.65);
}

/* Accent variants selectable via Tweaks */
[data-accent="indigo"] {
  --accent:        oklch(55% 0.16 265);
  --accent-hover:  oklch(49% 0.17 265);
  --accent-tint:   oklch(96% 0.03 265);
  --accent-border: oklch(85% 0.06 265);
}
[data-theme="dark"][data-accent="indigo"] {
  --accent:        oklch(72% 0.14 265);
  --accent-tint:   oklch(28% 0.07 265);
  --accent-border: oklch(38% 0.1 265);
}
[data-accent="amber"] {
  --accent:        oklch(65% 0.14 65);
  --accent-hover:  oklch(59% 0.15 65);
  --accent-tint:   oklch(96% 0.035 65);
  --accent-border: oklch(86% 0.07 65);
}
[data-theme="dark"][data-accent="amber"] {
  --accent:        oklch(78% 0.14 75);
  --accent-tint:   oklch(28% 0.05 75);
  --accent-border: oklch(42% 0.08 75);
}

[data-density="compact"] {
  --row-h: 32px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: var(--lh-base);
  color: var(--fg);
  background: var(--bg);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body {
  font-variant-numeric: tabular-nums;
}
button { font-family: inherit; font-size: inherit; color: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.num { font-variant-numeric: tabular-nums; letter-spacing: -0.005em; }

::selection { background: var(--accent-tint); color: var(--fg); }
