:root {
    --primary: #667eea;
    --secondary: #764ba2;
    --text-main: #333333;
    --text-muted: #6b7280;
    --bg-body: #f3f4f6;
    --bg-sidebar: #ffffff;
    --sidebar-width: 260px;
    --border-color: #e5e7eb;
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    box-shadow: 2px 0 10px rgba(0,0,0,0.05);
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 30px 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
}
.sidebar-header p {
    margin: 5px 0 0 0;
    opacity: 0.8;
    font-size: 14px;
}

.nav-menu {
    list-style: none;
    padding: 20px 0;
    margin: 0;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}
/* Mempercantik tampilan scrollbar pada sidebar */
.nav-menu::-webkit-scrollbar {
    width: 6px;
}
.nav-menu::-webkit-scrollbar-track {
    background: transparent;
}
.nav-menu::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.nav-menu::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
.nav-menu .nav-title {
    padding: 10px 25px;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 10px;
}
.nav-menu li a {
    display: block;
    padding: 12px 25px;
    color: var(--text-main);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}
.nav-menu li a i {
    width: 25px;
    color: var(--primary);
    transition: all 0.3s ease;
}
.nav-menu li a:hover, .nav-menu li a.active {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary);
    border-right: 4px solid var(--primary);
}
.nav-menu li a.active i {
    color: var(--primary);
}
.text-danger {
    color: #ef4444 !important;
}
.text-danger i {
    color: #ef4444 !important;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.topbar {
    background: white;
    padding: 15px 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}
.user-info i {
    color: var(--primary);
}

.container {
    padding: 30px;
}

/* Card & Typography */
.card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    margin-bottom: 24px;
}
.page-title {
    margin-top: 0;
    margin-bottom: 24px;
    color: var(--text-main);
    font-weight: 600;
}

/* Grid & Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}
.stat-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.3s;
}
.stat-card:hover {
    transform: translateY(-5px);
}
.stat-info h3 {
    margin: 0 0 5px 0;
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}
.stat-info .num {
    margin: 0;
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
}
.stat-icon {
    width: 60px;
    height: 60px;
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}
table th, table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
table th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--text-muted);
}
table tbody tr:hover {
    background: #f1f5f9;
}
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    background: #e0e7ff;
    color: #4f46e5;
}

/* Forms & Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
}
.btn:hover {
    background: var(--secondary);
    box-shadow: 0 4px 6px rgba(102,126,234,0.3);
}
.btn-secondary {
    background: #94a3b8;
}
.btn-secondary:hover {
    background: #64748b;
}
.header-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-main);
}
.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.3s;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}
textarea.form-control {
    resize: vertical;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 20px;
}
.col-span-full {
    grid-column: 1 / -1;
}
.alert {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}
.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* ==========================================================================
   MOBILE RESPONSIVE
   ========================================================================== */
@media screen and (max-width: 768px) {
    html, body {
        overflow-x: hidden !important;
        max-width: 100% !important;
        width: 100% !important;
    }
    .container {
        padding: 15px !important;
    }
    .topbar {
        padding: 15px !important;
    }
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    .sidebar.active {
        transform: translateX(0);
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 90;
    }
    .sidebar-overlay.active {
        display: block;
    }
    .main-content {
        margin-left: 0;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .header-action {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    .header-action form, .header-action > div {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    .header-action .form-control {
        width: 100% !important;
    }
    .header-action button, .header-action .btn {
        width: 100% !important;
        text-align: center;
        box-sizing: border-box;
    }
    .topbar {
        padding: 15px 20px;
        justify-content: flex-start;
    }
    .topbar .header-title-area {
        flex: 1;
        display: flex;
        align-items: center;
        gap: 15px;
    }
    .mobile-menu-toggle {
        display: block !important;
        background: none;
        border: none;
        font-size: 20px;
        color: var(--primary);
        cursor: pointer;
        padding: 5px;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .flex-col-mobile {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center;
    }
    .flex-col-mobile table {
        width: 100% !important;
    }
    .flex-col-mobile tr {
        display: block;
        padding: 10px 0;
        border-bottom: 1px solid var(--border-color) !important;
    }
    .flex-col-mobile td {
        display: block;
        width: 100% !important;
        text-align: left;
        border: none !important;
        padding: 0 !important;
    }
    .flex-col-mobile tr td:first-child {
        color: var(--text-muted);
        font-size: 0.75rem;
        margin-bottom: 3px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    .flex-col-mobile tr td:last-child {
        font-size: 0.85rem;
        color: var(--text-main);
        line-height: 1.4;
    }
    .kategori-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
    }
    .kategori-grid .stat-card {
        padding: 12px !important;
        min-height: 90px !important;
    }
    .kategori-grid .stat-info h3 {
        font-size: 0.8rem !important;
        margin-bottom: 5px !important;
    }
    .kategori-grid .stat-info .num {
        font-size: 1.5rem !important;
    }
    .dashboard-banner {
        padding: 20px !important;
        gap: 15px !important;
        flex-direction: column;
        text-align: center;
    }
    .dashboard-banner img {
        width: 80px !important;
    }
    .dashboard-banner h3 {
        font-size: 1rem !important;
    }
    .dashboard-banner .banner-title {
        font-size: 1.6rem !important;
    }
    .dashboard-banner p {
        font-size: 0.85rem !important;
        margin-top: 8px !important;
    }
    .table-responsive, div[style*="overflow-x:auto"] {
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        margin-bottom: 1.5rem !important;
        border: 1px solid var(--border-color);
        border-radius: 8px;
    }
    .table-responsive table:not(.table-cards), div[style*="overflow-x:auto"] table:not(.table-cards) {
        min-width: 650px !important;
    }
    table th {
        white-space: nowrap !important;
    }
    
    /* Table cards mobile collapse layout */
    .table-responsive:has(.table-cards), div[style*="overflow-x:auto"]:has(.table-cards) {
        border: none !important;
        overflow-x: visible !important;
        background: transparent !important;
    }
    .table-cards thead {
        display: none !important;
    }
    .table-cards tr {
        display: block !important;
        background: white !important;
        border: 1px solid var(--border-color) !important;
        border-radius: 12px !important;
        padding: 15px !important;
        margin-bottom: 15px !important;
        box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05) !important;
    }
    .table-cards td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 10px 0 !important;
        border-bottom: 1px dashed #f1f5f9 !important;
        text-align: right !important;
        font-size: 14px !important;
        word-break: break-word !important;
        overflow-wrap: anywhere !important;
        white-space: normal !important;
    }
    .table-cards td:last-child {
        border-bottom: none !important;
        justify-content: center !important;
        padding-top: 12px !important;
        text-align: center !important;
        flex-wrap: wrap;
        gap: 5px;
    }
    .table-cards td::before {
        content: attr(data-label) !important;
        font-weight: 600 !important;
        color: var(--text-muted) !important;
        text-align: left !important;
        margin-right: 15px !important;
        font-size: 13px !important;
    }
    .statistik-laporan-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
    .statistik-laporan-grid > div {
        padding: 12px !important;
    }
    .statistik-laporan-grid p {
        font-size: 11px !important;
        margin-bottom: 5px !important;
    }
    .statistik-laporan-grid h2 {
        font-size: 20px !important;
    }
    .table-cards tr:has(.table-empty) {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
    }
    .table-cards .table-empty {
        display: block !important;
        text-align: center !important;
        padding: 20px 0 !important;
        border: none !important;
        font-style: italic !important;
        color: var(--text-muted) !important;
    }
    .table-cards .table-empty::before {
        display: none !important;
    }
    .table-cards tr.total-row {
        background: #f8fafc !important;
        border: 2px solid var(--primary) !important;
    }
    .table-cards tr.total-row td.total-label {
        display: none !important;
    }
    .table-cards tr.total-row td.total-value {
        display: flex !important;
        justify-content: space-between !important;
        font-size: 16px !important;
    }
    .table-cards tr.total-row td.total-value::before {
        content: "TOTAL" !important;
        font-weight: bold !important;
        color: var(--primary) !important;
    }
    .kinerja-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
    }
    .kinerja-grid .card:last-child {
        grid-column: span 2 !important;
    }
    .kinerja-grid .card {
        padding: 15px !important;
    }
    .kinerja-grid i {
        font-size: 28px !important;
        margin-bottom: 8px !important;
    }
    .kinerja-grid h3 {
        font-size: 15px !important;
    }
    .kinerja-grid p {
        font-size: 12px !important;
    }
}

.table-cards {
    width: 100%;
    border-collapse: collapse;
}

.kategori-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.kategori-grid .stat-card {
    min-height: 120px;
    align-items: flex-start;
    padding: 15px;
}

.dashboard-banner {
    margin-bottom: 20px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 30px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 25px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    flex-wrap: wrap;
}

.dashboard-banner img {
    width: 130px;
    height: auto;
    flex-shrink: 0;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2));
    border-radius: 12px;
}

.dashboard-banner h3 {
    margin-top: 0;
    font-size: 1.4rem;
    font-weight: normal;
    opacity: 0.9;
}

.dashboard-banner .banner-title {
    font-size: 2.2rem;
    font-weight: bold;
}

.dashboard-banner p {
    margin: 10px 0 0 0;
    font-size: 1rem;
    opacity: 0.9;
}

.mobile-menu-toggle {
    display: none;
}

.statistik-laporan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.kinerja-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.role-selector {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    width: 100%;
}
.role-btn {
    flex: 1;
    text-align: center;
    padding: 12px 5px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
    background: #ffffff;
    color: #64748b;
    box-sizing: border-box;
}
.role-btn:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}
.role-selector input[type="radio"]:checked + .role-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 4px 6px rgba(102, 126, 234, 0.2);
}
