/* =====================================================
       PAGE HEADER
    ===================================================== */

.analytics-page {
    padding-bottom: 1rem;
}

.page-icon-badge {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.5rem;
    background: linear-gradient(135deg, #0F766E 0%, #14B8A6 100%);
    box-shadow: 0 10px 22px rgba(15, 118, 110, .28);
    flex-shrink: 0;
}

.page-title {
    font-weight: 800;
    letter-spacing: -.4px;
    color: var(--text-main, #0f172a);
    font-size: 1.45rem;
}

.page-subtitle {
    color: var(--text-muted, #64748b);
    font-size: .88rem;
    max-width: 720px;
}

/* ---------- HEADER META CHIP ---------- */

.header-meta {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    padding: .55rem 1rem;
    border-radius: 12px;

    background: #ECFDF5;
    color: #0F766E;
    border: 1px solid #BBF7D0;

    font-size: .8rem;
    font-weight: 700;

}

.meta-chip i {
    font-size: .95rem;
}

/* =====================================================
       KPI CARD
    ===================================================== */

.kpi-card {
    border: 1px solid rgba(226, 232, 240, .9);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 4px 18px rgba(15, 23, 42, .05);
    transition: all .25s ease;
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.kpi-card.accent-success::before {
    background: #16A34A;
}

.kpi-card.accent-danger::before {
    background: #DC2626;
}

.kpi-card.accent-warning::before {
    background: #F59E0B;
}

.kpi-card.accent-primary::before {
    background: #6366F1;
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 32px rgba(15, 23, 42, .10);
}

.kpi-label {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .8px;
    text-transform: uppercase;
    color: #94A3B8;
}

.kpi-value {
    font-weight: 800;
    font-size: 1.6rem;
    letter-spacing: -.5px;
    color: #0f172a;
}

.kpi-hint {
    font-size: .74rem;
    color: #94A3B8;
    font-weight: 500;
}

.kpi-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

/* =====================================================
       CHART CARD
    ===================================================== */

.chart-card {
    border: 1px solid rgba(226, 232, 240, .9);
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 4px 18px rgba(15, 23, 42, .05);
}

.chart-card-header {
    background: #F8FAFC;
    border-bottom: 1px solid #E2E8F0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    gap: 1rem;
}

.chart-card-header h5 {
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -.3px;
}

.chart-card .card-body {
    padding: 1.25rem;
}

.chart-loading {
    text-align: center;
    padding: 3rem 1rem;
}

.chart-wrapper {
    position: relative;
    height: 340px;
}

.donut-wrapper {
    max-width: 340px;
    margin: auto;
    height: 340px;
}

#incidentMonthly,
#priorityDonut {
    display: none;
}

/* =====================================================
       TABLE CARD
    ===================================================== */

.table-card {
    border: 1px solid rgba(226, 232, 240, .9);
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 4px 18px rgba(15, 23, 42, .05);
}

.table-card-header {
    background: #F8FAFC;
    border-bottom: 1px solid #E2E8F0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    gap: 1rem;
}

.table-card-header h5 {
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -.3px;
}

/* =====================================================
       ANALYTICS TABLE
    ===================================================== */

.analytics-table thead th {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .8px;
    text-transform: uppercase;
    color: #64748B;
    background: #F8FAFC;
    border-bottom: 1px solid #E2E8F0;
    padding: .9rem 1.1rem;
    white-space: nowrap;
}

.analytics-table tbody td {
    padding: .9rem 1.1rem;
    font-size: .86rem;
    color: #334155;
    border-bottom: 1px solid #F1F5F9;
    vertical-align: middle;
}

.analytics-table tbody tr:last-child td {
    border-bottom: none;
}

.analytics-table tbody tr:hover {
    background: #F8FAFC;
}

.badge-priority {
    min-width: 60px;
    display: inline-block;
    font-weight: 700;
    font-size: .74rem;
    letter-spacing: .3px;
    padding: 5px 10px;
    border-radius: 8px;
}

.analytics-table .badge {
    font-weight: 600;
    font-size: .72rem;
    padding: 5px 10px;
    border-radius: 8px;
    letter-spacing: .3px;
}

/* =====================================================
    PRIORITY CELL
    ===================================================== */

.analytics-table td .badge-priority {

    min-width: 48px;
    display: inline-block;
    font-weight: 700;
    font-size: .74rem;
    letter-spacing: .5px;
    padding: 4px 10px;
    border-radius: 8px;
    text-align: center;

}

.priority-label {

    font-size: .72rem;
    font-weight: 600;
    color: #64748B;
    margin-top: 4px;
    letter-spacing: .2px;

}

body.dark-mode .priority-label {
    color: #94A3B8;
}

/* DataTables wrapper */
.table-card .dataTables_wrapper {
    padding: 1rem 1.25rem 1.25rem;
}

.dataTables_wrapper .dataTables_filter input {
    border-radius: 10px;
    border: 1px solid #E2E8F0;
    padding: .45rem .85rem;
    font-size: .85rem;
}

.dataTables_wrapper .dataTables_length select {
    border-radius: 10px;
    border: 1px solid #E2E8F0;
    padding: .3rem 1.5rem .3rem .6rem;
    font-size: .85rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: 8px !important;
    font-size: .82rem;
}

.dataTables_wrapper .dataTables_info {
    font-size: .8rem;
    color: #64748B;
}

/* =====================================================
       DARK MODE
    ===================================================== */

body.dark-mode .kpi-card,
body.dark-mode .chart-card,
body.dark-mode .table-card {
    background: #1E293B;
    border-color: #334155;
}

body.dark-mode .kpi-card:hover {
    box-shadow: 0 12px 28px rgba(0, 0, 0, .35);
}

body.dark-mode .kpi-value,
body.dark-mode .page-title,
body.dark-mode .chart-card-header h5,
body.dark-mode .table-card-header h5 {
    color: #F1F5F9;
}

body.dark-mode .chart-card-header,
body.dark-mode .table-card-header {
    background: #0F172A;
    border-bottom-color: #334155;
}

body.dark-mode .analytics-table thead th {
    background: #0F172A;
    color: #94A3B8;
    border-bottom-color: #334155;
}

body.dark-mode .analytics-table tbody td {
    color: #CBD5E1;
    border-bottom-color: #1E293B;
}

body.dark-mode .analytics-table tbody tr:hover {
    background: #0F172A;
}

body.dark-mode .meta-chip {
    background: #052E2B;
    color: #2DD4BF;
    border-color: #0F766E;
}

body.dark-mode .dataTables_wrapper .dataTables_filter input,
body.dark-mode .dataTables_wrapper .dataTables_length select {
    background: #0F172A;
    border-color: #334155;
    color: #E2E8F0;
}

body.dark-mode .dataTables_wrapper .dataTables_info {
    color: #94A3B8;
}

/* =====================================================
       RESPONSIVE
    ===================================================== */

@media (max-width: 991.98px) {
    .chart-wrapper {
        height: 300px;
    }

    .donut-wrapper {
        height: 280px;
    }
}

@media (max-width: 575.98px) {
    .page-icon-badge {
        width: 46px;
        height: 46px;
        font-size: 1.25rem;
    }

    .page-title {
        font-size: 1.15rem;
    }

    .kpi-value {
        font-size: 1.35rem;
    }

    .chart-wrapper {
        height: 260px;
    }

    .donut-wrapper {
        height: 240px;
    }

    .chart-card-header,
    .table-card-header {
        flex-direction: column;
        align-items: flex-start;
    }
}