/* ============================================================
   HRM light / dark theme overrides
   ------------------------------------------------------------
   Load order on every page is:
       sb-admin-bs5.css  ->  bootstrap 5.3  ->  theme.css
   Bootstrap 5.3 themes its own components through [data-bs-theme],
   and the leave/overtime markup now uses native BS5 classes, so this
   file is deliberately small. It only covers what Bootstrap's dark
   mode CANNOT reach: the SB Admin layout rules (fixed light colours,
   ID selectors), plus a couple of app-specific helper classes.
   ============================================================ */

/* ---- Theme picker (topbar dropdown) check mark ---- */
.theme-option .theme-check { display: none; }
.theme-option.active .theme-check { display: inline-block; }

/* ---- Table header: proper theme-aware surface (no hardcoded colours) ----
   The list pages mark headers `<thead class="table-dark">` (and set the row's
   inline bg to #707E83). `.table-dark` forces an always-dark header that blends
   into the dark page. Instead, drive the header CELLS from Bootstrap's theme
   variables so they adapt automatically: a "secondary" surface with emphasis
   text — light-grey/dark-text in light mode, dark-grey/light-text in dark mode,
   distinct from the body in both. (`.table-hrm-head` is the same header on
   leave/overtime.) Cell-level + !important so it beats `.table-dark`'s
   var(--bs-table-bg) and the inline row colours. */
/* Covers every header pattern in the app:
   - `.table-hrm-head` rows (leave/overtime + converted history tables)
   - list tables: `<thead class="table-dark">`  (class on the thead)
   - in-form tables: `<tr class="table-dark">`   (class on the row, no thead) */
.table-hrm-head > th,
.table-hrm-head > td,
.table thead.table-dark > tr > th,
.table thead.table-dark > tr > td,
.table tr.table-dark > th,
.table tr.table-dark > td {
    background-color: var(--bs-dark) !important;   /* light mode: dark header (#212529) */
    color: var(--bs-light) !important;             /* on light text (#f8f9fa) */
    /* Bootstrap 5.3 paints table-cell backgrounds with `box-shadow: inset 0 0
       0 9999px var(--bs-table-bg-...)`, which sits ON TOP of background-color.
       `.table-dark` sets that shadow colour to #212529, so without this the
       header renders dark-on-dark in dark mode regardless of background-color.
       Kill the overlay so the background-color above is what actually shows. */
    box-shadow: none !important;
}
/* Only the JS-built list header (row.className="table-hrm-head") lacks inline
   alignment, so it needs centering from CSS. Every other header/bar sets its
   own alignment on the <tr> (centered column headers; left-aligned clickable
   section bars in the PA servlets), which the cells inherit — so the flip above
   deliberately carries NO text-align, to avoid force-centering those bars. */
.table-hrm-head > th,
.table-hrm-head > td {
    text-align: center;
}
/* Dark mode: flip it — a light header on the dark page, so it stands out
   strongly from the (dark) tbody rows. Uses Bootstrap's --bs-light/--bs-dark
   tokens, so still no hardcoded colours. */
[data-bs-theme="dark"] .table-hrm-head > th,
[data-bs-theme="dark"] .table-hrm-head > td,
[data-bs-theme="dark"] .table thead.table-dark > tr > th,
[data-bs-theme="dark"] .table thead.table-dark > tr > td,
[data-bs-theme="dark"] .table tr.table-dark > th,
[data-bs-theme="dark"] .table tr.table-dark > td {
    background-color: var(--bs-light) !important;  /* light header (#f8f9fa) */
    color: var(--bs-dark) !important;              /* dark text (#212529) */
}

/* ---- Table caption ----
   Bootstrap themes <caption> to a muted secondary colour at 75% opacity,
   which reads as washed-out for these bold list titles. Use full body
   colour so the caption is crisp in both light and dark. */
.table > caption { color: var(--bs-body-color); }

/* ---- Incomplete attendance cell highlight (replaces inline "yellow") ----
   --hrm-incomplete-bg is also used directly by JS that sets an inline
   background (attendance / *_approval pages) so the highlight follows the
   theme instead of a hardcoded "yellow". */
:root { --hrm-incomplete-bg: #fff3cd; }
[data-bs-theme="dark"] { --hrm-incomplete-bg: #4d3b00; }
.cell-incomplete { background-color: var(--hrm-incomplete-bg) !important; color: #664d03 !important; }
[data-bs-theme="dark"] .cell-incomplete { color: #ffe08a !important; }

/* Performance-appraisal reviewer comment colours (Superior = blue, HOD = brown).
   Server-built inline styles reference these via var(...,fallback); the fallback
   keeps the Bootstrap-3 desktop view (which never loads this file) blue/brown,
   while dark mode gets lighter, legible shades. */
:root { --hrm-pa-superior: #0000ff; --hrm-pa-hod: #8b4513; }
[data-bs-theme="dark"] { --hrm-pa-superior: #6ea8fe; --hrm-pa-hod: #d69a6a; }

/* ============================================================
   DARK MODE — the SB Admin layout rules (sb-admin-bs5.css) use fixed
   light colours that Bootstrap's dark mode can't reach
   ============================================================ */

/* sb-admin-bs5.css sets `#wrapper #content-wrapper{background-color:#f8f9fc}` — note
   the TWO-ID selector (specificity 2,0,0). The override must match #wrapper too,
   otherwise the page background stays light in dark mode (light text on it then
   becomes unreadable). No Bootstrap equivalent exists for this element. */
[data-bs-theme="dark"] #wrapper #content-wrapper { background-color: #212529; }

/* Topbar: swap the light banner image for a solid dark bar and lift the
   inline grey link colour so it stays legible on dark. */
[data-bs-theme="dark"] #nav_topbar {
    background-image: none !important;
    background-color: #2b3035 !important;
}
[data-bs-theme="dark"] #nav_topbar .nav-link,
[data-bs-theme="dark"] #nav_topbar .btn { color: #dee2e6 !important; }

/* Mobile hamburger toggle: SB Admin fills it light (#eaecf4/#dddfeb) on
   hover/active, which on dark becomes a white circle hiding the (now light)
   icon. Use a subtle translucent highlight so the icon stays visible. */
[data-bs-theme="dark"] .topbar #sidebarToggleTop:hover,
[data-bs-theme="dark"] .topbar #sidebarToggleTop:active,
[data-bs-theme="dark"] .topbar #sidebarToggleTop:focus {
    background-color: rgba(255, 255, 255, .15);
}

/* Brand logo (logo3.png) has a baked-in light background drawn for the light
   header banner. In dark mode swap it for logo3-dark.png — a transparent-background
   variant (generated from the original: connected background flood-filled out,
   golfer silhouette preserved, edges feathered) so it sits cleanly on the dark bar
   with the brand colours intact. */
[data-bs-theme="dark"] #nav_topbar img[src*="logo3"] {
    content: url("../images/logo3-dark.png?v=4");
}

/* sb-admin-bs5.css keeps read-only inputs grey (`.form-control[readonly]
   {background:#eaecf4}`). Bootstrap 5 only re-themes :disabled, not [readonly],
   so readonly fields would stay light in dark mode (light text on them becomes
   unreadable). Re-theme both to a muted dark surface. */
[data-bs-theme="dark"] .form-control[readonly],
[data-bs-theme="dark"] .form-control:disabled,
[data-bs-theme="dark"] .form-select:disabled {
    background-color: var(--bs-secondary-bg);
    color: var(--bs-body-color);
}

/* ============================================================
   Fixed light colours in utilities
   ------------------------------------------------------------
   Bootstrap 5's .bg-light/.bg-white/.text-dark stay light/dark in both
   themes, and SB Admin's .text-gray-800 is a fixed colour too. Re-map
   fixed light backgrounds to dark surfaces and fixed dark text to light.
   (Components BS5 themes itself — cards, dropdowns, modals, inputs,
   list-groups, thumbnails — are intentionally left alone.)
   ============================================================ */

/* Fixed-light background utilities (they use !important, so must we). */
[data-bs-theme="dark"] .bg-light,
[data-bs-theme="dark"] .bg-white { background-color: #2b3035 !important; color: var(--bs-body-color) !important; }

/* Fixed-dark text utilities -> readable light tones. */
[data-bs-theme="dark"] .text-dark,
[data-bs-theme="dark"] .text-gray-800 { color: var(--bs-emphasis-color) !important; }
[data-bs-theme="dark"] .text-body { color: var(--bs-body-color) !important; }
[data-bs-theme="dark"] .text-muted { color: var(--bs-secondary-color) !important; }

/* Sidebar: SB Admin paints it with .bg-gradient-primary (a fixed blue gradient,
   #4e73df -> #224abe). It is not a Bootstrap component — BS5 has no sidebar — so
   it never reacts to data-bs-theme. In dark mode drop the blue for a dark surface
   consistent with the topbar/cards; the text is already light via .sidebar-dark. */
[data-bs-theme="dark"] .sidebar.bg-gradient-primary,
[data-bs-theme="dark"] #accordionSidebar.bg-gradient-primary {
    background-image: none !important;
    background-color: #2b3035 !important;
}

/* ---- calendar.html ---- */
/* Day cells are `card border-0`; in dark mode the card bg matches the page bg,
   so with no border the whole grid vanishes. Give the cells a distinct dark
   surface + border (the !important beats Bootstrap's `.border-0`). */
[data-bs-theme="dark"] .week-row .card {
    background-color: #2b3035;
    border: 1px solid var(--bs-border-color) !important;
}
/* Event pills use `bg-info/bg-warning` + `text-dark` — those backgrounds stay
   light (cyan/yellow) in dark mode, so the text must stay dark. This out-ranks
   the general `.text-dark -> light` rule above (which is for text on the page,
   not on a fixed-light coloured background). */
[data-bs-theme="dark"] .bg-info.text-dark,
[data-bs-theme="dark"] .bg-warning.text-dark { color: #000 !important; }

/* ---- Sidebar expanded submenu (sidemenu.html) ---- */
/* Submenu panel is `.bg-white .collapse-inner` (→ dark surface via the bg-white
   rule above), but sb-admin colours `.collapse-item` dark (#3a3b45), so the
   submenu text is dark-on-dark. Flip it light in dark mode (light mode keeps the
   white panel + dark text). !important beats SB Admin's transient .collapsing rule. */
/* The panel itself (.bg-white .collapse-inner) turns #2b3035 (bg-white override) —
   same as the sidebar — and its light drop-shadow is invisible on dark, so the
   panel has no visible edge. Give it a slightly elevated surface + border + dark
   shadow so it reads as a distinct popover (keeps the markup; no card needed). */
[data-bs-theme="dark"] .sidebar .collapse-inner {
    background-color: #343a40 !important;
    border: 1px solid var(--bs-border-color);
    box-shadow: 0 .5rem 1rem rgba(0,0,0,.5);
}
[data-bs-theme="dark"] .sidebar .collapse-inner .collapse-item { color: rgba(255,255,255,.85) !important; }
[data-bs-theme="dark"] .sidebar .collapse-inner .collapse-item:hover,
[data-bs-theme="dark"] .sidebar .collapse-inner .collapse-item:focus {
    background-color: rgba(255,255,255,.1) !important;
    color: #fff !important;
}
[data-bs-theme="dark"] .sidebar .collapse-inner .collapse-item.active { color: #6ea8fe !important; }

/* ============================================================
   Mobile listing tables: DataTables card layout (portrait)
   In portrait, each #tblActiveList row renders as a full-width card
   showing every column as a bold label + value; landscape keeps the
   table. The label comes from each column's createdCell data-label.
   ============================================================ */

/* The listing tables' batch select-all label. In landscape it must not render
   — its column is a few percent wide — but the checkbox has no other
   accessible name, so hide it the sr-only way rather than with display:none,
   which would drop it from the accessibility tree entirely. The portrait rule
   below unwinds all of this to make it the visible bar label. */
.hrm-selectall {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

@media screen and (orientation: portrait) {
    #tblActiveList { border: 0; }
    #tblActiveList > thead { display: none; }
    #tblActiveList > tbody > tr {
        display: block;
        margin-bottom: .75rem;
        border: 1px solid var(--bs-border-color);
        border-radius: .5rem;
        background: var(--bs-body-bg);
        box-shadow: 0 .125rem .25rem rgba(0, 0, 0, .075);
        overflow: hidden;
    }
    #tblActiveList > tbody > tr > td {
        display: flex;
        gap: .5rem;
        text-align: left !important;
        border: 0;
        border-bottom: 1px solid var(--bs-border-color);
        padding: .45rem .75rem;
        box-shadow: none !important;
    }
    #tblActiveList > tbody > tr > td:last-child { border-bottom: 0; }
    /* Row-select boxes match the select-all bar's 1.5em — they are the control
       tapped most in the card list, and a 16px box under a 24px one reads as a
       mistake. Scoped to the checkbox itself rather than to the cell, because
       the select column's data-label is '' on most pages but 'Select' on
       claimprocess_finance, so a [data-label=""] selector would miss it.
       `margin: 0` drops Bootstrap's .25em top margin: with it, the box sat low
       against a label whose line box is the same 24px height. */
    #tblActiveList > tbody > tr > td input[type="checkbox"] {
        width: 1.5em;
        height: 1.5em;
        margin: 0;
        flex: 0 0 auto;
    }
    #tblActiveList > tbody > tr > td::before {
        content: attr(data-label);
        font-weight: 700;
        flex: 0 0 42%;
    }
    #tblActiveList > tbody > tr > td.dt-empty { display: block; text-align: center !important; }
    #tblActiveList > tbody > tr > td.dt-empty::before { content: ""; }
    /* The row-select checkbox column is built with dtLabel(''), so its ::before
       renders empty but still claims `flex: 0 0 42%` — which would push the box
       42% into the card. Drop the label gutter for unlabelled cells. */
    #tblActiveList > tbody > tr > td[data-label=""]::before { display: none; }

    /* ---- Batch select-all bar ----
       Hiding the whole thead (above) also took the batch select-all checkbox
       with it, leaving no way to select every row on mobile. Re-expose just
       that one header cell as a full-width bar above the cards.
       `:has()` keeps this off the listing tables that have no select-all —
       their header must stay hidden, since a lone data-column heading above
       the cards would read as a stray label. */
    /* Flex columns rather than blocks, so whitespace-only text nodes between
       the tags cannot render as stray line boxes. `border: 0` on the row is
       what actually matters though: once the row is no longer a table-row it
       becomes a block box, so `.table-bordered`'s `border-width: 1px 0` on it
       starts painting — 2px of dead space above the first card, still there on
       the pages that hide the checkbox and collapse the bar. */
    #tblActiveList > thead:has(input[type="checkbox"]) { display: flex; flex-direction: column; }
    #tblActiveList > thead > tr { display: flex; flex-direction: column; border: 0; }
    /* Every header cell except the select-all one stays hidden. The 2nd
       selector must repeat the :has() rather than rely on source order: the
       cell carries .text-center (and emp_training an inline width), so it
       needs its own !important overrides anyway.
       The state test mirrors the per-page scripts that show the checkbox only
       when there are batch-eligible rows — they set `chkAll.style.display`
       ('none' / ''), and CSS cannot read a child's rendered state, so match
       the inline declaration. jQuery .hide() serialises identically; a future
       switch to a utility CLASS for hiding would need this updated. */
    #tblActiveList > thead > tr > th,
    #tblActiveList > thead > tr > td { display: none; }
    #tblActiveList > thead > tr > th:has(input[type="checkbox"]:not([style*="display: none"])),
    #tblActiveList > thead > tr > td:has(input[type="checkbox"]:not([style*="display: none"])) {
        display: flex;
        align-items: center;
        gap: .5rem;
        width: auto !important;
        text-align: left !important;
        border: 0;
        border-radius: .5rem;
        margin-bottom: .75rem;
        padding: .45rem .75rem;
    }
    /* Hand the padding to .hrm-selectall, but ONLY when that label is actually
       in the cell: the label pays it back so the inset belongs to its hit box
       rather than to dead cell padding. Gating on :has() matters because the
       CSS and the markup ship separately — a page served this stylesheet with a
       cached pre-label *_top.html would otherwise render a thin bar where only
       the 16px box responds to taps. Without the label it stays a normal
       padded bar with a working checkbox.
       The selector has to restate the rule above and add :has(.hrm-selectall)
       on top: that rule's :has() argument is an attribute-qualified input,
       which out-specifies a bare class, so a shorter selector here silently
       loses the cascade and the cell keeps double padding. */
    #tblActiveList > thead > tr > th:has(input[type="checkbox"]:not([style*="display: none"])):has(.hrm-selectall),
    #tblActiveList > thead > tr > td:has(input[type="checkbox"]:not([style*="display: none"])):has(.hrm-selectall) {
        padding: 0 0 0 .75rem;
    }
    /* DataTables rewrites every header cell to
         <div class="dt-column-header">
           <span class="dt-column-title">…original content…</span>
           <span class="dt-column-order"></span>
         </div>
       which buries the checkbox and the label two levels under the bar, where
       neither can be a flex item of it. `display: contents` dissolves those
       wrappers so the input and label become the bar's own flex children. It
       is also a no-op on emp_training, whose table is not DataTables-converted
       and whose cell already holds them directly — so one set of rules covers
       both. (.dt-column-order becomes a flex item too, but this column is
       `orderable: false` on every page, so it renders at zero width.) */
    #tblActiveList > thead > tr > th .dt-column-header,
    #tblActiveList > thead > tr > td .dt-column-header,
    #tblActiveList > thead > tr > th .dt-column-title,
    #tblActiveList > thead > tr > td .dt-column-title { display: contents; }

    /* Bigger box on touch. Bootstrap's 1em (16px) is a fussy target on a
       phone, and it is the one part of the bar the label must not cover, so
       its own area is all it gets — 1.5em brings it to 24px. `margin: 0`
       drops Bootstrap's .25em top margin, which would otherwise fight
       `align-items: center` and leave the box sitting low in the bar. */
    #tblActiveList > thead > tr > th input[type="checkbox"],
    #tblActiveList > thead > tr > td input[type="checkbox"] {
        width: 1.5em;
        height: 1.5em;
        margin: 0;
        flex: 0 0 auto;
    }

    /* The bar's label fills everything to the right of the checkbox — the
       whole bar is one tap target, not just the 16px box. `align-self:
       stretch` + flex centering makes the hit box the full bar height. */
    #tblActiveList > thead > tr > th .hrm-selectall,
    #tblActiveList > thead > tr > td .hrm-selectall {
        position: static;
        width: auto;
        height: auto;
        clip-path: none;
        overflow: visible;
        flex: 1;
        align-self: stretch;
        display: flex;
        align-items: center;
        /* The label must NOT bleed left over the checkbox. An earlier version
           did (negative margin, to make literally every pixel of the bar a hit
           target) and it put the label on top of the box, so the checkbox
           stopped being directly hit-testable and every click depended on
           label -> control forwarding. When that forwarding does not happen the
           checkbox cannot be clicked at all. The box owns its own hit area; the
           label takes everything to the right of it. */
        margin: 0;
        padding: .45rem .75rem .45rem 0;
        font-weight: 700;
        cursor: pointer;
    }
}

/* ---- Shared page chrome (moved out of per-page <style>) ---- */
.img-profile { height: 2rem; width: 2rem; }
.topbar { height: 4.375rem; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================
   Dashboard cards (home.html and any other card-based page)
   Shell + header + label/value rows + stat tiles + metric tiles.
   Every colour comes from a Bootstrap 5.3 theme variable, so light
   and dark both work without extra [data-bs-theme] overrides.
   ============================================================ */

.hrm-card {
    /* Drive Bootstrap's own card variables instead of overriding its rules.
       Both radii must be set: BS5.3 derives them independently from
       --bs-border-radius (--bs-card-inner-border-radius does NOT reference
       --bs-card-border-radius), so setting only the outer one left the header
       rounded to the default .375rem while the card was .75rem. */
    --bs-card-border-radius: .75rem;
    --bs-card-inner-border-radius: calc(.75rem - var(--bs-border-width));
    --bs-card-border-color: var(--bs-border-color-translucent);
    --bs-card-spacer-x: .9rem;
    --bs-card-spacer-y: .65rem;
    --bs-card-cap-bg: transparent;
    --bs-card-cap-padding-x: .9rem;
    --bs-card-cap-padding-y: .7rem;
    /* The one colour that can't come from a theme variable: Bootstrap's own
       --bs-box-shadow is fixed black, and 10% black is invisible on a dark
       surface. Dark mode needs far more opacity for the same perceived lift. */
    --hrm-card-shadow: 0 .5rem 1rem rgba(0, 0, 0, .1);

    border-left: 4px solid var(--hrm-card-accent, var(--bs-border-color));
    transition: transform .15s ease, box-shadow .15s ease;
}
/* .65 on the dark page bg composites to about the same perceived step as .1
   does on white, so the hover lift reads equally in both themes. */
[data-bs-theme="dark"] .hrm-card { --hrm-card-shadow: 0 .5rem 1rem rgba(0, 0, 0, .65); }

/* !important beats the .shadow-sm utility that the markup carries. */
.hrm-card:hover { transform: translateY(-2px); box-shadow: var(--hrm-card-shadow) !important; }

/* The filter panel borrows the house card look, but it is a static panel rather
   than a clickable tile: it keeps the accent and radius, not the hover lift. */
search.hrm-card { transition: none; }
search.hrm-card:hover { transform: none; box-shadow: var(--bs-box-shadow-sm) !important; }

/* Card body is the only asymmetric box: roomier at the bottom than the top,
   which a single --bs-card-spacer-y cannot express. */
.hrm-card > .card-body { padding-bottom: .9rem; }
.hrm-card > .card-footer { border-top: 0; padding: 0 .9rem .9rem; }

.hrm-accent-primary { --hrm-card-accent: var(--bs-primary); }
.hrm-accent-success { --hrm-card-accent: var(--bs-success); }
.hrm-accent-info { --hrm-card-accent: var(--bs-info); }
.hrm-accent-warning { --hrm-card-accent: var(--bs-warning); }
.hrm-accent-danger { --hrm-card-accent: var(--bs-danger); }
.hrm-accent-secondary { --hrm-card-accent: var(--bs-secondary); }
/* Extra accents so neighbouring application cards are told apart at a
   glance. Bootstrap has no -subtle/-emphasis pair for these hues, so the
   icon tint is mixed from the base colour (works in light and dark). */
.hrm-accent-orange { --hrm-card-accent: var(--bs-orange); }
.hrm-accent-teal { --hrm-card-accent: var(--bs-teal); }
.hrm-accent-purple { --hrm-card-accent: var(--bs-purple); }
.hrm-accent-pink { --hrm-card-accent: var(--bs-pink); }
.hrm-accent-indigo { --hrm-card-accent: var(--bs-indigo); }
.hrm-icon-orange { --hrm-hue: var(--bs-orange); }
.hrm-icon-teal { --hrm-hue: var(--bs-teal); }
.hrm-icon-purple { --hrm-hue: var(--bs-purple); }
.hrm-icon-pink { --hrm-hue: var(--bs-pink); }
.hrm-icon-indigo { --hrm-hue: var(--bs-indigo); }
.hrm-icon[class*="hrm-icon-"] {
    background-color: color-mix(in srgb, var(--hrm-hue) 16%, var(--bs-body-bg));
    color: color-mix(in srgb, var(--hrm-hue) 70%, var(--bs-emphasis-color));
}

/* ---- Card header: icon tile + title (+ trailing badge / close button) ---- */
.hrm-card-head { display: flex; align-items: center; gap: .6rem; }
.hrm-icon {
    flex: 0 0 auto;
    width: 36px; height: 36px;
    border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .95rem;
}
.hrm-card-title { margin: 0; font-size: .95rem; font-weight: 700; color: var(--bs-emphasis-color); }
a.hrm-card-title:hover { color: var(--bs-primary); }
.hrm-card-sub { font-size: .75rem; color: var(--bs-secondary-color); }

/* ---- Label/value rows. The .hrm-row wrapper is what the page script
   shows/hides; the inner .hrm-line owns the layout, so jQuery .show()
   writing display:block can never flatten the row. ---- */
.hrm-list { display: flex; flex-direction: column; gap: .1rem; }
.hrm-line {
    display: flex; align-items: center; justify-content: space-between;
    gap: .75rem;
    padding: .4rem .5rem;
    border-radius: .5rem;
}
.hrm-row:hover > .hrm-line { background-color: var(--bs-tertiary-bg); }
.hrm-line-label { min-width: 0; font-size: .875rem; }

/* Count pill. Neutral by default; the page script adds bg-*-subtle /
   text-*-emphasis matching the item's createToast type when there is
   something to act on. The fallback background tints itself from the
   current text colour for browsers without color-mix(). */
.hrm-count {
    flex: 0 0 auto;
    display: inline-block;
    min-width: 2.15rem;
    padding: .1rem .5rem;
    border-radius: 1rem;
    font-size: .8rem; font-weight: 700; line-height: 1.5;
    text-align: center;
    color: var(--bs-secondary-color);
    background-color: var(--bs-secondary-bg);
    background-color: color-mix(in srgb, currentColor 14%, transparent);
}
/* Beats Bootstrap's a:hover colour; typed pills keep theirs (!important). */
a.hrm-count, a.hrm-count:hover { color: var(--bs-secondary-color); text-decoration: none; }
a.hrm-count:hover { box-shadow: 0 0 0 2px var(--bs-border-color); }
/* No empty grey blob before the count arrives, or when it is cleared. */
.hrm-count:empty { display: none; }

/* ---- Stat tiles (big numbers) ---- */
.hrm-stat {
    height: 100%;
    padding: .5rem .35rem;
    border-radius: .6rem;
    text-align: center;
    background-color: var(--bs-tertiary-bg);
}
.hrm-stat-num { font-size: 1.5rem; font-weight: 800; line-height: 1.15; }
.hrm-stat-label { font-size: .7rem; line-height: 1.3; color: var(--bs-secondary-color); }
.hrm-stat-date { font-size: .65rem; line-height: 1.3; color: var(--bs-secondary-color); opacity: .85; }

/* ---- Empty state ---- */
.hrm-empty { padding: .9rem .5rem; text-align: center; color: var(--bs-secondary-color); }
.hrm-empty > .fas,
.hrm-empty > .far { display: block; font-size: 1.4rem; opacity: .55; margin-bottom: .35rem; }

/* ---- Announcement items (markup is built by the page script) ---- */
.hrm-ann {
    display: block;
    padding: .55rem .7rem;
    border: 1px solid var(--bs-border-color-translucent);
    border-radius: .6rem;
    background-color: var(--bs-tertiary-bg);
}
.hrm-ann:hover { border-color: var(--bs-primary); text-decoration: none; }
.hrm-ann + .hrm-ann { margin-top: .4rem; }

/* ---- Small status pill, e.g. "All clear" / device name ---- */
.hrm-chip {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .7rem;
    font-weight: 700;
    padding: .15rem .55rem;
    border-radius: 999px;
    white-space: nowrap;
}

/* ---- Recent Announcement: featured item + compact list ----
   Side by side once the card is wide enough (container query, since the
   card can be resized on the dashboard). */
#card_announcement .card { container-type: inline-size; }
@container (min-width: 640px) {
    #divsum_announcement:has(.hrm-ann-list) { display: grid; grid-template-columns: 1.4fr 1fr; gap: .75rem; align-items: start; }
}
.hrm-ann-feature { padding: .75rem .85rem; }
.hrm-ann-chips { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-bottom: .35rem; }
.hrm-ann-date { font-size: .72rem; color: var(--bs-secondary-color); white-space: nowrap; }
.hrm-ann-chips .hrm-ann-date { margin-left: auto; }
.hrm-ann-title { font-weight: 700; color: var(--bs-emphasis-color); line-height: 1.3; }
.hrm-ann-excerpt {
    margin-top: .25rem;
    font-size: .82rem;
    color: var(--bs-secondary-color);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.hrm-ann-excerpt:empty { display: none; }
.hrm-ann-more { display: inline-block; margin-top: .3rem; font-size: .75rem; font-weight: 600; color: var(--bs-primary); }
.hrm-ann-list { display: flex; flex-direction: column; gap: .1rem; margin-top: .5rem; }
@container (min-width: 640px) { .hrm-ann-list { margin-top: 0; } }
.hrm-ann-row {
    display: flex; align-items: center; gap: .55rem;
    padding: .4rem .5rem;
    border-radius: .5rem;
    color: inherit;
    text-decoration: none;
    font-size: .85rem;
}
.hrm-ann-row:hover { background-color: var(--bs-tertiary-bg); color: inherit; }
.hrm-ann-row-title { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hrm-ann-dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background-color: var(--bs-border-color); }
.hrm-ann-dot.is-new { background-color: var(--bs-primary); }
.hrm-ann-all { padding: .35rem .5rem; font-size: .75rem; font-weight: 600; }

/* ---- My Calendar card: month grid + day detail ---- */
.cal-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.cal-title { flex: 1; text-align: center; font-weight: 700; color: var(--bs-emphasis-color); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .2rem; }
.cal-grid > .hrm-empty { grid-column: 1 / -1; }
.cal-grid { position: relative; transition: opacity .15s; }
.cal-grid.is-loading { opacity: .45; pointer-events: none; }
.cal-grid.is-loading::after {
    content: "";
    position: absolute;
    top: 50%; left: 50%;
    width: 1.5rem; height: 1.5rem;
    margin: -.75rem 0 0 -.75rem;
    border: .2em solid var(--bs-secondary-color);
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border .75s linear infinite;
}
.cal-dow { text-align: center; font-size: .62rem; text-transform: uppercase; color: var(--bs-secondary-color); padding-bottom: .15rem; }
.cal-day {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: .15rem;
    min-height: 2.35rem;
    padding: .2rem 0;
    border: 1px solid transparent;
    border-radius: .5rem;
    background: transparent;
    color: var(--bs-body-color);
    font-size: .8rem;
    line-height: 1;
}
.cal-day:hover { background-color: var(--bs-tertiary-bg); }
.cal-day:focus-visible { outline: 2px solid var(--bs-primary); outline-offset: 1px; }
.cal-day.is-off { background-color: var(--bs-secondary-bg); color: var(--bs-secondary-color); }
.cal-day.is-holiday { background-color: var(--bs-danger-bg-subtle); color: var(--bs-danger-text-emphasis); font-weight: 700; }
.cal-day.is-today { border-color: var(--bs-primary); font-weight: 700; }
.cal-day.is-selected { box-shadow: inset 0 0 0 2px var(--bs-primary); }
.cal-dot { width: 6px; height: 6px; border-radius: 50%; }
.cal-dot.is-worked { background-color: var(--bs-success); }
.cal-dot.is-issue { background-color: var(--bs-danger); }
.cal-dot.is-late { background-color: var(--bs-warning); }
.cal-dot.is-info { background-color: var(--bs-info); }
.cal-dot.is-leave { background-color: var(--bs-primary); }
.cal-legend { display: flex; flex-wrap: wrap; gap: .25rem .75rem; margin: .5rem 0; font-size: .68rem; color: var(--bs-secondary-color); }
.cal-legend > span { display: inline-flex; align-items: center; gap: .3rem; }
.cal-key { display: inline-block; flex: 0 0 auto; width: 9px; height: 9px; border-radius: 3px; background-color: var(--bs-border-color); }
.cal-key.is-holiday { background-color: var(--bs-danger); }
.cal-key.is-off { background-color: var(--bs-secondary); }
.cal-key.is-leave { background-color: var(--bs-primary); }
.cal-key.is-worked { background-color: var(--bs-success); }
.cal-key.is-issue { background-color: var(--bs-danger); }
.cal-key.is-late { background-color: var(--bs-warning); }
.cal-key.is-info { background-color: var(--bs-info); }
.cal-detail { padding: .55rem .7rem; border-radius: .6rem; background-color: var(--bs-tertiary-bg); }
.cal-detail-date { font-size: .8rem; font-weight: 700; color: var(--bs-emphasis-color); margin-bottom: .25rem; }
.cal-item { display: flex; align-items: center; gap: .45rem; font-size: .8rem; padding: .1rem 0; }
.cal-detail-empty { font-size: .78rem; color: var(--bs-secondary-color); }

/* ---- Pending Approval rows: nothing waiting = faded; age chip ---- */
.hrm-row.hrm-row-zero > .hrm-line { opacity: .55; }
.hrm-row.hrm-row-zero:hover > .hrm-line { opacity: .85; }
.hrm-age {
    margin-left: auto;
    margin-right: .4rem;
    font-size: .68rem;
    font-weight: 600;
    white-space: nowrap;
    color: var(--bs-secondary-color);
}
.hrm-age.is-warn { color: var(--bs-warning-text-emphasis); }
.hrm-age.is-late { color: var(--bs-danger-text-emphasis); }
.hrm-age::before { content: "\f017"; font-family: "Font Awesome 7 Free"; font-weight: 400; margin-right: .25rem; }

/* ---- Thin share bar under a .hrm-stat number ---- */
.hrm-stat-bar {
    height: 4px;
    margin: .4rem .35rem .25rem;
    border-radius: 2px;
    overflow: hidden;
    background-color: var(--bs-border-color-translucent);
}
.hrm-stat-bar > span { display: block; height: 100%; width: 0; border-radius: 2px; transition: width .4s ease; }

/* ---- "Latest request" / "Next trip" strip under a card's list ---- */
.hrm-last {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .5rem .75rem;
    border-radius: .6rem;
    background-color: var(--bs-tertiary-bg);
    font-size: .82rem;
}
.hrm-last > .fas { flex: 0 0 auto; color: var(--bs-secondary-color); }
.hrm-last-text { min-width: 0; }
.hrm-last-text > div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hrm-last-label { font-size: .68rem; color: var(--bs-secondary-color); }
.hrm-last-sub { font-size: .72rem; color: var(--bs-secondary-color); }

/* ---- Mon-Sun attendance strip (My Attendance card) ---- */
.hrm-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .25rem; }
.hrm-week-day {
    padding: .3rem 0 .25rem;
    border-radius: .5rem;
    text-align: center;
    line-height: 1.1;
}
.hrm-week-day.is-today { background-color: var(--bs-tertiary-bg); box-shadow: inset 0 0 0 1px var(--bs-border-color); }
.hrm-week-dow { font-size: .62rem; text-transform: uppercase; color: var(--bs-secondary-color); }
.hrm-week-num { font-size: .72rem; font-weight: 700; color: var(--bs-emphasis-color); }
.hrm-week-dot {
    width: 12px; height: 12px;
    margin: .25rem auto;
    border-radius: 50%;
    border: 2px solid var(--bs-border-color);
}
.hrm-week-dot.is-success { background-color: var(--bs-success); border-color: var(--bs-success); }
.hrm-week-dot.is-warning { background-color: var(--bs-warning); border-color: var(--bs-warning); }
.hrm-week-dot.is-danger { background-color: var(--bs-danger); border-color: var(--bs-danger); }
.hrm-week-dot.is-info { background-color: var(--bs-info); border-color: var(--bs-info); }
.hrm-week-dot.is-primary { background-color: var(--bs-primary); border-color: var(--bs-primary); }
.hrm-week-dot.is-off { background-color: var(--bs-secondary-bg); border-color: var(--bs-secondary-bg); }

/* ============================================================
   Subordinate Absent and Lateness card (home.html #card_excessive)
   Layout follows the CARD's width (container query), not the
   viewport, because the card can be resized on the dashboard.
   ============================================================ */
.exc-wrap { container-type: inline-size; }
.exc-periods { display: grid; grid-template-columns: 1fr; gap: .75rem; }
.exc-period {
    padding: .7rem;
    border: 1px solid var(--bs-border-color-translucent);
    border-radius: .75rem;
}
.exc-period-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: .25rem .75rem;
    margin-bottom: .55rem;
}
.exc-period-title { font-size: .85rem; font-weight: 700; }
.exc-period-range { font-size: .72rem; color: var(--bs-secondary-color); }
.exc-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
a.exc-tile {
    display: block;
    color: inherit;
    text-decoration: none;
    border: 1px solid transparent;
    transition: border-color .15s, background-color .15s;
}
a.exc-tile:hover { border-color: var(--bs-border-color); background-color: var(--bs-secondary-bg); }
a.exc-tile:focus-visible { outline: 2px solid var(--bs-primary); outline-offset: 1px; }
a.exc-tile.exc-zero { opacity: .5; pointer-events: none; }
.exc-rule { font-size: .62rem; line-height: 1.25; color: var(--bs-secondary-color); opacity: .85; }
@container (min-width: 480px) {
    .exc-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@container (min-width: 900px) {
    .exc-periods { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   Attendance Check card (home.html #card_attendance_check)
   ============================================================ */
.att-wrap { container-type: inline-size; }
.att-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.att-side { display: flex; flex-direction: column; gap: .5rem; }
@container (min-width: 560px) {
    .att-grid { grid-template-columns: 1fr 1fr; align-items: center; }
}
.att-clock {
    font-size: 2.4rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: .02em;
    font-variant-numeric: tabular-nums;
    color: var(--bs-emphasis-color);
}
.att-date { margin-top: .2rem; font-size: .8rem; color: var(--bs-secondary-color); }
.att-btn { padding: .8rem; font-size: 1.05rem; font-weight: 700; border-radius: .75rem; }
.att-status { display: flex; align-items: center; gap: .65rem; padding: .6rem .75rem; border-radius: .75rem; }
.att-status > .fas { font-size: 1.3rem; flex: 0 0 auto; }
.att-status-title { font-size: .9rem; font-weight: 700; line-height: 1.2; }
.att-status-sub { font-size: .72rem; opacity: .85; }
.att-status-sub:empty { display: none; }
.att-last {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .5rem .75rem;
    border-radius: .75rem;
    background-color: var(--bs-tertiary-bg);
    font-size: .85rem;
}
.att-last > .fas { color: var(--bs-secondary-color); }
.att-last-label { font-size: .7rem; color: var(--bs-secondary-color); }

@media (prefers-reduced-motion: reduce) {
    .hrm-card { transition: none; }
    .hrm-card:hover { transform: none; }
}

/* ============================================================
   Leave balance panels (leave_application_top / _form)
   ------------------------------------------------------------
   The headline numbers reuse the .hrm-stat tiles above, so the
   list page and the dashboard card render the same figures the
   same way. The audit detail (entitlement, carry forward, every
   "taken" figure) collapses into a two-column key/value grid.

   IMPORTANT: every row's `display` must come from a CLASS, never
   an inline style. The page script toggles rows with
   `style.display = ""` (see leave_application.html), which wipes
   an inline value and would flatten the layout.
   ============================================================ */

.hrm-balance-head {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: .5rem;
    margin-bottom: .6rem;
}
.hrm-balance-title { font-size: .95rem; font-weight: 700; color: var(--bs-emphasis-color); }
.hrm-balance-asof { font-size: .75rem; color: var(--bs-secondary-color); }

/* ---- Proportional usage bar. Scaled to the sum of its own three segments,
   never to info.total_leave -- see renderUsageBar() for why. ---- */
.hrm-usage-track {
    display: flex;
    height: .5rem;
    border-radius: .25rem;
    overflow: hidden;
    background-color: var(--bs-secondary-bg);
}
.hrm-usage-seg { height: 100%; }
.hrm-usage-taken { background-color: var(--bs-success); }
.hrm-usage-forfeit { background-color: var(--bs-warning); }
/* --bs-secondary, not --bs-secondary-color: the latter is a text colour and
   lands near-black in light mode, which reads as heavier than "taken". */
.hrm-usage-remain { background-color: var(--bs-secondary); }

.hrm-usage-legend {
    display: flex; flex-wrap: wrap; gap: .25rem .9rem;
    margin-top: .35rem;
    font-size: .7rem; color: var(--bs-secondary-color);
}
.hrm-usage-key { display: inline-flex; align-items: center; gap: .3rem; }
.hrm-usage-dot { width: .5rem; height: .5rem; border-radius: .15rem; }
.hrm-usage-key b { color: var(--bs-emphasis-color); }

/* ---- Collapsible "Breakdown" toggle ---- */
.hrm-balance-toggle { font-size: .8rem; }
.hrm-balance-toggle:not(.collapsed) > .fas { transform: rotate(180deg); }
.hrm-balance-toggle > .fas { transition: transform .15s ease; font-size: .7rem; }

/* ---- Key/value detail grid: two columns, one on mobile. Fixed at two
   rather than auto-fit, because these labels are long enough that a
   wide screen would otherwise pack in four cramped columns. ---- */
.hrm-kv { display: grid; grid-template-columns: 1fr 1fr; column-gap: 1.5rem; }
/* Wrapper the script injects "taken" rows into. `contents` lets those
   rows sit directly in the grid instead of stacking in one column. */
.hrm-kv-group { display: contents; }
.hrm-kv-row {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: .75rem;
    padding: .3rem .1rem;
    border-bottom: 1px solid var(--bs-border-color-translucent);
    font-size: .85rem;
}
.hrm-kv-label { min-width: 0; color: var(--bs-secondary-color); }
.hrm-kv-val { flex: 0 0 auto; font-weight: 700; }

/* ---- Form page: compact pill bar that stays put while the (very long)
   apply form scrolls. `top` clears the fixed topbar (.topbar = 4.375rem).
   Sticky is scoped to its containing block, so the sticky element has to be
   a DIRECT child of the tall <form id="frmData"> — not of a short row/col
   wrapper, or it would unstick immediately. ---- */
.hrm-balance-sticky {
    position: sticky; top: 4.375rem; z-index: 3;
    padding: .25rem 0;
    background-color: var(--bs-body-bg);
}
.hrm-balance-bar {
    display: flex; flex-wrap: wrap; align-items: center; gap: .4rem;
    padding: .45rem .6rem;
    border: 1px solid var(--bs-border-color-translucent);
    border-radius: .6rem;
    background-color: var(--bs-tertiary-bg);
}
.hrm-pill {
    display: inline-flex; align-items: baseline; gap: .35rem;
    padding: .15rem .6rem;
    border-radius: 1rem;
    font-size: .75rem; line-height: 1.5;
    color: var(--bs-secondary-color);
    background-color: var(--bs-secondary-bg);
}
.hrm-pill-num { font-size: .9rem; font-weight: 700; color: var(--bs-emphasis-color); }
/* The pill matching the selected leave type; set by changeLeaveType(). */
.hrm-pill-active { box-shadow: 0 0 0 2px var(--bs-primary); }

@media screen and (orientation: portrait) {
    .hrm-kv { grid-template-columns: 1fr; }
    /* Full-width bar on mobile: the pills already wrap, and the rounded
       inset just eats horizontal room on a narrow screen. */
    .hrm-balance-bar { padding: .4rem .45rem; }
    .hrm-pill { font-size: .7rem; }
}

/* ---- Smooth sidebar collapse (AdminLTE-style) ---- */
.sidebar {
    transition: width .3s ease-in-out;
    will-change: width;
}

/* Fade/settle the inner bits instead of snapping them */
.sidebar .nav-item .nav-link,
.sidebar .nav-item .nav-link i,
.sidebar .nav-item .nav-link span,
.sidebar .sidebar-brand,
.sidebar .sidebar-heading {
    transition: padding .3s ease-in-out, font-size .3s ease-in-out, opacity .2s ease-in-out;
}

/* Respect reduced-motion users */
@media (prefers-reduced-motion: reduce) {
    .sidebar,
    .sidebar .nav-item .nav-link,
    .sidebar .nav-item .nav-link i,
    .sidebar .nav-item .nav-link span { transition: none; }
}

/* ---- Sidebar count badges ----
   sb-admin-2 paints these as small red rectangles glued to the end of the label
   text, so they land at a different x on every row, and in the narrow sidebar
   its own rule forces every .nav-link span -- the badge included -- to
   display:block, which drops the badge onto its own line as a full-width bar.

   Fix: pill them, right-align them into a column when labels sit beside the
   icon, and turn them into a corner counter when they don't.

   The !important on the colours is deliberate. sidemenu.html and header.js set
   `background-color: red` inline on ~100 badge elements and inline styles
   outrank plain author CSS, so this is the one place that can recolour them. */
.sidebar { --hrm-sidebar-bg: #4e73df; }
[data-bs-theme="dark"] .sidebar { --hrm-sidebar-bg: #2b3035; }

/* A badge with no count must not render at all. Bootstrap ships `.badge:empty
   { display: none }` for this, but sb-admin-2's `.sidebar .nav-item .nav-link
   span` (higher specificity) forces every span back to block/inline and wins,
   which leaves an empty coloured pill on every menu that has no count yet.
   !important is the only thing that outranks it here. */
.sidebar .badge:empty { display: none !important; }

.sidebar .badge {
    top: 0;                        /* sb-admin-2 nudges .badge up 1px */
    min-width: 1.35rem;
    padding: .18em .45em;
    font-size: .68rem;
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
    border-radius: 999px;
    font-variant-numeric: tabular-nums;   /* 1 / 12 / 99+ keep the same width */

    /* Default tier: a menu with no createToast in home.html is reporting a number,
       not asking for anything, so it stays neutral. Solid grey rather than a
       translucent white, because submenu badges sit on the white .collapse-inner
       panel where a white wash is invisible. #858796 is sb-admin-2's own grey, so
       it reads as muted on the blue gradient, the dark sidebar and the panel. */
    background-color: #858796 !important;
    color: #fff !important;
}

/* The other two tiers mirror the createToast type home.html raises for the same
   item, using the same text-bg-* utility its toast header does:
     danger  -- your own record is broken and only you can fix it
     warning -- something is waiting on you to approve or submit */
.sidebar .badge.text-bg-danger {
    background-color: var(--bs-danger) !important;
    color: #fff !important;
}
.sidebar .badge.text-bg-warning {
    background-color: var(--bs-warning) !important;
    color: #000 !important;
}

/* Narrow sidebar (mobile at any time, desktop when collapsed): the label is
   stacked under the icon, so the badge becomes a corner counter -- same
   geometry sb-admin-2 uses for its own topbar .badge-counter. The ring follows
   the sidebar surface, which flips to #2b3035 in dark mode (see above). */
.sidebar .nav-item .nav-link { position: relative; }
.sidebar .nav-item .nav-link .badge {
    position: absolute;
    top: .35rem;
    right: .5rem;
    transform: scale(.8);
    transform-origin: top right;
    box-shadow: 0 0 0 1.5px var(--hrm-sidebar-bg);
}

/* Desktop, expanded: labels sit beside the icon, so badges right-align instead. */
@media (min-width: 768px) {
    .sidebar:not(.toggled) .nav-item .nav-link { display: flex; align-items: center; }
    /* same idea as the submenu gap, but only on the label so the icon keeps
       sb-admin-2's own .25rem spacing */
    .sidebar:not(.toggled) .nav-item .nav-link span:not(.badge) { padding-right: .4rem; }
    .sidebar:not(.toggled) .nav-item .nav-link .badge {
        position: static;
        margin-left: auto;
        transform: none;
        box-shadow: 0 0 0 1.5px rgba(0, 0, 0, .12);
    }
}

/* Submenu items always show a full-width label, so they always right-align.
   Matches sb-admin-2's own 5-class selector, which sets display:block. */
.sidebar .nav-item .collapse .collapse-inner .collapse-item,
.sidebar .nav-item .collapsing .collapse-inner .collapse-item {
    display: flex;
    align-items: center;
    column-gap: .4rem;   /* keeps a long label off its badge */
}
.sidebar .collapse-inner .collapse-item .badge { margin-left: auto; }

/* ---------------------------------------------------------------------------
   Animated content swaps (list <-> form), driven by getContent()/swapContent()
   in js/main.js. Naming #div_content lifts just that region into its own
   transition group, so the sidebar, topbar and footer stay put instead of
   cross-fading with it.

   This covers in-page swaps only. The cross-document half of the API
   (@view-transition { navigation: auto }) is deliberately NOT used: every page
   ships as empty divs filled by AJAX, so the browser would snapshot the new
   document while still blank and cross-fade the old page to white.

   Guarded on prefers-reduced-motion so the name is never applied when the user
   asked for less movement - main.js skips the transition in that case too, and
   an unused view-transition-name would still force a snapshot.

   The name is attached to a class rather than to #div_content directly, and
   main.js only carries that class for the ~180ms a swap is in flight. A
   view-transition-name creates a STACKING CONTEXT on the element that carries
   it - permanently, not just while animating. Every .modal in this app lives
   inside #div_content, but Bootstrap appends .modal-backdrop to <body>. With a
   standing name on #div_content the modal's z-index:1055 is trapped inside that
   context, which itself sits below the body-level backdrop at z-index:1050, so
   the backdrop paints over the dialog: it looks greyed out and swallows every
   click and keystroke. Keeping the name off between swaps leaves #div_content
   an ordinary element, and the modal reaches the top of the page again.
   --------------------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
    #div_content.hrm-swapping {
        view-transition-name: hrm-content;
    }

    ::view-transition-old(hrm-content),
    ::view-transition-new(hrm-content) {
        animation-duration: 180ms;
        animation-timing-function: ease;
    }

    /* The list and the form are rarely the same height; morphing the box that
       fast reads as a lurch, so only the contents cross-fade. */
    ::view-transition-group(hrm-content) {
        animation-duration: 0s;
    }
}
