/* =====================================================================================
   phs-tokens.css - Performance Hub color, type, shape and motion tokens.
   Loaded right after style.bundle.css. phs-components.css builds on it.
   - One token set: light on :root, dark on :root[data-theme="dark"].
   - Old names (--phs-*, --bg-*, --text-*) point here, so site.css and page sheets follow the theme.
   - Bootstrap / Metronic bridge: --bs-* variables map to the tokens in both themes.
     data-bs-theme is never set (it turns the Font Awesome Pro icons gray).
   Dark mode is only data-theme="dark" on <html>. Text pairs pass 4.5:1, UI parts 3:1, both themes.
   Font sizes follow the text-size control (html[data-font-level]).
   ===================================================================================== */

/* -------------------------------------------------------------------------------------
   1. Font
   Open Sans latin, one self-hosted variable file (weights 400-700; 800 and 900 draw as 700).
   The fallback face is Arial sized to Open Sans' width and line box, so text does not jump
   when the font arrives (Open Sans is 1.0414x Arial's width, ascent 1.069em, descent 0.293em).
   ------------------------------------------------------------------------------------- */
@font-face {
    font-family: "Open Sans";
    font-style: normal;
    font-weight: 400 700;
    font-stretch: 100%;
    font-display: swap;
    src: url("../lib/open-sans/opensans-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;
}

@font-face {
    font-family: "Open Sans Fallback";
    font-weight: 400;
    src: local("Arial"), local("ArialMT");
    size-adjust: 104.1%;
    ascent-override: 102.6%;
    descent-override: 28.1%;
    line-gap-override: 0%;
}

/* Arial Bold stands in for 600 and 700 (Open Sans 600 is 1.006x, 700 is 1.036-1.053x its width). */
@font-face {
    font-family: "Open Sans Fallback";
    font-weight: 700;
    src: local("Arial Bold"), local("Arial-BoldMT");
    size-adjust: 103%;
    ascent-override: 103.8%;
    descent-override: 28.4%;
    line-gap-override: 0%;
}

/* -------------------------------------------------------------------------------------
   2a. Light tokens (default)
   ------------------------------------------------------------------------------------- */
:root {
    color-scheme: light;

    /* Type */
    --phs-font-family: "Open Sans", "Open Sans Fallback", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
    --phs-font-mono: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
    --phs-weight-regular: 400;
    --phs-weight-semibold: 600;
    --phs-weight-bold: 700;
    --phs-fs-display: 1.75rem;     /* 24.5px  status pages only */
    --phs-fs-page-title: 1.5rem;   /* 21px    h1 page title */
    --phs-fs-section: 1.25rem;     /* 17.5px  h2 section */
    --phs-fs-card-title: 1.125rem; /* 15.75px h2/h3 card and popup title */
    --phs-fs-body: 1rem;           /* 14px    body text */
    --phs-fs-label: 0.9375rem;     /* 13.1px  field labels */
    --phs-fs-control: 0.9375rem;   /* 13.1px  buttons, field text, tabs */
    --phs-fs-small: 0.875rem;      /* 12.25px help text, small buttons */
    --phs-fs-table-head: 0.8125rem;/* 11.4px  table headers, badges */
    --phs-fs-min: 0.75rem;         /* 10.5px  nothing smaller */
    --phs-leading-tight: 1.25;
    --phs-leading-normal: 1.5;

    /* Surfaces */
    --phs-surface-page: #f5f8fa;
    --phs-surface-card: #ffffff;
    --phs-surface-subtle: #f8fafc;
    --phs-surface-muted: #f1f5f9;
    --phs-surface-raised: #ffffff;      /* popups, menus, toasts */
    --phs-surface-field: #ffffff;       /* inputs */
    --phs-surface-hover: #f1f5f9;       /* row hover, secondary button hover */
    --phs-surface-pressed: #e2e8f0;
    --phs-surface-header: #2c294b;      /* the top bar */

    /* Ink (text) */
    --phs-ink-heading: #111827;
    --phs-ink-body: #374151;
    --phs-ink-muted: #5f6b7a;
    --phs-ink-label: #374151;
    --phs-ink-placeholder: #5f6b7a;
    --phs-ink-on-fill: #ffffff;
    --phs-ink-on-header: #ffffff;
    --phs-ink-brand: #2c294b;
    --phs-ink-link: #1d4ed8;
    --phs-ink-link-hover: #1e40af;

    /* Lines */
    --phs-border: #e2e8f0;              /* dividers and card edges (decorative) */
    --phs-border-strong: #cbd5e1;       /* decorative, stronger */
    --phs-border-control: #6b7280;      /* field and secondary-button edges, 3:1 or better */
    --phs-focus: #1565c0;
    --phs-focus-on-dark: #7db8ff;       /* the ring on surfaces that stay dark in light mode (sidebar, brand panels) */
    --phs-focus-width: 2px;
    --phs-focus-offset: 2px;

    /* Primary action */
    --phs-primary: #2563eb;
    --phs-primary-hover: #1d4ed8;
    --phs-primary-active: #1e40af;
    --phs-on-primary: #ffffff;
    --phs-primary-tint: #eff6ff;
    --phs-primary-tint-ink: #1d4ed8;
    --phs-indicator: #2563eb;           /* checked boxes, active tab bar, spinner, progress */
    --phs-on-indicator: #ffffff;
    --phs-text-primary: #2563eb;        /* primary as text (.text-primary, light badges) */
    --phs-text-primary-inverse: #ffffff;/* ink on a --phs-text-primary fill */
    --phs-status-inverse: #ffffff;      /* ink on a status text color used as a fill */

    /* Secondary button: white with a gray edge */
    --phs-secondary-bg: #ffffff;
    --phs-secondary-bg-hover: #f1f5f9;
    --phs-secondary-bg-active: #e2e8f0;
    --phs-secondary-ink: #374151;
    --phs-secondary-ink-hover: #111827;
    --phs-secondary-border: #6b7280;

    /* Status: text (on any surface), fill (+hover) with on-fill ink, tint with ink-on-tint, mid border */
    --phs-success-text: #15803d;
    --phs-success-fill: #15803d;
    --phs-success-fill-hover: #166534;
    --phs-success-fill-active: #14532d;
    --phs-success-on-fill: #ffffff;
    --phs-success-tint: #dcfce7;
    --phs-success-tint-ink: #166534;
    --phs-success-border: #86efac;

    --phs-danger-text: #b91c1c;
    --phs-danger-fill: #b91c1c;
    --phs-danger-fill-hover: #991b1b;
    --phs-danger-fill-active: #7f1d1d;
    --phs-danger-on-fill: #ffffff;
    --phs-danger-tint: #fee2e2;
    --phs-danger-tint-ink: #991b1b;
    --phs-danger-border: #fca5a5;

    --phs-warning-text: #92400e;
    --phs-warning-fill: #f59e0b;
    --phs-warning-fill-hover: #fbbf24;  /* lighter, so the dark ink stays readable */
    --phs-warning-fill-active: #fcd34d;
    --phs-warning-on-fill: #111827;
    --phs-warning-tint: #fef3c7;
    --phs-warning-tint-ink: #92400e;
    --phs-warning-border: #fcd34d;

    --phs-info-text: #0369a1;
    --phs-info-fill: #0369a1;
    --phs-info-fill-hover: #075985;
    --phs-info-fill-active: #0c4a6e;
    --phs-info-on-fill: #ffffff;
    --phs-info-tint: #e0f2fe;
    --phs-info-tint-ink: #075985;
    --phs-info-border: #7dd3fc;

    --phs-neutral-text: #4b5563;
    --phs-neutral-fill: #4b5563;
    --phs-neutral-fill-hover: #374151;
    --phs-neutral-fill-active: #1f2937;
    --phs-neutral-on-fill: #ffffff;
    --phs-neutral-tint: #f1f5f9;
    --phs-neutral-tint-ink: #374151;
    --phs-neutral-border: #cbd5e1;

    /* Chart marks (3:1 or better on the card) */
    --phs-chart-success: #15803d;
    --phs-chart-danger: #dc2626;
    --phs-chart-delayed: #b45309;
    --phs-chart-in-progress: #2563eb;
    --phs-chart-submitted: #7c3aed;
    --phs-chart-not-started: #64748b;

    /* Scrollbars (thumb 3:1 or better on every surface) */
    --phs-scrollbar-thumb: #7b8597;
    --phs-scrollbar-thumb-hover: #5f6b7e;
    --phs-scrollbar-track: transparent;

    /* Overlays */
    --phs-backdrop: rgba(15, 23, 42, 0.5);
    --phs-block-scrim: rgba(245, 248, 250, 0.72);
    --phs-skeleton-base: #e2e8f0;
    --phs-skeleton-shine: #f1f5f9;

    /* Elevation */
    --phs-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
    --phs-shadow-md: 0 4px 12px rgba(16, 24, 40, 0.10);
    --phs-shadow-lg: 0 18px 48px rgba(16, 24, 40, 0.18);

    /* Shape */
    --phs-radius-control: 8px;
    --phs-radius-card: 12px;
    --phs-radius-dialog: 12px;
    --phs-radius-badge: 999px;

    /* Layout */
    --phs-control-height: max(24px, 2.5rem);
    --phs-control-height-sm: max(24px, 2rem);
    --phs-banner-stack: 0px;            /* impersonation bar + maintenance banner, set by script */
    --phs-sticky-top: calc(var(--app-header-height, 60px) + var(--phs-banner-stack));

    /* Motion: base values (the level classes below scale them) */
    --phs-duration-fast: 150ms;
    --phs-duration-medium: 200ms;
    --phs-duration-slow: 300ms;
    --phs-ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
    --phs-ease-enter: cubic-bezier(0.2, 0.8, 0.2, 1);
    --phs-ease-exit: cubic-bezier(0.4, 0, 1, 1);
    /* Effective values components use. Level "subtle" (default): */
    --phs-motion-fast: var(--phs-duration-fast);
    --phs-motion-medium: var(--phs-duration-medium);
    --phs-motion-slow: var(--phs-duration-slow);
    --phs-motion-rise: 6px;
    --phs-motion-scale: 0.98;

    /* RGB triplets the bridge needs (Bootstrap builds rgba() from them) */
    --phs-rgb-text-primary: 37, 99, 235;
    --phs-rgb-link: 29, 78, 216;
    --phs-rgb-link-hover: 30, 64, 175;
    --phs-rgb-success: 21, 128, 61;
    --phs-rgb-danger: 185, 28, 28;
    --phs-rgb-warning: 146, 64, 14;
    --phs-rgb-info: 3, 105, 161;
    --phs-rgb-light: 248, 250, 252;
    --phs-rgb-dark: 31, 41, 55;
    --phs-rgb-body: 55, 65, 81;
    --phs-rgb-emphasis: 17, 24, 39;
    --phs-rgb-body-bg: 255, 255, 255;
    --phs-rgb-secondary: 241, 245, 249;
    --phs-rgb-gray-100: 248, 250, 252;
    --phs-rgb-gray-200: 241, 245, 249;
    --phs-rgb-gray-300: 203, 213, 225;
    --phs-rgb-gray-400: 148, 163, 184;
    --phs-rgb-gray-500: 95, 107, 122;
    --phs-rgb-gray-600: 75, 85, 99;
    --phs-rgb-gray-700: 55, 65, 81;
    --phs-rgb-gray-800: 31, 41, 55;
    --phs-rgb-gray-900: 17, 24, 39;

    /* Gray scale the bridge maps Metronic's gray-100..900 onto. 500 and up are text-safe. */
    --phs-gray-100: #f8fafc;
    --phs-gray-200: #f1f5f9;
    --phs-gray-300: #cbd5e1;
    --phs-gray-400: #94a3b8;
    --phs-gray-500: #5f6b7a;
    --phs-gray-600: #4b5563;
    --phs-gray-700: #374151;
    --phs-gray-800: #1f2937;
    --phs-gray-900: #111827;
}

/* -------------------------------------------------------------------------------------
   2b. Dark tokens (navy)
   ------------------------------------------------------------------------------------- */
:root[data-theme="dark"] {
    color-scheme: dark;

    --phs-surface-page: #1a1a2e;
    --phs-surface-card: #16213e;
    --phs-surface-subtle: #1b2744;
    --phs-surface-muted: #243352;
    --phs-surface-raised: #1b2744;
    --phs-surface-field: #1a1a2e;
    --phs-surface-hover: #243352;
    --phs-surface-pressed: #2c3f60;
    --phs-surface-header: #0f0f1e;

    --phs-ink-heading: #f4f6fb;
    --phs-ink-body: #dfe3ea;
    --phs-ink-muted: #a7aebb;
    --phs-ink-label: #e5e7eb;
    --phs-ink-placeholder: #a7aebb;
    --phs-ink-on-fill: #ffffff;
    --phs-ink-on-header: #ffffff;
    --phs-ink-brand: #c4b5fd;
    --phs-ink-link: #93c5fd;
    --phs-ink-link-hover: #bfdbfe;

    --phs-border: #334e68;
    --phs-border-strong: #475569;
    --phs-border-control: #8b95a7;
    --phs-focus: #7db8ff;
    --phs-focus-on-dark: #7db8ff;

    --phs-primary: #2563eb;
    --phs-primary-hover: #1d4ed8;
    --phs-primary-active: #1e40af;
    --phs-on-primary: #ffffff;
    --phs-primary-tint: #1e3a8a;
    --phs-primary-tint-ink: #bfdbfe;
    --phs-indicator: #60a5fa;
    --phs-on-indicator: #0f172a;
    --phs-text-primary: #93c5fd;
    --phs-text-primary-inverse: #111827;
    --phs-status-inverse: #111827;

    --phs-secondary-bg: #1b2744;
    --phs-secondary-bg-hover: #243352;
    --phs-secondary-bg-active: #2c3f60;
    --phs-secondary-ink: #dfe3ea;
    --phs-secondary-ink-hover: #f4f6fb;
    --phs-secondary-border: #8b95a7;

    --phs-success-text: #4ade80;
    --phs-success-fill: #15803d;
    --phs-success-fill-hover: #166534;
    --phs-success-fill-active: #14532d;
    --phs-success-on-fill: #ffffff;
    --phs-success-tint: #1f3a24;
    --phs-success-tint-ink: #bbf7d0;
    --phs-success-border: #166534;

    --phs-danger-text: #f87171;
    --phs-danger-fill: #b91c1c;
    --phs-danger-fill-hover: #991b1b;
    --phs-danger-fill-active: #7f1d1d;
    --phs-danger-on-fill: #ffffff;
    --phs-danger-tint: #450a0a;
    --phs-danger-tint-ink: #fecaca;
    --phs-danger-border: #991b1b;

    --phs-warning-text: #fcd34d;
    --phs-warning-fill: #f59e0b;
    --phs-warning-fill-hover: #fbbf24;
    --phs-warning-fill-active: #fcd34d;
    --phs-warning-on-fill: #111827;
    --phs-warning-tint: #3a2d0b;
    --phs-warning-tint-ink: #fde68a;
    --phs-warning-border: #92400e;

    --phs-info-text: #7dd3fc;
    --phs-info-fill: #0369a1;
    --phs-info-fill-hover: #075985;
    --phs-info-fill-active: #0c4a6e;
    --phs-info-on-fill: #ffffff;
    --phs-info-tint: #1e3a5f;
    --phs-info-tint-ink: #bae6fd;
    --phs-info-border: #075985;

    --phs-neutral-text: #cbd5e1;
    --phs-neutral-fill: #475569;
    --phs-neutral-fill-hover: #334155;
    --phs-neutral-fill-active: #1e293b;
    --phs-neutral-on-fill: #ffffff;
    --phs-neutral-tint: #243352;
    --phs-neutral-tint-ink: #e2e8f0;
    --phs-neutral-border: #475569;

    --phs-chart-success: #22c55e;
    --phs-chart-danger: #f87171;
    --phs-chart-delayed: #f59e0b;
    --phs-chart-in-progress: #60a5fa;
    --phs-chart-submitted: #a78bfa;
    --phs-chart-not-started: #94a3b8;

    --phs-scrollbar-thumb: #7c859a;
    --phs-scrollbar-thumb-hover: #9aa3b5;

    --phs-backdrop: rgba(0, 0, 0, 0.65);
    --phs-block-scrim: rgba(15, 15, 30, 0.72);
    --phs-skeleton-base: #243352;
    --phs-skeleton-shine: #2c3f60;

    --phs-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --phs-shadow-md: 0 4px 14px rgba(0, 0, 0, 0.45);
    --phs-shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.6);

    --phs-rgb-text-primary: 147, 197, 253;
    --phs-rgb-link: 147, 197, 253;
    --phs-rgb-link-hover: 191, 219, 254;
    --phs-rgb-success: 74, 222, 128;
    --phs-rgb-danger: 248, 113, 113;
    --phs-rgb-warning: 252, 211, 77;
    --phs-rgb-info: 125, 211, 252;
    --phs-rgb-light: 27, 39, 68;
    --phs-rgb-dark: 229, 231, 235;
    --phs-rgb-body: 223, 227, 234;
    --phs-rgb-emphasis: 244, 246, 251;
    --phs-rgb-body-bg: 22, 33, 62;
    --phs-rgb-secondary: 36, 51, 82;
    --phs-rgb-gray-100: 27, 39, 68;
    --phs-rgb-gray-200: 36, 51, 82;
    --phs-rgb-gray-300: 51, 78, 104;
    --phs-rgb-gray-400: 71, 85, 105;
    --phs-rgb-gray-500: 167, 174, 187;
    --phs-rgb-gray-600: 167, 174, 187;
    --phs-rgb-gray-700: 203, 213, 225;
    --phs-rgb-gray-800: 229, 231, 235;
    --phs-rgb-gray-900: 244, 246, 251;

    --phs-gray-100: #1b2744;
    --phs-gray-200: #243352;
    --phs-gray-300: #334e68;
    --phs-gray-400: #475569;
    --phs-gray-500: #a7aebb;
    --phs-gray-600: #a7aebb;
    --phs-gray-700: #cbd5e1;
    --phs-gray-800: #e5e7eb;
    --phs-gray-900: #f4f6fb;
}

/* -------------------------------------------------------------------------------------
   3. Motion
   ------------------------------------------------------------------------------------- */
/* Reduce motion (OS setting): every token-driven animation becomes instant. */
@media (prefers-reduced-motion: reduce) {
    :root {
        --phs-motion-fast: 0ms !important;
        --phs-motion-medium: 0ms !important;
        --phs-motion-slow: 0ms !important;
        --phs-motion-rise: 0px !important;
        --phs-motion-scale: 1 !important;
    }
}

/* Header height per text size (measured with Open Sans), so the side menu sits right from the
   first paint. Fontsizeadjuster.js still measures the real header and corrects it (View As bar,
   banners); before, the 60px default made the side menu jump 5 to 23px after load. */
html[data-font-level="1"] { --phs-app-header-height: 65px; }
html[data-font-level="2"] { --phs-app-header-height: 66px; }
html[data-font-level="3"] { --phs-app-header-height: 72px; }
html[data-font-level="4"] { --phs-app-header-height: 78px; }
html[data-font-level="5"] { --phs-app-header-height: 83px; }

/* -------------------------------------------------------------------------------------
   4. Aliases: old names keep working and follow the theme.
   Same specificity as the site.css token blocks and loaded later, so these win.
   ------------------------------------------------------------------------------------- */
:root {
    /* older --phs-* names */
    --phs-ink-primary: var(--phs-ink-heading);
    /* --phs-border-default, -subtle and -card keep their site.css values (light gray in both
       themes): about 80 dark-mode rules use them as light text. */
    /* Accent / ADA link: filled buttons use them behind white text, so one dark blue in both themes. */
    --phs-accent-link: #1d4ed8;
    --phs-link-ada: #1d4ed8;
    --phs-primary-action: var(--phs-primary);
    --phs-primary-action-hover: var(--phs-primary-hover);
    --phs-primary-gradient: var(--phs-primary);
    --phs-header-bar: var(--phs-surface-header);
    --phs-focus-ring: 0 0 0 var(--phs-focus-width) var(--phs-focus);
    --phs-focus-ring-strong: 0 0 0 3px var(--phs-focus);
    --phs-shadow-ambient-sm: var(--phs-shadow-sm);
    --phs-shadow-ambient-md: var(--phs-shadow-md);
    --phs-status-success: var(--phs-success-text);
    --phs-status-danger: var(--phs-danger-text);
    --phs-status-warning: var(--phs-warning-text);
    --phs-status-info: var(--phs-info-text);
    --phs-status-neutral: var(--phs-neutral-text);
    --phs-transition: background-color var(--phs-motion-fast) var(--phs-ease-standard), color var(--phs-motion-fast) var(--phs-ease-standard), border-color var(--phs-motion-fast) var(--phs-ease-standard), box-shadow var(--phs-motion-fast) var(--phs-ease-standard), opacity var(--phs-motion-fast) var(--phs-ease-standard);

    /* legacy names */
    --primary-gradient: var(--phs-primary);
    --bg-primary: var(--phs-surface-page);
    --bg-secondary: var(--phs-surface-card);
    --bg-card: var(--phs-surface-card);
    --card-bg: var(--phs-surface-card);
    --bg-header: var(--phs-surface-header);
    --header-bg: var(--phs-surface-header);
    --text-primary: var(--phs-ink-heading);
    --text-secondary: var(--phs-ink-body);
    --text-muted: var(--phs-ink-muted);
    --border-color: var(--phs-border);
    --shadow-sm: var(--phs-shadow-sm);
    --shadow-md: var(--phs-shadow-md);
    --shadow-lg: var(--phs-shadow-lg);
    --transition: var(--phs-transition);
}

/* -------------------------------------------------------------------------------------
   5. Bootstrap / Metronic bridge
   Metronic keeps 131 of these only under [data-bs-theme=...], which the portal never sets,
   so they were undefined; the rest had light values in both themes. Mapping them once to
   the tokens makes the theme's own cards, tables, menus, alerts and text utilities follow
   data-theme. Because the tokens switch, this block needs no dark copy (the -rgb triplets
   switch with the tokens too).
   Note for dark mode: --bs-primary, --bs-success, --bs-danger, --bs-warning and --bs-info
   are the TEXT colors (light shades); their -inverse is dark ink, so .badge-success and
   friends stay readable. Buttons do not use them; phs-components.css styles .btn directly.
   ------------------------------------------------------------------------------------- */
:root {
    /* type */
    --bs-font-sans-serif: var(--phs-font-family);
    --bs-body-font-family: var(--phs-font-family);
    --bs-font-monospace: var(--phs-font-mono);
    --bs-body-line-height: var(--phs-leading-normal);

    /* body, headings, links */
    --bs-body-color: var(--phs-ink-body);
    --bs-body-color-rgb: var(--phs-rgb-body);
    --bs-body-bg: var(--phs-surface-card);
    --bs-body-bg-rgb: var(--phs-rgb-body-bg);
    --bs-emphasis-color: var(--phs-ink-heading);
    --bs-emphasis-color-rgb: var(--phs-rgb-emphasis);
    --bs-heading-color: var(--phs-ink-heading);
    --bs-secondary-color: var(--phs-ink-muted);
    --bs-secondary-bg: var(--phs-surface-muted);
    --bs-secondary-bg-rgb: var(--phs-rgb-secondary);
    --bs-tertiary-color: var(--phs-ink-muted);
    --bs-tertiary-bg: var(--phs-surface-subtle);
    --bs-link-color: var(--phs-ink-link);
    --bs-link-color-rgb: var(--phs-rgb-link);
    --bs-link-hover-color: var(--phs-ink-link-hover);
    --bs-link-hover-color-rgb: var(--phs-rgb-link-hover);
    --bs-highlight-color: var(--phs-warning-tint-ink);
    --bs-highlight-bg: var(--phs-warning-tint);
    --bs-code-bg: var(--phs-surface-muted);

    /* borders and focus */
    --bs-border-color: var(--phs-border);
    --bs-border-color-translucent: var(--phs-border);
    --bs-border-dashed-color: var(--phs-border-strong);
    --bs-focus-ring-color: var(--phs-focus);
    --bs-root-card-border-color: var(--phs-border);
    --bs-root-card-box-shadow: var(--phs-shadow-sm);

    /* gray scale */
    --bs-gray-100: var(--phs-gray-100);
    --bs-gray-200: var(--phs-gray-200);
    --bs-gray-300: var(--phs-gray-300);
    --bs-gray-400: var(--phs-gray-400);
    --bs-gray-500: var(--phs-gray-500);
    --bs-gray-600: var(--phs-gray-600);
    --bs-gray-700: var(--phs-gray-700);
    --bs-gray-800: var(--phs-gray-800);
    --bs-gray-900: var(--phs-gray-900);
    --bs-gray-100-rgb: var(--phs-rgb-gray-100);
    --bs-gray-200-rgb: var(--phs-rgb-gray-200);
    --bs-gray-300-rgb: var(--phs-rgb-gray-300);
    --bs-gray-400-rgb: var(--phs-rgb-gray-400);
    --bs-gray-500-rgb: var(--phs-rgb-gray-500);
    --bs-gray-600-rgb: var(--phs-rgb-gray-600);
    --bs-gray-700-rgb: var(--phs-rgb-gray-700);
    --bs-gray-800-rgb: var(--phs-rgb-gray-800);
    --bs-gray-900-rgb: var(--phs-rgb-gray-900);
    --bs-gray: var(--phs-gray-600);
    --bs-gray-dark: var(--phs-gray-800);
    --bs-text-gray-100: var(--phs-gray-100);
    --bs-text-gray-200: var(--phs-gray-200);
    --bs-text-gray-300: var(--phs-gray-300);
    --bs-text-gray-400: var(--phs-gray-400);
    --bs-text-gray-500: var(--phs-gray-500);
    --bs-text-gray-600: var(--phs-gray-600);
    --bs-text-gray-700: var(--phs-gray-700);
    --bs-text-gray-800: var(--phs-gray-800);
    --bs-text-gray-900: var(--phs-gray-900);

    /* theme colors: primary */
    --bs-primary: var(--phs-text-primary);
    --bs-primary-rgb: var(--phs-rgb-text-primary);
    --bs-primary-active: var(--phs-primary-hover);
    --bs-primary-light: var(--phs-primary-tint);
    --bs-primary-inverse: var(--phs-text-primary-inverse);
    --bs-primary-clarity: var(--phs-primary-tint);
    --bs-primary-text-emphasis: var(--phs-primary-tint-ink);
    --bs-primary-bg-subtle: var(--phs-primary-tint);
    --bs-primary-border-subtle: var(--phs-border-strong);
    --bs-text-primary: var(--phs-text-primary);
    /* success */
    --bs-success: var(--phs-success-text);
    --bs-success-rgb: var(--phs-rgb-success);
    --bs-success-active: var(--phs-success-fill-hover);
    --bs-success-light: var(--phs-success-tint);
    --bs-success-inverse: var(--phs-status-inverse);
    --bs-success-clarity: var(--phs-success-tint);
    --bs-success-text-emphasis: var(--phs-success-tint-ink);
    --bs-success-bg-subtle: var(--phs-success-tint);
    --bs-success-border-subtle: var(--phs-success-border);
    --bs-text-success: var(--phs-success-text);
    /* danger */
    --bs-danger: var(--phs-danger-text);
    --bs-danger-rgb: var(--phs-rgb-danger);
    --bs-danger-active: var(--phs-danger-fill-hover);
    --bs-danger-light: var(--phs-danger-tint);
    --bs-danger-inverse: var(--phs-status-inverse);
    --bs-danger-clarity: var(--phs-danger-tint);
    --bs-danger-text-emphasis: var(--phs-danger-tint-ink);
    --bs-danger-bg-subtle: var(--phs-danger-tint);
    --bs-danger-border-subtle: var(--phs-danger-border);
    --bs-text-danger: var(--phs-danger-text);
    --bs-form-invalid-color: var(--phs-danger-text);
    --bs-form-invalid-border-color: var(--phs-danger-text);
    /* warning */
    --bs-warning: var(--phs-warning-text);
    --bs-warning-rgb: var(--phs-rgb-warning);
    --bs-warning-active: var(--phs-warning-text);
    --bs-warning-light: var(--phs-warning-tint);
    --bs-warning-inverse: var(--phs-status-inverse);
    --bs-warning-clarity: var(--phs-warning-tint);
    --bs-warning-text-emphasis: var(--phs-warning-tint-ink);
    --bs-warning-bg-subtle: var(--phs-warning-tint);
    --bs-warning-border-subtle: var(--phs-warning-border);
    --bs-text-warning: var(--phs-warning-text);
    /* info (Metronic's purple becomes the portal's info blue) */
    --bs-info: var(--phs-info-text);
    --bs-info-rgb: var(--phs-rgb-info);
    --bs-info-active: var(--phs-info-fill-hover);
    --bs-info-light: var(--phs-info-tint);
    --bs-info-inverse: var(--phs-status-inverse);
    --bs-info-clarity: var(--phs-info-tint);
    --bs-info-text-emphasis: var(--phs-info-tint-ink);
    --bs-info-bg-subtle: var(--phs-info-tint);
    --bs-info-border-subtle: var(--phs-info-border);
    --bs-text-info: var(--phs-info-text);
    --bs-form-valid-color: var(--phs-success-text);
    --bs-form-valid-border-color: var(--phs-success-text);
    /* secondary, light, dark */
    --bs-secondary: var(--phs-surface-muted);
    --bs-secondary-rgb: var(--phs-rgb-secondary);
    --bs-secondary-active: var(--phs-surface-pressed);
    --bs-secondary-light: var(--phs-surface-subtle);
    --bs-secondary-inverse: var(--phs-ink-heading);
    --bs-secondary-clarity: var(--phs-surface-muted);
    --bs-secondary-text-emphasis: var(--phs-ink-body);
    --bs-secondary-bg-subtle: var(--phs-surface-subtle);
    --bs-secondary-border-subtle: var(--phs-border);
    --bs-text-secondary: var(--phs-ink-muted);
    --bs-light: var(--phs-surface-subtle);
    --bs-light-rgb: var(--phs-rgb-light);
    --bs-light-active: var(--phs-surface-muted);
    --bs-light-light: var(--phs-surface-card);
    --bs-light-inverse: var(--phs-ink-heading);
    --bs-light-clarity: var(--phs-surface-subtle);
    --bs-light-text-emphasis: var(--phs-ink-body);
    --bs-light-bg-subtle: var(--phs-surface-subtle);
    --bs-light-border-subtle: var(--phs-border);
    --bs-text-light: #f8fafc;           /* light text stays light (used on dark bars) */
    --bs-dark: var(--phs-gray-800);
    --bs-dark-rgb: var(--phs-rgb-dark);
    --bs-dark-active: var(--phs-gray-900);
    --bs-dark-light: var(--phs-surface-muted);
    --bs-dark-inverse: var(--phs-surface-card);
    --bs-dark-clarity: var(--phs-surface-muted);
    --bs-dark-text-emphasis: var(--phs-ink-heading);
    --bs-dark-bg-subtle: var(--phs-surface-muted);
    --bs-dark-border-subtle: var(--phs-border-strong);
    --bs-text-dark: var(--phs-gray-800);
    --bs-text-muted: var(--phs-ink-muted);
    --bs-text-white: #ffffff;

    /* Metronic components that read the theme-only variables */
    --bs-component-active-bg: var(--phs-indicator);
    --bs-component-active-color: var(--phs-on-indicator);
    --bs-component-checked-bg: var(--phs-indicator);
    --bs-component-checked-color: var(--phs-on-indicator);
    --bs-component-hover-bg: var(--phs-surface-hover);
    --bs-component-hover-color: var(--phs-ink-link);
    --bs-input-bg: var(--phs-surface-field);
    --bs-input-color: var(--phs-ink-heading);
    --bs-input-solid-bg: var(--phs-surface-field);
    --bs-input-solid-bg-focus: var(--phs-surface-field);
    --bs-input-solid-color: var(--phs-ink-heading);
    --bs-input-solid-placeholder-color: var(--phs-ink-placeholder);
    --bs-dropdown-bg: var(--phs-surface-raised);
    --bs-dropdown-box-shadow: var(--phs-shadow-md);
    --bs-menu-dropdown-bg-color: var(--phs-surface-raised);
    --bs-menu-dropdown-box-shadow: var(--phs-shadow-md);
    --bs-menu-heading-color: var(--phs-ink-muted);
    --bs-menu-link-color-hover: var(--phs-ink-link);
    --bs-menu-link-color-show: var(--phs-ink-link);
    --bs-menu-link-color-here: var(--phs-ink-link);
    --bs-menu-link-color-active: var(--phs-ink-link);
    --bs-menu-link-bg-color-hover: var(--phs-surface-hover);
    --bs-menu-link-bg-color-show: var(--phs-surface-hover);
    --bs-menu-link-bg-color-here: var(--phs-surface-hover);
    --bs-menu-link-bg-color-active: var(--phs-surface-hover);
    --bs-app-bg-color: var(--phs-surface-page);
    --bs-app-blank-bg-color: var(--phs-surface-page);
    --bs-app-header-base-bg-color: var(--phs-surface-header);
    --bs-app-header-sticky-bg-color: var(--phs-surface-header);
    --bs-drawer-bg-color: var(--phs-surface-raised);
    --bs-drawer-overlay-bg-color: var(--phs-backdrop);
    --bs-overlay-bg: var(--phs-block-scrim);
    --bs-blockui-overlay-bg: var(--phs-block-scrim);
    --bs-table-striped-bg: var(--phs-surface-subtle);
    --bs-symbol-label-bg: var(--phs-surface-muted);
    --bs-symbol-label-color: var(--phs-ink-heading);
    --bs-bullet-bg-color: var(--phs-border-control);
    --bs-scrollbar-color: var(--phs-scrollbar-thumb);
    --bs-scrollbar-hover-color: var(--phs-scrollbar-thumb-hover);
    --bs-tooltip-box-shadow: var(--phs-shadow-md);
}

/* Icons keep their parent's color. Metronic colors every icon with var(--bs-text-muted)
   (style.bundle.css: i.bi, i[class*=" fa-"], ...). Today that variable is undefined, so the
   declaration falls back to the inherited color and icons take their parent's color (green
   checks, red trash cans). The bridge above defines it for .text-muted, which would turn every
   icon gray. Same selectors, loaded right after style.bundle.css, so every rule that colors an
   icon today still wins and nothing else changes. */
i.bi,
i[class*=" fa-"],
i[class*=" fonticon-"],
i[class*=" la-"],
i[class^=fa-],
i[class^=fonticon-],
i[class^=la-] {
    color: inherit;
}

/* Labels: Metronic paints them gray-800 / gray-500 (2.58:1); one rule for both. */
.form-label,
.col-form-label {
    color: var(--phs-ink-label);
}

.form-check-label {
    color: var(--phs-ink-body);
}
