:root {
    --sidebar-width: 264px;
}

body {
    background: #f6f8fb;
}

.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    flex: 0 0 var(--sidebar-width);
    display: flex;
    flex-direction: column;
    padding: 1.1rem;
    background: #ffffff;
    border-right: 1px solid var(--border-color);
    box-shadow: 1px 0 0 rgba(15, 23, 42, 0.02);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 44px;
    margin-bottom: 1.4rem;
    padding: 0 0.45rem;
    color: var(--text-primary);
    font-size: 1.05rem;
    font-weight: 800;
}

.sidebar-brand i {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--primary-rgb), 0.1);
    border-radius: var(--border-radius);
    color: var(--primary);
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
    list-style: none;
}

.sidebar-item a {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.68rem 0.76rem;
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-size: 0.92rem;
    font-weight: 800;
}

.sidebar-item a:hover,
.sidebar-item.active a {
    background: rgba(var(--primary-rgb), 0.09);
    color: var(--primary);
}

.sidebar-item a i {
    width: 18px;
    text-align: center;
}

.main-content {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.top-bar {
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.6rem;
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 20;
}

.content-body {
    flex: 1;
    padding: 1.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    min-height: 136px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.15rem;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.stat-info h3 {
    margin-bottom: 0.52rem;
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.stat-info .stat-value {
    color: var(--text-primary);
    font-size: clamp(1.5rem, 3vw, 2rem);
    line-height: 1;
    font-weight: 800;
}

.stat-icon {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
    font-size: 1.2rem;
}

.stat-icon.blue { background: rgba(var(--primary-rgb), 0.1); color: var(--primary); }
.stat-icon.green { background: rgba(15, 159, 110, 0.1); color: var(--success); }
.stat-icon.orange { background: rgba(217, 119, 6, 0.1); color: var(--warning); }
.stat-icon.purple { background: rgba(124, 58, 237, 0.1); color: var(--purple); }

.charts-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 0.85fr);
    gap: 1rem;
    align-items: start;
    margin-bottom: 1.5rem;
}

.table-responsive {
    overflow-x: auto;
    border-radius: var(--border-radius);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th,
.data-table td {
    padding: 0.85rem 0.9rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.88rem;
    vertical-align: middle;
}

.data-table th {
    background: var(--bg-primary);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.data-table tbody tr:hover {
    background: rgba(var(--primary-rgb), 0.04);
}

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

@media (max-width: 1040px) {
    .dashboard-wrapper {
        display: block;
    }

    .sidebar {
        width: 100%;
        position: static;
        border-right: 0;
        border-bottom: 1px solid var(--border-color);
    }

    .sidebar-menu {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 0.1rem;
    }

    .sidebar-item a {
        white-space: nowrap;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .top-bar,
    .content-body {
        padding: 1rem;
    }

    .top-bar {
        align-items: flex-start;
        flex-direction: column;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}
