/**
 * District Monitoring Portal (DMP) — Phoenix Design System
 * Inspired by Phoenix Admin & Dashboard Theme (Bootstrap 5)
 * District Administration Bandipora · EcoNet Org
 */

/* ── Phoenix CSS Variables & Color Tokens ── */
:root {
    --phoenix-primary: #3874ff;
    --phoenix-primary-dark: #2f63d9;
    --phoenix-primary-light: #e7eeff;
    --phoenix-bg: #eff2f6;
    --phoenix-card: #ffffff;
    --phoenix-line: #e3e6ed;
    --phoenix-heading: #141824;
    --phoenix-body: #525b75;
    --phoenix-muted: #8a94ad;

    /* Semantic Theme Aliases */
    --phoenix-card-bg: var(--phoenix-card);
    --phoenix-border-color: var(--phoenix-line);
    --phoenix-secondary-color: var(--phoenix-muted);
    --phoenix-heading-color: var(--phoenix-heading);
    --phoenix-soft-bg: #f5f7fa;
    --phoenix-secondary-bg: #f1f4f9;

    /* Phoenix Status Colors */
    --phoenix-success: #25b865;
    --phoenix-info: #00b8d9;
    --phoenix-warning: #e5780b;
    --phoenix-danger: #ec1f00;

    /* Bootstrap Overrides */
    --bs-primary: #3874ff;
    --bs-primary-rgb: 56, 116, 255;
    --bs-link-color: #3874ff;
    --bs-link-hover-color: #2f63d9;
    --bs-border-color: #e3e6ed;
    --bs-body-color: #525b75;
    --bs-body-bg: var(--phoenix-bg);
}

/* ── Base & Reset ── */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    background: var(--phoenix-bg);
    color: var(--phoenix-body);
    font-family: "Inter", "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    letter-spacing: -0.005em;
}

h1, h2, h3, h4, h5, h6, .fw-bold, .fw-semibold {
    color: var(--phoenix-heading);
}

a {
    color: var(--phoenix-primary);
    text-decoration: none;
}

a:hover {
    color: var(--phoenix-primary-dark);
}

:focus-visible {
    outline: 3px solid rgba(56, 116, 255, .55);
    outline-offset: 3px;
}

.skip-link {
    position: fixed;
    left: 1rem;
    top: -4rem;
    z-index: 1100;
    border-radius: .55rem;
    background: var(--phoenix-heading);
    color: var(--phoenix-card);
    padding: .6rem .85rem;
    font-weight: 700;
    text-decoration: none;
    transition: top .15s ease;
}

.skip-link:focus {
    top: 1rem;
    color: var(--phoenix-card);
}

/* ── Phoenix Sidebar Navigation ── */
.sidebar {
    background: var(--phoenix-card);
    height: 100vh;
    width: 252px;
    position: fixed;
    top: 0;
    left: 0;
    border-right: 1px solid var(--phoenix-line);
    overflow: hidden;
    z-index: 1045;
    transition: transform .25s ease, width .2s ease;
}

.sidebar .nav-scroll {
    flex: 1 1 auto;
    overflow-y: auto;
}

.sidebar .nav-scroll::-webkit-scrollbar {
    width: 6px;
}

.sidebar .nav-scroll::-webkit-scrollbar-thumb {
    background: #cbd3e1;
    border-radius: 6px;
}

[data-bs-theme="dark"] .sidebar .nav-scroll::-webkit-scrollbar-thumb {
    background: #2e3a47;
}

.sidebar .brand {
    padding: 1.1rem 1.4rem;
    border-bottom: 1px solid var(--phoenix-line);
}

.sidebar .brand .title {
    color: var(--phoenix-heading);
    font-weight: 800;
    letter-spacing: -.01em;
}

.sidebar .nav-link {
    position: relative;
    color: var(--phoenix-body);
    padding: .5rem .9rem;
    margin: .1rem .7rem;
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    transition: background .15s ease, color .15s ease;
}

.sidebar .nav-link:hover {
    color: var(--phoenix-heading);
    background: #f5f7fa;
}

.sidebar .nav-link.active {
    color: var(--phoenix-primary);
    background: #e7eeff;
}

.sidebar .nav-link.active::before {
    content: "";
    position: absolute;
    left: -.7rem;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    border-radius: 0 3px 3px 0;
    background: linear-gradient(180deg, var(--phoenix-primary), #6c4eff);
}

.sidebar .nav-link i {
    width: 24px;
    font-size: 1rem;
    color: var(--phoenix-muted);
    transition: color .15s ease;
}

.sidebar .nav-link.active i {
    color: var(--phoenix-primary);
}

.sidebar .nav-section {
    color: var(--phoenix-muted);
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: .9rem 1.5rem .3rem;
}

/* ── Content & Layout Shell ── */
.content {
    margin-left: 252px;
    width: calc(100% - 252px);
    min-width: 0;
    transition: margin-left .2s ease, width .2s ease;
}

#main-content {
    min-width: 0;
    width: 100%;
    overflow-x: clip;
}

#main-content .row > [class*="col-"] {
    min-width: 0;
}

/* ── Phoenix Topbar ── */
/* Important: No backdrop-filter, filter or transform on .topbar as it creates containing block for Popper fixed dropdowns */
.topbar {
    background: var(--phoenix-card);
    border-bottom: 1px solid var(--phoenix-line);
    min-height: 60px;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.menu-toggle {
    display: none;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(13, 17, 23, .45);
    z-index: 1044;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease;
}

.sidebar-backdrop.show {
    opacity: 1;
    visibility: visible;
}

.topbar-brand {
    display: none;
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 0 0 50px rgba(0, 0, 0, .25);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .content {
        margin-left: 0;
        width: 100%;
    }
    .menu-toggle {
        display: inline-flex;
    }
    .topbar-brand {
        display: flex;
    }
    .topbar {
        padding-left: .75rem !important;
        padding-right: .75rem !important;
    }
    .content > .p-4 {
        padding: 1rem !important;
    }
}

@media (max-width: 575.98px) {
    .topbar .badge-jur {
        max-width: 42vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .stat-card .num {
        font-size: 1.5rem;
    }
}

.topbar-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--phoenix-body);
    font-size: 1.15rem;
    transition: background .15s;
    background: transparent;
    border: none;
}

.topbar-icon:hover {
    background: #f5f7fa;
    color: var(--phoenix-heading);
}

.topbar-icon:focus-visible, .user-chip:focus-visible {
    outline-offset: 2px;
}

/* User Profile Chip */
.user-chip {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    padding: .3rem .55rem;
    border-radius: 12px;
    text-decoration: none;
    transition: background .15s;
    cursor: pointer;
}

.user-chip:hover {
    background: #f5f7fa;
}

.user-chip::after {
    display: none;
}

.user-chip .avatar {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: linear-gradient(135deg, #3874ff, #6c4eff);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .92rem;
    letter-spacing: .02em;
}

.user-chip .meta {
    flex-direction: column;
    line-height: 1.15;
}

.user-chip .meta .nm {
    font-weight: 700;
    color: var(--phoenix-heading);
    font-size: .9rem;
}

.user-chip .meta .rl {
    font-size: .72rem;
    color: var(--phoenix-muted);
}

.user-chip .caret {
    color: var(--phoenix-muted);
    font-size: .75rem;
    transition: transform .15s;
}

.user-chip[aria-expanded="true"] .caret {
    transform: rotate(180deg);
}

/* ── Phoenix Cards ── */
.card, .card-phoenix {
    background: var(--phoenix-card);
    box-shadow: 0 4px 12px rgba(43, 48, 82, .04), 0 1px 3px rgba(43, 48, 82, .03);
    border: 1px solid var(--phoenix-line);
    border-radius: .85rem;
    transition: box-shadow .2s ease, transform .2s ease;
}

.card-header, .card-phoenix-header {
    background: transparent !important;
    border-bottom: 1px solid var(--phoenix-line);
    font-weight: 700;
    color: var(--phoenix-heading);
    padding: 1rem 1.25rem;
}

.card-body, .card-phoenix-body {
    padding: 1.25rem;
}

.card-footer, .card-phoenix-footer {
    background: transparent !important;
    border-top: 1px solid var(--phoenix-line);
    padding: .85rem 1.25rem;
}

/* ── Phoenix Welcome Banner ── */
.welcome-hero {
    background: linear-gradient(120deg, #13315c 0%, #2f63d9 58%, #3874ff 100%);
    border-radius: 1rem;
    padding: 1.35rem 1.6rem;
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(47, 99, 217, .28);
}

.welcome-hero::after {
    content: "";
    position: absolute;
    right: -30px;
    top: -50px;
    width: 190px;
    height: 190px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
}

.welcome-hero::before {
    content: "";
    position: absolute;
    right: 90px;
    bottom: -70px;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: rgba(255, 153, 51, .16);
}

.welcome-hero .wh-inner {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: .6rem;
}

.welcome-hero .wh-greet {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -.01em;
    line-height: 1.15;
}

.welcome-hero .wh-sub {
    opacity: .88;
    font-size: .85rem;
    margin-top: .15rem;
}

.welcome-hero .wh-chip {
    background: rgba(255, 255, 255, .16);
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 999px;
    padding: .25rem .7rem;
    font-size: .74rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
}

/* ── Phoenix Stat / KPI Cards ── */
.stat-card {
    border: 1px solid var(--phoenix-line);
    border-radius: .85rem;
    border-top: 3px solid var(--ac, #3874ff);
    position: relative;
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease;
    background: var(--phoenix-card);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 36px rgba(43, 48, 82, .14);
}

.stat-card .stat-lbl {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 700;
    color: var(--phoenix-muted);
}

.stat-card .num {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--phoenix-heading);
    line-height: 1.05;
}

.stat-card .stat-ico {
    width: 50px;
    height: 50px;
    flex: 0 0 auto;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    color: #fff;
    background: var(--ac, #3874ff);
    box-shadow: 0 6px 16px rgba(0, 0, 0, .12);
}

.stat-card .stat-ico .bi {
    color: #fff !important;
    opacity: 1 !important;
}

a.stat-card {
    display: block;
    cursor: pointer;
}

a.stat-card:hover {
    border-color: var(--ac, #3874ff);
}

.stat-card .stat-go {
    position: absolute;
    right: .65rem;
    bottom: .5rem;
    color: var(--ac, #3874ff);
    font-size: .85rem;
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity .18s ease, transform .18s ease;
}

.stat-card--link:hover .stat-go {
    opacity: .9;
    transform: translateX(0);
}

/* ── Module Overview Breakdown Cards ── */
.bd-card {
    border: 1px solid var(--phoenix-border-color, #e3e6ed);
    border-radius: 16px;
    background: var(--phoenix-card-bg, #fff);
    height: 100%;
    overflow: hidden;
}

.bd-head {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .9rem 1rem;
    border-bottom: 1px solid var(--phoenix-border-color, #eef1f6);
}

.bd-head .bi {
    font-size: 1.05rem;
}

.bd-ico {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex: 0 0 auto;
}

.bd-body {
    padding: 1rem;
}

.bd-row {
    display: flex;
    gap: .6rem;
}

.bd-tile {
    flex: 1;
    border-radius: 12px;
    background: var(--phoenix-secondary-bg, #f7f9fc);
    padding: .7rem .5rem;
    text-align: center;
    text-decoration: none;
    transition: .15s;
    border: 1px solid transparent;
}

.bd-tile:hover {
    background: #fff;
    border-color: var(--c);
    box-shadow: 0 6px 16px rgba(20, 40, 80, .10);
    transform: translateY(-1px);
}

.bd-tile .n {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1;
    color: var(--c);
}

.bd-tile .l {
    font-size: .66rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--phoenix-secondary-color, #8a94ad);
    font-weight: 700;
    margin-top: .35rem;
    display: block;
}

.bd-trend {
    display: flex;
    height: 8px;
    border-radius: 6px;
    overflow: hidden;
    margin-top: .9rem;
    background: #eef1f6;
}

.bd-trend span {
    display: block;
    height: 100%;
}

.bd-foot {
    font-size: .72rem;
    color: var(--phoenix-secondary-color, #8a94ad);
    margin-top: .55rem;
    display: flex;
    justify-content: space-between;
}

/* ── Modern Page Header ── */
.page-head {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.4rem;
    flex-wrap: wrap;
    padding: .95rem 1.2rem;
    background: linear-gradient(135deg, color-mix(in srgb, var(--phoenix-primary) 6%, var(--phoenix-card)), var(--phoenix-card) 62%);
    border: 1px solid var(--phoenix-line);
    border-radius: 16px;
    box-shadow: 0 6px 22px rgba(31, 45, 77, .06);
    position: relative;
    overflow: visible;
}

.page-head::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(150px 150px at calc(100% - 20px) -30px, color-mix(in srgb, var(--phoenix-primary) 14%, transparent), transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.page-head .ph-actions .dropdown-menu {
    z-index: 1056;
}

.page-head .ph-ico {
    width: 50px;
    height: 50px;
    flex: 0 0 auto;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.45rem;
    color: #fff;
    background: linear-gradient(135deg, var(--phoenix-primary), #6c4eff);
    box-shadow: 0 8px 20px rgba(56, 116, 255, .30);
    position: relative;
    z-index: 1;
}

/* Distinct Module Header Accents */
.page-head .ph-ico:has(.bi-megaphone-fill) { background: linear-gradient(135deg, #fb7185, #e11d48); box-shadow: 0 8px 20px rgba(225, 29, 72, .28); }
.page-head .ph-ico:has(.bi-cone-striped) { background: linear-gradient(135deg, #fbbf24, #d97706); box-shadow: 0 8px 20px rgba(217, 119, 6, .28); }
.page-head .ph-ico:has(.bi-clipboard-data-fill), .page-head .ph-ico:has(.bi-clipboard-data) { background: linear-gradient(135deg, #34d399, #059669); box-shadow: 0 8px 20px rgba(5, 150, 105, .28); }
.page-head .ph-ico:has(.bi-graph-up-arrow) { background: linear-gradient(135deg, #a78bfa, #7c3aed); box-shadow: 0 8px 20px rgba(124, 58, 237, .28); }
.page-head .ph-ico:has(.bi-people-fill) { background: linear-gradient(135deg, #38bdf8, #0284c7); box-shadow: 0 8px 20px rgba(2, 132, 199, .28); }
.page-head .ph-ico:has(.bi-sliders) { background: linear-gradient(135deg, #94a3b8, #475569); box-shadow: 0 8px 20px rgba(71, 85, 105, .28); }
.page-head .ph-ico:has(.bi-database-fill) { background: linear-gradient(135deg, #818cf8, #4f46e5); box-shadow: 0 8px 20px rgba(79, 70, 229, .28); }
.page-head .ph-ico:has(.bi-lightbulb) { background: linear-gradient(135deg, #fcd34d, #eab308); box-shadow: 0 8px 20px rgba(234, 179, 8, .3); }
.page-head .ph-ico:has(.bi-headset) { background: linear-gradient(135deg, #2dd4bf, #0d9488); box-shadow: 0 8px 20px rgba(13, 148, 136, .28); }
.page-head .ph-ico:has(.bi-shield-exclamation) { background: linear-gradient(135deg, #fb7185, #be123c); box-shadow: 0 8px 20px rgba(190, 18, 60, .28); }
.page-head .ph-ico:has(.bi-shield-check) { background: linear-gradient(135deg, #4ade80, #16a34a); box-shadow: 0 8px 20px rgba(22, 163, 74, .28); }
.page-head .ph-ico:has(.bi-shield-lock) { background: linear-gradient(135deg, #a78bfa, #6d28d9); box-shadow: 0 8px 20px rgba(109, 40, 217, .28); }
.page-head .ph-ico:has(.bi-bell-fill) { background: linear-gradient(135deg, #fb923c, #ea580c); box-shadow: 0 8px 20px rgba(234, 88, 12, .28); }
.page-head .ph-ico:has(.bi-building-fill), .page-head .ph-ico:has(.bi-building-add) { background: linear-gradient(135deg, #818cf8, #4338ca); box-shadow: 0 8px 20px rgba(67, 56, 202, .28); }
.page-head .ph-ico:has(.bi-pin-map-fill) { background: linear-gradient(135deg, #f87171, #dc2626); box-shadow: 0 8px 20px rgba(220, 38, 38, .28); }
.page-head .ph-ico:has(.bi-bank2) { background: linear-gradient(135deg, #60a5fa, #1e40af); box-shadow: 0 8px 20px rgba(30, 64, 175, .28); }
.page-head .ph-ico:has(.bi-hdd-stack-fill) { background: linear-gradient(135deg, #94a3b8, #334155); box-shadow: 0 8px 20px rgba(51, 65, 85, .28); }
.page-head .ph-ico:has(.bi-file-earmark-bar-graph) { background: linear-gradient(135deg, #38bdf8, #0369a1); box-shadow: 0 8px 20px rgba(3, 105, 161, .28); }
.page-head .ph-ico:has(.bi-tools) { background: linear-gradient(135deg, #a8a29e, #57534e); box-shadow: 0 8px 20px rgba(87, 83, 78, .28); }
.page-head .ph-ico:has(.bi-ui-checks) { background: linear-gradient(135deg, #5eead4, #0f766e); box-shadow: 0 8px 20px rgba(15, 118, 110, .28); }
.page-head .ph-ico:has(.bi-check2-square) { background: linear-gradient(135deg, #4ade80, #15803d); box-shadow: 0 8px 20px rgba(21, 128, 61, .28); }
.page-head .ph-ico:has(.bi-diagram-3-fill) { background: linear-gradient(135deg, #c084fc, #7e22ce); box-shadow: 0 8px 20px rgba(126, 34, 206, .28); }
.page-head .ph-ico:has(.bi-pencil-square) { background: linear-gradient(135deg, #fbbf24, #b45309); box-shadow: 0 8px 20px rgba(180, 83, 9, .28); }
.page-head .ph-ico:has(.bi-person-gear) { background: linear-gradient(135deg, #818cf8, #4f46e5); box-shadow: 0 8px 20px rgba(79, 70, 229, .28); }
.page-head .ph-ico:has(.bi-gear) { background: linear-gradient(135deg, #94a3b8, #475569); box-shadow: 0 8px 20px rgba(71, 85, 105, .28); }

.page-head > div:not(.ph-ico):not(.ph-actions) {
    position: relative;
    z-index: 1;
    min-width: 0;
}

.page-head h4 {
    margin: 0;
    font-weight: 800;
    letter-spacing: -.015em;
    line-height: 1.12;
    font-size: 1.32rem;
}

.page-head .ph-sub {
    color: var(--phoenix-muted);
    font-size: .84rem;
    margin-top: .15rem;
}

.page-head .ph-actions {
    margin-left: auto;
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    align-items: center;
    position: relative;
    z-index: 1;
}

@media (max-width: 575.98px) {
    .page-head {
        padding: .8rem .95rem;
        gap: .75rem;
    }
    .page-head h4 {
        font-size: 1.15rem;
    }
    .page-head .ph-actions {
        margin-left: 0;
        width: 100%;
    }
}

/* ── Phoenix Data Tables ── */
.dt-wrap {
    border: 1px solid var(--phoenix-line);
    border-radius: 14px;
    overflow: hidden;
    background: var(--phoenix-card);
    box-shadow: 0 7px 14px 0 rgba(43, 48, 82, .05);
}

.dt-scroll {
    max-height: 72vh;
    overflow: auto;
}

.dt {
    width: 100%;
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
}

.dt thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--phoenix-soft-bg);
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--phoenix-muted);
    font-weight: 700;
    white-space: nowrap;
    padding: .72rem .85rem;
    border-bottom: 1px solid var(--phoenix-line);
}

.dt tbody td {
    padding: .72rem .85rem;
    border-bottom: 1px solid color-mix(in srgb, var(--phoenix-line) 60%, transparent);
    vertical-align: middle;
}

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

.dt tbody tr:nth-child(even) td {
    background: color-mix(in srgb, var(--phoenix-muted) 4%, transparent);
}

.dt tbody tr:hover td {
    background: color-mix(in srgb, var(--phoenix-primary) 6%, transparent);
}

.dt .num {
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}

.dt .dt-rail {
    width: 4px;
    padding: 0 !important;
    background: var(--rail, transparent);
}

.dt thead th.dt-rail {
    background: var(--phoenix-soft-bg);
}

.dt .dt-primary {
    font-weight: 600;
    color: var(--phoenix-heading);
    text-decoration: none;
}

.dt .dt-primary:hover {
    color: var(--phoenix-primary);
}

.dt .dt-id {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .74rem;
    color: var(--phoenix-muted);
    white-space: nowrap;
}

.dt .dt-sub {
    font-size: .75rem;
    color: var(--phoenix-muted);
}

.dt-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #e7eeff;
    color: #3874ff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: .72rem;
    flex: 0 0 auto;
}

[data-bs-theme="dark"] .dt-avatar {
    background: #1b2740;
    color: #6ea0ff;
}

.dt-bar {
    height: 6px;
    width: 70px;
    border-radius: 4px;
    background: var(--phoenix-secondary-bg);
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
}

.dt-bar > span {
    display: block;
    height: 100%;
    border-radius: 4px;
}

.dt-pill {
    font-size: .7rem;
    font-weight: 700;
    padding: .2rem .6rem;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    white-space: nowrap;
}

/* ── Standard Bootstrap Table Polish ── */
.table {
    --bs-table-color: var(--phoenix-body);
}

.table thead th {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--phoenix-muted);
    font-weight: 700;
    background: #f6f8fb;
    border-bottom: 2px solid var(--phoenix-line);
    white-space: nowrap;
}

.table > :not(caption) > * > * {
    padding: .7rem .8rem;
    vertical-align: middle;
}

.table-hover > tbody > tr:hover > * {
    background: rgba(56, 116, 255, .045);
}

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

.table-sticky thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}

.report-table td {
    font-variant-numeric: tabular-nums;
    font-size: .86rem;
}

.report-table tbody tr:nth-child(even) td {
    background: #f8fafd;
}

.report-table tbody tr:hover td {
    background: rgba(56, 116, 255, .06);
}

.report-scroll {
    max-height: 70vh;
    overflow: auto;
}

/* ── Phoenix Badges & Soft Pills ── */
.badge-jur {
    background: #e7eeff;
    color: var(--phoenix-primary-dark);
    font-weight: 600;
}

.pill-soft {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-weight: 600;
    font-size: .74rem;
    padding: .22rem .6rem;
    border-radius: 999px;
}

.badge {
    font-weight: 600;
    letter-spacing: .01em;
    padding: .38em .6em;
    border-radius: .375rem;
}

.badge.rounded-pill {
    border-radius: 999px;
}

/* Official Phoenix Soft Badges */
.badge-phoenix {
    padding: .35em .65em;
    font-size: .72rem;
    font-weight: 700;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    line-height: 1.2;
}

.badge-phoenix-primary, .badge.bg-primary-subtle {
    background-color: #e7eeff !important;
    color: #2f63d9 !important;
}

.badge-phoenix-success, .badge.bg-success-subtle {
    background-color: #e8f7f0 !important;
    color: #15803d !important;
}

.badge-phoenix-warning, .badge.bg-warning-subtle {
    background-color: #fef3c7 !important;
    color: #b45309 !important;
}

.badge-phoenix-danger, .badge.bg-danger-subtle {
    background-color: #fee2e2 !important;
    color: #b91c1c !important;
}

.badge-phoenix-info, .badge.bg-info-subtle {
    background-color: #e0f2fe !important;
    color: #0369a1 !important;
}

.badge-phoenix-secondary, .badge.bg-secondary-subtle {
    background-color: #f1f5f9 !important;
    color: #475569 !important;
}

/* ── Phoenix Form Controls & Inputs ── */
.form-control, .form-select {
    border-radius: .6rem;
    border-color: var(--phoenix-line);
    transition: border-color .15s, box-shadow .15s;
    background-color: var(--phoenix-card);
    color: var(--phoenix-heading);
}

.form-control:focus, .form-select:focus {
    border-color: var(--phoenix-primary);
    box-shadow: 0 0 0 .2rem rgba(56, 116, 255, .15);
    background-color: var(--phoenix-card);
    color: var(--phoenix-heading);
}

.input-group-text {
    background: #f5f7fa;
    border-color: var(--phoenix-line);
    color: var(--phoenix-muted);
}

.form-label {
    font-weight: 600;
    font-size: .82rem;
    color: var(--phoenix-heading);
    margin-bottom: .35rem;
}

/* Masked / Secure Fields */
.secure-field .form-control {
    border-left: 0;
}

.secure-field:focus-within .input-group-text {
    border-color: #3874ff;
    color: #3874ff;
}

.secure-field:focus-within .form-control {
    box-shadow: none;
}

/* ── Phoenix Buttons ── */
.btn {
    border-radius: .6rem;
    font-weight: 600;
    transition: transform .12s ease, box-shadow .15s ease, background-color .15s ease;
}

.btn:active {
    transform: translateY(1px);
}

.btn:focus-visible, .form-check-input:focus {
    box-shadow: 0 0 0 .22rem rgba(56, 116, 255, .22);
}

.btn-sm {
    border-radius: .5rem;
}

.btn-primary {
    --bs-btn-bg: #3874ff;
    --bs-btn-border-color: #3874ff;
    --bs-btn-hover-bg: #2f63d9;
    --bs-btn-hover-border-color: #2f63d9;
    --bs-btn-active-bg: #2f63d9;
    box-shadow: 0 4px 12px rgba(56, 116, 255, .22);
}

.btn-outline-primary {
    --bs-btn-color: #3874ff;
    --bs-btn-border-color: #3874ff;
    --bs-btn-hover-bg: #3874ff;
    --bs-btn-hover-border-color: #3874ff;
    --bs-btn-active-bg: #3874ff;
}

/* Phoenix Soft Outline & Subtle Buttons */
.btn-phoenix-primary {
    color: #3874ff;
    background-color: rgba(56, 116, 255, .1);
    border: 1px solid transparent;
}

.btn-phoenix-primary:hover {
    color: #fff;
    background-color: #3874ff;
}

.btn-phoenix-secondary {
    color: var(--phoenix-body);
    background-color: var(--phoenix-secondary-bg);
    border: 1px solid var(--phoenix-line);
}

.btn-phoenix-secondary:hover {
    color: var(--phoenix-heading);
    background-color: #e3e6ed;
}

/* ── Modals, Dropdowns & Popovers ── */
.dropdown-menu {
    border-radius: .75rem;
    border-color: var(--phoenix-line);
    box-shadow: 0 12px 34px rgba(43, 48, 82, .14);
    padding: .4rem;
    background: var(--phoenix-card);
}

.dropdown-item {
    border-radius: .5rem;
    padding: .5rem .7rem;
    font-weight: 500;
    color: var(--phoenix-body);
}

.dropdown-item:hover {
    background: #f5f7fa;
    color: var(--phoenix-heading);
}

.modal-content {
    border-radius: 1rem;
    border-color: var(--phoenix-line);
    background: var(--phoenix-card);
}

.modal-header, .modal-footer {
    border-color: var(--phoenix-line);
}

/* ── Navigation Tabs ── */
.nav-tabs {
    border-bottom: 1px solid var(--phoenix-line);
}

.nav-tabs .nav-link {
    border: none;
    color: var(--phoenix-muted);
    font-weight: 600;
    padding: .6rem .9rem;
    border-bottom: 2px solid transparent;
}

.nav-tabs .nav-link:hover {
    color: var(--phoenix-heading);
    border-bottom-color: var(--phoenix-line);
}

.nav-tabs .nav-link.active {
    background: transparent;
    color: var(--phoenix-primary);
    border-bottom: 2px solid var(--phoenix-primary);
}

/* ── UI Utilities ── */
.avatar-sm {
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: linear-gradient(135deg, #3874ff, #6c4eff);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .72rem;
    font-weight: 700;
}

.view-toggle {
    display: inline-flex;
    border: 1px solid var(--phoenix-line);
    border-radius: 9px;
    overflow: hidden;
    background: var(--phoenix-card);
}

.view-toggle button {
    border: 0;
    background: transparent;
    color: var(--phoenix-muted);
    padding: .42rem .72rem;
    font-size: .95rem;
    cursor: pointer;
    line-height: 1;
    transition: background .15s, color .15s;
}

.view-toggle button:not(:last-child) {
    border-right: 1px solid var(--phoenix-line);
}

.view-toggle button.active {
    background: var(--phoenix-primary);
    color: #fff;
}

.view-pane[hidden] {
    display: none !important;
}

.sec-title {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-weight: 800;
    color: var(--phoenix-muted);
    margin: .2rem 0 .6rem;
}

.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--phoenix-muted);
}

.empty-state .bi {
    font-size: 2.4rem;
    opacity: .45;
    display: block;
    margin-bottom: .5rem;
}

.dmp-switch {
    width: 46px;
    height: 26px;
    border-radius: 999px;
    border: none;
    background: #cbd3e1;
    position: relative;
    padding: 0;
    cursor: pointer;
    transition: background .18s;
    flex: 0 0 auto;
}

.dmp-switch .knob {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    transition: left .18s;
}

.dmp-switch.on {
    background: #1aa06d;
}

.dmp-switch.on .knob {
    left: 23px;
}

/* Alerts */
.alert {
    border-radius: .75rem;
    border: none;
}

.alert-success { background: #e6f7f0; color: #0f7a54; }
.alert-danger { background: #fdeaea; color: #b3352f; }
.alert-warning { background: #fff4e5; color: #9a6207; }
.alert-info { background: #e7eeff; color: #2f63d9; }

/* Impersonation Banner */
.impersonation-bar {
    position: sticky;
    top: 60px;
    z-index: 1029;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .6rem;
    background: linear-gradient(90deg, #b3670a, #d9820f);
    color: #fff;
    padding: .55rem 1.1rem;
    font-size: .86rem;
    box-shadow: 0 4px 14px rgba(179, 103, 10, .28);
}

.impersonation-bar strong { color: #fff; }
.impersonation-bar .btn-light { color: #b3670a; }

/* ── Collapsible Mini Sidebar (Desktop) ── */
.collapse-toggle {
    display: none;
}

@media (min-width: 992px) {
    .collapse-toggle {
        display: inline-flex;
    }
    .sidebar-mini .sidebar {
        width: 74px;
    }
    .sidebar-mini .content {
        margin-left: 74px;
        width: calc(100% - 74px);
    }
    .sidebar-mini .sidebar .brand {
        justify-content: center;
    }
    .sidebar-mini .sidebar .brand small,
    .sidebar-mini .sidebar .brand .title {
        display: none;
    }
    .sidebar-mini .sidebar .nav-link {
        font-size: 0;
        justify-content: center;
        padding: .55rem 0;
        margin: .15rem .5rem;
    }
    .sidebar-mini .sidebar .nav-link i {
        font-size: 1.15rem;
        width: auto;
        margin: 0;
    }
    .sidebar-mini .sidebar .nav-link.active::before {
        left: 0;
    }
    .sidebar-mini .sidebar .nav-section {
        font-size: 0;
        height: 1px;
        padding: 0;
        margin: .5rem .95rem;
        overflow: hidden;
        background: var(--phoenix-line);
    }
    .sidebar-mini .sidebar > .p-3.border-top {
        display: none;
    }
    .sidebar-mini .sidebar:hover {
        width: 74px;
        box-shadow: none;
    }
}

/* ── Upload & Progress Indicator ── */
.dmp-busy {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    background: rgba(10, 22, 45, .55);
    backdrop-filter: blur(2px);
}

.dmp-busy-card {
    background: var(--phoenix-card, #fff);
    border-radius: 14px;
    padding: 1.4rem 1.5rem;
    min-width: 290px;
    max-width: 90vw;
    box-shadow: 0 18px 50px rgba(16, 24, 40, .28);
    text-align: center;
}

.dmp-busy-title {
    font-weight: 800;
    color: var(--phoenix-heading, #0d2748);
    margin-bottom: .15rem;
}

.dmp-busy-sub {
    font-size: .8rem;
    color: var(--phoenix-muted, #6b7589);
}

.dmp-busy-bar {
    height: 8px;
    border-radius: 99px;
    background: rgba(56, 116, 255, .14);
    overflow: hidden;
    margin: .9rem 0 .5rem;
}

.dmp-busy-bar span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 99px;
    background: linear-gradient(90deg, #3874ff, #6c4eff);
    transition: width .2s ease;
}

.dmp-busy-pct {
    font-size: .78rem;
    font-weight: 700;
    color: var(--phoenix-primary, #3874ff);
    font-variant-numeric: tabular-nums;
}

.dmp-busy-bar.is-waiting span {
    width: 40% !important;
    animation: dmpSweep 1.1s ease-in-out infinite;
}

@keyframes dmpSweep {
    0% { margin-left: -40%; }
    100% { margin-left: 100%; }
}

/* ── Phoenix Dark Mode System ── */
[data-bs-theme="dark"] {
    --phoenix-bg: #0d1117;
    --phoenix-card: #161b22;
    --phoenix-line: #272d38;
    --phoenix-heading: #e8ebf2;
    --phoenix-body: #b3bbcc;
    --phoenix-muted: #8b95a7;
    --phoenix-soft-bg: #0f141b;
    --phoenix-secondary-bg: #1b212b;
    --bs-body-color: #b3bbcc;
    --bs-border-color: #272d38;
    --bs-body-bg: var(--phoenix-bg);
}

[data-bs-theme="dark"] body {
    background: var(--phoenix-bg);
    color: var(--phoenix-body);
}

[data-bs-theme="dark"] .sidebar,
[data-bs-theme="dark"] .topbar {
    background: var(--phoenix-card);
}

[data-bs-theme="dark"] .sidebar .nav-link:hover {
    background: #1d242e;
}

[data-bs-theme="dark"] .sidebar .nav-link.active {
    background: #1b2740;
    color: #6ea0ff;
}

[data-bs-theme="dark"] .sidebar .nav-link.active i {
    color: #6ea0ff;
}

[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .stat-card,
[data-bs-theme="dark"] .bd-card {
    background: var(--phoenix-card);
    border-color: var(--phoenix-line);
}

[data-bs-theme="dark"] .card-header,
[data-bs-theme="dark"] .bg-white {
    background-color: var(--phoenix-card) !important;
}

[data-bs-theme="dark"] .user-chip:hover,
[data-bs-theme="dark"] .topbar-icon:hover {
    background: #1d242e;
}

[data-bs-theme="dark"] .badge-jur {
    background: #1b2740;
    color: #9bb8ff;
}

[data-bs-theme="dark"] .table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--phoenix-body);
}

[data-bs-theme="dark"] .table thead th {
    background: #1b222c;
}

[data-bs-theme="dark"] .report-table tbody tr:nth-child(even) td {
    background: #171d26;
}

[data-bs-theme="dark"] .report-table tbody tr:hover td {
    background: rgba(56, 116, 255, .12);
}

[data-bs-theme="dark"] .list-group-item {
    background: var(--phoenix-card);
    color: var(--phoenix-body);
    border-color: var(--phoenix-line);
}

[data-bs-theme="dark"] .bg-light {
    background-color: #1b212b !important;
}

[data-bs-theme="dark"] .text-dark {
    color: var(--phoenix-heading) !important;
}

[data-bs-theme="dark"] .dropdown-menu {
    background: var(--phoenix-card);
    border-color: var(--phoenix-line);
}

[data-bs-theme="dark"] .dropdown-item {
    color: var(--phoenix-body);
}

[data-bs-theme="dark"] .dropdown-item:hover {
    background: #1d242e;
    color: var(--phoenix-heading);
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    background: #0f141b;
    border-color: var(--phoenix-line);
    color: var(--phoenix-body);
}

[data-bs-theme="dark"] .input-group-text {
    background: #0f141b;
}

[data-bs-theme="dark"] .theme-toggle .bi-sun { display: inline; }
[data-bs-theme="dark"] .theme-toggle .bi-moon-stars { display: none; }
.theme-toggle .bi-sun { display: none; }

/* Dark mode badges */
[data-bs-theme="dark"] .badge-phoenix-primary, [data-bs-theme="dark"] .bg-primary-subtle {
    background-color: #1b2740 !important;
    color: #9bb8ff !important;
}

[data-bs-theme="dark"] .badge-phoenix-success, [data-bs-theme="dark"] .bg-success-subtle {
    background-color: #12241c !important;
    color: #5cd6a1 !important;
}

[data-bs-theme="dark"] .badge-phoenix-warning, [data-bs-theme="dark"] .bg-warning-subtle {
    background-color: #2a2113 !important;
    color: #f0b45e !important;
}

[data-bs-theme="dark"] .badge-phoenix-danger, [data-bs-theme="dark"] .bg-danger-subtle {
    background-color: #2a1516 !important;
    color: #f28b8b !important;
}

[data-bs-theme="dark"] .badge-phoenix-info, [data-bs-theme="dark"] .bg-info-subtle {
    background-color: #0f2630 !important;
    color: #67c7e0 !important;
}

[data-bs-theme="dark"] .badge-phoenix-secondary, [data-bs-theme="dark"] .bg-secondary-subtle {
    background-color: #1c222c !important;
    color: #aeb7c6 !important;
}

[data-bs-theme="dark"] .alert-success { background-color: #12241c; color: #8fe3ba; border-color: #1c3a2c; }
[data-bs-theme="dark"] .alert-danger  { background-color: #2a1516; color: #f4a9a9; border-color: #3d2122; }
[data-bs-theme="dark"] .alert-warning { background-color: #2a2113; color: #f2c37e; border-color: #3d3320; }
[data-bs-theme="dark"] .alert-info    { background-color: #0f2630; color: #8fd4e8; border-color: #1c3d49; }

/* ── Print Media ── */
@media print {
    .sidebar, .topbar, .ph-actions, .view-toggle, .no-print, .preloader {
        display: none !important;
    }
    .content {
        margin: 0 !important;
        width: 100% !important;
    }
    #main-content {
        padding: 0 !important;
    }
    .card, .dt-wrap {
        box-shadow: none !important;
        border-color: #ccc !important;
    }
    .page-head {
        background: none !important;
        box-shadow: none !important;
        border: 1px solid #ccc;
    }
    .page-head::after {
        display: none !important;
    }
    a {
        text-decoration: none !important;
        color: inherit !important;
    }
    body {
        background: #fff !important;
    }
    @page {
        margin: 14mm;
    }
}

.print-head {
    display: none;
}

@media print {
    .print-head {
        display: block;
        text-align: center;
        margin-bottom: 14px;
    }
    .print-head .ph-org {
        font-weight: 800;
        font-size: 1.05rem;
        color: #0d2748;
    }
    .print-head .ph-portal {
        font-size: .8rem;
        color: #555;
    }
    .print-head hr {
        margin: .5rem 0;
        border-top: 2px solid #FF9933;
    }
}
