/*
 * Vendor Portal — Design System
 * Loaded by base.html, login.html and the standalone attendance pages.
 * Theme is set on <html data-theme="light|dark" data-bs-theme="…"> by an inline
 * script in <head> (localStorage key: "vp-theme"). Pages should use the tokens
 * below instead of hardcoded hex colours so both themes work.
 */

/* ─────────────────────────────────────────────────────────────────────────────
   TOKENS (light)
───────────────────────────────────────────────────────────────────────────── */
:root {
    /* Brand */
    --accent:       #3A5BD9;
    --accent-2:     #2D49B8;
    --accent-rgb:   58, 91, 217;
    --teal:         #0FB5A0;
    --teal-rgb:     15, 181, 160;
    --violet:       #7C5CF6;
    --violet-rgb:   124, 92, 246;

    /* Status */
    --green:        #10B981;
    --green-rgb:    16, 185, 129;
    --amber:        #D97706;
    --amber-rgb:    245, 158, 11;
    --rose:         #F43F5E;
    --rose-rgb:     244, 63, 94;
    --blue:         #3B82F6;
    --blue-rgb:     59, 130, 246;

    /* Sidebar — always dark */
    --sb-bg:        #06122A;
    --sb-bg-2:      #0C1A36;
    --sb-bg-3:      #15264A;
    --sb-border:    #18294A;
    --sb-text:      #6A80A8;
    --sb-text-h:    #B3C3E0;
    --sb-text-a:    #E3EAF8;
    --sb-section:   #3A4F75;
    --sb-w:         252px;

    /* Surfaces */
    --body:         #EEF2F9;
    --surface:      #FFFFFF;
    --surface-2:    #F6F8FD;
    --surface-3:    #EDF1F8;
    --border:       #E1E7F2;
    --border-2:     #CDD6E7;

    /* Text */
    --tx-1:         #0A1628;
    --tx-2:         #3D4F6E;
    --tx-3:         #6E7E9B;

    /* Header */
    --hdr-h:        60px;
    --hdr-bg:       rgba(255,255,255,.86);
    --hdr-border:   #E1E7F2;

    /* Shape & motion */
    --r:            8px;
    --r-lg:         12px;
    --r-xl:         16px;
    --t:            .2s;
    --shadow:       0 1px 3px rgba(6,18,42,.06), 0 4px 16px rgba(6,18,42,.05);
    --shadow-md:    0 4px 24px rgba(6,18,42,.10);
    --shadow-lg:    0 16px 48px rgba(6,18,42,.16);
}

/* ─────────────────────────────────────────────────────────────────────────────
   TOKENS (dark)
───────────────────────────────────────────────────────────────────────────── */
html[data-theme="dark"] {
    --body:         #070E1C;
    --surface:      #0E1828;
    --surface-2:    #0B1422;
    --surface-3:    #13203A;
    --border:       #18233A;
    --border-2:     #22314F;
    --tx-1:         #DCE6F7;
    --tx-2:         #8AA3C8;
    --tx-3:         #5A7096;
    --hdr-bg:       rgba(7,14,28,.82);
    --hdr-border:   #18233A;
    --accent:       #5677EE;
    --accent-2:     #4766E0;
    --accent-rgb:   86, 119, 238;
    --amber:        #FBBF24;
    --shadow:       0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.25);
    --shadow-md:    0 6px 28px rgba(0,0,0,.45);
    --shadow-lg:    0 18px 50px rgba(0,0,0,.55);
    color-scheme: dark;
}

/* ─────────────────────────────────────────────────────────────────────────────
   BOOTSTRAP VARIABLE BRIDGE
   Bootstrap 5.3 reads these; pointing them at our tokens makes every BS
   component follow the theme.
───────────────────────────────────────────────────────────────────────────── */
:root,
html[data-theme="dark"] {
    --bs-body-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --bs-body-bg:            var(--body);
    --bs-body-color:         var(--tx-1);
    --bs-emphasis-color:     var(--tx-1);
    --bs-secondary-color:    var(--tx-3);
    --bs-secondary-bg:       var(--surface-3);
    --bs-tertiary-color:     var(--tx-3);
    --bs-tertiary-bg:        var(--surface-2);
    --bs-heading-color:      var(--tx-1);
    --bs-border-color:       var(--border);
    --bs-border-color-translucent: var(--border);
    --bs-primary:            var(--accent);
    --bs-primary-rgb:        var(--accent-rgb);
    --bs-link-color:         var(--accent);
    --bs-link-color-rgb:     var(--accent-rgb);
    --bs-link-hover-color:   var(--accent-2);
    --bs-link-hover-color-rgb: var(--accent-rgb);
    --bs-focus-ring-color:   rgba(var(--accent-rgb), .25);
    --bs-border-radius:      var(--r);
    --bs-border-radius-lg:   var(--r-lg);
}

/* ─────────────────────────────────────────────────────────────────────────────
   BASE
───────────────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
    font-family: var(--bs-body-font-family);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background: var(--body);
    color: var(--tx-1);
    font-family: var(--bs-body-font-family);
    transition: background var(--t), color var(--t);
}

h1, h2, h3, h4, h5, h6 { color: var(--tx-1); letter-spacing: -0.015em; }
h3 { font-size: 1.375rem; font-weight: 800; letter-spacing: -0.02em; }
h5 { font-weight: 700; }
h6 { font-weight: 700; }

a { color: var(--accent); }
a:hover { color: var(--accent-2); }

.tabular, .text-end-num { font-variant-numeric: tabular-nums; }

*:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

::selection { background: rgba(var(--accent-rgb), .18); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* ─────────────────────────────────────────────────────────────────────────────
   APP SHELL — sidebar
───────────────────────────────────────────────────────────────────────────── */
.app-body {
    display: flex;
    height: 100vh;
    height: 100dvh;   /* the visible screen; on phones 100vh runs under the browser bar and hides the page bottom */
    margin: 0;
    overflow: hidden;
}

.sidebar {
    width: var(--sb-w);
    position: fixed;
    top: 0; bottom: 0; left: 0;
    display: flex;
    flex-direction: column;
    background: var(--sb-bg);
    border-right: 1px solid var(--sb-border);
    z-index: 1040;
    box-shadow: 4px 0 24px rgba(0,0,0,.12);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
}

.sidebar-brand {
    height: var(--hdr-h);
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 18px;
    border-bottom: 1px solid var(--sb-border);
    flex-shrink: 0;
    text-decoration: none;
}
.sidebar-brand:hover { text-decoration: none; }

.brand-mark {
    width: 32px; height: 32px;
    border-radius: 9px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--accent) 0%, var(--teal) 100%);
    box-shadow: 0 4px 14px rgba(var(--accent-rgb), .45);
    color: #fff;
    font-size: .95rem;
}
.brand-name {
    color: #F3F6FC;
    font-size: .95rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
}
.brand-tag {
    color: var(--sb-text);
    font-size: .7rem;
    font-weight: 500;
    margin-top: 2px;
}
/* vendor the session belongs to, under the product name */
.brand-vendor {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
    min-width: 0;
}
.brand-vendor-name {
    color: var(--sb-text-h);
    font-size: .72rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.brand-vendor-code {
    flex-shrink: 0;
    padding: 0 5px;
    border-radius: 4px;
    background: rgba(var(--teal-rgb), .14);
    color: #5EE3CF;
    font-size: .62rem;
    font-weight: 600;
    line-height: 1.5;
    font-variant-numeric: tabular-nums;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 0 16px;
    scrollbar-width: thin;
    scrollbar-color: var(--sb-bg-3) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--sb-bg-3); border-radius: 2px; }

/* collapsible section: a header row (icon tile, label, chevron) over its indented links */
.sidebar-group + .sidebar-group { margin-top: 2px; }
.sidebar-section {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 7px 16px 7px 14px;
    font-size: .835rem;
    font-weight: 600;
    color: var(--sb-text-h);
    background: none;
    border: 0;
    text-align: left;
    cursor: pointer;
    user-select: none;
    transition: color .13s, background .13s;
}
.sidebar-section:hover { background: var(--sb-bg-2); color: var(--sb-text-a); }
.sidebar-section-icon {
    width: 28px; height: 28px;
    border-radius: 8px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--sb-bg-2);
    border: 1px solid var(--sb-border);
    color: var(--sb-text);
    font-size: .85rem;
    transition: color .13s, background .13s, border-color .13s;
}
.sidebar-section:hover .sidebar-section-icon { color: var(--sb-text-h); background: var(--sb-bg-3); }
.sidebar-section .chev {
    margin-left: auto;
    font-size: .65rem;
    opacity: .5;
    transform: rotate(90deg);
    transition: transform .22s ease;
}
.sidebar-group:not(.collapsed) .sidebar-section { color: var(--sb-text-a); }
.sidebar-group.collapsed .sidebar-section .chev { transform: none; }
/* the section holding the current page */
.sidebar-group.current .sidebar-section-icon {
    background: rgba(var(--accent-rgb), .2);
    border-color: rgba(var(--accent-rgb), .35);
    color: #8EA6FF;
}

.sidebar-group-links {
    position: relative;
    padding: 2px 0 6px;
}
.sidebar-group-links::before {
    content: "";
    position: absolute;
    left: 28px; top: 0; bottom: 8px;
    width: 1px;
    background: var(--sb-border);
}
.sidebar-group-links .sidebar-link { padding-left: 42px; padding-top: 7px; padding-bottom: 7px; }
.sidebar-group-links .sidebar-link:hover { border-left-color: transparent; }
/* active marker sits on the guide line instead of the sidebar edge */
.sidebar-group-links .sidebar-link.active {
    border-left-color: transparent;
    background:
        linear-gradient(var(--accent), var(--accent)) 25px 50% / 3px 60% no-repeat,
        rgba(var(--accent-rgb), .16);
}
.sidebar-group-links .sidebar-sub a { padding-left: 69px; }
.sidebar-group.collapsed .sidebar-group-links { display: none; }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 8px 20px;
    font-size: .835rem;
    font-weight: 500;
    color: var(--sb-text);
    text-decoration: none;
    background: none;
    border: 0;
    border-left: 2px solid transparent;
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
    transition: color .13s, background .13s, border-color .13s;
}
.sidebar-link > i:first-child {
    width: 16px;
    text-align: center;
    font-size: .95rem;
    opacity: .7;
    flex-shrink: 0;
    transition: opacity .13s, color .13s;
}
.sidebar-link:hover {
    color: var(--sb-text-h);
    background: var(--sb-bg-2);
    border-left-color: var(--sb-border);
}
.sidebar-link:hover > i:first-child { opacity: 1; }
.sidebar-link.active {
    color: var(--sb-text-a);
    background: rgba(var(--accent-rgb), .16);
    border-left-color: var(--accent);
    font-weight: 600;
}
.sidebar-link.active > i:first-child { opacity: 1; color: #8EA6FF; }
/* a count of things waiting for this user, at the end of a sidebar link */
.sidebar-count {
    margin-left: auto;
    min-width: 20px; height: 20px; padding: 0 6px;
    border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--amber); color: #1a1205;
    font-size: .7rem; font-weight: 700;
}

.sidebar-link .chev {
    margin-left: auto;
    font-size: .65rem;
    opacity: .5;
    transition: transform .22s ease;
}
.sidebar-link.open { color: var(--sb-text-h); }
.sidebar-link.open > i:first-child { opacity: 1; }
.sidebar-link.open .chev { transform: rotate(90deg); }

.sidebar-sub {
    display: none;
    background: rgba(0,0,0,.18);
    padding: 2px 0 6px;
}
.sidebar-sub.open { display: block; }
.sidebar-sub a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 20px 6px 47px;
    font-size: .8rem;
    color: var(--sb-text);
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: color .12s, background .12s;
}
.sidebar-sub a::before {
    content: "";
    width: 5px; height: 5px;
    border-radius: 50%;
    background: var(--sb-section);
    flex-shrink: 0;
}
.sidebar-sub a:hover { color: var(--sb-text-h); background: rgba(255,255,255,.03); }
.sidebar-sub a.active { color: var(--sb-text-a); font-weight: 600; }
.sidebar-sub a.active::before { background: #8EA6FF; box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .3); }

.sidebar-footer {
    flex-shrink: 0;
    padding: 12px 14px;
    border-top: 1px solid var(--sb-border);
}
/* Users / Settings, pinned under the nav: rows like the section headers */
.sidebar-account { padding: 8px 0; }
.sidebar-account-link { text-decoration: none; color: var(--sb-text); font-weight: 500; }
.sidebar-account-link:hover { text-decoration: none; }
.sidebar-account-link.active { color: var(--sb-text-a); background: rgba(var(--accent-rgb), .16); font-weight: 600; }
.sidebar-account-link.active .sidebar-section-icon {
    background: rgba(var(--accent-rgb), .2);
    border-color: rgba(var(--accent-rgb), .35);
    color: #8EA6FF;
}
.workspace-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--r);
    background: var(--sb-bg-2);
    border: 1px solid var(--sb-border);
}
.workspace-avatar {
    width: 30px; height: 30px;
    border-radius: 8px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(var(--teal-rgb), .16);
    color: #5EE3CF;
    font-size: .78rem;
    font-weight: 700;
}
.workspace-name {
    color: var(--sb-text-h);
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.workspace-code {
    color: var(--sb-text);
    font-size: .68rem;
    font-variant-numeric: tabular-nums;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(6,18,42,.55);
    backdrop-filter: blur(2px);
    z-index: 1035;
}

/* ─────────────────────────────────────────────────────────────────────────────
   APP SHELL — main column & top bar
───────────────────────────────────────────────────────────────────────────── */
.main-content {
    margin-left: var(--sb-w);
    width: calc(100% - var(--sb-w));
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--body);
    transition: background var(--t);
}
.main-content::-webkit-scrollbar { width: 8px; }
.main-content::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 4px; }
.main-content::-webkit-scrollbar-track { background: transparent; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    height: var(--hdr-h);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 28px;
    background: var(--hdr-bg);
    border-bottom: 1px solid var(--hdr-border);
    backdrop-filter: blur(14px) saturate(180%);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
}

.topbar-crumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-size: .84rem;
}
.topbar-crumbs .crumb-section { color: var(--tx-3); font-weight: 500; white-space: nowrap; }
.topbar-crumbs .crumb-sep { color: var(--border-2); font-size: .7rem; }
.topbar-crumbs .crumb-page {
    color: var(--tx-1);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
}

.hdr-btn {
    position: relative;
    width: 38px; height: 38px;
    border-radius: var(--r);
    border: 1px solid transparent;
    background: transparent;
    color: var(--tx-2);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.02rem;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
.hdr-btn:hover,
.hdr-btn.open { background: var(--surface-3); color: var(--tx-1); }

.hdr-btn-menu { display: none; margin-left: -8px; }

.hdr-divider { width: 1px; height: 24px; background: var(--border); margin: 0 6px; }

/* theme toggle — sun / moon swap */
.theme-toggle .bi-moon-stars-fill { display: none; }
html[data-theme="dark"] .theme-toggle .bi-sun-fill { display: none; }
html[data-theme="dark"] .theme-toggle .bi-moon-stars-fill { display: inline-block; }
.theme-toggle i { transition: transform .4s cubic-bezier(.4,0,.2,1); }
.theme-toggle:hover i { transform: rotate(-20deg); }

/* view-transition ripple when switching theme */
::view-transition-old(root) { animation: none; mix-blend-mode: normal; z-index: 1; }
::view-transition-new(root) {
    mix-blend-mode: normal;
    z-index: 9999;
    animation: vp-ripple .5s cubic-bezier(.4,0,.2,1) forwards;
}
@keyframes vp-ripple {
    from { clip-path: circle(0% at var(--theme-x, 50%) var(--theme-y, 0%)); }
    to   { clip-path: circle(150% at var(--theme-x, 50%) var(--theme-y, 0%)); }
}

.hdr-count {
    position: absolute;
    top: 3px; right: 3px;
    min-width: 17px; height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--rose);
    color: #fff;
    font-size: .62rem;
    font-weight: 700;
    line-height: 1;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 0 2px var(--surface);
}

/* user chip + popover */
.user-chip {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 4px 8px 4px 4px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: none;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.user-chip:hover,
.user-chip.open { background: var(--surface-3); }
.user-chip-name {
    font-size: .82rem;
    font-weight: 600;
    color: var(--tx-1);
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-chip .bi-chevron-down { font-size: .65rem; color: var(--tx-3); }

.avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--accent), var(--violet));
    color: #fff;
    font-size: .78rem;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(var(--accent-rgb), .3);
}

.popover-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    display: none;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    z-index: 1060;
    animation: vp-pop .15s ease-out;
}
.popover-panel.open { display: flex; }
@keyframes vp-pop {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: none; }
}

.user-menu { width: 240px; }
.user-menu-head {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}
.user-menu-name { font-size: .88rem; font-weight: 700; color: var(--tx-1); }
.user-menu-sub { font-size: .74rem; color: var(--tx-3); margin-top: 2px; }
.user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    font-size: .84rem;
    color: var(--tx-2);
    text-decoration: none;
    transition: background .12s, color .12s;
}
.user-menu-item i { width: 16px; text-align: center; color: var(--tx-3); }
.user-menu-item:hover { background: var(--surface-2); color: var(--tx-1); }
.user-menu-item.active { color: var(--accent); font-weight: 600; background: rgba(var(--accent-rgb), .07); }
.user-menu-item.active i { color: var(--accent); }
.user-menu-item.danger,
.user-menu-item.danger i { color: var(--rose); }
.user-menu-item.danger:hover { background: rgba(var(--rose-rgb), .07); color: var(--rose); }
.user-menu-sep { height: 1px; background: var(--border); margin: 4px 0; }

/* notifications popover */
.notif-panel { width: 360px; max-height: 480px; }
.notif-head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}
.notif-title { font-size: .92rem; font-weight: 700; color: var(--tx-1); }
.notif-sub { font-size: .76rem; color: var(--tx-3); margin-top: 2px; }
.notif-list { overflow-y: auto; flex: 1; }
.notif-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 18px;
    border-bottom: 1px solid var(--border);
    color: inherit;
    text-decoration: none;
    transition: background .12s;
}
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--surface-2); color: inherit; }
.notif-icon {
    width: 34px; height: 34px;
    border-radius: 10px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(var(--amber-rgb), .14);
    color: var(--amber);
}
.notif-info { flex: 1; min-width: 0; }
.notif-item-title { font-size: .86rem; font-weight: 600; color: var(--tx-1); line-height: 1.3; }
.notif-item-sub { font-size: .74rem; color: var(--tx-3); margin-top: 2px; }
.notif-chev { color: var(--tx-3); font-size: .8rem; }
.notif-empty { padding: 36px 20px; text-align: center; color: var(--tx-3); font-size: .86rem; }
.notif-empty i { display: block; font-size: 1.8rem; color: var(--green); margin-bottom: 8px; }
.notif-empty-sub { font-size: .74rem; margin-top: 4px; }

.page-body { padding: 26px 32px 48px; }

.content-wrapper { margin: 0 auto; min-width: 0; }

/* ─────────────────────────────────────────────────────────────────────────────
   PAGE HERO — shared page header
   <div class="page-hero">
     <div class="page-hero-left">
       <div class="page-hero-icon"><i class="bi bi-people-fill"></i></div>
       <div><h1 class="page-hero-title">Employees</h1>
            <p class="page-hero-sub">…</p></div>
     </div>
     <div class="page-hero-actions">…buttons…</div>
   </div>
───────────────────────────────────────────────────────────────────────────── */
.page-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 22px;
}
.page-hero-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.page-hero-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(var(--accent-rgb), .12);
    color: var(--accent);
    border: 1px solid rgba(var(--accent-rgb), .18);
    font-size: 1.2rem;
}
.page-hero-title {
    font-size: 1.375rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--tx-1);
    margin: 0 0 2px;
    line-height: 1.2;
}
.page-hero-sub { font-size: .85rem; color: var(--tx-3); margin: 0; }
.page-hero-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ─────────────────────────────────────────────────────────────────────────────
   STAT CARDS
───────────────────────────────────────────────────────────────────────────── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}
.stat-card {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
    transition: box-shadow .2s, transform .2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-card::after {
    content: "";
    position: absolute;
    top: 0; right: 0;
    width: 3px; height: 100%;
    background: var(--stat-tone, var(--accent));
    opacity: .5;
}
.stat-icon {
    width: 48px; height: 48px;
    border-radius: 13px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem;
    background: rgba(var(--accent-rgb), .12);
    color: var(--accent);
}
.stat-label {
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--tx-3);
    margin-bottom: 4px;
}
.stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1.1;
    color: var(--tx-1);
    font-variant-numeric: tabular-nums;
}
.stat-sub { font-size: .74rem; color: var(--tx-3); margin-top: 3px; }

/* tone modifiers — apply to .stat-card (sets stripe + icon) or to .stat-icon / .tone-chip */
.tone-accent { --stat-tone: var(--accent); }
.tone-green  { --stat-tone: var(--green); }
.tone-amber  { --stat-tone: var(--amber); }
.tone-rose   { --stat-tone: var(--rose); }
.tone-blue   { --stat-tone: var(--blue); }
.tone-teal   { --stat-tone: var(--teal); }
.tone-violet { --stat-tone: var(--violet); }
.tone-neutral { --stat-tone: var(--tx-3); }
.tone-green  .stat-icon, .stat-icon.tone-green  { background: rgba(var(--green-rgb), .12);  color: var(--green); }
.tone-amber  .stat-icon, .stat-icon.tone-amber  { background: rgba(var(--amber-rgb), .14);  color: var(--amber); }
.tone-rose   .stat-icon, .stat-icon.tone-rose   { background: rgba(var(--rose-rgb), .12);   color: var(--rose); }
.tone-blue   .stat-icon, .stat-icon.tone-blue   { background: rgba(var(--blue-rgb), .12);   color: var(--blue); }
.tone-teal   .stat-icon, .stat-icon.tone-teal   { background: rgba(var(--teal-rgb), .12);   color: var(--teal); }
.tone-violet .stat-icon, .stat-icon.tone-violet { background: rgba(var(--violet-rgb), .12); color: var(--violet); }
.tone-neutral .stat-icon, .stat-icon.tone-neutral { background: rgba(110,126,155,.12); color: var(--tx-3); }

/* ─────────────────────────────────────────────────────────────────────────────
   CARDS
───────────────────────────────────────────────────────────────────────────── */
.card {
    --bs-card-bg: var(--surface);
    --bs-card-border-color: var(--border);
    --bs-card-cap-bg: var(--surface-2);
    --bs-card-color: var(--tx-1);
    --bs-card-border-radius: var(--r-lg);
    --bs-card-inner-border-radius: calc(var(--r-lg) - 1px);
    box-shadow: var(--shadow);
}
.card.shadow-none, .card.border-0.shadow-none { box-shadow: none; }
.card-body { padding: 20px 24px; }
.card-header {
    padding: 14px 24px;
    font-weight: 700;
    color: var(--tx-1);
}

.ds-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
    padding: 22px 24px;
}

/* table card — card with a header row and a flush table */
.table-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.table-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 16px 22px;
    border-bottom: 1px solid var(--border);
}
.table-card-title { font-size: .95rem; font-weight: 700; color: var(--tx-1); margin: 0; }
.table-card-sub { font-size: .76rem; color: var(--tx-3); margin-top: 2px; }
.table-card .table-responsive { border: 0; border-radius: 0; }

.count-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    background: rgba(var(--accent-rgb), .1);
    color: var(--accent);
    margin-left: 6px;
    font-variant-numeric: tabular-nums;
}

/* ─────────────────────────────────────────────────────────────────────────────
   TABLES
───────────────────────────────────────────────────────────────────────────── */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--tx-2);
    --bs-table-border-color: var(--border);
    --bs-table-striped-bg: var(--surface-2);
    --bs-table-striped-color: var(--tx-2);
    --bs-table-hover-bg: rgba(var(--accent-rgb), .045);
    --bs-table-hover-color: var(--tx-1);
    --bs-table-active-bg: rgba(var(--accent-rgb), .08);
    font-size: .855rem;
    margin-bottom: 0;
    color: var(--tx-2);
}
.table > :not(caption) > * > * { border-bottom-color: var(--border); }

.table thead th,
.table > thead > tr > th {
    background: var(--surface-2);
    color: var(--tx-3);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 11px 14px;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}
/* legacy navy headers become the light DS header */
.table-dark,
.table thead.table-dark,
.table thead.table-dark th,
.table .table-dark th {
    --bs-table-bg: var(--surface-2);
    --bs-table-color: var(--tx-3);
    --bs-table-border-color: var(--border);
    --bs-table-striped-bg: var(--surface-2);
    --bs-table-hover-bg: var(--surface-2);
    background: var(--surface-2) !important;
    color: var(--tx-3) !important;
    border-color: var(--border) !important;
}
.table-light,
.table-secondary {
    --bs-table-bg: var(--surface-2);
    --bs-table-color: var(--tx-2);
    --bs-table-border-color: var(--border);
}
.table tbody td {
    padding: 11px 14px;
    vertical-align: middle;
    white-space: nowrap;
    color: var(--tx-2);
}
.table tbody td strong,
.table tbody td .fw-semibold,
.table tbody td .fw-bold { color: var(--tx-1); }
.table tbody tr { transition: background-color .12s; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tfoot td,
.table tfoot th {
    background: var(--surface-2);
    color: var(--tx-1);
    font-weight: 700;
    border-top: 1px solid var(--border-2);
}

.table-responsive {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
    overflow-x: auto;
    max-width: 100%;
}
.card .table-responsive { box-shadow: none; }

/* ─────────────────────────────────────────────────────────────────────────────
   STATUS PILLS  <span class="ds-badge ds-badge-success">Paid</span>
───────────────────────────────────────────────────────────────────────────── */
.ds-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    white-space: nowrap;
    background: rgba(110,126,155,.12);
    color: var(--tx-3);
}
.ds-badge::before {
    content: "";
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: .85;
}
.ds-badge.no-dot::before { display: none; }
.ds-badge-success { background: rgba(var(--green-rgb), .12);  color: var(--green); }
.ds-badge-warning { background: rgba(var(--amber-rgb), .14);  color: var(--amber); }
.ds-badge-danger  { background: rgba(var(--rose-rgb), .12);   color: var(--rose); }
.ds-badge-info    { background: rgba(var(--blue-rgb), .12);   color: var(--blue); }
.ds-badge-accent  { background: rgba(var(--accent-rgb), .12); color: var(--accent); }
.ds-badge-teal    { background: rgba(var(--teal-rgb), .12);   color: var(--teal); }
.ds-badge-violet  { background: rgba(var(--violet-rgb), .12); color: var(--violet); }
.ds-badge-neutral { background: rgba(110,126,155,.12);        color: var(--tx-3); }

/* Bootstrap badges — softer */
.badge { font-weight: 600; letter-spacing: .01em; border-radius: 6px; padding: .38em .7em; }
.badge.bg-primary { background-color: var(--accent) !important; }
.badge.bg-success-soft { background: rgba(var(--green-rgb), .12) !important; color: var(--green); }
.badge.bg-danger-soft  { background: rgba(var(--rose-rgb), .12) !important;  color: var(--rose); }
.badge.bg-light { background: var(--surface-3) !important; color: var(--tx-2) !important; }

/* ID / code chip */
.ds-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--tx-2);
    font-size: .76rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

/* ─────────────────────────────────────────────────────────────────────────────
   BUTTONS
───────────────────────────────────────────────────────────────────────────── */
.btn {
    --bs-btn-font-size: .855rem;
    --bs-btn-font-weight: 600;
    --bs-btn-padding-x: 16px;
    --bs-btn-padding-y: 8px;
    --bs-btn-border-radius: var(--r);
    --bs-btn-focus-box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .22);
    transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .15s;
}
.btn:active { transform: scale(.98); }
.btn-sm { --bs-btn-font-size: .78rem; --bs-btn-padding-x: 11px; --bs-btn-padding-y: 5px; --bs-btn-border-radius: 7px; }
.btn-lg { --bs-btn-font-size: .95rem; --bs-btn-padding-x: 22px; --bs-btn-padding-y: 11px; }

.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--accent);
    --bs-btn-border-color: var(--accent);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--accent-2);
    --bs-btn-hover-border-color: var(--accent-2);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--accent-2);
    --bs-btn-active-border-color: var(--accent-2);
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: var(--accent);
    --bs-btn-disabled-border-color: var(--accent);
    box-shadow: 0 2px 10px rgba(var(--accent-rgb), .28);
}
.btn-primary:hover { box-shadow: 0 4px 16px rgba(var(--accent-rgb), .38); transform: translateY(-1px); }

.btn-outline-primary {
    --bs-btn-color: var(--accent);
    --bs-btn-border-color: rgba(var(--accent-rgb), .35);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--accent);
    --bs-btn-hover-border-color: var(--accent);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--accent-2);
    --bs-btn-active-border-color: var(--accent-2);
    --bs-btn-disabled-color: var(--accent);
    --bs-btn-disabled-border-color: rgba(var(--accent-rgb), .35);
}

.btn-success {
    --bs-btn-bg: var(--green);
    --bs-btn-border-color: var(--green);
    --bs-btn-hover-bg: #059669;
    --bs-btn-hover-border-color: #059669;
    --bs-btn-active-bg: #047857;
    --bs-btn-active-border-color: #047857;
    box-shadow: 0 2px 10px rgba(var(--green-rgb), .25);
}

.btn-info {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--teal);
    --bs-btn-border-color: var(--teal);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #0C9C8A;
    --bs-btn-hover-border-color: #0C9C8A;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #0A8676;
    --bs-btn-active-border-color: #0A8676;
    --bs-btn-disabled-color: #fff;
    box-shadow: 0 2px 10px rgba(var(--teal-rgb), .25);
}

.btn-danger {
    --bs-btn-bg: var(--rose);
    --bs-btn-border-color: var(--rose);
    --bs-btn-hover-bg: #E11D48;
    --bs-btn-hover-border-color: #E11D48;
}

/* secondary / light / outline-secondary → neutral surface buttons */
.btn-secondary,
.btn-light,
.btn-outline-secondary,
.btn-outline-dark {
    --bs-btn-color: var(--tx-2);
    --bs-btn-bg: var(--surface);
    --bs-btn-border-color: var(--border-2);
    --bs-btn-hover-color: var(--accent);
    --bs-btn-hover-bg: rgba(var(--accent-rgb), .05);
    --bs-btn-hover-border-color: rgba(var(--accent-rgb), .5);
    --bs-btn-active-color: var(--accent);
    --bs-btn-active-bg: rgba(var(--accent-rgb), .1);
    --bs-btn-active-border-color: var(--accent);
    --bs-btn-disabled-color: var(--tx-3);
    --bs-btn-disabled-bg: var(--surface-2);
    --bs-btn-disabled-border-color: var(--border);
}

.btn-outline-success { --bs-btn-color: var(--green); --bs-btn-border-color: rgba(var(--green-rgb), .4); --bs-btn-hover-bg: var(--green); --bs-btn-hover-border-color: var(--green); }
.btn-outline-danger  { --bs-btn-color: var(--rose);  --bs-btn-border-color: rgba(var(--rose-rgb), .4);  --bs-btn-hover-bg: var(--rose);  --bs-btn-hover-border-color: var(--rose); }
.btn-outline-warning { --bs-btn-color: var(--amber); --bs-btn-border-color: rgba(var(--amber-rgb), .45); --bs-btn-hover-bg: #F59E0B; --bs-btn-hover-border-color: #F59E0B; --bs-btn-hover-color: #fff; }
.btn-outline-info    { --bs-btn-color: var(--teal);  --bs-btn-border-color: rgba(var(--teal-rgb), .4);  --bs-btn-hover-bg: var(--teal);  --bs-btn-hover-border-color: var(--teal); --bs-btn-hover-color: #fff; }

.btn-link { --bs-btn-color: var(--accent); --bs-btn-hover-color: var(--accent-2); font-weight: 500; }

/* icon-only button for table rows */
.icon-only-btn,
.action-btn {
    width: 32px; height: 32px;
    padding: 0; margin: 0;
    border-radius: var(--r);
    border: 1px solid transparent;
    background: transparent;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--tx-3);
    cursor: pointer;
    transition: background .13s, color .13s, border-color .13s;
}
.icon-only-btn i,
.action-btn i { font-size: 1.05rem; color: inherit; }
.icon-only-btn:hover,
.action-btn:hover {
    background: rgba(var(--accent-rgb), .1);
    border-color: rgba(var(--accent-rgb), .2);
    color: var(--accent);
}
.icon-only-btn:hover i { color: var(--accent); }
.action-btn.danger:hover  { background: rgba(var(--rose-rgb), .1);  border-color: rgba(var(--rose-rgb), .2);  color: var(--rose); }
.action-btn.success:hover { background: rgba(var(--green-rgb), .1); border-color: rgba(var(--green-rgb), .2); color: var(--green); }

/* ─────────────────────────────────────────────────────────────────────────────
   FORMS
───────────────────────────────────────────────────────────────────────────── */
.form-label {
    font-size: .78rem;
    font-weight: 600;
    color: var(--tx-2);
    margin-bottom: 6px;
    letter-spacing: .005em;
}
.required::after { content: " *"; color: var(--rose); }

.form-control,
.form-select {
    background-color: var(--surface-2);
    border: 1px solid var(--border-2);
    border-radius: var(--r);
    color: var(--tx-1);
    font-size: .875rem;
    padding: 8px 12px;
    transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.form-select { padding-right: 2.25rem; }
.form-control-sm, .form-select-sm { font-size: .8rem; padding-top: 5px; padding-bottom: 5px; }
.form-control::placeholder { color: var(--tx-3); opacity: .8; }
.form-control:focus,
.form-select:focus {
    background-color: var(--surface);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .14);
    color: var(--tx-1);
}
.form-control:disabled,
.form-control[readonly],
.form-select:disabled {
    background-color: var(--surface-3);
    color: var(--tx-3);
}
.form-text { color: var(--tx-3); font-size: .76rem; }

.input-group-text {
    background: var(--surface-3);
    border-color: var(--border-2);
    color: var(--tx-3);
    font-size: .875rem;
    transition: border-color .15s, color .15s;
}
.input-group:focus-within .input-group-text { border-color: var(--accent); color: var(--accent); }

.form-check-input {
    background-color: var(--surface);
    border-color: var(--border-2);
}
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.form-check-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .18); }
.form-check-label { color: var(--tx-2); }

.form-control[type="file"]::file-selector-button {
    background: rgba(var(--accent-rgb), .1);
    border: 0;
    border-right: 1px solid var(--border-2);
    color: var(--accent);
    font-weight: 600;
    margin: -8px 12px -8px -12px;
    padding: 8px 14px;
}
.form-control[type="file"]:hover:not(:disabled)::file-selector-button { background: rgba(var(--accent-rgb), .16); }

/* form section heading */
.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--tx-3);
    margin-bottom: 14px;
    padding: 0;
    border: 0;
}
.section-header::before {
    content: "";
    width: 3px; height: 14px;
    border-radius: 2px;
    background: var(--accent);
    flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────────────────────────
   ALERTS
───────────────────────────────────────────────────────────────────────────── */
@keyframes vp-slide-down {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: none; }
}
.alert {
    --bs-alert-border-radius: var(--r-lg);
    font-size: .86rem;
    border: 1px solid transparent;
    animation: vp-slide-down .3s ease-out;
}
.alert-info    { --bs-alert-bg: rgba(var(--blue-rgb), .08);  --bs-alert-color: var(--blue);  --bs-alert-border-color: rgba(var(--blue-rgb), .2); }
.alert-success { --bs-alert-bg: rgba(var(--green-rgb), .08); --bs-alert-color: #059669;      --bs-alert-border-color: rgba(var(--green-rgb), .22); }
.alert-warning { --bs-alert-bg: rgba(var(--amber-rgb), .1);  --bs-alert-color: var(--amber); --bs-alert-border-color: rgba(var(--amber-rgb), .28); }
.alert-danger,
.alert-error   { --bs-alert-bg: rgba(var(--rose-rgb), .08);  --bs-alert-color: var(--rose);  --bs-alert-border-color: rgba(var(--rose-rgb), .22); }
.alert-error   { background: var(--bs-alert-bg); color: var(--bs-alert-color); border-color: var(--bs-alert-border-color); }
html[data-theme="dark"] .alert-success { --bs-alert-color: #34D399; }
.alert .alert-link { color: inherit; }

/* ─────────────────────────────────────────────────────────────────────────────
   MENUS, MODALS, NAV, PAGINATION
───────────────────────────────────────────────────────────────────────────── */
.dropdown-menu {
    --bs-dropdown-bg: var(--surface);
    --bs-dropdown-color: var(--tx-2);
    --bs-dropdown-border-color: var(--border);
    --bs-dropdown-border-radius: var(--r-lg);
    --bs-dropdown-link-color: var(--tx-2);
    --bs-dropdown-link-hover-color: var(--tx-1);
    --bs-dropdown-link-hover-bg: var(--surface-2);
    --bs-dropdown-link-active-color: #fff;
    --bs-dropdown-link-active-bg: var(--accent);
    --bs-dropdown-divider-bg: var(--border);
    --bs-dropdown-header-color: var(--tx-3);
    box-shadow: var(--shadow-lg);
    font-size: .855rem;
    padding: 6px;
}
.dropdown-item { border-radius: 6px; padding: 7px 12px; }

.modal-content {
    --bs-modal-bg: var(--surface);
    --bs-modal-color: var(--tx-1);
    --bs-modal-border-color: var(--border);
    --bs-modal-header-border-color: var(--border);
    --bs-modal-footer-border-color: var(--border);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-lg);
}
.modal-header { padding: 16px 24px; }
.modal-title { font-weight: 700; font-size: 1.02rem; letter-spacing: -0.01em; }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 12px 24px; background: var(--surface-2); border-bottom-left-radius: var(--r-xl); border-bottom-right-radius: var(--r-xl); }
.modal-backdrop { --bs-backdrop-bg: #06122A; --bs-backdrop-opacity: .55; }

.nav-tabs {
    --bs-nav-tabs-border-color: var(--border);
    --bs-nav-tabs-link-hover-border-color: transparent;
    --bs-nav-tabs-link-active-color: var(--accent);
    --bs-nav-tabs-link-active-bg: transparent;
    --bs-nav-tabs-link-active-border-color: transparent transparent var(--accent);
    gap: 4px;
}
.nav-tabs .nav-link {
    color: var(--tx-3);
    font-size: .855rem;
    font-weight: 600;
    border-width: 0 0 2px;
    padding: 9px 14px;
}
.nav-tabs .nav-link:hover { color: var(--tx-1); }
.nav-pills {
    --bs-nav-pills-link-active-bg: var(--accent);
    --bs-nav-pills-border-radius: var(--r);
}
.nav-pills .nav-link { color: var(--tx-2); font-weight: 600; font-size: .855rem; }

.list-group {
    --bs-list-group-bg: var(--surface);
    --bs-list-group-color: var(--tx-2);
    --bs-list-group-border-color: var(--border);
    --bs-list-group-action-hover-bg: var(--surface-2);
    --bs-list-group-action-hover-color: var(--tx-1);
    --bs-list-group-active-bg: var(--accent);
    --bs-list-group-active-border-color: var(--accent);
}

.pagination {
    --bs-pagination-color: var(--tx-2);
    --bs-pagination-bg: transparent;
    --bs-pagination-border-color: transparent;
    --bs-pagination-hover-color: var(--accent);
    --bs-pagination-hover-bg: rgba(var(--accent-rgb), .08);
    --bs-pagination-hover-border-color: transparent;
    --bs-pagination-active-bg: var(--accent);
    --bs-pagination-active-border-color: var(--accent);
    --bs-pagination-disabled-bg: transparent;
    --bs-pagination-disabled-color: var(--tx-3);
    --bs-pagination-disabled-border-color: transparent;
    --bs-pagination-focus-box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .2);
    gap: 3px;
}
.pagination .page-link {
    border-radius: var(--r) !important;
    font-size: .8rem;
    font-weight: 600;
    min-width: 32px;
    text-align: center;
}
.pagination .page-item.active .page-link { box-shadow: 0 2px 8px rgba(var(--accent-rgb), .35); }

.tooltip { --bs-tooltip-bg: var(--sb-bg); --bs-tooltip-font-size: .75rem; --bs-tooltip-border-radius: 6px; }
html[data-theme="dark"] .tooltip { --bs-tooltip-bg: #22314F; }

.progress { --bs-progress-bg: var(--surface-3); --bs-progress-bar-bg: var(--accent); border-radius: 999px; }

.accordion {
    --bs-accordion-bg: var(--surface);
    --bs-accordion-color: var(--tx-1);
    --bs-accordion-border-color: var(--border);
    --bs-accordion-btn-color: var(--tx-1);
    --bs-accordion-active-color: var(--accent);
    --bs-accordion-active-bg: rgba(var(--accent-rgb), .06);
    --bs-accordion-btn-focus-box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .18);
}

/* ─────────────────────────────────────────────────────────────────────────────
   UTILITY BRIDGES — keep common Bootstrap utilities theme-aware
───────────────────────────────────────────────────────────────────────────── */
.text-muted     { color: var(--tx-3) !important; }
.text-secondary { color: var(--tx-3) !important; }
.text-dark,
.text-body,
.text-black     { color: var(--tx-1) !important; }
.text-primary   { color: var(--accent) !important; }
.bg-white       { background-color: var(--surface) !important; }
.bg-light       { background-color: var(--surface-2) !important; }
.bg-body-tertiary { background-color: var(--surface-2) !important; }
.border, .border-top, .border-bottom, .border-start, .border-end { border-color: var(--border) !important; }
.border-primary { border-color: var(--accent) !important; }
.link-primary   { color: var(--accent) !important; }
hr { border-color: var(--border); opacity: 1; }

html[data-theme="dark"] .text-success { color: #34D399 !important; }
html[data-theme="dark"] .text-danger  { color: #FB7185 !important; }
html[data-theme="dark"] .text-warning { color: #FBBF24 !important; }
html[data-theme="dark"] .text-info    { color: #5EEAD4 !important; }
html[data-theme="dark"] .bg-success-subtle { background-color: rgba(var(--green-rgb), .14) !important; }
html[data-theme="dark"] .bg-danger-subtle  { background-color: rgba(var(--rose-rgb), .14) !important; }
html[data-theme="dark"] .bg-warning-subtle { background-color: rgba(var(--amber-rgb), .14) !important; }
html[data-theme="dark"] .bg-info-subtle    { background-color: rgba(var(--blue-rgb), .14) !important; }
html[data-theme="dark"] .bg-primary-subtle { background-color: rgba(var(--accent-rgb), .16) !important; }

/* ─────────────────────────────────────────────────────────────────────────────
   EMPTY STATE
───────────────────────────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 56px 24px;
    color: var(--tx-3);
}
.empty-state-icon {
    width: 64px; height: 64px;
    border-radius: 18px;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(var(--accent-rgb), .1);
    border: 1px solid rgba(var(--accent-rgb), .16);
    margin-bottom: 16px;
}
.empty-state-icon i { font-size: 1.7rem; color: var(--accent); }
.empty-state h6 { font-weight: 700; color: var(--tx-1); margin-bottom: 4px; font-size: 1rem; }
.empty-state p { font-size: .86rem; margin-bottom: 0; }

/* ─────────────────────────────────────────────────────────────────────────────
   MISC SHARED BITS
───────────────────────────────────────────────────────────────────────────── */
.emp-name {
    color: var(--tx-1);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px dashed var(--border-2);
    padding-bottom: 1px;
}
.emp-name:hover { color: var(--accent); border-bottom-color: var(--accent); }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: .82rem;
    font-weight: 500;
    color: var(--tx-3);
    text-decoration: none;
    transition: color .15s;
}
.back-link:hover { color: var(--accent); }

#loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(6,18,42,.7);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    color: #fff;
}
#loading-overlay .spinner-border { color: #8EA6FF !important; }
body.loaded #loading-overlay { display: none; }

/* ─────────────────────────────────────────────────────────────────────────────
   AUTH (login) — split layout
───────────────────────────────────────────────────────────────────────────── */
/* dvh = the screen actually visible on a phone; plain vh counts the space under the browser bars and makes the page scroll */
.auth-shell { min-height: 100vh; min-height: 100dvh; display: flex; background: var(--body); }
.auth-page, .auth-page body { overscroll-behavior: none; }

.auth-panel {
    width: 46%;
    max-width: 620px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 44px 52px;
    color: #fff;
    background: linear-gradient(160deg, #050D1F 0%, #0A1733 55%, #071428 100%);
}
/* blueprint grid */
.auth-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255,255,255,.028) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.028) 1px, transparent 1px);
    background-size: 40px 40px;
}
/* glow */
.auth-panel::after {
    content: "";
    position: absolute;
    width: 420px; height: 420px;
    border-radius: 50%;
    right: -140px; bottom: -120px;
    background: radial-gradient(circle, rgba(var(--accent-rgb), .32) 0%, transparent 70%);
    pointer-events: none;
}
.auth-panel > * { position: relative; z-index: 1; }
/* site photo — fades up into the navy so the grid reads over it */
.auth-panel > .auth-photo {
    position: absolute;
    inset: 38% 0 0 0;
    z-index: 0;
    background: var(--auth-photo) center 60% / cover no-repeat;
    opacity: .5;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 55%);
    mask-image: linear-gradient(to bottom, transparent 0%, #000 55%);
    pointer-events: none;
}

.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand .brand-mark { width: 40px; height: 40px; border-radius: 11px; font-size: 1.1rem; }
.auth-brand-name { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.02em; }

.auth-title {
    font-size: clamp(2rem, 3.2vw, 2.7rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.08;
    color: #fff;
    margin: 0 0 16px;
}
.auth-title span { color: #8EA6FF; }
.auth-lede { font-size: .95rem; line-height: 1.7; color: #7D93BA; max-width: 420px; margin: 0; }

.auth-modules {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 32px;
    max-width: 440px;
}
.auth-module {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border-radius: 10px;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.07);
    font-size: .8rem;
    font-weight: 500;
    color: #B3C3E0;
}
.auth-module i {
    width: 28px; height: 28px;
    border-radius: 8px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(var(--accent-rgb), .2);
    color: #8EA6FF;
    font-size: .85rem;
}
.auth-module:nth-child(even) i { background: rgba(var(--teal-rgb), .16); color: #5EE3CF; }

.auth-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.auth-chip {
    font-size: .64rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 4px 9px;
    border-radius: 5px;
    background: rgba(6,18,42,.55);
    border: 1px solid rgba(255,255,255,.12);
    color: rgba(255,255,255,.62);
    backdrop-filter: blur(6px);
}

.auth-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-md);
    padding: 36px 38px;
}
.auth-mobile-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; font-weight: 700; letter-spacing: -0.02em; color: var(--tx-1); }
.auth-card-title { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.03em; margin: 0 0 4px; color: var(--tx-1); }
.auth-card-sub { font-size: .86rem; color: var(--tx-3); margin: 0 0 26px; }

.auth-input { position: relative; }
.auth-input > i {
    position: absolute;
    left: 13px; top: 50%;
    transform: translateY(-50%);
    color: var(--tx-3);
    font-size: .9rem;
    pointer-events: none;
}
.auth-input .form-control { padding: 10px 40px 10px 38px; font-size: .9rem; }
.auth-input-btn {
    position: absolute;
    right: 6px; top: 50%;
    transform: translateY(-50%);
    width: 30px; height: 30px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--tx-3);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
}
.auth-input-btn:hover { color: var(--tx-1); background: var(--surface-3); }
.auth-submit { padding-top: 8px; padding-bottom: 8px; }

.auth-secure {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 14px;
    font-size: .74rem;
    color: var(--tx-3);
}
.auth-secure i { color: var(--green); }
.auth-foot { text-align: center; font-size: .74rem; color: var(--tx-3); margin-top: 22px; }

.auth-theme {
    position: fixed;
    top: 16px; right: 16px;
    z-index: 10;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    border-radius: 50%;
}

/* ─────────────────────────────────────────────────────────────────────────────
   RESPONSIVE
───────────────────────────────────────────────────────────────────────────── */
@media (max-width: 991px) {
    .auth-panel { display: none; }
    .auth-card { padding: 28px 24px; }
}

/* phones: no card — brand on top, form in the middle, footer at the bottom, all on one screen */
@media (max-width: 575.98px) {
    .auth-shell { background: var(--surface); }
    .auth-main { padding: 0; align-items: stretch; }
    .auth-card {
        min-height: 100vh; min-height: 100dvh;
        max-width: none;
        display: flex; flex-direction: column;
        padding: 16px 24px 20px;
        background: none; border: 0; border-radius: 0; box-shadow: none;
    }
    .auth-mobile-brand { min-height: 38px; margin: 0; }   /* same height as the theme button beside it */
    .auth-card-body { margin: auto 0; padding: 28px 0; }
    .auth-card-title { font-size: 1.6rem; }
    .auth-input .form-control { font-size: 16px; padding-top: 12px; padding-bottom: 12px; }   /* under 16px, iPhones zoom in on tap */
    .auth-submit { padding-top: 12px; padding-bottom: 12px; font-size: 1rem; }
    .auth-foot { margin-top: 0; }
    .auth-theme { position: absolute; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); box-shadow: none; }
    .sidebar.open { transform: translateX(0); box-shadow: 8px 0 32px rgba(0,0,0,.4); }
    .sidebar-overlay.open { display: block; }

    /* phones scroll the page itself, so the browser bars never cover the bottom of it */
    .app-body { display: block; height: auto; overflow: visible; }
    .main-content { margin-left: 0; width: 100%; overflow-x: clip; overflow-y: visible; }
    .topbar { padding: 0 16px; }
    .hdr-btn-menu { display: inline-flex; }
    .user-chip-name, .user-chip .bi-chevron-down, .hdr-divider { display: none; }
    .page-body { padding: 18px 16px 32px; }
    .notif-panel { width: calc(100vw - 32px); right: -56px; }

    .page-hero-title { font-size: 1.2rem; }
    .page-hero-actions { width: 100%; }
    /* under 16px, iPhones zoom the page in when a field is tapped — beats page styles that shrink a field */
    :is(input:not([type=checkbox], [type=radio], [type=range], [type=color]), select, textarea) { font-size: 16px !important; }
    input[type=month], .input-group > input[type=month] { min-width: 180px; }   /* room for "September 2026" at that size */
    .d-flex.justify-content-between { flex-wrap: wrap; gap: 12px; }
    .card-body { padding: 16px; }
}

@media (max-width: 576px) {
    .page-body { padding: 14px 10px 28px; }
    .row.g-3 > [class*="col-"]:not(.col-12) { flex: 0 0 50%; max-width: 50%; }

    /* KPI tiles two-up on phones */
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .stat-card { padding: 14px; gap: 10px; }
    .stat-icon { width: 36px; height: 36px; border-radius: 10px; font-size: 1rem; }
    .stat-value { font-size: 1.2rem; }
    .crumb-section, .crumb-sep { display: none; }
}

/* ─────────────────────────────────────────────────────────────────────────────
   WAREHOUSE pages on phones — content first, like an app
   (.wh-page on the page wrapper; .wh-title-in-bar on a hero whose title the top bar already shows)
───────────────────────────────────────────────────────────────────────────── */
@media (max-width: 767.98px) {
    .wh-page { padding-bottom: 64px; }   /* last row clears the floating button */
    .wh-page .page-hero { flex-wrap: nowrap; margin-bottom: 12px; }
    .wh-page .page-hero-icon { display: none; }
    .wh-page .page-hero-actions { width: auto; flex-shrink: 0; }
    .wh-page .page-hero.wh-title-in-bar { margin: 0; }
    .wh-page .wh-title-in-bar .page-hero-left { display: none; }

    /* main action floats bottom-right */
    .wh-page .wh-actions .btn-primary {
        position: fixed;
        right: 16px; bottom: 20px;
        z-index: 1020;
        padding: 12px 20px;
        border-radius: 999px;
        box-shadow: 0 8px 24px rgba(var(--accent-rgb), .45);
    }

    /* totals: one slim row */
    .wh-page .wh-summary {
        display: flex;
        gap: 0;
        padding: 4px 0;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--r-lg);
        box-shadow: var(--shadow);
    }
    .wh-page .wh-summary .stat-card {
        flex: 1 1 0; min-width: 0;
        flex-direction: column; justify-content: center; gap: 0;
        padding: 8px 4px;
        text-align: center;
        background: none; border: 0; border-radius: 0; box-shadow: none; transform: none;
    }
    .wh-page .wh-summary .stat-card + .stat-card { border-left: 1px solid var(--border); }
    .wh-page .wh-summary .stat-card::after, .wh-page .wh-summary .stat-icon { display: none; }
    .wh-page .wh-summary .stat-label { font-size: .7rem; font-weight: 600; letter-spacing: 0; text-transform: none; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .wh-page .wh-summary .stat-value { font-size: 1.1rem; }

    /* search and filter on one line, straight on the page */
    .wh-page .wh-toolbar { flex-wrap: nowrap; padding: 0; background: none; border: 0; box-shadow: none; }
    .wh-page .wh-search { min-width: 0; max-width: none !important; }
    .wh-page .wh-filter-text, .wh-page .wh-toolbar > .text-muted { display: none; }

    /* filters open as a sheet from the bottom, over a dimmed page */
    .wh-page .wh-filter-menu.show {
        position: fixed !important;
        inset: auto 0 0 0 !important;
        transform: none !important;
        width: auto;
        max-height: 85vh;
        overflow-y: auto;
        z-index: 1060;
        border: 0;
        border-radius: 18px 18px 0 0;
        box-shadow: 0 0 0 100vmax rgba(6, 18, 42, .45);   /* dims the page around the sheet */
    }
    .wh-page .wh-filter-menu.show::before {   /* catches taps on the dimmed page (base.html closes the sheet) */
        content: "";
        position: fixed; inset: 0; z-index: -1;
    }
    .wh-page .wh-sheet-head {
        display: flex; align-items: center; justify-content: space-between;
        padding: 14px 16px 4px;
        font-weight: 700; color: var(--tx-1);
    }
    .wh-page .wh-filter-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
    .wh-page .wh-filter-foot .btn { padding-top: 10px; padding-bottom: 10px; font-size: .9rem; }

    /* "saved" messages pop up at the bottom, above the floating button, and fade (base.html) */
    .wh-page > .alert-success {
        position: fixed;
        left: 16px; right: 16px; bottom: 84px;
        z-index: 1040;
        margin: 0;
        padding-left: 44px;
        background: var(--surface);   /* solid: it floats over the list */
        color: var(--tx-1);
        font-weight: 500;
        box-shadow: 0 10px 30px rgba(6, 18, 42, .22);
    }
    .wh-page > .alert-success::before {
        content: "\F26A";   /* bi-check-circle-fill */
        font-family: "bootstrap-icons";
        position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
        color: var(--green);
    }
}
.wh-sheet-head { display: none; }

/* ─────────────────────────────────────────────────────────────────────────────
   WAREHOUSE phone lists — rows inside one card, like an app list
   .wh-list-label (group heading) → .wh-list → .wh-list-row (icon · main · end · chevron)
───────────────────────────────────────────────────────────────────────────── */
.wh-list-label {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 6px 4px 8px;
    font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
    color: var(--tx-3);
}
.wh-list-label a { font-size: .8rem; font-weight: 600; letter-spacing: 0; text-transform: none; text-decoration: none; }
.wh-list {
    margin-bottom: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.wh-list-row {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px;
    color: inherit; text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}
.wh-list-row + .wh-list-row { border-top: 1px solid var(--border); }
a.wh-list-row { transition: background .12s; }
a.wh-list-row:hover { color: inherit; }
a.wh-list-row:active { background: var(--surface-2); }
.wh-list-icon {
    width: 34px; height: 34px;
    border-radius: 10px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface-3);
    color: var(--tx-2);
    font-size: .95rem;
}
.wh-list-main { flex: 1; min-width: 0; }
.wh-list-title { display: flex; align-items: center; gap: 6px; min-width: 0; font-weight: 600; color: var(--tx-1); }
.wh-list-title > .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wh-list-sub { margin-top: 1px; font-size: .78rem; line-height: 1.4; color: var(--tx-3); }
.wh-list-end { flex-shrink: 0; text-align: right; }
.wh-list-num { font-size: 1.05rem; font-weight: 700; line-height: 1.15; color: var(--tx-1); font-variant-numeric: tabular-nums; }
.wh-list-cap { font-size: .68rem; color: var(--tx-3); }
.wh-list-chev { flex-shrink: 0; margin-right: -4px; font-size: .8rem; color: var(--tx-3); }
.wh-list .ds-badge { flex-shrink: 0; }
.wh-list-empty { padding: 18px 16px; font-size: .85rem; color: var(--tx-3); text-align: center; }
.wh-flag { font-weight: 600; color: var(--tx-2); }
.wh-flag.low { color: var(--amber); }


/* ─────────────────────────────────────────────────────────────────────────────
   APP BAR — form and detail screens on phones show "← Title" instead of menu + crumbs
   (body_class "has-app-bar", plus "app-sheet" for a plain white form screen; an app_bar block
   with .app-bar-back / .app-bar-title and an optional .app-bar-action on the right)
───────────────────────────────────────────────────────────────────────────── */
.app-bar-back, .app-bar-title, .app-bar-action { display: none; }
@media (max-width: 768px) {
    .has-app-bar .hdr-btn-menu,
    .has-app-bar .topbar-crumbs,
    .has-app-bar .topbar-actions,
    .has-app-bar .back-link,
    .has-app-bar .page-hero-left { display: none; }
    .has-app-bar .page-hero { margin: 0; }
    body.app-sheet, .app-sheet .main-content { background: var(--surface); }
    .has-app-bar .app-bar-back { display: inline-flex; margin-left: -8px; color: var(--tx-1); font-size: 1.25rem; }
    .has-app-bar .app-bar-action { display: inline-flex; margin-left: auto; margin-right: -8px; color: var(--tx-1); font-size: 1.1rem; }
    .has-app-bar .app-bar-title {
        display: block;
        min-width: 0;
        overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
        font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em;
        color: var(--tx-1);
    }
}
