* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f4f6f9;
    color: #222;
    font-size: 14px;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
}

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

.sidebar {
    width: 250px;
    background: #1f2937;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-brand {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,.1);
}

.sidebar-brand h2 {
    margin: 0;
    font-size: 22px;
}

.sidebar-brand span {
    font-size: 12px;
    color: #cbd5e1;
}

.sidebar-user {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,.1);
}

.sidebar-user-name {
    font-weight: bold;
}

.sidebar-user-role,
.sidebar-user-school {
    font-size: 12px;
    color: #cbd5e1;
    margin-top: 4px;
}

.sidebar-menu {
    list-style: none;
    padding: 10px;
    margin: 0;
}

.sidebar-menu li {
    margin-bottom: 4px;
}

.sidebar-menu a {
    display: block;
    padding: 12px 14px;
    border-radius: 6px;
    color: #e5e7eb;
    font-size: 14px;
}

.sidebar-menu a:hover,
.sidebar-menu li.active a {
    background: #2563eb;
    color: #fff;
}

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

.topbar {
    min-height: 64px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.topbar h1 {
    margin: 0;
    font-size: 22px;
}

.topbar-user {
    font-size: 14px;
    color: #555;
}

.content {
    padding: 24px;
}

.card {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    padding: 20px;
    margin-bottom: 20px;
    width: 100%;
}

.card-title {
    margin: 0 0 14px;
    font-size: 18px;
}

.card p {
    line-height: 1.6;
}

.alert {
    padding: 12px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
    font-size: 14px;
}

.form-control {
    width: 100%;
    max-width: 100%;
    padding: 11px 12px;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    font-size: 14px;
    background: #fff;
}

textarea.form-control {
    resize: vertical;
}

.form-control:focus {
    outline: none;
    border-color: #2563eb;
}

.btn {
    display: inline-block;
    border: none;
    border-radius: 7px;
    padding: 10px 14px;
    font-size: 14px;
    cursor: pointer;
    background: #e5e7eb;
    color: #111827;
    line-height: 1.2;
    margin: 2px;
}

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

.btn-danger {
    background: #dc2626;
    color: #fff;
}

.btn-secondary {
    background: #6b7280;
    color: #fff;
}

.btn-sm {
    padding: 7px 10px;
    font-size: 13px;
}

.btn-block,
.btn-full {
    width: 100%;
}

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

.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.table th,
.table td {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    font-size: 14px;
    vertical-align: top;
}

.table th {
    background: #f9fafb;
    font-weight: bold;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 99px;
    font-size: 12px;
    background: #e5e7eb;
    color: #374151;
}

.badge.success,
.badge-aktif,
.badge-trial {
    background: #dcfce7;
    color: #166534;
}

.badge.danger,
.badge-nonaktif,
.badge-berakhir {
    background: #fee2e2;
    color: #991b1b;
}

.badge.warning {
    background: #fef3c7;
    color: #92400e;
}

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

.dashboard-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    display: block;
}

.dashboard-number {
    font-size: 34px;
    font-weight: bold;
    color: #2563eb;
    margin-bottom: 10px;
}

.dashboard-title {
    font-size: 15px;
    color: #555;
}

.login-page {
    min-height: 100vh;
    background: #1f2937;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.login-box {
    width: 100%;
    max-width: 420px;
    background: #fff;
    padding: 28px;
    border-radius: 10px;
}

.login-title {
    text-align: center;
    margin-bottom: 22px;
}

.login-title h1 {
    margin: 0;
    font-size: 28px;
}

.login-title p {
    margin: 8px 0 0;
    color: #666;
    font-size: 14px;
}

.login-footer {
    text-align: center;
    margin-top: 18px;
    color: #777;
    font-size: 13px;
}

.modal-backdrop {
    display: none;
    position: fixed;
    z-index: 9999;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    padding: 40px 16px;
    overflow-y: auto;
}

.modal-backdrop.show {
    display: block;
}

.modal-box {
    background: #fff;
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding: 24px;
    border-radius: 12px;
}

.modal-large {
    max-width: 960px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.modal-close {
    border: 0;
    background: transparent;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
}

@media (max-width: 768px) {
    body {
        font-size: 15px;
    }

    .app-wrapper {
        display: block;
    }

    .sidebar {
        width: 100%;
    }

    .sidebar-brand,
    .sidebar-user {
        padding: 14px 16px;
    }

    .sidebar-brand h2 {
        font-size: 20px;
    }

    .sidebar-menu {
        display: flex;
        overflow-x: auto;
        gap: 6px;
        padding: 10px;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar-menu li {
        flex: 0 0 auto;
        margin-bottom: 0;
    }

    .sidebar-menu a {
        white-space: nowrap;
        padding: 10px 12px;
        font-size: 13px;
    }

    .topbar {
        min-height: auto;
        padding: 14px 16px;
        display: block;
    }

    .topbar h1 {
        font-size: 19px;
        margin-bottom: 6px;
    }

    .topbar-user {
        font-size: 13px;
    }

    .content {
        padding: 14px;
    }

    .card {
        padding: 16px;
        border-radius: 9px;
        margin-bottom: 14px;
    }

    .card-title {
        font-size: 17px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .dashboard-card {
        padding: 16px;
    }

    .dashboard-number {
        font-size: 28px;
    }

    .table {
        min-width: 760px;
    }

    .table th,
    .table td {
        padding: 10px;
        font-size: 13px;
    }

    .btn {
        padding: 10px 12px;
        font-size: 13px;
        margin-bottom: 6px;
    }

    .btn-sm {
        padding: 8px 10px;
        font-size: 13px;
    }

    .form-control {
        font-size: 15px;
        padding: 11px 12px;
    }

    .modal-backdrop {
        padding: 16px 10px;
    }

    .modal-box,
    .modal-large {
        max-width: 100%;
        padding: 16px;
        border-radius: 10px;
    }

    .modal-header {
        align-items: flex-start;
    }

    .login-box {
        padding: 22px;
    }

    .login-title h1 {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .content {
        padding: 10px;
    }

    .card {
        padding: 14px;
    }

    .topbar h1 {
        font-size: 18px;
    }

    .table {
        min-width: 700px;
    }

    .btn,
    .btn-sm {
        width: 100%;
        text-align: center;
    }

    td .btn,
    td .btn-sm {
        width: auto;
    }
}

.badge-diduga {
    background-color: #dc3545 !important;
    color: white !important;
    padding: 5px 10px !important;
    border-radius: 20px !important;
    font-size: 0.78em !important;
    font-weight: 600 !important;
    margin: 2px 4px 2px 0 !important;
    display: inline-block !important;
}

/* ===================== PERBAIKAN TABEL ALUR KERJA ===================== */
.card table.table {
    width: 100%;
    border-collapse: collapse;
}

.card table.table td {
    padding: 12px 10px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: top;
}

/* Khusus tabel alur kerja */
.card table.table tr td:first-child {
    width: 40px;
    font-weight: bold;
    color: #2563eb;
    text-align: center;
    background: #f8fafc;
}

/* Responsive khusus untuk tabel sederhana seperti Alur Kerja */
@media (max-width: 768px) {
    .card table.table td {
        padding: 14px 10px;
        font-size: 15px;
        line-height: 1.5;
    }

    .card table.table tr td:first-child {
        width: 36px;
        padding: 14px 8px;
    }

    /* Pastikan teks bisa wrap dengan baik */
    .card table.table td:last-child {
        word-break: break-word;
        hyphens: auto;
    }
}

@media (max-width: 480px) {
    .card table.table td {
        padding: 12px 8px;
        font-size: 14.5px;
    }
}

/* ===================== TABEL SISWA INKLUSI ===================== */
#siswaTable {
    width: 100%;
    border-collapse: collapse;
    min-width: 1000px; /* memaksa scroll horizontal */
}

#siswaTable th,
#siswaTable td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: middle;
}

#siswaTable th {
    background: #f8fafc;
    font-weight: 600;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Kolom khusus */
#siswaTable td:nth-child(1) { /* No */
    width: 50px;
    text-align: center;
    font-weight: bold;
}

#siswaTable td:last-child { /* Aksi */
    white-space: nowrap;
}

.diduga-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* ===================== RESPONSIVE TABLE ===================== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    margin: 0 -4px;
    padding: 0 4px;
}

@media (max-width: 768px) {
    #siswaTable {
        min-width: 1100px; /* sedikit lebih lebar agar tidak terlalu sempit */
        font-size: 14px;
    }

    #siswaTable th,
    #siswaTable td {
        padding: 10px 8px;
    }

    #siswaTable td {
        white-space: nowrap; /* penting agar tidak pecah kolom */
    }

    /* Buat tombol aksi lebih kecil & vertikal di HP */
    #siswaTable .btn {
        display: inline-block;
        margin: 3px 2px;
        padding: 7px 10px;
        font-size: 12.5px;
    }

    /* Kolom Diduga */
    .diduga-badges {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    #siswaTable {
        min-width: 980px;
        font-size: 13.5px;
    }

    #siswaTable th,
    #siswaTable td {
        padding: 9px 6px;
    }
}