/* Tenant themes. Each institution gets an accent swap only — the semantic
   alias layer absorbs it, so no component CSS changes. Apply on <html> as
   data-theme="…" and optionally data-mode="dark".

   DOCUMENT-LEVEL ONLY. These scopes are deliberately :root-prefixed. A nested
   scope cannot work here: the semantic aliases below (--text-color-main:
   var(--black) and friends) are declared on :root, so var() substitution
   happens THERE and descendants inherit the already-resolved literal.
   Re-mapping a primitive further down the tree cannot reach an alias that was
   already substituted, so a nested [data-mode=dark] flips backgrounds while
   leaving text at its light-mode colour — dark-on-dark. Supporting a nested
   dark region would mean re-declaring the whole alias layer inside each scope;
   until that is done, set data-mode on <html>.
   data-theme=pharma is the Amspensan default and equals :root.
   Hover shades follow the source's HSV value shift (-8 for solids, -4 for washes). */

:root[data-theme=pharma]{
  --theme-color:var(--pharma-blue);
  --primary-color:var(--pharma-blue);
  --primary-color-hover:var(--pharma-blue-hover);
  --primary-color-rgb:var(--rgb-pharma-blue);
  --menu-selected-color:var(--pharma-blue-light);
  --menu-selected-color-hover:var(--pharma-blue-light-hover);
  --background-color-body:var(--pharma-blue-lighter);
}

:root[data-theme=red]{
  /* --theme-color is a FILL (badges, .label-theme) carrying white text, so it
     takes the accessible crimson: #EF3340 is 4.02:1 with white, #E71221 is 4.66. */
  --theme-color:var(--crimson-blaze-accessible);
  /* Crimson as ink on white is 4.02:1. */
  --accent-ink:#E71221;
  --primary-color:var(--black);
  --primary-color-hover:var(--black-hover);
  --primary-color-rgb:var(--rgb-black);
  --secondary-color:var(--crimson-blaze-accessible);
  --secondary-color-hover:#C90E1C;
  --menu-selected-color:var(--whispering-blush);
  --menu-selected-color-hover:var(--whispering-blush-hover);
  --background-color-body:var(--cotton-cloud);
}

:root[data-theme=blue]{
  --theme-color:var(--success-blue);
  /* --crimson-blaze is 4.02:1 with white on the tertiary fill. */
  --secondary-color:var(--crimson-blaze-accessible);
  --secondary-color-hover:#C90E1C;
  --text-color-main:var(--midnight-charcoal);
  /* --grey-dark-bluish #7D85AB is 3.61:1 on white. This theme's page is a
     gradient down to #E9EBFF, so the ink is measured against that stop:
     4.60:1 there, 5.42:1 on white. */
  --text-color-subdued:#5E6892;
  --background-color-body:var(--success-blue-light-gradient);
  --menu-selected-color:var(--success-blue-light);
  --menu-selected-color-hover:var(--success-blue-light-hover);
  --primary-color:var(--success-blue);
  --primary-color-hover:var(--success-blue-hover);
  --primary-color-rgb:var(--rgb-success-blue);
  /* --rose-pink-dark #E653A8 is 3.41:1 with white; this is 4.53:1. */
  --danger-color:#DC208D;
  --danger-color-hover:#CA1D82;
  --color-grey-dark:var(--grey-dark-bluish);
  --color-grey-medium:var(--grey-medium-bluish);
  --color-grey-light:var(--grey-light-bluish);
}

:root[data-theme=green]{
  --theme-color:#A4B465;
  --primary-color:#A4B465;
  /* White on #A4B465 is 2.26:1. Dark ink is 7.13:1. */
  --primary-ink:var(--text-color-main);
  /* #A4B465 as ink on white is 2.26:1. */
  --accent-ink:#6F7C3C;
  --primary-color-hover:#93a15a;
  --primary-color-rgb:var(--rgb-olive-green);
  --menu-selected-color:#f4f9db;
  --menu-selected-color-hover:#ebf0d3;
  --background-color-body:#f7f9ed;
}

:root[data-theme=purple]{
  --font-family-default:var(--font-family-helvetica);
  /* --grey-dark is 4.11:1 on this theme's #f2e9ef page. */
  --text-color-subdued:#696969;
  --theme-color:#53354A;
  --primary-color:#53354A;
  --primary-color-hover:#452c3e;
  --primary-color-rgb:83,53,74;
  --menu-selected-color:#dbd0d8;
  --menu-selected-color-hover:#d2c6cf;
  --background-color-body:#f2e9ef;
}

:root[data-theme=yellow]{
  --theme-color:#E8DD00;
  --primary-color:#E8DD00;
  /* White on #E8DD00 is 1.42:1 — the worst pairing in the kit. Dark ink is 11.33:1. */
  --primary-ink:var(--text-color-main);
  /* #E8DD00 as ink on white is 1.42:1. */
  --accent-ink:#7D7700;
  --primary-color-hover:#cdc400;
  --primary-color-rgb:232,221,0;
  --menu-selected-color:#fffdba;
  --menu-selected-color-hover:#f5f3b3;
  --background-color-body:linear-gradient(to bottom,#F8F8F8 0%,#FFFFFF 40%,#FFFFFF 60%,#FFFFE7 100%);
}

:root[data-theme=purple][data-mode=dark]{
  --theme-color:#c17cac;--primary-color:#c17cac;--primary-color-hover:#b169a0;--primary-color-rgb:193,124,172;
}
:root[data-theme=yellow][data-mode=dark]{
  --theme-color:#f0e740;--primary-color:#f0e740;--primary-color-hover:#d6ce39;--primary-color-rgb:240,231,64;
}

/* Dark mode: primitive re-mapping, aliases untouched. */
:root[data-mode=dark]{
  color-scheme:dark;
  /* Status ink re-measured against the dark tints (#212121 family):
     success 4.74:1, error 4.51:1, warning 10.01:1, info 5.71:1, neutral 8.57:1. */
  --status-success-ink:#249E6B;
  --status-error-ink:#F14B56;
  --status-warning-ink:#F5C702;
  --status-info-ink:#3FA3D8;
  --status-neutral-ink:#BDBDBD;
  --menu-selected-color:#212121;
  --menu-selected-color-hover:#212121;
  --background-color-body:#444444;
  --black:#FFFFFF;
  --black-hover:#E0e0e0;
  --pharma-blue:#3FA3D8;
  --pharma-blue-hover:#2B8FC4;
  --pharma-blue-light:#212121;
  --pharma-blue-light-hover:#2A2A2A;
  --pharma-blue-lighter:#444444;
  --midnight-onyx:#D8D6D2;
  --success-blue:#4da6ff;
  --success-blue-hover:#1a8cff;
  --success-blue-light:#212121;
  --midnight-charcoal:#ECECEC;
  --charcoal-blue:#D1D9FF;
  --white:#303030;
  --grey-light:#717171;
  --grey-dark:#BDBDBD;
  --grey-dark-bluish:#CED4E6;
  --grey-light-bluish:#858FB2;
  --cotton-cloud:#444444;
  --whispering-blush:#212121;
  /* Status tints. The inks above are all measured against the #212121 family,
     so every tint they sit on has to be re-mapped here — leaving one at its
     light value strands that ink on a background it is never shown on.
     --status-neutral-bg is set directly because it otherwise falls through to
     --grey-light (#717171), which is mid-grey against a mid-grey ink. */
  --mustard-yellow-light:#212121;
  --emerald-green-light:#212121;
  --status-neutral-bg:#212121;
  --cotton-ball:#444444;
  --crown-jewels:#BB7ED7;
  --ayame-iris:#975092;
  --sea-serpant-v2:#81E2E7;
  --avatar-basic:#20283D;
  --rgba-hover-light:rgba(255,255,255,0.08);
  --rgba-hover-lighter:rgba(255,255,255,0.04);
  --rgb-black:255,255,255; /* @kind color */
  --rgb-success-blue:77,166,255; /* @kind color */
  --rgb-pharma-blue:63,163,216; /* @kind color */
  --rgb-grey-light-bluish:133,143,178; /* @kind color */
  --rgb-os-bg:225,225,225;
  --vibrant-purple:#C08EFF;
  --vibrant-purple-light:#A575F9;
  --vibrant-purple-lighter:#8D5EF0;
  --horizon-blue-light:#74C2E8;
  --horizon-blue-lighter:#4EA3D6;
  --aqua-ambition-light:#70DFDF;
  --emerald-green:#30E398;
  --emerald-green-light:#94E6C3;
  --emerald-green-dark:#208D60;
  --rose-pink:#FF9ECF;
  --rose-pink-light:#F6B2D9;
  --rose-pink-dark:#D658A3;
  --rose-pink-dark-hover:#E06DB1;
  --mustard-yellow:#FFDD7A;
  --mustard-yellow-dark:#F5C702;
  --link-color:#87CEEB;
  --link-color-hover:#ADD8E6;
  --plum-purple:#c17cac;
  --token-tag:#c49fb4;
  --attribute-value:#9fc0cf;
  --token-funtion:#f593a7;
  --chart-tooltip-box-shadow:0px 2px 16px 0px rgba(0,0,0,0.5);
  --shadow-dropdown:0px 0px 1px 0px rgba(255,255,255,0.10),0px 26px 80px 0px rgba(255,255,255,0.08);
  --shadow-button:0px 1px 0px 0px rgba(255,255,255,0.05);
  --shadow-button-hover:0px 2px 16px 0px rgba(255,255,255,0.10),0px 0px 0px 1px rgba(173,216,230,0.15);
  --shadow-profile:0 0.5rem 1rem rgba(255,255,255,0.16);
  --shadow-profile-sm:0 0.125rem 0.25rem rgba(255,255,255,0.075);
  --chat-panel-right-shadow:4px 0 8px -4px rgba(255,255,255,0.1);
  --chat-panel-double-shadow:-4px 0 8px -4px rgba(255,255,255,0.1),4px 0 8px -4px rgba(255,255,255,0.1);
}
