/**
 * NorthPathOS · Agenda design tokens (#853 batch 5d)
 * Operator's CLAUDE.md hard rule: NEVER hardcode hex in module code.
 * Every color the week/day agenda grid needs lives HERE as a --agenda-*
 * custom property. Agenda component CSS (the grid/card renderer, added in
 * a later batch) must reference only var(--agenda-*) -- no hex literals --
 * same convention as lib/tokens.css for the base palette.
 *
 * SCOPING (matches the existing convention -- see lib/tokens.css's :root,
 * lib/components.css's body[data-theme="dark"] block, and
 * lib/themes/premium.css's body[data-theme="premium"] block):
 *   - Grid / line / shading / card / status tokens are scoped per theme via
 *     body[data-theme="light|dark|premium"] (light lives at :root, the
 *     theme-agnostic default, exactly like tokens.css's base palette).
 *   - The agenda does NOT reuse plain page surfaces (--bg/--surface/--white/
 *     --g50 etc.) -- every value below is deliberately offset from the page
 *     background/card colors in every theme so the calendar reads as its
 *     own surface, not a copy of the dashboard chrome. Reference values as
 *     of this batch: light page bg #f9fafb (--g50) / card #fff (--white);
 *     dark page bg #020810 / surface #0d1829 / surface-2 #142540
 *     (lib/components.css body[data-theme="dark"]); premium page bg #131e36
 *     / surface #1c2848 / surface-2 #243358 (lib/themes/premium.css). None
 *     of those hex values are reused verbatim below.
 *   - Doctor-palette tokens (12 curated keys) are DELIBERATELY NOT scoped by
 *     body[data-theme] -- they're defined once at :root with an explicit
 *     "--light/--dark/--premium" suffix so lib/agenda-theme.js's
 *     doctorColor(key, theme) can resolve any theme's swatch on demand
 *     (needed for the Configuracion > Agenda settings preview, which shows
 *     a doctor's color across all 3 themes side by side without flipping
 *     body[data-theme]). The live grid/settings code should always call
 *     doctorColor(key, NPOS.tenant.theme()) rather than hand-rolling a var()
 *     name, so the current theme is explicit, not cascade-implied.
 *
 * #853 batch 5c QAQC HIGH fix (2026-09-25): the 12 key names are now the
 * DB's own canonical English set (migration 0144's agenda_color_keys() --
 * see supabase/migrations/20260925063348_0144_..._settings.sql) -- slate,
 * red, orange, amber, lime, emerald, teal, cyan, blue, violet, fuchsia,
 * rose -- instead of the old Spanish set that batch 5d shipped with no
 * relation to the DB's CHECK-constrained values. Every key's hue actually
 * matches its name (red ~0deg, orange ~30deg, amber ~50deg, lime ~90deg,
 * emerald ~150deg, teal ~175deg, cyan ~195deg, blue ~220deg, violet
 * ~260deg, fuchsia ~295deg, rose ~335deg; slate ~215deg desaturated to
 * ~11-16% S, a genuine blue-grey neutral). Minimum pairwise hue distance
 * among the 11 CHROMATIC keys is >=20deg (tests/agenda-tokens.test.mjs
 * enforces this). slate sits only ~11deg from blue in hue (Tailwind's own
 * slate-500 is ~215deg too) -- it reads as distinct because of saturation
 * (~11-16% vs ~55-62% for the chromatic keys), not hue, so the test's
 * minimum-hue-distance check is explicitly LOWERED to 5deg for any pair
 * that includes slate (see MIN_HUE_DISTANCE_SLATE in that test file) --
 * every other pair still enforces the 20deg minimum. Every strip/tag-bg/
 * tag-text below was generated by holding hue+saturation fixed per key/
 * theme and solving for the lightness that clears WCAG AA 4.5:1 tag-text-
 * on-tag-bg (same method as lib/agenda-theme.js's own _ensureAAText, run
 * once at build time here rather than at runtime) -- every key clears at
 * least 6.3:1 in every theme, well above the 4.5:1 floor.
 *
 * doctorColor(unknownKey, theme) (lib/agenda-theme.js) no longer silently
 * aliases an unrecognized key to the first curated key -- it now returns
 * this file's own --agenda-doctor-unassigned-* tokens (pure, 0%-saturation
 * neutral grey, deliberately distinct from slate's desaturated blue-grey)
 * so a bad/legacy color_key value renders as a visibly neutral "no color
 * assigned" swatch instead of masquerading as a real doctor's color.
 *
 * PREMIUM CUSTOM ACCENT (#620 reuse -- see lib/tenant.js's
 * _deriveAccentShades()/_applyAccentFromState()): premium's --agenda-accent*
 * tokens below reference var(--gold)/var(--gold-bright)/var(--gold-soft),
 * the SAME custom properties tenant.js already derives (safe HSL
 * hue/saturation-preserving, lightness-clamped) and paints onto
 * body[data-theme="premium"] for BOTH the 4 curated preset accents (via
 * lib/themes/premium.css's body[data-theme="premium"][data-theme-accent="..."]
 * blocks) and a tenant's own custom brand hex (via tenant.js's inline
 * body.style.setProperty, which wins the cascade over any attribute-selector
 * rule). This file invents NO new hex-from-brand-color math -- it only
 * points agenda tokens at the vars tenant.js already maintains. The one
 * thing CSS alone cannot guarantee is a WCAG AA text pairing for an
 * ARBITRARY customer hex (tenant.js's own clamp targets legibility against
 * the FIXED premium chrome, not the agenda's own card surfaces) -- that
 * additional guarantee is applied at runtime by
 * lib/agenda-theme.js's applyCustomAccent(), which sets --agenda-accent-text
 * as an inline override (see that file for the contrast-safety-net method).
 */

:root {
  /* ── Light agenda surface (default theme) ────────────────────────────── */
  --agenda-grid-bg: #f3f5fa;
  --agenda-grid-border: #dfe3ee;
  --agenda-hour-line: #d7dbe6;
  --agenda-halfhour-line: #e8eaf1;
  --agenda-offhours-bg: #eceef4;
  --agenda-blocked-bg: #f3e9e9;
  --agenda-blocked-stripe: #e6cccc;
  --agenda-today-tint: rgba(26, 86, 219, 0.07);
  --agenda-now-line: #e5484d;

  --agenda-card-presencial-bg: #d9e3f2;
  --agenda-card-presencial-border: #90add5;
  --agenda-card-presencial-text: #153765;

  --agenda-card-teleconsulta-bg: #e8d9f2;
  --agenda-card-teleconsulta-border: #b890d5;
  --agenda-card-teleconsulta-text: #441565;

  --agenda-card-cancelled-bg: #ebebeb;
  --agenda-card-cancelled-border: #bfbfbf;
  --agenda-card-cancelled-text: #4d4d4d;

  --agenda-status-confirmed: #16a34a;
  --agenda-status-scheduled: #1a56db;
  --agenda-status-no-show: #dc2626;
  --agenda-status-completed: #6b7280;

  /* Non-premium themes have no tenant-custom brand color -- these are
     fixed, tuned defaults (blue), never overridden at runtime. */
  --agenda-accent: #1a56db;
  --agenda-accent-bright: #1a56db;
  --agenda-accent-soft: rgba(26, 86, 219, 0.1);
  --agenda-accent-text: #153765;

  /* -- Doctor palette (12 curated keys + unassigned fallback), theme-suffixed, :root-scoped -- see file header for the generation method -- */

  /* -- light -- */
  --agenda-doctor-slate-strip--light: #5a697c;
  --agenda-doctor-slate-tag-bg--light: #e4e8ec;
  --agenda-doctor-slate-tag-text--light: #2f3946;
  --agenda-doctor-red-strip--light: #ae2929;
  --agenda-doctor-red-tag-bg--light: #f2dede;
  --agenda-doctor-red-tag-text--light: #601515;
  --agenda-doctor-orange-strip--light: #ae6729;
  --agenda-doctor-orange-tag-bg--light: #f2e7de;
  --agenda-doctor-orange-tag-text--light: #603815;
  --agenda-doctor-amber-strip--light: #ae9c29;
  --agenda-doctor-amber-tag-bg--light: #f2efde;
  --agenda-doctor-amber-tag-text--light: #605615;
  --agenda-doctor-lime-strip--light: #6bae29;
  --agenda-doctor-lime-tag-bg--light: #e8f2de;
  --agenda-doctor-lime-tag-text--light: #3b6015;
  --agenda-doctor-emerald-strip--light: #29ae6b;
  --agenda-doctor-emerald-tag-bg--light: #def2e8;
  --agenda-doctor-emerald-tag-text--light: #15603b;
  --agenda-doctor-teal-strip--light: #29aea0;
  --agenda-doctor-teal-tag-bg--light: #def2f0;
  --agenda-doctor-teal-tag-text--light: #156059;
  --agenda-doctor-cyan-strip--light: #2986ae;
  --agenda-doctor-cyan-tag-bg--light: #deecf2;
  --agenda-doctor-cyan-tag-text--light: #154a60;
  --agenda-doctor-blue-strip--light: #294cae;
  --agenda-doctor-blue-tag-bg--light: #dee4f2;
  --agenda-doctor-blue-tag-text--light: #152960;
  --agenda-doctor-violet-strip--light: #5529ae;
  --agenda-doctor-violet-tag-bg--light: #e5def2;
  --agenda-doctor-violet-tag-text--light: #2e1560;
  --agenda-doctor-fuchsia-strip--light: #a529ae;
  --agenda-doctor-fuchsia-tag-bg--light: #f0def2;
  --agenda-doctor-fuchsia-tag-text--light: #5b1560;
  --agenda-doctor-rose-strip--light: #ae2962;
  --agenda-doctor-rose-tag-bg--light: #f2dee7;
  --agenda-doctor-rose-tag-text--light: #601536;
  /* unassigned/unknown color_key fallback -- pure neutral grey, distinct from 'slate' */
  --agenda-doctor-unassigned-strip--light: #6b6b6b;
  --agenda-doctor-unassigned-tag-bg--light: #e8e8e8;
  --agenda-doctor-unassigned-tag-text--light: #3b3b3b;

  /* -- dark -- */
  --agenda-doctor-slate-strip--dark: #8d98a5;
  --agenda-doctor-slate-tag-bg--dark: #2a3037;
  --agenda-doctor-slate-tag-text--dark: #d1d6db;
  --agenda-doctor-red-strip--dark: #d45e5e;
  --agenda-doctor-red-tag-bg--dark: #421f1f;
  --agenda-doctor-red-tag-text--dark: #edc0c0;
  --agenda-doctor-orange-strip--dark: #d4955e;
  --agenda-doctor-orange-tag-bg--dark: #422f1f;
  --agenda-doctor-orange-tag-text--dark: #edd5c0;
  --agenda-doctor-amber-strip--dark: #d4c45e;
  --agenda-doctor-amber-tag-bg--dark: #423d1f;
  --agenda-doctor-amber-tag-text--dark: #ede7c0;
  --agenda-doctor-lime-strip--dark: #99d45e;
  --agenda-doctor-lime-tag-bg--dark: #30421f;
  --agenda-doctor-lime-tag-text--dark: #d6edc0;
  --agenda-doctor-emerald-strip--dark: #5ed499;
  --agenda-doctor-emerald-tag-bg--dark: #1f4230;
  --agenda-doctor-emerald-tag-text--dark: #c0edd6;
  --agenda-doctor-teal-strip--dark: #5ed4c8;
  --agenda-doctor-teal-tag-bg--dark: #1f423e;
  --agenda-doctor-teal-tag-text--dark: #c0ede8;
  --agenda-doctor-cyan-strip--dark: #5eb1d4;
  --agenda-doctor-cyan-tag-bg--dark: #1f3742;
  --agenda-doctor-cyan-tag-text--dark: #c0dfed;
  --agenda-doctor-blue-strip--dark: #5e7dd4;
  --agenda-doctor-blue-tag-bg--dark: #1f2842;
  --agenda-doctor-blue-tag-text--dark: #c0cced;
  --agenda-doctor-violet-strip--dark: #855ed4;
  --agenda-doctor-violet-tag-bg--dark: #2b1f42;
  --agenda-doctor-violet-tag-text--dark: #cfc0ed;
  --agenda-doctor-fuchsia-strip--dark: #cc5ed4;
  --agenda-doctor-fuchsia-tag-bg--dark: #401f42;
  --agenda-doctor-fuchsia-tag-text--dark: #eac0ed;
  --agenda-doctor-rose-strip--dark: #d45e91;
  --agenda-doctor-rose-tag-bg--dark: #421f2e;
  --agenda-doctor-rose-tag-text--dark: #edc0d3;
  /* unassigned/unknown color_key fallback -- pure neutral grey, distinct from 'slate' */
  --agenda-doctor-unassigned-strip--dark: #999999;
  --agenda-doctor-unassigned-tag-bg--dark: #303030;
  --agenda-doctor-unassigned-tag-text--dark: #d6d6d6;

  /* -- premium -- */
  --agenda-doctor-slate-strip--premium: #919aa6;
  --agenda-doctor-slate-tag-bg--premium: #282d34;
  --agenda-doctor-slate-tag-text--premium: #d2d6db;
  --agenda-doctor-red-strip--premium: #d36464;
  --agenda-doctor-red-tag-bg--premium: #3e1e1e;
  --agenda-doctor-red-tag-text--premium: #ecc1c1;
  --agenda-doctor-orange-strip--premium: #d39864;
  --agenda-doctor-orange-tag-bg--premium: #3e2d1e;
  --agenda-doctor-orange-tag-text--premium: #ecd5c1;
  --agenda-doctor-amber-strip--premium: #d3c464;
  --agenda-doctor-amber-tag-bg--premium: #3e391e;
  --agenda-doctor-amber-tag-text--premium: #ece6c1;
  --agenda-doctor-lime-strip--premium: #9cd364;
  --agenda-doctor-lime-tag-bg--premium: #2e3e1e;
  --agenda-doctor-lime-tag-text--premium: #d6ecc1;
  --agenda-doctor-emerald-strip--premium: #64d39c;
  --agenda-doctor-emerald-tag-bg--premium: #1e3e2e;
  --agenda-doctor-emerald-tag-text--premium: #c1ecd6;
  --agenda-doctor-teal-strip--premium: #64d3c8;
  --agenda-doctor-teal-tag-bg--premium: #1e3e3a;
  --agenda-doctor-teal-tag-text--premium: #c1ece7;
  --agenda-doctor-cyan-strip--premium: #64b2d3;
  --agenda-doctor-cyan-tag-bg--premium: #1e343e;
  --agenda-doctor-cyan-tag-text--premium: #c1dfec;
  --agenda-doctor-blue-strip--premium: #6482d3;
  --agenda-doctor-blue-tag-bg--premium: #1e273e;
  --agenda-doctor-blue-tag-text--premium: #c1ccec;
  --agenda-doctor-violet-strip--premium: #8964d3;
  --agenda-doctor-violet-tag-bg--premium: #291e3e;
  --agenda-doctor-violet-tag-text--premium: #cfc1ec;
  --agenda-doctor-fuchsia-strip--premium: #cc64d3;
  --agenda-doctor-fuchsia-tag-bg--premium: #3b1e3e;
  --agenda-doctor-fuchsia-tag-text--premium: #e9c1ec;
  --agenda-doctor-rose-strip--premium: #d36494;
  --agenda-doctor-rose-tag-bg--premium: #3e1e2c;
  --agenda-doctor-rose-tag-text--premium: #ecc1d3;
  /* unassigned/unknown color_key fallback -- pure neutral grey, distinct from 'slate' */
  --agenda-doctor-unassigned-strip--premium: #9c9c9c;
  --agenda-doctor-unassigned-tag-bg--premium: #2e2e2e;
  --agenda-doctor-unassigned-tag-text--premium: #d6d6d6;
}

/* ── Dark agenda surface ────────────────────────────────────────────────── */
body[data-theme="dark"] {
  --agenda-grid-bg: #0b1522;
  --agenda-grid-border: #1c2c42;
  --agenda-hour-line: #223349;
  --agenda-halfhour-line: #172536;
  --agenda-offhours-bg: #0e1a29;
  --agenda-blocked-bg: #2a1b1b;
  --agenda-blocked-stripe: #3a2424;
  --agenda-today-tint: rgba(59, 130, 246, 0.1);
  --agenda-now-line: #ff6b6b;

  --agenda-card-presencial-bg: #1d2d44;
  --agenda-card-presencial-border: #385e94;
  --agenda-card-presencial-text: #b8cdea;

  --agenda-card-teleconsulta-bg: #341d44;
  --agenda-card-teleconsulta-border: #6e3894;
  --agenda-card-teleconsulta-text: #d5b8ea;

  --agenda-card-cancelled-bg: #292929;
  --agenda-card-cancelled-border: #4d4d4d;
  --agenda-card-cancelled-text: #b8b8b8;

  --agenda-status-confirmed: #34d399;
  --agenda-status-scheduled: #60a5fa;
  --agenda-status-no-show: #f87171;
  --agenda-status-completed: #94a3b8;

  --agenda-accent: #60a5fa;
  --agenda-accent-bright: #60a5fa;
  --agenda-accent-soft: rgba(96, 165, 250, 0.14);
  --agenda-accent-text: #b8cdea;
}

/* ── Premium agenda surface ─────────────────────────────────────────────── */
body[data-theme="premium"] {
  --agenda-grid-bg: #16213f;
  --agenda-grid-border: #2a3c66;
  --agenda-hour-line: #33456e;
  --agenda-halfhour-line: #202e4d;
  --agenda-offhours-bg: #182742;
  --agenda-blocked-bg: #3a2a1f;
  --agenda-blocked-stripe: #4a3527;
  /* Today tint rides the same tenant-managed accent as the rest of premium
     chrome (see file header) -- glows in the tenant's own brand color. */
  --agenda-today-tint: var(--gold-soft);
  --agenda-now-line: #ff8a5b;

  --agenda-card-presencial-bg: #3e361d;
  --agenda-card-presencial-border: #947d38;
  --agenda-card-presencial-text: #ebe0c2;

  --agenda-card-teleconsulta-bg: #311d3e;
  --agenda-card-teleconsulta-border: #6e3894;
  --agenda-card-teleconsulta-text: #dac2eb;

  --agenda-card-cancelled-bg: #2d2925;
  --agenda-card-cancelled-border: #544e45;
  --agenda-card-cancelled-text: #bfb9b0;

  --agenda-status-confirmed: #4ade80;
  --agenda-status-scheduled: #7fa8e8;
  --agenda-status-no-show: #ff6b6b;
  --agenda-status-completed: #b0a78f;

  /* Reused, not re-derived: var(--gold)/var(--gold-bright)/var(--gold-soft)
     are tenant.js's own #620 safe-derivation output (curated preset OR the
     tenant's custom hex, whichever is live) -- see file header. --agenda-
     accent-text starts as the same reused value; lib/agenda-theme.js's
     applyCustomAccent() may override it inline with a contrast-guaranteed
     variant for the custom-hex case only (inline style wins the cascade). */
  --agenda-accent: var(--gold);
  --agenda-accent-bright: var(--gold-bright);
  --agenda-accent-soft: var(--gold-soft);
  --agenda-accent-text: var(--gold-bright);
}
