/* ==========================================================================
   Audit Hive – 3D UI Layer
   ---------------------------------------------------------------------------
   Loaded LAST (after every page stylesheet) so all pages share one look.
   Purely visual: no element is hidden, moved or re-ordered.

   Depth model
     • Surfaces have a "thickness" edge (1–3px darker rim under the face),
       a top bevel highlight and a soft ambient + key shadow.
     • Interactive things (buttons, tiles, chips) rise on hover and press
       down on :active.
     • Light mode = shadows.  Dark mode = rim light + coloured glow.

   Sections: 1 Tokens  2 Canvas  3 Page hero (shared)  4 Cards  5 Tiles &
             icon chips  6 Buttons  7 Forms  8 Tabs  9 Tables  10 Overlays
             11 Detail heroes  12 Responsive / motion
   ========================================================================== */

/* ---------- 1. Tokens --------------------------------------------------- */
:root {
    --ah-hero-gradient: linear-gradient(135deg, #0f1a3a 0%, #162a66 48%, #2341a8 100%);
    --ah-hero-rim: rgba(10, 18, 48, 0.55);

    /* surface rim (the visible "thickness" under a raised surface) */
    --ah-rim: rgba(15, 23, 42, 0.10);
    --ah-rim-strong: rgba(15, 23, 42, 0.16);
    --ah-bevel: inset 0 1px 0 rgba(255, 255, 255, 0.95), inset 0 -1px 0 rgba(15, 23, 42, 0.04);

    --ah-depth-1: 0 1px 0 var(--ah-rim), 0 2px 4px -1px rgba(15, 23, 42, 0.06), 0 8px 18px -8px rgba(15, 23, 42, 0.12);
    --ah-depth-2: 0 2px 0 var(--ah-rim), 0 6px 10px -4px rgba(15, 23, 42, 0.08), 0 18px 34px -14px rgba(15, 23, 42, 0.22);
    --ah-depth-3: 0 3px 0 var(--ah-rim-strong), 0 12px 18px -8px rgba(15, 23, 42, 0.12), 0 30px 60px -20px rgba(15, 23, 42, 0.30);

    --ah-well: inset 0 2px 4px rgba(15, 23, 42, 0.06), inset 0 1px 1px rgba(15, 23, 42, 0.04);
    --ah-btn-edge: inset 0 1px 0 rgba(255, 255, 255, 0.28), inset 0 -2px 0 rgba(0, 0, 0, 0.18);

    --ah-canvas:
        radial-gradient(1100px 520px at 100% -10%, rgba(var(--ah-primary-rgb), 0.07), transparent 60%),
        radial-gradient(900px 480px at -10% 110%, rgba(var(--ah-accent-rgb), 0.06), transparent 60%);

    /* every page stylesheet's hero gradient now resolves to the shared one */
    --premium-gradient: var(--ah-hero-gradient);
}

html[data-bs-theme="dark"] {
    --ah-hero-gradient: linear-gradient(135deg, #0b1230 0%, #14225a 50%, #253f9e 100%);
    --ah-hero-rim: rgba(0, 0, 0, 0.6);
    --ah-rim: rgba(0, 0, 0, 0.55);
    --ah-rim-strong: rgba(0, 0, 0, 0.7);
    --ah-bevel: inset 0 1px 0 rgba(255, 255, 255, 0.07), inset 0 -1px 0 rgba(0, 0, 0, 0.35);

    --ah-depth-1: 0 1px 0 var(--ah-rim), 0 2px 6px -1px rgba(0, 0, 0, 0.4), 0 10px 22px -10px rgba(0, 0, 0, 0.6);
    --ah-depth-2: 0 2px 0 var(--ah-rim), 0 8px 14px -6px rgba(0, 0, 0, 0.5), 0 22px 40px -16px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.02);
    --ah-depth-3: 0 3px 0 var(--ah-rim-strong), 0 14px 22px -8px rgba(0, 0, 0, 0.55), 0 34px 64px -20px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(var(--ah-primary-rgb), 0.12);

    --ah-well: inset 0 2px 5px rgba(0, 0, 0, 0.35), inset 0 1px 1px rgba(0, 0, 0, 0.3);
    --ah-btn-edge: inset 0 1px 0 rgba(255, 255, 255, 0.22), inset 0 -2px 0 rgba(0, 0, 0, 0.3);

    --ah-canvas:
        radial-gradient(1100px 520px at 100% -10%, rgba(var(--ah-primary-rgb), 0.10), transparent 60%),
        radial-gradient(900px 480px at -10% 110%, rgba(var(--ah-accent-rgb), 0.06), transparent 60%);
}

/* ---------- 2. Canvas --------------------------------------------------- */
body:not(:has(.account-pages)) {
    background-image: var(--ah-canvas);
    background-attachment: fixed;
    background-repeat: no-repeat;
}

/* one container rhythm for every page shell */
.premium-container {
    margin: 0 auto 1.25rem !important;
    padding: 0 !important;
    width: 100%;
    max-width: 100%;
}
.premium-container + .premium-container { margin-top: 1.25rem !important; }

/* ---------- 3. Page hero (shared by every page) -------------------------
   .premium-header       – hero band at the top of a .premium-card / .card
   .premium-card-header  – same, used by create/edit project & audit list
   .assessment-header    – form view / response header
   .ah-page-head         – stand-alone hero for pages without a hero card
   ------------------------------------------------------------------------ */
.premium-header,
.premium-card-header,
.assessment-header,
.ah-page-head {
    position: relative;
    isolation: isolate;
    background: var(--ah-hero-gradient) !important;
    color: #fff !important;
    padding: 1.4rem 1.75rem !important;
    border: 0 !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.16),
        inset 0 -1px 0 rgba(0, 0, 0, 0.25),
        inset 0 -18px 30px -24px rgba(0, 0, 0, 0.55) !important;
}
.premium-header.bg-gradient-slate { background: var(--ah-hero-gradient) !important; }

/* light blobs + grid on every hero (premium.css already does this for .premium-header) */
.premium-card-header::before,
.assessment-header::before,
.ah-page-head::before {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; border-radius: inherit;
    background:
        radial-gradient(600px 220px at 85% -20%, rgba(var(--ah-primary-rgb), 0.55), transparent 60%),
        radial-gradient(400px 180px at 10% 120%, rgba(var(--ah-accent-rgb), 0.32), transparent 60%);
}
.premium-card-header::after,
.assessment-header::after,
.ah-page-head::after {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0.35; border-radius: inherit;
    background-image: linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px);
    background-size: 28px 28px;
    -webkit-mask-image: radial-gradient(circle at 70% 30%, #000 20%, transparent 75%); mask-image: radial-gradient(circle at 70% 30%, #000 20%, transparent 75%);
}

/* heroes that sit at the top of a card keep the card's top corners */
.premium-header,
.premium-card-header,
.assessment-header,
.card > .premium-header:first-child {
    border-radius: var(--ah-radius-lg) var(--ah-radius-lg) 0 0 !important;
}
.modal-content > .premium-card-header { border-radius: 0 !important; }

/* text on any hero */
.premium-header :is(h1, h2, h3, h4, h5, h6, .card-title, .modal-title),
.premium-card-header :is(h1, h2, h3, h4, h5, h6, .card-title, .modal-title),
.assessment-header :is(h1, h2, h3, h4, h5, h6),
.ah-page-head :is(h1, h2, h3, h4, h5, h6) {
    color: #fff !important;
    font-weight: 800; letter-spacing: -0.01em;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25), 0 6px 18px rgba(0, 0, 0, 0.25);
}
/* one heading size for every hero (pages used h2/h4/h5 at different sizes) */
.premium-header :is(h1, h2, h3, h4, h5):not(.dropdown-menu *),
.premium-card-header :is(h1, h2, h3, h4, h5),
.assessment-header :is(h1, h2, h3, h4),
.ah-page-head :is(h1, h4) { font-size: 1.25rem !important; line-height: 1.3; }
.premium-header .btn-premium, .premium-card-header .btn-premium {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.5rem 1.1rem !important; font-size: var(--ah-fs-md) !important; font-weight: 700;
    min-height: 40px; width: auto; height: auto;
    border: 0; border-radius: var(--ah-radius-sm) !important; color: #fff !important;
    background: var(--ah-primary-gradient) !important;
    box-shadow: var(--ah-btn-edge), 0 8px 18px -8px rgba(0, 0, 0, 0.6) !important;
    transition: transform var(--ah-dur-fast) var(--ah-ease), filter var(--ah-dur-fast) ease;
}
.premium-header .btn-premium:hover, .premium-card-header .btn-premium:hover { transform: translateY(-2px); filter: brightness(1.08); }
.premium-header .btn-premium:active, .premium-card-header .btn-premium:active { transform: translateY(1px); }
.premium-card-header .btn i, .premium-card-header .btn-premium i, .premium-header .btn i {
    padding: 0 !important; background: none !important; box-shadow: none !important; border: 0 !important;
    width: auto !important; height: auto !important; transform: none !important;
    font-size: 1.05rem !important; color: inherit !important;
}
.premium-header :is(p, small, .text-muted, .text-secondary),
.premium-card-header :is(p, small, .text-muted, .text-secondary),
.assessment-header :is(p, small, .text-muted, .text-secondary),
.ah-page-head :is(p, small, .text-muted, .text-secondary) {
    color: rgba(255, 255, 255, 0.78) !important;
}
.premium-header :is(h1, h2, h3, h4, h5, h6) i,
.premium-header :is(.text-primary, .text-dark, .text-body),
.premium-card-header :is(h1, h2, h3, h4, h5, h6) i,
.ah-page-head :is(h1, h2, h3, h4, h5, h6) i { color: #fff !important; }
.premium-card-header a:not(.btn), .assessment-header a:not(.btn), .ah-page-head a:not(.btn) { color: #fff; opacity: 0.85; text-decoration: none; }
.premium-card-header a:not(.btn):hover, .ah-page-head a:not(.btn):hover { opacity: 1; text-decoration: underline; }
.premium-header .btn-close, .premium-card-header .btn-close { filter: invert(1) brightness(2); }

/* the leading icon of a hero becomes a floating glass cube */
.ah-hero-icon,
.premium-card-header > i:first-child,
.premium-card-header > .d-flex > i:first-child {
    flex: 0 0 auto;
    width: 46px; height: 46px; display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.4rem !important; color: #fff !important; padding: 0 !important;
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0.06)) !important;
    border: 1px solid rgba(255, 255, 255, 0.22);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 -3px 0 rgba(0, 0, 0, 0.18), 0 10px 22px -8px rgba(0, 0, 0, 0.55);
    transform: perspective(400px) rotateX(8deg) rotateY(-8deg);
    transition: transform var(--ah-dur) var(--ah-ease);
}
.premium-header:hover .ah-hero-icon, .ah-page-head:hover .ah-hero-icon { transform: perspective(400px) rotateX(0) rotateY(0) translateY(-2px); }

/* hero buttons: glass on dark */
.premium-header .btn:not(.btn-primary):not(.btn-success):not(.btn-danger):not(.btn-warning):not(.btn-info):not(.dropdown-item),
.premium-card-header .btn:not(.btn-primary):not(.btn-success):not(.btn-danger):not(.btn-warning):not(.btn-info),
.ah-page-head .btn:not(.btn-primary):not(.btn-success):not(.btn-danger):not(.btn-warning):not(.btn-info) {
    background: rgba(255, 255, 255, 0.12) !important;
    color: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.26) !important;
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 6px 14px -8px rgba(0, 0, 0, 0.6) !important;
}
.premium-header .btn-light, .premium-header .btn-outline-light, .ah-page-head .btn-light {
    background: rgba(255, 255, 255, 0.94) !important; color: #16255a !important;
}
.premium-header .btn:hover, .premium-card-header .btn:hover, .ah-page-head .btn:hover { transform: translateY(-2px); }
.premium-header .form-control, .premium-header .form-select { background: rgba(255, 255, 255, 0.96) !important; color: #0f172a !important; }
html[data-bs-theme="dark"] .premium-header .form-control, html[data-bs-theme="dark"] .premium-header .form-select { background: var(--ah-surface) !important; color: var(--ah-text) !important; }

/* stand-alone page hero */
.ah-page-head {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem;
    border-radius: var(--ah-radius-lg) !important;
    margin-bottom: 1.25rem;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.16),
        inset 0 -1px 0 rgba(0, 0, 0, 0.25),
        0 3px 0 var(--ah-hero-rim),
        0 18px 36px -18px rgba(22, 37, 90, 0.65) !important;
}
.ah-page-head__title { display: flex; align-items: center; gap: 0.9rem; min-width: 0; }
.ah-page-head__title h4, .ah-page-head__title h1 { margin: 0; font-size: 1.25rem; line-height: 1.25; overflow-wrap: anywhere; }
.ah-page-head__title p { margin: 0.15rem 0 0; font-size: var(--ah-fs-sm); }
.ah-page-head__actions { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.ah-page-head .breadcrumb { margin: 0; --bs-breadcrumb-divider-color: rgba(255,255,255,.6); }
.ah-page-head .breadcrumb-item, .ah-page-head .breadcrumb-item.active { color: rgba(255, 255, 255, 0.78); font-size: var(--ah-fs-sm); }
.ah-page-head .breadcrumb-item + .breadcrumb-item::before { color: rgba(255, 255, 255, 0.5); }

/* ---------- 4. Cards ------------------------------------------------------ */
.card, .premium-card, .dash-card, .chart-card, .glass-card {
    box-shadow: var(--ah-depth-1), var(--ah-bevel) !important;
}
.premium-card, .card:has(> .premium-header:first-child), .card:has(> .premium-card-header:first-child) {
    box-shadow: var(--ah-depth-2), var(--ah-bevel) !important;
}
.premium-card:hover { transform: none; }
.card.shadow-lg, .card.shadow, .card.shadow-sm { box-shadow: var(--ah-depth-1), var(--ah-bevel) !important; }
.card .card { box-shadow: 0 1px 0 var(--ah-rim), var(--ah-bevel) !important; }
.modal .card { box-shadow: 0 1px 0 var(--ah-rim) !important; }

/* tactile lift for "clickable" surfaces */
.dash-card:hover, .chart-card:hover, .hover-shadow:hover, .vendor-card > .card:hover, .ah-lift:hover {
    transform: perspective(1200px) translateY(-4px) rotateX(1.2deg);
    box-shadow: var(--ah-depth-3), var(--ah-bevel) !important;
}
.dash-card:has(.nav-tabs):hover, .dash-card:has(form):hover { transform: none; box-shadow: var(--ah-depth-2), var(--ah-bevel) !important; }

/* card header: slightly raised strip with a bevel line */
.card-header:not(.premium-header):not(.premium-card-header):not(.modal-header) {
    box-shadow: inset 0 -1px 0 var(--ah-border), inset 0 1px 0 rgba(255, 255, 255, 0.6);
    background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0)) !important;
}
html[data-bs-theme="dark"] .card-header:not(.premium-header):not(.premium-card-header):not(.modal-header) {
    box-shadow: inset 0 -1px 0 var(--ah-border), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0)) !important;
}
.card-header:not(.premium-header):not(.premium-card-header):not(.modal-header) :is(h4, h5, .card-title) > i:first-child,
.ah-icon-3d {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 10px; font-size: 1.05rem;
    color: var(--ah-primary) !important;
    -webkit-text-fill-color: currentColor;   /* some headings use gradient text-fill; keep the glyph visible */
    background: linear-gradient(145deg, rgba(var(--ah-primary-rgb), 0.18), rgba(var(--ah-primary-rgb), 0.06));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), inset 0 -2px 0 rgba(var(--ah-primary-rgb), 0.18), 0 4px 10px -4px rgba(var(--ah-primary-rgb), 0.45);
    margin-right: 0.6rem !important; vertical-align: middle;
}
html[data-bs-theme="dark"] .card-header:not(.premium-header):not(.premium-card-header):not(.modal-header) :is(h4, h5, .card-title) > i:first-child,
html[data-bs-theme="dark"] .ah-icon-3d { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), inset 0 -2px 0 rgba(0, 0, 0, 0.3), 0 4px 12px -4px rgba(var(--ah-primary-rgb), 0.5); }

/* ---------- 5. Stat / KPI tiles & icon chips ------------------------------- */
.stat-card, .kpi-card {
    box-shadow: var(--ah-depth-2), var(--ah-bevel) !important;
}
.stat-card:hover, .kpi-card:hover {
    transform: perspective(900px) translateY(-6px) rotateX(3deg);
    box-shadow: var(--ah-depth-3), var(--ah-bevel) !important;
}
.stat-icon, .ah-chip-3d {
    position: relative;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), inset 0 -3px 0 rgba(15, 23, 42, 0.10), 0 10px 20px -10px rgba(15, 23, 42, 0.35);
    transform: perspective(400px) rotateX(10deg) translateZ(0);
    transition: transform var(--ah-dur) var(--ah-ease);
}
html[data-bs-theme="dark"] .stat-icon, html[data-bs-theme="dark"] .ah-chip-3d {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), inset 0 -3px 0 rgba(0, 0, 0, 0.35), 0 10px 22px -10px rgba(0, 0, 0, 0.8);
}
.ah-chip-lg { width: 52px; height: 52px; flex: 0 0 52px; border-radius: 15px !important; font-size: 1.5rem; }
.ah-chip-lg i { font-size: 1.5rem !important; }
.ah-chip-3d.bg-primary-subtle { background: linear-gradient(145deg, rgba(var(--ah-primary-rgb), 0.20), rgba(var(--ah-primary-rgb), 0.08)) !important; color: var(--ah-primary) !important; }
.ah-chip-3d.bg-danger-subtle  { background: linear-gradient(145deg, rgba(var(--ah-danger-rgb), 0.20),  rgba(var(--ah-danger-rgb), 0.08)) !important;  color: var(--ah-danger) !important; }
.ah-chip-3d.bg-warning-subtle { background: linear-gradient(145deg, rgba(var(--ah-warning-rgb), 0.24), rgba(var(--ah-warning-rgb), 0.10)) !important; color: var(--ah-warning) !important; }
.ah-chip-3d.bg-success-subtle { background: linear-gradient(145deg, rgba(var(--ah-success-rgb), 0.22), rgba(var(--ah-success-rgb), 0.08)) !important; color: var(--ah-success) !important; }
.ah-chip-3d i { color: inherit !important; }
.stat-card:hover .stat-icon, .hover-shadow:hover .ah-chip-3d { transform: perspective(400px) rotateX(0) translateY(-3px) scale(1.05); }
.stat-value { font-weight: 800; letter-spacing: -0.02em; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6); }
html[data-bs-theme="dark"] .stat-value { text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5); }

/* ---------- 6. Buttons ------------------------------------------------------ */
.btn-primary, .btn-success, .btn-danger, .btn-warning, .btn-info {
    box-shadow: var(--ah-btn-edge), 0 6px 14px -6px rgba(var(--ah-primary-rgb), 0.6) !important;
}
.btn-success { box-shadow: var(--ah-btn-edge), 0 6px 14px -6px rgba(var(--ah-success-rgb), 0.6) !important; }
.btn-danger  { box-shadow: var(--ah-btn-edge), 0 6px 14px -6px rgba(var(--ah-danger-rgb), 0.6) !important; }
.btn-warning { box-shadow: var(--ah-btn-edge), 0 6px 14px -6px rgba(var(--ah-warning-rgb), 0.6) !important; }
.btn-info    { box-shadow: var(--ah-btn-edge), 0 6px 14px -6px rgba(var(--ah-info-rgb), 0.6) !important; }
.btn-primary:hover, .btn-success:hover, .btn-danger:hover, .btn-warning:hover, .btn-info:hover { transform: translateY(-2px); filter: brightness(1.06); }
.btn-secondary, .btn-light, .btn-outline-secondary {
    box-shadow: 0 1px 0 var(--ah-rim), var(--ah-bevel), 0 4px 10px -6px rgba(15, 23, 42, 0.25) !important;
}
.btn:not(.btn-link):not(.nav-link):active, .btn:not(.btn-link).active:not(.nav-link) {
    transform: translateY(1px) scale(0.99) !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.18) !important;
    filter: none;
}
.btn:disabled, .btn.disabled { transform: none !important; }
[class*="btn-soft-"] { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 -2px 0 rgba(0, 0, 0, 0.06) !important; }
[class*="btn-soft-"]:hover { transform: translateY(-1px); }
.btn-outline-primary:hover, .btn-outline-danger:hover, .btn-outline-success:hover { transform: translateY(-1px); box-shadow: 0 6px 14px -8px rgba(var(--ah-primary-rgb), 0.55) !important; }

/* ---------- 7. Forms -------------------------------------------------------- */
.form-control, .form-select, .input-group-text {
    box-shadow: var(--ah-well) !important;
    background-color: var(--ah-surface-2) !important;
}
.form-control:hover:not(:focus):not(:disabled), .form-select:hover:not(:focus):not(:disabled) { border-color: rgba(var(--ah-primary-rgb), 0.35) !important; }
.form-control:focus, .form-select:focus {
    background-color: var(--ah-surface) !important;
    box-shadow: var(--ah-focus-ring), 0 6px 16px -10px rgba(var(--ah-primary-rgb), 0.6) !important;
}
.form-control:disabled, .form-control[readonly], .form-select:disabled { background-color: var(--ah-surface-3) !important; }
.form-check-input { box-shadow: var(--ah-well); }
.form-check-input:checked { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 3px 8px -2px rgba(var(--ah-primary-rgb), 0.6); }
.premium-header .form-control, .premium-header .form-select { box-shadow: 0 6px 14px -8px rgba(0, 0, 0, 0.5) !important; }

/* ---------- 8. Tabs: raised segmented track ---------------------------------- */
.nav-tabs {
    border-bottom: 0 !important;
    padding: 4px; gap: 4px;
    border-radius: var(--ah-radius-md);
    background: var(--ah-surface-3);
    box-shadow: var(--ah-well);
    display: inline-flex; flex-wrap: wrap; max-width: 100%;
}
.nav-tabs .nav-link {
    border-radius: var(--ah-radius-sm) !important;
    border: 0 !important;
    padding: 0.5rem 1rem;
    transition: background var(--ah-dur-fast) ease, color var(--ah-dur-fast) ease, box-shadow var(--ah-dur-fast) ease, transform var(--ah-dur-fast) var(--ah-ease);
}
.nav-tabs .nav-link:hover { background: rgba(var(--ah-surface-rgb), 0.6); }
.nav-tabs .nav-link.active, .nav-tabs .nav-item.show .nav-link {
    color: var(--ah-primary) !important;
    background: var(--ah-surface) !important;
    box-shadow: 0 1px 0 var(--ah-rim), var(--ah-bevel), 0 6px 14px -8px rgba(15, 23, 42, 0.35) !important;
    transform: translateY(-1px);
}
html[data-bs-theme="dark"] .nav-tabs .nav-link.active { background: var(--ah-elevated) !important; box-shadow: 0 1px 0 var(--ah-rim), var(--ah-bevel), 0 6px 16px -8px rgba(var(--ah-primary-rgb), 0.5) !important; }
.card-header .nav-tabs { margin: 0; }

/* ---------- 9. Tables ---------------------------------------------------------- */
.table thead th, .premium-table thead th {
    box-shadow: inset 0 -1px 0 var(--ah-border-strong), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0)) !important;
}
html[data-bs-theme="dark"] .table thead th { box-shadow: inset 0 -1px 0 var(--ah-border-strong), inset 0 1px 0 rgba(255, 255, 255, 0.04); background-image: none !important; }
.table-hover tbody tr:hover {
    box-shadow: inset 3px 0 0 var(--ah-primary), 0 6px 14px -10px rgba(15, 23, 42, 0.35) !important;
    position: relative; z-index: 1;
}
.pagination .page-link { box-shadow: 0 1px 0 var(--ah-rim), var(--ah-bevel); }
.pagination .page-link:hover { transform: translateY(-1px); }
.pagination .page-item.active .page-link { box-shadow: var(--ah-btn-edge), 0 6px 14px -6px rgba(var(--ah-primary-rgb), 0.7); }

/* badges: tiny raised pills */
.badge:not(.badge-soft):not(.badge-status):not([class*="badge-soft-"]) { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.15); }
.badge-status, .badge-soft, [class*="badge-soft-"] { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35); }

/* ---------- 10. Overlays ---------------------------------------------------- */
.modal-content { box-shadow: var(--ah-depth-3), var(--ah-bevel) !important; }
.modal.fade .modal-dialog { transform: perspective(1200px) translateY(18px) rotateX(-6deg) scale(0.97); transform-origin: 50% 0; }
.modal.show .modal-dialog { transform: none; }
/* every modal header = the same navy 3D hero as page headers
   (views used bg-primary, bg-light, bg-success, bg-warning-gradient, bg-premium-ai … ) */
html .modal .modal-content > .modal-header {
    position: relative; isolation: isolate;
    background: var(--ah-hero-gradient) !important;
    color: #fff !important;
    border-bottom: 0 !important;
    padding: 1rem 1.25rem !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), inset 0 -1px 0 rgba(0, 0, 0, 0.25), inset 0 -14px 24px -20px rgba(0, 0, 0, 0.55) !important;
}
html .modal .modal-content > .modal-header::before {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background: radial-gradient(420px 160px at 90% -30%, rgba(var(--ah-primary-rgb), 0.55), transparent 60%),
                radial-gradient(300px 140px at 0% 140%, rgba(var(--ah-accent-rgb), 0.28), transparent 60%);
}
html .modal .modal-content > .modal-header :is(.modal-title, h1, h2, h3, h4, h5, h6, span, i, .text-primary, .text-premium-ai, .text-dark, .text-body) {
    color: #fff !important; -webkit-text-fill-color: currentColor;
}
html .modal .modal-content > .modal-header :is(.text-muted, small, p) { color: rgba(255, 255, 255, 0.78) !important; }
html .modal .modal-content > .modal-header .modal-title { font-weight: 800; letter-spacing: -0.01em; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); }
html .modal .modal-content > .modal-header .modal-title > i:first-child {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 10px; margin-right: 0.6rem !important; font-size: 1.05rem !important;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0.06));
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 -2px 0 rgba(0, 0, 0, 0.18), 0 6px 14px -6px rgba(0, 0, 0, 0.55);
}
/* form-builder Q-AI modals use their own centred header block */
html .modal .modal-ai-header {
    background: var(--ah-hero-gradient) !important; color: #fff !important; isolation: isolate; position: relative;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), inset 0 -14px 24px -20px rgba(0, 0, 0, 0.55);
}
html .modal .modal-ai-header::before {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background: radial-gradient(420px 160px at 90% -30%, rgba(var(--ah-primary-rgb), 0.55), transparent 60%),
                radial-gradient(300px 140px at 0% 140%, rgba(var(--ah-accent-rgb), 0.28), transparent 60%);
}
html .modal .modal-ai-header :is(h1, h2, h3, h4, h5, p, i, span) { color: #fff !important; }
html .modal .modal-ai-header p { opacity: 0.8; }
html .modal .modal-content > .modal-header .btn-close { filter: invert(1) grayscale(100%) brightness(200%) !important; opacity: 0.85; }
html .modal .modal-content > .modal-header .btn-close:hover { opacity: 1; }
.dropdown-menu { box-shadow: var(--ah-depth-3), var(--ah-bevel); }
.alert { box-shadow: 0 1px 0 var(--ah-rim), var(--ah-bevel); }

/* ---------- 11. Detail-page heroes (project / vendor / risk) ----------------------
   Same navy 3D hero as Tenant Detail / Support ticket, so every detail page
   opens the same way. Content inside keeps its markup; only colours adapt.        */
html[data-bs-theme] :is(.ah-detail-hero, .hero-card-3d) {
    position: relative; overflow: hidden; isolation: isolate;
    border: 0 !important;
    border-radius: var(--ah-radius-lg) !important;
    background: var(--ah-hero-gradient) !important;
    color: #fff;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.16),
        inset 0 -1px 0 rgba(0, 0, 0, 0.25),
        0 3px 0 var(--ah-hero-rim),
        0 22px 44px -20px rgba(22, 37, 90, 0.7) !important;
}
html[data-bs-theme] :is(.ah-detail-hero, .hero-card-3d)::before {
    content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none; border-radius: inherit;
    background:
        radial-gradient(700px 260px at 90% -20%, rgba(var(--ah-primary-rgb), 0.55), transparent 60%),
        radial-gradient(480px 220px at 0% 120%, rgba(var(--ah-accent-rgb), 0.30), transparent 60%);
    box-shadow: none;
}
html[data-bs-theme] :is(.ah-detail-hero, .hero-card-3d)::after {
    content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: 0.35; border-radius: inherit;
    background-image: linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px);
    background-size: 28px 28px;
    -webkit-mask-image: radial-gradient(circle at 75% 25%, #000 15%, transparent 70%); mask-image: radial-gradient(circle at 75% 25%, #000 15%, transparent 70%);
}
.ah-detail-hero:hover, .hero-card-3d:hover { transform: none; }
.ah-detail-hero > .card-body, .hero-card-3d > .card-body { position: relative; z-index: 1; }

/* text on the navy hero */
:is(.ah-detail-hero, .hero-card-3d) :is(h1, h2, h3, h4, h5, h6, .text-dark, .text-body, .fw-bold:not(.badge):not(.btn)) {
    color: #fff !important;
}
:is(.ah-detail-hero, .hero-card-3d) :is(h1, h2, h3) { text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25), 0 8px 22px rgba(0, 0, 0, 0.3); letter-spacing: -0.01em; }
:is(.ah-detail-hero, .hero-card-3d) :is(.text-muted, .text-secondary, p, small) { color: rgba(255, 255, 255, 0.76) !important; }
:is(.ah-detail-hero, .hero-card-3d) i.text-primary, :is(.ah-detail-hero, .hero-card-3d) .text-primary:not(.badge) { color: #a9b8ff !important; }
:is(.ah-detail-hero, .hero-card-3d) a:not(.btn) { color: #fff !important; text-decoration: none; opacity: 0.9; }
:is(.ah-detail-hero, .hero-card-3d) a:not(.btn):hover { opacity: 1; text-decoration: underline; }

/* leading icon / avatar → floating glass cube */
:is(.ah-detail-hero, .hero-card-3d) :is(.ah-hero-icon, .vendor-avatar) {
    width: 64px !important; height: 64px !important; border-radius: 18px !important; flex: 0 0 64px;
    display: inline-flex; align-items: center; justify-content: center; padding: 0 !important;
    font-size: 1.8rem !important; color: #fff !important;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.06)) !important;
    border: 1px solid rgba(255, 255, 255, 0.24) !important;
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 -4px 0 rgba(0, 0, 0, 0.18), 0 14px 28px -10px rgba(0, 0, 0, 0.6) !important;
    transform: perspective(500px) rotateX(10deg) rotateY(-10deg);
    transition: transform var(--ah-dur) var(--ah-ease);
}
:is(.ah-detail-hero, .hero-card-3d):hover :is(.ah-hero-icon, .vendor-avatar) { transform: perspective(500px) rotateX(0) rotateY(0) translateY(-2px); }
:is(.ah-detail-hero, .hero-card-3d) :is(.ah-hero-icon, .vendor-avatar) i { color: #fff !important; font-size: inherit !important; }

/* stat tiles inside the hero → raised glass blocks */
.ah-hero-stat {
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.05)) !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    border-radius: var(--ah-radius-md) !important;
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), inset 0 -2px 0 rgba(0, 0, 0, 0.2), 0 12px 24px -14px rgba(0, 0, 0, 0.7) !important;
    transition: transform var(--ah-dur) var(--ah-ease), background var(--ah-dur) ease, box-shadow var(--ah-dur) ease !important;
}
.ah-hero-stat:hover {
    transform: perspective(700px) translateY(-4px) rotateX(4deg);
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.08)) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), inset 0 -2px 0 rgba(0, 0, 0, 0.2), 0 20px 34px -14px rgba(0, 0, 0, 0.8) !important;
}
.ah-hero-stat { flex-direction: column; align-items: flex-start !important; gap: 0.6rem !important; padding: 0.9rem 1rem !important; min-width: 0; }
.ah-hero-stat > div { min-width: 0; }
.ah-hero-stat .text-uppercase { font-size: 0.68rem !important; letter-spacing: 0.04em; line-height: 1.25; white-space: nowrap; }
.ah-hero-stat > i {
    width: 38px; height: 38px; flex: 0 0 38px; border-radius: 11px;
    display: inline-flex; align-items: center; justify-content: center; font-size: 1.2rem !important;
    color: #fff !important;
    background: linear-gradient(145deg, rgba(var(--ah-primary-rgb), 1), rgba(var(--ah-primary-rgb), 0.65));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 -2px 0 rgba(0, 0, 0, 0.2), 0 8px 16px -8px rgba(0, 0, 0, 0.7);
}
.ah-hero-stat > i.text-danger { background: linear-gradient(145deg, #f87171, #dc2626); }
.ah-hero-stat .fs-4 { font-weight: 800; letter-spacing: -0.02em; }

/* badges & buttons on the navy hero */
:is(.ah-detail-hero, .hero-card-3d) .badge:is(.bg-white, .bg-light, [class*="bg-opacity"], [class*="-subtle"]),
.ah-hero-badge {
    background: rgba(255, 255, 255, 0.14) !important; color: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.26) !important;
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 6px 14px -8px rgba(0, 0, 0, 0.6) !important;
}
:is(.ah-detail-hero, .hero-card-3d) .badge i { color: inherit !important; }
/* risk / status pills: dark-mode palette reads on navy */
:is(.ah-detail-hero, .hero-card-3d) .badge-status { background: rgba(255, 255, 255, 0.12) !important; border-color: rgba(255, 255, 255, 0.22) !important; }
:is(.ah-detail-hero, .hero-card-3d) .badge-status.badge-low      { color: #6ee7b7 !important; }
:is(.ah-detail-hero, .hero-card-3d) .badge-status.badge-medium   { color: #fcd34d !important; }
:is(.ah-detail-hero, .hero-card-3d) .badge-status.badge-high     { color: #fdba74 !important; }
:is(.ah-detail-hero, .hero-card-3d) .badge-status.badge-critical { color: #fca5a5 !important; }
:is(.ah-detail-hero, .hero-card-3d) .badge-status:is(.badge-info, .badge-primary) { color: #bae6fd !important; }
:is(.ah-detail-hero, .hero-card-3d) :is(.btn-outline-secondary, .btn-outline-primary, .btn-light, .btn-secondary) {
    background: rgba(255, 255, 255, 0.12) !important; color: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.28) !important;
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 6px 14px -8px rgba(0, 0, 0, 0.6) !important;
}
:is(.ah-detail-hero, .hero-card-3d) :is(.btn-outline-secondary, .btn-outline-primary, .btn-light, .btn-secondary):hover { background: rgba(255, 255, 255, 0.2) !important; transform: translateY(-2px); }
:is(.ah-detail-hero, .hero-card-3d) .btn i { color: inherit !important; }

/* detail-page tab bar (project details) → same raised segmented track as .nav-tabs */
.premium-tabs-header {
    background: var(--ah-surface-2) !important;
    padding: 0.9rem 1.25rem !important;
    border-bottom: 1px solid var(--ah-border) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
html[data-bs-theme="dark"] .premium-tabs-header { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04); }
.premium-nav-tabs {
    display: inline-flex !important; max-width: 100%;
    padding: 4px !important; gap: 4px !important;
    border-radius: var(--ah-radius-md);
    background: var(--ah-surface-3);
    box-shadow: var(--ah-well);
}
.premium-nav-tabs .premium-tab-link {
    padding: 0.45rem 0.9rem !important;
    border-radius: var(--ah-radius-sm) !important;
    border-bottom: 0 !important;
    color: var(--ah-text-2) !important;
}
.premium-nav-tabs .premium-tab-link:hover { background: rgba(var(--ah-surface-rgb), 0.6) !important; color: var(--ah-primary) !important; }
.premium-nav-tabs .premium-tab-link.active {
    color: var(--ah-primary) !important;
    background: var(--ah-surface) !important;
    box-shadow: 0 1px 0 var(--ah-rim), var(--ah-bevel), 0 6px 14px -8px rgba(15, 23, 42, 0.35) !important;
    transform: translateY(-1px);
}
html[data-bs-theme="dark"] .premium-nav-tabs .premium-tab-link.active { background: var(--ah-elevated) !important; box-shadow: 0 1px 0 var(--ah-rim), var(--ah-bevel), 0 6px 16px -8px rgba(var(--ah-primary-rgb), 0.5) !important; }
.premium-nav-tabs .premium-tab-link .tab-icon { width: 28px; height: 28px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4); }
.premium-nav-tabs .premium-tab-link.active .tab-icon {
    background: var(--ah-primary-gradient) !important; color: #fff !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 -2px 0 rgba(0, 0, 0, 0.18), 0 6px 12px -6px rgba(var(--ah-primary-rgb), 0.8) !important;
    transform: none;
}

/* raised metric tile on a light surface (vendor details KPI row, etc.) */
.ah-tile-3d {
    position: relative; overflow: hidden;
    background: linear-gradient(180deg, var(--ah-surface), var(--ah-surface-2)) !important;
    border: 1px solid var(--ah-border) !important;
    box-shadow: var(--ah-depth-2), var(--ah-bevel) !important;
    transition: transform var(--ah-dur) var(--ah-ease), box-shadow var(--ah-dur) ease;
}
.ah-tile-3d::before {
    content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; pointer-events: none;
    background: linear-gradient(90deg, var(--ah-primary), var(--ah-accent));
    opacity: 0.85;
}
.ah-tile-3d:hover { transform: perspective(900px) translateY(-5px) rotateX(3deg); box-shadow: var(--ah-depth-3), var(--ah-bevel) !important; }
@media (hover: none) { .ah-tile-3d:hover { transform: none; } }

/* breadcrumbs that sit above a page (vendor details) – raised glass strip */
.ah-crumb-bar {
    padding: 0.6rem 0.9rem; border-radius: var(--ah-radius-md);
    background: var(--ah-glass-bg); border: 1px solid var(--ah-border);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    box-shadow: var(--ah-depth-1), var(--ah-bevel);
    gap: 0.5rem; flex-wrap: wrap;
}
.ah-crumb-bar .breadcrumb { margin: 0; }

/* ---------- 12. Responsive & motion ------------------------------------------- */
@media (max-width: 991.98px) {
    .premium-header, .premium-card-header, .assessment-header, .ah-page-head { padding: 1.1rem 1.15rem !important; }
}
@media (max-width: 767.98px) {
    .ah-page-head { flex-direction: column; align-items: stretch; }
    .ah-page-head__actions { width: 100%; }
    .ah-page-head__actions > .btn, .ah-page-head__actions > a.btn { flex: 1 1 auto; justify-content: center; }
    .ah-page-head__title h4, .ah-page-head__title h1 { font-size: 1.1rem; }
    .ah-hero-icon, .premium-card-header > i:first-child, .premium-card-header > .d-flex > i:first-child { width: 40px; height: 40px; font-size: 1.2rem !important; }
    .nav-tabs { display: flex; flex-wrap: nowrap; }
    /* lighter depth on small screens keeps scrolling smooth */
    .card, .premium-card, .stat-card, .kpi-card, .dash-card { box-shadow: var(--ah-depth-1), var(--ah-bevel) !important; }
    .ah-crumb-bar { flex-direction: column; align-items: flex-start !important; }
    /* premium.css stacks every .d-flex inside a hero; buttons that carry d-flex must stay one row */
    .premium-header :is(.btn, [class*="btn-premium"]) { flex-direction: row !important; align-items: center !important; justify-content: center !important; white-space: nowrap; }
    /* hero action rows (form view: score / expand / Q-AI / status) wrap instead of overflowing */
    .assessment-header .d-flex, .premium-header > .d-flex, .premium-header .d-flex.gap-2, .premium-header .d-flex.gap-3 { flex-wrap: wrap; row-gap: 0.6rem !important; }
    .assessment-header .d-flex.gap-4 { gap: 0.6rem !important; width: 100%; }
    /* modal headers with extra controls (risk snapshot zoom bar) wrap under the title */
    html .modal .modal-content > .modal-header { flex-wrap: wrap; row-gap: 0.6rem; }
    html .modal .modal-content > .modal-header > .d-flex { flex-wrap: wrap; row-gap: 0.5rem; }
    html .modal .modal-content > .modal-header .modal-title { font-size: 1rem; }
    /* form response action row */
    #aiFillBtnContainer .ai-fill-btn { white-space: nowrap; display: inline-flex; align-items: center; }
    /* risk matrix: keep option columns readable while scrolling sideways */
    .ah-risk-matrix > .table { min-width: 640px; }
    /* hero with a title + action: stack, action full width */
    .premium-card-header { flex-wrap: wrap; gap: 0.75rem; }
    .premium-card-header .btn-premium, .premium-card-header > .btn { width: 100%; justify-content: center; white-space: nowrap; }
    /* stat tiles: two per row instead of one very tall column */
    .row > [class*="col-md-3"]:has(.stat-card) { flex: 0 0 50%; max-width: 50%; }
    .stat-card { padding: 1rem 0.75rem !important; }
    .stat-card .stat-icon { width: 44px; height: 44px; font-size: 1.2rem; margin-bottom: 0.6rem; }
    .stat-card .stat-label { font-size: 0.68rem; }
    .stat-card .stat-value { font-size: 1.5rem; }
}
@media (hover: none) {
    .stat-card:hover, .kpi-card:hover, .dash-card:hover, .chart-card:hover, .hover-shadow:hover, .vendor-card > .card:hover, .ah-lift:hover { transform: none; }
    .ah-hero-icon { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .stat-icon, .ah-chip-3d, .ah-hero-icon { transform: none !important; }
    .modal.fade .modal-dialog { transform: none; }
}
@media print {
    body { background-image: none !important; }
    .card, .premium-card, .stat-card, .kpi-card { box-shadow: none !important; transform: none !important; }
}

/* ---------- 13. Dark-mode readability fixes ------------------------------------------------ */
/* Tenant logos are uploaded artwork (often dark text on transparent): always show them on a white plate,
   as in light mode, so they stay readable in dark mode. */
html[data-bs-theme="dark"] .ah-logo-plate { background: #ffffff !important; border-color: rgba(255, 255, 255, 0.2) !important; }
/* Bootstrap's .text-dark stays near-black in dark mode; inside raised tiles use the heading colour instead
   (Vendor Details "Next Review" date was unreadable). */
html[data-bs-theme="dark"] .ah-tile-3d .text-dark { color: var(--ah-heading) !important; }
