:root {
    --primary: #2f6fed;
    --secondary: #f5f7fb;
    --border: #e7ebf3;
    --surface: #ffffff;
    --text: #21364d;
    --muted: #6c757d;
}
body.theme-dark {
    --secondary: #111827;
    --border: #2f3b52;
    --surface: #172033;
    --text: #f1f5f9;
    --muted: #94a3b8;
    background: linear-gradient(135deg, #0f172a 0%, #111827 100%);
    color: var(--text);
}
body {
    background: linear-gradient(135deg, #f8fbff 0%, var(--secondary) 100%);
    font-family: Arial, sans-serif;
    color: var(--text);
}
.card, .table, .form-control, .form-select, .modal-content {
    background: var(--surface) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}
.sidebar {
    background: #0f172a !important;
}
.text-muted { color: var(--muted) !important; }
.wrapper {
    display: flex;
    min-height: 100vh;
}
.sidebar {
    width: 260px;
    flex: 0 0 260px;
    min-height: 100vh;
    position: sticky;
    top: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
}
.content {
    flex: 1;
    padding: 20px;
    min-width: 0;
}
.user-welcome {
    align-items: center;
    display: inline-flex;
    gap: 8px;
    min-width: 0;
}
.user-icon-3d {
    align-items: center;
    background: linear-gradient(145deg, #69a0ff 0%, #2f6fed 58%, #174bb5 100%);
    border: 1px solid rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    box-shadow: inset 2px 2px 3px rgba(255, 255, 255, 0.55), inset -3px -4px 5px rgba(16, 55, 135, 0.42), 0 3px 6px rgba(25, 70, 150, 0.28);
    color: #fff;
    display: inline-flex;
    flex: 0 0 30px;
    height: 30px;
    justify-content: center;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
    width: 30px;
}
.user-icon-3d i {
    font-size: 17px;
    line-height: 1;
}
.user-welcome-text {
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.card {
    border-radius: 14px;
}
.card-stat {
    border-left: 4px solid var(--primary);
}
.dashboard-chart-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
    justify-content: center;
    min-height: 220px;
    width: 100%;
}
.dashboard-bar-row {
    align-items: center;
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(70px, 1fr) minmax(80px, 2fr) auto;
}
.dashboard-bar-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dashboard-bar-track {
    background: #e7ebf3;
    border-radius: 999px;
    height: 12px;
    overflow: hidden;
}
.dashboard-bar-fill {
    background: #2f6fed;
    border-radius: inherit;
    display: block;
    height: 100%;
}
.dashboard-bar-value {
    font-size: 0.875rem;
    font-weight: 600;
    text-align: right;
    white-space: nowrap;
}
.dashboard-pie-chart {
    align-items: center;
    min-height: 280px;
}
.dashboard-product-chart {
    min-height: 280px;
}
.dashboard-pie {
    aspect-ratio: 1;
    border-radius: 50%;
    max-height: 190px;
    max-width: 190px;
    width: min(48vw, 190px);
}
.dashboard-pie-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    justify-content: center;
}
.dashboard-legend-dot {
    border-radius: 50%;
    display: inline-block;
    height: 11px;
    margin-right: 6px;
    width: 11px;
}
.dashboard-legend-paid {
    background: #2f6fed;
}
.dashboard-legend-unpaid {
    background: #dc3545;
}
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.nav-link:hover {
    background: rgba(255,255,255,0.08);
    border-radius: 6px;
}
.table thead th {
    background: #f3f7ff;
}
@media (max-width: 991.98px) {
    .wrapper {
        display: block;
        min-height: 100vh;
    }
    .sidebar {
        background: #0f172a !important;
        height: 100vh;
        height: 100dvh;
        left: 0;
        min-height: 0;
        overflow-y: auto;
        position: fixed;
        top: 0;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        width: min(280px, 85vw);
        z-index: 1060;
    }
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    .sidebar-backdrop {
        background: rgba(15, 23, 42, 0.55);
        border: 0;
        display: none;
        inset: 0;
        padding: 0;
        position: fixed;
        width: 100%;
        z-index: 1050;
    }
    body.sidebar-open {
        overflow: hidden;
    }
    body.sidebar-open .sidebar-backdrop {
        display: block;
    }
    .content {
        padding: 12px;
        width: 100%;
    }
    .content > .navbar {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
    .dashboard-chart-container {
        min-height: 220px;
    }
    .dashboard-pie-chart,
    .dashboard-product-chart {
        min-height: 250px;
    }
}
@media (max-width: 575.98px) {
    .content {
        padding: 8px;
    }
    .content .container-fluid {
        padding-left: 4px;
        padding-right: 4px;
    }
    .navbar .user-welcome {
        max-width: 48vw;
    }
    .navbar .user-welcome-text {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .dashboard-chart-container {
        min-height: 190px;
    }
    .dashboard-pie-chart,
    .dashboard-product-chart {
        min-height: 220px;
    }
    .dashboard-bar-row {
        gap: 7px;
        grid-template-columns: minmax(60px, 0.8fr) minmax(45px, 1fr) auto;
    }
    .dashboard-bar-label,
    .dashboard-bar-value {
        font-size: 0.75rem;
    }
    .card-body {
        padding: 14px;
    }
}
@media print {
    .sidebar, .navbar, .btn, .alert, .form-control, .form-select {
        display: none !important;
    }
    .content {
        padding: 0;
    }
}
