:root {
    --sidebar-width: 260px;
    --primary-gradient: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    --kpi-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bs-body-bg);
}

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bs-tertiary-bg);
    border-right: 1px solid var(--bs-border-color);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1040;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    padding: 1.25rem 1.5rem;
    font-weight: 700;
    font-size: 1.1rem;
    border-bottom: 1px solid var(--bs-border-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--bs-primary);
}

.sidebar-nav {
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    border-radius: 0.5rem;
    color: var(--bs-body-color);
    text-decoration: none;
    transition: all 0.2s;
}

.sidebar-nav .nav-link:hover {
    background: var(--bs-secondary-bg);
}

.sidebar-nav .nav-link.active {
    background: var(--bs-primary);
    color: #fff;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.top-navbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    background: var(--bs-body-bg);
    border-bottom: 1px solid var(--bs-border-color);
    position: sticky;
    top: 0;
    z-index: 1030;
}

.navbar-title {
    flex: 1;
    font-weight: 600;
    font-size: 1.1rem;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.content-area {
    padding: 1.5rem;
    flex: 1;
}

.kpi-card {
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    box-shadow: var(--kpi-shadow);
    height: 100%;
}

.kpi-label {
    font-size: 0.8rem;
    color: var(--bs-secondary-color);
    margin-bottom: 0.35rem;
}

.kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--bs-primary);
}

.kpi-value.kpi-small {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.3;
}

.chart-card .card-body {
    min-height: 280px;
}

.filter-bar {
    border: none;
    box-shadow: var(--kpi-shadow);
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 50%, #1d4ed8 100%);
    padding: 1rem;
}

.login-card {
    background: var(--bs-body-bg);
    border-radius: 1rem;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-icon {
    font-size: 3rem;
    color: var(--bs-primary);
}

.report-list .list-group-item {
    cursor: pointer;
    border-left: 3px solid transparent;
}

.report-list .list-group-item.active {
    border-left-color: var(--bs-primary);
}

.table th {
    white-space: nowrap;
    font-size: 0.85rem;
}

.btn-detail {
    font-size: 0.8rem;
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }
}

[data-bs-theme="dark"] {
    color-scheme: dark;
    --bs-body-color: #e2e8f0;
    --bs-body-bg: #0b1220;
    --bs-secondary-color: #94a3b8;
    --bs-tertiary-color: #cbd5e1;
    --bs-emphasis-color: #f8fafc;
    --bs-border-color: #334155;
    --bs-heading-color: #f1f5f9;
    --bs-link-color: #93c5fd;
    --bs-link-hover-color: #bfdbfe;
}

[data-bs-theme="dark"] body,
[data-bs-theme="dark"] .content-area,
[data-bs-theme="dark"] .navbar-title,
[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .card-body,
[data-bs-theme="dark"] .card-header,
[data-bs-theme="dark"] .modal-content,
[data-bs-theme="dark"] .modal-header,
[data-bs-theme="dark"] .modal-body,
[data-bs-theme="dark"] .modal-title,
[data-bs-theme="dark"] .list-group-item,
[data-bs-theme="dark"] dl dt,
[data-bs-theme="dark"] dl dd,
[data-bs-theme="dark"] .form-label,
[data-bs-theme="dark"] .form-check-label,
[data-bs-theme="dark"] label,
[data-bs-theme="dark"] p,
[data-bs-theme="dark"] span:not(.badge),
[data-bs-theme="dark"] h1,
[data-bs-theme="dark"] h2,
[data-bs-theme="dark"] h3,
[data-bs-theme="dark"] h4,
[data-bs-theme="dark"] h5,
[data-bs-theme="dark"] h6 {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .text-muted,
[data-bs-theme="dark"] .form-text,
[data-bs-theme="dark"] .dropdown-item-text,
[data-bs-theme="dark"] .kpi-label {
    color: #94a3b8 !important;
}

[data-bs-theme="dark"] .text-dark {
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] code {
    color: #7dd3fc;
    background: #0f172a;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    color: #e2e8f0;
    background-color: #0f172a;
    border-color: #475569;
}

[data-bs-theme="dark"] .form-control::placeholder {
    color: #64748b;
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    color: #f8fafc;
    background-color: #0f172a;
    border-color: #60a5fa;
    box-shadow: 0 0 0 0.2rem rgba(96, 165, 250, 0.2);
}

[data-bs-theme="dark"] .dropdown-menu {
    background-color: #1e293b;
    border-color: #334155;
}

[data-bs-theme="dark"] .dropdown-item {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .dropdown-item:hover,
[data-bs-theme="dark"] .dropdown-item:focus {
    color: #f8fafc;
    background-color: #334155;
}

[data-bs-theme="dark"] .btn-outline-secondary {
    color: #cbd5e1;
    border-color: #64748b;
}

[data-bs-theme="dark"] .btn-outline-secondary:hover {
    color: #0f172a;
    background-color: #cbd5e1;
    border-color: #cbd5e1;
}

[data-bs-theme="dark"] .btn-link {
    color: #93c5fd;
}

[data-bs-theme="dark"] .table thead th {
    color: #f1f5f9;
    border-color: #334155;
}

[data-bs-theme="dark"] .table td,
[data-bs-theme="dark"] .table th {
    border-color: #334155;
}

[data-bs-theme="dark"] .modal-content {
    background-color: #1e293b;
    border-color: #334155;
}

[data-bs-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

[data-bs-theme="dark"] .alert-danger {
    color: #fecaca;
    background-color: #450a0a;
    border-color: #7f1d1d;
}

[data-bs-theme="dark"] .alert-success {
    color: #bbf7d0;
    background-color: #052e16;
    border-color: #14532d;
}

[data-bs-theme="dark"] .kpi-card,
[data-bs-theme="dark"] .filter-bar,
[data-bs-theme="dark"] .chart-card,
[data-bs-theme="dark"] .card {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .card-header {
    background: #0f172a;
    border-color: #334155;
    color: #f1f5f9;
}

[data-bs-theme="dark"] .sidebar {
    background: #0f172a;
    border-color: #334155;
}

[data-bs-theme="dark"] .sidebar-brand {
    color: #93c5fd;
    border-color: #334155;
}

[data-bs-theme="dark"] .sidebar-nav .nav-link {
    color: #cbd5e1;
}

[data-bs-theme="dark"] .sidebar-nav .nav-link:hover {
    background: #1e293b;
    color: #f8fafc;
}

[data-bs-theme="dark"] .sidebar-nav .nav-link.active {
    background: #2563eb;
    color: #fff;
}

[data-bs-theme="dark"] .top-navbar {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .content-area {
    background: #0b1220;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .kpi-value {
    color: #60a5fa;
}

[data-bs-theme="dark"] .kpi-value.kpi-small {
    color: #93c5fd;
}

[data-bs-theme="dark"] .table {
    --bs-table-bg: transparent;
    --bs-table-color: #e2e8f0;
    --bs-table-striped-color: #e2e8f0;
    --bs-table-hover-color: #f8fafc;
    --bs-table-striped-bg: rgba(255, 255, 255, 0.04);
    --bs-table-hover-bg: rgba(255, 255, 255, 0.08);
    --bs-table-border-color: #334155;
}

[data-bs-theme="dark"] .report-list .list-group-item {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .report-list .list-group-item:hover {
    background: #334155;
    color: #f8fafc;
}

[data-bs-theme="dark"] .report-list .list-group-item.active {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #fff;
}

[data-bs-theme="dark"] .login-page {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
}

[data-bs-theme="dark"] .login-card {
    background: #1e293b;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .login-card h2,
[data-bs-theme="dark"] .login-card .form-label {
    color: #f1f5f9;
}

[data-bs-theme="dark"] .badge.bg-secondary {
    color: #e2e8f0;
    background-color: #475569 !important;
}
