/* ============================================================
   Hidanet Panel - tema modern di atas Bootstrap 5 (tanpa build)
   Bahasa desain mengikuti panel Sistahid: token ala shadcn,
   primary biru logo, radius besar, dark mode via [data-bs-theme].
   ============================================================ */

:root,
[data-bs-theme=light] {
    --hd-background: hsl(210 40% 98%);
    --hd-foreground: hsl(222.2 84% 4.9%);
    --hd-card: hsl(0 0% 100%);
    --hd-muted: hsl(210 40% 96.1%);
    --hd-muted-foreground: hsl(215.4 16.3% 46.9%);
    --hd-border: hsl(214.3 31.8% 91.4%);
    --hd-primary: #2563eb;          /* biru logo Hidanet (blue-600) */
    --hd-primary-strong: #1d4ed8;   /* blue-700 */
    --hd-primary-soft: rgba(37, 99, 235, .10);
    --hd-radius: 1rem;
    --hd-shadow-card: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
    --hd-shadow-pop: 0 10px 30px -10px rgba(15, 23, 42, .25);
    --hd-sidebar-bg: rgba(255, 255, 255, .82);
    --hd-topbar-bg: rgba(248, 250, 252, .85);

    /* Remap variabel Bootstrap ke token di atas */
    --bs-body-bg: var(--hd-background);
    --bs-body-color: var(--hd-foreground);
    --bs-border-color: var(--hd-border);
    --bs-secondary-color: var(--hd-muted-foreground);
    --bs-tertiary-bg: var(--hd-muted);
    --bs-border-radius: .75rem;
    --bs-border-radius-sm: .5rem;
    --bs-border-radius-lg: var(--hd-radius);
    --bs-link-color: var(--hd-primary-strong);
    --bs-link-hover-color: #1e40af;
    --bs-font-sans-serif: "Plus Jakarta Sans", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

[data-bs-theme=dark] {
    --hd-background: hsl(222.2 84% 4.9%);
    --hd-foreground: hsl(210 40% 98%);
    --hd-card: hsl(222.2 84% 6%);
    --hd-muted: hsl(217.2 32.6% 17.5%);
    --hd-muted-foreground: hsl(215 20.2% 65.1%);
    --hd-border: hsl(217.2 32.6% 17.5%);
    --hd-primary: #3b82f6;
    --hd-primary-strong: #60a5fa;
    --hd-primary-soft: rgba(59, 130, 246, .16);
    --hd-shadow-card: 0 1px 2px rgba(0, 0, 0, .35);
    --hd-shadow-pop: 0 10px 30px -10px rgba(0, 0, 0, .6);
    --hd-sidebar-bg: rgba(10, 16, 30, .88);
    --hd-topbar-bg: rgba(10, 16, 30, .8);

    --bs-body-bg: var(--hd-background);
    --bs-body-color: var(--hd-foreground);
    --bs-border-color: var(--hd-border);
    --bs-secondary-color: var(--hd-muted-foreground);
    --bs-tertiary-bg: var(--hd-muted);
    --bs-link-color: var(--hd-primary-strong);
    --bs-link-hover-color: #93c5fd;
}

[x-cloak] { display: none !important; }

html, body { height: 100%; }

body {
    background: var(--hd-background);
    color: var(--hd-foreground);
    font-family: var(--bs-font-sans-serif);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* ============================================================
   Kerangka: sidebar + topbar
   ============================================================ */

.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
    width: 264px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--hd-sidebar-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 1px solid var(--hd-border);
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1045;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4, 0, .2, 1);
}

.app-shell.sidebar-open .app-sidebar { transform: translateX(0); box-shadow: var(--hd-shadow-pop); }

.app-backdrop {
    position: fixed; inset: 0; z-index: 1040;
    background: rgba(2, 6, 23, .45);
    backdrop-filter: blur(2px);
}

.app-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    transition: margin-left .28s cubic-bezier(.4, 0, .2, 1);
}

/* Di desktop sidebar TIDAK pernah hilang: menciutkannya menyisakan rel ikon.
   Menyembunyikannya sepenuhnya berarti menghilangkan seluruh navigasi, dan
   satu-satunya jalan kembali adalah menemukan tombol yang tadi menutupnya. */
@media (min-width: 992px) {
    .app-sidebar {
        box-shadow: none;
        transform: translateX(0);
        width: var(--hd-rail, 72px);
        /* hidden, bukan visible: apa pun yang lebih lebar dari rel harus
           terpotong di sini, bukan menumpuk di atas isi halaman. */
        overflow: hidden;
        transition: width .28s cubic-bezier(.4, 0, .2, 1);
    }
    .app-shell.sidebar-open .app-sidebar { box-shadow: none; width: 264px; }

    .app-main { margin-left: var(--hd-rail, 72px); }
    .app-shell.sidebar-open .app-main { margin-left: 264px; }

    .app-backdrop { display: none !important; }

    /* --- keadaan rel --- */

    .app-shell:not(.sidebar-open) .app-sidebar .nav-label { display: none; }

    .app-shell:not(.sidebar-open) .sidebar-brand { padding: 0; justify-content: center; }
    .app-shell:not(.sidebar-open) .brand-wordmark { display: none; }
    .app-shell:not(.sidebar-open) .brand-mark { display: block; height: 2.1rem; width: 2.1rem; }

    /* Jarak antar grup dirapatkan: di rel, judul grup sudah jadi garis
       pemisah, jadi 1.5rem bawaan menyisakan lubang kosong yang lebar. */
    .app-shell:not(.sidebar-open) .nav-group + .nav-group { margin-top: .85rem; }
    .app-shell:not(.sidebar-open) .sidebar-nav { padding: 1rem .75rem; }
    .app-shell:not(.sidebar-open) .sidebar-user { justify-content: center; padding: .9rem .5rem; }

    .app-shell:not(.sidebar-open) .nav-item-link {
        justify-content: center;
        padding: .65rem 0;
        gap: 0;
    }

    /* Judul grup jadi garis pemisah: pengelompokannya tetap terbaca walau
       katanya hilang. */
    .app-shell:not(.sidebar-open) .nav-group-title {
        margin: 0 .25rem .5rem;
        padding: 0;
        border-top: 1px solid var(--hd-border);
    }
    .app-shell:not(.sidebar-open) .nav-group:first-child .nav-group-title { border-top: 0; }

    /* Lencana angka tidak muat di rel; disusutkan jadi titik di pojok ikon
       supaya "ada yang menunggu" tetap terlihat.

       Pembungkusnya dikeluarkan dari aliran flex. Kelas ms-auto miliknya
       adalah margin-left: auto, dan margin auto pada flex item MENYERAP
       seluruh ruang kosong -- mengalahkan justify-content: center. Akibatnya
       ikon Konfirmasi dan Pemberitahuan terdorong ke kiri sementara ikon
       lain tetap di tengah, dan barisnya terlihat goyah. */
    .app-shell:not(.sidebar-open) .nav-item-link { position: relative; }
    .app-shell:not(.sidebar-open) .nav-badge {
        position: absolute;
        inset: 0;
        margin: 0 !important;
        pointer-events: none;
    }
    .app-shell:not(.sidebar-open) .nav-item-link .nav-count {
        position: absolute;
        top: .35rem;
        right: .9rem;
        margin: 0;
        min-width: .5rem;
        height: .5rem;
        padding: 0;
        font-size: 0;
        line-height: 0;
        background: #f59e0b;
    }

    /* Label rel memakai atribut title bawaan browser, BUKAN gelembung CSS.
       .sidebar-nav punya overflow-y: auto, jadi ::after akan terpotong persis
       ketika menunya cukup panjang untuk butuh gulir -- dan position: fixed
       tidak menolong karena backdrop-filter pada .app-sidebar menjadikannya
       blok penampung. Tooltip bawaan tidak pernah terpotong. */
}

/* --- isi sidebar --- */

.sidebar-brand {
    height: 4.25rem;
    display: flex; align-items: center; gap: .75rem;
    padding: 0 1.5rem;
    text-decoration: none;
    color: var(--hd-foreground);
    flex-shrink: 0;
}

.brand-logo { height: 34px; width: auto; max-width: 100%; }

/* Wordmark navy tidak terbaca di latar gelap -> jadikan putih monokrom.
   .brand-mark DIKECUALIKAN: ikonnya biru di latar transparan, sudah terbaca di
   kedua tema, dan meng-invert-nya hanya menyisakan siluet putih.
   Hanya wordmark BAWAAN: logo unggahan pengurus berwarna dan tidak boleh
   dibalik, dan mode ikon + nama sudah memakai warna teks tema. */
[data-bs-theme=dark] .brand-default { filter: brightness(0) invert(1); }

/* Ikon persegi hanya dipakai saat sidebar menciut jadi rel. */
.brand-mark { display: none; }

.sidebar-nav { flex: 1 1 auto; overflow-y: auto; padding: 1rem; }

.nav-group + .nav-group { margin-top: 1.5rem; }

.nav-group-title {
    padding: 0 .75rem;
    margin-bottom: .5rem;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
}
.nav-group-title.text-op { color: #2563eb; }
.nav-group-title.text-manage { color: #8b5cf6; }
.nav-group-title.text-resident { color: #d97706; }

.nav-item-link {
    display: flex; align-items: center; gap: .75rem;
    padding: .65rem .9rem;
    margin-bottom: .125rem;
    border-radius: .8rem;
    font-size: .875rem;
    font-weight: 500;
    color: var(--hd-muted-foreground);
    text-decoration: none;
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.nav-item-link svg { width: 1.25rem; height: 1.25rem; flex-shrink: 0; }
.nav-item-link:hover { color: var(--hd-foreground); background: var(--hd-muted); }
.nav-item-link.active { color: var(--hd-primary-strong); background: var(--hd-primary-soft); font-weight: 600; }
.nav-item-link .nav-count {
    margin-left: auto;
    font-size: .68rem; font-weight: 700;
    padding: .15rem .5rem;
    border-radius: 999px;
    background: rgba(245, 158, 11, .18);
    color: #b45309;
}
[data-bs-theme=dark] .nav-item-link .nav-count { color: #fbbf24; }

.sidebar-user {
    flex-shrink: 0;
    border-top: 1px solid var(--hd-border);
    padding: .9rem 1rem;
    display: flex; align-items: center; gap: .7rem;
}
.sidebar-user .avatar {
    width: 2.4rem; height: 2.4rem;
    border-radius: .8rem;
    background: var(--hd-primary-soft);
    color: var(--hd-primary-strong);
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700;
}
.sidebar-user .u-name { font-size: .82rem; font-weight: 600; line-height: 1.2; }
.sidebar-user .u-role { font-size: .68rem; color: var(--hd-muted-foreground); }

/* --- topbar --- */

.app-topbar {
    position: sticky; top: 0; z-index: 1030;
    height: 4.25rem;
    display: flex; align-items: center; gap: .75rem;
    padding: 0 1rem;
    background: var(--hd-topbar-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--hd-border);
}
@media (min-width: 992px) { .app-topbar { padding: 0 1.5rem; } }

.topbar-btn {
    width: 2.5rem; height: 2.5rem; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--hd-border);
    border-radius: .8rem;
    background: var(--hd-card);
    color: var(--hd-muted-foreground);
    transition: color .15s, background .15s;
}
.topbar-btn:hover { color: var(--hd-foreground); background: var(--hd-muted); }
.topbar-btn svg { width: 1.15rem; height: 1.15rem; }

.topbar-title { font-weight: 700; font-size: 1rem; letter-spacing: -.01em; }

.topbar-menu {
    position: absolute; right: 0; top: calc(100% + .5rem);
    min-width: 11rem;
    background: var(--hd-card);
    border: 1px solid var(--hd-border);
    border-radius: .9rem;
    box-shadow: var(--hd-shadow-pop);
    padding: .35rem;
    z-index: 1050;
}
.topbar-menu .menu-link {
    display: flex; align-items: center; gap: .6rem;
    width: 100%;
    padding: .5rem .7rem;
    border: 0; background: none;
    border-radius: .6rem;
    font-size: .84rem;
    color: var(--hd-muted-foreground);
    text-decoration: none;
    transition: background .15s, color .15s;
    text-align: left;
}
.topbar-menu .menu-link:hover { background: var(--hd-muted); color: var(--hd-foreground); }
.topbar-menu .menu-link.active { color: var(--hd-primary-strong); font-weight: 600; }
.topbar-menu .menu-link svg { width: 1rem; height: 1rem; flex-shrink: 0; }
.topbar-menu hr { margin: .35rem .25rem; border-color: var(--hd-border); opacity: 1; }

.app-content { padding: 1.25rem 1rem 2.5rem; }
@media (min-width: 992px) { .app-content { padding: 1.75rem 1.75rem 3rem; } }

/* ============================================================
   Re-skin komponen Bootstrap yang dipakai halaman-halaman
   ============================================================ */

.card {
    --bs-card-bg: var(--hd-card);
    --bs-card-border-color: var(--hd-border);
    border-radius: var(--hd-radius);
    box-shadow: var(--hd-shadow-card);
}
.card.shadow-sm { box-shadow: var(--hd-shadow-card) !important; }
.card-header {
    background: transparent;
    border-bottom-color: var(--hd-border);
    padding: .9rem 1.25rem;
    font-weight: 600;
}
.card-footer { background: transparent; border-top-color: var(--hd-border); }

/* Kartu statistik dashboard */
.stat-card .card-body { padding: 1rem 1.1rem; }
.stat-icon {
    width: 2.6rem; height: 2.6rem; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: .8rem;
}
.stat-icon svg { width: 1.25rem; height: 1.25rem; }
.stat-icon--secondary { background: var(--hd-muted); color: var(--hd-muted-foreground); }
.stat-icon--success { background: rgba(16, 185, 129, .12); color: #059669; }
.stat-icon--danger { background: rgba(239, 68, 68, .12); color: #dc2626; }
.stat-icon--warning { background: rgba(245, 158, 11, .15); color: #b45309; }
.stat-icon--primary { background: rgba(37, 99, 235, .12); color: #2563eb; }
.stat-icon--info { background: rgba(139, 92, 246, .12); color: #7c3aed; }
[data-bs-theme=dark] .stat-icon--success { color: #34d399; }
[data-bs-theme=dark] .stat-icon--danger { color: #f87171; }
[data-bs-theme=dark] .stat-icon--warning { color: #fbbf24; }
[data-bs-theme=dark] .stat-icon--primary { color: #60a5fa; }
[data-bs-theme=dark] .stat-icon--info { color: #a78bfa; }
.stat-label { font-size: .72rem; color: var(--hd-muted-foreground); font-weight: 600; letter-spacing: .02em; }
.stat-value { font-size: 1.25rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.25; }

/* Tabel */
.table { --bs-table-border-color: var(--hd-border); }
.table > thead th {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 700;
    color: var(--hd-muted-foreground);
    background: var(--hd-muted) !important;
    border-bottom: 0;
    padding-top: .65rem; padding-bottom: .65rem;
    white-space: nowrap;
}
.table > :not(caption) > * > * { padding: .6rem .75rem; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: var(--hd-muted); }
.table > tfoot th { background: var(--hd-muted) !important; }

/* Badge -> chip lembut */
.badge { font-weight: 600; border-radius: 999px; padding: .32em .7em; letter-spacing: .01em; }
.badge.text-bg-success { background: rgba(16, 185, 129, .13) !important; color: #059669 !important; }
.badge.text-bg-danger { background: rgba(239, 68, 68, .13) !important; color: #dc2626 !important; }
.badge.text-bg-warning { background: rgba(245, 158, 11, .16) !important; color: #b45309 !important; }
.badge.text-bg-info { background: rgba(14, 165, 233, .13) !important; color: #0284c7 !important; }
.badge.text-bg-primary { background: var(--hd-primary-soft) !important; color: var(--hd-primary-strong) !important; }
.badge.text-bg-secondary { background: var(--hd-muted) !important; color: var(--hd-muted-foreground) !important; }
.badge.text-bg-light { background: var(--hd-muted) !important; color: var(--hd-muted-foreground) !important; border-color: var(--hd-border) !important; }
[data-bs-theme=dark] .badge.text-bg-success { color: #34d399 !important; }
[data-bs-theme=dark] .badge.text-bg-danger { color: #f87171 !important; }
[data-bs-theme=dark] .badge.text-bg-warning { color: #fbbf24 !important; }
[data-bs-theme=dark] .badge.text-bg-info { color: #38bdf8 !important; }

/* Tombol */
.btn { border-radius: .75rem; font-weight: 600; }
.btn-sm { border-radius: .6rem; }
.btn-primary {
    --bs-btn-bg: var(--hd-primary);
    --bs-btn-border-color: var(--hd-primary);
    --bs-btn-hover-bg: #1d4ed8;
    --bs-btn-hover-border-color: #1d4ed8;
    --bs-btn-active-bg: #1e40af;
    --bs-btn-active-border-color: #1e40af;
    --bs-btn-disabled-bg: var(--hd-primary);
    --bs-btn-disabled-border-color: var(--hd-primary);
    box-shadow: 0 6px 16px -8px rgba(37, 99, 235, .6);
}
.btn-success {
    --bs-btn-bg: #059669;
    --bs-btn-border-color: #059669;
    --bs-btn-hover-bg: #047857;
    --bs-btn-hover-border-color: #047857;
    --bs-btn-active-bg: #047857;
    --bs-btn-active-border-color: #047857;
}
.btn-outline-secondary { --bs-btn-color: var(--hd-muted-foreground); --bs-btn-border-color: var(--hd-border); }
.btn-outline-primary {
    --bs-btn-color: var(--hd-primary-strong);
    --bs-btn-border-color: var(--hd-primary);
    --bs-btn-hover-bg: var(--hd-primary);
    --bs-btn-hover-border-color: var(--hd-primary);
}

/* Form */
.form-control, .form-select {
    border-radius: .7rem;
    border-color: var(--hd-border);
    background-color: var(--hd-card);
    padding: .5rem .85rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--hd-primary);
    box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .18);
}
.form-check-input:checked { background-color: var(--hd-primary); border-color: var(--hd-primary); }
.form-check-input:focus { box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .18); border-color: var(--hd-primary); }
.form-label { font-size: .82rem; font-weight: 600; margin-bottom: .35rem; }
.form-text { font-size: .74rem; }

/* Alert */
.alert { border-radius: var(--hd-radius); border: 1px solid var(--hd-border); }
.alert-success { background: rgba(16, 185, 129, .1); border-color: rgba(16, 185, 129, .35); color: #047857; }
.alert-danger { background: rgba(239, 68, 68, .09); border-color: rgba(239, 68, 68, .3); color: #b91c1c; }
.alert-warning { background: rgba(245, 158, 11, .1); border-color: rgba(245, 158, 11, .35); color: #92400e; }
.alert-info { background: rgba(14, 165, 233, .1); border-color: rgba(14, 165, 233, .3); color: #075985; }
.alert-light { background: var(--hd-muted); color: var(--hd-muted-foreground); }
[data-bs-theme=dark] .alert-success { color: #6ee7b7; }
[data-bs-theme=dark] .alert-danger { color: #fca5a5; }
[data-bs-theme=dark] .alert-warning { color: #fcd34d; }
[data-bs-theme=dark] .alert-info { color: #7dd3fc; }

/* Modal (dirender manual oleh Livewire) */
.modal-open-manual { display: block; background: rgba(2, 6, 23, .55); backdrop-filter: blur(3px); }
.modal-content {
    border-radius: 1.1rem;
    border: 1px solid var(--hd-border);
    background: var(--hd-card);
    box-shadow: var(--hd-shadow-pop);
}
.modal-header, .modal-footer { border-color: var(--hd-border); }

/* Pagination (livewire::bootstrap) */
.pagination { --bs-pagination-border-radius: .7rem; gap: .25rem; }
.page-link {
    border-radius: .6rem !important;
    border-color: transparent;
    color: var(--hd-muted-foreground);
    background: transparent;
    font-size: .85rem;
    font-weight: 600;
}
.page-link:hover { background: var(--hd-muted); color: var(--hd-foreground); }
.page-item.active .page-link { background: var(--hd-primary); border-color: var(--hd-primary); color: #fff; }
.page-item.disabled .page-link { background: transparent; }

/* Dropdown Bootstrap */
.dropdown-menu {
    border-radius: .9rem;
    border-color: var(--hd-border);
    box-shadow: var(--hd-shadow-pop);
    background: var(--hd-card);
}

/* Util kecil */
.text-body-secondary { color: var(--hd-muted-foreground) !important; }
[wire\:loading] { opacity: .6; }
code { color: var(--hd-primary-strong); }

/* Scrollbar halus */
.sidebar-nav::-webkit-scrollbar, .table-responsive::-webkit-scrollbar { width: 6px; height: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb, .table-responsive::-webkit-scrollbar-thumb {
    background: var(--hd-border); border-radius: 999px;
}

/* Layar sempit */
@media (max-width: 575.98px) {
    .app-content { padding: 1rem .75rem 2rem; }
    .stat-value { font-size: 1.05rem; }
    .card-header { padding: .75rem 1rem; }
}

/* ============================================================
   Halaman login (layout guest)
   ============================================================ */

.auth-body {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 1.5rem;
    background:
        radial-gradient(60rem 30rem at 110% -10%, rgba(37, 99, 235, .12), transparent 60%),
        radial-gradient(50rem 28rem at -20% 110%, rgba(245, 158, 11, .08), transparent 60%),
        var(--hd-background);
}
.auth-card {
    width: 100%; max-width: 26rem;
    background: var(--hd-card);
    border: 1px solid var(--hd-border);
    border-radius: 1.25rem;
    box-shadow: var(--hd-shadow-pop);
    padding: 2rem;
}
.auth-logo { height: 46px; width: auto; max-width: 100%; }

/* ============================================================
   Navigasi bawah (mobile) — pola yang sama dengan panel Sistahid
   ============================================================ */

.app-bottomnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1035;
    height: 4rem;
    display: flex; align-items: center; justify-content: space-around;
    padding: 0 .25rem;
    background: var(--hd-card);
    border-top: 1px solid var(--hd-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 -4px 12px -2px rgba(2, 6, 23, .08);
    padding-bottom: env(safe-area-inset-bottom);
}

.bottomnav-item {
    flex: 1 1 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: .15rem;
    height: 100%;
    text-decoration: none;
    color: var(--hd-muted-foreground);
    font-size: .62rem; line-height: 1;
    transition: color .15s;
}
.bottomnav-item svg { width: 1.25rem; height: 1.25rem; }
.bottomnav-item.active { color: var(--hd-primary-strong); font-weight: 700; }

.bottomnav-fab-slot {
    position: relative; flex: 1 1 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 100%;
}
.bottomnav-fab {
    position: absolute; top: -1.3rem;
    width: 3.3rem; height: 3.3rem;
    border-radius: 999px;
    border: 4px solid var(--hd-background);
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 16px -4px rgba(37, 99, 235, .5);
    z-index: 2;
    transition: transform .15s, background .2s, box-shadow .2s;
}
.bottomnav-fab:active { transform: scale(.9); }
.bottomnav-fab svg { width: 1.4rem; height: 1.4rem; }
.bottomnav-fab.is-open {
    background: linear-gradient(135deg, #f43f5e, #ec4899);
    box-shadow: 0 8px 16px -4px rgba(244, 63, 94, .5);
}
.bottomnav-fab-label {
    margin-top: 1.65rem;
    font-size: .62rem; line-height: 1;
    color: var(--hd-muted-foreground);
}
.bottomnav-fab-label.is-open { color: var(--hd-primary-strong); font-weight: 700; }

/* Laci menu penuh layar yang muncul dari bawah */
.mobile-menu {
    position: fixed; inset: 0; z-index: 1036;
    display: flex; flex-direction: column; justify-content: flex-end;
    padding: 0 .75rem 5.75rem;
    background: rgba(2, 6, 23, .55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.mobile-menu-card {
    background: var(--hd-card);
    border: 1px solid var(--hd-border);
    border-radius: 1.5rem;
    padding: 1.1rem;
    box-shadow: var(--hd-shadow-pop);
    max-height: 72vh;
    overflow-y: auto;
}
.mobile-menu-head {
    display: flex; align-items: center; justify-content: space-between;
    padding-bottom: .85rem; margin-bottom: .85rem;
    border-bottom: 1px solid var(--hd-border);
}
.mobile-menu-group + .mobile-menu-group { margin-top: 1.1rem; }
.mobile-menu-group-title {
    display: flex; align-items: center; gap: .4rem;
    padding: 0 .25rem; margin-bottom: .6rem;
    font-size: .66rem; font-weight: 700;
    letter-spacing: .12em; text-transform: uppercase;
}
.mobile-menu-group-title .dot { width: .45rem; height: .45rem; border-radius: 999px; background: currentColor; }
.mobile-menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.mobile-menu-tile {
    display: flex; flex-direction: column; align-items: center; text-align: center;
    padding: .55rem .2rem;
    border: 0; background: none;
    border-radius: 1rem;
    text-decoration: none;
    color: var(--hd-muted-foreground);
    font-size: .66rem; font-weight: 600; line-height: 1.25;
    transition: background .15s;
}
.mobile-menu-tile:hover { background: var(--hd-muted); }
.mobile-menu-tile .tile-icon {
    width: 3rem; height: 3rem;
    border-radius: 1rem;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: .4rem;
    background: var(--hd-muted);
    transition: transform .15s;
}
.mobile-menu-tile .tile-icon svg { width: 1.4rem; height: 1.4rem; }
.mobile-menu-tile:hover .tile-icon { transform: scale(1.08); }
.mobile-menu-tile.active { color: var(--hd-primary-strong); }
.mobile-menu-tile.active .tile-icon { background: var(--hd-primary-soft); color: var(--hd-primary-strong); }
.mobile-menu-tile .tile-badge {
    position: absolute; transform: translate(1.05rem, -.35rem);
    font-size: .6rem; font-weight: 700;
    padding: .05rem .35rem; border-radius: 999px;
    background: #f59e0b; color: #fff;
}

/* Ruang supaya isi halaman tidak tertutup navigasi bawah */
@media (max-width: 991.98px) {
    .app-content { padding-bottom: 6rem; }
}

/* ============================================================
   Tabel -> kartu di layar sempit
   ------------------------------------------------------------
   Label tiap sel diambil otomatis dari <thead> oleh JS di layout,
   jadi kolom baru tidak perlu disetel manual di sini.
   ============================================================ */

@media (max-width: 767.98px) {
    .table-cards thead { display: none; }

    .table-cards,
    .table-cards tbody,
    .table-cards tfoot,
    .table-cards tr,
    .table-cards td,
    .table-cards tfoot th { display: block; width: 100%; }

    .table-cards tbody tr {
        border: 1px solid var(--hd-border);
        border-radius: 1rem;
        background: var(--hd-card);
        padding: .7rem .9rem;
        margin-bottom: .6rem;
    }
    .table-cards.table-hover > tbody > tr:hover > * { --bs-table-bg-state: transparent; }

    .table-cards tbody td {
        display: flex; align-items: flex-start; justify-content: space-between;
        gap: 1rem;
        padding: .28rem 0 !important;
        border: 0 !important;
        text-align: right;
    }
    .table-cards tbody td::before {
        content: attr(data-label);
        flex: 0 0 auto;
        text-align: left;
        font-size: .72rem; font-weight: 600;
        color: var(--hd-muted-foreground);
        white-space: nowrap;
    }
    /* Sel tanpa label (mis. baris kosong ber-colspan) tampil penuh */
    .table-cards tbody td:not([data-label])::before,
    .table-cards tbody td[data-label='']::before { content: none; }
    .table-cards tbody td[colspan] {
        display: block;
        text-align: center;
    }
    .table-cards tbody td[colspan]::before { content: none; }

    .table-cards tfoot tr {
        border: 1px solid var(--hd-border);
        border-radius: 1rem;
        background: var(--hd-muted);
        padding: .6rem .9rem;
    }
    .table-cards tfoot th {
        display: flex; justify-content: space-between;
        padding: .2rem 0 !important;
        border: 0 !important;
        background: transparent !important;
        text-align: left !important;
        text-transform: none; letter-spacing: normal;
    }
    .table-cards tfoot th:empty { display: none; }

    /* Wrapper tidak perlu menggulung lagi karena sudah berbentuk kartu */
    .table-responsive:has(.table-cards) { overflow-x: visible; }
}

/* ============================================================
   Halaman welcome (landing publik di "/")
   ============================================================ */

body.landing { overflow-x: hidden; }

.landing-nav {
    position: sticky; top: 0; z-index: 1030;
    padding: .8rem 0;
    background: var(--hd-topbar-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--hd-border);
}

.landing-hero {
    padding: 3.5rem 0 2.5rem;
    background:
        radial-gradient(48rem 26rem at 100% -15%, rgba(37, 99, 235, .14), transparent 62%),
        radial-gradient(42rem 24rem at -15% 105%, rgba(245, 158, 11, .10), transparent 62%);
}
@media (min-width: 992px) { .landing-hero { padding: 5rem 0 4rem; } }

.landing-pill {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .35rem .85rem;
    border-radius: 999px;
    border: 1px solid var(--hd-border);
    background: var(--hd-card);
    font-size: .74rem; font-weight: 600;
    color: var(--hd-muted-foreground);
}
.pulse-dot {
    width: .5rem; height: .5rem; border-radius: 999px;
    background: #10b981;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, .6);
    animation: hd-pulse 2s infinite;
}
@keyframes hd-pulse {
    70% { box-shadow: 0 0 0 .45rem rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.landing-title {
    font-size: clamp(2rem, 6vw, 3.25rem);
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1.12;
}
.landing-title .grad {
    background: linear-gradient(100deg, #2563eb, #0ea5e9 55%, #f59e0b);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}
.landing-lead {
    margin-top: 1rem;
    font-size: 1.02rem;
    color: var(--hd-muted-foreground);
    max-width: 34rem;
}

.landing-preview {
    background: var(--hd-card);
    border: 1px solid var(--hd-border);
    border-radius: 1.5rem;
    padding: 1.25rem;
    box-shadow: var(--hd-shadow-pop);
}
.landing-preview .dot-red,
.landing-preview .dot-amber,
.landing-preview .dot-green {
    width: .6rem; height: .6rem; border-radius: 999px; display: inline-block;
}
.landing-preview .dot-red { background: #f87171; }
.landing-preview .dot-amber { background: #fbbf24; }
.landing-preview .dot-green { background: #34d399; }

.preview-card {
    border: 1px solid var(--hd-border);
    border-radius: 1.1rem;
    padding: 1.1rem;
    background: var(--hd-background);
}
.preview-strip {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem;
    text-align: center;
}
.preview-strip > div {
    border: 1px solid var(--hd-border);
    border-radius: 1rem;
    padding: .7rem .35rem;
    background: var(--hd-background);
}
.strip-value { font-weight: 800; font-size: .95rem; letter-spacing: -.02em; }
.strip-label { font-size: .66rem; color: var(--hd-muted-foreground); }

.landing-section { padding: 2.75rem 0; }
@media (min-width: 992px) { .landing-section { padding: 4rem 0; } }

.landing-h2 {
    font-size: clamp(1.4rem, 3.4vw, 2rem);
    font-weight: 800;
    letter-spacing: -.02em;
    margin-bottom: .35rem;
}
.landing-sub { color: var(--hd-muted-foreground); margin-bottom: 0; }

.landing-card {
    background: var(--hd-card);
    border: 1px solid var(--hd-border);
    border-radius: 1.5rem;
    padding: 1.5rem;
    box-shadow: var(--hd-shadow-card);
    transition: transform .18s, box-shadow .18s;
}
.landing-card:hover { transform: translateY(-3px); box-shadow: var(--hd-shadow-pop); }
.landing-card-title { font-size: 1.1rem; font-weight: 700; margin: .85rem 0 .6rem; }

.landing-icon {
    width: 3rem; height: 3rem;
    border-radius: 1rem;
    display: inline-flex; align-items: center; justify-content: center;
}
.landing-icon svg { width: 1.5rem; height: 1.5rem; }
.landing-icon--blue { background: rgba(37, 99, 235, .12); color: #2563eb; }
.landing-icon--violet { background: rgba(139, 92, 246, .12); color: #7c3aed; }
[data-bs-theme=dark] .landing-icon--blue { color: #60a5fa; }
[data-bs-theme=dark] .landing-icon--violet { color: #a78bfa; }

.landing-list { margin: 0; padding-left: 1.1rem; color: var(--hd-muted-foreground); }
.landing-list li { margin-bottom: .45rem; }
.landing-list li::marker { color: var(--hd-primary); }

.landing-step {
    background: var(--hd-card);
    border: 1px solid var(--hd-border);
    border-radius: 1.5rem;
    padding: 1.5rem;
    box-shadow: var(--hd-shadow-card);
}
.step-no {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2.4rem; height: 2.4rem;
    border-radius: .9rem;
    background: var(--hd-primary-soft);
    color: var(--hd-primary-strong);
    font-weight: 800;
}

.landing-cta {
    text-align: center;
    border: 1px solid var(--hd-border);
    border-radius: 1.75rem;
    padding: 2.75rem 1.5rem;
    background:
        radial-gradient(30rem 14rem at 50% 0%, rgba(37, 99, 235, .12), transparent 70%),
        var(--hd-card);
    box-shadow: var(--hd-shadow-card);
}

.landing-footer {
    border-top: 1px solid var(--hd-border);
    padding: 1.5rem 0;
    background: var(--hd-card);
}

/* Banner ajakan pasang aplikasi (muncul di laci menu bila browser mengizinkan) */
.install-banner {
    display: flex; align-items: center; gap: .7rem;
    padding: .7rem .8rem;
    margin-bottom: 1rem;
    border-radius: 1rem;
    border: 1px solid rgba(37, 99, 235, .3);
    background: var(--hd-primary-soft);
}
.install-icon {
    width: 2.2rem; height: 2.2rem; flex-shrink: 0;
    border-radius: .75rem;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--hd-primary);
    color: #fff;
}
.install-icon svg { width: 1.1rem; height: 1.1rem; }

/* Titik pada lonceng: penanda halus bahwa notifikasi masih bisa dinyalakan. */
.bell-dot {
    position: absolute; top: .35rem; right: .35rem;
    width: .5rem; height: .5rem;
    border-radius: 999px;
    background: #f59e0b;
    border: 2px solid var(--hd-card);
}

/* ============================================================
   Tombol seragam (<x-btn>)
   ============================================================ */

.hd-btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    white-space: nowrap;
}

.hd-icon { width: 1.05rem; height: 1.05rem; flex-shrink: 0; }
.btn-lg .hd-icon { width: 1.25rem; height: 1.25rem; }

/* Di layar sempit tombol menyusut jadi ikon saja. Kolom Aksi pada tabel
   Rumah dan Pengguna memuat tiga sampai empat tombol per baris; ikon dan
   teks sekaligus membuat tabelnya meluber. Atribut title tetap ada, jadi
   yang hilang tulisannya saja -- bukan artinya. */
@media (max-width: 767.98px) {
    .hd-btn:not(.hd-btn-wide) .hd-btn-label { display: none; }
    .hd-btn:not(.hd-btn-wide) { gap: 0; padding-left: .5rem; padding-right: .5rem; }
    /* Tombol tanpa ikon tidak boleh ikut kehilangan teksnya -- yang tersisa
       hanya kotak kosong tanpa petunjuk apa pun. */
    .hd-btn:not(:has(.hd-icon)) .hd-btn-label { display: inline; }
}

/* ============================================================
   Toast (<x-toasts>)
   ============================================================ */

.toast-layer {
    position: fixed;
    top: .85rem;
    left: 50%;
    transform: translateX(-50%);
    /* Di atas modal Bootstrap (1055) -- pesan galat dari dalam modal harus
       tetap terbaca, bukan tertimbun oleh modal yang memunculkannya. */
    z-index: 1090;
    width: min(30rem, calc(100vw - 1.5rem));
    display: flex;
    flex-direction: column;
    gap: .5rem;
    /* KUNCI: lapisannya tembus klik. Pesan yang melayang di tengah atas
       menutupi judul halaman dan tombolnya; tanpa ini, sekadar menunggu
       toast hilang jadi syarat sebelum bisa menekan apa pun di bawahnya. */
    pointer-events: none;
}

.toast-item {
    /* Toast-nya sendiri tetap menerima klik, supaya bisa ditutup lebih awal. */
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    padding: .7rem .85rem;
    border: 1px solid var(--hd-border);
    border-left-width: 4px;
    border-radius: .85rem;
    background: var(--hd-card);
    box-shadow: var(--hd-shadow-pop);
    font-size: .875rem;
    line-height: 1.4;
}

.toast-ikon { display: inline-flex; padding-top: .05rem; }
.toast-ikon .hd-icon { width: 1.15rem; height: 1.15rem; }
.toast-pesan { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }

.toast-close {
    flex-shrink: 0;
    border: 0;
    background: none;
    padding: 0;
    display: inline-flex;
    color: var(--hd-muted-foreground);
}
.toast-close .hd-icon { width: .9rem; height: .9rem; }
.toast-close:hover { color: var(--hd-foreground); }

.toast-success { border-left-color: #16a34a; }
.toast-success .toast-ikon { color: #16a34a; }
.toast-error { border-left-color: #dc2626; }
.toast-error .toast-ikon { color: #dc2626; }
.toast-warning { border-left-color: #d97706; }
.toast-warning .toast-ikon { color: #d97706; }
.toast-info { border-left-color: var(--hd-primary); }
.toast-info .toast-ikon { color: var(--hd-primary); }

[data-bs-theme=dark] .toast-success .toast-ikon { color: #4ade80; }
[data-bs-theme=dark] .toast-error .toast-ikon { color: #f87171; }
[data-bs-theme=dark] .toast-warning .toast-ikon { color: #fbbf24; }

.toast-masuk { transition: opacity .18s ease-out, transform .18s ease-out; }
.toast-keluar { transition: opacity .15s ease-in, transform .15s ease-in; }
.toast-awal { opacity: 0; transform: translateY(-.5rem); }

@media (prefers-reduced-motion: reduce) {
    .toast-masuk, .toast-keluar { transition: none; }
    .toast-awal { transform: none; }
}

/* Lonceng yang perangkatnya sudah berlangganan: menguning, bukan menghilang.
   Menghilangkannya membuat perangkat aktif tidak punya penanda apa pun, dan
   satu-satunya jalan mematikan notifikasi tersembunyi di halaman Profil. */
.topbar-btn.bell-on {
    color: #b45309;
    background: rgba(245, 158, 11, .16);
    border-color: rgba(245, 158, 11, .35);
}
.topbar-btn.bell-on:hover { background: rgba(245, 158, 11, .26); }

[data-bs-theme=dark] .topbar-btn.bell-on {
    color: #fbbf24;
    background: rgba(245, 158, 11, .2);
}

/* ============================================================
   Halaman dokumentasi (/docs/panduan, /docs/sistem)
   ============================================================ */

.docs-page { max-width: 56rem; }

.docs-section {
    background: var(--hd-card);
    border: 1px solid var(--hd-border);
    border-radius: var(--hd-radius);
    box-shadow: var(--hd-shadow-card);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
}
.docs-section h2 { scroll-margin-top: 5rem; }
.docs-bab {
    border-bottom: 2px solid var(--hd-primary-soft);
    padding-bottom: .5rem;
}

.columns-2 { columns: 2 14rem; }

.docs-shot { margin: .75rem 0 1.25rem; }
.docs-shot img { max-height: 480px; }
.docs-shot-missing {
    display: flex; align-items: center; gap: .6rem;
    padding: 1.25rem 1rem;
    border-style: dashed !important;
    color: var(--hd-muted-foreground);
    font-size: .82rem;
    background: var(--hd-muted);
}
.docs-shot-missing .hd-icon { width: 1.4rem; height: 1.4rem; flex-shrink: 0; }

.docs-table {
    border: 1px solid var(--hd-border);
    border-radius: .75rem;
    padding: .6rem .9rem;
    background: var(--hd-card);
}
.docs-table summary { cursor: pointer; }
.docs-table summary::marker { color: var(--hd-muted-foreground); }

/* Pasangan tangkapan desktop + HP pada panduan. */
.docs-shot-pair {
    display: flex;
    gap: .9rem;
    align-items: flex-start;
    flex-wrap: wrap;
}
.docs-shot-pair .pasangan-desktop { flex: 1 1 22rem; min-width: 0; }
.docs-shot-pair .pasangan-hp { flex: 0 0 auto; }
.docs-shot-pair .pasangan-hp img { max-height: 480px; }
