/*
 * modern.css — SMPN 2 Kuta Utara
 * Redesign total seluruh UI. Load terakhir setelah style.css.
 * Mencakup: Layout, Sidebar, Topbar, Cards, Tables, Forms,
 * Buttons, Badges, Modals, Alerts, Dashboard, Pagination,
 * Input Groups, Tabs, Stats, dan semua komponen halaman.
 */

/* ============================================================
   1. DESIGN TOKENS
   ============================================================ */
:root {
    /* Brand */
    --brand:         #1565C0;
    --brand-dark:    #0D47A1;
    --brand-light:   #1E88E5;
    --brand-soft:    #E3F0FC;
    --brand-muted:   #BBDEFB;
    --gold:          #F9A825;
    --gold-soft:     #FFF8E1;

    /* Grays */
    --gray-50:  #F8FAFC;
    --gray-100: #F1F5F9;
    --gray-200: #E2E8F0;
    --gray-300: #CBD5E1;
    --gray-400: #94A3B8;
    --gray-500: #64748B;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1E293B;
    --gray-900: #0F172A;

    /* Status */
    --green:        #1B873B; --green-soft:   #E7F6EE;
    --amber:        #B45309; --amber-soft:   #FFF7ED;
    --red:          #DC2626; --red-soft:     #FEF2F2;
    --blue:         #1565C0; --blue-soft:    #EBF5FF;
    --purple:       #6D28D9; --purple-soft:  #F3EFFF;
    --teal:         #0891B2; --teal-soft:    #ECFEFF;

    /* Status badges */
    --s-hadir:           #1B873B; --s-hadir-bg:        #E7F6EE;
    --s-izin:            #B45309; --s-izin-bg:         #FFF7ED;
    --s-sakit:           #1565C0; --s-sakit-bg:        #EBF5FF;
    --s-alpha:           #DC2626; --s-alpha-bg:        #FEF2F2;
    --s-menunggu:        #B45309; --s-menunggu-bg:     #FFF7ED;
    --s-diverifikasi:    #1B873B; --s-diverifikasi-bg: #E7F6EE;
    --s-ditolak:         #DC2626; --s-ditolak-bg:      #FEF2F2;

    /* Compat with old var names */
    --brand-primary:      var(--brand);
    --brand-primary-soft: var(--brand-soft);
    --brand-cyan-bg:      var(--teal-soft);
    --status-hadir:       var(--s-hadir);    --status-hadir-bg:    var(--s-hadir-bg);
    --status-izin:        var(--s-izin);     --status-izin-bg:     var(--s-izin-bg);
    --status-sakit:       var(--s-sakit);    --status-sakit-bg:    var(--s-sakit-bg);
    --status-alpha:       var(--s-alpha);    --status-alpha-bg:    var(--s-alpha-bg);
    --status-menunggu:    var(--s-menunggu); --status-menunggu-bg: var(--s-menunggu-bg);

    /* Layout */
    --sidebar-w:     256px;
    --sidebar-w-col:  72px;
    --topbar-h:       60px;

    /* Radii */
    --r-xs:  4px;
    --r-sm:  8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 20px;
    --r-2xl:24px;
    --r-pill:999px;

    /* Shadows */
    --s-xs: 0 1px 2px rgba(15,23,42,.06);
    --s-sm: 0 2px 8px rgba(15,23,42,.08);
    --s-md: 0 4px 16px rgba(15,23,42,.10);
    --s-lg: 0 10px 32px rgba(15,23,42,.14);
    --s-xl: 0 20px 50px rgba(15,23,42,.18);

    /* Motion */
    --ease: cubic-bezier(.4,0,.2,1);
    --dur:  .2s;
    --t:    var(--dur) var(--ease);
}

/* ============================================================
   2. BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; scroll-behavior: smooth; }

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    background: var(--gray-100) !important;
    color: var(--gray-900) !important;
    font-size: 14px !important;
    line-height: 1.55 !important;
    -webkit-font-smoothing: antialiased;
    margin: 0;
}

a { transition: color var(--t); }
img { max-width: 100%; }
::selection { background: var(--brand-soft); color: var(--brand-dark); }

/* ============================================================
   3. APP SHELL
   ============================================================ */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ============================================================
   4. SIDEBAR
   ============================================================ */
.app-sidebar {
    width: var(--sidebar-w);
    background: var(--gray-900);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 1050;
    transition: width var(--t), transform var(--t);
    overflow: hidden;
    flex-shrink: 0;
}

/* Collapsed (desktop) */
body.sidebar-collapsed .app-sidebar       { width: var(--sidebar-w-col); }
body.sidebar-collapsed .sidebar-brand__text,
body.sidebar-collapsed .sidebar-user__info,
body.sidebar-collapsed .nav-item__label,
body.sidebar-collapsed .nav-group__arrow,
body.sidebar-collapsed .nav-section-label,
body.sidebar-collapsed .sidebar-footer span { opacity: 0; width: 0; overflow: hidden; white-space: nowrap; }
body.sidebar-collapsed .nav-group__children { display: none !important; }
body.sidebar-collapsed .app-main { margin-left: var(--sidebar-w-col); }

/* ── Sidebar Header ── */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 16px 16px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    text-decoration: none !important;
    min-width: 0;
}

.sidebar-brand__logo {
    width: 34px; height: 34px; flex-shrink: 0;
    border-radius: var(--r-sm);
    object-fit: contain;
    background: rgba(255,255,255,.08);
    padding: 3px;
}

.sidebar-brand__text {
    display: flex; flex-direction: column; line-height: 1.15;
    overflow: hidden;
    transition: opacity var(--t), width var(--t);
}
.sidebar-brand__name { font-size: 15px; font-weight: 800; color: #fff; white-space: nowrap; }
.sidebar-brand__sub  { font-size: 10px; font-weight: 600; color: rgba(255,255,255,.4); text-transform: uppercase; letter-spacing: .8px; white-space: nowrap; }

.sidebar-toggle {
    width: 28px; height: 28px;
    border: none; background: rgba(255,255,255,.06); border-radius: var(--r-xs);
    color: rgba(255,255,255,.5); cursor: pointer;
    display: none; align-items: center; justify-content: center;
    font-size: 14px; transition: var(--t); flex-shrink: 0;
}
.sidebar-toggle:hover { background: rgba(255,255,255,.12); color: #fff; }

/* ── Sidebar User ── */
.sidebar-user {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    flex-shrink: 0;
}

.sidebar-user__avatar { position: relative; width: 36px; height: 36px; flex-shrink: 0; }
.sidebar-user__avatar img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,.15); }
.sidebar-user__dot { position: absolute; bottom: 1px; right: 1px; width: 8px; height: 8px; background: var(--green); border: 1.5px solid var(--gray-900); border-radius: 50%; }

.sidebar-user__info { min-width: 0; overflow: hidden; transition: opacity var(--t), width var(--t); }
.sidebar-user__name { display: block; font-size: 13px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user__role { display: block; font-size: 10px; font-weight: 600; color: rgba(255,255,255,.4); text-transform: uppercase; letter-spacing: .6px; }

/* ── Sidebar Nav ── */
.sidebar-nav {
    flex: 1; overflow-y: auto; overflow-x: hidden;
    padding: 12px 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.08) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 2px; }

.nav-section-label {
    font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 1.2px;
    color: rgba(255,255,255,.25); padding: 8px 8px 4px; white-space: nowrap;
    transition: opacity var(--t);
}

.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: var(--r-sm);
    text-decoration: none !important;
    color: rgba(255,255,255,.62) !important;
    font-size: 13px; font-weight: 600; margin-bottom: 2px;
    transition: background var(--t), color var(--t); white-space: nowrap;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: rgba(255,255,255,.92) !important; }
.nav-item.active { background: var(--brand-soft) !important; color: var(--brand) !important; }
.nav-item.active .nav-item__icon { color: var(--brand); }

.nav-item__icon { width: 20px; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; color: rgba(255,255,255,.4); transition: color var(--t); }
.nav-item:hover .nav-item__icon { color: rgba(255,255,255,.8); }
.nav-item__label { overflow: hidden; text-overflow: ellipsis; flex: 1; }

.nav-group { margin-bottom: 2px; }
.nav-group__trigger {
    width: 100%; display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: var(--r-sm);
    background: none; border: none; color: rgba(255,255,255,.62);
    font-size: 13px; font-weight: 600; font-family: inherit;
    cursor: pointer; text-align: left; white-space: nowrap;
    transition: background var(--t), color var(--t);
}
.nav-group__trigger:hover { background: rgba(255,255,255,.07); color: rgba(255,255,255,.92); }
.nav-group.open > .nav-group__trigger { color: rgba(255,255,255,.9); }

.nav-group__arrow { margin-left: auto; font-size: 10px; opacity: .4; transition: transform var(--t); flex-shrink: 0; }
.nav-group.open > .nav-group__trigger .nav-group__arrow { transform: rotate(90deg); opacity: .7; }

.nav-group__children { display: none; padding: 2px 0 4px 30px; }

.nav-child {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: var(--r-xs);
    text-decoration: none !important; color: rgba(255,255,255,.5) !important;
    font-size: 12.5px; font-weight: 500; margin-bottom: 1px; white-space: nowrap;
    transition: background var(--t), color var(--t);
}
.nav-child:hover { background: rgba(255,255,255,.06); color: rgba(255,255,255,.85) !important; }
.nav-child.active { color: var(--brand-light) !important; font-weight: 700; }
.nav-child__dot { width: 5px; height: 5px; border-radius: 50%; background: rgba(255,255,255,.2); flex-shrink: 0; transition: background var(--t); }
.nav-child.active .nav-child__dot { background: var(--brand-light); }
.nav-child:hover .nav-child__dot { background: rgba(255,255,255,.5); }

/* ── Sidebar Footer ── */
.app-sidebar .sidebar-footer { position: static; z-index: auto; background: transparent; box-shadow: none; padding: 10px 8px; border-top: 1px solid rgba(255,255,255,.06); flex-shrink: 0; }
.sidebar-logout {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: var(--r-sm);
    text-decoration: none !important; color: rgba(255,255,255,.45) !important;
    font-size: 13px; font-weight: 600; white-space: nowrap;
    transition: background var(--t), color var(--t);
}
.sidebar-logout:hover { background: rgba(220,38,38,.15); color: #FC8181 !important; }
.sidebar-logout i { font-size: 14px; flex-shrink: 0; }

.sidebar-backdrop {
    display: none; position: fixed; inset: 0;
    background: rgba(15,23,42,.5); backdrop-filter: blur(2px); z-index: 1049;
}
.sidebar-backdrop.active { display: block; }

/* ============================================================
   5. APP MAIN
   ============================================================ */
.app-main {
    flex: 1; min-width: 0; margin-left: var(--sidebar-w);
    display: flex; flex-direction: column;
    min-height: 100vh; transition: margin-left var(--t);
}
.app-content { min-width: 0; }

/* ============================================================
   6. TOPBAR
   ============================================================ */
.app-topbar {
    height: var(--topbar-h); background: #fff;
    border-bottom: 1px solid var(--gray-200);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px; gap: 12px;
    position: sticky; top: 0; z-index: 1040;
    box-shadow: var(--s-xs);
}

.topbar-left  { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 6px; }

.topbar-hamburger {
    width: 38px; height: 38px;
    border: 1.5px solid var(--gray-200); background: var(--gray-50);
    border-radius: var(--r-sm); display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 4px;
    cursor: pointer; transition: var(--t); flex-shrink: 0;
}
.topbar-hamburger span { display: block; width: 16px; height: 2px; background: var(--gray-600); border-radius: 2px; transition: var(--t); }
.topbar-hamburger:hover { background: var(--brand-soft); border-color: var(--brand-muted); }
.topbar-hamburger:hover span { background: var(--brand); }

.topbar-breadcrumb { display: flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 500; }
.topbar-breadcrumb__item { color: var(--gray-500); }
.topbar-breadcrumb__item.active { color: var(--gray-900); font-weight: 700; }
.topbar-breadcrumb__item a { color: var(--brand-light); text-decoration: none; }
.topbar-breadcrumb__item a:hover { text-decoration: underline; }
.topbar-breadcrumb__sep { color: var(--gray-300); font-size: 14px; }

.topbar-action {
    width: 38px; height: 38px;
    border: 1.5px solid var(--gray-200); background: var(--gray-50);
    border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--gray-500); transition: var(--t);
}
.topbar-action:hover { background: var(--brand-soft); border-color: var(--brand-muted); color: var(--brand); }

.topbar-user__btn {
    display: flex; align-items: center; gap: 8px; padding: 5px 10px;
    border: 1.5px solid var(--gray-200); background: var(--gray-50);
    border-radius: var(--r-md); cursor: pointer; transition: var(--t);
}
.topbar-user__btn:hover,
.topbar-user.show .topbar-user__btn { background: var(--brand-soft); border-color: var(--brand-muted); }

.topbar-user__avatar { width: 30px; height: 30px; border-radius: 50%; overflow: hidden; flex-shrink: 0; border: 1.5px solid var(--gray-200); }
.topbar-user__avatar img { width: 100%; height: 100%; object-fit: cover; }
.topbar-user__info { flex-direction: column; align-items: flex-start; }
.topbar-user__name { display: block; font-size: 12.5px; font-weight: 700; color: var(--gray-900); line-height: 1.2; white-space: nowrap; }
.topbar-user__role { display: block; font-size: 10px; font-weight: 600; color: var(--gray-400); line-height: 1.2; white-space: nowrap; }
.topbar-user__caret { font-size: 9px; color: var(--gray-400); transition: transform var(--t); }
.topbar-user.show .topbar-user__caret { transform: rotate(180deg); }

.topbar-dropdown { min-width: 240px !important; border: 1px solid var(--gray-200) !important; border-radius: var(--r-xl) !important; box-shadow: var(--s-xl) !important; padding: 8px !important; margin-top: 8px !important; }
.topbar-dropdown__profile { display: flex; align-items: center; gap: 12px; padding: 10px 8px 12px; }
.topbar-dropdown__avatar { position: relative; width: 46px; height: 46px; flex-shrink: 0; }
.topbar-dropdown__avatar img { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; border: 2px solid var(--gray-200); }
.topbar-dropdown__online { position: absolute; bottom: 2px; right: 2px; width: 10px; height: 10px; background: var(--green); border: 2px solid #fff; border-radius: 50%; }
.topbar-dropdown__name { font-size: 14px; font-weight: 800; color: var(--gray-900); margin-bottom: 2px; }
.topbar-dropdown__role { font-size: 11px; color: var(--gray-400); font-weight: 600; }
.topbar-dropdown__divider { height: 1px; background: var(--gray-100); margin: 4px 0; }
.topbar-dropdown__item {
    display: flex !important; align-items: center !important; gap: 9px !important;
    padding: 10px 12px !important; border-radius: var(--r-sm) !important;
    font-size: 13px !important; font-weight: 600 !important; color: var(--gray-700) !important;
    text-decoration: none !important; transition: var(--t) !important; cursor: pointer;
}
.topbar-dropdown__item:hover { background: var(--gray-100) !important; }
.topbar-dropdown__item--danger { color: var(--red) !important; }
.topbar-dropdown__item--danger:hover { background: var(--red-soft) !important; }

/* ============================================================
   7. PAGE CONTENT
   ============================================================ */
.app-content {
    flex: 1; padding: 24px 24px 32px;
    animation: pageIn .2s ease;
}
@keyframes pageIn { from { opacity: .8; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.page-title-bar { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.page-title-bar__title { font-size: 20px !important; font-weight: 800 !important; color: var(--gray-900) !important; margin: 0 0 4px !important; line-height: 1.2; }

/* ============================================================
   8. BREADCRUMB
   ============================================================ */
.breadcrumb { background: none !important; padding: 0 !important; margin: 0 !important; font-size: 12px !important; }
.breadcrumb-item { font-weight: 500 !important; }
.breadcrumb-item a { color: var(--brand-light) !important; text-decoration: none !important; }
.breadcrumb-item a:hover { text-decoration: underline !important; }
.breadcrumb-item.active { color: var(--gray-400) !important; }
.breadcrumb-item + .breadcrumb-item::before { content: '›' !important; color: var(--gray-300) !important; }

/* ============================================================
   9. CARDS
   ============================================================ */
.card {
    border: none !important;
    border-radius: var(--r-lg) !important;
    box-shadow: var(--s-sm) !important;
    background: #fff !important;
    transition: box-shadow var(--t) !important;
    overflow: hidden;
}
.card:hover { box-shadow: var(--s-md) !important; }

.card-header {
    background: #fff !important;
    border-bottom: 1px solid var(--gray-100) !important;
    padding: 16px 20px !important;
    border-radius: var(--r-lg) var(--r-lg) 0 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: wrap;
    gap: 8px;
}
.card-header h5,
.card-header h6,
.card-header .card-title,
.card-header .fw-bold {
    font-size: 14px !important;
    font-weight: 800 !important;
    color: var(--gray-900) !important;
    margin: 0 !important;
}
.card-body    { padding: 20px !important; }
.card-footer  { background: #fff !important; border-top: 1px solid var(--gray-100) !important; padding: 14px 20px !important; }

/* ============================================================
   10. TABLES
   ============================================================ */
.table { font-size: 13px !important; color: var(--gray-700) !important; margin: 0 !important; }

.table thead th,
.table thead td {
    font-size: 10.5px !important;
    font-weight: 800 !important;
    letter-spacing: .7px !important;
    text-transform: uppercase !important;
    color: var(--gray-400) !important;
    background: var(--gray-50) !important;
    border-bottom: 1px solid var(--gray-200) !important;
    border-top: none !important;
    padding: 12px 16px !important;
    white-space: nowrap;
    vertical-align: middle !important;
}

.table td {
    vertical-align: middle !important;
    padding: 12px 16px !important;
    border-color: var(--gray-100) !important;
    font-weight: 500;
}

.table tbody tr { transition: background var(--t); }
.table tbody tr:hover { background: var(--gray-50) !important; }
.table-striped > tbody > tr:nth-of-type(odd) > * { background: transparent !important; }

.table-responsive { border-radius: var(--r-lg) !important; }

/* Empty state in table */
.table tbody td[colspan] .text-muted i { font-size: 2.5rem; opacity: .3; display: block; margin: 0 auto 12px; }

/* ============================================================
   11. FORMS
   ============================================================ */
.form-control,
.form-select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="file"],
textarea,
select {
    border: 1.5px solid var(--gray-200) !important;
    border-radius: var(--r-sm) !important;
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    font-size: 13.5px !important;
    color: var(--gray-900) !important;
    background: var(--gray-50) !important;
    padding: 9px 12px !important;
    transition: border-color var(--t), box-shadow var(--t), background var(--t) !important;
    line-height: 1.5;
}

.form-control:focus,
.form-select:focus,
input:focus, textarea:focus, select:focus {
    border-color: var(--brand-light) !important;
    box-shadow: 0 0 0 3px rgba(30,136,229,.12) !important;
    background: #fff !important;
    outline: none !important;
}

.form-control::placeholder,
input::placeholder, textarea::placeholder { color: var(--gray-400) !important; font-weight: 400; }

label, .form-label, .col-form-label {
    font-size: 13px !important;
    font-weight: 700 !important;
    color: var(--gray-700) !important;
    margin-bottom: 6px !important;
}

.form-text { font-size: 12px !important; color: var(--gray-400) !important; }

/* Input group */
.input-group-text {
    background: var(--gray-50) !important;
    border: 1.5px solid var(--gray-200) !important;
    border-radius: var(--r-sm) !important;
    color: var(--gray-400) !important;
    font-size: 13px !important;
    padding: 9px 12px !important;
}
.input-group > :not(:first-child) { border-left: none !important; }
.input-group > :not(:last-child)  { border-right: none !important; }
.input-group:focus-within .input-group-text {
    border-color: var(--brand-light) !important;
}

/* Validation */
.is-invalid { border-color: var(--red) !important; }
.is-valid   { border-color: var(--green) !important; }
.invalid-feedback { font-size: 12px !important; color: var(--red) !important; font-weight: 600; }
.valid-feedback   { font-size: 12px !important; color: var(--green) !important; }

/* Form check */
.form-check-input {
    width: 16px !important; height: 16px !important;
    border: 1.5px solid var(--gray-300) !important;
    border-radius: 4px !important;
    background-color: var(--gray-50) !important;
    margin-top: 2px;
}
.form-check-input:checked { background-color: var(--brand) !important; border-color: var(--brand) !important; }
.form-check-label { font-size: 13px !important; font-weight: 500 !important; color: var(--gray-700) !important; margin-bottom: 0 !important; }

/* Switch */
.form-switch .form-check-input { width: 36px !important; border-radius: var(--r-pill) !important; }

/* Select2 overrides */
.select2-container--default .select2-selection--single {
    border: 1.5px solid var(--gray-200) !important;
    border-radius: var(--r-sm) !important;
    height: 42px !important;
    display: flex !important; align-items: center !important;
    background: var(--gray-50) !important;
    padding: 0 8px !important;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--gray-900) !important; font-size: 13.5px !important; padding: 0 4px !important;
}
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--brand-light) !important;
    box-shadow: 0 0 0 3px rgba(30,136,229,.12) !important;
}
.select2-container--default .select2-selection--multiple {
    border: 1.5px solid var(--gray-200) !important;
    border-radius: var(--r-sm) !important;
    background: var(--gray-50) !important;
    min-height: 42px !important;
}
.select2-dropdown {
    border: 1px solid var(--gray-200) !important;
    border-radius: var(--r-md) !important;
    box-shadow: var(--s-lg) !important;
    font-size: 13px !important;
    font-family: 'Plus Jakarta Sans', sans-serif !important;
}
.select2-container--default .select2-results__option { padding: 9px 12px !important; }
.select2-container--default .select2-results__option--highlighted {
    background: var(--brand-soft) !important; color: var(--brand) !important;
}
.select2-search.select2-search--inline { display: none !important; }
.select2-container--default .select2-search--dropdown .select2-search__field {
    border: 1.5px solid var(--gray-200) !important;
    border-radius: var(--r-xs) !important;
    padding: 7px 10px !important;
    font-size: 13px !important;
}

/* ============================================================
   12. BUTTONS
   ============================================================ */
.btn {
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    font-weight: 700 !important;
    font-size: 13px !important;
    border-radius: var(--r-sm) !important;
    padding: 9px 18px !important;
    transition: transform var(--t), box-shadow var(--t), background var(--t), border-color var(--t) !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    line-height: 1.3 !important;
    cursor: pointer;
    text-decoration: none !important;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* Primary */
.btn-primary {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%) !important;
    border-color: var(--brand) !important; color: #fff !important;
    box-shadow: 0 2px 8px rgba(21,101,192,.25) !important;
}
.btn-primary:hover { background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 100%) !important; box-shadow: 0 4px 16px rgba(21,101,192,.38) !important; color: #fff !important; }

/* Success */
.btn-success {
    background: linear-gradient(135deg, #1B873B, #22C55E) !important;
    border-color: #1B873B !important; color: #fff !important;
    box-shadow: 0 2px 8px rgba(27,135,59,.25) !important;
}
.btn-success:hover { box-shadow: 0 4px 16px rgba(27,135,59,.38) !important; color: #fff !important; }

/* Danger */
.btn-danger {
    background: linear-gradient(135deg, #B91C1C, #EF4444) !important;
    border-color: #B91C1C !important; color: #fff !important;
    box-shadow: 0 2px 8px rgba(185,28,28,.25) !important;
}
.btn-danger:hover { box-shadow: 0 4px 16px rgba(185,28,28,.38) !important; color: #fff !important; }

/* Warning */
.btn-warning {
    background: linear-gradient(135deg, #B45309, #F59E0B) !important;
    border-color: #B45309 !important; color: #fff !important;
    box-shadow: 0 2px 8px rgba(180,83,9,.25) !important;
}
.btn-warning:hover { box-shadow: 0 4px 16px rgba(180,83,9,.38) !important; color: #fff !important; }

/* Secondary / Light */
.btn-secondary,
.btn-light {
    background: var(--gray-100) !important; border-color: var(--gray-200) !important;
    color: var(--gray-700) !important; box-shadow: none !important;
}
.btn-secondary:hover,
.btn-light:hover { background: var(--gray-200) !important; color: var(--gray-900) !important; }

/* Outline primary */
.btn-outline-primary  { border-color: var(--brand) !important; color: var(--brand) !important; background: transparent !important; }
.btn-outline-primary:hover  { background: var(--brand-soft) !important; }
.btn-outline-dark { border-color: var(--gray-700) !important; color: var(--gray-700) !important; background: transparent !important; }
.btn-outline-dark:hover { background: var(--gray-900) !important; color: #fff !important; }

/* Dark */
.btn-dark { background: var(--gray-800) !important; border-color: var(--gray-900) !important; color: #fff !important; }
.btn-dark:hover { background: var(--gray-900) !important; color: #fff !important; }

/* Soft variants */
.btn-soft-primary { background: var(--brand-soft) !important; color: var(--brand) !important; border-color: var(--brand-soft) !important; box-shadow: none !important; }
.btn-soft-primary:hover { background: var(--brand) !important; color: #fff !important; }
.btn-soft-danger  { background: var(--red-soft) !important; color: var(--red) !important; border-color: var(--red-soft) !important; box-shadow: none !important; }
.btn-soft-danger:hover { background: var(--red) !important; color: #fff !important; }
.btn-soft-success { background: var(--green-soft) !important; color: var(--green) !important; border-color: var(--green-soft) !important; box-shadow: none !important; }

/* Sizes */
.btn-sm { padding: 6px 12px !important; font-size: 12px !important; border-radius: var(--r-xs) !important; }
.btn-sm:hover:not(:disabled) { transform: none; }
.btn-lg { padding: 12px 24px !important; font-size: 15px !important; border-radius: var(--r-md) !important; }

/* Pill buttons (from some views) */
.btn.rounded-pill { border-radius: var(--r-pill) !important; }
.btn.rounded-3    { border-radius: var(--r-sm) !important; }

/* ============================================================
   13. BADGES
   ============================================================ */
.badge {
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    font-weight: 700 !important; font-size: 11px !important;
    border-radius: var(--r-xs) !important;
    padding: 4px 8px !important;
    letter-spacing: .2px;
}

/* Bootstrap 5 subtle bg compat */
.bg-success-subtle, .bg-success-subtle { background: var(--s-hadir-bg) !important; color: var(--s-hadir) !important; }
.bg-danger-subtle  { background: var(--s-alpha-bg) !important; color: var(--s-alpha) !important; }
.bg-warning-subtle { background: var(--s-izin-bg) !important; color: var(--s-izin) !important; }
.bg-primary-subtle { background: var(--brand-soft) !important; color: var(--brand) !important; }
.bg-light   { background: var(--gray-100) !important; }
.bg-soft-primary { background: var(--brand-soft) !important; }
.bg-soft-success { background: var(--s-hadir-bg) !important; }
.bg-soft-warning { background: var(--s-izin-bg) !important; }
.bg-soft-danger  { background: var(--s-alpha-bg) !important; }

/* Status badges (custom) */
.badge-status {
    display: inline-flex; align-items: center;
    padding: 4px 10px; border-radius: var(--r-pill);
    font-size: 11px; font-weight: 700;
    letter-spacing: .3px;
}
.badge-status-hadir,
.badge-status-diverifikasi,
.badge-status-aktif   { background: var(--s-hadir-bg); color: var(--s-hadir); border: 1px solid rgba(27,135,59,.2); }
.badge-status-izin,
.badge-status-menunggu { background: var(--s-izin-bg); color: var(--s-izin); border: 1px solid rgba(180,83,9,.2); }
.badge-status-sakit   { background: var(--s-sakit-bg); color: var(--s-sakit); border: 1px solid rgba(21,101,192,.2); }
.badge-status-alpha,
.badge-status-tidak_hadir,
.badge-status-ditolak,
.badge-status-tidak_aktif { background: var(--s-alpha-bg); color: var(--s-alpha); border: 1px solid rgba(220,38,38,.2); }

/* ============================================================
   14. DASHBOARD — STAT CARDS
   ============================================================ */
/* New dash-stat (used in dashboard_admin) */
.dash-stat {
    background: #fff; border-radius: var(--r-lg); box-shadow: var(--s-sm);
    padding: 16px 18px; display: flex; align-items: center; gap: 14px;
    height: 100%; transition: var(--t);
    border: 1px solid var(--gray-100);
}
.dash-stat:hover { box-shadow: var(--s-md); transform: translateY(-2px); }
.dash-stat__icon {
    width: 48px; height: 48px; min-width: 48px; border-radius: var(--r-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; background: var(--brand-soft); color: var(--brand);
}
.dash-stat--warn    .dash-stat__icon { background: var(--s-izin-bg);  color: var(--s-izin); }
.dash-stat--danger  .dash-stat__icon { background: var(--s-alpha-bg); color: var(--s-alpha); }
.dash-stat--neutral .dash-stat__icon { background: var(--gray-100);   color: var(--gray-500); }
.dash-stat__value { font-size: 1.6rem; font-weight: 800; color: var(--gray-900); line-height: 1.1; }
.dash-stat__label { font-size: 12px; color: var(--gray-500); font-weight: 600; }

/* Legacy dash-count (used in siswa, guru, etc.) */
.dash-count {
    background: #fff; border-radius: var(--r-lg); box-shadow: var(--s-sm);
    padding: 16px 18px; display: flex; align-items: center; justify-content: space-between;
    gap: 10px; transition: var(--t); border: 1px solid var(--gray-100);
    text-decoration: none !important; color: inherit !important;
}
.dash-count:hover { box-shadow: var(--s-md); transform: translateY(-2px); }
.dash-counts h5 { font-size: 12px !important; font-weight: 700 !important; color: var(--gray-500) !important; margin-bottom: 4px !important; }
.dash-counts h4 { font-size: 1.7rem !important; font-weight: 800 !important; color: var(--gray-900) !important; margin: 0 !important; line-height: 1; }
.dash-count > a { text-decoration: none !important; color: inherit !important; display: flex; width: 100%; align-items: center; justify-content: space-between; }

/* Icon circles in dash-count */
.dash-count .rounded-circle,
.dash-count [class*="badge-status"] {
    width: 48px !important; height: 48px !important;
    min-width: 48px; display: flex !important;
    align-items: center !important; justify-content: center !important;
    border-radius: 50% !important; font-size: 1.1rem !important;
}

/* ============================================================
   15. DASHBOARD — HERO
   ============================================================ */
.dash-hero {
    position: relative; overflow: hidden;
    border-radius: var(--r-xl) !important;
    background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 55%, var(--brand-light) 100%) !important;
    padding: 28px !important; margin-bottom: 20px !important;
    color: #fff; display: flex; align-items: center; justify-content: space-between;
    gap: 20px; flex-wrap: wrap;
}
.dash-hero::before {
    content: ''; position: absolute; inset: 0;
    background-image: radial-gradient(rgba(255,255,255,.1) 1.5px, transparent 1.5px);
    background-size: 22px 22px;
    mask-image: linear-gradient(120deg,rgba(0,0,0,.7) 0%,transparent 65%);
    pointer-events: none;
}
.dash-hero::after {
    content: ''; position: absolute; width: 260px; height: 260px; border-radius: 50%;
    background: rgba(255,255,255,.05); right: -70px; bottom: -110px; pointer-events: none;
}
.dash-hero__eyebrow  { font-size: 11px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: rgba(255,255,255,.6); margin-bottom: 6px; position: relative; }
.dash-hero__title    { font-size: clamp(1.35rem, 1vw + 1.1rem, 1.85rem); font-weight: 800; line-height: 1.15; margin-bottom: 6px; position: relative; }
.dash-hero__subtitle { color: rgba(255,255,255,.75); max-width: 42ch; margin: 0; font-size: 13px; line-height: 1.55; position: relative; }
.dash-hero__photo    { height: 152px; width: auto; align-self: flex-end; margin-bottom: -28px; mask-image: linear-gradient(to bottom, black 78%, transparent 100%); filter: drop-shadow(0 8px 16px rgba(13,71,161,.3)); position: relative; }
.dash-hero__meta     { position: relative; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); border-radius: var(--r-md); padding: 14px 20px; text-align: center; min-width: 114px; flex-shrink: 0; backdrop-filter: blur(8px); }
.dash-hero__meta .day   { font-size: 2rem; font-weight: 800; line-height: 1; display: block; }
.dash-hero__meta .month { font-size: 11px; font-weight: 600; color: rgba(255,255,255,.7); text-transform: uppercase; letter-spacing: .6px; }

/* ============================================================
   16. QUICK ACCESS GRID
   ============================================================ */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 10px; }
.quick-item {
    background: #fff; border-radius: var(--r-lg); box-shadow: var(--s-sm);
    border: 1px solid var(--gray-100); padding: 14px 8px;
    display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
    text-decoration: none !important; color: var(--gray-700) !important;
    transition: var(--t);
}
.quick-item:hover { transform: translateY(-3px); box-shadow: var(--s-md); border-color: var(--brand-muted); }
.quick-item:active { transform: scale(.97); }
.quick-item__icon { width: 44px; height: 44px; border-radius: var(--r-md); display: flex; align-items: center; justify-content: center; font-size: 1.05rem; background: var(--brand-soft); color: var(--brand); }
.quick-item__icon--red    { background: var(--s-alpha-bg); color: var(--s-alpha); }
.quick-item__icon--green  { background: var(--s-hadir-bg); color: var(--s-hadir); }
.quick-item__icon--amber  { background: var(--s-izin-bg);  color: var(--s-izin);  }
.quick-item__icon--blue   { background: var(--s-sakit-bg); color: var(--s-sakit); }
.quick-item__icon--purple { background: var(--purple-soft); color: var(--purple); }
.quick-item__icon--teal   { background: var(--teal-soft);   color: var(--teal);   }
.quick-item__label { font-size: 11px; font-weight: 700; line-height: 1.3; }

/* ============================================================
   17. DATA ROWS (dashboard lists)
   ============================================================ */
.data-rows { display: flex; flex-direction: column; }
.data-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--gray-100); transition: background var(--t); border-radius: var(--r-xs); }
.data-row:last-child { border-bottom: none; }
.data-row:hover { background: var(--gray-50); }
.data-row__rank { width: 24px; min-width: 24px; height: 24px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.data-row__avatar { width: 36px; height: 36px; min-width: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; color: #fff; background: var(--brand); }
.data-row__body { flex: 1; min-width: 0; }
.data-row__title { font-weight: 700; color: var(--gray-900); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.data-row__subtitle { font-size: 11px; color: var(--gray-400); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.data-row__trailing { flex-shrink: 0; text-align: right; }
.data-row__empty { text-align: center; padding: 32px 16px; color: var(--gray-400); }
.data-row__empty i { font-size: 2rem; opacity: .4; margin-bottom: 8px; display: block; }

/* ============================================================
   18. NAV PILLS (page tabs)
   ============================================================ */
.nav-pills .nav-link {
    border-radius: var(--r-sm) !important;
    font-size: 12.5px !important; font-weight: 700 !important;
    padding: 7px 16px !important; color: var(--gray-500) !important;
    transition: var(--t) !important;
}
.nav-pills .nav-link.active { background: var(--brand) !important; color: #fff !important; }
.nav-pills .nav-link:hover:not(.active) { background: var(--brand-soft) !important; color: var(--brand) !important; }

/* Nav tabs (line style) */
.nav-tabs { border-bottom: 2px solid var(--gray-200) !important; }
.nav-tabs .nav-link { border: none !important; border-bottom: 2px solid transparent !important; margin-bottom: -2px !important; color: var(--gray-500) !important; font-weight: 700 !important; font-size: 13px !important; padding: 10px 16px !important; border-radius: 0 !important; transition: var(--t) !important; }
.nav-tabs .nav-link.active { border-bottom-color: var(--brand) !important; color: var(--brand) !important; background: none !important; }
.nav-tabs .nav-link:hover:not(.active) { color: var(--brand) !important; }

/* ============================================================
   19. PAGINATION
   ============================================================ */
.pagination { gap: 3px !important; }
.pagination .page-link {
    border-radius: var(--r-xs) !important; border: 1.5px solid var(--gray-200) !important;
    color: var(--gray-700) !important; font-size: 12.5px !important; font-weight: 700 !important;
    padding: 6px 11px !important; transition: var(--t) !important;
}
.pagination .page-link:hover { background: var(--brand-soft) !important; border-color: var(--brand-muted) !important; color: var(--brand) !important; }
.pagination .page-item.active .page-link { background: var(--brand) !important; border-color: var(--brand) !important; color: #fff !important; }
.pagination .page-item.disabled .page-link { opacity: .45 !important; }

/* ============================================================
   20. ALERTS
   ============================================================ */
.alert {
    border-radius: var(--r-md) !important; border: none !important;
    padding: 14px 18px !important; font-size: 13px !important;
    font-weight: 500 !important; display: flex; align-items: flex-start; gap: 10px;
}
.alert i { font-size: 15px; flex-shrink: 0; margin-top: 1px; }
.alert-primary { background: var(--brand-soft) !important; color: var(--brand-dark) !important; }
.alert-success  { background: var(--s-hadir-bg) !important; color: var(--s-hadir) !important; }
.alert-warning  { background: var(--s-izin-bg) !important; color: var(--s-izin) !important; }
.alert-danger   { background: var(--s-alpha-bg) !important; color: var(--s-alpha) !important; }
.alert-info     { background: var(--teal-soft) !important; color: var(--teal) !important; }
.alert .btn-close { margin-left: auto; opacity: .5; }

/* Inline info alerts (from old views) */
.bg-sky-subtle { background: var(--teal-soft) !important; color: var(--teal) !important; }
.bg-light-info { background: var(--teal-soft) !important; }

/* ============================================================
   21. MODALS
   ============================================================ */
.modal-content { border-radius: var(--r-2xl) !important; border: none !important; box-shadow: var(--s-xl) !important; overflow: hidden; }
.modal-header  { border-bottom: 1px solid var(--gray-100) !important; padding: 20px 24px !important; background: #fff !important; }
.modal-title   { font-size: 16px !important; font-weight: 800 !important; color: var(--gray-900) !important; }
.modal-body    { padding: 20px 24px !important; }
.modal-footer  { border-top: 1px solid var(--gray-100) !important; padding: 14px 24px !important; background: var(--gray-50) !important; }
.btn-close     { opacity: .45; transition: opacity var(--t); }
.btn-close:hover { opacity: 1; }

/* ============================================================
   22. PROGRESS
   ============================================================ */
.progress { border-radius: var(--r-pill) !important; background: var(--gray-200) !important; height: 6px !important; }
.progress-bar { border-radius: var(--r-pill) !important; background: linear-gradient(90deg, var(--brand), var(--brand-light)) !important; }

/* ============================================================
   23. LIST GROUPS
   ============================================================ */
.list-group-item { border-color: var(--gray-100) !important; padding: 12px 16px !important; font-size: 13px !important; }
.list-group-item:first-child { border-radius: var(--r-md) var(--r-md) 0 0 !important; }
.list-group-item:last-child  { border-radius: 0 0 var(--r-md) var(--r-md) !important; }
.list-group-item.active { background: var(--brand) !important; border-color: var(--brand) !important; }

/* ============================================================
   24. GLOBAL LOADER
   ============================================================ */
div#global-loader {
    position: fixed !important; inset: 0 !important; background: rgba(255,255,255,.92) !important;
    backdrop-filter: blur(4px) !important; z-index: 9999 !important;
    align-items: center !important; justify-content: center !important;
}
/* display TIDAK !important — jQuery fadeOut() perlu bisa menyembunyikannya lewat inline style */
div#global-loader { display: flex; }
.app-loader-spinner {
    width: 44px; height: 44px;
    border: 4px solid var(--gray-200); border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   25. SWEETALERT2 OVERRIDES
   ============================================================ */
.swal2-popup { border-radius: var(--r-2xl) !important; font-family: 'Plus Jakarta Sans', sans-serif !important; }
.swal2-title { font-size: 18px !important; font-weight: 800 !important; color: var(--gray-900) !important; }
.swal2-html-container { font-size: 13px !important; color: var(--gray-600) !important; }
.swal2-confirm { border-radius: var(--r-sm) !important; font-weight: 700 !important; background: linear-gradient(135deg, var(--brand), var(--brand-light)) !important; }
.swal2-cancel  { border-radius: var(--r-sm) !important; font-weight: 700 !important; background: var(--gray-200) !important; color: var(--gray-700) !important; }

/* ============================================================
   26. DATATABLES
   ============================================================ */
.dataTables_wrapper {
    font-family: 'Plus Jakarta Sans', sans-serif !important;
}
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    border: 1.5px solid var(--gray-200) !important;
    border-radius: var(--r-sm) !important;
    font-size: 13px !important; padding: 7px 10px !important;
    font-family: inherit !important; background: var(--gray-50) !important;
}
.dataTables_wrapper .dataTables_filter input:focus { border-color: var(--brand-light) !important; box-shadow: 0 0 0 3px rgba(30,136,229,.1) !important; outline: none !important; }
.dataTables_wrapper .dataTables_info { font-size: 12px !important; color: var(--gray-400) !important; }
.dataTables_wrapper .dataTables_paginate .paginate_button { border-radius: var(--r-xs) !important; font-size: 12.5px !important; font-weight: 700 !important; transition: var(--t) !important; }
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover { background: var(--brand) !important; border-color: var(--brand) !important; color: #fff !important; }
.dataTables_wrapper .dataTables_paginate .paginate_button:hover:not(.current) { background: var(--brand-soft) !important; color: var(--brand) !important; border-color: var(--brand-muted) !important; }

/* ============================================================
   27. QR SCANNER PAGE
   ============================================================ */
#reader { border-radius: var(--r-xl) !important; overflow: hidden !important; border: 2px solid var(--gray-200) !important; }
#reader video { border-radius: var(--r-lg) !important; }

/* ============================================================
   28. MISC UTILITIES
   ============================================================ */
[data-feather] { vertical-align: middle; }

/* Text colors */
.text-primary { color: var(--brand) !important; }
.text-success { color: var(--s-hadir) !important; }
.text-danger  { color: var(--s-alpha) !important; }
.text-warning { color: var(--s-izin) !important; }
.text-muted   { color: var(--gray-400) !important; }
.text-dark    { color: var(--gray-900) !important; }
.text-sky     { color: var(--teal) !important; }

/* BG */
.bg-primary { background: var(--brand) !important; }
.bg-success { background: var(--s-hadir) !important; }
.bg-danger  { background: var(--s-alpha) !important; }
.bg-warning { background: var(--s-izin) !important; }

/* Avatar initial circle (used in siswa list) */
.rounded-circle.bg-sky-subtle,
.rounded-circle.bg-primary-subtle,
.rounded-circle[class*="badge-status"] {
    display: flex !important; align-items: center !important;
    justify-content: center !important; font-weight: 700 !important;
    font-size: 13px !important; font-family: 'Plus Jakarta Sans', sans-serif !important;
}

/* Pill badge from old views */
.badge.rounded-pill { border-radius: var(--r-pill) !important; }

/* Border tweaks */
.border-start.border-4.border-info { border-color: var(--teal) !important; }

/* Font weight utilities */
.fw-bold    { font-weight: 700 !important; }
.fw-semibold { font-weight: 600 !important; }

/* Container */
.container-fluid { padding: 0 !important; }

/* Row gap */
.g-3 { --bs-gutter-x: 16px; --bs-gutter-y: 16px; }

/* Shadow utilities */
.shadow-sm { box-shadow: var(--s-sm) !important; }
.shadow     { box-shadow: var(--s-md) !important; }
.shadow-xs  { box-shadow: var(--s-xs) !important; }

/* ============================================================
   29. PAGE-SPECIFIC PATCHES
   ============================================================ */

/* Siswa / Guru index top section */
.col-md-6 h4.fw-bold { font-size: 18px !important; font-weight: 800 !important; }

/* Card footer pagination center */
.card-footer .pagination { margin: 0 !important; }

/* Old page-header (hidden, replaced by page-title-bar) */
.page-header { display: none !important; }

/* Hide legacy elements */
.header:not(.app-topbar),
.horizontal-sidebar,
#sidebar:not(#app-sidebar) {
    display: none !important;
}

/* ============================================================
   30. RESPONSIVE
   ============================================================ */

/* ── Tablet landscape ── */
@media (max-width: 1199.98px) {
    .app-content { padding: 18px 18px 28px; }
}

/* ── Tablet / mobile: sidebar jadi drawer ── */
@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-w) !important;
        box-shadow: var(--s-xl);
        z-index: 1060;
    }
    .app-sidebar.sidebar-mobile-open { transform: translateX(0); }
    .app-main  { margin-left: 0 !important; }
    .sidebar-toggle { display: flex !important; }
    .dash-hero__photo { display: none; }
    .dash-hero__meta  { display: none; }
    .app-content { padding: 14px 14px 24px; }
    .page-title-bar__title { font-size: 18px !important; }
    .page-title-bar { margin-bottom: 14px; }

    /* ── FIX UTAMA: Table harus bisa scroll horizontal di mobile ── */
    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        display: block;
    }
    /* Pastikan tabel tidak menyusut, tetap punya lebar alaminya */
    .table-responsive .table {
        min-width: 500px; /* tabel tidak akan lebih kecil dari ini */
    }
    /* Card yang membungkus tabel tidak boleh overflow:hidden yang memblokir scroll */
    .card { overflow: visible !important; }
    .card .table-responsive { border-radius: var(--r-lg) !important; }
}

/* ── Tablet portrait ── */
@media (max-width: 767.98px) {
    .app-content { padding: 10px 10px 20px; }

    /* Hero */
    .dash-hero {
        padding: 18px !important;
        border-radius: var(--r-lg) !important;
        flex-direction: column;
        align-items: flex-start !important;
    }
    .dash-hero__title    { font-size: 1.4rem; }
    .dash-hero__subtitle { font-size: 12px; }

    /* Stat cards */
    .dash-stat { padding: 14px !important; gap: 10px; }
    .dash-stat__value { font-size: 1.3rem; }
    .dash-stat__icon  { width: 40px; height: 40px; min-width: 40px; font-size: 1rem; }

    /* Quick grid: 4 kolom */
    .quick-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; }
    .quick-item { padding: 10px 4px; gap: 6px; }
    .quick-item__icon { width: 38px; height: 38px; font-size: .9rem; }
    .quick-item__label { font-size: 10px; }

    /* Cards */
    .card-body   { padding: 14px !important; }
    .card-header { padding: 12px 14px !important; }
    .card-footer { padding: 12px 14px !important; }

    /* Buttons */
    .btn { min-height: 44px; }
    .btn-sm { min-height: 34px !important; padding: 6px 10px !important; }

    /* Tables */
    .table td, .table th { padding: 10px !important; font-size: 12.5px !important; }
    .table thead th { font-size: 10px !important; }

    /* Page title */
    .page-title-bar { flex-direction: column; align-items: flex-start; gap: 4px; }
    .page-title-bar__title { font-size: 17px !important; }

    /* Topbar */
    .app-topbar { padding: 0 12px; }

    /* Dash count (siswa/guru/dll) */
    .dash-count { padding: 12px 14px !important; gap: 8px; }
    .dash-counts h4 { font-size: 1.4rem !important; }
    .dash-counts h5 { font-size: 11px !important; }
    .dash-count .rounded-circle {
        width: 40px !important; height: 40px !important;
        min-width: 40px !important; font-size: 1rem !important;
    }

    /* Modal */
    .modal-dialog  { margin: 10px !important; }
    .modal-content { border-radius: var(--r-xl) !important; }
    .modal-header  { padding: 16px 18px !important; }
    .modal-body    { padding: 16px 18px !important; }
    .modal-footer  { padding: 12px 18px !important; }

    /* Pagination */
    .pagination { flex-wrap: wrap; justify-content: center; gap: 2px; }
    .page-link  { padding: 6px 10px !important; font-size: 12px !important; }

    /* Nav pills */
    .nav-pills { flex-wrap: wrap; gap: 4px; }
    .nav-pills .nav-link { padding: 7px 12px !important; font-size: 12px !important; }

    /* Alert */
    .alert { font-size: 12.5px !important; padding: 12px 14px !important; }

    /* Select2 full width */
    .select2-container { width: 100% !important; }
}

/* ── Mobile (< 576px) ── */
@media (max-width: 575.98px) {
    .app-content { padding: 10px 10px 16px; }

    /* Topbar compact */
    .app-topbar      { padding: 0 10px; gap: 8px; height: 54px; }
    .topbar-hamburger { width: 36px; height: 36px; }
    .topbar-action   { width: 34px; height: 34px; }
    .topbar-breadcrumb { display: none !important; }
    .topbar-user__info { display: none !important; }

    /* Hero */
    .dash-hero { padding: 16px !important; }
    .dash-hero__title { font-size: 1.3rem; }

    /* Quick grid */
    .quick-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
    .quick-item { padding: 8px 2px; gap: 5px; }
    .quick-item__icon { width: 34px; height: 34px; font-size: .8rem; }
    .quick-item__label { font-size: 9.5px; }

    /* Page title */
    .page-title-bar__title { font-size: 16px !important; }
    .breadcrumb { font-size: 11px !important; }

    /* Card header */
    .card-header { flex-wrap: wrap !important; gap: 6px !important; }
    .card-header h5,
    .card-header h6 { font-size: 13px !important; }

    /* Tabel: min-width lebih kecil di HP kecil */
    .table-responsive .table { min-width: 420px; }

    /* Nav pills scroll horizontal */
    .nav-pills {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 2px;
    }
    .nav-pills::-webkit-scrollbar { display: none; }
    .nav-pills .nav-link { white-space: nowrap; }

    /* Modal */
    .modal-dialog { margin: 8px !important; }
}

/* ── Prevent iOS auto-zoom on input focus ── */
@media (max-width: 767.98px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    input[type="search"],
    select,
    textarea,
    .form-control,
    .form-select {
        font-size: 16px !important;
    }
}

/* ── Print ── */
@media print {
    .app-sidebar, .app-topbar, .sidebar-backdrop, #global-loader { display: none !important; }
    .app-main  { margin-left: 0 !important; }
    .app-content { padding: 0 !important; }
    .card { box-shadow: none !important; border: 1px solid #ddd !important; }
    .btn  { display: none !important; }
    body  { background: white !important; font-size: 12px !important; }
    .table td, .table th { padding: 6px 8px !important; border: 1px solid #ddd !important; }
}

/* ============================================================
   31. SECTION LABELS (dashboard content grouping)
   ============================================================ */
.section-label {
    font-size: 11px; font-weight: 800; text-transform: uppercase;
    letter-spacing: .8px; color: var(--gray-400); margin: 28px 0 12px;
    display: flex; align-items: center; gap: 8px;
}
.section-label:first-child { margin-top: 0; }
.section-label i { font-size: 12px; color: var(--brand); }

/* test */
