/* Status: PROTOTYPE (not production code; see Prototypes/shared/README.md)
   SMART EMIS shared theme of every prototype (GOV-R147, on the ui-ux-pro-max skill: references/theme.css).
   THE ONE PLACE OF THE COLOURS. The palette of a page is chosen by <html data-hue="...">, the mode by <html class="dark">;
   both are set by emis-theme.js, which also holds the hue of each module. Colours are "R G B" triplets so that
   Tailwind opacity modifiers work: bg-brand-600/20. Presentation only: no field, status code, rule or approval step here. */
/* GOV-R322-A (CR-723, gap G-03): three tiers of tokens. This file holds TIER 1, the primitive tokens (the colour ramps: --brand-50..950 per
   hue, --accent-*), and TIER 2, the semantic tokens (meanings: canvas, surfaces, ink, borders, navigation, elevation, and the GOV-R329-A
   meanings below), with the Tailwind mapping of the screens. TIER 3, the component tokens, is in emis-tokens.css. Nothing was moved or
   re-valued here: the headings only group what was already written. */

/* ===== TIER 1 — primitive tokens: the brand ramp of each hue (GOV-R322-A) ===== */
:root, [data-hue="indigo"] {
  --brand-50: 238 242 255; --brand-100: 224 231 255; --brand-200: 199 210 254; --brand-300: 165 180 252;
  --brand-400: 129 140 248; --brand-500: 99 102 241; --brand-600: 79 70 229; --brand-700: 67 56 202;
  --brand-800: 55 48 163; --brand-900: 49 46 129; --brand-950: 30 27 75;
  --grad-brand: linear-gradient(135deg, #4338CA 0%, #4F46E5 50%, #7C3AED 100%);
}
:root {
  /* TIER 1 — primitive (GOV-R322-A): the accent ramp, the primitive of the secondary colour (--secondary reads it, GOV-R329-A) */
  /* Accent: Lagoon Teal */
  --accent-50: 240 253 250; --accent-100: 204 251 241; --accent-300: 94 234 212;
  --accent-500: 20 184 166; --accent-600: 13 148 136; --accent-700: 15 118 110;

  /* TIER 2 — semantic (GOV-R322-A): the meanings below, from here to the end of this block */
  /* Neutrals */
  --canvas: 246 248 251; --surface: 255 255 255; --surface-2: 248 250 252;
  --border: 229 233 240; --border-strong: 203 213 225;
  --ink: 15 23 42; --ink-2: 51 65 85; --ink-muted: 94 109 131; --ink-faint: 148 163 184;
  --line: rgb(var(--border));
  --control-border: 128 142 163;   /* GOV-R217-A: the border of a field, 3.3:1 on white */

  /* Navigation (always dark) */
  --nav-from: 15 23 42; --nav-to: 17 28 58; --nav-ink: 203 213 225;
  /* GOV-R276-A (CR-702): text and marks drawn on the brand gradient, the hero band or the dark navigation; white in light and dark */
  --on-brand: 255 255 255;

  /* A page uses --grad-hero where the band needs its own stops; by default it is the brand gradient */
  --grad-hero: var(--grad-brand);

  /* Elevation */
  --shadow-1: 0 0 0 1px rgba(16,24,40,.02), 0 1px 2px rgba(16,24,40,.05);
  --shadow-2: 0 0 0 1px rgba(16,24,40,.03), 0 1px 2px rgba(16,24,40,.06), 0 14px 30px -12px rgba(16,24,40,.16);
  --shadow-3: 0 24px 48px -12px rgba(16,24,40,.25);
  --shadow-glow: 0 6px 16px -4px rgb(var(--brand-600) / .45);

  --font-sans: 'Inter', system-ui, sans-serif;
  color-scheme: light;
}

/* ===== TIER 2 — semantic tokens added by GOV-R329-A (CR-723, gap G-10) =====
   Each equals what the screens draw today, so nothing changes until a theme sets it; no existing rule reads them yet. Declared on :root
   and on every [data-hue] element (a menu tile, a palette swatch or an enterprise card carries its own hue), so a token that reads the
   brand ramp resolves against the local ramp, as the rules it will replace do. The dark values follow through the neutrals; only
   --selection has its own dark value (below the dark block).
   --secondary    the accent ramp (--accent-600), unused by the screens today
   --focus-ring   brand-500: the focus colour of emis-shell.css (:focus-visible) and of this file (.emis-theme-btn)
   --selection    the chosen item of the shell menus (.es-item.on, .es-am.cur): brand-50; dark brand-500 at .16
   --hover        the row and button under the pointer (.es-btn:hover, .es-item:hover): surface-2
   --disabled-bg  a disabled field (emis-picker.css .ep-in:disabled; the builder's «muted» disabled look): surface-2
   --disabled-ink the text of a disabled control (emis-input.css .emin-cal:disabled; the builder's «muted» look): ink-faint
   --field-invalid the border of an invalid field (emis-input.css .emin-field[aria-invalid]): 225 29 72, the --bad of emis-tokens.css
   --field-valid  no screen draws a valid state today: 5 150 105, the --ok of emis-tokens.css
   --header-bg    the home bar (emis-shell.css #es-bar)
   --sidebar-bg   the side menu (emis-shell.css #es-side) */
:root, [data-hue] {
  --secondary: var(--accent-600);
  --focus-ring: var(--brand-500);
  --selection: rgb(var(--brand-50));
  --hover: rgb(var(--surface-2));
  --disabled-bg: rgb(var(--surface-2));
  --disabled-ink: rgb(var(--ink-faint));
  --field-invalid: 225 29 72;
  --field-valid: 5 150 105;
  --header-bg: linear-gradient(135deg, rgb(var(--brand-600)) 0%, rgb(var(--brand-700)) 55%, rgb(var(--brand-900)) 100%);
  --sidebar-bg: linear-gradient(180deg, rgb(var(--nav-from)) 0%, rgb(var(--nav-to)) 100%);
}

[dir="rtl"] { --font-sans: 'IBM Plex Sans Arabic', 'Cairo', system-ui, sans-serif; }

/* ===== TIER 1 — primitive tokens: the brand ramps of the other hues (GOV-R322-A) ===== */
/* Palettes */
[data-hue="emerald"] {
  --brand-50: 236 253 245; --brand-100: 209 250 229; --brand-200: 167 243 208; --brand-300: 110 231 183;
  --brand-400: 52 211 153; --brand-500: 16 185 129; --brand-600: 4 134 96; --brand-700: 4 120 87;
  --brand-800: 6 95 70; --brand-900: 6 78 59; --brand-950: 2 44 34;
  --grad-brand: linear-gradient(135deg, #059669 0%, #0D9488 55%, #0EA5E9 100%);
  /* Payroll hero: darker stops keep white text at 4.5:1 or more (CR-271) */
  --grad-hero: linear-gradient(135deg, #047857 0%, #0F766E 55%, #0369A1 100%);
}
[data-hue="violet"] {
  --brand-50: 245 243 255; --brand-100: 237 233 254; --brand-200: 221 214 254; --brand-300: 196 181 253;
  --brand-400: 167 139 250; --brand-500: 139 92 246; --brand-600: 124 58 237; --brand-700: 109 40 217;
  --brand-800: 91 33 182; --brand-900: 76 29 149; --brand-950: 46 16 101;
  --grad-brand: linear-gradient(135deg, #7C3AED 0%, #C026D3 55%, #4F46E5 100%);
}
[data-hue="sky"] {
  --brand-50: 240 249 255; --brand-100: 224 242 254; --brand-200: 186 230 253; --brand-300: 125 211 252;
  --brand-400: 56 189 248; --brand-500: 14 165 233; --brand-600: 2 124 188; --brand-700: 3 105 161;
  --brand-800: 7 89 133; --brand-900: 12 74 110; --brand-950: 8 47 73;
  --grad-brand: linear-gradient(135deg, #0284C7 0%, #4F46E5 55%, #14B8A6 100%);
}
[data-hue="teal"] {
  --brand-50: 240 253 250; --brand-100: 204 251 241; --brand-200: 153 246 228; --brand-300: 94 234 212;
  --brand-400: 45 212 191; --brand-500: 20 184 166; --brand-600: 14 132 122; --brand-700: 15 118 110;
  --brand-800: 17 94 89; --brand-900: 19 78 74; --brand-950: 4 47 46;
  --grad-brand: linear-gradient(135deg, #0D9488 0%, #0284C7 55%, #4F46E5 100%);
}
[data-hue="amber"] {
  --brand-50: 255 251 235; --brand-100: 254 243 199; --brand-200: 253 230 138; --brand-300: 252 211 77;
  --brand-400: 251 191 36; --brand-500: 245 158 11; --brand-600: 180 83 9; --brand-700: 146 64 14;
  --brand-800: 120 53 15; --brand-900: 99 45 14; --brand-950: 69 26 3;
  --grad-brand: linear-gradient(135deg, #B45309 0%, #D97706 55%, #E11D48 100%);
}
[data-hue="rose"] {
  --brand-50: 255 241 242; --brand-100: 255 228 230; --brand-200: 254 205 211; --brand-300: 253 164 175;
  --brand-400: 251 113 133; --brand-500: 244 63 94; --brand-600: 190 18 60; --brand-700: 159 18 57;
  --brand-800: 136 19 55; --brand-900: 76 5 25; --brand-950: 59 4 20;
  --grad-brand: linear-gradient(135deg, #881337 0%, #BE123C 55%, #DB2777 100%);
}
[data-hue="cyan"] {
  --brand-50: 236 254 255; --brand-100: 207 250 254; --brand-200: 165 243 252; --brand-300: 103 232 249;
  --brand-400: 34 211 238; --brand-500: 6 182 212; --brand-600: 11 128 158; --brand-700: 14 116 144;
  --brand-800: 21 94 117; --brand-900: 22 78 99; --brand-950: 8 51 68;
  --grad-brand: linear-gradient(135deg, #0E7490 0%, #0891B2 55%, #6366F1 100%);
}
[data-hue="slate"] {
  --brand-50: 241 245 249; --brand-100: 226 232 240; --brand-200: 203 213 225; --brand-300: 148 163 184;
  --brand-400: 100 116 139; --brand-500: 71 85 105; --brand-600: 71 85 105; --brand-700: 51 65 85;
  --brand-800: 30 41 59; --brand-900: 15 23 42; --brand-950: 2 6 23;
  --grad-brand: linear-gradient(135deg, #334155 0%, #4F46E5 55%, #0EA5E9 100%);
}

/* ===== TIER 2 — semantic tokens, dark mode (GOV-R322-A) ===== */
/* Dark mode: tokens */
.dark {
  --canvas: 11 16 32; --surface: 17 24 39; --surface-2: 26 34 52;
  --border: 36 48 71; --border-strong: 51 65 85;
  --ink: 230 234 242; --ink-2: 203 213 225; --ink-muted: 148 163 184; --ink-faint: 100 116 139;
  --control-border: 100 116 139;
  --nav-from: 8 12 26; --nav-to: 13 20 40;
  --shadow-1: 0 1px 2px rgba(0,0,0,.4);
  --shadow-2: 0 8px 24px -6px rgba(0,0,0,.5);
  --shadow-3: 0 24px 48px -12px rgba(0,0,0,.6);
  color-scheme: dark;
}
/* GOV-R329-A (CR-723): the dark value of --selection (.dark .es-item.on, .dark .es-am.cur of emis-shell.css); the other GOV-R329-A tokens
   keep their expression and take the dark neutrals */
.dark, .dark [data-hue] { --selection: rgb(var(--brand-500) / .16); }

/* ===== The Tailwind mapping: the Tailwind classes of the screens read the semantic tokens (GOV-R322-A; unchanged) ===== */
/* Dark mode: the Tailwind classes of the screens. The hero band keeps its gradient and its own text colours in both modes. */
.dark :is(.bg-white,.focus\:bg-white:focus,.hover\:bg-white:hover):not(.page-hero *) { background-color: rgb(var(--surface)); }
.dark :is(.bg-white\/95):not(.page-hero *) { background-color: rgb(var(--surface) / .95); }
.dark :is(.bg-slate-50,.bg-gray-50,.hover\:bg-slate-50:hover):not(.page-hero *) { background-color: rgb(var(--surface-2)); }
.dark :is(.bg-slate-50\/50,.bg-slate-50\/60,.bg-slate-50\/70,.bg-slate-50\/80,.hover\:bg-slate-50\/70:hover):not(.page-hero *) { background-color: rgb(var(--surface-2) / .7); }
.dark :is(.bg-slate-100,.bg-gray-100,.hover\:bg-slate-100:hover):not(.page-hero *) { background-color: rgb(var(--border) / .75); }
.dark :is(.bg-slate-200,.hover\:bg-slate-200:hover,.hover\:bg-slate-200\/60:hover):not(.page-hero *) { background-color: rgb(var(--border-strong)); }
.dark :is(.to-slate-50):not(.page-hero *) { --tw-gradient-to: rgb(var(--surface-2)) var(--tw-gradient-to-position); }
.dark :is(.text-slate-900,.text-slate-800,.hover\:text-slate-900:hover,.hover\:text-slate-800:hover):not(.page-hero *) { color: rgb(var(--ink)); }
.dark :is(.text-slate-700,.text-slate-600,.hover\:text-slate-700:hover,.hover\:text-slate-600:hover):not(.page-hero *) { color: rgb(var(--ink-2)); }
.dark :is(.text-slate-500,.text-slate-400):not(.page-hero *) { color: rgb(var(--ink-muted)); }
.dark :is(.border-slate-50,.border-slate-100,.border-slate-200,.border-slate-200\/80,.divide-slate-100>:not([hidden])~:not([hidden]),.divide-slate-200>:not([hidden])~:not([hidden])):not(.page-hero *) { border-color: rgb(var(--border)); }
.dark :is(.border-slate-300,.hover\:border-slate-300:hover,.group:hover .group-hover\:border-slate-300):not(.page-hero *) { border-color: rgb(var(--border-strong)); }
.dark :is(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]),select,textarea):not(.page-hero *) { background-color: rgb(var(--surface-2)); color: rgb(var(--ink)); border-color: rgb(var(--border-strong)); }

/* Inline colours written into a few screens (GOV-R148) */
.dark :is([style*="color:#475569"],[style*="color:#64748b"],[style*="color:#334155"]):not(.page-hero *) { color: rgb(var(--ink-muted)) !important; }
.dark :is([style*="color:#3730a3"]):not(.page-hero *) { color: rgb(165 180 252) !important; }

.dark :is(.bg-brand-50,.bg-brand-50\/30,.bg-brand-50\/40,.bg-brand-50\/50,.bg-brand-50\/60,.bg-brand-50\/70,.bg-brand-50\/80,.bg-brand-100,.hover\:bg-brand-50:hover,.hover\:bg-brand-100:hover,.hover\:bg-brand-50\/40:hover):not(.page-hero *) { background-color: rgb(var(--brand-500) / .16); }
.dark :is(.text-brand-600,.text-brand-700,.text-brand-800,.text-brand-900,.text-brand-950,.hover\:text-brand-800:hover,.hover\:text-brand-900:hover):not(.page-hero *) { color: rgb(var(--brand-300)); }
.dark :is(.border-brand-50,.border-brand-100,.border-brand-200,.border-brand-300,.hover\:border-brand-300:hover):not(.page-hero *) { border-color: rgb(var(--brand-500) / .35); }
.dark :is(.bg-indigo-50,.bg-indigo-50\/30,.bg-indigo-50\/40,.bg-indigo-50\/50,.bg-indigo-50\/60,.bg-indigo-50\/70,.bg-indigo-50\/80,.bg-indigo-100,.hover\:bg-indigo-50:hover,.hover\:bg-indigo-100:hover,.hover\:bg-indigo-50\/40:hover):not(.page-hero *) { background-color: rgb(var(--brand-500) / .16); }
.dark :is(.text-indigo-600,.text-indigo-700,.text-indigo-800,.text-indigo-900,.text-indigo-950,.hover\:text-indigo-800:hover,.hover\:text-indigo-900:hover):not(.page-hero *) { color: rgb(var(--brand-300)); }
.dark :is(.border-indigo-50,.border-indigo-100,.border-indigo-200,.border-indigo-300,.hover\:border-indigo-300:hover):not(.page-hero *) { border-color: rgb(var(--brand-500) / .35); }
.dark :is(.bg-emerald-50,.bg-emerald-50\/30,.bg-emerald-50\/40,.bg-emerald-50\/50,.bg-emerald-50\/60,.bg-emerald-50\/70,.bg-emerald-50\/80,.bg-emerald-100,.hover\:bg-emerald-50:hover,.hover\:bg-emerald-100:hover):not(.page-hero *) { background-color: rgb(16 185 129 / .14); }
.dark :is(.bg-emerald-200):not(.page-hero *) { background-color: rgb(16 185 129 / .28); }
.dark :is(.text-emerald-600,.text-emerald-700,.text-emerald-800,.text-emerald-900,.text-emerald-950):not(.page-hero *) { color: rgb(110 231 183); }
.dark :is(.border-emerald-50,.border-emerald-100,.border-emerald-200,.border-emerald-300,.hover\:border-emerald-300:hover):not(.page-hero *) { border-color: rgb(16 185 129 / .35); }
.dark :is(.bg-green-50,.bg-green-50\/30,.bg-green-50\/40,.bg-green-50\/50,.bg-green-50\/60,.bg-green-50\/70,.bg-green-50\/80,.bg-green-100,.hover\:bg-green-50:hover,.hover\:bg-green-100:hover):not(.page-hero *) { background-color: rgb(34 197 94 / .14); }
.dark :is(.bg-green-200):not(.page-hero *) { background-color: rgb(34 197 94 / .28); }
.dark :is(.text-green-600,.text-green-700,.text-green-800,.text-green-900,.text-green-950):not(.page-hero *) { color: rgb(134 239 172); }
.dark :is(.border-green-50,.border-green-100,.border-green-200,.border-green-300,.hover\:border-green-300:hover):not(.page-hero *) { border-color: rgb(34 197 94 / .35); }
.dark :is(.bg-amber-50,.bg-amber-50\/30,.bg-amber-50\/40,.bg-amber-50\/50,.bg-amber-50\/60,.bg-amber-50\/70,.bg-amber-50\/80,.bg-amber-100,.hover\:bg-amber-50:hover,.hover\:bg-amber-100:hover):not(.page-hero *) { background-color: rgb(245 158 11 / .14); }
.dark :is(.bg-amber-200):not(.page-hero *) { background-color: rgb(245 158 11 / .28); }
.dark :is(.text-amber-600,.text-amber-700,.text-amber-800,.text-amber-900,.text-amber-950):not(.page-hero *) { color: rgb(252 211 77); }
.dark :is(.border-amber-50,.border-amber-100,.border-amber-200,.border-amber-300,.hover\:border-amber-300:hover):not(.page-hero *) { border-color: rgb(245 158 11 / .35); }
.dark :is(.bg-yellow-50,.bg-yellow-50\/30,.bg-yellow-50\/40,.bg-yellow-50\/50,.bg-yellow-50\/60,.bg-yellow-50\/70,.bg-yellow-50\/80,.bg-yellow-100,.hover\:bg-yellow-50:hover,.hover\:bg-yellow-100:hover):not(.page-hero *) { background-color: rgb(234 179 8 / .14); }
.dark :is(.bg-yellow-200):not(.page-hero *) { background-color: rgb(234 179 8 / .28); }
.dark :is(.text-yellow-600,.text-yellow-700,.text-yellow-800,.text-yellow-900,.text-yellow-950):not(.page-hero *) { color: rgb(253 224 71); }
.dark :is(.border-yellow-50,.border-yellow-100,.border-yellow-200,.border-yellow-300,.hover\:border-yellow-300:hover):not(.page-hero *) { border-color: rgb(234 179 8 / .35); }
.dark :is(.bg-orange-50,.bg-orange-50\/30,.bg-orange-50\/40,.bg-orange-50\/50,.bg-orange-50\/60,.bg-orange-50\/70,.bg-orange-50\/80,.bg-orange-100,.hover\:bg-orange-50:hover,.hover\:bg-orange-100:hover):not(.page-hero *) { background-color: rgb(249 115 22 / .14); }
.dark :is(.bg-orange-200):not(.page-hero *) { background-color: rgb(249 115 22 / .28); }
.dark :is(.text-orange-600,.text-orange-700,.text-orange-800,.text-orange-900,.text-orange-950):not(.page-hero *) { color: rgb(253 186 116); }
.dark :is(.border-orange-50,.border-orange-100,.border-orange-200,.border-orange-300,.hover\:border-orange-300:hover):not(.page-hero *) { border-color: rgb(249 115 22 / .35); }
.dark :is(.bg-rose-50,.bg-rose-50\/30,.bg-rose-50\/40,.bg-rose-50\/50,.bg-rose-50\/60,.bg-rose-50\/70,.bg-rose-50\/80,.bg-rose-100,.hover\:bg-rose-50:hover,.hover\:bg-rose-100:hover):not(.page-hero *) { background-color: rgb(244 63 94 / .14); }
.dark :is(.bg-rose-200):not(.page-hero *) { background-color: rgb(244 63 94 / .28); }
.dark :is(.text-rose-600,.text-rose-700,.text-rose-800,.text-rose-900,.text-rose-950):not(.page-hero *) { color: rgb(253 164 175); }
.dark :is(.border-rose-50,.border-rose-100,.border-rose-200,.border-rose-300,.hover\:border-rose-300:hover):not(.page-hero *) { border-color: rgb(244 63 94 / .35); }
.dark :is(.bg-red-50,.bg-red-50\/30,.bg-red-50\/40,.bg-red-50\/50,.bg-red-50\/60,.bg-red-50\/70,.bg-red-50\/80,.bg-red-100,.hover\:bg-red-50:hover,.hover\:bg-red-100:hover):not(.page-hero *) { background-color: rgb(239 68 68 / .14); }
.dark :is(.bg-red-200):not(.page-hero *) { background-color: rgb(239 68 68 / .28); }
.dark :is(.text-red-600,.text-red-700,.text-red-800,.text-red-900,.text-red-950):not(.page-hero *) { color: rgb(252 165 165); }
.dark :is(.border-red-50,.border-red-100,.border-red-200,.border-red-300,.hover\:border-red-300:hover):not(.page-hero *) { border-color: rgb(239 68 68 / .35); }
.dark :is(.bg-sky-50,.bg-sky-50\/30,.bg-sky-50\/40,.bg-sky-50\/50,.bg-sky-50\/60,.bg-sky-50\/70,.bg-sky-50\/80,.bg-sky-100,.hover\:bg-sky-50:hover,.hover\:bg-sky-100:hover):not(.page-hero *) { background-color: rgb(14 165 233 / .14); }
.dark :is(.bg-sky-200):not(.page-hero *) { background-color: rgb(14 165 233 / .28); }
.dark :is(.text-sky-600,.text-sky-700,.text-sky-800,.text-sky-900,.text-sky-950):not(.page-hero *) { color: rgb(125 211 252); }
.dark :is(.border-sky-50,.border-sky-100,.border-sky-200,.border-sky-300,.hover\:border-sky-300:hover):not(.page-hero *) { border-color: rgb(14 165 233 / .35); }
.dark :is(.bg-blue-50,.bg-blue-50\/30,.bg-blue-50\/40,.bg-blue-50\/50,.bg-blue-50\/60,.bg-blue-50\/70,.bg-blue-50\/80,.bg-blue-100,.hover\:bg-blue-50:hover,.hover\:bg-blue-100:hover):not(.page-hero *) { background-color: rgb(59 130 246 / .14); }
.dark :is(.bg-blue-200):not(.page-hero *) { background-color: rgb(59 130 246 / .28); }
.dark :is(.text-blue-600,.text-blue-700,.text-blue-800,.text-blue-900,.text-blue-950):not(.page-hero *) { color: rgb(147 197 253); }
.dark :is(.border-blue-50,.border-blue-100,.border-blue-200,.border-blue-300,.hover\:border-blue-300:hover):not(.page-hero *) { border-color: rgb(59 130 246 / .35); }
.dark :is(.bg-cyan-50,.bg-cyan-50\/30,.bg-cyan-50\/40,.bg-cyan-50\/50,.bg-cyan-50\/60,.bg-cyan-50\/70,.bg-cyan-50\/80,.bg-cyan-100,.hover\:bg-cyan-50:hover,.hover\:bg-cyan-100:hover):not(.page-hero *) { background-color: rgb(6 182 212 / .14); }
.dark :is(.bg-cyan-200):not(.page-hero *) { background-color: rgb(6 182 212 / .28); }
.dark :is(.text-cyan-600,.text-cyan-700,.text-cyan-800,.text-cyan-900,.text-cyan-950):not(.page-hero *) { color: rgb(103 232 249); }
.dark :is(.border-cyan-50,.border-cyan-100,.border-cyan-200,.border-cyan-300,.hover\:border-cyan-300:hover):not(.page-hero *) { border-color: rgb(6 182 212 / .35); }
.dark :is(.bg-teal-50,.bg-teal-50\/30,.bg-teal-50\/40,.bg-teal-50\/50,.bg-teal-50\/60,.bg-teal-50\/70,.bg-teal-50\/80,.bg-teal-100,.hover\:bg-teal-50:hover,.hover\:bg-teal-100:hover):not(.page-hero *) { background-color: rgb(20 184 166 / .14); }
.dark :is(.bg-teal-200):not(.page-hero *) { background-color: rgb(20 184 166 / .28); }
.dark :is(.text-teal-600,.text-teal-700,.text-teal-800,.text-teal-900,.text-teal-950):not(.page-hero *) { color: rgb(94 234 212); }
.dark :is(.border-teal-50,.border-teal-100,.border-teal-200,.border-teal-300,.hover\:border-teal-300:hover):not(.page-hero *) { border-color: rgb(20 184 166 / .35); }
.dark :is(.bg-violet-50,.bg-violet-50\/30,.bg-violet-50\/40,.bg-violet-50\/50,.bg-violet-50\/60,.bg-violet-50\/70,.bg-violet-50\/80,.bg-violet-100,.hover\:bg-violet-50:hover,.hover\:bg-violet-100:hover):not(.page-hero *) { background-color: rgb(139 92 246 / .14); }
.dark :is(.bg-violet-200):not(.page-hero *) { background-color: rgb(139 92 246 / .28); }
.dark :is(.text-violet-600,.text-violet-700,.text-violet-800,.text-violet-900,.text-violet-950):not(.page-hero *) { color: rgb(196 181 253); }
.dark :is(.border-violet-50,.border-violet-100,.border-violet-200,.border-violet-300,.hover\:border-violet-300:hover):not(.page-hero *) { border-color: rgb(139 92 246 / .35); }
.dark :is(.bg-purple-50,.bg-purple-50\/30,.bg-purple-50\/40,.bg-purple-50\/50,.bg-purple-50\/60,.bg-purple-50\/70,.bg-purple-50\/80,.bg-purple-100,.hover\:bg-purple-50:hover,.hover\:bg-purple-100:hover):not(.page-hero *) { background-color: rgb(168 85 247 / .14); }
.dark :is(.bg-purple-200):not(.page-hero *) { background-color: rgb(168 85 247 / .28); }
.dark :is(.text-purple-600,.text-purple-700,.text-purple-800,.text-purple-900,.text-purple-950):not(.page-hero *) { color: rgb(216 180 254); }
.dark :is(.border-purple-50,.border-purple-100,.border-purple-200,.border-purple-300,.hover\:border-purple-300:hover):not(.page-hero *) { border-color: rgb(168 85 247 / .35); }

/* Base */
body { background: rgb(var(--canvas)); color: rgb(var(--ink)); }
.num { font-variant-numeric: tabular-nums; }
.bg-grad-brand { background-image: var(--grad-brand); }
.text-grad-brand { background-image: var(--grad-brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.dark ::-webkit-scrollbar-track { background: rgb(var(--surface-2)); }
.dark ::-webkit-scrollbar-thumb { background: rgb(var(--border-strong)); }
/* White text on amber (Return, Request correction, warning, count badges): amber-700, 5:1 in both modes (GOV-R150) */
.bg-amber-500.text-white { background-color: #B45309; border-color: #B45309; }
.bg-amber-500.text-white:hover { background-color: #92400E; border-color: #92400E; }
/* Light mode: light-grey text (empty-value dashes, reference numbers, hints) at slate-500, 4.7:1 on white (GOV-R151).
   Icons, the navigation, the hero band and text on dark surfaces keep their own colour. */
html:not(.dark) :is(.text-slate-400, .text-slate-300):not(i, svg, :hover, .page-hero *, aside *, #sidebar-nav *, #side *, :is(.bg-slate-700, .bg-slate-800, .bg-slate-900, .bg-slate-950, .bg-slate-900\/80, .bg-slate-900\/90, .bg-slate-900\/95, .bg-gray-800, .bg-gray-900) *) { color: rgb(var(--ink-muted)); }
html:not(.dark) [style*="color:#94a3b8"]:not(i, svg, :hover, .page-hero *, aside *, #sidebar-nav *, #side *, :is(.bg-slate-700, .bg-slate-800, .bg-slate-900, .bg-slate-950, .bg-slate-900\/80, .bg-slate-900\/90, .bg-slate-900\/95, .bg-gray-800, .bg-gray-900) *) { color: rgb(var(--ink-muted)) !important; }

/* The switch in the top bar and its panel (built by emis-theme.js) */
.emis-theme-btn { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 32px; height: 32px; border-radius: 10px; border: 1px solid rgb(var(--border-strong)); background: rgb(var(--surface)); color: rgb(var(--brand-600)); cursor: pointer; transition: background .15s, border-color .15s; }
.dark .emis-theme-btn { color: rgb(var(--brand-300)); }
.emis-theme-btn:hover { background: rgb(var(--surface-2)); border-color: rgb(var(--brand-400)); }
.emis-theme-btn:focus-visible, .emis-theme-pop button:focus-visible { outline: 2px solid rgb(var(--brand-500)); outline-offset: 2px; }
.emis-theme-pop { position: fixed; z-index: 75; width: 256px; padding: 12px; border-radius: 14px; background: rgb(var(--surface)); color: rgb(var(--ink)); border: 1px solid rgb(var(--border)); box-shadow: var(--shadow-3); font-size: 12px; text-align: start; }
.emis-theme-pop[hidden] { display: none; }
/* GOV-R304-A (CR-683): the small close button at the top end of the appearance panel (theme colours, 26px, 40px touch target on a coarse pointer) */
.emis-theme-pop .emis-theme-x { position: absolute; top: 8px; inset-inline-end: 8px; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 8px; background: transparent; color: rgb(var(--ink-muted)); font-size: 13px; cursor: pointer; transition: background-color .15s, color .15s; }
.emis-theme-pop .emis-theme-x:hover { background: rgb(var(--surface-2)); color: rgb(var(--ink)); }
.emis-theme-pop > h4:first-of-type { padding-inline-end: 30px; }
@media (pointer: coarse) { .emis-theme-pop .emis-theme-x { width: 40px; height: 40px; top: 2px; inset-inline-end: 2px; } }
.emis-theme-pop h4 { margin: 0 0 6px; font-size: 12px; font-weight: 700; color: rgb(var(--ink-2)); }
.emis-theme-pop h4:not(:first-child) { margin-top: 12px; }
.emis-theme-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.emis-theme-modes button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; border-radius: 9px; border: 1px solid rgb(var(--border-strong)); background: rgb(var(--surface)); color: rgb(var(--ink-2)); font-size: 12px; font-weight: 600; cursor: pointer; }
.emis-theme-modes button[aria-pressed="true"] { background: rgb(var(--brand-600)); border-color: rgb(var(--brand-600)); color: #fff; }
.emis-theme-swatches { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.emis-theme-swatches button { position: relative; aspect-ratio: 1; border-radius: 10px; border: 2px solid transparent; background: var(--grad-brand); color: #fff; font-size: 12px; cursor: pointer; }
.emis-theme-swatches button[aria-pressed="true"] { border-color: rgb(var(--ink)); }
.emis-theme-swatches button .ck { display: none; }
.emis-theme-swatches button[aria-pressed="true"] .ck { display: inline; }
.emis-theme-swatches button[aria-pressed="true"] .df { display: none; }
.emis-theme-now { margin: 8px 0 0; font-size: 12px; color: rgb(var(--ink-muted)); }
@media print { .emis-theme-btn, .emis-theme-pop { display: none !important; } }

/* GOV-R157-A (CR-323): a new colour of the user's own: the swatch, the «+» button and the editor (picker, code, ramp preview) */
.emis-theme-swatches .emis-theme-own { background: none; }
.emis-theme-swatches .emis-theme-add { background: rgb(var(--surface-2)); color: rgb(var(--ink-2)); border: 2px dashed rgb(var(--border-strong, var(--border))); }
.emis-theme-swatches .emis-theme-add[aria-expanded="true"] { border-style: solid; border-color: rgb(var(--brand-500)); color: rgb(var(--brand-700)); }
.emis-theme-new { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgb(var(--border)); }
.emis-theme-new-row { display: flex; gap: 8px; align-items: center; }
.emis-theme-new-row input[type="color"] { width: 40px; height: 34px; padding: 2px; border-radius: 9px; border: 1px solid rgb(var(--border)); background: rgb(var(--surface)); cursor: pointer; }
.emis-theme-new-row input[type="text"] { flex: 1; min-width: 0; height: 34px; padding: 0 10px; border-radius: 9px; border: 1px solid rgb(var(--border)); background: rgb(var(--surface)); color: rgb(var(--ink)); font: 600 12.5px ui-monospace, monospace; text-transform: uppercase; }
.emis-theme-ramp { display: grid; grid-template-columns: repeat(11, 1fr); gap: 2px; margin-top: 8px; border-radius: 8px; overflow: hidden; }
.emis-theme-ramp span { height: 18px; }
.emis-theme-hint { margin: 6px 0 0; font-size: 11px; color: rgb(var(--ink-muted)); }
.emis-theme-err { margin: 6px 0 0; font-size: 11px; color: rgb(225 29 72); }
.emis-theme-use { width: 100%; margin-top: 8px; padding: 7px; border-radius: 9px; border: 0; background: rgb(var(--brand-600)); color: #fff; font-weight: 700; font-size: 12px; cursor: pointer; }
.emis-theme-use[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Measured contrast, applied once for every module (GOV-R215-A, GOV-R217-A, GOV-R218-A; CR-441) ----------
   The audit of the design skill measured four things that failed in every prototype at once. They are repaired here, in the one
   place of the colours, so no module carries a fix of its own. Presentation only. */

/* Muted text (GOV-R218-A): slate-500 read 4.47:1 on the canvas and 4.26:1 on a 50 tint. --ink-muted is now 94 109 131 (#5E6D83),
   4.7:1 or more on white, the canvas, surface-2 and every 50 tint; the Tailwind class follows the token in the light mode.
   Icons, the navigation, the hero band and text on dark surfaces keep their own colour (the same exclusions as GOV-R151). */
html:not(.dark) .text-slate-500:not(i, svg, .page-hero *, aside *, #sidebar-nav *, #side *, :is(.bg-slate-700, .bg-slate-800, .bg-slate-900, .bg-slate-950, .bg-slate-900\/80, .bg-slate-900\/90, .bg-slate-900\/95, .bg-gray-800, .bg-gray-900) *) { color: rgb(var(--ink-muted)); }

/* The floor of text size (GOV-R218-A): nothing is set under 11px. The arbitrary classes below were used about 1400 times across the modules. */
html :is(.text-\[9px\], .text-\[9\.5px\], .text-\[10px\], .text-\[10\.5px\]) { font-size: 11px; }

/* Four weights (GOV-R218-A): 400, 600, 700, 800. 500 is not a role of the type scale, so the class draws 600. */
html .font-medium { font-weight: 600; }

/* The boundary of a control (GOV-R217-A): the border of a field reads 3:1 or more against white and surface-2 (it read 1.48:1).
   An error border, a focused field and a control drawn without a border are left alone. */
html :is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], [type="hidden"]), select, textarea):not(:focus, [aria-invalid="true"], [class*="border-rose"], [class*="border-red"], [class*="border-0"], [class*="border-transparent"], [class*="border-none"]) { border-color: rgb(var(--control-border)); }
/* A <small> element draws 0.83em by default, which is 10px inside 12px text: the floor holds there too (GOV-R218-A). */
html small { font-size: max(11px, 0.833em); }

/* ---------- The repeated failures of the inner screens, repaired once (GOV-R219-A; CR-442) ----------
   Every screen of nine modules was measured (measure-gates.js). Three failures repeated across all of them, and each is a
   Tailwind class that draws a colour too light for what sits on it. They are mapped here in the light mode; the dark mode
   has its own rules above. Presentation only: no status, field or rule changes — a meaning keeps its hue, one step deeper. */

/* 1. White text on a saturated fill that reads under 4.5:1 (emerald-600 read 3.77:1, rose-500 3.67:1). Same remedy as GOV-R150 for amber. */
html:not(.dark) :is(.bg-emerald-600, .bg-emerald-500):is(.text-white, :has(> .text-white)) { background-color: #047857; border-color: #047857; }
html:not(.dark) :is(.bg-green-600, .bg-green-500):is(.text-white, :has(> .text-white)) { background-color: #15803D; border-color: #15803D; }
html:not(.dark) :is(.bg-teal-600, .bg-teal-500):is(.text-white, :has(> .text-white)) { background-color: #0F766E; border-color: #0F766E; }
html:not(.dark) :is(.bg-sky-600, .bg-sky-500):is(.text-white, :has(> .text-white)) { background-color: #0369A1; border-color: #0369A1; }
html:not(.dark) :is(.bg-cyan-600, .bg-cyan-500):is(.text-white, :has(> .text-white)) { background-color: #0E7490; border-color: #0E7490; }
html:not(.dark) :is(.bg-rose-500, .bg-red-500):is(.text-white, :has(> .text-white)) { background-color: #E11D48; border-color: #E11D48; }
html:not(.dark) .bg-blue-500:is(.text-white, :has(> .text-white)) { background-color: #2563EB; border-color: #2563EB; }
html:not(.dark) .bg-orange-500:is(.text-white, :has(> .text-white)) { background-color: #C2410C; border-color: #C2410C; }
html:not(.dark) .bg-violet-500:is(.text-white, :has(> .text-white)) { background-color: #7C3AED; border-color: #7C3AED; }
html:not(.dark) :is(.bg-indigo-500, .bg-brand-500):is(.text-white, :has(> .text-white)) { background-color: rgb(var(--brand-600)); border-color: rgb(var(--brand-600)); }

/* 2. Coloured text of the 500 and 600 steps, which reads under 4.5:1 on white or on its own 50 tint (amber-600 3.07:1, teal-600 3.59:1,
      rose-500 3.67:1): it draws the 700 step. Icons keep their colour (an icon needs 3:1, and a status dot is not text). */
html:not(.dark) :is(.text-emerald-600, .text-emerald-500):not(i, svg, .page-hero *) { color: #047857; }
html:not(.dark) :is(.text-green-600, .text-green-500):not(i, svg, .page-hero *) { color: #15803D; }
html:not(.dark) :is(.text-teal-600, .text-teal-500):not(i, svg, .page-hero *) { color: #0F766E; }
html:not(.dark) :is(.text-sky-600, .text-sky-500):not(i, svg, .page-hero *) { color: #0369A1; }
html:not(.dark) :is(.text-cyan-600, .text-cyan-500):not(i, svg, .page-hero *) { color: #0E7490; }
html:not(.dark) :is(.text-amber-600, .text-amber-500):not(i, svg, .page-hero *) { color: #B45309; }
html:not(.dark) :is(.text-orange-600, .text-orange-500):not(i, svg, .page-hero *) { color: #C2410C; }
html:not(.dark) :is(.text-rose-500, .text-red-500):not(i, svg, .page-hero *) { color: #E11D48; }
html:not(.dark) .text-blue-500:not(i, svg, .page-hero *) { color: #2563EB; }
html:not(.dark) :is(.text-indigo-600, .text-brand-600, .text-indigo-500, .text-brand-500):not(i, svg, .page-hero *) { color: rgb(var(--brand-700)); }

/* 3. Text greys: a screen read six or more because the whole slate scale was in use. Three roles, three greys (ink, ink-2, ink-muted). */
html:not(.dark) :is(.text-slate-800, .text-gray-900, .text-gray-800):not(.page-hero *) { color: rgb(var(--ink)); }
html:not(.dark) :is(.text-slate-600, .text-gray-700, .text-gray-600):not(i, svg, .page-hero *, aside *, #sidebar-nav *, #side *) { color: rgb(var(--ink-2)); }
html:not(.dark) :is(.text-gray-500, .text-gray-400):not(i, svg, .page-hero *, aside *, #sidebar-nav *, #side *) { color: rgb(var(--ink-muted)); }

/* CR-725 ([DOCUMENTED REQUIREMENT — GOV-R323-A]): one default font pair for every module, as the design skill sets it (Inter for English, IBM Plex Sans
   Arabic for Arabic, Cairo only its fallback). A font chosen in the builder or in My profile still wins (html[data-font], emis-theme-studio.css). */
:root { --font-ar: 'IBM Plex Sans Arabic', 'Cairo', 'Inter', sans-serif; --font-en: 'Inter', 'IBM Plex Sans Arabic', sans-serif; }
body { font-family: var(--font-ar); }
html[dir="ltr"] body, [dir="ltr"] body, body[dir="ltr"] { font-family: var(--font-en); }

/* ==========================================================================
   PAGE HERO BAND & ACTIONS DROPDOWN (Strict Prototype Fidelity)
   ========================================================================== */
.page-hero {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  background: var(--grad-hero, var(--grad-brand, linear-gradient(135deg, #4338CA 0%, #3730A3 55%, #312E81 100%))) !important;
  color: #ffffff !important;
  padding: 18px 22px 20px;
  margin-bottom: 14px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}
.page-hero::before {
  content: '';
  position: absolute;
  width: 280px;
  height: 280px;
  top: -120px;
  inset-inline-end: -60px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  filter: blur(30px);
  pointer-events: none;
}
.page-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.14) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: 0.45;
  pointer-events: none;
}
.page-hero .page-head {
  position: relative;
  z-index: 1;
  margin-bottom: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.page-hero .page-head h2 {
  color: #ffffff !important;
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-hero .page-head p {
  color: rgba(255, 255, 255, 0.85) !important;
  font-size: 0.8rem;
  margin: 4px 0 0;
}
.page-hero .btn-hero-action {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(6px);
  border-radius: 12px;
  padding: 8px 16px;
  font-size: 0.8rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  cursor: pointer;
}
.page-hero .btn-hero-action:hover {
  background: rgba(255, 255, 255, 0.26);
  border-color: rgba(255, 255, 255, 0.45);
}
.page-hero .btn-hero-icon {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(6px);
  border-radius: 12px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  cursor: pointer;
}
.page-hero .btn-hero-icon:hover {
  background: rgba(255, 255, 255, 0.26);
  border-color: rgba(255, 255, 255, 0.45);
}
.page-hero .chip-badge {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff !important;
  border: 1px dashed rgba(255, 255, 255, 0.45);
  border-radius: 9999px;
  padding: 2px 10px;
  font-size: 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.page-hero .breadcrumb-hero {
  color: rgba(255, 255, 255, 0.8) !important;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

/* Actions button & dropdown menu in tables (.act-wrap, .act-btn, .act-list) */
.act-wrap {
  position: relative;
  display: inline-block;
}
.act-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgb(var(--border-strong, 203 213 225));
  background: rgb(var(--surface, 255 255 255));
  color: rgb(var(--ink-2, 51 65 85));
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.15s ease;
  cursor: pointer;
}
.act-btn:hover, .act-wrap.open .act-btn {
  border-color: rgb(var(--brand-500, 99 102 241));
  color: rgb(var(--brand-700, 67 56 202));
  background: rgb(var(--brand-50, 238 242 255));
}
.act-n {
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgb(var(--surface-2, 241 245 249));
  color: rgb(var(--ink-muted, 100 116 139));
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.act-list {
  display: flex;
  flex-direction: column;
  position: absolute;
  inset-inline-end: 0;
  bottom: calc(100% + 6px);
  top: auto;
  z-index: 60;
  min-width: 220px;
  white-space: nowrap;
  padding: 4px;
  background: rgb(var(--surface, 255 255 255));
  border: 1px solid rgb(var(--border, 226 232 240));
  border-radius: 12px;
  box-shadow: 0 18px 40px -12px rgba(15, 23, 42, 0.35);
}
.dark .act-btn {
  border-color: rgb(var(--border-strong, 51 65 85));
  background: rgb(var(--surface, 15 23 42));
  color: rgb(var(--ink, 248 250 252));
}
.dark .act-btn:hover, .dark .act-wrap.open .act-btn {
  background: rgb(var(--brand-500, 99 102 241) / 0.16);
  border-color: rgb(var(--brand-500, 99 102 241));
  color: rgb(var(--brand-300, 165 180 252));
}
.dark .act-n {
  background: rgb(var(--surface-2, 30 41 59));
  color: rgb(var(--ink-muted, 148 163 184));
}
.dark .act-list {
  background: rgb(var(--surface, 15 23 42));
  border-color: rgb(var(--border, 51 65 85));
  box-shadow: 0 14px 30px -4px rgba(0, 0, 0, 0.5);
}
.act-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 10px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: rgb(var(--ink, 15 23 42));
  font-size: 12px;
  font-weight: 500;
  text-align: start;
  cursor: pointer;
  transition: all 0.15s ease;
}
.act-item:hover:not([disabled]) {
  background: rgb(var(--brand-50, 238 242 255));
  color: rgb(var(--brand-700, 67 56 202));
}
.dark .act-item {
  color: rgb(var(--ink, 241 245 249));
}
.dark .act-item:hover:not([disabled]) {
  background: rgb(var(--brand-500, 99 102 241) / 0.16);
  color: rgb(var(--brand-300, 165 180 252));
}
.act-item[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}
