* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
    background: #f5f6fa;
    color: #222;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.sidebar-open {
    overflow: hidden;
}

.topbar {
    height: 60px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    padding: 0 20px;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
}

.hamburger {
    display: none;
    width: 38px;
    height: 38px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #ffffff;
    font-size: 20px;
    cursor: pointer;
    margin-right: 14px;
    align-items: center;
    justify-content: center;
    color: #333;
    transition: background 0.15s;
}

.hamburger:hover {
    background: #f1f5f9;
}

.logo {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    margin-right: 32px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.desktop-nav {
    display: flex;
    align-items: center;
    height: 100%;
    gap: 4px;
}

.nav-item {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 38px;
    padding: 0 14px;
    text-decoration: none;
    color: #475569;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.15s ease;
    user-select: none;
}

.nav-link:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.nav-link.active {
    background: #eff6ff;
    color: #2563eb;
    font-weight: 600;
}

.dropdown-caret {
    font-size: 11px;
    transition: transform 0.2s;
}

.nav-item.open .dropdown-caret {
    transform: rotate(180deg);
}

.mega-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 480px;
    max-width: 90vw;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    padding: 20px;
    z-index: 1100;
}

.mega-menu.show {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.mega-column h3 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    color: #94a3b8;
    font-weight: 700;
}

.mega-column a {
    display: block;
    padding: 7px 8px;
    color: #334155;
    text-decoration: none;
    font-size: 13px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.mega-column a:hover {
    background: #eff6ff;
    color: #2563eb;
}

.mega-column a.active {
    background: #eff6ff;
    color: #2563eb;
    font-weight: 600;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    max-width: 85vw;
    height: 100vh;
    background: #ffffff;
    z-index: 2000;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.12);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar.active {
    transform: translateX(0);
}

.sidebar-header {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 700;
    font-size: 16px;
    color: #1e293b;
}

.close-sidebar {
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    font-size: 24px;
    color: #64748b;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-sidebar:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.sidebar-nav {
    padding: 10px 0;
    flex: 1;
}

.side-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    text-decoration: none;
    color: #334155;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s;
}

.side-link-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.side-link-content i {
    width: 20px;
    text-align: center;
}

.side-link:hover {
    background: #f8fafc;
    color: #2563eb;
}

.side-link.active {
    background: #eff6ff;
    color: #2563eb;
    font-weight: 600;
    border-left: 3px solid #2563eb;
}

.side-dropdown {
    display: none;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
}

.side-dropdown.show {
    display: block;
}

.side-dropdown a {
    display: block;
    padding: 10px 18px 10px 48px;
    color: #475569;
    text-decoration: none;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}

.side-dropdown a:hover {
    color: #2563eb;
    background: #f1f5f9;
}

.side-dropdown a.active {
    color: #2563eb;
    font-weight: 600;
    background: #eff6ff;
}

.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    z-index: 1500;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.overlay.active {
    display: block;
    opacity: 1;
}

.content {
    flex: 1;
    padding: 80px 24px 40px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(3px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-header {
    margin-bottom: 20px;
}

.page-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
}

.page-header p {
    color: #64748b;
    font-size: 14px;
}

.card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 18px;
}

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

.stat-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
}

.stat-label {
    font-size: 12px;
    color: #64748b;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table.simple-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

table.simple-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    padding: 10px 14px;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

table.simple-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    white-space: nowrap;
}

table.simple-table tr:hover td {
    background: #f8fafc;
}

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.badge-success {
    background: #dcfce7;
    color: #15803d;
}

.badge-warning {
    background: #fef3c7;
    color: #b45309;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

.form-group input,
.form-group select {
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    color: #1e293b;
    outline: none;
    background: #ffffff;
}

.form-group input:focus,
.form-group select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 18px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: background 0.15s;
}

.btn-primary {
    background: #2563eb;
    color: #ffffff;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.mobile-tabs {
    display: none;
}

@media (max-width: 768px) {
    .desktop-nav {
        display: none;
    }

    .hamburger {
        display: flex;
    }

    .logo {
        font-size: 16px;
        margin-right: auto;
    }

    .topbar {
        padding: 0 14px;
        height: 56px;
    }

    .content {
        padding: 72px 14px 80px;
    }

    .page-header h1 {
        font-size: 20px;
    }

    .mobile-tabs {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 60px;
        background: #ffffff;
        border-top: 1px solid #e2e8f0;
        z-index: 1000;
        display: flex;
        justify-content: space-around;
        align-items: center;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .tab {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        height: 100%;
        text-decoration: none;
        color: #64748b;
        font-size: 11px;
        font-weight: 500;
        gap: 3px;
        cursor: pointer;
        transition: color 0.15s;
        -webkit-tap-highlight-color: transparent;
    }

    .tab-icon {
        font-size: 18px;
        line-height: 1;
    }

    .tab:hover,
    .tab.active {
        color: #2563eb;
    }
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

.chart-legend {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 12px;
    color: #64748b;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.legend-blue {
    background: #2563eb;
}

.legend-gray {
    background: #94a3b8;
}

.bar-chart-wrapper {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 8px;
}

.bar-chart {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    min-width: 480px;
    height: 220px;
    border-bottom: 1px solid #e2e8f0;
    padding: 0 10px;
    gap: 12px;
}

.chart-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}

.bars-group {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    width: 100%;
    max-width: 36px;
    height: 100%;
}

.chart-bar {
    flex: 1;
    border-radius: 4px 4px 0 0;
    transition: opacity 0.2s;
    cursor: pointer;
}

.chart-bar:hover {
    opacity: 0.85;
}

.chart-bar.in {
    background: #2563eb;
}

.chart-bar.out {
    background: #94a3b8;
}

.col-label {
    font-size: 11px;
    color: #64748b;
    margin-top: 8px;
    font-weight: 500;
}

.progress-group {
    margin-bottom: 14px;
}

.progress-group:last-child {
    margin-bottom: 0;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 6px;
    color: #334155;
}

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: #2563eb;
    border-radius: 4px;
}
