/* Bia — Clinical Modern Healthcare tokens
   Cool neutrals + blue primary. Status accents (amber/teal/clay) kept
   semantically distinct so they remain readable against the cool base. */


/* Fonts self-hosted (vendored woff2 in /static/fonts), NOT Google Fonts @import.
   The strict CSP (style-src/font-src 'self', docs/engineering/06-security.md) blocks
   the package's `@import url('fonts.googleapis...')` and the gstatic woff2 it pulls.
   This is the only deviation from the as-is copy of the package tokens.css — see ADR-0009.
   Hanken Grotesk is a variable font (one file per subset, weight range 400 700);
   IBM Plex Mono is static per weight. Subsets: latin + latin-ext (pt-PT). */

/* Hanken Grotesk 400 700 (latin-ext) */
@font-face {
  font-family: 'Hanken Grotesk';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/static/fonts/hanken-grotesk-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Hanken Grotesk 400 700 (latin) */
@font-face {
  font-family: 'Hanken Grotesk';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/static/fonts/hanken-grotesk-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* IBM Plex Mono 400 (latin-ext) */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/ibm-plex-mono-400-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* IBM Plex Mono 500 (latin-ext) */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/static/fonts/ibm-plex-mono-500-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* IBM Plex Mono 400 (latin) */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/ibm-plex-mono-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* IBM Plex Mono 500 (latin) */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/static/fonts/ibm-plex-mono-500-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* === Cool neutrals — clinical base (hue 235) === */
  --bg-app: oklch(0.985 0.0048 235);          /* page background, cool off-white */
  --bg-surface: oklch(1 0 0);                  /* elevated surface, true white */
  --bg-surface-2: oklch(0.975 0.006 235);      /* nested surface */
  --bg-hover: oklch(0.96 0.0078 235);          /* hover wash */
  --bg-sunken: oklch(0.965 0.0078 235);        /* gutter, lunch */

  --border-subtle: oklch(0.93 0.0078 235);
  --border-default: oklch(0.88 0.012 235);
  --border-strong: oklch(0.78 0.015 235);

  /* === Text === */
  --text-primary: oklch(0.25 0.012 235);
  --text-secondary: oklch(0.50 0.012 235);
  --text-tertiary: oklch(0.62 0.0102 235);
  --text-disabled: oklch(0.75 0.0078 235);
  --text-inverse: oklch(0.99 0.003 235);

  /* === Brand primary — "sage-*" name kept for token continuity, now tuned to clinical blue (hue 230) === */
  --sage-50:  oklch(0.96 0.0365 230);
  --sage-100: oklch(0.92 0.0635 230);
  --sage-200: oklch(0.85 0.0985 230);
  --sage-500: oklch(0.55 0.135  230);
  --sage-600: oklch(0.46 0.135  230);
  --sage-700: oklch(0.38 0.117  230);

  /* Primary button explicit tokens (darker tints for stronger CTA) */
  --btn-primary-bg:       oklch(0.30 0.115 230);
  --btn-primary-bg-hover: oklch(0.42 0.135 230);

  /* Amber — por confirmar */
  --amber-50:  oklch(0.97 0.025 82);
  --amber-100: oklch(0.93 0.045 80);
  --amber-200: oklch(0.86 0.075 78);
  --amber-500: oklch(0.66 0.110 70);
  --amber-700: oklch(0.46 0.080 60);

  /* Teal — em curso, live */
  --teal-50:  oklch(0.96 0.020 200);
  --teal-100: oklch(0.92 0.035 200);
  --teal-200: oklch(0.84 0.055 200);
  --teal-500: oklch(0.55 0.080 200);
  --teal-700: oklch(0.40 0.065 200);

  /* Clay — urgência */
  --clay-50:  oklch(0.96 0.022 35);
  --clay-100: oklch(0.92 0.040 35);
  --clay-200: oklch(0.85 0.080 35);
  --clay-500: oklch(0.60 0.130 32);
  --clay-700: oklch(0.42 0.100 32);

  /* Médico palette — positional doctor colours (web/doctor_palette.py: lm/ac/me
     + overflow d4-d6). Canonical home here (global): the agenda's chip + the
     faturação list both colour médicos from these, and the global styles-shell.css
     already references them in `.fopt__dot--*`. styles-agenda-week.css / agenda-glue.css
     still re-declare lm-me / d4-d6 with identical values (legacy, page-scoped) — safe to
     drop in a later cleanup now that they live globally. */
  --doc-lm: oklch(0.58 0.060 55);    /* warm sand/brown */
  --doc-lm-bg: oklch(0.96 0.020 55);
  --doc-ac: oklch(0.55 0.075 330);   /* muted plum */
  --doc-ac-bg: oklch(0.96 0.025 330);
  --doc-me: oklch(0.55 0.060 130);   /* olive */
  --doc-me-bg: oklch(0.96 0.022 130);
  --doc-d4: oklch(0.54 0.075 255);   /* blue */
  --doc-d4-bg: oklch(0.96 0.022 255);
  --doc-d5: oklch(0.54 0.075 300);   /* magenta */
  --doc-d5-bg: oklch(0.96 0.022 300);
  --doc-d6: oklch(0.54 0.060 95);    /* gold */
  --doc-d6-bg: oklch(0.96 0.022 95);

  /* === Status mapping === */
  --c-confirmed: var(--sage-600);
  --c-confirmed-bg: var(--sage-50);
  --c-confirmed-border: var(--sage-200);

  --c-pending: var(--amber-700);
  --c-pending-bg: var(--amber-50);
  --c-pending-border: var(--amber-200);

  --c-inprogress: var(--teal-700);
  --c-inprogress-bg: var(--teal-50);
  --c-inprogress-border: var(--teal-500);

  --c-urgency: var(--clay-700);
  --c-urgency-bg: var(--clay-50);
  --c-urgency-border: var(--clay-200);

  --c-missed: oklch(0.62 0.008 60);
  --c-missed-bg: oklch(0.96 0.005 65);
  --c-missed-border: oklch(0.88 0.010 65);

  /* === Type === */
  --font-sans: 'Hanken Grotesk', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

  --t-2xs: 10.5px;
  --t-xs: 11.5px;
  --t-sm: 12.5px;
  --t-base: 13.5px;
  --t-md: 14.5px;
  --t-lg: 16px;
  --t-xl: 19px;
  --t-2xl: 22px;
  --t-3xl: 28px;

  /* === Radii === */
  --r-xs: 3px;
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --r-xl: 12px;

  /* === Shadows (cool-tinted to match clinical base) === */
  --shadow-xs: 0 1px 1px oklch(0.4 0.04 235 / 0.05);
  --shadow-sm: 0 1px 2px oklch(0.4 0.04 235 / 0.06), 0 1px 1px oklch(0.4 0.04 235 / 0.04);
  --shadow-md: 0 2px 4px oklch(0.4 0.04 235 / 0.06), 0 1px 2px oklch(0.4 0.04 235 / 0.04);
  --shadow-lg: 0 8px 18px oklch(0.35 0.04 235 / 0.10), 0 2px 4px oklch(0.35 0.04 235 / 0.06);
  --shadow-pop: 0 12px 32px oklch(0.30 0.04 235 / 0.12), 0 2px 6px oklch(0.30 0.04 235 / 0.07);

  /* Focus ring */
  --ring: 0 0 0 2px var(--bg-app), 0 0 0 4px oklch(0.55 0.135 230 / 0.55);

  /* Layout */
  --sidebar-w: 200px;
  --sidebar-w-collapsed: 56px;
  --topbar-h: 52px;
  --rail-w: 360px;
  --hour-h: 72px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: var(--t-base);
  color: var(--text-primary);
  background: var(--bg-app);
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

button { font-family: inherit; cursor: pointer; }

::selection { background: var(--sage-100); color: var(--text-primary); }

*:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--r-sm);
}

/* Scrollbar — warm subtle */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: oklch(0.85 0.012 235);
  border: 2px solid var(--bg-app);
  border-radius: 8px;
}
*::-webkit-scrollbar-thumb:hover { background: oklch(0.78 0.015 235); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
