/* ==========================================================================
   Aurora — Base: reset ringan, tipografi, dan kerangka tata letak.
   Dimuat SESUDAH bootstrap.min.css, jadi berkas ini sengaja menimpa
   sebagian gaya Bootstrap 3 yang masih dipakai halaman lama.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

/* Atribut hidden harus selalu menang.
   Stylesheet penulis SELALU mengalahkan stylesheet bawaan peramban, berapa
   pun specificity-nya. Jadi aturan seperti .a-pasang{display:flex} atau
   .a-btn{display:inline-flex} diam-diam menimpa [hidden]{display:none}
   bawaan peramban -- elemen tetap terlihat padahal JavaScript-nya sudah
   menyetel .hidden = true dan mengira elemen itu hilang.

   Akibat nyatanya: popup ajakan pasang aplikasi tetap tampil walau sudah
   ditutup, dan pada kunjungan berikutnya skripnya berhenti lebih awal
   sehingga tidak ada satu pun event listener terpasang -- tombol X dan
   Pasang terasa mati saat disentuh. */
[hidden] { display: none !important; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: var(--text-base);
    line-height: var(--leading);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-synthesis-weight: none;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font);
    color: var(--text);
    font-weight: 650;
    letter-spacing: -.011em;
    margin: 0 0 .5em;
    line-height: 1.25;
}
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }
h5, h6 { font-size: 13px; }

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover, a:focus { color: var(--accent-hover); text-decoration: none; }

hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }

code, pre, kbd, samp { font-family: var(--font-mono); font-size: .92em; }
code {
    background: var(--surface-3);
    color: var(--text);
    padding: .15em .4em;
    border-radius: var(--radius-xs);
}
pre {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    overflow: auto;
    color: var(--text);
}

/* Angka uang selalu rata antar-baris */
.num, .money, td.text-right, .stat-value { font-variant-numeric: tabular-nums; }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-xs); }

::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }

/* Scrollbar tipis, mengikuti tema */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: var(--radius-pill);
    border: 2px solid transparent;
    background-clip: content-box;
}

/* ==========================================================================
   Kerangka aplikasi
   ========================================================================== */

.aurora-app {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    /* Latar ditegaskan di sini, bukan hanya mengandalkan body. Bootstrap 3
       memasang `body{background-color:#fff}`, dan kalau urutan muat berubah
       lagi, latar gelap tidak boleh ikut hilang. */
    background: var(--bg);
    min-height: 100vh;
    min-height: 100dvh;
    transition: grid-template-columns var(--transition);
}
body.sidebar-collapse .aurora-app { grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr); }

/* --- Sidebar --- */
/* Sel grid mengisi seluruh tinggi halaman supaya latar sidebar tidak putus
   saat konten lebih tinggi dari layar; isinya yang sticky, bukan selnya. */
.aurora-sidebar {
    grid-row: 1 / -1;
    background: var(--surface);
    border-right: 1px solid var(--border);
    z-index: 40;
}
.aurora-sidebar-inner {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.aurora-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 18px;
    height: var(--topbar-h);
    flex: 0 0 auto;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    overflow: hidden;
}
.aurora-brand:hover { color: var(--text); }
.aurora-brand-mark {
    flex: 0 0 auto;
    width: 34px; height: 34px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #fff;
    display: grid; place-items: center;
    font-weight: 750; font-size: 13px;
    letter-spacing: .02em;
}
.aurora-brand-text { min-width: 0; }

/* Varian logo: spanduk perusahaan menggantikan kotak inisial + nama.
   Inisialnya tetap ada di markup dan muncul lagi saat sidebar terlipat,
   karena logo selebar 1078x200 tidak terbaca di lebar 34px. */
.aurora-brand--logo .aurora-brand-mark { display: none; }
.aurora-brand-img {
    display: block;
    max-width: 100%;
    max-height: 30px;
    width: auto; height: auto;
    object-fit: contain; object-position: left center;
    margin-bottom: 2px;
}
body.sidebar-collapse .aurora-brand--logo { justify-content: center; padding: 0 8px; }
body.sidebar-collapse .aurora-brand--logo .aurora-brand-mark { display: grid; }
.aurora-brand-name {
    font-weight: 680; font-size: 14.5px; letter-spacing: -.01em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.aurora-brand-sub {
    font-size: 11px; color: var(--text-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.aurora-nav {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 10px 24px;
}
.aurora-nav ul { list-style: none; margin: 0; padding: 0; }

.aurora-nav-section {
    font-size: 10.5px;
    font-weight: 650;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-faint);
    padding: 16px 10px 6px;
}

/* Satu baris menu. Dipakai juga oleh menu plugin (lihat compat.css) */
.aurora-nav a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 7px 11px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    transition: background var(--transition), color var(--transition);
}
.aurora-nav a:hover { background: var(--surface-3); color: var(--text); }
.aurora-nav li.active > a,
.aurora-nav a.active {
    background: var(--accent-soft);
    color: var(--accent-text);
    font-weight: 600;
}
.aurora-nav .ico { flex: 0 0 auto; width: 18px; height: 18px; }
.aurora-nav .nav-txt { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; }

/* Submenu (treeview) */
/* Dinamai .nav-caret, BUKAN .caret: Bootstrap 3 memakai .caret sebagai
   segitiga dari border (border-top:4px dashed, dan border-top-color:#000
   dengan !important), yang menempel di SVG kita dan membuat chevron sidebar
   tampak aneh. Diketahui lewat docs/UI_V2_AUDIT.py. */
.aurora-nav .nav-caret {
    flex: 0 0 auto; width: 15px; height: 15px;
    color: var(--text-faint);
    transition: transform var(--transition);
}
.aurora-nav details[open] > summary .nav-caret { transform: rotate(90deg); }
.aurora-nav summary {
    list-style: none;
    cursor: pointer;
    display: flex; align-items: center; gap: 11px;
    padding: 7px 11px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 13px; font-weight: 500;
    white-space: nowrap;
    transition: background var(--transition), color var(--transition);
}
.aurora-nav summary::-webkit-details-marker { display: none; }
.aurora-nav summary:hover { background: var(--surface-3); color: var(--text); }
.aurora-nav details.is-active > summary { color: var(--text); font-weight: 600; }
.aurora-nav details > ul { margin: 2px 0 6px; padding-left: 29px; }
.aurora-nav details > ul a { padding: 6px 11px; font-size: 12.5px; }

/* Sidebar terlipat (desktop) */
body.sidebar-collapse .aurora-brand-text,
body.sidebar-collapse .aurora-nav .nav-txt,
body.sidebar-collapse .aurora-nav .nav-caret,
body.sidebar-collapse .aurora-nav-section { display: none; }
body.sidebar-collapse .aurora-nav a,
body.sidebar-collapse .aurora-nav summary { justify-content: center; padding: 10px; }
body.sidebar-collapse .aurora-nav details > ul { display: none; }

/* --- Topbar --- */
.aurora-topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 var(--gutter);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: saturate(150%) blur(10px);
    -webkit-backdrop-filter: saturate(150%) blur(10px);
    border-bottom: 1px solid var(--border);
}

.aurora-iconbtn {
    flex: 0 0 auto;
    width: 36px; height: 36px;
    display: grid; place-items: center;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}
.aurora-iconbtn:hover { background: var(--surface-3); color: var(--text); }
.aurora-iconbtn .ico { width: 19px; height: 19px; }

/* Pemicu command palette */
.aurora-search {
    flex: 1 1 auto;
    max-width: 420px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 9px;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
}
.aurora-search:hover { border-color: var(--border-strong); background: var(--surface); }
.aurora-search .ico { width: 16px; height: 16px; flex: 0 0 auto; }
.aurora-search .txt { flex: 1 1 auto; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aurora-kbd {
    flex: 0 0 auto;
    font-family: var(--font);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-faint);
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-xs);
    padding: 1px 6px;
}

/* Menu profil */
.aurora-user { position: relative; flex: 0 0 auto; }
.aurora-user-btn {
    display: flex; align-items: center; gap: 9px;
    padding: 5px 9px 5px 5px;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    transition: background var(--transition);
}
.aurora-user-btn:hover { background: var(--surface-3); }
.aurora-avatar {
    width: 28px; height: 28px; border-radius: 50%;
    object-fit: cover; flex: 0 0 auto;
    background: var(--surface-3);
}
.aurora-user-name {
    font-size: 13px; font-weight: 550; max-width: 140px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.aurora-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 236px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    z-index: 60;
    display: none;
}
.aurora-menu.open { display: block; }
.aurora-menu-head {
    padding: 11px 12px;
    border-bottom: 1px solid var(--border);
    margin: -6px -6px 6px;
    border-radius: var(--radius) var(--radius) 0 0;
    background: var(--surface-2);
}
.aurora-menu-head .n { font-weight: 640; font-size: 13.5px; }
.aurora-menu-head .r { font-size: 11.5px; color: var(--text-muted); }
.aurora-menu a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 11px;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13.5px;
}
.aurora-menu a:hover { background: var(--surface-3); }
.aurora-menu a.is-danger { color: var(--danger-text); }
.aurora-menu a.is-danger:hover { background: var(--danger-soft); }
.aurora-menu .ico { width: 17px; height: 17px; flex: 0 0 auto; color: var(--text-muted); }
.aurora-menu hr { margin: 6px 0; }

/* --- Area konten --- */
.aurora-main { display: flex; flex-direction: column; min-width: 0; }
.aurora-content { flex: 1 1 auto; padding: 20px var(--gutter) 40px; min-width: 0; }
.aurora-page-title { font-size: 20px; font-weight: 700; margin: 0 0 18px; letter-spacing: -.02em; }

.aurora-footer {
    padding: 16px var(--gutter);
    border-top: 1px solid var(--border);
    color: var(--text-faint);
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.aurora-footer a { color: var(--text-muted); }

/* Bilah mode pemeliharaan */
.aurora-maintenance {
    background: var(--warn-soft);
    color: var(--warn-text);
    border-bottom: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
    padding: 10px var(--gutter);
    font-size: 13px;
}
.aurora-maintenance a { color: var(--warn-text); font-weight: 650; text-decoration: underline; }

/* Lencana pratinjau tema — pengingat bahwa ini bukan tampilan produksi */
.aurora-preview-badge {
    position: fixed;
    right: 14px; bottom: 14px;
    z-index: 70;
    display: flex; align-items: center; gap: 8px;
    background: var(--identity);
    color: #fff;
    font-size: 11.5px; font-weight: 600;
    padding: 7px 12px;
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-lg);
}
.aurora-preview-badge a { color: #fff; text-decoration: underline; opacity: .85; }

/* ==========================================================================
   Responsif — sidebar jadi off-canvas
   ========================================================================== */

.aurora-scrim {
    position: fixed; inset: 0;
    background: rgb(15 23 42 / .5);
    z-index: 39;
    opacity: 0; pointer-events: none;
    transition: opacity var(--transition);
}

@media (max-width: 991px) {
    .aurora-app { grid-template-columns: minmax(0, 1fr); }
    body.sidebar-collapse .aurora-app { grid-template-columns: minmax(0, 1fr); }

    .aurora-sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        width: min(86vw, var(--sidebar-w));
        transform: translateX(-100%);
        transition: transform var(--transition);
        box-shadow: var(--shadow-lg);
    }
    .aurora-sidebar-inner { height: 100%; }
    body.nav-open .aurora-sidebar { transform: translateX(0); }
    body.nav-open .aurora-scrim { opacity: 1; pointer-events: auto; }

    /* Di mobile, sidebar selalu tampil penuh saat dibuka */
    body.sidebar-collapse .aurora-brand-text,
    body.sidebar-collapse .aurora-nav .nav-txt,
    body.sidebar-collapse .aurora-nav .nav-caret,
    body.sidebar-collapse .aurora-nav-section { display: revert; }
    body.sidebar-collapse .aurora-nav a,
    body.sidebar-collapse .aurora-nav summary { justify-content: flex-start; padding: 9px 11px; }
    body.sidebar-collapse .aurora-nav details > ul { display: revert; }

    .aurora-user-name { display: none; }
    .aurora-search { max-width: none; }
    .aurora-content { padding: 16px var(--gutter) 34px; }
    .aurora-page-title { font-size: 19px; }
}

@media (min-width: 992px) {
    .aurora-navtoggle-mobile { display: none; }
}
@media (max-width: 991px) {
    .aurora-navtoggle-desktop { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Saat dicetak: buang chrome, sisakan isi */
@media print {
    .aurora-sidebar, .aurora-topbar, .aurora-footer,
    .aurora-preview-badge, .aurora-scrim { display: none !important; }
    .aurora-app { display: block; }
    .aurora-content { padding: 0; }
    body { background: #fff; }
}

/* Label bawaan. Dipindah dari compat.css saat berkas itu dihapus
   (11 Okt 2026): ternyata satu-satunya aturan ELEMEN global di sana, dan
   selama ini dialah yang membentuk setiap <label> di aplikasi. .a-label,
   .a-check, dan .a-switch tetap menimpanya karena lebih spesifik. */
label { color: var(--text); font-weight: 600; font-size: 12.5px; }
