/* ==========================================================================
   SoftHCM theme  -  design tokens
   --------------------------------------------------------------------------
   One source of truth for colour, type, spacing, radius and elevation.
   Modelled on the ParaTech ERP (erp-modern-shell.css) so the products read as
   one family, but keeping the ESS primary blue (#1f58c7) - user decision
   2026-11-15.

   Loaded AFTER bootstrap.min.css and app.min.css. Components (layout shell,
   listing grid, forms) must use these --ess-* tokens, never raw hex values,
   so dark mode and future per-client tuning need only change this block.

   Dark mode follows the template's existing switch: [data-bs-theme="dark"]
   on <body>, set by the top bar's Appearance menu (assets/js/ess-theme.js;
   saved in the theme_customizer cookie).
   ========================================================================== */

:root {
    /* Brand */
    --ess-primary: #1f58c7;
    --ess-primary-rgb: 31, 88, 199;
    --ess-primary-hover: #1a4bab;
    --ess-primary-active: #163f90;
    --ess-primary-soft: #eaf0fb;
    --ess-primary-soft-border: #cfdcf5;
    --ess-on-primary: #ffffff;

    /* Surfaces */
    --ess-page-bg: #f5f6fa;
    --ess-surface: #ffffff;
    --ess-surface-raised: #f2f4f7;   /* table header, toolbar, hover */
    --ess-surface-sunken: #eef1f6;
    --ess-border: #e4e9f2;
    --ess-border-strong: #d3dae6;
    --ess-overlay: rgba(16, 24, 40, .45);

    /* Text */
    --ess-text: #1f2937;
    --ess-text-secondary: #5b6577;
    --ess-text-muted: #636d7f;       /* >= 4.6:1 on white, page, raised and sunken surfaces (was #6b7588: 4.1 - 4.3:1 off white) */
    --ess-link: var(--ess-primary);

    /* Status (text colour + soft background for badges / alerts). Each text colour is >= 4.8:1 on its
       own soft fill and on white (WCAG AA for the 12 px badge text). Was #0f9d58 / #b7791f / #d93a3f /
       #0b7fb3: 3.1 - 4.0:1 on the fills, so every status chip failed AA. */
    --ess-success: #0b7a44;
    --ess-success-soft: #e6f6ee;
    --ess-warning: #8f5b0a;
    --ess-warning-soft: #fdf3e1;
    --ess-danger: #c0282e;
    --ess-danger-soft: #fdecec;
    --ess-info: #086d99;
    --ess-info-soft: #e5f4fb;
    --ess-neutral: #5f6b7a;
    --ess-neutral-soft: #eef0f3;

    /* Solid fills that carry white text (buttons, solid badges). The same in
       both modes: white on these is >= 4.4:1, so they read on light and dark
       pages alike. The template's own fills (#28b765, #52c6ea, #a4a9b4) were
       2.0 - 2.6:1 under white text. */
    --ess-solid-success: #12864d;
    --ess-solid-info: #0a7aac;        /* 4.78:1 under white text (#0b7fb3 was 4.47:1, under AA) */
    --ess-solid-secondary: #5f6b7a;
    --ess-solid-danger: #d93a3f;
    --ess-solid-amber: #b45309;       /* "late / time out" fill with white text */
    --ess-solid-warning: #f1b44c;     /* light fill: takes dark text */
    --ess-on-warning: #2b1d00;

    /* Type */
    --ess-font: "Open Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    --ess-font-mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
    --ess-fs-xs: .75rem;    /* 12 */
    --ess-fs-sm: .8125rem;  /* 13 */
    --ess-fs-base: .875rem; /* 14 */
    --ess-fs-md: 1rem;      /* 16 */
    --ess-fs-lg: 1.125rem;  /* 18 */
    --ess-fs-xl: 1.375rem;  /* 22 */
    --ess-fw-regular: 400;
    --ess-fw-medium: 500;
    --ess-fw-semibold: 600;

    /* Spacing (4px grid) */
    --ess-space-1: 4px;
    --ess-space-2: 8px;
    --ess-space-3: 12px;
    --ess-space-4: 16px;
    --ess-space-5: 24px;
    --ess-space-6: 32px;

    /* Shape & elevation */
    --ess-radius-sm: 8px;
    --ess-radius-md: 12px;
    --ess-radius-lg: 16px;
    --ess-radius-pill: 999px;
    --ess-shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
    --ess-shadow-md: 0 6px 22px rgba(16, 24, 40, .07);
    --ess-shadow-lg: 0 14px 40px rgba(16, 24, 40, .16);
    --ess-focus-ring: 0 0 0 3px rgba(var(--ess-primary-rgb), .25);

    /* Layout */
    --ess-header-height: 60px;
    --ess-sidebar-width: 264px;
    --ess-sidebar-collapsed-width: 72px;
    --ess-content-max: 1600px;

    /* Motion */
    --ess-transition: 180ms;
    --ess-ease: cubic-bezier(.4, 0, .2, 1);
}

[data-bs-theme="dark"] {
    /* #7aa3f2 (was #5b8def): primary text on its soft chip over a raised surface was 3.9:1, now 4.8:1;
       dark text on the button fill 6.8:1. */
    --ess-primary: #7aa3f2;
    --ess-primary-rgb: 122, 163, 242;
    --ess-primary-hover: #96b7f5;
    --ess-primary-active: #b0c9f8;
    --ess-primary-soft: rgba(91, 141, 239, .14);
    --ess-primary-soft-border: rgba(91, 141, 239, .32);
    --ess-on-primary: #0b1220;
    /* Tokens built from other tokens resolve where they are declared, so they
       are re-declared here or dark mode would keep the light-mode blue. */
    --ess-link: var(--ess-primary);
    --ess-focus-ring: 0 0 0 3px rgba(var(--ess-primary-rgb), .25);

    --ess-page-bg: #111418;
    --ess-surface: #181c21;
    --ess-surface-raised: #20252c;
    --ess-surface-sunken: #0d1014;
    --ess-border: #2a3038;
    --ess-border-strong: #39414b;
    --ess-overlay: rgba(0, 0, 0, .6);

    --ess-text: #e6e9ee;
    --ess-text-secondary: #aab2bf;
    --ess-text-muted: #8a93a3;       /* >= 4.6:1 on page, surface and raised (was #7d8695: 4.2:1 on raised) */

    --ess-success: #3ccf8e;
    --ess-success-soft: rgba(60, 207, 142, .14);
    --ess-warning: #f2b84b;
    --ess-warning-soft: rgba(242, 184, 75, .14);
    --ess-danger: #f47c80;           /* >= 4.7:1 on its soft chip over raised (was #f0686c: 4.2:1) */
    --ess-danger-soft: rgba(240, 104, 108, .14);
    --ess-info: #4cc0ef;
    --ess-info-soft: rgba(76, 192, 239, .14);
    --ess-neutral: #a3acb9;
    --ess-neutral-soft: rgba(163, 172, 185, .14);

    --ess-shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --ess-shadow-md: 0 6px 22px rgba(0, 0, 0, .35);
    --ess-shadow-lg: 0 14px 40px rgba(0, 0, 0, .5);
}

/* Standard status badge - every listing uses these instead of inline colours.
   success = Approved/Active/Yes · danger = Rejected/InActive/Blocked ·
   info = Pending · neutral = Canceled/Unapproved · warning = On leave/Invalid */
.ess-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--ess-space-1);
    padding: 2px 10px;
    border-radius: var(--ess-radius-pill);
    font-size: var(--ess-fs-xs);
    font-weight: var(--ess-fw-semibold);
    line-height: 1.6;
    white-space: nowrap;
    background: var(--ess-neutral-soft);
    color: var(--ess-neutral);
}
.ess-badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.ess-badge--success { background: var(--ess-success-soft); color: var(--ess-success); }
.ess-badge--danger  { background: var(--ess-danger-soft);  color: var(--ess-danger); }
.ess-badge--warning { background: var(--ess-warning-soft); color: var(--ess-warning); }
.ess-badge--info    { background: var(--ess-info-soft);    color: var(--ess-info); }
.ess-badge--primary { background: var(--ess-primary-soft); color: var(--ess-primary); }
.ess-badge--neutral { background: var(--ess-neutral-soft); color: var(--ess-neutral); }

/* Bootstrap's light badges (.badge.bg-light / .bg-white / .text-bg-light, usually with .text-dark)
   keep their white-ish fill in dark mode, so the page's light text - or .text-dark on a dark card -
   becomes unreadable. In dark mode they become a raised token surface with token text and a hairline
   border: --ess-text on --ess-surface-raised is ~13:1 (AA needs 4.5:1). Light mode is unchanged.
   The !important matches Bootstrap's own utilities (.bg-light / .text-dark are !important). */
[data-bs-theme="dark"] .badge.bg-light,
[data-bs-theme="dark"] .badge.bg-white,
[data-bs-theme="dark"] .badge.text-bg-light,
[data-bs-theme="dark"] .badge.bg-light-subtle,
[data-bs-theme="dark"] .badge.badge-soft-light {
    background-color: var(--ess-surface-raised) !important;
    color: var(--ess-text) !important;
    border: 1px solid var(--ess-border-strong);
}
/* The quieter variant (.text-muted / .text-secondary), light AND dark: Bootstrap's muted grey on its
   light fill is 4.3:1 (below AA); the secondary token is ~5.6:1 in light and ~7.5:1 in dark mode. */
.badge.bg-light.text-muted,
.badge.bg-light.text-secondary,
[data-bs-theme="dark"] .badge.bg-light.text-muted,
[data-bs-theme="dark"] .badge.bg-light.text-secondary {
    color: var(--ess-text-secondary) !important;
}
[data-bs-theme="dark"] .badge.bg-light .text-dark,
[data-bs-theme="dark"] .badge.bg-light .text-muted,
[data-bs-theme="dark"] .badge.bg-white .text-dark {
    color: inherit !important;
}

/* ==========================================================================
   Shell layer - restyles the existing admin template through its own CSS
   variables wherever it has them, with direct rules only where it does not.
   The sidebar, the top bar and the Appearance menu are in ess-shell.css.
   Order matters: this file loads after app.min.css.
   ========================================================================== */

:root {
    /* The sign-in page's brand panel (Views/Account/Login.cshtml). */
    --ess-sidebar-bg: linear-gradient(180deg, #13214a 0%, #0c1633 100%);
    /* Page backdrop: a faint ESS-blue wash. */
    --ess-page-tint-a: rgba(31, 88, 199, .07);
    --ess-page-tint-b: rgba(58, 120, 236, .045);
}
[data-bs-theme="dark"] {
    --ess-sidebar-bg: linear-gradient(180deg, #0f1730 0%, #0a1024 100%);
    --ess-page-tint-a: rgba(91, 141, 239, .09);
    --ess-page-tint-b: rgba(91, 141, 239, .045);
}

/* Template variables -> tokens. [data-bs-theme="light"] is listed too: the
   shell renders that attribute on <body> in light mode, where Bootstrap's
   own `:root, [data-bs-theme=light]` block would otherwise re-apply the
   template palette (grey #a4a9b4 secondary text, #f8f9fb page) under it. */
:root, [data-bs-theme="light"], [data-bs-theme="dark"] {
    --bs-font-sans-serif: var(--ess-font);
    --bs-body-font-family: var(--ess-font);
    --bs-body-font-size: var(--ess-fs-base);
    --bs-body-bg: var(--ess-page-bg);
    --bs-body-color: var(--ess-text);
    --bs-secondary-bg: var(--ess-surface);
    --bs-tertiary-bg: var(--ess-surface-raised);
    /* Bootstrap scopes --bs-card-bg to .card; screens that borrow it outside a
       card (menu hub, dashboard tiles) fell back to a hard-coded #fff, which
       put light text on white in dark mode. */
    --bs-card-bg: var(--ess-surface);
    --bs-emphasis-color: var(--ess-text);
    --bs-border-color: var(--ess-border);
    --bs-border-color-translucent: var(--ess-border);
    --bs-border-radius: var(--ess-radius-sm);
    --bs-border-radius-lg: var(--ess-radius-md);
    --bs-primary: var(--ess-primary);
    --bs-primary-rgb: var(--ess-primary-rgb);
    --bs-link-color: var(--ess-link);
    --bs-link-hover-color: var(--ess-primary-hover);
    --bs-heading-color: var(--ess-text);
    --bs-secondary-color: var(--ess-text-secondary);
    --bs-header-bg: var(--ess-page-bg);
    --bs-header-item-color: var(--ess-text-secondary);
    --bs-footer-bg: transparent;
    --bs-card-border-radius: var(--ess-radius-md);
}

/* ---- Top bar: blends into the page like the ERP header ---- */
#page-topbar {
    background: var(--ess-page-bg);
    box-shadow: none;
    border-bottom: 1px solid transparent;
}
#page-topbar .page-title {
    font-family: var(--ess-font);
    font-size: var(--ess-fs-lg);
    font-weight: var(--ess-fw-semibold);
    color: var(--ess-text);
    letter-spacing: -.01em;
}
/* The screen title is the page's one <h1> (each screen's own card headings follow it); it keeps the
   21 px the template gave the old <h4> (app.min.css: .page-title-box h4 { font-size: 21px !important }). */
.page-title-box h1.page-title { font-size: 21px !important; line-height: 1.2; }
#page-topbar .header-item { color: var(--ess-text-secondary); }
#page-topbar .header-item:hover { color: var(--ess-primary); }

/* The top bar is fixed: anything scrolled into view (a form opened above the
   list, a validation error, an #anchor) stops below it instead of under it. */
html { scroll-padding-top: calc(var(--bs-header-height, 70px) + var(--ess-space-3)); }
/* Bell count: white on the red dot in every topbar colour. */
#page-topbar .noti-icon .noti-dot { color: #fff; }

/* ---- Keyboard: skip link, focus ring, landmark ---- */
/* Visible only while focused (the first Tab on every page). */
.ess-skip-link {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 10000;
    padding: 10px 16px;
    border-radius: var(--ess-radius-sm);
    background: #1f58c7;   /* ESS blue in both modes: white text 6.4:1 */
    color: #ffffff;
    font-weight: var(--ess-fw-semibold);
    box-shadow: var(--ess-shadow-lg);
    transform: translateY(-160%);
    transition: transform var(--ess-transition) var(--ess-ease);
}
.ess-skip-link:focus { transform: none; color: #ffffff; outline: 2px solid #ffffff; outline-offset: -4px; }
#ess-main:focus { outline: none; }   /* the skip target, not a control */
/* One focus ring for keyboard users, in ESS blue. The template removed the
   outline on header buttons, menu links and dropdown items. Form controls
   keep their own box-shadow ring (ess-forms.css). The sidebar's ring is its
   own (--ess-side-focus, ess-shell.css), visible on either sidebar colour. */
:root { --ess-focus-outline: #1f58c7; }
[data-bs-theme="dark"] { --ess-focus-outline: #7aa3f2; }
:is(a, button, [role="button"], [tabindex]:not([tabindex="-1"]), summary, .btn, .dropdown-item, .nav-link):focus-visible {
    outline: 2px solid var(--ess-focus-outline) !important;
    outline-offset: 2px;
}
.dropdown-item:focus-visible { outline-offset: -2px; }

/* Links inside running text (a sentence, a plain list item, a definition) are underlined: colour
   alone does not mark them (WCAG 1.4.1; axe "link-in-text-block"). Buttons, chips and styled links
   carry a class and are left alone. !important: bootstrap.min.css carries a template a { text-decoration: none !important }. */
.main-content :is(p, dd, li:not([class]), h1, h2, h3, h4, h5, h6) > a:not([class]) { text-decoration: underline !important; text-underline-offset: 2px; }

/* ---- Typography ---- */
body { font-family: var(--ess-font); color: var(--ess-text); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6,
.card-title, .page-title { font-family: var(--ess-font) !important; color: var(--ess-text); }
.text-muted { color: var(--ess-text-muted) !important; }

/* ---- Content cards ---- */
.main-content .card {
    background: var(--ess-surface);
    border: 1px solid var(--ess-border);
    border-radius: var(--ess-radius-md);
    box-shadow: var(--ess-shadow-sm);
}
.main-content .card-header {
    background: transparent;
    border-bottom: 1px solid var(--ess-border);
    padding: var(--ess-space-4) var(--ess-space-5);
}
.main-content .card-body { padding: var(--ess-space-5); }

/* ---- Tables (legacy listings, until each moves to the listing component) ---- */
.main-content .table {
    --bs-table-bg: transparent;
    --bs-table-hover-bg: var(--ess-primary-soft);
    --bs-table-striped-bg: var(--ess-surface-raised);
    color: var(--ess-text);
    font-size: var(--ess-fs-sm);
    margin-bottom: 0;
}
.main-content .table > thead > tr > th,
.main-content .table > thead > tr > td {
    background: var(--ess-surface-raised);
    color: var(--ess-text-secondary);
    font-weight: var(--ess-fw-semibold);
    font-size: var(--ess-fs-xs);
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
    border-bottom: 1px solid var(--ess-border-strong);
    padding: 10px 12px;
    vertical-align: middle;
}
.main-content .table > tbody > tr > td,
.main-content .table > tbody > tr > th {
    padding: 10px 12px;
    vertical-align: middle;
    border-color: var(--ess-border);
}
/* Soften the template's heavy grid: horizontal rules only. */
.main-content .table-bordered > :not(caption) > * > * { border-width: 0 0 1px 0; }
.main-content .table-responsive {
    border-radius: var(--ess-radius-sm);
    border: 1px solid var(--ess-border);
}
.main-content .table caption { color: var(--ess-text-muted); caption-side: bottom; padding: var(--ess-space-3) var(--ess-space-2) 0; }

/* ---- Buttons ---- */
.btn { border-radius: var(--ess-radius-sm); font-weight: var(--ess-fw-semibold); font-size: var(--ess-fs-sm); }
.btn-primary {
    --bs-btn-bg: var(--ess-primary);
    --bs-btn-border-color: var(--ess-primary);
    --bs-btn-hover-bg: var(--ess-primary-hover);
    --bs-btn-hover-border-color: var(--ess-primary-hover);
    --bs-btn-active-bg: var(--ess-primary-active);
    --bs-btn-active-border-color: var(--ess-primary-active);
    --bs-btn-color: var(--ess-on-primary);
    --bs-btn-hover-color: var(--ess-on-primary);
    box-shadow: 0 4px 12px rgba(var(--ess-primary-rgb), .22);
}
.btn:focus-visible { box-shadow: var(--ess-focus-ring); }
.btn-sm { border-radius: 6px; }
/* Solid variants on readable fills (white text >= 4.4:1 in both modes).
   bootstrap.min.css carries a template block that paints these with direct
   background-color values (and !important on :hover/:focus/:active), so the
   overrides are direct properties too. Hover darkens with color-mix. */
.btn-success { --ess-btn-fill: var(--ess-solid-success); }
.btn-info { --ess-btn-fill: var(--ess-solid-info); }
.btn-secondary { --ess-btn-fill: var(--ess-solid-secondary); }
.btn-danger { --ess-btn-fill: var(--ess-solid-danger); }
.btn-warning { --ess-btn-fill: var(--ess-solid-warning); }
.btn:is(.btn-success, .btn-info, .btn-secondary, .btn-danger, .btn-warning) {
    --bs-btn-bg: var(--ess-btn-fill);
    --bs-btn-border-color: var(--ess-btn-fill);
    --bs-btn-color: #fff;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-color: #fff;
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: var(--ess-btn-fill);
    --bs-btn-disabled-border-color: var(--ess-btn-fill);
    color: #fff;
    background-color: var(--ess-btn-fill);
    border-color: var(--ess-btn-fill);
}
.btn:is(.btn-success, .btn-info, .btn-secondary, .btn-danger, .btn-warning):is(:hover, :focus, :active, .active) {
    color: #fff;
    background-color: color-mix(in srgb, var(--ess-btn-fill) 86%, #000) !important;
    border-color: color-mix(in srgb, var(--ess-btn-fill) 86%, #000) !important;
}
/* Soft ("subtle") buttons: tinted fill + status text, from the mode-aware
   tokens (the template hard-codes the light-mode hex, e.g. #1f58c7 text that
   is 2.7:1 on the dark surface, #a4a9b4 that is 2.3:1 on white). */
.btn-subtle-primary { --ess-subtle: var(--ess-primary); --ess-subtle-bg: var(--ess-primary-soft); --ess-subtle-on: var(--ess-on-primary); }
.btn-subtle-secondary { --ess-subtle: var(--ess-text-secondary); --ess-subtle-bg: var(--ess-neutral-soft); --ess-subtle-on: #fff; --ess-subtle-solid: var(--ess-solid-secondary); }
.btn-subtle-success { --ess-subtle: var(--ess-success); --ess-subtle-bg: var(--ess-success-soft); --ess-subtle-on: #fff; --ess-subtle-solid: var(--ess-solid-success); }
.btn-subtle-info { --ess-subtle: var(--ess-info); --ess-subtle-bg: var(--ess-info-soft); --ess-subtle-on: #fff; --ess-subtle-solid: var(--ess-solid-info); }
.btn-subtle-danger { --ess-subtle: var(--ess-danger); --ess-subtle-bg: var(--ess-danger-soft); --ess-subtle-on: #fff; --ess-subtle-solid: var(--ess-solid-danger); }
.btn-subtle-warning { --ess-subtle: var(--ess-warning); --ess-subtle-bg: var(--ess-warning-soft); --ess-subtle-on: var(--ess-on-warning); --ess-subtle-solid: var(--ess-solid-warning); }
.btn:is(.btn-subtle-primary, .btn-subtle-secondary, .btn-subtle-success, .btn-subtle-info, .btn-subtle-danger, .btn-subtle-warning) {
    color: var(--ess-subtle);
    background-color: var(--ess-subtle-bg);
    border-color: transparent;
}
.btn:is(.btn-subtle-primary, .btn-subtle-secondary, .btn-subtle-success, .btn-subtle-info, .btn-subtle-danger, .btn-subtle-warning):is(:hover, :focus, :active, .active) {
    color: var(--ess-subtle-on) !important;
    background-color: var(--ess-subtle-solid, var(--ess-subtle)) !important;
}

/* Outline secondary: the template's #a4a9b4 text/border is 2.3:1 on white. */
.btn-outline-secondary {
    --bs-btn-color: var(--ess-text-secondary);
    --bs-btn-border-color: var(--ess-border-strong);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--ess-solid-secondary);
    --bs-btn-hover-border-color: var(--ess-solid-secondary);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--ess-solid-secondary);
    --bs-btn-active-border-color: var(--ess-solid-secondary);
    --bs-btn-disabled-color: var(--ess-text-muted);
    --bs-btn-disabled-border-color: var(--ess-border);
}

/* Outline primary / danger: the template paints #1f58c7 and #ed5555 in both modes (2.7:1 on the dark
   surface; #ed5555 is 3.5:1 on white). Mode-aware tokens instead; hover fills with the solid colour. */
.btn-outline-primary {
    --bs-btn-color: var(--ess-primary);
    --bs-btn-border-color: var(--ess-primary);
    --bs-btn-hover-color: var(--ess-on-primary);
    --bs-btn-hover-bg: var(--ess-primary);
    --bs-btn-hover-border-color: var(--ess-primary);
    --bs-btn-active-color: var(--ess-on-primary);
    --bs-btn-active-bg: var(--ess-primary-active);
    --bs-btn-active-border-color: var(--ess-primary-active);
    --bs-btn-disabled-color: var(--ess-primary);
    --bs-btn-disabled-border-color: var(--ess-primary);
}
.btn-outline-danger {
    --bs-btn-color: var(--ess-danger);
    --bs-btn-border-color: var(--ess-danger);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--ess-solid-danger);
    --bs-btn-hover-border-color: var(--ess-solid-danger);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--ess-solid-danger);
    --bs-btn-active-border-color: var(--ess-solid-danger);
    --bs-btn-disabled-color: var(--ess-danger);
    --bs-btn-disabled-border-color: var(--ess-danger);
}
.btn-outline-warning {
    --bs-btn-color: var(--ess-warning);
    --bs-btn-border-color: var(--ess-warning);
    --bs-btn-hover-color: var(--ess-on-warning);
    --bs-btn-hover-bg: var(--ess-solid-warning);
    --bs-btn-hover-border-color: var(--ess-solid-warning);
    --bs-btn-active-color: var(--ess-on-warning);
    --bs-btn-active-bg: var(--ess-solid-warning);
    --bs-btn-active-border-color: var(--ess-solid-warning);
    --bs-btn-disabled-color: var(--ess-warning);
    --bs-btn-disabled-border-color: var(--ess-warning);
}
.btn-check:checked + .btn-outline-warning { color: var(--ess-on-warning); background-color: var(--ess-solid-warning); border-color: var(--ess-solid-warning); }
/* Status text utilities: Bootstrap's / the template's fills as text are 1.7 - 3.5:1 on white
   (.text-warning #f4c238 is 1.7:1). The status tokens are >= 4.8:1 in both modes. */
.text-success { color: var(--ess-success) !important; }
.text-danger { color: var(--ess-danger) !important; }
.text-warning { color: var(--ess-warning) !important; }
.text-info { color: var(--ess-info) !important; }
.text-secondary { color: var(--ess-text-secondary) !important; }

/* Solid background utilities used as header strips / badges with white text. */
.bg-success { --bs-success-rgb: 18, 134, 77; }
.bg-info { --bs-info-rgb: 11, 127, 179; }
.bg-danger { --bs-danger-rgb: 217, 58, 63; }
.bg-secondary { --bs-secondary-rgb: 95, 107, 122; }
/* Solid primary fills carry white text too. Dark mode lightens --ess-primary to #7aa3f2 (2.5:1
   under white: the recruitment status badges were unreadable), so the fill keeps the light blue. */
.bg-primary, .text-bg-primary { --bs-primary-rgb: 31, 88, 199; }
/* bootstrap.min.css's template block repaints coloured card headers with
   !important light fills (#2dcc71, #69cded, #ef6c6c, #b2b6c0) under white text. */
.card-header.bg-success { background-color: var(--ess-solid-success) !important; }
.card-header.bg-info { background-color: var(--ess-solid-info) !important; }
.card-header.bg-danger { background-color: var(--ess-solid-danger) !important; }
.card-header.bg-secondary { background-color: var(--ess-solid-secondary) !important; }
/* Chart legends: app.min.css forces #a4a9b4 (2.4:1 on white). */
.apexcharts-legend-text { color: var(--ess-text-secondary) !important; }

.btn.btn-warning,
.btn.btn-warning:is(:hover, :focus, :active, .active, :disabled, .disabled) {
    --bs-btn-color: var(--ess-on-warning);
    --bs-btn-hover-color: var(--ess-on-warning);
    --bs-btn-active-color: var(--ess-on-warning);
    --bs-btn-disabled-color: var(--ess-on-warning);
    color: var(--ess-on-warning) !important;   /* bootstrap.min.css: .btn-warning { color: #fff !important } */
}

/* ---- Forms ---- */
.form-control, .form-select, .input-group-text, .choices__inner {
    border-radius: var(--ess-radius-sm);
    border-color: var(--ess-border-strong);
    background-color: var(--ess-surface);
    color: var(--ess-text);
    font-size: var(--ess-fs-sm);
}
.form-control:focus, .form-select:focus {
    border-color: var(--ess-primary);
    box-shadow: var(--ess-focus-ring);
}
.form-label { color: var(--ess-text-secondary); font-weight: var(--ess-fw-semibold); font-size: var(--ess-fs-sm); }
/* Placeholders (inputs and the Choices.js widgets in every listing filter): Choices draws its
   placeholder at 50% opacity (#8f949b, 3.1:1). The muted token at full opacity is >= 4.6:1. */
.form-control::placeholder, .form-select::placeholder { color: var(--ess-text-muted); opacity: 1; }
.choices__placeholder { color: var(--ess-text-muted); opacity: 1; }

/* ---- Pagination ---- */
.pagination { gap: 4px; flex-wrap: wrap; }
.pagination .page-link,
.pagination li a, .pagination li span {
    border-radius: var(--ess-radius-sm) !important;
    border: 1px solid var(--ess-border);
    color: var(--ess-text-secondary);
    min-width: 34px;
    text-align: center;
    padding: 6px 10px;
    font-size: var(--ess-fs-sm);
    background: var(--ess-surface);
}
.pagination .active > .page-link,
.pagination li.active a, .pagination li.active span {
    background: var(--ess-primary);
    border-color: var(--ess-primary);
    color: var(--ess-on-primary);
}
.pagination li.disabled a, .pagination li.disabled span { opacity: .5; }

/* ---- Dropdowns, modals, alerts ---- */
.dropdown-menu {
    border: 1px solid var(--ess-border);
    border-radius: var(--ess-radius-md);
    box-shadow: var(--ess-shadow-lg);
    padding: var(--ess-space-1);
}
.dropdown-item { border-radius: 6px; font-size: var(--ess-fs-sm); }
.modal-content { border: 0; border-radius: var(--ess-radius-lg); box-shadow: var(--ess-shadow-lg); }
.alert { border-radius: var(--ess-radius-sm); }

/* ---- Footer ---- */
.footer {
    background: transparent;
    border-top: 1px solid var(--ess-border);
    color: var(--ess-text-muted);
    font-size: var(--ess-fs-xs);
}

/* ---- Brand ---- */
.ess-brand-logo { height: 28px; width: auto; max-width: 180px; object-fit: contain; }
/* The sidebar's logo row (the logo on a white tile, both sizes): ess-shell.css. */
.ess-powered-by { display: inline-flex; align-items: center; gap: 6px; color: var(--ess-text-muted); }
.ess-powered-by img { height: 16px; width: 16px; }

/* ==========================================================================
   Page wash behind the chrome (body.ess-shell = the signed-in layout; the
   login page and print are untouched). The sidebar and top bar are in
   ess-shell.css.
   ========================================================================== */
/* The faint wash behind the chrome. A fixed layer (not background-attachment:
   fixed) so scrolling never repaints it. */
body.ess-shell::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(900px 520px at 0% 0%, var(--ess-page-tint-a), transparent 65%),
        radial-gradient(820px 480px at 100% 0%, var(--ess-page-tint-b), transparent 62%);
}

/* ---- Icon-only sidebar ("Small"; default only at 992 - 1199 px): the hover
   flyout's size. The template gave it a fixed 190 px, so longer names ran
   out of it over the page ("Approval Extend Date Travel Settlement"). Its
   colours are the sidebar's (ess-shell.css). ---- */
body.ess-shell[data-sidebar-size="sm"] .vertical-menu #sidebar-menu > ul > li:hover > a { width: calc(var(--ess-flyout-width) + 60px); }
body.ess-shell[data-sidebar-size="sm"] .vertical-menu #sidebar-menu > ul > li:hover > ul {
    width: var(--ess-flyout-width);
    border-radius: 0 0 var(--ess-radius-md) var(--ess-radius-md);
    padding-bottom: var(--ess-space-2);
    box-shadow: var(--ess-shadow-lg);
}
body.ess-shell[data-sidebar-size="sm"] .vertical-menu #sidebar-menu > ul > li:hover > ul a {
    width: auto;
    white-space: normal;
    line-height: 1.35;
}
:root { --ess-flyout-width: 260px; }

/* ---- Mobile ---- */
@media (max-width: 575.98px) {
    .main-content .card-body { padding: var(--ess-space-4); }
}

/* ==========================================================================
   Shared page primitives for module screens (Core HR, Workplace, Assets,
   Help desk, Engagement, Learning). One look per pattern instead of one per
   module (W11 design QA found four tile styles and three empty states).
   - .ess-stats / .ess-stat: figure tiles (value over label), an optional
     3 px status accent on the left (--primary|success|warning|danger|info|
     neutral); an <a class="ess-stat"> is a link tile.
   - .ess-empty: "nothing here" panel, the same look as the listing's empty
     state (.ess-lst__state): dashed frame, icon, centred text.
   ========================================================================== */
.ess-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--ess-space-3);
    margin: 0 0 var(--ess-space-4);
    padding: 0;
    list-style: none;
}
.ess-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    padding: var(--ess-space-3) var(--ess-space-4);
    border: 1px solid var(--ess-border);
    border-left: 3px solid var(--ess-stat-accent, var(--ess-border));
    border-radius: var(--ess-radius-md);
    background: var(--ess-surface);
    box-shadow: var(--ess-shadow-sm);
    color: var(--ess-text);
    text-decoration: none;
}
a.ess-stat { transition: border-color var(--ess-transition) var(--ess-ease); }
a.ess-stat:hover, a.ess-stat:focus-visible { border-color: var(--ess-primary); color: var(--ess-text); }
.ess-stat__value { display: block; font-size: var(--ess-fs-xl); font-weight: var(--ess-fw-semibold); line-height: 1.2; color: var(--ess-text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ess-stat__label { display: block; font-size: var(--ess-fs-sm); color: var(--ess-text-secondary); overflow-wrap: anywhere; }
.ess-stat--primary { --ess-stat-accent: var(--ess-primary); }
.ess-stat--success { --ess-stat-accent: var(--ess-success); }
.ess-stat--warning { --ess-stat-accent: var(--ess-warning); }
.ess-stat--danger { --ess-stat-accent: var(--ess-danger); }
.ess-stat--info { --ess-stat-accent: var(--ess-info); }
.ess-stat--neutral { --ess-stat-accent: var(--ess-neutral); }
/* figures that load after the page: placeholder tiles */
.ess-stats--loading .ess-stat { min-height: 4.25rem; background: var(--ess-surface-raised); box-shadow: none; }

.ess-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--ess-space-2);
    padding: var(--ess-space-6) var(--ess-space-4);
    text-align: center;
    color: var(--ess-text-secondary);
    border: 1px dashed var(--ess-border-strong);
    border-radius: var(--ess-radius-sm);
    overflow-wrap: anywhere;
}
.ess-empty > i, .ess-empty__ico { font-size: 2.25rem; line-height: 1; color: var(--ess-text-muted); }
.ess-empty__title { margin: 0; font-weight: var(--ess-fw-semibold); color: var(--ess-text); }
.ess-empty__text { margin: 0; font-size: var(--ess-fs-sm); }

/* ==========================================================================
   Touch targets on phones (W11 design QA: buttons, inputs and chips were
   26 - 37 px tall at 390 px). Every control a thumb uses is at least 40 px
   tall below 576 px; desktop sizes are unchanged.
   ========================================================================== */
@media (max-width: 575.98px) {
    .main-content :is(.btn, .form-control, .form-select, .choices__inner, .nav-link, .dropdown-item) { min-height: 40px; }
    .main-content .btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
    .main-content :is(.btn.d-block, .btn.w-100) { display: flex; }
    .main-content .form-control-sm, .main-content .form-select-sm { min-height: 40px; }
    .main-content .btn-close { min-width: 40px; min-height: 40px; background-position: center; }
    .main-content summary { min-height: 40px; display: flex; align-items: center; gap: 6px; }
    .main-content .ess-lst { --ess-lst-control-h: 40px; }
    .main-content .ess-rpt { --ess-rpt-control-h: 40px; }
    .main-content :is(.ess-lst, .ess-rpt) .form-control { min-height: 40px; }
}

/* ==========================================================================
   Icon-rail flyouts (992 - 1199 px, data-sidebar-size="sm"): a long group
   (Workplace has 24 screens) ran 800 px below the window. The flyout now
   scrolls inside itself; app.js sets --ess-flyout-max to the room left
   below the hovered icon (the fallback assumes the icon near the top).
   ========================================================================== */
body.ess-shell[data-sidebar-size="sm"] .vertical-menu #sidebar-menu > ul > li:hover > ul {
    max-height: var(--ess-flyout-max, calc(100vh - 140px));
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

/* ==========================================================================
   Reduced motion (WCAG 2.3.3 / 2.2.2): one site-wide switch. Animations and
   transitions finish at once, smooth scrolling stops; loading shimmers and
   busy indicators (spinners, the listing progress bar) keep turning slowly.
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        transition-delay: 0s !important;
        scroll-behavior: auto !important;
    }
    /* Busy indicators keep turning, slowly: a frozen spinner reads as a hung page. */
    .spinner-border, .spinner-grow { animation-duration: 1.5s !important; animation-iteration-count: infinite !important; }
    .ess-lst__progress::after { animation-duration: 3s !important; animation-iteration-count: infinite !important; }
}
