/* Dark mode bersama: login + halaman dalam */
html[data-theme="dark"] {
    color-scheme: dark;
    --bs-body-bg: #0d1522;
    --bs-body-color: #e6edf7;
    --bs-emphasis-color: #f4f7fb;
    --bs-secondary-color: #9aabc2;
    --bs-tertiary-color: #7f90a8;
    --bs-card-bg: #162033;
    --bs-card-color: #e6edf7;
    --bs-border-color: #2a364c;
    --bs-secondary-bg: #1b2638;
    --bs-tertiary-bg: #121b2b;
}
html[data-theme="dark"] body {
    background-color: #0d1522 !important;
    color: #e6edf7;
}
html[data-theme="dark"] .login-form-section {
    background: #121a28 !important;
    color: #e6edf7;
}
html[data-theme="dark"] .login-box h3,
html[data-theme="dark"] .login-box .fw-bold { color: #f4f7fb; }
html[data-theme="dark"] .text-dark { color: #e6edf7 !important; }
html[data-theme="dark"] .text-muted,
html[data-theme="dark"] .text-secondary { color: #9aabc2 !important; }
html[data-theme="dark"] .bg-white,
html[data-theme="dark"] .bg-light { background-color: #162033 !important; color: #e6edf7 !important; }
html[data-theme="dark"] .card,
html[data-theme="dark"] .siswa-card,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .offcanvas,
html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .list-group-item,
html[data-theme="dark"] .accordion-item,
html[data-theme="dark"] .accordion-button,
html[data-theme="dark"] .content-wrapper,
html[data-theme="dark"] .main {
    background-color: #162033 !important;
    color: #e6edf7 !important;
    border-color: #2a364c !important;
}
html[data-theme="dark"] .card-header,
html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer {
    background-color: #121b2b !important;
    color: #e6edf7 !important;
    border-color: #2a364c !important;
}
html[data-theme="dark"] .table { color: #e6edf7; --bs-table-bg: transparent; --bs-table-color: #e6edf7; }
html[data-theme="dark"] .table th,
html[data-theme="dark"] .table thead th {
    background-color: #1c283c !important;
    color: #d5deea !important;
    border-color: #2a364c !important;
}
html[data-theme="dark"] .table td { border-color: #2a364c !important; }
html[data-theme="dark"] .table-hover tbody tr:hover { background-color: #1c283c !important; color: #fff; }
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="password"],
html[data-theme="dark"] input[type="date"],
html[data-theme="dark"] input[type="number"],
html[data-theme="dark"] input[type="search"],
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
    background-color: #1b2638 !important;
    color: #e6edf7 !important;
    border-color: #314158 !important;
}
html[data-theme="dark"] .form-control::placeholder { color: #7f90a8; }
html[data-theme="dark"] .btn-light,
html[data-theme="dark"] .btn-outline-secondary {
    background: #243044;
    color: #e6edf7;
    border-color: #314158;
}
html[data-theme="dark"] .alert-light { background: #1b2638; color: #e6edf7; }
html[data-theme="dark"] hr { border-color: #2a364c; opacity: 1; }
html[data-theme="dark"] .sidebar { background: #0c1422 !important; }

#themeToggle {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 5000;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,.18);
    background: rgba(15, 23, 36, .82);
    color: #f3d48a;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 20px rgba(0,0,0,.25);
}
html[data-theme="light"] #themeToggle,
html:not([data-theme="dark"]) #themeToggle {
    background: #fff;
    color: #1e293b;
    border-color: #d7dee8;
}

/* Kartu dan panel yang masih putih di banyak halaman */
html[data-theme="dark"] body {
    color: #e6edf7 !important;
}
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .card:not([class*="bg-"]):not([class*="text-bg-"]),
html[data-theme="dark"] .card-custom,
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .lp-wrap,
html[data-theme="dark"] .rekap-box,
html[data-theme="dark"] .list-siswa-container,
html[data-theme="dark"] .list-siswa-box,
html[data-theme="dark"] .checkbox-group,
html[data-theme="dark"] .bg-white,
html[data-theme="dark"] .content,
html[data-theme="dark"] .container.bg-white {
    background-color: #162033 !important;
    color: #e6edf7 !important;
    border-color: #2a364c !important;
}
html[data-theme="dark"] .lp-item,
html[data-theme="dark"] .stat-icon {
    border-color: transparent !important;
}
html[data-theme="dark"] .lp-item {
    background: #1c283c !important;
    color: #e6edf7 !important;
    border-color: #2a364c !important;
}
html[data-theme="dark"] .lp-title,
html[data-theme="dark"] .stat-data h3,
html[data-theme="dark"] .card-custom .card-header,
html[data-theme="dark"] .card-header:not([class*="bg-"]) {
    color: #e6edf7 !important;
    background-color: transparent;
}
html[data-theme="dark"] .lp-item small,
html[data-theme="dark"] .stat-data p,
html[data-theme="dark"] .text-muted,
html[data-theme="dark"] .section-header {
    color: #9aabc2 !important;
}
html[data-theme="dark"] .section-header::after {
    background: #2a364c !important;
}
html[data-theme="dark"] .table,
html[data-theme="dark"] .table td,
html[data-theme="dark"] .table th {
    color: #e6edf7 !important;
}
html[data-theme="dark"] .table thead,
html[data-theme="dark"] .table thead th,
html[data-theme="dark"] .table th {
    background-color: #1c283c !important;
    color: #c5d2e4 !important;
    border-color: #2a364c !important;
}
html[data-theme="dark"] .table td {
    background-color: transparent !important;
    border-color: #2a364c !important;
}
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] .form-control:focus {
    background-color: #1b2638 !important;
    color: #e6edf7 !important;
    border-color: #314158 !important;
}
html[data-theme="dark"] .icon-blue { background: rgba(67,97,238,.18) !important; color: #93a8ff !important; }
html[data-theme="dark"] .icon-green { background: rgba(16,185,129,.16) !important; color: #6ee7b7 !important; }
html[data-theme="dark"] .icon-red { background: rgba(239,68,68,.16) !important; color: #fca5a5 !important; }
html[data-theme="dark"] .icon-yellow { background: rgba(245,158,11,.16) !important; color: #fcd34d !important; }
html[data-theme="dark"] .sl-modal,
html[data-theme="dark"] .sl-modal .sl-body .card {
    background: rgba(18, 26, 40, .92) !important;
    color: #e6edf7 !important;
}
html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] .bg-primary,
html[data-theme="dark"] .bg-danger,
html[data-theme="dark"] .bg-success,
html[data-theme="dark"] .bg-warning,
html[data-theme="dark"] .text-white,
html[data-theme="dark"] .card-header.bg-danger {
    color: #fff !important;
}

@media (max-width: 767.98px) {
    #themeToggle { top: 10px; right: 10px; z-index: 4500; }
}
@media (min-width: 768px) {
    .sidebar { left: 0 !important; visibility: visible !important; }
    .mobile-nav-toggle { display: none !important; }
}


/* Kontras teks mode gelap di semua halaman, termasuk kelas Tailwind */
html[data-theme="dark"] body {
    background-color: #0d1522 !important;
    color: #e8eef7 !important;
}
html[data-theme="dark"] [class*="text-gray-"],
html[data-theme="dark"] [class*="text-slate-"],
html[data-theme="dark"] [class*="text-zinc-"],
html[data-theme="dark"] [class*="text-neutral-"],
html[data-theme="dark"] [class*="text-stone-"],
html[data-theme="dark"] .text-dark,
html[data-theme="dark"] .text-black,
html[data-theme="dark"] .text-body,
html[data-theme="dark"] .link-dark,
html[data-theme="dark"] .text-secondary {
    color: #e8eef7 !important;
}
html[data-theme="dark"] .text-white,
html[data-theme="dark"] .text-light,
html[data-theme="dark"] thead .text-white,
html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] .btn-success,
html[data-theme="dark"] .btn-danger,
html[data-theme="dark"] .btn-warning,
html[data-theme="dark"] .btn-info,
html[data-theme="dark"] .badge.bg-primary,
html[data-theme="dark"] .badge.bg-success,
html[data-theme="dark"] .badge.bg-danger,
html[data-theme="dark"] .badge.bg-warning,
html[data-theme="dark"] .bg-blue-600,
html[data-theme="dark"] .bg-blue-500,
html[data-theme="dark"] [class*="bg-blue-6"],
html[data-theme="dark"] [class*="bg-green-6"],
html[data-theme="dark"] [class*="bg-red-6"],
html[data-theme="dark"] [class*="bg-indigo-6"] {
    color: #fff !important;
}
html[data-theme="dark"] [class*="bg-white"],
html[data-theme="dark"] [class*="bg-gray-50"],
html[data-theme="dark"] [class*="bg-gray-100"],
html[data-theme="dark"] [class*="bg-gray-200"],
html[data-theme="dark"] [class*="bg-slate-50"],
html[data-theme="dark"] [class*="bg-slate-100"],
html[data-theme="dark"] [class*="bg-slate-200"],
html[data-theme="dark"] .bg-light,
html[data-theme="dark"] .bg-body,
html[data-theme="dark"] .table-light,
html[data-theme="dark"] .list-group-item {
    background-color: #162033 !important;
    color: #e8eef7 !important;
}
html[data-theme="dark"] table tbody tr:hover,
html[data-theme="dark"] .table-hover tbody tr:hover {
    background-color: #1e2b40 !important;
    color: #e8eef7 !important;
}
html[data-theme="dark"] table,
html[data-theme="dark"] th,
html[data-theme="dark"] td,
html[data-theme="dark"] .border,
html[data-theme="dark"] .border-b,
html[data-theme="dark"] .border-t,
html[data-theme="dark"] .border-bottom,
html[data-theme="dark"] [class*="border-gray-"],
html[data-theme="dark"] [class*="border-slate-"] {
    border-color: #2a364c !important;
}
html[data-theme="dark"] thead,
html[data-theme="dark"] thead th,
html[data-theme="dark"] .bg-blue-600,
html[data-theme="dark"] [class*="bg-blue-6"] {
    background-color: #2563eb !important;
    color: #fff !important;
    border-color: #1d4ed8 !important;
}
html[data-theme="dark"] .badge-ip,
html[data-theme="dark"] .bg-blue-100,
html[data-theme="dark"] [class*="bg-blue-100"],
html[data-theme="dark"] [class*="bg-indigo-100"],
html[data-theme="dark"] [class*="bg-green-100"],
html[data-theme="dark"] [class*="bg-red-100"],
html[data-theme="dark"] [class*="bg-yellow-100"],
html[data-theme="dark"] [class*="bg-purple-100"] {
    background-color: #243044 !important;
    color: #dbe7ff !important;
}
html[data-theme="dark"] .text-blue-600,
html[data-theme="dark"] .text-primary,
html[data-theme="dark"] a:not(.btn):not(.menu-link):not([class*="bg-"]) {
    color: #93c5fd;
}
html[data-theme="dark"] .menu-link { color: #c5d0e0; }
html[data-theme="dark"] .menu-link.active,
html[data-theme="dark"] .menu-link.active i { color: #fff !important; }
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select {
    background-color: #1b2638 !important;
    color: #e8eef7 !important;
    border-color: #314158 !important;
}
html[data-theme="dark"] ::placeholder { color: #93a0b5 !important; }

html[data-theme="dark"] .page-title,
html[data-theme="dark"] .content-wrapper h1,
html[data-theme="dark"] .content-wrapper h2,
html[data-theme="dark"] .content-wrapper h3,
html[data-theme="dark"] .content-wrapper h4,
html[data-theme="dark"] .content-wrapper h5,
html[data-theme="dark"] .main h3,
html[data-theme="dark"] .main h4,
html[data-theme="dark"] .fw-bold.text-dark {
    color: #f4f7fb !important;
}
html[data-theme="dark"] .card-custom,
html[data-theme="dark"] .card-header-custom,
html[data-theme="dark"] .card-body {
    background: #162033 !important;
    color: #e6edf7 !important;
    border-color: #2a364c !important;
}
html[data-theme="dark"] .card-header-custom h5,
html[data-theme="dark"] .card-header-custom .text-secondary,
html[data-theme="dark"] .text-secondary {
    color: #d7e2f0 !important;
}
html[data-theme="dark"] .table td,
html[data-theme="dark"] .table th {
    color: #e6edf7;
}
@media (max-width: 767.98px) {
    .content-wrapper, .main { padding-top: 64px !important; }
    td.kosong-tabel { display: block; width: calc(100vw - 36px); max-width: 100%; }
}
