/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: #f1f5f9;
    color: #0f172a;
    line-height: 1.6;
}

/* ===== LAYOUT ===== */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
    padding: 1.5rem 1rem;
    flex-shrink: 0;
    min-height: 100vh;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    background: #ffffff;
    padding: 1rem 2rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.content {
    padding: 1.5rem 2rem;
    flex: 1;
}

/* ===== SIDEBAR STYLES ===== */
.sidebar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-brand i {
    color: #2563eb;
    font-size: 1.5rem;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav li {
    margin-bottom: 0.25rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    border-radius: 0.5rem;
    color: #475569;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.sidebar-nav a:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.sidebar-nav a.active {
    background: #2563eb;
    color: #ffffff;
}

.sidebar-nav a i {
    font-size: 1.1rem;
    width: 1.25rem;
    text-align: center;
}

.sidebar-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
}

.sidebar-section-title {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    font-weight: 600;
    margin-bottom: 0.75rem;
    padding: 0 1rem;
}

/* ===== TOPBAR ===== */
.topbar-title h1 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: #0f172a;
}

.topbar-title p {
    font-size: 0.75rem;
    color: #64748b;
    margin: 0;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar-actions .badge-dot {
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    display: inline-block;
}

.topbar-actions .avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #2563eb;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
}

/* ===== CARDS ===== */
.card-custom {
    background: #ffffff;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.15s ease;
}

.card-custom:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* ===== KPI CARDS ===== */
.kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
    margin-top: 0.5rem;
}

.kpi-label {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 500;
}

.kpi-delta {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-top: 0.25rem;
}

.kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.kpi-icon-blue {
    background: #dbeafe;
    color: #2563eb;
}

.kpi-icon-green {
    background: #dcfce7;
    color: #16a34a;
}

.kpi-icon-amber {
    background: #fef3c7;
    color: #d97706;
}

.kpi-icon-cyan {
    background: #cffafe;
    color: #0891b2;
}

/* ===== HEADCOUNT BARS ===== */
.hc-bar-track {
    width: 100%;
    height: 6px;
    background: #f1f5f9;
    border-radius: 3px;
    overflow: hidden;
}

.hc-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.hc-blue {
    background: #2563eb;
}

.hc-green {
    background: #16a34a;
}

.hc-amber {
    background: #d97706;
}

.hc-cyan {
    background: #0891b2;
}

/* ===== UTILITY ===== */
.fw-600 {
    font-weight: 600;
}

.fw-500 {
    font-weight: 500;
}

.text-900 {
    color: #0f172a;
}

.text-500 {
    color: #64748b;
}

.text-600 {
    color: #475569;
}

.fs-12 {
    font-size: 0.75rem;
}

.fs-11 {
    font-size: 0.6875rem;
}

.fs-10 {
    font-size: 0.625rem;
}

.fs-14 {
    font-size: 0.875rem;
}

/* ===== LOADING SKELETON ===== */
.skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.kpi-skeleton {
    height: 72px;
    width: 100%;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    .sidebar {
        width: 220px;
    }
}

@media (max-width: 992px) {
    .sidebar {
        width: 200px;
        padding: 1rem 0.75rem;
    }

    .content {
        padding: 1rem;
    }

    .topbar {
        padding: 0.75rem 1rem;
    }
}

@media (max-width: 768px) {
    .app-wrapper {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        min-height: auto;
        height: auto;
        position: relative;
        padding: 1rem;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
    }

    .sidebar-brand {
        margin-bottom: 1rem;
    }

    .sidebar-nav {
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .sidebar-nav li {
        margin-bottom: 0;
    }

    .sidebar-nav a {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }

    .sidebar-section {
        display: none;
    }

    .topbar-title h1 {
        font-size: 1.1rem;
    }

    .content {
        padding: 0.75rem;
    }

    .kpi-value {
        font-size: 1.4rem;
    }

    .card-custom {
        padding: 1rem !important;
    }

    .card-custom.p-4 {
        padding: 1rem !important;
    }

    .row.g-3 {
        --bs-gutter-y: 0.75rem;
        --bs-gutter-x: 0.75rem;
    }

    .col-3,
    .col-6,
    .col-4,
    .col-8 {
        width: 100% !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    .col-6 {
        width: 100% !important;
    }

    .topbar-actions .d-none.d-md-flex {
        display: none !important;
    }
}

@media (max-width: 576px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .topbar-actions {
        width: 100%;
        justify-content: space-between;
    }

    .content {
        padding: 0.5rem;
    }

    .card-custom {
        padding: 0.75rem !important;
    }

    .kpi-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .kpi-value {
        font-size: 1.2rem;
    }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}