:root {
    --portal-slate-bg: #f8fafc;
    --portal-sidebar-bg: #0f172a;
    --portal-sidebar-text: #e2e8f0;
    --portal-border-subtle: #e2e8f0;
    --portal-row-alt: #f8fafc;
    --portal-sticky-shadow: rgba(15, 23, 42, 0.06);
}

body.portal-body {
    background-color: var(--portal-slate-bg);
    color: #0f172a;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.portal-sidebar {
    background-color: var(--portal-sidebar-bg);
    color: var(--portal-sidebar-text);
    min-height: 100vh;
}

.portal-sidebar .nav-link {
    color: #cbd5e1;
    border-radius: 0.375rem;
    padding: 0.6rem 0.85rem;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.portal-sidebar .nav-link:hover,
.portal-sidebar .nav-link.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.btn-icon-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.125rem;
    height: 2.125rem;
    padding: 0;
    border-radius: 0.375rem;
    border: 1px solid transparent;
    transition: all 0.15s ease-in-out;
}

.btn-icon-edit {
    background-color: #f1f5f9;
    color: #475569;
    border-color: #cbd5e1;
}
.btn-icon-edit:hover {
    background-color: #e2e8f0;
    color: #1e293b;
}

.btn-icon-delete {
    background-color: #ffe4e6;
    color: #e11d48;
    border-color: #fecdd3;
}
.btn-icon-delete:hover {
    background-color: #fecdd3;
    color: #be123c;
}

.btn-icon-view {
    background-color: #e0f2fe;
    color: #0284c7;
    border-color: #bae6fd;
}
.btn-icon-view:hover {
    background-color: #bae6fd;
    color: #0369a1;
}

.btn-icon-pdf,
.btn-icon-approve {
    background-color: #d1fae5;
    color: #059669;
    border-color: #a7f3d0;
}
.btn-icon-pdf:hover,
.btn-icon-approve:hover {
    background-color: #a7f3d0;
    color: #047857;
}

.btn-icon-reject {
    background-color: #fef3c7;
    color: #d97706;
    border-color: #fde68a;
}
.btn-icon-reject:hover {
    background-color: #fee2e2;
    color: #dc2626;
}

.help-popover-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.15rem;
    height: 1.15rem;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    border-radius: 50%;
    background-color: #e2e8f0;
    color: #334155;
    border: 1px solid #94a3b8;
    cursor: pointer;
    margin-left: 0.35rem;
    vertical-align: middle;
    text-decoration: none;
}

.help-popover-trigger:hover,
.help-popover-trigger:focus {
    background-color: #0284c7;
    color: #ffffff;
    border-color: #0284c7;
    outline: 2px solid rgba(2, 132, 199, 0.25);
}

.sticky-table-container {
    position: relative;
    max-height: 480px;
    overflow: auto;
    border-top: 1px solid var(--portal-border-subtle);
    border-bottom: 1px solid var(--portal-border-subtle);
    border-left: none;
    border-right: none;
    background-color: #ffffff;
}

.table-sticky-matrix {
    width: 100%;
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0;
    border-left: none;
    border-right: none;
}

.table-sticky-matrix th,
.table-sticky-matrix td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    border-top: none;
    border-left: none;
    border-right: none;
    border-bottom: 1px solid var(--portal-border-subtle);
    white-space: nowrap;
}

.table-sticky-matrix thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background-color: #f1f5f9;
    color: #334155;
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 2px solid #cbd5e1;
}

.table-sticky-matrix tbody tr:nth-child(odd) td {
    background-color: #ffffff;
}

.table-sticky-matrix tbody tr:nth-child(even) td {
    background-color: var(--portal-row-alt);
}

.table-sticky-matrix thead th:first-child {
    position: sticky;
    left: 0;
    z-index: 4;
    background-color: #e2e8f0;
    box-shadow: 2px 0 5px var(--portal-sticky-shadow);
}

.table-sticky-matrix tbody td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    font-weight: 600;
    box-shadow: 2px 0 5px var(--portal-sticky-shadow);
}

.mobile-chart-fallback {
    display: none;
}

.desktop-chart-canvas {
    display: block;
}

@media (max-width: 767.98px) {
    .desktop-chart-canvas {
        display: none !important;
    }

    .mobile-chart-fallback {
        display: block !important;
    }

    .table-sticky-matrix.mobile-card-stack thead {
        display: none;
    }

    .table-sticky-matrix.mobile-card-stack tbody tr {
        display: block;
        margin-bottom: 0.85rem;
        border: 1px solid var(--portal-border-subtle);
        border-radius: 0.5rem;
        padding: 0.5rem;
        background-color: #ffffff;
    }

    .table-sticky-matrix.mobile-card-stack tbody td,
    .table-sticky-matrix.mobile-card-stack tbody td:first-child {
        position: static;
        display: flex;
        justify-content: space-between;
        align-items: center;
        white-space: normal;
        box-shadow: none;
        padding: 0.45rem 0.6rem;
        border-bottom: 1px dashed var(--portal-border-subtle);
    }

    .table-sticky-matrix.mobile-card-stack tbody td:last-child {
        border-bottom: none;
    }

    .table-sticky-matrix.mobile-card-stack tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #475569;
        margin-right: 0.75rem;
    }
}
