/* The Radiology Desk: the one set of color tokens. Every page links this file first (app.html, index.html,
   radiologists.html, apply.html). Older names (app.css --bg/--g/--mute, home.css, radiologists.html --accent/--muted,
   Tailwind's background/primary/muted) are aliases of these, so change a color here and it changes everywhere.
   Dark mode is the .dark class on <html> (the app) or data-theme="dark" (radiologists.html).
   Each color value is written once, as a --p-* palette token below; the semantic --c-* tokens point at it.
   A see-through use takes the channel form: rgb(var(--p-mint-rgb) / .18). tests/unit/maxcss_tokens.test.ts keeps each
   -rgb channel equal to its hex, and keeps max.css free of color literals. */

/* Palette: the same in both themes. */
:root{
  /* Brand. Dark green desk at night, MAX's mint glow, brass accent. */
  --p-night:#07100a;   --p-night-rgb:7 16 10;       /* deepest green, text on mint */
  --p-ink:#0f2417;     --p-ink-rgb:15 36 23;        /* dark green panels, light mode primary */
  --p-green:#17703f;   --p-green-rgb:23 112 63;     /* brand green */
  --p-leaf:#5fd38a;    --p-leaf-rgb:95 211 138;     /* brand green on dark backgrounds */
  --p-mint:#8fe3a8;    --p-mint-rgb:143 227 168;    /* MAX glow, dark mode primary */
  --p-brass:#d1a95e;   --p-brass-rgb:209 169 94;    /* warm accent */
  --p-mist:#eef6ee;    --p-mist-rgb:238 246 238;    /* text on dark green panels */
  --p-white:#fff;      --p-white-rgb:255 255 255;
  --p-black:#000;      --p-black-rgb:0 0 0;

  /* Light and dark theme surfaces and text (the --c-* tokens below use these). */
  --p-day-bg:#f3f6f1;
  --p-day-surface:#fcfdfb;    --p-day-surface-rgb:252 253 251;
  --p-day-surface-2:#e8efe5;
  --p-day-text:#132016;       --p-day-text-rgb:19 32 22;
  --p-night-bg:#0b140e;
  --p-night-surface:#111d15;  --p-night-surface-rgb:17 29 21;
  --p-night-text:#e8f1e6;     --p-night-text-rgb:232 241 230;

  /* Status: soft backgrounds and text, for light and for dark. */
  --p-green-soft:#dcebdd;     --p-green-soft-rgb:220 235 221;
  --p-green-soft-night:#16301f;
  --p-amber:#8a5a12;          --p-amber-soft:#f5ead3;
  --p-amber-night:#e7c27a;    --p-amber-soft-night:#33280f;
  --p-red:#a3352b;            --p-red-rgb:163 53 43;          --p-red-soft:#f5dcd8;
  --p-red-night:#f0a197;      --p-red-night-rgb:240 161 151;  --p-red-soft-night:#3a1814;
  --p-gold:#c9a227;           --p-gold-light:#d9a441;         /* reference consent rule, room review note */

  /* Muted greens for secondary text: on white cards, and on dark green. */
  --p-sage:#556657;  --p-sage-deep:#3f5a46;  --p-sage-night:#a3b7a5;  --p-sage-pale:#bcd3c0;  --p-sage-mist:#b9cdbd;
  /* Pale text on dark green panels. */
  --p-mist-soft:#e9f3ea;  --p-mist-soft-rgb:233 243 234;
  --p-mist-pale:#f3f7f2;  --p-mist-glow:#f4fbf5;
  --p-mist-tray:#e8f5ec;  --p-mist-tray-rgb:232 245 236;

  /* The MAX layer: MAX himself, and the dark green panels around him. */
  --p-max-eye:#eafff0;       --p-max-eye-rgb:234 255 240;
  --p-max-shell-hi:#4fb37a;  --p-max-shell-lo:#0c2215;
  --p-max-panel:#0c1a11;     --p-max-deep:#0b1a11;       --p-max-cta-deep:#0b1a10;
  --p-max-drop-rgb:10 24 15; --p-max-tray-rgb:12 26 18;  --p-max-card-rgb:13 28 18;  --p-max-intro-rgb:10 22 16;
  --p-max-dusk:#08120c;      --p-max-dusk-2:#0d1f14;     --p-max-glow:#163a25;
  --p-max-nm:#0d2116;        --p-max-nm-glow:#123222;    --p-max-inbox:#06140d;
  --p-night-shade-rgb:7 24 14;  --p-night-shade-2-rgb:6 14 9;
  --p-green-tint:#1a6b40;    --p-green-art:#0f5a33;      --p-green-bar:#2f9e5e;
  --p-mint-line-rgb:120 220 160;  --p-mint-bright:#7fe0a6;
  --p-mint-pale:#cdf3d8;     --p-mint-pale-rgb:205 243 216;
  --p-mint-heat-rgb:74 222 128;   /* intake heat map */
  --p-brass-pale:#f3e3c2;    --p-brass-light:#e8c37e;    --p-brass-light-rgb:232 195 126;  --p-brass-deep:#c99a45;
  --p-sig-paper:#fbfaf6;     /* signature preview */

  /* Tags and kinds: stored, found, AI, workforce, flags. */
  --p-blue-soft:#e3ecf5;  --p-blue:#2b5a8a;
  --p-sky-rgb:120 190 255;  --p-sky-pale:#9fd0ff;  --p-sky-deep:#5aa7e8;
  --p-violet-soft:#efe6f5;  --p-violet:#6b3a8a;
  --p-coral-rgb:255 160 140;  --p-coral-pale:#ffb7a6;  --p-coral-red-rgb:230 110 90;
  --p-coral-tray-rgb:240 140 120;  --p-coral-tray-text:#f2a08f;

  /* Coverage map (cov.css). */
  --p-cov-c:#1f8a4c;  --p-cov-p:#59b9a0;  --p-cov-r:#a9d9b7;  --p-cov-gap-rgb:196 88 74;
  --p-cov-c-night:#24834c;  --p-cov-p-night:#2f8f84;  --p-cov-gap-night-rgb:232 120 110;

  /* App screens (app.css, readable.css, cov.css). Exact values carried over as they were; near-identical colors are
     kept apart on purpose, since merging them is a design decision. */
  --p-green-hover:#125a32;   /* solid green button, hover */
  --p-green-glow:#1d4a31;    /* top of the dark hero gradient */
  --p-green-orb:#24452f;     --p-green-orb-hi:#3b9d65;   /* avatar and orb highlights */
  --p-green-desk:#2f9e5b;    /* desk hours on the calendar */
  --p-night-side:#060d08;    /* sidebar, dark */
  --p-red-line:#e6c4c0;      /* danger button border */
  --p-mint-label:#e9f6ec;    /* coverage bar label */
  --p-gold-stripe:#c99a3c;   /* agreement month stripe */
  --p-amber-await:#a8742a;   --p-amber-await-night:#e3bf79;   /* calendar day awaiting, light and dark */

  /* Preview and review panels (index.css .pv-*), and the deal room (room.css). */
  --p-emerald:#2fbf71;       --p-emerald-rgb:47 191 113;
  --p-emerald-pale:#5fe09b;  --p-emerald-ink:#04140b;
  --p-red-pale:#f08a8a;      /* preview error text */
  --p-room-ink:#06120a;      --p-room-ink-2:#06120b;     --p-room-badge:#0a140d;
  --p-room-sage:#5f7a66;
  --p-room-red:#e0675c;      --p-room-red-rgb:224 103 92;
  --p-mint-bright-rgb:127 224 166;
  --p-jade-rgb:62 207 142;   --p-green-mark-rgb:80 200 120;

  /* SVG marks and color data in components (kit.tsx logo, BuildMap.tsx status, Rad.tsx contract hues). */
  --p-logo-hi:#6fd498;       --p-logo-lo:#0a1c10;        --p-logo-eye:#effff3;
  --p-map-test:#7ec8e3;      --p-map-open:#c9d4cb;       --p-map-parked:#9a8f7a;  --p-map-denied:#e08a7e;
  --p-hue-sky:#7cc4e8;       --p-hue-violet:#c79be8;     --p-hue-coral:#e89a8f;

  /* Light-theme values of the overlay and coverage-map tokens; the dark values are in the .dark block below. They sit on
     :root only, not on .light, as they did in index.css and cov.css, so a .light island keeps the page's values. */
  --button-outline:rgb(var(--p-black-rgb) / .1);
  --badge-outline:rgb(var(--p-black-rgb) / .05);
  --elevate-1:rgb(var(--p-black-rgb) / .03);
  --elevate-2:rgb(var(--p-black-rgb) / .08);
  --cv-c:var(--p-cov-c);  --cv-p:var(--p-cov-p);  --cv-r:var(--p-cov-r);  --cv-o:rgb(var(--p-ink-rgb) / .07);  --cv-gap:rgb(var(--p-cov-gap-rgb) / .35);
}

/* Semantic: what a color is for. Light first, dark below. A .light or .dark element is an island that resolves its own
   values whatever the page theme: the MAX panel is a .dark island, and the white cards inside it are .light islands. */
:root,.light{
  --c-bg:var(--p-day-bg);
  --c-surface:var(--p-day-surface);
  --c-surface-2:var(--p-day-surface-2);
  --c-line:#d3ddcf;
  --c-text:var(--p-day-text);
  --c-text-muted:#46564a;
  --c-text-faint:#5b6a58;   /* 4.6:1 or better on every light surface, brand-soft included (R-102) */
  --c-brand:var(--p-green);
  --c-brand-soft:var(--p-green-soft);
  --c-primary:var(--p-ink);      /* solid button and selected chip */
  --c-on-primary:var(--p-white);
  --c-ok:var(--p-green);   --c-ok-bg:var(--p-green-soft);
  --c-warn:var(--p-amber); --c-warn-bg:var(--p-amber-soft);
  --c-bad:var(--p-red);    --c-bad-bg:var(--p-red-soft);
}
.dark,[data-theme=dark]{
  --c-bg:var(--p-night-bg);
  --c-surface:var(--p-night-surface);
  --c-surface-2:#17271c;
  --c-line:#243a2b;
  --c-text:var(--p-night-text);
  --c-text-muted:#b2c4b3;
  --c-text-faint:#8b9f8d;
  --c-brand:var(--p-leaf);
  --c-brand-soft:var(--p-green-soft-night);
  --c-primary:var(--p-mint);
  --c-on-primary:var(--p-night);
  --c-ok:var(--p-mint);          --c-ok-bg:var(--p-green-soft-night);
  --c-warn:var(--p-amber-night); --c-warn-bg:var(--p-amber-soft-night);
  --c-bad:var(--p-red-night);    --c-bad-bg:var(--p-red-soft-night);
  /* Overlays (shadcn buttons and badges) and the coverage map, dark. */
  --button-outline:rgb(var(--p-white-rgb) / .1);
  --badge-outline:rgb(var(--p-white-rgb) / .05);
  --elevate-1:rgb(var(--p-white-rgb) / .04);
  --elevate-2:rgb(var(--p-white-rgb) / .09);
  --cv-c:var(--p-cov-c-night);  --cv-p:var(--p-cov-p-night);  --cv-r:rgb(var(--p-mint-rgb) / .38);  --cv-o:rgb(var(--p-white-rgb) / .06);  --cv-gap:rgb(var(--p-cov-gap-night-rgb) / .38);
}
