/* ============================================================
   Hasil Hermes Hotspot - Stylesheet
   Tema: sidebar gelap + konten terang (ala Mikhmon), tanpa CDN
   ============================================================ */

:root {
    --sidebar: #0f172a;
    --sidebar-2: #1e293b;
    --accent: #0ea5e9;
    --accent-2: #14b8a6;
    --bg: #f1f5f9;
    --card: #ffffff;
    --card-2: #f8fafc;
    --text: #1e293b;
    --muted: #64748b;
    --border: #e2e8f0;
    --danger: #ef4444;
    --ok: #22c55e;
    --warn: #f59e0b;
    --radius: 14px;
    --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 14px rgba(15, 23, 42, .05);
    --code-bg: #eef2f7;
    --hover: #f8fafc;
}

/* ---------------- Dark mode ---------------- */
:root[data-theme="dark"] {
    --sidebar: #020617;
    --sidebar-2: #1e293b;
    --accent: #38bdf8;
    --accent-2: #2dd4bf;
    --bg: #0b1120;
    --card: #111827;
    --card-2: #0f1626;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --border: #1f2937;
    --danger: #f87171;
    --ok: #34d399;
    --warn: #fbbf24;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .3);
    --code-bg: #1e293b;
    --hover: #0f1b2e;
    color-scheme: dark;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14.5px;
    line-height: 1.55;
}

a { color: var(--accent); text-decoration: none; }
code {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1px 6px;
    font-size: 12.5px;
    font-family: Consolas, "Courier New", monospace;
}

/* ---------------- Layout ---------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    background: linear-gradient(180deg, var(--sidebar), #0b1222);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 50;
    transition: transform .25s ease;
}

.brand {
    display: flex; align-items: center; gap: 12px;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
    position: relative;
}
.drawer-close { display: none; margin-left: auto; color: #94a3b8; }
.drawer-close svg { width: 20px; height: 20px; }
.brand-logo {
    width: 40px; height: 40px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff; font-weight: 800; font-size: 15px;
    display: flex; align-items: center; justify-content: center;
    letter-spacing: .5px;
    box-shadow: 0 4px 12px rgba(14, 165, 233, .35);
}
.brand-logo.lg { width: 56px; height: 56px; font-size: 20px; border-radius: 16px; margin: 0 auto 12px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text strong { color: #fff; font-size: 15px; }
.brand-text span { font-size: 11.5px; color: #94a3b8; }

.nav { flex: 1; padding: 14px 10px; overflow-y: auto; }
.nav-link {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 13px;
    margin-bottom: 3px;
    border-radius: 10px;
    color: #cbd5e1;
    font-weight: 500;
    transition: background .15s, color .15s;
}
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-link:hover { background: var(--sidebar-2); color: #fff; }
.nav-link.active {
    background: linear-gradient(90deg, rgba(14, 165, 233, .22), rgba(20, 184, 166, .12));
    color: #fff;
    box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-foot { padding: 12px 10px; border-top: 1px solid rgba(255, 255, 255, .07); }
.sidebar-user {
    display: flex; align-items: center; gap: 10px;
    margin-top: 10px; padding: 4px 8px;
}
.avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: #fff; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.sidebar-user div:last-child { display: flex; flex-direction: column; line-height: 1.25; }
.sidebar-user strong { color: #fff; font-size: 13px; }
.sidebar-user span { font-size: 11px; color: #94a3b8; }

.main { flex: 1; margin-left: 240px; display: flex; flex-direction: column; min-height: 100vh; min-width: 0; }

.topbar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 14px 26px;
    display: flex; align-items: center; gap: 14px;
    position: sticky; top: 0; z-index: 40;
}
.page-title { font-size: 18px; font-weight: 700; flex: 1; }
.topbar-date { color: var(--muted); font-size: 13px; }

.content { padding: 24px 26px; flex: 1; max-width: 1200px; width: 100%; margin: 0 auto; }

.footer {
    padding: 14px 26px;
    text-align: center;
    color: var(--muted);
    font-size: 12.5px;
    border-top: 1px solid var(--border);
    background: var(--card);
}

.sidebar-backdrop { display: none; }

/* ---------------- Tombol ---------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 14px; font-weight: 600;
    cursor: pointer;
    transition: filter .15s, transform .05s, background .15s;
    font-family: inherit;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 3px 10px rgba(14, 165, 233, .3); }
.btn-ok { background: var(--ok); color: #fff; box-shadow: 0 3px 10px rgba(34, 197, 94, .3); }
.btn-danger { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.btn-ghost { background: var(--card); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }

.icon-btn {
    background: none; border: none; cursor: pointer;
    color: var(--muted); font-size: 20px; line-height: 1;
    padding: 6px 8px; border-radius: 8px;
}
.icon-btn:hover { background: var(--bg); color: var(--text); }
.menu-btn { display: none; }
.topbar-logout { display: none; }
.topbar-logout svg { width: 20px; height: 20px; }
.theme-toggle svg { width: 19px; height: 19px; }
.theme-toggle .ico-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .ico-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .ico-moon { display: inline; }
.brand-logo-img { width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0; box-shadow: 0 4px 12px rgba(14, 165, 233, .35); }

/* ---------------- Kartu & statistik ---------------- */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 22px;
}
.card-stat { display: flex; align-items: center; gap: 14px; padding: 18px 20px; margin-bottom: 0; }
.stat-icon {
    width: 48px; height: 48px; border-radius: 13px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.c-blue { background: #e0f2fe; color: #0284c7; }
.c-green { background: #dcfce7; color: #16a34a; }
.c-red { background: #fee2e2; color: #dc2626; }
.c-amber { background: #fef3c7; color: #d97706; }
.stat-label { display: block; font-size: 12px; color: var(--muted); }
.stat-value { display: block; font-size: 22px; font-weight: 800; letter-spacing: -.5px; }

.card-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
    margin-bottom: 14px;
}
.card-head h2 { font-size: 16px; font-weight: 700; }
.head-actions { display: flex; gap: 8px; }
.count-pill {
    background: var(--accent); color: #fff;
    font-size: 12px; font-weight: 700;
    padding: 2px 9px; border-radius: 999px;
    margin-left: 6px; vertical-align: 2px;
}

/* ---------------- Toolbar & form ---------------- */
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; align-items: center; }
.search-form { display: flex; gap: 8px; flex: 1; min-width: 260px; }
.search-form input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    background: var(--card);
}
input, select, textarea {
    width: 100%;
    padding: 10px 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    background: var(--card);
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, .15);
}
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--muted); }
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0 16px;
}
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.form-stack { max-width: 460px; }
.inline-form { display: inline; }
.muted { color: var(--muted); }

/* ---------------- Tabel ---------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
    text-align: left;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--muted);
    padding: 10px 12px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
.table td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table tbody tr:hover { background: var(--hover); }
.table .empty { text-align: center; color: var(--muted); padding: 34px 12px; }
.th-act { text-align: right; }
.th-act { white-space: nowrap; }
.row-invalid td { background: #fef2f2; }
.table-info td { border-bottom: 1px solid var(--border); padding: 9px 4px; }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
}
.badge-ok { background: #dcfce7; color: #15803d; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-warn { background: #fef3c7; color: #b45309; }
.btn-warn { background: #fef3c7; color: #b45309; border-color: #fcd34d; }
.badge-muted { background: #e2e8f0; color: #475569; }
.inline-check { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.inline-check input { width: auto; margin: 0; }

/* ---------------- Pagination ---------------- */
.pagination { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.page-link {
    min-width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--card);
    color: var(--text);
    font-size: 13.5px; font-weight: 600;
}
.page-link:hover { border-color: var(--accent); color: var(--accent); }
.page-link.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------------- Alert ---------------- */
.alert {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 12px 16px;
    border-radius: 11px;
    margin-bottom: 18px;
    font-size: 14px;
    font-weight: 500;
    animation: slideIn .25s ease;
}
.alert-ok { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert-err { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-x { background: none; border: none; font-size: 18px; cursor: pointer; color: inherit; line-height: 1; }
:root[data-theme="dark"] .alert-ok { background: #052e1a; color: #6ee7b7; border-color: #14532d; }
:root[data-theme="dark"] .alert-err { background: #3b0d0d; color: #fca5a5; border-color: #7f1d1d; }
@keyframes slideIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------------- Modal ---------------- */
.modal {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, .55);
    display: flex; align-items: center; justify-content: center;
    z-index: 100;
    padding: 20px;
}
.modal[hidden] { display: none; }
.modal-box {
    background: var(--card);
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 620px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(15, 23, 42, .3);
    animation: popIn .2s ease;
}
@keyframes popIn { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.modal-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px;
}
.modal-head h3 { font-size: 16px; }

/* ---------------- Login ---------------- */
.login-body {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #134e4a 60%, #0e7490 100%);
    padding: 20px;
}
.login-wrap { width: 100%; max-width: 400px; }
.login-card {
    background: var(--card);
    border-radius: 18px;
    padding: 34px 30px;
    box-shadow: 0 25px 60px rgba(2, 6, 23, .5);
}
.login-brand { text-align: center; margin-bottom: 22px; }
.login-logo { border-radius: 16px; box-shadow: 0 6px 16px rgba(14,165,233,.25); }
.login-brand h1 { font-size: 21px; margin-top: 10px; }
.login-brand p { color: var(--muted); font-size: 13px; }
.login-hint { text-align: center; margin-top: 18px; font-size: 12.5px; color: var(--muted); }

/* Password show/hide */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-toggle {
    position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
    background: none; border: none; cursor: pointer;
    color: var(--muted); padding: 6px; border-radius: 8px;
    display: flex; align-items: center;
}
.pw-toggle:hover { color: var(--accent); }
.pw-toggle svg { width: 19px; height: 19px; }
.pw-toggle .ico-eye-off { display: none; }
.pw-toggle.on .ico-eye { display: none; }
.pw-toggle.on .ico-eye-off { display: inline; }

/* ---------------- Dropzone ---------------- */
.dropzone {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 34px 20px;
    border: 2px dashed var(--border);
    border-radius: 14px;
    background: var(--card-2);
    cursor: pointer;
    text-align: center;
    transition: border-color .15s, background .15s;
    color: var(--text);
}
.dropzone:hover, .dropzone.drag {
    border-color: var(--accent);
    background: var(--hover);
}
.dropzone svg { width: 34px; height: 34px; color: var(--accent); margin-bottom: 4px; }

.stack { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }

/* ---------------- Accordion (Riwayat Akses per-akun) ---------------- */
.accordion { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.acc-item {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--card);
    transition: box-shadow .15s, border-color .15s;
}
.acc-item.open { border-color: var(--accent); box-shadow: 0 2px 10px rgba(14,165,233,.08); }
.acc-head {
    width: 100%;
    display: flex; align-items: center; gap: 10px;
    padding: 13px 15px;
    background: var(--card-2);
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 14.5px; font-weight: 600;
    color: var(--text);
    text-align: left;
    transition: background .15s;
}
.acc-head:hover { background: var(--hover); }
.acc-item.open .acc-head { background: var(--hover); }
.acc-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-meta { color: var(--muted); font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.acc-meta .count-pill { margin-left: 0; }
.acc-caret { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; transition: transform .2s; }
.acc-item.open .acc-caret { transform: rotate(180deg); color: var(--accent); }
.acc-body {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows .22s ease;
}
.acc-body > * { overflow: hidden; }
.acc-item.open .acc-body { grid-template-rows: 1fr; }
.acc-item.open .acc-body > * { padding: 4px 12px 12px; }

/* ---------------- PWA install prompt ---------------- */
.pwa-install {
    position: fixed;
    left: 14px; right: 14px; bottom: 14px;
    z-index: 70;
    display: flex; align-items: center; gap: 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(15,23,42,.22);
    padding: 13px 15px;
    animation: pwaUp .3s ease;
}
.pwa-install[hidden] { display: none; }
.pwa-install-logo { width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0; }
.pwa-install-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.pwa-install-text strong { font-size: 14.5px; }
.pwa-install-text span { font-size: 12px; color: var(--muted); }
.pwa-install-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
@keyframes pwaUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* Panduan pasang manual */
.pwa-guide {
    position: fixed; inset: 0;
    z-index: 110;
    background: rgba(15,23,42,.55);
    display: flex; align-items: flex-end; justify-content: center;
    padding: 0;
}
.pwa-guide[hidden] { display: none; }
.pwa-guide-box {
    background: var(--card);
    width: 100%;
    max-width: 480px;
    border-radius: 18px 18px 0 0;
    padding: 20px 20px calc(24px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -10px 40px rgba(15,23,42,.3);
    animation: pwaUp .25s ease;
}
.pwa-guide-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.pwa-guide-head img { border-radius: 9px; }
.pwa-guide-head strong { flex: 1; font-size: 16px; }
.pwa-guide-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; line-height: 1.5; }
.pwa-guide-steps li { padding-left: 4px; }

/* Bar install jangan menutupi bottom-nav di HP */
@media (max-width: 900px) {
    .pwa-install { bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }
}
@media (min-width: 901px) {
    .pwa-install { left: auto; right: 20px; max-width: 420px; }
    .pwa-guide { align-items: center; }
    .pwa-guide-box { border-radius: 18px; }
}

.tip {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    color: #0c4a6e;
    border-radius: 11px;
    padding: 13px 15px;
    font-size: 13px;
    margin-top: 16px;
}

/* ---------------- Bottom Tab Bar (Android, mobile only) ---------------- */
.bottom-nav { display: none; }
.bnav-item, .bnav-fab {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}

/* ---------------- Responsive ---------------- */
@media (max-width: 900px) {
    /* Sidebar berubah jadi drawer geser dari kiri (ala menu Android) */
    .sidebar {
        transform: translateX(-100%);
        width: 82%;
        max-width: 320px;
        border-top-right-radius: 20px;
        border-bottom-right-radius: 20px;
    }
    .sidebar.open { transform: translateX(0); box-shadow: 0 0 60px rgba(0,0,0,.45); }
    .sidebar-backdrop.show {
        display: block;
        position: fixed; inset: 0;
        background: rgba(15, 23, 42, .5);
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
        z-index: 45;
        animation: fadeIn .2s ease;
    }
    .drawer-close { display: inline-flex; }
    .main { margin-left: 0; }
    .menu-btn { display: inline-flex; }
    .topbar-logout { display: inline-flex; }
    .topbar-date { display: none; }
    .content {
        padding: 16px 14px;
        /* ruang untuk bottom nav + safe area */
        padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px));
    }
    .topbar {
        padding: 12px 14px;
        padding-top: calc(12px + env(safe-area-inset-top, 0px));
    }
    .page-title { font-size: 16.5px; }
    body { padding-bottom: 0; }

    /* Sembunyikan Logout di daftar drawer (sudah ada di app bar), tetap tampil di footer sidebar */
    .footer { padding-bottom: calc(14px + 74px + env(safe-area-inset-bottom, 0px)); }

    /* --- Bottom navigation bar --- */
    .bottom-nav {
        display: flex;
        position: fixed;
        left: 0; right: 0; bottom: 0;
        z-index: 60;
        background: var(--card);
        border-top: 1px solid var(--border);
        box-shadow: 0 -4px 20px rgba(15, 23, 42, .08);
        padding: 6px 6px 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        align-items: stretch;
    }
    .bnav-item, .bnav-fab {
        flex: 1;
        display: flex; flex-direction: column; align-items: center; justify-content: center;
        gap: 3px;
        padding: 7px 2px 9px;
        font-size: 10.5px; font-weight: 600;
        color: var(--muted);
        background: none; border: none; cursor: pointer;
        font-family: inherit;
        position: relative;
        transition: color .15s;
        border-radius: 12px;
    }
    .bnav-item svg, .bnav-fab svg { width: 22px; height: 22px; }
    .bnav-item span, .bnav-fab span { line-height: 1; }
    .bnav-item:active, .bnav-fab:active { background: var(--bg); }
    .bnav-item.active { color: var(--accent); }
    .bnav-item.active::after {
        content: "";
        position: absolute; top: 2px;
        width: 5px; height: 5px; border-radius: 50%;
        background: var(--accent);
    }
    .bnav-fab { color: var(--muted); }
    /* --- Tabel jadi kartu bertumpuk di HP (tanpa geser horizontal) --- */
    .table-cards thead { display: none; }
    .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
    .table-cards tr {
        border: 1px solid var(--border);
        border-radius: 12px;
        margin-bottom: 10px;
        padding: 6px 4px;
        background: var(--card);
    }
    .table-cards tr:hover { background: var(--card); }
    .table-cards td {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 12px;
        padding: 7px 12px;
        border: none;
        border-bottom: 1px dashed var(--border);
        text-align: right;
        white-space: normal;
        word-break: break-word;
    }
    .table-cards tr td:last-child { border-bottom: none; }
    .table-cards td::before {
        content: attr(data-label);
        flex-shrink: 0;
        font-size: 11.5px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .4px;
        color: var(--muted);
        text-align: left;
    }
    /* Baris "kosong / empty" tetap normal (colspan) */
    .table-cards td.empty { display: block; text-align: center; }
    .table-cards td.empty::before { content: none; }
}

@media (max-width: 600px) {
    .cards { grid-template-columns: 1fr 1fr; gap: 10px; }
    .cards .card-stat, .cards .card { min-width: 0 !important; }
    .card-stat { padding: 14px; gap: 10px; }
    .stat-value { font-size: 19px; }
    .stat-icon { width: 42px; height: 42px; }
    .stat-icon svg { width: 20px; height: 20px; }
    .card { padding: 16px; }
    .card-head h2 { font-size: 15px; }
    /* Kartu yang butuh isi lebar (chart/progress) boleh full row */
    .cards[style*="minmax(150px"] { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 380px) {
    .stat-value { font-size: 17px; }
    .bnav-item span, .bnav-fab span { font-size: 9.5px; }
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------------- Kelola Admin & hak akses (ceklis) ---------------- */
.admin-list { display: flex; flex-direction: column; gap: 12px; }
.admin-item { border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: var(--card-2); }
.admin-item-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.admin-item-head .muted { font-size: 12px; margin-left: 4px; }
.perm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px 14px;
    margin-bottom: 10px;
}
.perm-grid .inline-check { font-size: 13px; padding: 4px 0; }
.admin-item-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.perm-form { border-top: 1px dashed var(--border); padding-top: 10px; }

/* ---------------- SOP / Tata Tertib ---------------- */
.sop-body { background: var(--bg); min-height: 100vh; padding: 20px 14px calc(30px + env(safe-area-inset-bottom,0px)); }
.sop-page { max-width: 780px; margin: 0 auto; }
.sop-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.sop-head img { border-radius: 14px; box-shadow: 0 6px 16px rgba(14,165,233,.25); flex-shrink: 0; }
.sop-head h1 { font-size: 19px; line-height: 1.25; }
.sop-content { display: flex; flex-direction: column; gap: 16px; }
.sop-section h3 { display: flex; align-items: center; gap: 9px; font-size: 15.5px; margin-bottom: 8px; }
.sop-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff; font-size: 13px; font-weight: 800; flex-shrink: 0;
}
.sop-list { margin: 0; padding-left: 34px; display: flex; flex-direction: column; gap: 7px; font-size: 14px; line-height: 1.55; }
.sop-list li { padding-left: 4px; }
.sop-footer { margin-top: 8px; padding-top: 12px; border-top: 1px dashed var(--border); color: var(--muted); font-size: 13px; font-style: italic; }
.sop-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; justify-content: center; }

@media print {
    .sop-actions, .no-print { display: none !important; }
    .sop-body { background: #fff; padding: 0; }
    @page { margin: 15mm; }
}

/* ---------------- Voucher / Kartu Akun (cetak) ---------------- */
.voucher-sheet {
    display: grid;
    grid-template-columns: repeat(var(--vcols, 3), 1fr);
    gap: 10px;
}
.voucher {
    border: 1px dashed #94a3b8;
    border-radius: 10px;
    padding: 10px 12px;
    background: #fff;
    color: #0f172a;
    break-inside: avoid;
    page-break-inside: avoid;
}
.voucher-head { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid #e2e8f0; padding-bottom: 6px; margin-bottom: 6px; }
.voucher-head img { border-radius: 6px; }
.voucher-title { font-size: 11.5px; font-weight: 700; line-height: 1.2; }
.voucher-body { display: flex; flex-direction: column; gap: 3px; }
.voucher-row { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
.voucher-row span:first-child { color: #64748b; }
.voucher-row strong { font-family: Consolas, "Courier New", monospace; font-size: 13px; }
.voucher-name { margin-top: 4px; font-size: 11px; color: #475569; border-top: 1px dashed #e2e8f0; padding-top: 4px; }
.voucher-sop { margin-top: 5px; font-size: 9.5px; line-height: 1.35; color: #b45309; background: #fffbeb; border: 1px solid #fde68a; border-radius: 6px; padding: 4px 6px; }
.voucher-foot { margin-top: 6px; font-size: 9px; color: #94a3b8; text-align: center; display: flex; flex-direction: column; gap: 1px; }
.voucher-link { font-weight: 700; color: #0284c7; }

@media print {
    .sidebar, .bottom-nav, .topbar, .footer, .sidebar-backdrop, .pwa-install, .pwa-guide, .no-print, .modal { display: none !important; }
    .main { margin-left: 0 !important; }
    .content { padding: 0 !important; max-width: none !important; }
    body { background: #fff !important; }
    .voucher-sheet { gap: 6px; }
    @page { margin: 10mm; }
}
