:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #eef2ff;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-active: #4f46e5;
    --body-bg: #f1f5f9;
    --card-bg: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
    --sidebar-width: 260px;
    --sidebar-scrollbar: rgba(255, 255, 255, 0.06);
    --sidebar-scrollbar-hover: rgba(255, 255, 255, 0.14);
    --navbar-height: 64px;
    --font: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: var(--font);
    color: var(--text-primary);
    background: var(--body-bg);
    -webkit-font-smoothing: antialiased;
}

/* ===== APP LAYOUT ===== */
.app-body { margin: 0; min-height: 100vh; }

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-content {
    flex: 1;
    padding: 1.5rem 2rem;
}

html[aria-busy="true"] .app-content {
    opacity: 0.94;
    transition: opacity 0.1s ease;
}

.app-footer {
    padding: 1rem 2rem;
    border-top: 1px solid var(--border-color);
    background: var(--card-bg);
    display: flex;
    justify-content: space-between;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* ===== SIDEBAR ===== */
.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform 0.25s ease;
    overflow: hidden;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: var(--sidebar-active);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.25rem;
}

.brand-text { display: flex; flex-direction: column; }

.brand-name {
    color: #fff;
    font-weight: 700;
    font-size: 0.9375rem;
    line-height: 1.2;
}

.brand-role {
    color: #94a3b8;
    font-size: 0.75rem;
}

.sidebar-nav {
    flex: 1;
    min-height: 0;
    padding: 0.75rem;
    background: var(--sidebar-bg);
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-gutter: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--sidebar-scrollbar) var(--sidebar-bg);
}

/* Scrollbar menyatu dengan sidebar — hampir tak terlihat, muncul halus saat hover */
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: var(--sidebar-bg);
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--sidebar-scrollbar);
    border-radius: 999px;
    transition: background 0.2s ease;
}

.sidebar-nav:hover::-webkit-scrollbar-thumb {
    background: var(--sidebar-scrollbar-hover);
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar-nav::-webkit-scrollbar-thumb:active {
    background: rgba(255, 255, 255, 0.26);
}

.sidebar-nav::-webkit-scrollbar-corner {
    background: var(--sidebar-bg);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 2px;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-link i { font-size: 1.125rem; width: 20px; text-align: center; }

.sidebar-link:hover {
    background: var(--sidebar-hover);
    color: #e2e8f0;
}

.sidebar-link.active {
    background: var(--sidebar-active);
    color: #fff;
}

/* Sidebar submenu (Input Data, dll.) */
.sidebar-group { margin-bottom: 0.125rem; }

.sidebar-group-toggle {
    cursor: pointer;
    text-align: left;
}

.sidebar-chevron {
    font-size: 0.75rem;
    transition: transform 0.2s ease;
    opacity: 0.7;
}

.sidebar-group.open .sidebar-chevron {
    transform: rotate(180deg);
}

.sidebar-submenu {
    display: none;
    padding-left: 0.5rem;
    margin-bottom: 0.25rem;
}

.sidebar-group.open .sidebar-submenu {
    display: block;
}

.sidebar-sublink {
    padding-left: 2.25rem !important;
    font-size: 0.875rem;
}

.sidebar-sublink i {
    font-size: 1rem;
    width: 18px;
}

.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.sidebar-logout:hover {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #fca5a5 !important;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1035;
}

/* ===== NAVBAR ===== */
.app-navbar {
    height: var(--navbar-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1050;
}

.sidebar-toggle {
    color: var(--text-primary);
    padding: 0.25rem;
    margin-right: 0.5rem;
    flex-shrink: 0;
    display: none;
}

.navbar-page-title {
    flex: 1;
    min-width: 0;
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.navbar-actions {
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.app-navbar .dropdown-menu {
    z-index: 1060;
}

.user-dropdown {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    border: none;
    background: transparent;
    padding: 0.375rem 0.5rem;
    border-radius: 8px;
}

.user-dropdown:hover { background: var(--body-bg); }

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
}

.avatar-initial {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.875rem;
}

.siswa-foto-preview-img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 12px;
    border: 2px solid var(--border-color, #dee2e6);
}

.siswa-foto-preview-placeholder {
    width: 120px;
    height: 120px;
    margin: 0 auto;
    border-radius: 12px;
    background: var(--body-bg);
    border: 2px dashed var(--border-color, #dee2e6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--text-muted, #6c757d);
}

.user-info { text-align: left; line-height: 1.2; }

.user-name {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-role {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* ===== PAGE ===== */
.page-header {
    margin-bottom: 1.5rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
}

.page-subtitle {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.9375rem;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* ===== STAT CARDS ===== */
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    height: 100%;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.375rem;
    flex-shrink: 0;
}

.stat-primary .stat-icon { background: var(--primary-light); color: var(--primary); }
.stat-success .stat-icon { background: #ecfdf5; color: #059669; }
.stat-warning .stat-icon { background: #fffbeb; color: #d97706; }
.stat-danger  .stat-icon { background: #fef2f2; color: #dc2626; }
.stat-icon-muted { background: var(--body-bg); color: var(--text-secondary); }

.stat-value {
    display: block;
    font-size: 1.375rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    display: block;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.stat-value-sm { font-size: 1rem; }

/* Rekapan SPP — matriks & KPI */
.spp-progress {
    height: 6px;
    background: rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    overflow: hidden;
}
.spp-progress-bar {
    height: 100%;
    background: var(--bs-info, #0dcaf0);
    border-radius: 999px;
}
.spp-filter-form .tunggakan-toolbar-left {
    flex: 1 1 100%;
    margin-right: 0;
}
.spp-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}
.spp-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.spp-matrix-wrap {
    overflow-x: auto;
    max-width: 100%;
}
.spp-matrix {
    font-size: 0.75rem;
    white-space: nowrap;
}
.spp-matrix-sticky {
    position: sticky;
    left: 0;
    background: var(--card-bg, #fff);
    z-index: 2;
    min-width: 160px;
}
.spp-col-month { min-width: 36px; }
.spp-cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: default;
}
.spp-cell--lunas { background: #d1e7dd; color: #0f5132; }
.spp-cell--tunggak { background: #f8d7da; color: #842029; }
.spp-cell--cicilan { background: #fff3cd; color: #664d03; }
.spp-cell--dispensasi { background: #e9ecef; color: #495057; }
.spp-cell--empty { background: #f8f9fa; color: #adb5bd; }

/* Tunggakan — toolbar & daftar siswa */
.tunggakan-toolbar {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.875rem 1.125rem;
    box-shadow: var(--shadow-sm);
}

.tunggakan-toolbar-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: flex-end;
    gap: 1rem 1.25rem;
    width: 100%;
    margin: 0;
}

.tunggakan-toolbar-left {
    margin-right: auto;
}

.tunggakan-filter-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.tunggakan-filter-label i {
    margin-right: 0.2rem;
    opacity: 0.85;
}

.tunggakan-select,
.tunggakan-search-input {
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    background: var(--body-bg);
    color: var(--text-primary);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tunggakan-select {
    min-width: 160px;
    cursor: pointer;
}

.tunggakan-select:focus,
.tunggakan-search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    outline: none;
}

.tunggakan-search-field {
    margin: 0;
}

.tunggakan-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.tunggakan-search-wrap > .bi-search {
    position: absolute;
    left: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    pointer-events: none;
}

.tunggakan-search-input {
    min-width: min(280px, 72vw);
    padding-left: 2.35rem;
    padding-right: 2rem;
}

/* Sembunyikan tombol clear bawaan browser (X biru kecil) */
.tunggakan-search-input::-webkit-search-cancel-button,
.tunggakan-search-input::-webkit-search-decoration {
    -webkit-appearance: none;
    appearance: none;
    display: none;
}

.tunggakan-search-input::-ms-clear {
    display: none;
    width: 0;
    height: 0;
}

.tunggakan-search-clear {
    position: absolute;
    right: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.tunggakan-search-clear:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.tunggakan-siswa-card {
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.tunggakan-siswa-card:hover {
    box-shadow: var(--shadow-md);
}

.tunggakan-siswa-card:has(.collapse.show) .card-header {
    border-bottom-color: var(--border-color);
}

.quick-link-card {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.quick-link-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
    color: inherit;
}

.quick-link-card i { font-size: 1.75rem; flex-shrink: 0; }
.quick-link-card strong { display: block; font-size: 0.875rem; }
.quick-link-card small { color: var(--text-secondary); font-size: 0.75rem; }

/* ===== CARDS ===== */
.card-modern {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-modern.card-overflow-visible,
.card-modern.card-overflow-visible .card-body {
    overflow: visible;
}

.card-modern .card-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
}

.card-modern .card-title {
    font-size: 1rem;
    font-weight: 600;
}

/* ===== MODAL MODERN ===== */
.modal-modern .modal-content {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md, 0 8px 30px rgba(15, 23, 42, 0.12));
    overflow: hidden;
}

.modal-modern .modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
    align-items: flex-start;
}

.modal-modern .modal-header-text {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.modal-modern .modal-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.modal-modern .modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-modern .modal-subtitle {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.modal-modern .modal-body {
    padding: 1.25rem 1.5rem;
}

.modal-modern .modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    background: var(--body-bg);
}

/* ===== UPLOAD SISWA MODAL ===== */
.modal-upload-siswa .modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.15);
    overflow: hidden;
}

.modal-upload-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: #fff;
}

.modal-upload-header .modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-upload-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-upload-close {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #dc3545;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 0.875rem;
}

.btn-upload-close:hover {
    background: #bb2d3b;
    color: #fff;
}

.upload-dropzone {
    margin: 1.25rem;
    border: 2px dashed #c4a882;
    border-radius: 8px;
    background: #fafafa;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    min-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-dropzone:hover,
.upload-dropzone.is-dragover {
    border-color: #a08060;
    background: #fff8f0;
}

.upload-dropzone-inner {
    text-align: center;
    padding: 2rem 1rem;
    pointer-events: none;
}

.upload-dropzone-icon {
    font-size: 3rem;
    color: #adb5bd;
    display: block;
    margin-bottom: 0.75rem;
}

.upload-dropzone-text {
    color: #6c757d;
    font-size: 0.9375rem;
}

.upload-table-wrap {
    border-top: 1px solid var(--border-color);
    padding: 0 1rem 1rem;
}

.upload-file-table thead th {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 0.5rem;
    white-space: nowrap;
}

.upload-file-table tbody td {
    font-size: 0.8125rem;
    padding: 0.625rem 0.5rem;
    vertical-align: middle;
}

.upload-filename {
    font-weight: 500;
    word-break: break-all;
}

.upload-progress {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    min-width: 80px;
}

.upload-progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.modal-upload-footer {
    justify-content: flex-end;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border-color);
}

/* ===== MODULE GRID ===== */
.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.module-item {
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    text-align: center;
    transition: box-shadow 0.15s ease;
}

.module-item:hover { box-shadow: var(--shadow-md); }

.module-item i { font-size: 2rem; margin-bottom: 0.75rem; display: block; }
.module-item h6 { font-weight: 600; margin-bottom: 0.375rem; }
.module-item p { font-size: 0.8125rem; color: var(--text-secondary); margin-bottom: 0.75rem; }

.role-list .list-group-item { font-size: 0.875rem; padding: 0.75rem 1.25rem; }

.empty-state {
    text-align: center;
    color: var(--text-secondary);
}

.empty-state i { font-size: 2.5rem; opacity: 0.4; display: block; margin-bottom: 0.5rem; }

/* ===== DATA TABLES ===== */
.data-table thead th {
    background: var(--body-bg);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1.25rem;
}

.data-table tbody td {
    padding: 0.875rem 1.25rem;
    font-size: 0.875rem;
    vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }

/* ===== BACKUP / RESTORE (gaya RDM) ===== */
.backup-restore-panel {
    background: #fff;
    border: 1px solid #d8dde6;
    border-radius: 4px;
    box-shadow: none;
    overflow: hidden;
}

.backup-restore-panel .br-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem 1.5rem 1rem;
    border-bottom: 1px solid #e8ecf1;
}

.backup-restore-panel .br-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #2c3e6b;
    margin: 0;
    line-height: 1.2;
}

.backup-restore-panel .br-subtitle {
    font-size: 0.8125rem;
    color: #8a94a6;
    margin: 0.2rem 0 0;
}

.backup-restore-panel .br-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.btn-rdm {
    background: #337ab7;
    border: 1px solid #2e6da4;
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.45rem 0.85rem;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
}

.btn-rdm:hover,
.btn-rdm:focus {
    background: #286090;
    border-color: #204d74;
    color: #fff;
}

.backup-restore-panel .btn-rdm-outline {
    background: #fff;
    border: 1px solid #ccc;
    color: #555;
    font-size: 0.8125rem;
    padding: 0.45rem 0.65rem;
    border-radius: 4px;
}

.backup-restore-panel .br-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.5rem;
    font-size: 0.8125rem;
    color: #555;
}

.backup-restore-panel .br-toolbar select,
.backup-restore-panel .br-toolbar input {
    font-size: 0.8125rem;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 0.25rem 0.4rem;
    margin: 0 0.25rem;
}

.backup-restore-panel .br-toolbar input[type="search"] {
    min-width: 180px;
    padding: 0.3rem 0.5rem;
}

.backup-restore-panel .br-table-wrap {
    overflow-x: auto;
    border-top: 1px solid #e8ecf1;
}

.backup-restore-panel .br-table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.backup-restore-panel .br-table thead th {
    background: #fff;
    color: #2c3e6b;
    font-weight: 700;
    padding: 0.65rem 1rem;
    border-bottom: 2px solid #e8ecf1;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}

.backup-restore-panel .br-table thead th.br-sortable:hover {
    background: #f8f9fb;
}

.backup-restore-panel .br-table tbody td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid #eef1f5;
    vertical-align: middle;
    color: #333;
}

.backup-restore-panel .br-table tbody tr:hover td {
    background: #f9fafb;
}

.backup-restore-panel .br-table .br-name {
    color: #c7254e;
    font-family: Consolas, Monaco, monospace;
    font-size: 0.8rem;
}

.backup-restore-panel .br-empty td {
    text-align: center;
    color: #888;
    padding: 2rem 1rem !important;
    border-bottom: none !important;
}

.backup-restore-panel .br-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    border-top: 1px solid #e8ecf1;
    font-size: 0.8125rem;
    color: #555;
}

.backup-restore-panel .br-paginate {
    display: flex;
    gap: 0.35rem;
}

.backup-restore-panel .br-paginate button {
    background: none;
    border: none;
    color: #337ab7;
    font-size: 0.8125rem;
    padding: 0.15rem 0.35rem;
    cursor: pointer;
}

.backup-restore-panel .br-paginate button:disabled {
    color: #aaa;
    cursor: not-allowed;
}

.backup-restore-panel .btn-download-rdm {
    background: #5cb85c;
    border: 1px solid #4cae4c;
    color: #fff;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.backup-restore-panel .btn-download-rdm:hover {
    background: #449d44;
    color: #fff;
}

.backup-restore-panel .br-actions-cell {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.backup-restore-panel .btn-delete-rdm {
    background: #d9534f;
    border: 1px solid #d43f3a;
    color: #fff;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    cursor: pointer;
}

.backup-restore-panel .btn-delete-rdm:hover {
    background: #c9302c;
    border-color: #ac2925;
    color: #fff;
}

.modal-restore-rdm .upload-dropzone {
    min-height: 140px;
    cursor: pointer;
}

.modal-restore-rdm label.upload-dropzone {
    cursor: pointer;
}

.icon-gear-spin {
    display: inline-block;
    animation: gear-spin 2.5s linear infinite;
}

@keyframes gear-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Autocomplete siswa */
.siswa-autocomplete {
    position: relative;
}

.siswa-autocomplete-list {
    position: absolute;
    z-index: 1050;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 240px;
    overflow-y: auto;
    margin: 0.25rem 0 0;
    padding: 0;
    list-style: none;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

.siswa-autocomplete-item {
    padding: 0.55rem 0.85rem;
    cursor: pointer;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-color);
}

.siswa-autocomplete-item:last-child {
    border-bottom: none;
}

.siswa-autocomplete-item:hover,
.siswa-autocomplete-item.active {
    background: var(--primary-light);
}

.siswa-autocomplete-item strong {
    display: block;
    font-weight: 600;
}

.siswa-autocomplete-item span {
    font-size: 0.8125rem;
}

.siswa-autocomplete-empty {
    padding: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-align: center;
}

.siswa-ac-input.is-searching {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.25rem;
}

.siswa-ac-spinner {
    display: inline-block;
    width: 0.85rem;
    height: 0.85rem;
    margin-right: 0.35rem;
    border: 2px solid #cbd5e1;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: -0.1rem;
}

/* ===== AUTH PAGE (WAKAKUR-style split) ===== */
.auth-body {
    min-height: 100vh;
    margin: 0;
    background: #fff;
    overflow-x: hidden;
}

.auth-split {
    display: flex;
    min-height: 100vh;
}

/* —— Left: dark info panel —— */
.auth-info {
    flex: 1 1 55%;
    position: relative;
    background: #0b1220;
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.auth-info-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(148, 163, 184, 0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.07) 1px, transparent 1px);
    background-size: 32px 32px;
    pointer-events: none;
}

.auth-info-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
    padding: 3rem 3.5rem;
    max-width: 640px;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.auth-brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #2563eb;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    flex-shrink: 0;
}

.auth-brand-logo-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 8px;
}

.auth-brand-name {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #fff;
}

.auth-info-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #60a5fa;
    margin: 0 0 1.25rem;
}

.auth-info-title {
    font-size: clamp(1.75rem, 3vw, 2.25rem);
    font-weight: 700;
    color: #fff;
    line-height: 1.25;
    margin: 0 0 1rem;
}

.auth-info-desc {
    font-size: 0.9375rem;
    line-height: 1.65;
    color: #94a3b8;
    margin: 0 0 2rem;
    max-width: 520px;
}

.auth-features {
    list-style: none;
    padding: 0;
    margin: 0 0 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.auth-features li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #cbd5e1;
}

.auth-feature-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(37, 99, 235, 0.2);
    color: #60a5fa;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.875rem;
}

.auth-info-footer {
    margin-top: auto;
    font-size: 0.75rem;
    color: #64748b;
    padding-top: 2rem;
}

/* —— Right: login panel —— */
.auth-panel {
    flex: 1 1 45%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 2rem;
    background: #fff;
}

.auth-panel-inner {
    width: 100%;
    max-width: 400px;
}

.auth-school-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #eff6ff;
    color: #2563eb;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.4375rem 0.875rem;
    border-radius: 999px;
    margin-bottom: 1.5rem;
}

.auth-panel-header {
    margin-bottom: 1.5rem;
}

.auth-welcome {
    font-size: 1.75rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 0.375rem;
    line-height: 1.2;
}

.auth-subtitle {
    color: #64748b;
    font-size: 0.9375rem;
    margin: 0;
}

.auth-panel .alert {
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    border-radius: 10px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.125rem;
}

.auth-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.auth-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #334155;
}

.auth-field {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-field-icon {
    position: absolute;
    left: 0.875rem;
    color: #94a3b8;
    font-size: 1rem;
    pointer-events: none;
    z-index: 1;
}

.auth-input {
    width: 100%;
    height: 48px;
    padding: 0 2.75rem;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-family: inherit;
    color: #0f172a;
    background: #f1f5f9;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.auth-input:focus {
    outline: none;
    background: #fff;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.auth-input::placeholder {
    color: #94a3b8;
}

.auth-field-toggle {
    position: absolute;
    right: 0.625rem;
    background: none;
    border: none;
    color: #94a3b8;
    padding: 0.25rem 0.375rem;
    cursor: pointer;
    line-height: 1;
}

.auth-field-toggle:hover {
    color: #64748b;
}

.auth-meta-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.auth-form-group--inline {
    margin: 0;
}

.auth-select {
    width: 100%;
    height: 48px;
    padding: 0 0.75rem 0 2.75rem;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-family: inherit;
    color: #0f172a;
    background: #f1f5f9;
    appearance: none;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.auth-select:focus {
    outline: none;
    background: #fff;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.navbar-context-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--body-bg);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 0.375rem 0.875rem;
}

.navbar-context-btn:hover,
.navbar-context-btn:focus {
    color: var(--primary);
    background: var(--primary-light);
    border-color: #c7d2fe;
}

.navbar-context-sep {
    opacity: 0.5;
}

.navbar-context-menu {
    min-width: 240px;
}

.auth-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
    width: 100%;
    height: 48px;
    background: #2563eb;
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.auth-submit:hover {
    background: #1d4ed8;
    color: #fff;
}

.auth-panel-hint {
    margin: 1.25rem 0 0;
    font-size: 0.8125rem;
    color: #94a3b8;
    text-align: center;
    line-height: 1.5;
}

.auth-demo {
    margin-top: 1.5rem;
    text-align: center;
}

.auth-demo-label {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 0.5rem;
}

.auth-demo-pill {
    display: inline-block;
    font-size: 0.6875rem;
    padding: 0.25rem 0.625rem;
    background: #f1f5f9;
    color: #475569;
    border-radius: 999px;
    border: 1px solid #e2e8f0;
}

.demo-accounts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    justify-content: center;
}

.auth-version {
    margin-top: 1.5rem;
    font-size: 0.6875rem;
    color: #cbd5e1;
    text-align: center;
}

@media (max-width: 991.98px) {
    .auth-split {
        flex-direction: column;
    }

    .auth-info {
        flex: 0 0 auto;
    }

    .auth-info-inner {
        padding: 2rem 1.5rem;
        max-width: none;
    }

    .auth-info-title {
        font-size: 1.5rem;
    }

    .auth-info-desc,
    .auth-features {
        margin-bottom: 1.25rem;
    }

    .auth-info-footer {
        padding-top: 1rem;
    }

    .auth-panel {
        flex: 1;
        padding: 2rem 1.25rem 2.5rem;
    }
}

@media (max-width: 575.98px) {
    .auth-welcome {
        font-size: 1.5rem;
    }

    .auth-meta-row {
        grid-template-columns: 1fr;
    }
}

.btn-primary {
    --bs-btn-bg: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary-dark);
    --bs-btn-hover-border-color: var(--primary-dark);
    --bs-btn-active-bg: var(--primary-dark);
    --bs-btn-active-border-color: var(--primary-dark);
}

/* ===== ERROR PAGES ===== */
.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--body-bg);
    text-align: center;
    padding: 2rem;
}

.error-code {
    font-size: 5rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    display: block;
    opacity: 0.3;
}

.error-content h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0.5rem 0;
}

.error-content p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* ===== RESPONSIVE (desktop-first base — detail di app-mobile.css) ===== */
@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-sidebar.open { transform: translateX(0); }
    .sidebar-overlay.show { display: block; }
    .app-main {
        margin-left: 0;
        min-width: 0;
        width: 100%;
        max-width: 100%;
    }
}
