/*
 * Lapisan penyempurnaan tampilan panel Citra Edukasi.
 *
 * Dimuat SETELAH CSS hasil build (resources/css/app.css), lihat resources/views/app.blade.php.
 * File statis: boleh diubah langsung tanpa `npm run build`. Isinya:
 *   1. efek saat kartu disentuh / disorot,
 *   2. kartu bergambar (kategori, mata pelajaran, materi) yang seragam,
 *   3. ukuran kartu, tabel, dan kontrol yang lebih ringkas di layar laptop,
 *   4. formulir filter di halaman daftar,
 *   5. kartu baris tabel dan filter yang lebih ringkas di HP,
 *   6. mode ujian layar penuh (pasangan assets/js/ce-exam-focus.js),
 *   7. halaman tes dan rapor: tabel informasi, judul kartu, tabel nilai, grafik (pasangan assets/js/ce-ui.js),
 *   8. layar mengerjakan soal: kepala kartu, teks soal, pilihan jawaban, navigasi nomor.
 *
 * Soal urutan: gaya milik sebuah halaman (blok <style> di file .vue) dimuat belakangan, jadi tetap menang
 * atas aturan umum di sini, sama seperti terhadap app.css. Aturan yang memang harus mengalahkan gaya halaman
 * (kelas .ce-kpis, .ce-sd-*, .ce-dash-*, .ce-program-card) diawali `body`.
 */

:root {
    --ce-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
    --ce-line-hover: #c9d5fb;
    --ce-shadow-hover: 0 18px 34px -22px rgba(7, 20, 82, 0.5), 0 2px 6px rgba(15, 23, 42, 0.05);
}

/* ==================================================================== 1. efek sentuh & sorot */

/* Kartu wadah (berisi tabel, formulir, dst.): cukup bayangan dan garis yang menguat, tanpa bergerak. */
.page-content .card {
    transition: box-shadow 0.22s var(--ce-ease), border-color 0.22s ease, transform 0.22s var(--ce-ease);
}

/* Ubin (statistik, program, tindakan) dan kartu bergambar: terangkat sedikit. */
.ce-stat,
body .ce-program-card,
body .ce-sd-program,
.ce-action {
    transition: transform 0.18s var(--ce-ease), box-shadow 0.18s var(--ce-ease), border-color 0.18s ease, background-color 0.18s ease;
    -webkit-tap-highlight-color: transparent;
}
.ce-stat .ce-stat-icon,
.ce-action .ce-action-count,
.ce-avatar {
    transition: transform 0.22s var(--ce-ease);
}

/* Kilau lembut di sudut ubin statistik saat disorot. */
.ce-stat::after {
    content: '';
    position: absolute;
    right: -34px;
    bottom: -46px;
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(23, 61, 181, 0.13), transparent 70%);
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.page-content .card:has(.card-img, .card-img-top) { overflow: hidden; }
.card .card-img,
.card .card-img-top {
    transition: transform 0.4s var(--ce-ease);
}

.ce-list-row {
    margin-inline: -10px;
    padding-inline: 10px;
    border-radius: 12px;
    transition: background-color 0.15s ease;
}

.table > tbody > tr > * { transition: background-color 0.15s ease, box-shadow 0.15s ease; }
.sidebar-wrapper .metismenu a { transition: background-color 0.18s ease, color 0.18s ease; }
.btn-primary, .btn-warning, .btn-success, .btn-danger, .btn-dark {
    transition: transform 0.15s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

/* Hanya untuk perangkat yang benar-benar punya kursor: di layar sentuh, :hover "menempel" setelah diketuk. */
@media (hover: hover) and (pointer: fine) {
    .page-content .card:hover {
        border-color: #d4dcf3;
        box-shadow: var(--ce-shadow);
    }

    .ce-stat:hover,
    body .ce-program-card:hover,
    body .ce-sd-program:hover,
    .page-content .card:has(.card-img, .card-img-top):hover,
    .page-content a:hover > .card {
        transform: translateY(-3px);
        border-color: var(--ce-line-hover);
        box-shadow: var(--ce-shadow-hover);
    }
    .ce-stat:hover::after { opacity: 1; }
    .ce-stat:hover .ce-stat-icon { transform: scale(1.07) rotate(-4deg); }
    .ce-action:hover { transform: translateX(3px); }
    .ce-action:hover .ce-action-count,
    .ce-list-row:hover .ce-avatar { transform: scale(1.06); }
    .card:hover .card-img,
    .card:hover .card-img-top { transform: scale(1.045); }

    .ce-list-row:hover { background: var(--ce-surface-2); }
    .page-content .table > tbody > tr:hover > * { --bs-table-accent-bg: var(--bs-table-hover-bg); }

    .sidebar-wrapper .metismenu a:hover .parent-icon { background: rgba(255, 255, 255, 0.14); }
    .btn-primary:hover { box-shadow: 0 10px 20px -12px rgba(23, 61, 181, 0.85); }
    .btn-warning:hover { box-shadow: 0 10px 20px -12px rgba(247, 181, 41, 0.9); }
    .btn-success:hover { box-shadow: 0 10px 20px -12px rgba(4, 120, 87, 0.8); }
    .btn-danger:hover { box-shadow: 0 10px 20px -12px rgba(240, 41, 56, 0.8); }
}

/* Umpan balik saat ditekan (kursor maupun jari). */
a.ce-stat:active,
a:active > .ce-stat,
body .ce-program-card:active,
body .ce-sd-program:active,
a.ce-action:active,
.page-content .card:has(.card-img, .card-img-top):active {
    transform: scale(0.985);
    border-color: var(--ce-line-hover);
    transition-duration: 0.08s;
}

:is(a.ce-stat, a.ce-action, .ce-program-card, .ce-sd-program):focus-visible {
    outline: 0;
    box-shadow: 0 0 0 4px rgba(23, 61, 181, 0.22);
}

@media (prefers-reduced-motion: reduce) {
    .page-content .card,
    .ce-stat,
    .ce-stat .ce-stat-icon,
    body .ce-program-card,
    body .ce-sd-program,
    .ce-action,
    .card .card-img,
    .card .card-img-top { transition: none !important; transform: none !important; }
}

/* ==================================================================== 2. kartu bergambar (kategori, mata pelajaran, materi) */

/* Gambar satu rasio supaya semua kartu dalam satu baris sama tinggi; teks keterangan tidak lagi setebal judul. */
.page-content .card > .p-2:has(> .card-img) {
    margin: 10px 10px 0;
    padding: 0 !important;
    border-radius: 12px;
    overflow: hidden;
    background: var(--ce-surface-2);
}
.page-content .card .card-img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-radius: 0;
}
.page-content .card:has(> .p-2 > .card-img) {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.page-content .card:has(> .p-2 > .card-img) > .card-header {
    display: block;
    min-height: 0 !important; /* beberapa halaman memasang min-height 120px langsung di elemennya */
    padding: 12px 14px 2px;
    border-bottom: 0;
}
.page-content .card:has(> .p-2 > .card-img) .card-title {
    margin-bottom: 4px;
    font-size: 15.5px;
    font-weight: 800;
    line-height: 1.3;
}
.page-content .card:has(> .p-2 > .card-img) .card-text {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    max-height: 4.5em; /* 3 baris; menjaga batas saat keterangan berisi beberapa paragraf */
    margin-bottom: 0;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
    color: var(--ce-muted);
}
.page-content .card:has(> .p-2 > .card-img) .card-text :is(p, div) { margin: 0; }
.page-content .card:has(> .p-2 > .card-img) > .card-body {
    flex: 0 0 auto;
    margin-top: auto;
    padding: 12px 14px 14px;
}
.page-content .row:has(> [class*='col-'] > .card > .p-2 > .card-img) { row-gap: 18px; }

/* Kartu bergambar mendatar (kategori tryout): aslinya menempel satu sama lain tanpa jarak antarbaris. */
.page-content .row:has(> [class*='col-'] > .card > .row > [class*='col-'] > .card-img) { row-gap: 16px; }
.page-content .row > [class*='col-'] > .card:has(> .row > [class*='col-'] > .card-img) { height: 100%; }

/* ==================================================================== 3. ukuran lebih ringkas di layar laptop / desktop */

@media (min-width: 1025px) {
    :root {
        --ce-sidebar-w: 240px;
        --ce-topbar-h: 62px;
        --ce-radius: 18px;
        --ce-radius-md: 14px;
    }

    body { font-size: 14.5px; }
    h1, .h1 { font-size: 24px; }
    h2, .h2 { font-size: 20.5px; }
    h3, .h3 { font-size: 18px; }
    h4, .h4 { font-size: 17px; }
    h5, .h5 { font-size: 15.5px; }

    /* kerangka */
    .page-content { padding: 22px 24px 20px; }
    .ce-page-header { margin-bottom: 18px; }
    .ce-page-heading { font-size: 23px; }
    .page-breadcrumb { margin-bottom: 16px !important; }
    .page-breadcrumb .breadcrumb-title { font-size: 18.5px; }
    .topbar .navbar { padding-left: 20px; }

    /* sidebar */
    .sidebar-wrapper .metismenu { padding: 8px 10px 80px; }
    .sidebar-wrapper .metismenu a { padding: 7px 10px; font-size: 13.5px; }
    .sidebar-wrapper .metismenu a .parent-icon { width: 30px; height: 30px; font-size: 17px; border-radius: 9px; }
    .sidebar-wrapper .metismenu ul a { padding: 6px 10px; font-size: 13px; }
    .sidebar-wrapper .metismenu .menu-label { padding: 14px 12px 4px; }
    .ce-menu-search { margin: 12px 10px 0; }
    .ce-menu-search input { height: 36px; font-size: 13px; }
    .ce-sidebar-user { padding: 11px 12px; border-radius: 14px; }
    .ce-brand img { width: 34px; height: 34px; border-radius: 10px; }

    /* kartu */
    .card + .card, .row + .card, .card + .row { margin-top: 16px; }
    .card-header { padding: 13px 18px; font-size: 15.5px; }
    .card-body { padding: 18px; }
    .ce-hero { padding: 20px 24px; }
    .ce-empty { padding: 28px 16px; }
    .ce-empty i { font-size: 36px; margin-bottom: 6px; }

    /* ubin statistik */
    .ce-stat { padding: 14px 16px; }
    .ce-stat .ce-stat-icon { width: 40px; height: 40px; font-size: 20px; border-radius: 12px; }
    .ce-stat .ce-stat-value { font-size: 24px; }
    .ce-stat .ce-stat-label { font-size: 12.5px; }
    .ce-stat .ce-stat-sub { font-size: 12px; }
    .ce-bstat { gap: 12px; }
    .ce-bstat .ce-stat-value { font-size: 20px; }
    .ce-bstat .ce-stat-label { white-space: normal; line-height: 1.25; }
    /* Dashboard Bimbel: empat ubin per baris (aslinya baru empat di layar ≥ 1200 px, tanpa menghitung sidebar). */
    .row > .col-6.col-xl-3:has(.ce-bstat) { width: 25%; }

    /* Kelas di bawah ini didefinisikan di gaya halaman dashboard, jadi perlu `body` agar menang.
       Empat ubin muat sebaris di layar laptop; tidak ada lagi satu ubin yang turun sendirian. */
    body .ce-kpis { grid-template-columns: repeat(auto-fit, minmax(176px, 1fr)); gap: 14px; margin-bottom: 18px; }
    /* Enam ubin ringkas: 3 + 3 di laptop, enam sebaris di layar lebar (bukan 4 + 2). */
    body .ce-kpis-compact { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-top: 18px; }
    body .ce-kpi { gap: 6px; }
    body .ce-sd-tiles { grid-template-columns: repeat(auto-fit, minmax(172px, 1fr)); gap: 14px; }
    body .ce-sd-tile { gap: 12px; }
    body .ce-sd-tile .ce-stat-value { font-size: 22px; }
    body .ce-sd-top, body .ce-sd-grid, body .ce-dash-grid { gap: 18px; }
    body .ce-dash-side { gap: 18px; }
    body .ce-sd > section, body .ce-sd > .ce-sd-grid, body .ce-sd-top { margin-bottom: 18px; }
    body .ce-dash-hero { gap: 14px; margin-bottom: 18px; }
    body .ce-dash-hero h2, body .ce-sd-next h2 { font-size: 21px; }
    body .ce-program-card, body .ce-sd-program { padding: 12px 14px; }

    /* tabel */
    .table { font-size: 14px; }
    .table > :not(caption) > * > * { padding: 0.6rem 0.8rem; }
    .table > thead th, .table thead.table-light th, .table-light th { font-size: 11.5px; }
    .table .badge { font-size: 11.5px; padding: 0.36em 0.72em; }
    .table .btn-sm { min-height: 30px; padding: 0.2rem 0.6rem; font-size: 12.5px; border-radius: 9px; }
    .pagination .page-link { padding: 0.32rem 0.72rem; font-size: 13px; }

    /* tombol & isian */
    .btn { min-height: 38px; padding: 0.42rem 0.95rem; font-size: 13.5px; }
    .btn.w-100 { padding-left: 0.2rem; padding-right: 0.2rem; }
    .btn-sm { min-height: 32px; padding: 0.26rem 0.7rem; font-size: 12.5px; }
    .btn-lg { min-height: 46px; font-size: 15px; }
    .form-control, .form-select, .input-group-text, .multiselect__tags { min-height: 40px; font-size: 14px; }
    .form-control-sm, .form-select-sm { min-height: 34px; font-size: 13px; }
    textarea.form-control { min-height: 84px; }
}

/* ==================================================================== 4. formulir filter di halaman daftar */

/* Label filter satu baris, kontrol rapat, tombol Filter/Reset berdampingan. */
.page-content .card form > .row > [class*='col-'] > label:not(.form-label):not(.form-check-label) {
    display: block;
    margin-bottom: 4px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--ce-mute-fg);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.page-content .card form > .row > [class*='col-'] > label + br { display: none; }
.page-content .card form > .row > [class*='col-'] > .input-group:has(> .btn) { flex-wrap: nowrap; }
.page-content .card form > .row > [class*='col-'] > .input-group > .btn { white-space: nowrap; }
/* Grup yang hanya berisi tombol (Filter + Reset): tombol berbagi lebar. Bila ada kotak isian, kotaknya yang melebar. */
.page-content .card form > .row > [class*='col-'] > .input-group:not(:has(> .form-control, > .form-select)) > .btn { flex: 1 1 auto; }

/* Di desktop kolom filter berbagi lebar secara lentur; kolom tombol selebar isinya, jadi tidak keluar dari kartu. */
@media (min-width: 992px) {
    .page-content .card form > .row:has(> [class*='col-'] > :is(.form-control-sm, .form-select-sm)) { --bs-gutter-x: 0.85rem; }
    .page-content .card form > .row:has(> [class*='col-'] > :is(.form-control-sm, .form-select-sm)) > [class*='col-'] {
        flex: 1 1 120px;
        width: auto;
        max-width: none;
        min-width: 0;
    }
    .page-content .card form > .row:has(> [class*='col-'] > :is(.form-control-sm, .form-select-sm)) > [class*='col-']:has(> .input-group > .btn) {
        flex: 0 0 auto;
    }
}

/* ==================================================================== 5. HP: kartu baris tabel & filter lebih ringkas */

@media (max-width: 767.98px) {
    /* Setiap baris tabel tampil sebagai kartu (lihat resources/css/app.css). Jarak antarsel dirapatkan
       supaya satu kartu tidak memakan lebih dari separuh layar. */
    :is(.table-responsive:not(.ce-keep), .page-content :not(.table-responsive):not(.ce-keep)) > .table:not(.ce-keep) > tbody > tr {
        margin-bottom: 8px;
        padding: 3px 12px;
        border-radius: 14px;
        transition: border-color 0.15s ease, background-color 0.15s ease;
    }
    :is(.table-responsive:not(.ce-keep), .page-content :not(.table-responsive):not(.ce-keep)) > .table:not(.ce-keep) > tbody > tr:active {
        border-color: var(--ce-line-hover);
        background: #fbfcff;
    }
    :is(.table-responsive:not(.ce-keep), .page-content :not(.table-responsive):not(.ce-keep)) > .table:not(.ce-keep) > tbody > tr > td {
        gap: 10px;
        padding: 6px 0 !important;
        font-size: 13.5px;
        line-height: 1.35;
        border-bottom-style: solid !important;
    }
    :is(.table-responsive:not(.ce-keep), .page-content :not(.table-responsive):not(.ce-keep)) > .table:not(.ce-keep) > tbody > tr > td[data-label]::before {
        font-size: 11.5px;
        font-weight: 600;
    }
    :is(.table-responsive:not(.ce-keep), .page-content :not(.table-responsive):not(.ce-keep)) > .table:not(.ce-keep) > tbody > tr > td .badge {
        font-size: 11px;
        padding: 0.3em 0.65em;
    }
    :is(.table-responsive:not(.ce-keep), .page-content :not(.table-responsive):not(.ce-keep)) > .table:not(.ce-keep) > tbody > tr > td .btn-sm {
        min-height: 32px;
        padding: 0.2rem 0.6rem;
        font-size: 12.5px;
    }

    /* Filter: dua kolom, sehingga tidak menghabiskan satu layar penuh sebelum daftar terlihat. */
    .page-content .card form > .row > [class*='col-']:has(> .form-control-sm, > .form-select-sm) {
        flex: 0 0 50%;
        max-width: 50%;
    }
    /* Kolom tombol mengisi sisa baris: di samping isian terakhir bila jumlah isian ganjil, selebar kartu bila genap. */
    .page-content .card form > .row:has(> [class*='col-'] > :is(.form-control-sm, .form-select-sm)) > [class*='col-']:has(> .input-group > .btn) {
        flex: 1 1 50%;
        max-width: 100%;
        width: auto;
        min-width: 0;
    }
    .page-content .card form > .row > [class*='col-'] > .input-group > .btn { min-width: 0; padding-inline: 0.45rem; }
    .page-content .card form > .row { --bs-gutter-x: 0.75rem; }
    .page-content .card form > .row > [class*='col-'] > .form-control-sm,
    .page-content .card form > .row > [class*='col-'] > .form-select-sm { min-height: 38px; }

    /* Kartu bergambar: dua per baris di HP (aslinya satu kartu selebar layar, sekitar 360 px tingginya). */
    .page-content .row:has(> [class*='col-'] > .card > .p-2 > .card-img) { --bs-gutter-x: 0.75rem; row-gap: 12px; }
    .page-content .row:has(> [class*='col-'] > .card > .p-2 > .card-img) > [class*='col-'] { flex: 0 0 50%; max-width: 50%; }
    .page-content .card > .p-2:has(> .card-img) { margin: 8px 8px 0; border-radius: 10px; }
    .page-content .card:has(> .p-2 > .card-img) > .card-header { padding: 10px 10px 2px; }
    .page-content .card:has(> .p-2 > .card-img) .card-title { font-size: 14px; }
    .page-content .card:has(> .p-2 > .card-img) .card-text { -webkit-line-clamp: 2; max-height: 2.8em; font-size: 12px; line-height: 1.4; }
    .page-content .card:has(> .p-2 > .card-img) > .card-body { padding: 10px; }
    .page-content .card:has(> .p-2 > .card-img) > .card-body .btn { min-height: 34px; font-size: 12.5px; }
}

/* ==================================================================== 6. mode ujian layar penuh (assets/js/ce-exam-focus.js) */

/* Selama layar penuh, layar soal hanya berisi soal: tautan Home/Logout disembunyikan seperti di CAT asli.
   Tekan Esc untuk keluar dari layar penuh; tautan itu muncul kembali. */
html.ce-exam-fs .navbar.fixed-top .navbar-nav,
html.ce-exam-fs .navbar.fixed-top .navbar-toggler { display: none !important; }
html.ce-exam-fs .navbar.fixed-top .navbar-brand { pointer-events: none; }

/* Tombol untuk masuk (lagi) ke layar penuh; hanya tampil di layar soal saat belum layar penuh. */
.ce-exam-fs-btn {
    position: fixed;
    top: 10px;
    left: 50%;
    z-index: 1040;
    display: none;
    align-items: center;
    gap: 7px;
    padding: 7px 16px;
    border: 0;
    border-radius: 999px;
    background: #071452;
    color: #fff;
    font: 700 13px/1.2 'Plus Jakarta Sans', system-ui, sans-serif;
    box-shadow: 0 10px 22px -12px rgba(7, 20, 82, 0.7);
    transform: translateX(-50%);
    transition: background-color 0.18s ease, transform 0.18s var(--ce-ease);
    cursor: pointer;
}
.ce-exam-fs-btn i { font-size: 17px; color: #ffc233; }
.ce-exam-fs-btn:hover { background: #0d2291; transform: translateX(-50%) translateY(-1px); }
.ce-exam-fs-btn:active { transform: translateX(-50%) scale(0.97); }
.ce-exam-fs-btn:focus-visible { outline: 3px solid #ffc233; outline-offset: 2px; }
html.ce-exam:not(.ce-exam-fs) .ce-exam-fs-btn { display: inline-flex; }

@media (prefers-reduced-motion: reduce) {
    .ce-exam-fs-btn { transition: none; }
}

/* ==================================================================== tabel Pendaftaran Bimbel (admin) */

/* Templat admin memaksa semua tabel satu baris (.table-responsive { white-space: nowrap }), sehingga daftar
   pendaftar melebar sampai ±1.670 px dan harus digeser ke kanan. Di laptop/tablet teks dibiarkan turun baris dan
   kolom dipadatkan; di HP tabel tetap memakai tampilan bawaan. Hanya tabel yang memuat tautan detail pendaftar. */
@media (min-width: 768px) {
    .table-responsive:has(a[href^="/admin/registrations/"]) { white-space: normal; }
    .table-responsive:has(a[href^="/admin/registrations/"]) > .table > :not(caption) > * > * { padding-left: 0.6rem; padding-right: 0.6rem; }
    .table-responsive:has(a[href^="/admin/registrations/"]) > .table > tbody > tr > td { overflow-wrap: anywhere; line-height: 1.35; }
    .table-responsive:has(a[href^="/admin/registrations/"]) > .table > tbody > tr > td:nth-child(2) { min-width: 150px; }
    .table-responsive:has(a[href^="/admin/registrations/"]) > .table > tbody > tr > td:nth-child(3) { min-width: 150px; max-width: 280px; }
    /* tanggal masuk boleh dua baris (tanggal / jam) */
    .table-responsive:has(a[href^="/admin/registrations/"]) > .table > tbody > tr > td:nth-child(5) { white-space: normal !important; min-width: 92px; }
    .table-responsive:has(a[href^="/admin/registrations/"]) > .table > tbody > tr > td:nth-child(6) { min-width: 100px; max-width: 170px; }
    .table-responsive:has(a[href^="/admin/registrations/"]) > .table > tbody > tr > td:nth-child(6) .small { overflow-wrap: anywhere; }
}
@media (min-width: 768px) and (max-width: 1199.98px) {
    .table-responsive:has(a[href^="/admin/registrations/"]) > .table { font-size: 13px; }
    .table-responsive:has(a[href^="/admin/registrations/"]) > .table > :not(caption) > * > * { padding-left: 0.4rem; padding-right: 0.4rem; }
    .table-responsive:has(a[href^="/admin/registrations/"]) > .table > tbody > tr > td:nth-child(2),
    .table-responsive:has(a[href^="/admin/registrations/"]) > .table > tbody > tr > td:nth-child(3) { min-width: 125px; }
    .table-responsive:has(a[href^="/admin/registrations/"]) > .table > tbody > tr > td:nth-child(5) { min-width: 80px; }
    .table-responsive:has(a[href^="/admin/registrations/"]) > .table > tbody > tr > td:nth-child(6) { min-width: 90px; }
}

/* ==================================================================== 7. halaman tes dan rapor */

/* 7a. Tabel informasi "Label : Isi" (ditandai assets/js/ce-ui.js dengan .ce-kv): daftar dua kolom yang tenang.
       Di HP tiap baris tetap satu baris (label di kiri, isi di kanan), bukan satu kartu per baris. */
.page-content table.table.ce-kv { width: 100%; margin: 0; border: 0; --bs-table-bg: transparent; --bs-table-striped-bg: transparent; --bs-table-hover-bg: transparent; }
.page-content table.table.ce-kv > tbody > tr { border-width: 0; }
.page-content table.table.ce-kv > tbody > tr > * {
    padding: 11px 6px;
    border: 0;
    border-bottom: 1px solid var(--ce-line-soft);
    background: transparent;
    box-shadow: none;
    vertical-align: top;
    text-align: left;
    white-space: normal;
}
.page-content table.table.ce-kv > tbody > tr > :first-child { width: 34%; min-width: 132px; font-size: 13.5px; font-weight: 600; color: var(--ce-muted); }
.page-content table.table.ce-kv > tbody > tr > :last-child { font-weight: 600; color: var(--ce-text); overflow-wrap: anywhere; }
.page-content table.table.ce-kv > tbody > tr > .ce-kv-sep { display: none; }
/* Baris pengisi kosong memisahkan kelompok baris (mis. tiap ujian di halaman tryout): jadi jeda tipis, bukan kotak kosong. */
.page-content table.table.ce-kv > tbody > tr.ce-kv-kosong > * { height: 14px; padding: 0; border-bottom: 0; font-size: 0; line-height: 0; }
.page-content table.table.ce-kv > tbody > tr:has(+ tr.ce-kv-kosong) > * { border-bottom: 0; }
.page-content table.table.ce-kv > tbody > tr.ce-kv-kosong:is(:first-child, :last-child) { display: none; }
.page-content table.table.ce-kv > tbody > tr:last-child > *,
.page-content table.table.ce-kv > tbody > tr.ce-kv-aksi > * { border-bottom: 0; }
.page-content table.table.ce-kv > tbody > tr.ce-kv-aksi > :last-child { padding-top: 14px; }
/* Baris judul bagian (satu sel selebar tabel, mis. "Informasi Peserta"): judul kecil rata kiri. */
.page-content table.table.ce-kv > tbody > tr:not(.ce-kv-kosong) > [colspan]:only-child {
    width: auto;
    padding-top: 16px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-align: left;
    color: var(--ce-blue);
    background: transparent;
}
/* Sel isi yang berisi tombol: tombol berjajar dengan jarak tetap. Formulir pembantu yang hanya berisi isian
   tersembunyi (mis. untuk cetak PDF) tidak mengambil tempat. */
.page-content table.table.ce-kv > tbody > tr > :last-child:has(> .btn, > form) { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.page-content table.table.ce-kv > tbody > tr > :last-child:has(> .btn, > form) > :is(.btn, form) { margin: 0 !important; }
.page-content table.table.ce-kv > tbody > tr > :last-child form:not(:has(button, .btn, select, textarea, input:not([type='hidden']))) { display: none; }
/* Tombol yang aslinya mengambang di kanan atas tabel informasi: jadi baris sendiri supaya tidak menimpa isinya. */
.page-content .card-body > .btn.float-end:has(+ table.ce-kv) { float: none !important; display: table; margin: 0 0 6px auto; }

@media (max-width: 767.98px) {
    .page-content table.table.ce-kv,
    .page-content table.table.ce-kv > tbody { display: block; width: 100%; }
    .page-content table.table.ce-kv > tbody > tr { display: flex; align-items: baseline; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--ce-line-soft); }
    .page-content table.table.ce-kv > tbody > tr:last-child { border-bottom: 0; }
    .page-content table.table.ce-kv > tbody > tr > * { display: block; padding: 0; border: 0; }
    .page-content table.table.ce-kv > tbody > tr > :first-child { flex: 0 0 40%; width: auto; min-width: 0; font-size: 12.5px; line-height: 1.4; }
    .page-content table.table.ce-kv > tbody > tr > :last-child { flex: 1 1 0; min-width: 0; text-align: right; font-size: 14px; line-height: 1.4; }
    .page-content table.table.ce-kv > tbody > tr > :last-child:has(> .btn, > form) { justify-content: flex-end; }
    .page-content table.table.ce-kv > tbody > tr.ce-kv-kosong { display: block; height: 8px; margin: 4px -16px; padding: 0; border-bottom: 0; background: var(--ce-bg); }
    .page-content table.table.ce-kv > tbody > tr.ce-kv-kosong > * { display: none; }
    .page-content table.table.ce-kv > tbody > tr.ce-kv-kosong:is(:first-child, :last-child) { display: none; }
    .page-content table.table.ce-kv > tbody > tr:has(+ tr.ce-kv-kosong) { border-bottom: 0; }
    .page-content table.table.ce-kv > tbody > tr.ce-kv-aksi { padding-top: 14px; border-bottom: 0; }
    .page-content table.table.ce-kv > tbody > tr:not(.ce-kv-kosong) > [colspan]:only-child { flex: 1 1 100%; padding-top: 6px; font-size: 11.5px; text-align: left; }
    .page-content table.table.ce-kv > tbody > tr.ce-kv-aksi > :first-child { display: none; }
    .page-content table.table.ce-kv > tbody > tr.ce-kv-aksi > :last-child { padding-top: 0; }
}

/* 7b. Judul kartu: putih dengan teks gelap di semua kartu (aslinya sebagian biru terang), dan tombol buka-tutup
       berupa lingkaran kecil yang kalem (aslinya kotak merah). */
.page-content .card > .card-header.bg-primary { background: var(--ce-surface) !important; border-bottom: 1px solid var(--ce-line-soft); }
.page-content .card > .card-header.bg-primary,
.page-content .card > .card-header.bg-primary :is(h4, h5, h6, .card-title) { color: var(--ce-text) !important; }
.page-content .card > .card-header > :is(h4, h5, h6)[data-bs-toggle='collapse'] { display: flow-root; padding-block: 6px; line-height: 20px; cursor: pointer; }
.page-content .card > .card-header > :is(h4, h5, h6)[data-bs-toggle='collapse'] > .float-end { margin: -6px 0 -6px 12px; }
.page-content .card > .card-header i.btn.bx {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--ce-line) !important;
    border-radius: 50%;
    background: var(--ce-surface-2) !important;
    color: var(--ce-navy) !important;
    font-size: 18px;
    line-height: 1;
    box-shadow: none !important;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.page-content .card > .card-header i.btn.bx:hover { border-color: var(--ce-line-hover) !important; background: var(--ce-blue-soft) !important; }

/* 7c. Tabel nilai: baris jumlah (TOTAL SKOR, KONVERSI NILAI AKHIR) diberi latar lembut supaya terbaca sebagai ringkasan. */
.page-content .table > tbody > tr:has(> th[colspan]) > th { background: var(--ce-surface-2); font-weight: 800; color: var(--ce-text); }

@media (max-width: 767.98px) {
    /* Kolom nomor (judulnya ditulis "NO") tidak berguna saat baris tampil sebagai kartu. */
    :is(.table-responsive:not(.ce-keep), .page-content :not(.table-responsive):not(.ce-keep)) > .table:not(.ce-keep) > tbody > tr > td[data-label='NO'] { display: none !important; }
    /* Sel nilai yang ditulis sebagai <th> (mis. kolom NILAI di peringkat) tampil seperti sel lain: "Label ... isi". */
    :is(.table-responsive:not(.ce-keep), .page-content :not(.table-responsive):not(.ce-keep)) > .table:not(.ce-keep) > tbody > tr:not(:has(> th[colspan])) > th[data-label] {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 6px 0 !important;
        border: 0 !important;
        background: transparent !important;
        font-size: 14.5px;
        font-weight: 800;
        text-align: right;
    }
    :is(.table-responsive:not(.ce-keep), .page-content :not(.table-responsive):not(.ce-keep)) > .table:not(.ce-keep) > tbody > tr:not(:has(> th[colspan])) > th[data-label]::before {
        content: attr(data-label);
        font-size: 11.5px;
        font-weight: 600;
        color: var(--ce-muted);
        text-align: left;
    }
    /* Baris tanpa sel (sisa kondisi "data tidak tersedia") tidak digambar sebagai kartu kosong. */
    :is(.table-responsive:not(.ce-keep), .page-content :not(.table-responsive):not(.ce-keep)) > .table:not(.ce-keep) > tbody > tr:not(:has(> td, > th)) { display: none; }
    /* Baris jumlah: satu kartu ringkas "judul ... angka". */
    :is(.table-responsive:not(.ce-keep), .page-content :not(.table-responsive):not(.ce-keep)) > .table:not(.ce-keep) > tbody > tr:has(> th[colspan]) {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 12px 14px;
        border-color: transparent;
        background: var(--ce-blue-soft);
    }
    :is(.table-responsive:not(.ce-keep), .page-content :not(.table-responsive):not(.ce-keep)) > .table:not(.ce-keep) > tbody > tr:has(> th[colspan]) > th {
        display: block;
        padding: 0 !important;
        border: 0 !important;
        background: transparent !important;
        font-size: 13.5px;
        text-align: left;
    }
    :is(.table-responsive:not(.ce-keep), .page-content :not(.table-responsive):not(.ce-keep)) > .table:not(.ce-keep) > tbody > tr:has(> th[colspan]) > th:last-child { font-size: 16px; text-align: right; }

    /* 7d. Grafik per kolom: bila kolomnya banyak, label sumbu bawah ditampilkan tiap lima supaya tidak bertumpuk. */
    .page-content .apexcharts-xaxis-texts-g:has(> text:nth-child(21)) > text:not(:first-child):not(:nth-child(5n)) { display: none; }
}

/* 7e. Petunjuk dan deskripsi (isi penyunting teks) memakai huruf aplikasi, bukan huruf bawaan penyunting. */
.page-content .ck-content,
.page-content .ck-content :is(p, li, span, div, td, th, strong, em, b, i) { font-family: inherit !important; }
.page-content .ck-content { font-size: 14.5px; line-height: 1.65; color: var(--ce-text); }
.page-content .ck-content > :last-child { margin-bottom: 0; }

/* 7f. Daftar latihan dan tryout (.list-group): tiap butir jadi kartu membulat dengan jarak, bukan kotak bersudut tajam. */
.page-content .list-group > .list-group-item.border {
    margin-bottom: 10px !important;
    padding: 12px 16px !important;
    border: 1px solid var(--ce-line) !important;
    border-radius: var(--ce-radius-sm) !important;
    background: var(--ce-surface);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.page-content .list-group > .list-group-item.border:last-child { margin-bottom: 0 !important; }
@media (hover: hover) and (pointer: fine) {
    .page-content .list-group > .list-group-item.border:hover { border-color: var(--ce-line-hover) !important; box-shadow: var(--ce-shadow-hover); }
}

/* 7g. Gambar yang gagal dimuat (ditandai ce-ui.js): latar lembut, bukan ikon gambar pecah dan teks pengganti. */
.page-content img.ce-img-rusak { visibility: hidden; }
.page-content :has(> img.ce-img-rusak) { min-height: 96px; border-radius: 10px; background: linear-gradient(135deg, var(--ce-blue-soft), var(--ce-surface-2)); }

@media (max-width: 767.98px) {
    /* 7h. Kartu baris tabel: lebar sel tidak lagi mengikuti atribut width milik tabel aslinya (isian jadi sempit),
           dan isian formulir mengisi sisa baris di samping labelnya. */
    :is(.table-responsive:not(.ce-keep), .page-content :not(.table-responsive):not(.ce-keep)) > .table:not(.ce-keep) > tbody > tr > :is(td, th) { width: auto; }
    :is(.table-responsive:not(.ce-keep), .page-content :not(.table-responsive):not(.ce-keep)) > .table:not(.ce-keep) > tbody > tr > td[data-label]::before { white-space: nowrap; }
    :is(.table-responsive:not(.ce-keep), .page-content :not(.table-responsive):not(.ce-keep)) > .table:not(.ce-keep) > tbody > tr > td[data-label] > :is(input:not([type='checkbox']):not([type='radio']):not([type='file']), select, textarea, .input-group) { flex: 1 1 auto; min-width: 0; max-width: 64%; min-height: 38px; }

    /* 7i. Tabel daftar tanpa judul kolom (ditandai .ce-list): satu baris ringkas "nomor | isi | tombol". */
    .page-content table.table.ce-list,
    .page-content table.table.ce-list > tbody { display: block; width: 100%; }
    .page-content table.table.ce-list > tbody > tr { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--ce-line-soft); }
    .page-content table.table.ce-list > tbody > tr:last-child { border-bottom: 0; }
    .page-content table.table.ce-list > tbody > tr > * { display: block; width: auto; padding: 0; border: 0; background: transparent; text-align: left; white-space: normal; }
    .page-content table.table.ce-list > tbody > tr > :first-child:not(:only-child) { flex: none; min-width: 18px; font-size: 12.5px; font-weight: 700; color: var(--ce-muted); text-align: center; }
    .page-content table.table.ce-list > tbody > tr > :nth-child(2) { flex: 1 1 0; min-width: 0; overflow-wrap: anywhere; }
    .page-content table.table.ce-list > tbody > tr > :nth-child(2) .badge { white-space: normal; text-align: left; line-height: 1.35; }
    .page-content table.table.ce-list > tbody > tr > :last-child:not(:nth-child(2)) { flex: none; }
    .page-content table.table.ce-list > tbody > tr > :only-child { flex: 1 1 100%; text-align: center; color: var(--ce-muted); }
    .page-content table.table.ce-list .btn { white-space: nowrap; }

    /* 7j. Sel kartu berisi teks + keterangan kecil di bawahnya (mis. nama hak akses + kodenya, nama + asal sekolah):
           label di kiri, isi dan keterangannya bertumpuk di kanan, tanpa memotong kata di tengah. */
    :is(.table-responsive:not(.ce-keep), .page-content :not(.table-responsive):not(.ce-keep)) > .table:not(.ce-keep) > tbody > tr > td[data-label]:has(> div.small) {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        column-gap: 12px;
        row-gap: 2px;
        align-items: start;
        text-align: right;
        overflow-wrap: break-word;
    }
    :is(.table-responsive:not(.ce-keep), .page-content :not(.table-responsive):not(.ce-keep)) > .table:not(.ce-keep) > tbody > tr > td[data-label]:has(> div.small) > div.small {
        grid-column: 2;
        max-width: none !important;
        font-weight: 500;
        white-space: normal;
        overflow-wrap: anywhere;
    }
}

/* ==================================================================== 8. layar mengerjakan soal (#questionExam) */

/* Kepala kartu soal dan navigasi: navy merek, bukan biru terang. */
#questionExam .card > .card-header.bg-primary { background: var(--ce-navy) !important; border-bottom: 0; }
#questionExam .card > .card-header.bg-primary :is(h4, h5) { letter-spacing: 0; }
#questionExam .card { overflow: hidden; }

/* Teks soal dan pilihan memakai huruf aplikasi; rata kiri supaya jarak antarkata tidak renggang di layar sempit. */
#questionExam .ck-content,
#questionExam .ck-content :is(p, li, span, div, td, th, strong, em, b, i) { font-family: inherit !important; }
#questionExam .ck-content { line-height: 1.65; color: var(--ce-text); }
#questionExam .ck-content,
#questionExam .ck-content :is(p, li, div) { text-align: left !important; }

/* Pilihan jawaban: tiap pilihan satu baris berbingkai yang bisa diketuk di mana saja; yang dipilih disorot hijau. */
#questionExam .card-body > div > table { width: 100%; margin-top: 14px; border-collapse: separate; border-spacing: 0; }
#questionExam .card-body > div > table > tbody > tr {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    padding: 8px 12px;
    border: 1px solid var(--ce-line);
    border-radius: 14px;
    background: var(--ce-surface);
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}
#questionExam .card-body > div > table > tbody > tr:has(> td > .btn-success) { border-color: #7fd0b0; background: var(--ce-ok-bg); }
#questionExam .card-body > div > table > tbody > tr > td { padding: 0 !important; width: auto; }
#questionExam .card-body > div > table > tbody > tr > td:first-child { flex: 0 0 40px; width: 40px; }
#questionExam .card-body > div > table > tbody > tr > td:last-child { flex: 1 1 0; min-width: 0; }
#questionExam .card-body > div > table > tbody > tr > td:first-child > .btn { display: grid; place-items: center; width: 40px !important; height: 40px; padding: 0; border-radius: 12px; font-weight: 800; }
#questionExam .card-body > div > table > tbody > tr > td:last-child > :is(p, .ck-content) { margin: 0; font-size: 15px; line-height: 1.5; }
#questionExam .card-body > div > table > tbody > tr > td:last-child .ck-content > :last-child { margin-bottom: 0; }
@media (hover: hover) and (pointer: fine) {
    #questionExam .card-body > div > table > tbody > tr:hover { border-color: var(--ce-line-hover); background: #fbfcff; }
    #questionExam .card-body > div > table > tbody > tr:has(> td > .btn-success):hover { background: var(--ce-ok-bg); }
}

/* Gambar di soal, pilihan, dan pembahasan: tidak pernah lebih lebar dari kartunya. Penyaring HTML di layar peserta
   membuang max-width dari atribut style gambar, sehingga gambar lebar (denah, deret gambar) terpotong di HP.
   Tinggi yang ditulis langsung di gambar (mis. 80 px pada kecermatan) tetap berlaku. */
.ck-content img { max-width: 100%; height: auto; }

/* Tabel di dalam soal (mis. kunci tes kecermatan 5 gambar/karakter): selalu muat selebar kartu di HP.
   Aslinya 5 gambar x 80 px + jarak sel melebar ~460 px dan terpotong di layar 390 px. */
#questionExam .ck-content figure.table { max-width: 100%; margin-left: auto; margin-right: auto; }
#questionExam .ck-content figure.table img { max-width: 100%; height: auto !important; }
@media (max-width: 575.98px) {
    #questionExam .ck-content figure.table table { width: 100%; table-layout: fixed; }
    #questionExam .ck-content figure.table td { padding: 6px 2px !important; }
    #questionExam .ck-content figure.table span[style*='font-size: 72px'] { font-size: 44px !important; line-height: 1.2; }
}

/* Navigasi nomor: di HP tingginya mengikuti isi (aslinya 480 px, menyisakan ruang kosong panjang). */
@media (max-width: 991.98px) {
    #questionExam .card-body[style*='height: 480px'] { height: auto !important; max-height: 264px; }
}
#questionExam .card-body[style*='height: 480px'] .btn { min-height: 38px; border-radius: 10px; }

/* Bilah atas layar soal: tombol Logout tampil sebagai tautan biasa, bukan tombol berbingkai. */
html.ce-exam .navbar .navbar-nav button.nav-link { border: 0; background: transparent; }
