/* ═══════════════════════════════════════════════════════════════════════
   WOMS — Soft Neutral theme
   Bootstrap 5.3 companion stylesheet.

   Canvas #FAFAF9 · white cards · one indigo accent · 12px radii ·
   shadows barely visible. Tuned to stay legible on a projector and to
   print without eating toner (see the @media print block at the bottom).

   Layers, in cascade order:
     1. Tokens                 — the whole palette, in one place
     2. Bootstrap globals      — remap --bs-* so utility classes inherit
     3. Bootstrap components   — buttons, forms, nav, tables, badges…
     4. App chrome             — navbar, sidebar, layout, term strip
     5. App components         — page header, cards, stats, DTR, tables
     6. Auth pages             — login / 403
     7. Utilities & print
     8. Dimension              — per-role accent + depth (see layer 8)

   To reskin: edit ONLY the "Accent" block in layer 1 — or, per role, the
   html[data-role="…"] blocks in layer 8. Every accented surface in the
   system resolves through those variables.
═══════════════════════════════════════════════════════════════════════ */

/* ═══ 1. TOKENS ══════════════════════════════════════════════════════ */

:root {
    /* ── Accent — the single hue. Swap these for teal:
       #0D9488 / #0F766E / #F0FDFA / #99F6E4 / #115E59 / 13,148,136 ── */
    --accent:            #4F46E5;   /* indigo-600 — buttons, active nav   */
    --accent-hover:      #4338CA;   /* indigo-700 — hover / pressed       */
    --accent-subtle:     #EEF2FF;   /* indigo-50  — tinted fills          */
    --accent-border:     #C7D2FE;   /* indigo-200 — hairlines on tints    */
    --accent-ink:        #3730A3;   /* indigo-800 — text on subtle fills  */
    --accent-rgb:        79, 70, 229;

    /* ── Neutrals (warm stone — keeps the near-white from going blue) ── */
    --canvas:            #FAFAF9;   /* page background                    */
    --surface:           #FFFFFF;   /* cards, navbar, sidebar, modals     */
    --surface-sunken:    #F5F5F4;   /* table heads, inert fills           */
    --border:            #E7E5E4;   /* hairlines — the main separator     */
    --border-strong:     #D6D3D1;   /* inputs, anything interactive       */

    --ink:               #1C1917;   /* headings, numbers                  */
    --ink-body:          #44403C;   /* body copy                          */
    --ink-muted:         #57534E;   /* secondary text, nav idle           */
    --ink-faint:         #78716C;   /* labels, captions, placeholders     */

    /* ── Semantic — desaturated to sit beside the neutrals ── */
    --ok:      #059669;  --ok-subtle:      #ECFDF5;  --ok-border:      #A7F3D0;  --ok-ink:      #065F46;
    --warn:    #D97706;  --warn-subtle:    #FFFBEB;  --warn-border:    #FDE68A;  --warn-ink:    #92400E;
    --bad:     #DC2626;  --bad-subtle:     #FEF2F2;  --bad-border:     #FECACA;  --bad-ink:     #991B1B;
    --info:    #0891B2;  --info-subtle:    #ECFEFF;  --info-border:    #A5F3FC;  --info-ink:    #155E75;
    --neutral: #57534E;  --neutral-subtle: #F5F5F4;  --neutral-border: #E7E5E4;  --neutral-ink: #44403C;

    /* ── Radii ── */
    --r-sm:  6px;
    --r-md:  8px;    /* buttons, inputs, badges   */
    --r-lg:  12px;   /* cards, modals, stat tiles */

    /* ── Shadows — barely visible by design ── */
    --shadow-xs: 0 1px 2px rgba(28, 25, 23, .04);
    --shadow-sm: 0 1px 3px rgba(28, 25, 23, .05), 0 1px 2px rgba(28, 25, 23, .03);
    --shadow-md: 0 4px 12px rgba(28, 25, 23, .06), 0 1px 3px rgba(28, 25, 23, .04);
    --shadow-lg: 0 12px 32px rgba(28, 25, 23, .10), 0 2px 8px rgba(28, 25, 23, .04);
    --ring:      0 0 0 3px rgba(var(--accent-rgb), .16);

    /* ── Layout ── */
    --sidebar-width:     260px;
    --navbar-height:     56px;
    --term-strip-height: 0px;
}

/* ═══ 2. BOOTSTRAP GLOBALS ═══════════════════════════════════════════
   Remapping these makes .text-primary, .bg-primary, .border-success,
   .bg-*-subtle and friends resolve to the theme with no markup changes. */

:root {
    --bs-body-bg:          var(--canvas);
    --bs-body-color:       var(--ink-body);
    --bs-body-color-rgb:   68, 64, 60;
    --bs-body-font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --bs-body-font-size:   .9375rem;
    --bs-emphasis-color:   var(--ink);
    --bs-heading-color:    var(--ink);
    --bs-secondary-color:  var(--ink-faint);
    --bs-tertiary-bg:      var(--surface-sunken);

    --bs-border-color:             var(--border);
    --bs-border-color-translucent: var(--border);
    --bs-border-radius:            var(--r-md);
    --bs-border-radius-sm:         var(--r-sm);
    --bs-border-radius-lg:         var(--r-lg);
    --bs-border-radius-xl:         var(--r-lg);

    --bs-link-color:       var(--accent);
    --bs-link-color-rgb:   var(--accent-rgb);
    --bs-link-hover-color: var(--accent-hover);

    --bs-primary:     var(--accent);  --bs-primary-rgb:   var(--accent-rgb);
    --bs-secondary:   #57534E;        --bs-secondary-rgb: 87, 83, 78;
    --bs-success:     #059669;        --bs-success-rgb:   5, 150, 105;
    --bs-danger:      #DC2626;        --bs-danger-rgb:    220, 38, 38;
    --bs-warning:     #D97706;        --bs-warning-rgb:   217, 119, 6;
    --bs-info:        #0891B2;        --bs-info-rgb:      8, 145, 178;
    --bs-light:       #F5F5F4;        --bs-light-rgb:     245, 245, 244;
    --bs-dark:        #1C1917;        --bs-dark-rgb:      28, 25, 23;

    --bs-primary-bg-subtle:   var(--accent-subtle);
    --bs-secondary-bg-subtle: var(--neutral-subtle);
    --bs-success-bg-subtle:   var(--ok-subtle);
    --bs-danger-bg-subtle:    var(--bad-subtle);
    --bs-warning-bg-subtle:   var(--warn-subtle);
    --bs-info-bg-subtle:      var(--info-subtle);

    --bs-primary-border-subtle:   var(--accent-border);
    --bs-secondary-border-subtle: var(--neutral-border);
    --bs-success-border-subtle:   var(--ok-border);
    --bs-danger-border-subtle:    var(--bad-border);
    --bs-warning-border-subtle:   var(--warn-border);
    --bs-info-border-subtle:      var(--info-border);

    --bs-primary-text-emphasis:   var(--accent-ink);
    --bs-secondary-text-emphasis: var(--neutral-ink);
    --bs-success-text-emphasis:   var(--ok-ink);
    --bs-danger-text-emphasis:    var(--bad-ink);
    --bs-warning-text-emphasis:   var(--warn-ink);
    --bs-info-text-emphasis:      var(--info-ink);
}

body {
    font-family: var(--bs-body-font-family);
    background: var(--canvas);
    color: var(--ink-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    color: var(--ink);
    letter-spacing: -.011em;
}

.text-muted { color: var(--ink-faint) !important; }

hr, .dropdown-divider { border-color: var(--border); opacity: 1; }

/* ═══ 3. BOOTSTRAP COMPONENTS ════════════════════════════════════════
   Bootstrap hardcodes its brand hex inside component classes, so each one
   gets its CSS vars remapped rather than its properties overridden — that
   keeps every built-in state (hover, active, disabled) working. */

/* ── Buttons ── */
.btn {
    --bs-btn-border-radius: var(--r-md);
    --bs-btn-font-weight: 500;
    --bs-btn-padding-x: 1rem;
    --bs-btn-padding-y: .4375rem;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.btn:focus-visible { box-shadow: var(--ring) !important; }

/* This sheet loads after Bootstrap, so the .btn sizing above would otherwise
   flatten .btn-sm / .btn-lg (same specificity, later wins). Restate them. */
.btn-sm, .btn-group-sm > .btn {
    --bs-btn-padding-y: .25rem;
    --bs-btn-padding-x: .625rem;
    --bs-btn-font-size: .8125rem;
    --bs-btn-border-radius: var(--r-sm);
}
.btn-lg, .btn-group-lg > .btn {
    --bs-btn-padding-y: .5625rem;
    --bs-btn-padding-x: 1.25rem;
    --bs-btn-font-size: 1rem;
    --bs-btn-border-radius: var(--r-md);
}

.btn-primary {
    --bs-btn-bg: var(--accent);
    --bs-btn-border-color: var(--accent);
    --bs-btn-hover-bg: var(--accent-hover);
    --bs-btn-hover-border-color: var(--accent-hover);
    --bs-btn-active-bg: var(--accent-hover);
    --bs-btn-active-border-color: var(--accent-hover);
    --bs-btn-disabled-bg: var(--accent);
    --bs-btn-disabled-border-color: var(--accent);
    --bs-btn-focus-shadow-rgb: var(--accent-rgb);
    box-shadow: var(--shadow-xs);
}

.btn-outline-primary {
    --bs-btn-color: var(--accent);
    --bs-btn-border-color: var(--accent-border);
    --bs-btn-hover-bg: var(--accent);
    --bs-btn-hover-border-color: var(--accent);
    --bs-btn-active-bg: var(--accent-hover);
    --bs-btn-active-border-color: var(--accent-hover);
    --bs-btn-disabled-color: var(--accent);
    --bs-btn-disabled-border-color: var(--accent-border);
    --bs-btn-focus-shadow-rgb: var(--accent-rgb);
}

/* Secondary reads as the neutral "Cancel" button, not a solid grey slab. */
.btn-secondary,
.btn-light {
    --bs-btn-color: var(--ink-body);
    --bs-btn-bg: var(--surface);
    --bs-btn-border-color: var(--border-strong);
    --bs-btn-hover-color: var(--ink);
    --bs-btn-hover-bg: var(--surface-sunken);
    --bs-btn-hover-border-color: var(--border-strong);
    --bs-btn-active-color: var(--ink);
    --bs-btn-active-bg: var(--border);
    --bs-btn-active-border-color: var(--border-strong);
    --bs-btn-disabled-color: var(--ink-faint);
    --bs-btn-disabled-bg: var(--surface);
    --bs-btn-disabled-border-color: var(--border);
    --bs-btn-focus-shadow-rgb: var(--accent-rgb);
    box-shadow: var(--shadow-xs);
}

.btn-outline-secondary {
    --bs-btn-color: var(--ink-muted);
    --bs-btn-border-color: var(--border-strong);
    --bs-btn-hover-color: var(--ink);
    --bs-btn-hover-bg: var(--surface-sunken);
    --bs-btn-hover-border-color: var(--border-strong);
    --bs-btn-active-color: var(--ink);
    --bs-btn-active-bg: var(--border);
    --bs-btn-active-border-color: var(--border-strong);
    --bs-btn-disabled-color: var(--ink-faint);
    --bs-btn-disabled-border-color: var(--border);
}

.btn-success {
    --bs-btn-bg: var(--ok);   --bs-btn-border-color: var(--ok);
    --bs-btn-hover-bg: #047857; --bs-btn-hover-border-color: #047857;
    --bs-btn-active-bg: #047857; --bs-btn-active-border-color: #047857;
    --bs-btn-disabled-bg: var(--ok); --bs-btn-disabled-border-color: var(--ok);
}
.btn-danger {
    --bs-btn-bg: var(--bad);  --bs-btn-border-color: var(--bad);
    --bs-btn-hover-bg: #B91C1C; --bs-btn-hover-border-color: #B91C1C;
    --bs-btn-active-bg: #B91C1C; --bs-btn-active-border-color: #B91C1C;
    --bs-btn-disabled-bg: var(--bad); --bs-btn-disabled-border-color: var(--bad);
}
.btn-warning {
    --bs-btn-color: #fff; --bs-btn-bg: var(--warn); --bs-btn-border-color: var(--warn);
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #B45309; --bs-btn-hover-border-color: #B45309;
    --bs-btn-active-color: #fff; --bs-btn-active-bg: #B45309; --bs-btn-active-border-color: #B45309;
    --bs-btn-disabled-color: #fff; --bs-btn-disabled-bg: var(--warn); --bs-btn-disabled-border-color: var(--warn);
}
.btn-info {
    --bs-btn-color: #fff; --bs-btn-bg: var(--info); --bs-btn-border-color: var(--info);
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #0E7490; --bs-btn-hover-border-color: #0E7490;
    --bs-btn-active-color: #fff; --bs-btn-active-bg: #0E7490; --bs-btn-active-border-color: #0E7490;
    --bs-btn-disabled-color: #fff; --bs-btn-disabled-bg: var(--info); --bs-btn-disabled-border-color: var(--info);
}

.btn-outline-danger {
    --bs-btn-color: var(--bad); --bs-btn-border-color: var(--bad-border);
    --bs-btn-hover-bg: var(--bad); --bs-btn-hover-border-color: var(--bad);
    --bs-btn-active-bg: #B91C1C; --bs-btn-active-border-color: #B91C1C;
}
.btn-outline-warning {
    --bs-btn-color: var(--warn-ink); --bs-btn-border-color: var(--warn-border);
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--warn); --bs-btn-hover-border-color: var(--warn);
}
.btn-outline-info {
    --bs-btn-color: var(--info-ink); --bs-btn-border-color: var(--info-border);
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--info); --bs-btn-hover-border-color: var(--info);
}
.btn-outline-success {
    --bs-btn-color: var(--ok-ink); --bs-btn-border-color: var(--ok-border);
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--ok); --bs-btn-hover-border-color: var(--ok);
}

.btn-link {
    --bs-btn-color: var(--accent);
    --bs-btn-hover-color: var(--accent-hover);
    text-decoration: none;
}

/* ── Forms ── */
.form-control, .form-select {
    background-color: var(--surface);
    border-color: var(--border-strong);
    border-radius: var(--r-md);
    color: var(--ink-body);
    font-size: .9rem;
    padding: .4375rem .75rem;
    transition: border-color .15s ease, box-shadow .15s ease;
}
/* .form-select needs its right gutter back or the text runs under the caret. */
.form-select { padding-right: 2.25rem; }
.form-control:focus, .form-select:focus {
    background-color: var(--surface);
    border-color: var(--accent);
    box-shadow: var(--ring);
    color: var(--ink);
}
.form-control::placeholder { color: var(--ink-faint); opacity: 1; }
.form-control:disabled, .form-select:disabled, .form-control[readonly] {
    background-color: var(--surface-sunken);
    color: var(--ink-faint);
}

.form-label {
    font-size: .8125rem;
    font-weight: 500;
    color: var(--ink-muted);
    margin-bottom: .3125rem;
}
.form-text { color: var(--ink-faint); font-size: .78rem; }

.input-group-text {
    background: var(--surface-sunken);
    border-color: var(--border-strong);
    color: var(--ink-muted);
    font-size: .875rem;
}

/* Same cascade problem as .btn-sm: the base rules above out-rank Bootstrap's
   small variants purely on source order. Restate the small sizes. */
.form-control-sm,
.input-group-sm > .form-control,
.input-group-sm > .input-group-text {
    padding: .25rem .5rem;
    font-size: .8125rem;
    border-radius: var(--r-sm);
}
.form-select-sm,
.input-group-sm > .form-select {
    padding: .25rem 2rem .25rem .5rem;
    font-size: .8125rem;
    border-radius: var(--r-sm);
}
.form-control-lg, .form-select-lg {
    padding: .5rem .875rem;
    font-size: 1rem;
    border-radius: var(--r-md);
}
.form-select-lg { padding-right: 2.25rem; }

.form-check-input { border-color: var(--border-strong); }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.form-check-input:focus { border-color: var(--accent); box-shadow: var(--ring); }

/* ── Cards — white on the near-white canvas, held apart by a hairline ── */
.card {
    --bs-card-bg: var(--surface);
    --bs-card-border-color: var(--border);
    --bs-card-border-radius: var(--r-lg);
    --bs-card-inner-border-radius: calc(var(--r-lg) - 1px);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-xs);
}

.card-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: .9rem;
    color: var(--ink);
    padding: .875rem 1.25rem;
    border-radius: var(--r-lg) var(--r-lg) 0 0 !important;
}

.card-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    border-radius: 0 0 var(--r-lg) var(--r-lg) !important;
}

/* ── Dropdowns, modals, offcanvas, list groups, accordions ── */
.dropdown-menu {
    --bs-dropdown-bg: var(--surface);
    --bs-dropdown-border-color: var(--border);
    --bs-dropdown-border-radius: var(--r-lg);
    --bs-dropdown-link-color: var(--ink-body);
    --bs-dropdown-link-hover-bg: var(--surface-sunken);
    --bs-dropdown-link-hover-color: var(--ink);
    --bs-dropdown-link-active-bg: var(--accent-subtle);
    --bs-dropdown-link-active-color: var(--accent-ink);
    --bs-dropdown-header-color: var(--ink-faint);
    --bs-dropdown-item-padding-y: .4375rem;
    box-shadow: var(--shadow-md) !important;
    padding: .375rem;
}
.dropdown-item { border-radius: var(--r-sm); }
.dropdown-header {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 600;
}

.modal-content {
    --bs-modal-bg: var(--surface);
    --bs-modal-border-color: var(--border);
    --bs-modal-border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
}
.modal-header, .modal-footer { border-color: var(--border); }
.modal-title { font-size: 1rem; font-weight: 600; }
.modal-backdrop { --bs-backdrop-bg: #1C1917; --bs-backdrop-opacity: .32; }

.offcanvas { --bs-offcanvas-bg: var(--surface); --bs-offcanvas-border-color: var(--border); }

.list-group {
    --bs-list-group-bg: var(--surface);
    --bs-list-group-border-color: var(--border);
    --bs-list-group-border-radius: var(--r-lg);
    --bs-list-group-action-hover-bg: var(--surface-sunken);
    --bs-list-group-active-bg: var(--accent-subtle);
    --bs-list-group-active-border-color: var(--accent-border);
    --bs-list-group-active-color: var(--accent-ink);
}

.accordion {
    --bs-accordion-bg: var(--surface);
    --bs-accordion-border-color: var(--border);
    --bs-accordion-border-radius: var(--r-lg);
    --bs-accordion-active-bg: var(--accent-subtle);
    --bs-accordion-active-color: var(--accent-ink);
    --bs-accordion-btn-focus-box-shadow: var(--ring);
}

/* ── Tabs & pills ── */
.nav-tabs {
    --bs-nav-tabs-border-color: var(--border);
    --bs-nav-tabs-link-active-color: var(--accent);
    --bs-nav-tabs-link-active-bg: var(--surface);
    --bs-nav-tabs-link-active-border-color: var(--border) var(--border) var(--surface);
    --bs-nav-tabs-link-hover-border-color: var(--border);
}
.nav-tabs .nav-link { font-size: .875rem; font-weight: 500; color: var(--ink-muted); }
.nav-tabs .nav-link:hover { color: var(--ink); }
.nav-tabs .nav-link.active { font-weight: 600; }

.nav-pills {
    --bs-nav-pills-border-radius: var(--r-md);
    --bs-nav-pills-link-active-bg: var(--accent-subtle);
    --bs-nav-pills-link-active-color: var(--accent-ink);
}

/* ── Pagination ── */
.pagination {
    --bs-pagination-color: var(--ink-muted);
    --bs-pagination-bg: var(--surface);
    --bs-pagination-border-color: var(--border);
    --bs-pagination-border-radius: var(--r-md);
    --bs-pagination-hover-color: var(--ink);
    --bs-pagination-hover-bg: var(--surface-sunken);
    --bs-pagination-hover-border-color: var(--border);
    --bs-pagination-active-bg: var(--accent);
    --bs-pagination-active-border-color: var(--accent);
    --bs-pagination-focus-bg: var(--accent-subtle);
    --bs-pagination-focus-box-shadow: var(--ring);
    --bs-pagination-disabled-bg: var(--surface);
    --bs-pagination-disabled-border-color: var(--border);
    --bs-pagination-disabled-color: var(--ink-faint);
}

/* ── Tables ── */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--ink-body);
    --bs-table-border-color: var(--border);
    --bs-table-striped-bg: rgba(28, 25, 23, .018);
    --bs-table-hover-bg: var(--accent-subtle);
    --bs-table-hover-color: var(--ink);
}

/* ── Alerts — flat tints, hairline border, no gradient ── */
.alert {
    --bs-alert-border-radius: var(--r-lg);
    border-width: 1px;
    font-size: .875rem;
}
.alert-primary   { --bs-alert-bg: var(--accent-subtle);  --bs-alert-border-color: var(--accent-border);  --bs-alert-color: var(--accent-ink); }
.alert-success   { --bs-alert-bg: var(--ok-subtle);      --bs-alert-border-color: var(--ok-border);      --bs-alert-color: var(--ok-ink); }
.alert-danger    { --bs-alert-bg: var(--bad-subtle);     --bs-alert-border-color: var(--bad-border);     --bs-alert-color: var(--bad-ink); }
.alert-warning   { --bs-alert-bg: var(--warn-subtle);    --bs-alert-border-color: var(--warn-border);    --bs-alert-color: var(--warn-ink); }
.alert-info      { --bs-alert-bg: var(--info-subtle);    --bs-alert-border-color: var(--info-border);    --bs-alert-color: var(--info-ink); }
.alert-secondary { --bs-alert-bg: var(--neutral-subtle); --bs-alert-border-color: var(--neutral-border); --bs-alert-color: var(--neutral-ink); }

/* ── Badges — subtle pills instead of saturated blocks. The .bg-* classes
   already in the markup are reused as tint hooks, so no PHP changed. ── */
.badge {
    font-weight: 500;
    font-size: .72rem;
    letter-spacing: .01em;
    padding: .3em .6em;
    border-radius: var(--r-sm);
    border: 1px solid transparent;
}
.badge.bg-primary   { background: var(--accent-subtle)  !important; color: var(--accent-ink)  !important; border-color: var(--accent-border); }
.badge.bg-success   { background: var(--ok-subtle)      !important; color: var(--ok-ink)      !important; border-color: var(--ok-border); }
.badge.bg-danger    { background: var(--bad-subtle)     !important; color: var(--bad-ink)     !important; border-color: var(--bad-border); }
.badge.bg-warning   { background: var(--warn-subtle)    !important; color: var(--warn-ink)    !important; border-color: var(--warn-border); }
.badge.bg-info      { background: var(--info-subtle)    !important; color: var(--info-ink)    !important; border-color: var(--info-border); }
.badge.bg-secondary { background: var(--neutral-subtle) !important; color: var(--neutral-ink) !important; border-color: var(--neutral-border); }
.badge.bg-dark      { background: var(--ink)            !important; color: #fff               !important; border-color: var(--ink); }
.badge.bg-light     { background: var(--surface-sunken) !important; color: var(--ink-muted)   !important; border-color: var(--border); }

/* Notification-count bubbles stay solid — they must catch the eye. */
.badge.rounded-pill.bg-danger {
    background: var(--bad) !important;
    color: #fff !important;
    border-color: var(--bad);
}

/* ── Progress ── */
.progress {
    --bs-progress-bg: var(--border);
    --bs-progress-bar-bg: var(--accent);
    --bs-progress-border-radius: 999px;
}

/* ═══ 4. APP CHROME ══════════════════════════════════════════════════ */

.main-layout {
    display: flex;
    min-height: 100vh;
    padding-top: var(--navbar-height);
}

/* ── Top navbar — white, held down by a single hairline ── */
#topNavbar {
    background: var(--surface) !important;
    border-bottom: 1px solid var(--border);
    box-shadow: none !important;
    min-height: var(--navbar-height);
    --bs-navbar-color: var(--ink-muted);
    --bs-navbar-hover-color: var(--ink);
    --bs-navbar-active-color: var(--ink);
    --bs-navbar-brand-color: var(--ink);
    --bs-navbar-brand-hover-color: var(--ink);
}

/* The navbar markup was written for a dark bar; retint its light-on-dark bits. */
#topNavbar .text-white { color: var(--ink-muted) !important; }
#topNavbar .text-white:hover { color: var(--ink) !important; }
#topNavbar .navbar-brand { color: var(--ink) !important; font-size: 1rem; letter-spacing: -.01em; }
#topNavbar .navbar-brand .bi { color: var(--accent); }
#topNavbar .border-white { border-color: var(--border) !important; }
#topNavbar .rounded-circle.bg-white { background: var(--accent-subtle) !important; }
#topNavbar .rounded-circle.bg-white .bi { color: var(--accent); }
#topNavbar .btn-link:focus-visible { box-shadow: var(--ring) !important; border-radius: var(--r-sm); }

/* ── Sidebar — light, so the accent is the only saturated thing on screen ── */
#sidebar {
    width: var(--sidebar-width);
    min-height: calc(100vh - var(--navbar-height));
    background: var(--surface);
    color: var(--ink-muted);
    border-right: 1px solid var(--border);
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    bottom: 0;
    z-index: 1030;
    transition: transform .25s ease;
    overflow-y: auto;
    box-shadow: none;
}

.sidebar-header {
    background: var(--surface);
    color: var(--ink);
    border-color: var(--border) !important;
    font-size: .9375rem;
}
.sidebar-header .bi { color: var(--accent); }

.sidebar-footer { background: var(--surface); border-color: var(--border) !important; }

#sidebar .border-bottom, #sidebar .border-top { border-color: var(--border) !important; }

/* Role pill reads as a quiet label, not a warning light. */
#sidebar .badge {
    font-size: .7rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    font-weight: 600;
}

/* Bootstrap's .nav is `display:flex; flex-wrap:wrap`. Inside a bounded-height
   .flex-column sidebar that makes a long menu wrap into a SECOND COLUMN
   instead of scrolling — the `overflow-y-auto` on the <ul> never engages,
   because wrapping wins first. Force one stack and let it scroll.
   min-height:0 is what actually lets a flex item scroll instead of growing. */
#sidebar .nav {
    flex-wrap: nowrap;
    min-height: 0;
    overflow-x: hidden;
}
#sidebar .nav-item { flex-shrink: 0; }

#sidebar .nav-link {
    position: relative;
    color: var(--ink-muted);
    border-radius: var(--r-md);
    padding: .4375rem .75rem;
    font-size: .875rem;
    font-weight: 500;
    margin-bottom: 1px;
    transition: background .15s ease, color .15s ease;
}
#sidebar .nav-link .bi { color: var(--ink-faint); transition: color .15s ease; }

#sidebar .nav-link:hover { background: var(--surface-sunken); color: var(--ink); }
#sidebar .nav-link:hover .bi { color: var(--ink-muted); }

#sidebar .nav-link.active {
    background: var(--accent-subtle);
    color: var(--accent-ink);
    font-weight: 600;
}
#sidebar .nav-link.active .bi { color: var(--accent); }
#sidebar .nav-link.active::before {
    content: '';
    position: absolute;
    left: -.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 1.125rem;
    border-radius: 0 3px 3px 0;
    background: var(--accent);
}
#sidebar .nav-link:focus-visible { box-shadow: var(--ring); outline: none; }

#sidebar .nav-label {
    font-size: .68rem;
    letter-spacing: .07em;
    color: var(--ink-faint) !important;
    font-weight: 600;
}

/* ── Content wrapper ── */
.content-wrapper {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 1.75rem;
    min-width: 0;
    transition: margin-left .25s ease;
}

/* ── Sidebar overlay (mobile) ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(28, 25, 23, .32);
    z-index: 1020;
}
.sidebar-overlay.show { display: block; }

@media (max-width: 991.98px) {
    #sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    #sidebar.show { transform: translateX(0); }
    .content-wrapper { margin-left: 0; padding: 1rem; }
}

/* ── Term context strip ── */
.term-strip {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    right: 0;
    z-index: 1029;
    border-radius: 0 !important;
    border: 0 !important;
    border-bottom: 1px solid var(--border) !important;
}

body.has-term-strip .main-layout {
    padding-top: calc(var(--navbar-height) + var(--term-strip-height));
}
body.has-term-strip #sidebar {
    top: calc(var(--navbar-height) + var(--term-strip-height));
    min-height: calc(100vh - var(--navbar-height) - var(--term-strip-height));
}

/* ═══ 5. APP COMPONENTS ══════════════════════════════════════════════ */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.page-header h1 {
    font-size: 1.3rem;
    font-weight: 650;
    margin: 0;
    color: var(--ink);
    letter-spacing: -.015em;
}
.page-header h1 .bi { color: var(--accent); }

/* ── Stat cards ──────────────────────────────────────────────────────
   Were four saturated blocks. Now white tiles with a dark number and a
   tinted icon chip — the .bg-* class already on each tile is reused as the
   hook that picks the chip's hue, so no markup changed. ── */
.stat-card {
    border-radius: var(--r-lg);
    padding: 1.125rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--surface) !important;
    color: var(--ink) !important;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
    transition: box-shadow .15s ease, border-color .15s ease;
}
.stat-card:hover { box-shadow: var(--shadow-sm); border-color: var(--border-strong); }

/* Out-specify the !important on Bootstrap's .bg-* / .text-* utilities. */
.stat-card.bg-primary, .stat-card.bg-success, .stat-card.bg-info,
.stat-card.bg-warning, .stat-card.bg-danger, .stat-card.bg-secondary,
.stat-card.bg-dark, .stat-card.text-dark, .stat-card.text-white {
    background: var(--surface) !important;
    color: var(--ink) !important;
}

.stat-card .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--r-md);
    background: var(--surface-sunken);
    color: var(--ink-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-card.bg-primary   .stat-icon { background: var(--accent-subtle);  color: var(--accent); }
.stat-card.bg-success   .stat-icon { background: var(--ok-subtle);      color: var(--ok); }
.stat-card.bg-info      .stat-icon { background: var(--info-subtle);    color: var(--info); }
.stat-card.bg-warning   .stat-icon { background: var(--warn-subtle);    color: var(--warn); }
.stat-card.bg-danger    .stat-icon { background: var(--bad-subtle);     color: var(--bad); }
.stat-card.bg-secondary .stat-icon { background: var(--neutral-subtle); color: var(--neutral); }

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 650;
    line-height: 1.1;
    color: var(--ink);
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
}

.stat-card .stat-label {
    font-size: .78rem;
    color: var(--ink-faint);
    opacity: 1;
    margin-top: .125rem;
    font-weight: 500;
}

/* ── Tables ── */
.table-card .table { margin: 0; font-size: .875rem; }

.table-card .table th {
    background: var(--surface-sunken);
    font-weight: 600;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--ink-faint);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    padding: .625rem .75rem;
}

.table-card .table td {
    vertical-align: middle;
    border-color: var(--border);
    color: var(--ink-body);
    padding: .6875rem .75rem;
}

.table-card .table tbody tr:last-child td { border-bottom: 0; }

/* Clip the table to the card's rounded corners. */
.table-card .card-body.p-0 > .table-responsive {
    border-radius: 0 0 var(--r-lg) var(--r-lg);
}

/* ── Progress (OJT hours) ── */
.hours-progress { height: 6px; border-radius: 999px; background: var(--border); }
.hours-progress .progress-bar { border-radius: 999px; }

/* ── DTR calendar ── */
.dtr-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }

.dtr-cell {
    aspect-ratio: 1;
    border-radius: var(--r-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: .72rem;
    font-weight: 500;
    cursor: default;
    border: 1px solid transparent;
}

.dtr-cell.present { background: var(--ok-subtle);   color: var(--ok-ink);   border-color: var(--ok-border); }
.dtr-cell.absent  { background: var(--bad-subtle);  color: var(--bad-ink);  border-color: var(--bad-border); }
.dtr-cell.excused { background: var(--warn-subtle); color: var(--warn-ink); border-color: var(--warn-border); }
.dtr-cell.holiday { background: var(--info-subtle); color: var(--info-ink); border-color: var(--info-border); }
.dtr-cell.empty   { background: var(--canvas);      color: var(--ink-faint); border-color: var(--border); }
.dtr-cell.today   { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ═══ 6. AUTH PAGES ══════════════════════════════════════════════════
   login.php and 403.php both open with <body class="bg-light">, which is
   the only handle they give us. ── */
body.bg-light { background: var(--canvas) !important; }

body.bg-light .card { box-shadow: var(--shadow-md); border-color: var(--border); }
body.bg-light .card-header.bg-white { background: var(--surface) !important; }

/* Brand mark above the login form. */
body.bg-light .bg-primary.rounded-circle {
    background: var(--accent) !important;
    box-shadow: var(--shadow-sm);
}

/* ═══ 7. UTILITIES & PRINT ═══════════════════════════════════════════ */

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cursor-pointer { cursor: pointer; }

.avatar-sm {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 50%;
    border: 1px solid var(--border);
}

/* Fix: a form wrapping header/body/footer inside a scrollable modal clips
   the footer. Make the form participate in the flex layout instead. */
.modal-dialog-scrollable .modal-content > form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-faint); }

/* ── Print — drop the chrome, keep the data ── */
@media print {
    :root { --canvas: #fff; }

    #topNavbar, #sidebar, .sidebar-overlay, .term-strip,
    .btn, .dropdown, .modal, .pagination { display: none !important; }

    body { background: #fff; color: #000; font-size: 11pt; }

    .main-layout { padding-top: 0; display: block; }
    .content-wrapper { margin-left: 0; padding: 0; }
    body.has-term-strip .main-layout { padding-top: 0; }

    .card, .stat-card {
        box-shadow: none !important;
        border: 1px solid #999 !important;
        break-inside: avoid;
    }

    .card-header { background: #fff !important; }
    .page-header { border-bottom: 1px solid #000; }

    /* Tinted fills vanish on most printers — restate them as borders. */
    .badge, .dtr-cell {
        background: #fff !important;
        color: #000 !important;
        border: 1px solid #666 !important;
    }

    .table-card .table th {
        background: #fff !important;
        color: #000 !important;
        border-bottom: 1px solid #000 !important;
    }

    .table-card .table td { border-color: #ccc !important; }

    a[href]::after { content: ''; }
}

/* ═══ 8. DIMENSION — per-role accent + depth ═════════════════════════
   The login screen sets the visual language: one hue, stacked shadows, a
   lit top edge, buttons that actually travel. This layer carries it into
   the app — and swings the hue per role, so an admin, a coordinator, a
   supervisor and a student each get a distinct system.

   Everything downstream (buttons, links, nav, badges, focus rings, the
   --bs-* remaps in layer 2) already resolves through --accent*, so the
   role blocks below are the only place the hue is named.

   The attribute lives on <html>, not <body>, on purpose: layer 2 declares
   --bs-primary, --ring and friends on :root, and a custom property that
   references var(--accent) resolves against the cascaded value on the SAME
   element. Overriding on <body> would leave every one of those derived
   vars stuck on the default indigo.

   Data surfaces — tables, the DTR grid, form text — stay flat and light.
   Depth is spent on chrome and on things you click. ── */

/* ── 8.1 Role accents ────────────────────────────────────────────── */

:root { --accent-deep: #3730A3; --accent-lite: #818CF8; }   /* pressed edge / lit top stop */

html[data-role="admin"] {                   /* indigo */
    --accent:        #4F46E5;
    --accent-hover:  #4338CA;
    --accent-subtle: #EEF2FF;
    --accent-border: #C7D2FE;
    --accent-ink:    #3730A3;
    --accent-deep:   #312E81;
    --accent-lite:   #818CF8;
    --accent-rgb:    79, 70, 229;
    --nav-top:       #312E81;
    --nav-bottom:    #1E1B4B;
}
html[data-role="coordinator"] {             /* violet */
    --accent:        #7C3AED;
    --accent-hover:  #6D28D9;
    --accent-subtle: #F5F3FF;
    --accent-border: #DDD6FE;
    --accent-ink:    #5B21B6;
    --accent-deep:   #4C1D95;
    --accent-lite:   #A78BFA;
    --accent-rgb:    124, 58, 237;
    --nav-top:       #4C1D95;
    --nav-bottom:    #2E1065;
}
html[data-role="supervisor"] {              /* teal */
    --accent:        #0F766E;
    --accent-hover:  #115E59;
    --accent-subtle: #F0FDFA;
    --accent-border: #99F6E4;
    --accent-ink:    #115E59;
    --accent-deep:   #134E4A;
    --accent-lite:   #14B8A6;
    --accent-rgb:    15, 118, 110;
    --nav-top:       #134E4A;
    --nav-bottom:    #042F2E;
}
html[data-role="student"] {                 /* blue */
    --accent:        #2563EB;
    --accent-hover:  #1D4ED8;
    --accent-subtle: #EFF6FF;
    --accent-border: #BFDBFE;
    --accent-ink:    #1E40AF;
    --accent-deep:   #1E3A8A;
    --accent-lite:   #60A5FA;
    --accent-rgb:    37, 99, 235;
    --nav-top:       #1E3A8A;
    --nav-bottom:    #172554;
}

/* Fallback for any page rendered without the attribute (403, notifications
   before the session settles) — keep the original indigo. */
html:not([data-role]) { --nav-top: #312E81; --nav-bottom: #1E1B4B; }

/* ── 8.2 Elevation ───────────────────────────────────────────────── */

:root {
    /* Three steps of lift. Each is contact + mid + ambient, so a surface
       reads as floating rather than as having a grey halo. */
    --lift-1:
        0 1px 2px rgba(28,25,23,.05),
        0 2px 6px -2px rgba(28,25,23,.07);
    --lift-2:
        0 1px 2px rgba(28,25,23,.06),
        0 6px 14px -6px rgba(28,25,23,.12),
        0 14px 28px -14px rgba(28,25,23,.10);
    --lift-3:
        0 2px 4px rgba(28,25,23,.07),
        0 12px 24px -10px rgba(28,25,23,.16),
        0 28px 48px -20px rgba(28,25,23,.16);
    --edge-lit: inset 0 1px 0 rgba(255,255,255,.9);
    --well: inset 0 2px 4px rgba(28,25,23,.055);
}

/* ── 8.3 Top navbar — glass, held above the page ─────────────────── */

#topNavbar {
    background: rgba(255,255,255,.82) !important;
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(28,25,23,.04), 0 8px 20px -14px rgba(28,25,23,.35) !important;
}

/* The brand mark becomes a small extruded tile in the role hue. */
#topNavbar .navbar-brand .bi {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    font-size: .95rem;
    color: #fff !important;
    background: linear-gradient(155deg,
        var(--accent-lite) 0%,
        var(--accent) 55%,
        var(--accent-deep) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.45),
        0 2px 0 -1px var(--accent-deep),
        0 6px 12px -6px rgba(var(--accent-rgb), .7);
}

#topNavbar .btn-link,
#topNavbar .dropdown > .btn {
    border-radius: 10px;
    transition: background .15s ease, transform .15s ease;
}
#topNavbar .btn-link:hover { background: var(--surface-sunken); }

/* Avatar sits slightly proud of the bar. */
#topNavbar img.rounded-circle,
#topNavbar .rounded-circle.bg-white {
    box-shadow: 0 1px 2px rgba(28,25,23,.12), 0 4px 8px -4px rgba(28,25,23,.35);
}

/* ── 8.4 Sidebar — a deep panel in the role hue ──────────────────── */

#sidebar {
    background: linear-gradient(178deg, var(--nav-top) 0%, var(--nav-bottom) 100%);
    border-right: 0;
    box-shadow: 1px 0 0 rgba(255,255,255,.04) inset, 6px 0 24px -16px rgba(15,14,42,.8);
    color: rgba(255,255,255,.68);
}
/* A soft bloom at the top so the panel doesn't read as a flat rectangle. */
#sidebar::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 240px;
    pointer-events: none;
    background: radial-gradient(120% 100% at 20% 0%, rgba(255,255,255,.10), transparent 70%);
}

#sidebar .sidebar-header,
#sidebar .sidebar-footer { background: transparent; }
#sidebar .border-bottom,
#sidebar .border-top { border-color: rgba(255,255,255,.10) !important; }
#sidebar .sidebar-header { color: #fff; position: relative; }
#sidebar .text-muted { color: rgba(255,255,255,.55) !important; }

/* Brand tile — the same extruded square as the navbar, one size up. */
#sidebar .sidebar-header .bi-briefcase-fill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 1rem;
    color: #fff !important;
    background: linear-gradient(155deg, rgba(255,255,255,.32), rgba(255,255,255,.10));
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.45),
        inset 0 -2px 4px rgba(0,0,0,.25),
        0 6px 14px -8px rgba(0,0,0,.9);
}
#sidebar .sidebar-header .btn-link { color: rgba(255,255,255,.6) !important; }

/* Role pill — a glass chip. Beats the !important tints in layer 3. */
#sidebar .badge {
    background: rgba(255,255,255,.13) !important;
    color: #fff !important;
    border: 1px solid rgba(255,255,255,.20) !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 6px 14px -10px rgba(0,0,0,.9);
    backdrop-filter: blur(8px);
}

#sidebar .nav-label { color: rgba(255,255,255,.42) !important; }

#sidebar .nav-link { color: rgba(255,255,255,.72); }
#sidebar .nav-link .bi { color: rgba(255,255,255,.5); }
#sidebar .nav-link:hover {
    background: rgba(255,255,255,.09);
    color: #fff;
    transform: translateX(2px);
}
#sidebar .nav-link:hover .bi { color: rgba(255,255,255,.85); }

/* The active item is the one raised surface in the panel. */
#sidebar .nav-link.active {
    color: #fff;
    background: linear-gradient(180deg, rgba(255,255,255,.20) 0%, rgba(255,255,255,.11) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.35),
        inset 0 -1px 0 rgba(0,0,0,.18),
        0 8px 18px -10px rgba(0,0,0,.85);
}
#sidebar .nav-link.active .bi { color: #fff; }
#sidebar .nav-link.active::before {
    left: -.25rem;
    width: 3px;
    height: 1.25rem;
    background: #fff;
    box-shadow: 0 0 10px rgba(255,255,255,.9);
}
#sidebar .nav-link:focus-visible {
    box-shadow: 0 0 0 3px rgba(255,255,255,.45);
    outline: none;
}

#sidebar .sidebar-footer .btn-outline-danger {
    --bs-btn-color: rgba(255,255,255,.82);
    --bs-btn-border-color: rgba(255,255,255,.22);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: rgba(220,38,38,.85);
    --bs-btn-hover-border-color: rgba(220,38,38,.9);
    --bs-btn-active-bg: #B91C1C;
    --bs-btn-active-border-color: #B91C1C;
    background: rgba(255,255,255,.06);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.14);
}

/* The global scrollbar rules are tuned for light surfaces. */
#sidebar::-webkit-scrollbar-thumb,
#sidebar .nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.20); }
#sidebar::-webkit-scrollbar-thumb:hover,
#sidebar .nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.35); }

@media (max-width: 991.98px) {
    #sidebar { box-shadow: 12px 0 40px -12px rgba(15,14,42,.7); }
}

/* ── 8.5 Page header ─────────────────────────────────────────────── */

.page-header h1 .bi {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 1rem;
    vertical-align: -.55rem;
    color: #fff !important;
    background: linear-gradient(155deg,
        var(--accent-lite) 0%,
        var(--accent) 55%,
        var(--accent-deep) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.45),
        0 3px 0 -1px var(--accent-deep),
        0 10px 18px -10px rgba(var(--accent-rgb), .8);
}

/* ── 8.6 Cards ───────────────────────────────────────────────────── */

.card {
    position: relative;
    background: linear-gradient(180deg, #FFFFFF 0%, #FDFDFC 100%);
    box-shadow: var(--edge-lit), var(--lift-1);
    transition: box-shadow .2s ease, transform .2s ease;
}
.card > .card-header:first-child::before {   /* lit edge, clipped to the radius */
    content: '';
    position: absolute;
    inset: 0 18% auto;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb), .55), transparent);
}
.card-header { position: relative; background: transparent; }

.modal-content { box-shadow: var(--edge-lit), var(--lift-3); }
.dropdown-menu { box-shadow: var(--edge-lit), var(--lift-2) !important; }

/* ── 8.7 Stat cards — the most dimensional thing on a dashboard ──── */

.stat-card {
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, #FFFFFF 0%, #FCFCFB 100%) !important;
    box-shadow: var(--edge-lit), var(--lift-1);
    transition: transform .2s cubic-bezier(.22,.61,.36,1), box-shadow .2s ease;
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--edge-lit), var(--lift-2);
}

/* Icon chips: gradient face, inset highlight, a solid edge underneath and a
   coloured glow — the same recipe as the login buttons, shrunk. */
.stat-card .stat-icon {
    color: #fff;
    border-radius: 12px;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.45),
        inset 0 -2px 4px rgba(0,0,0,.14),
        0 3px 0 -1px rgba(0,0,0,.16),
        0 10px 18px -10px rgba(0,0,0,.55);
}
.stat-card .stat-icon,
.stat-card.bg-primary   .stat-icon { background: linear-gradient(155deg, var(--accent-lite), var(--accent) 55%, var(--accent-deep)); color: #fff; }
.stat-card.bg-success   .stat-icon { background: linear-gradient(155deg, #34D399, var(--ok) 55%, #065F46);      color: #fff; }
.stat-card.bg-info      .stat-icon { background: linear-gradient(155deg, #22D3EE, var(--info) 55%, #155E75);    color: #fff; }
.stat-card.bg-warning   .stat-icon { background: linear-gradient(155deg, #FBBF24, var(--warn) 55%, #92400E);    color: #fff; }
.stat-card.bg-danger    .stat-icon { background: linear-gradient(155deg, #F87171, var(--bad) 55%, #991B1B);     color: #fff; }
.stat-card.bg-secondary .stat-icon { background: linear-gradient(155deg, #A8A29E, var(--neutral) 55%, #292524); color: #fff; }

/* A whisper of the tile's hue bleeding in from the right. */
.stat-card::after {
    content: '';
    position: absolute;
    top: -40%;
    right: -30%;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    opacity: .07;
    pointer-events: none;
    background: var(--accent);
}
.stat-card.bg-success::after   { background: var(--ok); }
.stat-card.bg-info::after      { background: var(--info); }
.stat-card.bg-warning::after   { background: var(--warn); }
.stat-card.bg-danger::after    { background: var(--bad); }
.stat-card.bg-secondary::after { background: var(--neutral); }

/* ── 8.8 Buttons that travel ─────────────────────────────────────── */

.btn-primary, .btn-success, .btn-danger, .btn-warning, .btn-info {
    border: 0;
    transition: transform .14s cubic-bezier(.22,.61,.36,1), box-shadow .14s ease, filter .14s ease;
}
.btn-primary {
    background: linear-gradient(180deg,
        var(--accent-lite) 0%, var(--accent) 55%, var(--accent-hover) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.35),
        0 3px 0 -1px var(--accent-deep),
        0 8px 16px -8px rgba(var(--accent-rgb), .75);
}
.btn-success { background: linear-gradient(180deg,#10B981 0%, var(--ok) 55%, #047857 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.32), 0 3px 0 -1px #065F46, 0 8px 16px -8px rgba(5,150,105,.7); }
.btn-danger  { background: linear-gradient(180deg,#EF4444 0%, var(--bad) 55%, #B91C1C 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.32), 0 3px 0 -1px #991B1B, 0 8px 16px -8px rgba(220,38,38,.7); }
.btn-warning { background: linear-gradient(180deg,#F59E0B 0%, var(--warn) 55%, #B45309 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.32), 0 3px 0 -1px #92400E, 0 8px 16px -8px rgba(217,119,6,.7); }
.btn-info    { background: linear-gradient(180deg,#06B6D4 0%, var(--info) 55%, #0E7490 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.32), 0 3px 0 -1px #155E75, 0 8px 16px -8px rgba(8,145,178,.7); }

.btn-primary:hover, .btn-success:hover, .btn-danger:hover,
.btn-warning:hover, .btn-info:hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
}
.btn-primary:active, .btn-success:active, .btn-danger:active,
.btn-warning:active, .btn-info:active {
    transform: translateY(2px);
    box-shadow: inset 0 2px 4px rgba(0,0,0,.3) !important;
}
/* Small buttons sit in dense table rows — trim the travel so a column of
   them doesn't shimmer on hover. */
.btn-sm.btn-primary, .btn-sm.btn-success, .btn-sm.btn-danger,
.btn-sm.btn-warning, .btn-sm.btn-info { box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 2px 0 -1px rgba(0,0,0,.22); }
.btn-sm:hover { transform: none; }

.btn-secondary, .btn-light, .btn-outline-secondary, .btn-outline-primary,
.btn-outline-danger, .btn-outline-success, .btn-outline-warning, .btn-outline-info {
    box-shadow: var(--edge-lit), 0 1px 2px rgba(28,25,23,.06);
}

/* ── 8.9 Inputs — sunken wells, matching the login screen ────────── */

.form-control, .form-select {
    background-color: #FBFBFC;
    box-shadow: var(--well);
}
.form-control:focus, .form-select:focus {
    background-color: var(--surface);
    box-shadow: inset 0 1px 2px rgba(28,25,23,.03), 0 0 0 4px rgba(var(--accent-rgb), .16);
}
.form-control:disabled, .form-select:disabled, .form-control[readonly] { box-shadow: none; }
.input-group-text { background: var(--surface-sunken); box-shadow: var(--well); }
.form-check-input:checked {
    background-image: linear-gradient(180deg, var(--accent-lite), var(--accent));
    box-shadow: 0 1px 2px rgba(var(--accent-rgb), .5);
}

/* ── 8.10 Data surfaces — depth only where it aids scanning ─────── */

.table-card .table th {
    background: linear-gradient(180deg, #F7F7F6 0%, var(--surface-sunken) 100%);
    box-shadow: inset 0 -1px 0 var(--border);
}
.table-card .table tbody tr { transition: background .12s ease; }

.progress { box-shadow: var(--well); }
.progress-bar {
    background: linear-gradient(180deg, var(--accent-lite), var(--accent));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
}

.badge { box-shadow: 0 1px 1px rgba(28,25,23,.04); }
.badge.rounded-pill.bg-danger {
    background: linear-gradient(180deg,#EF4444,#DC2626) !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 2px 6px -2px rgba(220,38,38,.9);
}

/* DTR cells lift only under the pointer, so a month grid stays calm. */
.dtr-cell {
    box-shadow: inset 0 1px 0 rgba(255,255,255,.6);
    transition: transform .14s ease, box-shadow .14s ease;
}
.dtr-cell:not(.empty):hover {
    transform: translateY(-2px);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 6px 12px -6px rgba(28,25,23,.4);
}

.term-strip { box-shadow: 0 6px 14px -12px rgba(28,25,23,.7); }

/* ── 8.11 Motion ─────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .card, .stat-card, .dtr-cell, .btn, #sidebar .nav-link,
    .btn-primary, .btn-success, .btn-danger, .btn-warning, .btn-info {
        transition: none !important;
    }
    .stat-card:hover, .dtr-cell:hover, #sidebar .nav-link:hover,
    .btn-primary:hover, .btn-success:hover, .btn-danger:hover,
    .btn-warning:hover, .btn-info:hover { transform: none !important; }
}

/* Print already flattens cards and hides the chrome (layer 7); just make
   sure the gradient faces don't come out as grey slabs. */
@media print {
    .stat-card, .card, .btn { background: #fff !important; box-shadow: none !important; }
    .stat-card::after { display: none; }
    .page-header h1 .bi, #topNavbar .navbar-brand .bi {
        background: none !important;
        color: #000 !important;
        box-shadow: none !important;
        width: auto; height: auto;
    }
}
