:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --secondary: #64748b;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --background: #f1f5f9;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--background);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* --- Login Overlay --- */
#login-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease;
}

.login-card {
    background: white;
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    text-align: center;
    width: 90%;
    max-width: 400px;
}

.pin-display {
    font-size: 2rem;
    letter-spacing: 0.5rem;
    margin: 1.5rem 0;
    font-weight: bold;
    height: 3rem;
}

.numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.pin-btn {
    background: var(--background);
    border: none;
    padding: 1rem;
    font-size: 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.pin-btn:active { background: #cbd5e1; }

/* --- Main App Layout --- */
header {
    background: var(--card-bg);
    padding: 1rem;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
}

.brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

main {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    padding-bottom: 80px;
}

/* --- Navigation --- */
nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-around;
    padding: 0.75rem 0;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.75rem;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
}

.nav-item.active {
    color: var(--primary);
}

.nav-item i {
    font-size: 1.5rem;
}

/* --- Sections & Cards --- */
.section {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
    border: 1px solid rgba(0,0,0,0.05);
}

.card h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: var(--text-main);
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 0.5rem;
}

/* --- Forms --- */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    gap: 0.5rem;
    width: 100%;
}

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-outline { background: transparent; border: 1px solid #cbd5e1; color: var(--text-main); }

/* --- QR Code Display --- */
.qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: #f8fafc;
    border-radius: var(--radius);
    margin-top: 1rem;
}

#qr-canvas {
    margin-bottom: 0.5rem;
}

/* --- Scanner & Jimpitan --- */
.scanner-wrapper {
    position: relative;
    width: 100%;
    height: 300px;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1rem;
}

#reader {
    width: 100%;
    height: 100%;
}

.amount-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-top: 1rem;
}

.amount-btn {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem 0;
    text-align: center;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.amount-btn.selected {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
    color: var(--primary);
}

/* --- Lists & Reports --- */
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f1f5f9;
}

.list-item:last-child { border-bottom: none; }

.status-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 600;
}
.status-paid { background: #d1fae5; color: #065f46; }
.status-unpaid { background: #f1f5f9; color: #64748b; }

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.stat-card {
    background: var(--card-bg);
    padding: 1rem;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow);
}
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); }

/* --- Toast Notification --- */
#toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 0.9rem;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 90%;
    max-width: 350px;
}
#toast.show { transform: translateX(-50%) translateY(0); }
#toast.success { background: var(--success); }
#toast.error { background: var(--danger); }

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
}
.modal {
    background: white;
    border-radius: var(--radius);
    width: 100%;
    max-width: 400px;
    padding: 1.5rem;
    animation: popUp 0.3s ease;
}
@keyframes popUp {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.citizen-avatar {
    width: 60px; height: 60px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

/* Helper */
.hidden { display: none !important; }
.text-sm { font-size: 0.875rem; color: var(--text-muted); }
.text-center { text-align: center; }