/* ============================================================
   APLIKASI RONDA JIMPITAN RT 02 / RW 08 SENDANGMULYO
   File   : assets/css/style.css
   Tema   : Oranye — Primary #FF9800 / Deep #F57C00 /
            Yellow #FFC107 / Background #F8F9FA /
            Success #4CAF50 / Danger #F44336
   Desain : Mobile-first (360-430px), card rounded 14-18px,
            bottom navigation, sidebar desktop
   ============================================================ */

:root {
    --primary: #FF9800;
    --deep: #F57C00;
    --dark: #E65100;
    --yellow: #FFC107;
    --bg: #F8F9FA;
    --success: #4CAF50;
    --danger: #F44336;
    --card-r: 16px;
    --topbar-h: 58px;
    --bottomnav-h: 64px;
}

* { -webkit-tap-highlight-color: transparent; }

html, body {
    background: var(--bg);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #2b2b2b;
}

body { padding-bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 992px) { body { padding-bottom: 0; } }

.min-w-0 { min-width: 0; }
.text-orange { color: var(--deep) !important; }
.link-wa { color: #128C7E; text-decoration: none; font-weight: 600; }
.link-wa:hover { text-decoration: underline; }

/* ============ TOMBOL ============ */
.btn-orange {
    background: linear-gradient(135deg, var(--primary), var(--deep));
    color: #fff; border: 0; border-radius: 12px; font-weight: 600;
    box-shadow: 0 4px 12px rgba(245, 124, 0, .30);
}
.btn-orange:hover, .btn-orange:focus {
    background: linear-gradient(135deg, var(--deep), var(--dark));
    color: #fff; transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(245, 124, 0, .38);
}
.btn-orange:disabled { opacity: .6; transform: none; }
.btn-outline-orange {
    color: var(--deep); border: 1.5px solid var(--primary);
    border-radius: 12px; font-weight: 600; background: #fff;
}
.btn-outline-orange:hover { background: var(--primary); color: #fff; }
.btn-wa {
    background: #25D366; color: #fff; border: 0; border-radius: 12px; font-weight: 600;
    box-shadow: 0 4px 12px rgba(37, 211, 102, .30);
}
.btn-wa:hover { background: #1ebe5b; color: #fff; }

/* ============ TOP BAR MOBILE ============ */
.topbar {
    position: sticky; top: 0; z-index: 1030;
    display: flex; align-items: center; gap: 10px;
    height: var(--topbar-h); padding: 0 14px;
    background: linear-gradient(135deg, var(--primary), var(--deep));
    color: #fff;
    box-shadow: 0 2px 10px rgba(245, 124, 0, .35);
}
.topbar-logo { border-radius: 10px; background: #fff3; padding: 2px; }
.topbar-title { flex: 1; min-width: 0; line-height: 1.15; }
.topbar-title strong {
    display: block; font-size: 12.5px; font-weight: 800;
    letter-spacing: .2px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.topbar-title span { font-size: 10.5px; opacity: .92; }
.badge-mode {
    background: rgba(255, 255, 255, .22); color: #fff; font-size: 10px;
    font-weight: 700; padding: 5px 8px; border-radius: 8px; white-space: nowrap;
}

/* ============ CHIP MENU ADMIN (MOBILE) ============ */
.admin-chips {
    display: flex; gap: 8px; padding: 10px 12px 2px; overflow-x: auto;
    scrollbar-width: none;
}
.admin-chips::-webkit-scrollbar { display: none; }
.chip {
    flex: 0 0 auto; background: #fff; border: 1.5px solid #ffe0b2;
    color: #7a4100; font-size: 12px; font-weight: 600;
    padding: 7px 13px; border-radius: 999px; text-decoration: none;
    white-space: nowrap;
}
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip i { font-size: 13px; }

/* ============ SIDEBAR (DESKTOP) ============ */
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: 240px; z-index: 1040;
    background: #fff; border-right: 1px solid #eee;
    padding: 18px 14px; flex-direction: column;
    box-shadow: 2px 0 14px rgba(0, 0, 0, .04);
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 14px; border-bottom: 1px solid #f1f1f1; }
.sidebar-brand img { border-radius: 10px; }
.brand-text { line-height: 1.15; min-width: 0; }
.brand-text strong { display: block; font-size: 13px; color: var(--deep); letter-spacing: .4px; }
.brand-text span { font-size: 9.5px; color: #999; font-weight: 600; }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; overflow-y: auto; }
.side-link {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 13px; border-radius: 12px;
    color: #555; text-decoration: none; font-size: 13.5px; font-weight: 600;
    transition: all .15s ease;
}
.side-link i { font-size: 16px; width: 20px; text-align: center; }
.side-link:hover { background: #fff3e0; color: var(--deep); }
.side-link.active {
    background: linear-gradient(135deg, var(--primary), var(--deep));
    color: #fff; box-shadow: 0 4px 12px rgba(245, 124, 0, .35);
}
.sidebar-foot { border-top: 1px solid #f1f1f1; padding-top: 12px; }
.side-user { display: flex; align-items: center; gap: 10px; }
.avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--deep));
    color: #fff; display: inline-flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 16px; flex: 0 0 auto;
}
.avatar-lg { width: 64px; height: 64px; font-size: 26px; }
.side-user-nama { font-size: 13px; font-weight: 700; }
.side-user-role { font-size: 10px; color: #999; }
.btn-logout {
    display: block; text-align: center; text-decoration: none;
    background: #fff5f5; color: var(--danger); border: 1px solid #ffcdd2;
    padding: 8px; border-radius: 10px; font-size: 13px; font-weight: 600;
}
.btn-logout:hover { background: var(--danger); color: #fff; }

/* ============ KONTEN ============ */
.app-main {
    padding: 14px 12px 20px;
    max-width: 1080px;
    margin: 0 auto;
}
@media (min-width: 992px) {
    .app-main { margin-left: 240px; padding: 22px 26px 40px; max-width: 1280px; }
}

/* ============ KARTU ============ */
.card-app {
    background: #fff; border-radius: var(--card-r);
    box-shadow: 0 2px 14px rgba(0, 0, 0, .055);
    border: 1px solid #f0f0f0;
}
.hero-card {
    background: linear-gradient(135deg, var(--primary), var(--deep));
    border-radius: 18px; color: #fff; padding: 16px;
    box-shadow: 0 6px 20px rgba(245, 124, 0, .35);
}
.hero-ico { font-size: 30px; opacity: .95; }
.hero-hari { font-size: 14.5px; font-weight: 800; }
.hero-slogan { font-size: 11px; opacity: .95; }
.petugas-chip {
    background: rgba(255, 255, 255, .2); border-radius: 999px;
    padding: 6px 13px; font-size: 12px; display: inline-flex; align-items: center; gap: 7px;
}

/* ============ STAT & TILES ============ */
.stat-card { position: relative; overflow: hidden; }
.stat-ico {
    width: 34px; height: 34px; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 16px; margin-bottom: 6px; color: #fff;
}
.ico-orange { background: linear-gradient(135deg, var(--primary), var(--deep)); }
.ico-green { background: linear-gradient(135deg, #66BB6A, var(--success)); }
.ico-red { background: linear-gradient(135deg, #EF5350, var(--danger)); }
.ico-yellow { background: linear-gradient(135deg, var(--yellow), #FFA000); }
.stat-val { font-size: 22px; font-weight: 800; line-height: 1.1; }
.stat-val small { font-size: 12px; color: #999; font-weight: 600; }
.stat-label { font-size: 11.5px; color: #888; font-weight: 600; }

.action-tile {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 4px; background: #fff; border-radius: 18px; padding: 22px 10px;
    text-decoration: none; border: 1px solid #f0f0f0;
    box-shadow: 0 2px 14px rgba(0, 0, 0, .055); transition: transform .15s ease;
}
.action-tile:hover { transform: translateY(-3px); }
.at-ico {
    width: 54px; height: 54px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--deep));
    color: #fff; display: flex; align-items: center; justify-content: center; font-size: 24px;
    box-shadow: 0 6px 16px rgba(245, 124, 0, .4);
}
.at-ico-2 { background: linear-gradient(135deg, #66BB6A, var(--success)); box-shadow: 0 6px 16px rgba(76, 175, 80, .4); }
.at-title { color: #333; font-weight: 800; font-size: 14px; }
.at-sub { color: #999; font-size: 11px; }

/* ============ GRAFIK 7 HARI (CSS) ============ */
.chart-7 { display: flex; align-items: flex-end; gap: 6px; height: 130px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.chart-val { font-size: 9px; color: #888; font-weight: 700; white-space: nowrap; }
.chart-bar-wrap { flex: 1; width: 100%; max-width: 38px; display: flex; align-items: flex-end; justify-content: center; }
.chart-bar {
    width: 100%; border-radius: 8px 8px 3px 3px;
    background: linear-gradient(180deg, var(--primary), var(--deep));
    min-height: 5px; transition: height .4s ease;
}
.chart-day { font-size: 10px; font-weight: 700; color: #555; margin-top: 4px; }
.chart-date { font-size: 9px; color: #aaa; }

/* ============ LIST TRANSAKSI ============ */
.list-trans { display: flex; flex-direction: column; }
.trans-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 4px; border-bottom: 1px solid #f5f5f5;
}
.trans-item:last-child { border-bottom: 0; }
.trans-nomor {
    background: #fff3e0; color: var(--dark); font-weight: 800; font-size: 11px;
    border-radius: 10px; padding: 8px 9px; min-width: 52px; text-align: center;
}
.trans-nama { font-size: 13.5px; font-weight: 700; }
.trans-meta { font-size: 11px; color: #999; }
.trans-nominal { font-weight: 800; color: var(--deep); white-space: nowrap; }

/* ============ BOTTOM NAV MOBILE ============ */
.bottomnav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 1035;
    height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #fff; display: flex; align-items: stretch;
    box-shadow: 0 -4px 18px rgba(0, 0, 0, .08);
    border-top: 1px solid #f2f2f2;
}
.bn-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; text-decoration: none; color: #999; font-size: 10.5px; font-weight: 700;
    position: relative; min-height: 44px;
}
.bn-item i { font-size: 19px; }
.bn-item.active { color: var(--deep); }
.bn-center { transform: translateY(-14px); }
.bn-bubble {
    width: 52px; height: 52px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--deep));
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 23px; box-shadow: 0 8px 20px rgba(245, 124, 0, .45);
    border: 4px solid var(--bg);
}
.bn-center .bn-label { color: var(--deep); }
.bn-item.active::after {
    content: ""; position: absolute; top: 0; width: 22px; height: 3px;
    background: var(--primary); border-radius: 0 0 4px 4px;
}
.bn-center::after { display: none; }

/* ============ BADGE ============ */
.badge-role {
    font-size: 10px; font-weight: 800; padding: 4px 9px; border-radius: 8px; letter-spacing: .4px;
}
.role-admin { background: #FFF3E0; color: var(--dark); border: 1px solid #ffe0b2; }
.role-petugas { background: #E8F5E9; color: #2E7D32; border: 1px solid #c8e6c9; }
.role-viewer { background: #F5F5F5; color: #666; border: 1px solid #e0e0e0; }
.badge-status { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 8px; }
.badge-status.aktif { background: #E8F5E9; color: #2E7D32; }
.badge-status.nonaktif { background: #FFEBEE; color: #C62828; }
.badge-badge {
    font-size: 9px; font-weight: 800; padding: 2.5px 7px; border-radius: 6px; letter-spacing: .4px;
    vertical-align: middle;
}
.badge-badge.haruan { background: #E8F5E9; color: #2E7D32; }
.badge-badge.harain, .badge-badge.harian { background: #E8F5E9; color: #2E7D32; }
.badge-badge.bulanan { background: #FFF3E0; color: #E65100; }
.qr-tag {
    background: #FFF8E1; color: #8D6E00; border: 1px dashed #FFD54F;
    padding: 2px 7px; border-radius: 7px; font-size: 11px; font-weight: 700;
}
.rumah-nomor {
    background: linear-gradient(135deg, var(--primary), var(--deep)); color: #fff;
    font-weight: 800; font-size: 13px; border-radius: 10px;
    width: 42px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
}

/* ============ TABEL ============ */
.table-scroll { overflow: auto; max-height: 65vh; border-radius: 12px; }
.tbl-app { font-size: 13px; }
.tbl-app thead th {
    position: sticky; top: 0; z-index: 5;
    background: #FFF3E0; color: #7a4100; font-size: 11px; font-weight: 800;
    text-transform: uppercase; letter-spacing: .3px;
    border-bottom: 2px solid #ffe0b2;
    white-space: nowrap;
}
.tbl-app td { vertical-align: middle; }
.tbl-app tfoot td { background: #FFF8F0; }
.row-dim { opacity: .45; }

/* ============ SEGMENTED FILTER ============ */
.seg-wrap { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.seg-wrap::-webkit-scrollbar { display: none; }
.seg {
    flex: 0 0 auto; border: 1.5px solid #ffe0b2; background: #fff; color: #7a4100;
    font-size: 12.5px; font-weight: 700; padding: 8px 15px; border-radius: 999px; cursor: pointer;
}
.seg.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.seg .cnt { opacity: .75; font-size: 11px; }

/* ============ KARTU RUMAH (jimpitan) ============ */
.card-rumah {
    display: flex; align-items: center; gap: 12px;
    background: #fff; border-radius: 14px; padding: 12px;
    border: 1px solid #f0f0f0; box-shadow: 0 2px 10px rgba(0, 0, 0, .045);
    height: 100%;
}
.card-rumah.sudah { background: #FAFFF9; border-color: #c8e6c9; }
.cr-nama { font-size: 13.5px; font-weight: 700; }
.cr-alamat { font-size: 11px; color: #999; }
.cr-status { margin-top: 2px; }

/* ============ SCANNER ============ */
.scan-card { overflow: hidden; }
.reader-box { width: 100%; border-radius: 12px; background: #222; min-height: 240px; overflow: hidden; position: relative; }
.reader-box video { border-radius: 12px; object-fit: cover; }
.reader-loading {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 14px; gap: 8px; background: rgba(0, 0, 0, .55); border-radius: 12px;
    pointer-events: none;
}
.reader-loading { display: flex; }
.reader-loading.d-none { display: none; }
#reader__scan_region img { width: 100%; }
#reader__dashboard_section_csr span, #reader__dashboard_section_control span { font-size: 12px !important; }

.hasil-ico { font-size: 38px; }
.ico-ok { color: var(--success); }
.ico-err { color: var(--danger); }
.ico-warn { color: #FFA000; }
.hasil-ok { border: 2px solid #A5D6A7; background: #F8FFF7; }
.hasil-err { border: 2px solid #EF9A9A; background: #FFF8F8; }
.hasil-warn { border: 2px solid #FFCC80; background: #FFFBF2; }

/* ============ LAPORAN PILLS ============ */
.nav-laporan { gap: 6px; overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap; }
.nav-laporan::-webkit-scrollbar { display: none; }
.nav-laporan .nav-link {
    border-radius: 999px; font-size: 13px; font-weight: 700; color: #7a4100;
    background: #fff; border: 1.5px solid #ffe0b2; padding: 8px 18px; white-space: nowrap;
}
.nav-laporan .nav-link.active {
    background: linear-gradient(135deg, var(--primary), var(--deep));
    border-color: transparent; color: #fff;
    box-shadow: 0 4px 12px rgba(245, 124, 0, .3);
}

/* ============ LOGIN ============ */
.login-body {
    min-height: 100vh; min-height: 100svh;
    background: linear-gradient(160deg, var(--primary) 0%, var(--deep) 45%, #d96c00 100%);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px));
}
.login-wrap { width: 100%; max-width: 420px; }
.login-card {
    background: #fff; border-radius: 22px; padding: 26px 22px;
    box-shadow: 0 18px 50px rgba(120, 60, 0, .35);
}
.login-head { text-align: center; margin-bottom: 20px; }
.login-logo { width: 190px; max-width: 80%; }
.login-title { font-size: 13.5px; font-weight: 800; color: #7a4100; margin-top: 10px; letter-spacing: .3px; }
.login-slogan { font-size: 11.5px; color: #999; margin: 4px 0 0; }
.login-input .input-group-text { background: #FFF3E0; border: 1.5px solid #ffe0b2; color: var(--dark); border-right: 0; }
.login-input .form-control { border: 1.5px solid #ffe0b2; border-left: 0; padding: 11px 12px; }
.login-input .form-control:focus { box-shadow: none; border-color: var(--primary); }
.login-demo {
    background: #FFF8F0; border: 1px dashed #FFD54F; border-radius: 12px;
    padding: 12px 14px; font-size: 12px; color: #6d5326;
}
.login-demo ul { padding-left: 18px; margin-top: 4px; }
.login-demo code { background: #fff; padding: 1px 5px; border-radius: 5px; border: 1px solid #ffe0b2; }
.login-foot { text-align: center; color: rgba(255, 255, 255, .85); font-size: 11px; margin-top: 16px; }
.btn-login { padding: 12px; font-size: 15px; }

/* ============ PILIH MODE QR ============ */
.pilih-mode {
    border: 1.5px solid #ffe9c9; background: #FFFBF5; border-radius: 14px;
    padding: 14px 14px 14px 44px; margin-bottom: 12px; transition: all .15s ease;
}
.pilih-mode:has(input:checked) { border-color: var(--primary); background: #FFF6EA; box-shadow: 0 3px 12px rgba(245, 124, 0, .12); }
.pilih-mode .form-check-input { margin-left: -28px; width: 1.2em; height: 1.2em; margin-top: .2em; }
.pilih-mode .form-check-input:checked { background-color: var(--deep); border-color: var(--deep); }

/* ============ TOAST ============ */
#toastArea .toast { border-radius: 14px; font-size: 13.5px; font-weight: 600; }

/* ============ MODAL ============ */
.modal-content { border: 0; border-radius: 18px; }
.modal-header .modal-title { font-size: 15.5px; }

/* ============ SCROLLBAR HALUS ============ */
.table-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.table-scroll::-webkit-scrollbar-thumb { background: #ffd699; border-radius: 8px; }
.table-scroll::-webkit-scrollbar-track { background: #fff7ee; }

/* ============ UTILITAS ============ */
.container-app { max-width: 100%; }
@media (min-width: 992px) {
    .container-app { max-width: 1180px; margin: 0 auto; }
}
.fw-black { font-weight: 800; }

/* ============ QR THUMBNAIL (tabel rumah) ============ */
.qr-cell { display: flex; align-items: center; gap: 8px; }
.qr-thumb {
    width: 44px; height: 44px; padding: 3px; flex: 0 0 auto;
    background: #fff; border: 1px solid #ffe0b2; border-radius: 8px;
}

/* ============ QR PREVIEW (modal tambah/edit rumah) ============ */
.qr-preview-box {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    background: #FFFBF5; border: 1.5px dashed #FFCC80; border-radius: 14px;
    padding: 12px;
}
.qr-preview-box img {
    width: 128px; height: 128px; padding: 5px;
    background: #fff; border: 1px solid #ffe0b2; border-radius: 10px;
}
