    /* ===== CSS VARIABLES / DESIGN TOKENS ===== */
:root {
    --primary: #4f46e5;
    --primary-light: #818cf8;
    --primary-dark: #3730a3;
    --secondary: #06b6d4;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg-base: #f1f5f9;
    --bg-card: #ffffff;
    --bg-card2: #f8fafc;
    --bg-input: #ffffff;
    --bg-header: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-focus: #4f46e5;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(79,70,229,0.10);
    --shadow-lg: 0 8px 32px rgba(79,70,229,0.15);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --transition: 0.22s cubic-bezier(.4,0,.2,1);
    --stat-blue: #4f46e5;
    --stat-cyan: #06b6d4;
    --stat-green: #10b981;
    --stat-amber: #f59e0b;
}
[data-theme="dark"] {
    --bg-base: #0f172a;
    --bg-card: #1e293b;
    --bg-card2: #162032;
    --bg-input: #1e293b;
    --bg-header: linear-gradient(135deg, #3730a3 0%, #0891b2 100%);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #334155;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
}
/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    transition: background var(--transition), color var(--transition);
    min-height: 100vh;
    font-size: 15px;
    line-height: 1.6;
}
/* ===== APP HEADER ===== */
.app-header {
    background: var(--bg-header);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 20px rgba(79,70,229,0.25);
}
.app-header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.app-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}
.app-logo-icon {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    backdrop-filter: blur(8px);
}
.app-logo-text {
    display: flex;
    flex-direction: column;
}
.app-logo-title {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.1;
    letter-spacing: -0.02em;
}
.app-logo-subtitle {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.75);
    font-weight: 400;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.btn-sound {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    font-family: inherit;
}
.btn-sound:hover { background: rgba(255,255,255,0.25); }
.btn-theme {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-family: inherit;
}
.btn-theme:hover { background: rgba(255,255,255,0.28); transform: rotate(15deg); }
/* ===== MAIN LAYOUT ===== */
.app-main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 16px 40px;
}
/* ===== STATS ROW ===== */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 16px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}
.stat-card.blue::before { background: linear-gradient(90deg, #4f46e5, #818cf8); }
.stat-card.cyan::before { background: linear-gradient(90deg, #06b6d4, #67e8f9); }
.stat-card.green::before { background: linear-gradient(90deg, #10b981, #6ee7b7); }
.stat-card.amber::before { background: linear-gradient(90deg, #f59e0b, #fde68a); }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}
.stat-card.blue .stat-icon { background: rgba(79,70,229,0.12); }
.stat-card.cyan .stat-icon { background: rgba(6,182,212,0.12); }
.stat-card.green .stat-icon { background: rgba(16,185,129,0.12); }
.stat-card.amber .stat-icon { background: rgba(245,158,11,0.12); }
.stat-info { flex: 1; min-width: 0; }
.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1;
    margin-bottom: 4px;
}
.stat-value {
    font-size: 1.7rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
}
.stat-card.blue .stat-value { color: var(--stat-blue); }
.stat-card.cyan .stat-value { color: var(--stat-cyan); }
.stat-card.green .stat-value { color: var(--stat-green); }
.stat-card.amber .stat-value { color: var(--stat-amber); }
/* ===== CONTENT GRID ===== */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}
/* ===== APP CARD ===== */
.app-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: box-shadow var(--transition);
}
.app-card:hover { box-shadow: var(--shadow-md); }
.app-card-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}
.app-card-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 7px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.app-card-body {
    padding: 18px;
}
/* ===== SCAN SECTION ===== */
.scan-section { grid-column: 1; }
.result-section { grid-column: 2; }
.scan-input-wrap {
    position: relative;
    margin-bottom: 14px;
}
.scan-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.3rem;
    pointer-events: none;
    z-index: 1;
}
.scanner-input {
    width: 100%;
    padding: 14px 16px 14px 46px;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--text-primary);
    transition: all var(--transition);
    font-family: inherit;
    outline: none;
}
.scanner-input::placeholder { color: var(--text-muted); font-weight: 400; font-size: 0.9rem; }
.scanner-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 4px rgba(79,70,229,0.12);
    background: var(--bg-input);
}
.btn-manual-toggle {
    width: 100%;
    padding: 10px;
    background: var(--bg-card2);
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn-manual-toggle:hover {
    background: rgba(79,70,229,0.07);
    border-color: var(--primary);
    color: var(--primary);
}
/* ===== CAMERA SCAN BUTTONS ===== */
.camera-scan-row {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}
.btn-camera-scan {
    flex: 1;
    padding: 12px 10px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn-camera-scan:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(79,70,229,0.3); }
.btn-camera-scan:active { transform: translateY(0); }
.btn-camera-scan.active {
    background: linear-gradient(135deg, #059669, #10b981);
    animation: rfid-pulse 1.4s ease-in-out infinite;
}
@keyframes rfid-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.5); }
    50% { box-shadow: 0 0 0 8px rgba(16,185,129,0); }
}
.btn-camera-photo {
    flex: 1;
    padding: 12px 10px;
    background: var(--bg-card2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn-camera-photo:hover {
    background: rgba(79,70,229,0.07);
    border-color: var(--primary);
    color: var(--primary);
}
@media (max-width: 760px) {
    /* 4 tombol (Mode Scan Cepat, Scan Kamera, Foto Barcode, Scan RFID/NFC)
       tidak muat berjajar 1 baris di layar HP — jadi meluber ke kanan.
       Susun jadi grid 2 kolom x 2 baris supaya semua langsung terlihat. */
    .camera-scan-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
    .btn-camera-scan, .btn-camera-photo {
        flex: initial;
    }
}
/* ===== CAMERA SCANNER MODAL ===== */
.camera-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    z-index: 2100;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    backdrop-filter: blur(6px);
}
.camera-modal-overlay.show { display: flex; animation: fadeIn 0.2s ease; }
.camera-modal-content {
    position: relative;
    width: 100%;
    max-width: 480px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}
.camera-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--bg-header);
    color: #fff;
}
.camera-modal-header span {
    font-size: 0.9rem;
    font-weight: 700;
}
.camera-modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
    font-family: inherit;
}
.camera-modal-close:hover { background: rgba(255,255,255,0.35); }
#camera-reader {
    width: 100%;
    background: #000;
    min-height: 260px;
}
#camera-reader video {
    width: 100% !important;
}
.camera-modal-hint {
    padding: 12px 18px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
    background: var(--bg-card2);
}
.camera-modal-status {
    padding: 10px 18px;
    font-size: 0.78rem;
    text-align: center;
    color: var(--text-muted);
}
/* ===== APP SHELL VISIBILITY (dikunci sampai login berhasil) ===== */
.app-shell {
    display: none;
}
.app-shell.unlocked {
    display: block;
}
/* ===== LOGIN SCREEN ===== */
.login-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: var(--bg-header);
}
.login-overlay.hide {
    display: none;
}
.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 40px rgba(0,0,0,0.3);
    padding: 32px 28px;
    text-align: center;
}
.login-logo {
    font-size: 2.5rem;
    margin-bottom: 6px;
}
.login-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 2px;
}
.login-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0 0 20px;
}
.login-field {
    text-align: left;
    margin-bottom: 14px;
}
.login-field label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 5px;
}
.login-field input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card2);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color var(--transition);
}
.login-field input:focus {
    outline: none;
    border-color: var(--primary);
}
.login-button {
    width: 100%;
    padding: 12px;
    margin-top: 4px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition);
}
.login-button:hover { opacity: 0.92; transform: translateY(-1px); }
.login-button:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.login-error {
    min-height: 1.1em;
    margin: 10px 0 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--danger, #dc3545);
}
.login-footnote {
    margin: 18px 0 0;
    font-size: 0.72rem;
    color: var(--text-muted);
}
.btn-logout {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: var(--bg-card2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition);
}
.btn-logout:hover {
    background: rgba(220,53,69,0.1);
    border-color: #dc3545;
    color: #dc3545;
}
.manual-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.manual-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: block;
}
.manual-input-row {
    display: flex;
    gap: 8px;
}
.form-input {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    transition: all var(--transition);
    outline: none;
}
.form-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.btn-primary {
    padding: 10px 18px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    white-space: nowrap;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(79,70,229,0.3); }
.btn-primary:active { transform: translateY(0); }
/* ===== RESULT SECTION ===== */
#hasil-verifikasi {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.result-placeholder {
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
}
.result-placeholder .placeholder-icon {
    font-size: 3rem;
    margin-bottom: 10px;
    opacity: 0.4;
}
.result-placeholder p { font-size: 0.85rem; }
/* ===== ALERT STYLES (overrides for modern look) ===== */
.alert {
    border-radius: var(--radius-md);
    padding: 16px;
    border: none;
    width: 100%;
    animation: slideIn 0.3s ease;
}
@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
.alert-success {
    background: linear-gradient(135deg, rgba(16,185,129,0.12), rgba(16,185,129,0.05));
    border: 1.5px solid rgba(16,185,129,0.3);
}
.alert-warning {
    background: linear-gradient(135deg, rgba(245,158,11,0.12), rgba(245,158,11,0.05));
    border: 1.5px solid rgba(245,158,11,0.3);
}
.alert-danger {
    background: linear-gradient(135deg, rgba(239,68,68,0.12), rgba(239,68,68,0.05));
    border: 1.5px solid rgba(239,68,68,0.3);
}
.alert-heading {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 10px;
}
.alert-success .alert-heading { color: #059669; }
.alert-warning .alert-heading { color: #d97706; }
.alert-danger .alert-heading { color: #dc2626; }
.alert p { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 4px; }
.alert p strong { color: var(--text-primary); }
.alert hr { border-color: var(--border); margin: 10px 0; }
.foto-mustahik {
    width: 160px;
    height: 205px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border);
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
    flex-shrink: 0;
}
.foto-mustahik:hover { transform: scale(1.04); box-shadow: 0 4px 16px rgba(79,70,229,0.2); }
.perwakilan-galeri {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.perwakilan-kartu {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 160px;
}
/* Foto perwakilan pakai class .foto-mustahik yg sama dgn foto mustahik di
   atasnya (lihat app.php) supaya ukurannya konsisten — cukup posisikan
   nama di bawahnya di sini. */
.perwakilan-kartu span {
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.3;
    word-break: break-word;
}
/* ===== MONITORING TABLE SECTION ===== */
.monitoring-section {
    margin-bottom: 20px;
}
.badge-pill {
    background: rgba(79,70,229,0.1);
    color: var(--primary);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
}
.btn-sm {
    padding: 6px 14px;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}
.btn-sm.btn-primary { background: linear-gradient(135deg, var(--primary), var(--secondary)); color: #fff; }
.btn-sm.btn-primary:hover { opacity: 0.88; }
.tabel-monitoring-collapse {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(.4,0,.2,1);
}
.tabel-monitoring-collapse.show {
    max-height: 75vh;
    overflow: hidden;
}
#toggle-tabel-monitoring-icon {
    display: inline-block;
    transition: transform 0.3s ease;
}
#toggle-tabel-monitoring.expanded #toggle-tabel-monitoring-icon { transform: rotate(180deg); }
/* ===== SEARCH & FILTER ROW ===== */
.filter-row {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.filter-row .form-input {
    flex: 1;
    min-width: 180px;
}
.filter-group {
    display: flex;
    gap: 4px;
    background: var(--bg-card2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 3px;
}
.filter-btn {
    padding: 6px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    color: var(--text-secondary);
    background: transparent;
}
.filter-btn.active { background: #fff; color: var(--primary); box-shadow: 0 1px 4px rgba(0,0,0,0.1); }
[data-theme="dark"] .filter-btn.active { background: var(--bg-card); }
.filter-btn:hover:not(.active) { color: var(--text-primary); background: rgba(79,70,229,0.06); }
.filter-info {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}
/* ===== TABLE ===== */
.table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 52vh;
}
.table-wrapper::-webkit-scrollbar { width: 5px; height: 5px; }
.table-wrapper::-webkit-scrollbar-track { background: var(--bg-card2); }
.table-wrapper::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
.app-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}
.app-table thead th {
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 5;
    padding: 10px 12px;
    text-align: left;
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
.app-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}
.app-table tbody tr:hover { background: rgba(79,70,229,0.04); }
.app-table tbody tr.table-success {
    background: rgba(16,185,129,0.06);
}
.app-table tbody tr.table-success:hover { background: rgba(16,185,129,0.1); }
.app-table td {
    padding: 9px 12px;
    color: var(--text-primary);
    vertical-align: middle;
}
.badge-belum {
    background: rgba(239,68,68,0.1);
    color: #dc2626;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}
.text-success-modern {
    color: var(--success);
    font-weight: 600;
    font-size: 0.78rem;
}
.foto-mustahik-mini {
    width: 42px;
    height: 52px;
    object-fit: cover;
    border-radius: 6px;
    border: 1.5px solid var(--border);
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
    display: block;
}
.foto-mustahik-mini:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(79,70,229,0.25);
    position: relative; z-index: 5;
}
/* ===== RESET SECTION ===== */
.reset-section {
    background: linear-gradient(135deg, rgba(239,68,68,0.06), rgba(239,68,68,0.02));
    border: 1.5px solid rgba(239,68,68,0.2);
    border-radius: var(--radius-lg);
    padding: 22px;
    text-align: center;
    margin-bottom: 20px;
}
.reset-section h5 {
    color: #dc2626;
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 6px;
}
.reset-section p {
    color: var(--text-secondary);
    font-size: 0.82rem;
    margin-bottom: 14px;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
}
.btn-reset-bulan {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border: none;
    color: white;
    padding: 11px 28px;
    border-radius: 30px;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 4px 14px rgba(239,68,68,0.3);
    font-family: inherit;
}
.btn-reset-bulan:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239,68,68,0.4);
}
.btn-reset-bulan:active { transform: translateY(0); }
/* ===== RIWAYAT SECTION ===== */
#riwayat-section { margin-bottom: 40px; }
.riwayat-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    overflow: hidden;
    transition: box-shadow var(--transition);
}
.riwayat-card:hover { box-shadow: var(--shadow-md); }
.riwayat-header {
    background: linear-gradient(135deg, #6f42c1, #4f46e5);
    color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    gap: 8px;
}
.riwayat-header:hover { filter: brightness(1.08); }
.riwayat-header-label { min-width: 0; }
.riwayat-header-tanggal { font-size: 0.8rem; opacity: 0.8; margin-left: 8px; }
.riwayat-header-aksi { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.riwayat-header .badge-info {
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 0.78rem;
    white-space: nowrap;
}
.riwayat-hapus-btn {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.4);
    padding: 2px 8px;
    font-size: 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
}
@media (max-width: 640px) {
    /* Header riwayat meluber & kepotong di layar sempit: label, badge,
       tombol hapus, & ikon panah semua berjajar 1 baris tak muat. Susun
       ulang jadi 2 baris — label di atas, badge+aksi di bawah & boleh
       wrap — supaya semuanya selalu kebaca penuh. */
    .riwayat-header {
        flex-wrap: wrap;
    }
    .riwayat-header-label {
        flex-basis: 100%;
    }
    .riwayat-header-tanggal {
        display: block;
        margin-left: 0;
    }
    .riwayat-header-aksi {
        flex-wrap: wrap;
        flex-basis: 100%;
        justify-content: space-between;
    }
}
.riwayat-body {
    display: none;
    padding: 16px;
    background: var(--bg-card);
}
.riwayat-body.show { display: block; }
.riwayat-toggle-icon { transition: transform 0.3s; }
.riwayat-header.expanded .riwayat-toggle-icon { transform: rotate(180deg); }
.empty-riwayat {
    text-align: center;
    color: var(--text-muted);
    padding: 2.5rem;
    font-size: 0.85rem;
}
/* ===== RIWAYAT TABLE ===== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
/* Sengaja TANPA width:100% — kalau tabel dipaksa 100% lebar kontainer,
   browser akan menyempitkan/wrap isi kolom drpd meluber, jadi
   .table-responsive di atas tak pernah kebagian overflow utk discroll.
   min-width memastikan kolom tetap kebaca; kontainer yg scroll. */
.table-riwayat { min-width: 480px; border-collapse: collapse; font-size: 0.8rem; }
.table-riwayat th, .table-riwayat td { padding: 7px 10px; border-bottom: 1px solid var(--border); }
.table-riwayat th { background: rgba(245,158,11,0.1); font-weight: 700; color: var(--text-secondary); font-size: 0.72rem; text-transform: uppercase; }
.table-riwayat td { color: var(--text-primary); }
/* ===== SUMMARY RIWAYAT ===== */
.summary-riwayat {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.summary-riwayat .stat-box {
    flex: 1;
    min-width: 100px;
    background: var(--bg-card2);
    border-radius: var(--radius-sm);
    padding: 12px;
    text-align: center;
    border: 1px solid var(--border);
}
.summary-riwayat .stat-box .num {
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
}
.summary-riwayat .stat-box .lbl {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 3px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.num-sudah { color: var(--success); }
.num-belum { color: var(--danger); }
.num-total { color: var(--primary); }
/* ===== PHOTO MODAL ===== */
.foto-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.88);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
    backdrop-filter: blur(6px);
}
.foto-modal-overlay.show { display: flex; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.foto-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.foto-modal-content img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: var(--radius-md);
    border: 3px solid rgba(255,255,255,0.8);
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}
.foto-modal-caption {
    color: rgba(255,255,255,0.9);
    margin-top: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
}
.foto-modal-close {
    position: absolute;
    top: -14px;
    right: -14px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #ef4444;
    color: #fff;
    border: 2px solid #fff;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition);
    font-family: inherit;
}
.foto-modal-close:hover { background: #dc2626; }
.foto-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: 2px solid rgba(255,255,255,0.6);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition);
    font-family: inherit;
    z-index: 1;
}
.foto-modal-nav:hover { background: rgba(0,0,0,0.75); }
.foto-modal-prev { left: -6px; }
.foto-modal-next { right: -6px; }
.foto-modal-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 10px;
}
.foto-modal-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
}
.foto-modal-dot.active { background: #fff; }
@media (max-width: 480px) {
    .foto-modal-prev { left: 2px; }
    .foto-modal-next { right: 2px; }
}
/* ===== AUDIO CONTROLS ===== */
.audio-controls { display: none; }
/* ===== DIVIDER ===== */
.section-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0 0 0;
}
/* ===== BTN HAPUS RIWAYAT ===== */
.btn-outline-danger-sm {
    background: transparent;
    border: 1.5px solid rgba(239,68,68,0.4);
    color: #ef4444;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}
.btn-outline-danger-sm:hover { background: rgba(239,68,68,0.08); border-color: #ef4444; }
/* ===== BTN TAMBAH MUSTAHIK ===== */
.btn-tambah-mustahik {
    background: linear-gradient(135deg, var(--success), #059669);
    color: #fff;
    border: none;
    padding: 7px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-tambah-mustahik:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(16,185,129,0.3); }
.btn-download-csv { background: linear-gradient(135deg, var(--primary), var(--secondary)); }
.btn-download-csv:hover { box-shadow: 0 4px 12px rgba(79,70,229,0.3); }
/* ===== TOMBOL AKSI DI TABEL (EDIT/HAPUS) ===== */
.aksi-cell { display: flex; gap: 6px; justify-content: center; }
.btn-icon-aksi {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1.5px solid var(--border);
    background: var(--bg-card2);
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: all var(--transition);
    font-family: inherit;
}
.btn-icon-aksi.edit:hover { border-color: var(--primary); color: var(--primary); background: rgba(79,70,229,0.08); }
.btn-icon-aksi.hapus:hover { border-color: #ef4444; color: #ef4444; background: rgba(239,68,68,0.08); }
/* ===== MODAL KELOLA MUSTAHIK (TAMBAH/EDIT) ===== */
.mustahik-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 2200;
    justify-content: center;
    align-items: flex-start;
    padding: 1rem;
    overflow-y: auto;
    backdrop-filter: blur(4px);
}
.mustahik-modal-overlay.show { display: flex; animation: fadeIn 0.2s ease; }
.mustahik-modal-content {
    position: relative;
    width: 100%;
    max-width: 520px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0,0,0,0.4);
    margin: 2vh auto;
}
.mustahik-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-header);
    color: #fff;
}
.mustahik-modal-header span { font-size: 0.95rem; font-weight: 700; }
.mustahik-modal-close {
    width: 32px; height: 32px; border-radius: 50%;
    background: rgba(255,255,255,0.2); color: #fff; border: none;
    font-size: 1rem; cursor: pointer; display: flex;
    align-items: center; justify-content: center;
    transition: background var(--transition); font-family: inherit;
}
.mustahik-modal-close:hover { background: rgba(255,255,255,0.35); }
.mustahik-modal-body { padding: 20px; max-height: 76vh; overflow-y: auto; }
.mustahik-form-group { margin-bottom: 14px; }
.mustahik-form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.mustahik-form-row { display: flex; gap: 12px; }
.mustahik-form-row .mustahik-form-group { flex: 1; }
textarea.form-input { resize: vertical; min-height: 70px; font-family: inherit; }
.mustahik-foto-upload-row {
    display: flex;
    align-items: center;
    gap: 14px;
}
.mustahik-foto-preview {
    width: 76px;
    height: 76px;
    border-radius: var(--radius-md);
    object-fit: cover;
    border: 2px solid var(--border);
    background: var(--bg-card2);
    flex-shrink: 0;
}
.mustahik-foto-upload-actions { display: flex; flex-direction: column; gap: 6px; }
.btn-upload-foto {
    background: var(--bg-card2);
    border: 1.5px dashed var(--border);
    color: var(--text-secondary);
    padding: 7px 14px;
    border-radius: 10px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}
.btn-upload-foto:hover { border-color: var(--primary); color: var(--primary); }
.mustahik-foto-hint { font-size: 0.7rem; color: var(--text-muted); }
.mustahik-perwakilan-hint { margin: -4px 0 8px; }
.mustahik-rfid-token-fallback { margin-top: 8px; }
.mustahik-token-row { display: flex; gap: 6px; margin-top: 4px; }
.mustahik-token-row .form-input { flex: 1; font-size: 0.78rem; font-family: monospace; }
.mustahik-token-row .btn-upload-foto { white-space: nowrap; }
.mustahik-perwakilan-list { display: flex; flex-direction: column; gap: 10px; }
.mustahik-perwakilan-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card2);
}
.mustahik-foto-preview-kecil { width: 52px; height: 52px; }
.mustahik-perwakilan-row .mustahik-foto-upload-actions { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; flex: 1; }
.mustahik-perwakilan-row .mustahik-perwakilan-nama { flex: 1; min-width: 140px; }
.mustahik-perwakilan-hapus {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    cursor: pointer;
}
.mustahik-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
}
.btn-batal-modal {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text-secondary);
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}
.btn-batal-modal:hover { background: var(--bg-card2); }
.mustahik-form-error {
    background: rgba(239,68,68,0.1);
    color: #ef4444;
    border: 1px solid rgba(239,68,68,0.3);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 0.8rem;
    margin-bottom: 12px;
    display: none;
}
.mustahik-form-error.show { display: block; }

/* ===== TAMPILAN KARTU DATA MUSTAHIK KHUSUS LAYAR HP ===== */
/* Default (layar besar): tabel biasa yang tampil, kartu disembunyikan. */
.mustahik-card-list { display: none; }
@media (max-width: 760px) {
    /* Di layar sempit, tabel discroll-horizontal diganti kartu vertikal
        supaya semua data + tombol Aksi (Edit/Hapus) langsung terlihat
        tanpa perlu geser ke samping. */
    .table-wrapper { display: none; }
    .mustahik-card-list {
        display: flex;
        flex-direction: column;
        gap: 10px;
        /* Wadah luar (.tabel-monitoring-collapse.show) punya overflow:hidden
            dan max-height terbatas untuk animasi buka/tutup, jadi daftar
            kartu ini butuh scroll vertikal sendiri di dalamnya —
            sama seperti .table-wrapper punya scroll sendiri untuk tabel. */
        max-height: 65vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-right: 2px;
    }
    .mustahik-card-list::-webkit-scrollbar { width: 5px; }
    .mustahik-card-list::-webkit-scrollbar-track { background: var(--bg-card2); }
    .mustahik-card-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
}
.mustahik-card {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card2);
    padding: 12px;
    transition: border-color var(--transition);
}
.mustahik-card.sudah-diambil { border-left: 4px solid var(--success); }
.mustahik-card.belum-diambil { border-left: 4px solid var(--warning); }
.mustahik-card-top {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.mustahik-card-top img {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1.5px solid var(--border);
    flex-shrink: 0;
    cursor: pointer;
}
.mustahik-card-info { flex: 1; min-width: 0; }
.mustahik-card-nama {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text-primary);
    line-height: 1.3;
    word-break: break-word;
}
.mustahik-card-kode {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--primary);
    background: rgba(79,70,229,0.1);
    display: inline-block;
    padding: 1px 8px;
    border-radius: 20px;
    margin-top: 3px;
}
.mustahik-card-body {
    margin-top: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 10px;
    font-size: 0.78rem;
}
.mustahik-card-body .full-row { grid-column: 1 / -1; }
.mustahik-card-body .label {
    color: var(--text-muted);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
    display: block;
    margin-bottom: 1px;
}
.mustahik-card-body .value { color: var(--text-primary); word-break: break-word; }
.mustahik-card-aksi {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
}
.mustahik-card-aksi button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    border: 1.5px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    transition: all var(--transition);
}
.mustahik-card-aksi button.edit:active,
.mustahik-card-aksi button.edit:hover { border-color: var(--primary); color: var(--primary); background: rgba(79,70,229,0.08); }
.mustahik-card-aksi button.hapus:active,
.mustahik-card-aksi button.hapus:hover { border-color: #ef4444; color: #ef4444; background: rgba(239,68,68,0.08); }
/* ===== PROGRESS BAR ===== */
.progress-wrap {
    margin-bottom: 16px;
}
.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.progress-bar-track {
    height: 8px;
    background: var(--border);
    border-radius: 10px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    border-radius: 10px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 0.8s cubic-bezier(.4,0,.2,1);
    width: 0%;
}
/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 900px) {
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .content-grid { grid-template-columns: 1fr; }
    .scan-section, .result-section { grid-column: 1; }
}
@media (max-width: 600px) {
    .app-main { padding: 14px 12px 32px; }
    .stats-row { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .stat-card { padding: 12px 10px; gap: 8px; }
    .stat-icon { width: 36px; height: 36px; font-size: 1.1rem; }
    .stat-value { font-size: 1.4rem; }
    .filter-row { flex-direction: column; }
    .filter-row .form-input { min-width: 0; }
    .app-logo-subtitle { display: none; }
    .btn-sound span:last-child { display: none; }
    .app-header-inner { padding: 10px 14px; }
    .summary-riwayat .stat-box { min-width: 80px; }
}
@media (max-width: 420px) {
    .stats-row { grid-template-columns: 1fr 1fr; gap: 6px; }
    .stat-card::before { display: none; }
}

/* =====================================================================
   PERAN PENGGUNA: ADMIN vs PETUGAS
   Class role-admin / role-petugas dipasang di <body> setelah login,
   berdasarkan email akun (lihat PERAN_PENGGUNA di index.html).
   ===================================================================== */

/* Petugas: sembunyikan semua kontrol yang mengubah/mereset data */
body.role-petugas .reset-section,
body.role-petugas #btn-tambah-mustahik,
body.role-petugas #btn-download-csv-mustahik,
body.role-petugas #hapus-semua-riwayat,
body.role-petugas .kelola-user-section {
    display: none !important;
}

/* Badge peran + email di header */
.user-role-badge {
    display: none; /* baru tampil setelah login (diisi lewat JS) */
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}
.user-role-badge.is-admin,
.user-role-badge.is-petugas {
    display: inline-flex;
}
.user-role-badge.is-admin {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.35);
}
.user-role-badge.is-petugas {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    color: #fff;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
}
.user-role-badge .role-email {
    font-weight: 400;
    opacity: 0.9;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}
@media (max-width: 640px) {
    /* Di layar HP, cukup tampilkan label perannya saja agar header tidak sesak */
    .user-role-badge .role-email { display: none; }
}

/* Ikon gembok pada kolom Aksi untuk petugas (baca-saja) */
.aksi-terkunci {
    display: inline-block;
    opacity: 0.45;
    font-size: 1rem;
    cursor: not-allowed;
}

/* =====================================================================
   MODE SCAN CEPAT (layar penuh)
   Tampilan kerja utama petugas: kamera selalu aktif di atas, hasil
   verifikasi (foto + data + status) di bawah — tanpa scroll halaman.
   ===================================================================== */
.scan-mode-view {
    position: fixed;
    inset: 0;
    z-index: 4000;
    display: none;
    flex-direction: column;
    background: var(--bg-base);
}
.scan-mode-view.show { display: flex; }

.scan-mode-topbar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-header);
    color: #fff;
    box-shadow: var(--shadow-md);
}
.scan-mode-title {
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.scan-mode-topbar-actions { display: flex; gap: 8px; }
.scan-mode-topbar-actions button {
    border: 1px solid rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.15);
    color: #fff;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: background var(--transition);
}
.scan-mode-topbar-actions button:hover { background: rgba(255,255,255,0.28); }

.scan-mode-camera-wrap {
    flex-shrink: 0;
    background: #000;
    text-align: center;
    position: relative;
}
#scan-mode-reader { width: 100%; }
#scan-mode-reader video {
    width: 100% !important;
    /* Diperkecil dari 42vh spy data mustahik di .scan-mode-result (di
       bawahnya) dapat ruang lebih panjang, tak perlu discroll sedikit2
       cuma utk baca detail/galeri foto perwakilan. */
    max-height: 26vh;
    object-fit: cover;
    display: block;
}
.scan-mode-status {
    margin: 0;
    padding: 6px 12px;
    font-size: 0.78rem;
    color: #e2e8f0;
    background: rgba(0,0,0,0.65);
}
.scan-mode-retry {
    margin: 14px auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    font-size: 0.95rem;
    border-radius: var(--radius-md);
    border: none;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.scan-mode-result {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    -webkit-overflow-scrolling: touch;
}
/* Perbesar elemen hasil supaya mudah dibaca sekilas oleh petugas */
.scan-mode-result .alert-heading {
    font-size: 1.35rem;
    letter-spacing: 0.5px;
}
.scan-mode-result .foto-mustahik {
    width: 150px;
    height: 190px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}
.scan-mode-result p { font-size: 0.95rem; }
.scan-mode-result .result-placeholder { padding-top: 8vh; }

/* Kedip singkat saat hasil baru masuk, agar pergantian hasil terasa jelas */
@keyframes scanResultFlash {
    0%   { opacity: 0.25; transform: translateY(6px); }
    100% { opacity: 1; transform: translateY(0); }
}
.scan-mode-result.flash > * { animation: scanResultFlash 0.28s ease-out; }

/* Tombol pembuka Mode Scan Cepat di halaman utama dibuat menonjol */
.btn-scan-mode-open {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    border-color: #d97706 !important;
}

/* =====================================================================
   PERBAIKAN TAMPILAN MOBILE
   1. Hilangkan scroll horizontal di seluruh halaman.
   2. Header dirapikan: boleh turun baris & elemen mengecil di layar HP.
   3. Popup foto dinaikkan ke lapisan PALING atas supaya tetap terlihat
      saat dibuka dari dalam Mode Scan Cepat.
   ===================================================================== */

/* 1) Kunci lebar halaman ke lebar layar — tidak ada geser kanan/kiri */
html, body {
    overflow-x: hidden;
    max-width: 100%;
}
.app-header-inner,
.app-main,
.scan-mode-view {
    max-width: 100%;
    box-sizing: border-box;
}

/* 2) Header responsif */
.app-header-inner {
    flex-wrap: wrap;        /* jika tidak muat satu baris, turun rapi ke baris kedua */
    row-gap: 6px;
}
.app-logo { min-width: 0; }
.app-logo-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.header-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-left: auto;
    min-width: 0;
}

@media (max-width: 640px) {
    .app-header-inner { padding: 8px 10px; gap: 6px; }
    .app-logo { gap: 7px; }
    .app-logo-icon { width: 32px; height: 32px; border-radius: 9px; }
    .app-logo-title { font-size: 0.88rem; }
    .header-actions { gap: 6px; }
    .user-role-badge { padding: 4px 9px; font-size: 0.68rem; }
    .btn-sound, .btn-theme { padding: 6px 8px; font-size: 0.85rem; }
    .btn-logout { padding: 6px 9px; }
    .btn-logout span { display: none; }   /* cukup ikon 🔒, teks "Keluar" disembunyikan */
}
@media (max-width: 380px) {
    /* Layar sangat sempit: judul aplikasi ikut disingkat ruangnya */
    .app-logo-title { font-size: 0.8rem; max-width: 120px; }
    .user-role-badge { padding: 3px 7px; }
}

/* 3) Popup foto selalu di lapisan teratas (di atas Mode Scan Cepat = 4000) */
.foto-modal-overlay {
    z-index: 5000;
}

/* Pengaman tambahan Mode Scan Cepat di layar sempit */
.scan-mode-view { overflow-x: hidden; }
.scan-mode-result .d-flex { flex-wrap: wrap; gap: 10px; }
/* HP sempit: foto verifikasi yg sudah diperbesar ditaruh di atas data
   (bukan di samping) supaya kolom teks tidak kejepit. */
@media (max-width: 480px) {
    #hasil-verifikasi .d-flex { flex-wrap: wrap; justify-content: center; gap: 10px; }
    #hasil-verifikasi .d-flex > .flex-shrink-0 { margin-right: 0 !important; }
    #hasil-verifikasi .d-flex > .flex-grow-1 { flex-basis: 100%; }
}
.scan-mode-result .alert { max-width: 100%; box-sizing: border-box; }
@media (max-width: 380px) {
    .scan-mode-topbar-actions button span { display: none; } /* cukup ikon 📋 */
}
