/* DP Seçim Yönetim — Civic Vanguard Design System */
:root {
    --primary: #D32F2F;
    --primary-dark: #B71C1C;
    --primary-light: #FFCDD2;
    --primary-bg: rgba(211,47,47,0.08);
    --secondary: #1A1A2E;
    --tertiary: #64748B;
    --surface: #F9F9F9;
    --surface-card: #FFFFFF;
    --border: #E2E8F0;
    --text-primary: #1A1C1C;
    --text-secondary: #64748B;
    --success: #16A34A;
    --success-bg: rgba(22,163,74,0.1);
    --warning: #F59E0B;
    --warning-bg: rgba(245,158,11,0.1);
    --info: #2563EB;
    --info-bg: rgba(37,99,235,0.1);
    --font-headline: 'Plus Jakarta Sans', system-ui, sans-serif;
    --font-body: 'Inter', system-ui, sans-serif;
    --radius: 0.5rem;
    --radius-lg: 1rem;
    --shadow-sm: 0 1px 3px rgba(26,26,46,0.05);
    --shadow-md: 0 4px 12px rgba(26,26,46,0.08);
    --shadow-lg: 0 8px 24px -4px rgba(26,26,46,0.12);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font-body);
    background: var(--surface);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior: none;
}

/* === LOGIN === */
.login-body { background: #FFFFFF; min-height: 100dvh; display: flex; align-items: center; justify-content: center; }
.login-container { width: 100%; max-width: 400px; padding: 2rem 1.5rem; }
.login-logo { text-align: center; margin-bottom: 2.5rem; }
.logo-circle {
    width: 88px; height: 88px; border-radius: 50%; background: var(--primary);
    color: #fff; font-family: var(--font-headline); font-size: 32px; font-weight: 800;
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 20px rgba(211,47,47,0.3); margin-bottom: 1rem;
}
.party-name { font-family: var(--font-headline); font-size: 22px; font-weight: 800; color: var(--primary); letter-spacing: -0.02em; }
.party-subtitle { font-size: 14px; color: var(--tertiary); margin-top: 4px; }
.portal-badge {
    display: inline-block; margin-top: 12px; padding: 4px 14px; border-radius: 9999px;
    background: var(--primary-bg); color: var(--primary); font-size: 10px;
    font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
}
.login-form { display: flex; flex-direction: column; gap: 1rem; }
.input-group {
    position: relative; display: flex; align-items: center;
    background: #FFF; border: 1px solid var(--border); border-radius: var(--radius);
    transition: border-color 0.2s;
}
.input-group:focus-within { border-color: var(--secondary); }
.input-icon { position: absolute; left: 14px; font-size: 20px; color: var(--tertiary); }
.input-group input {
    width: 100%; height: 52px; padding: 0 48px 0 44px; border: none; outline: none;
    font-family: var(--font-body); font-size: 15px; color: var(--text-primary); background: transparent;
}
.input-group input::placeholder { color: var(--tertiary); }
.toggle-password { position: absolute; right: 10px; background: none; border: none; cursor: pointer; color: var(--tertiary); padding: 4px; }
.btn-primary {
    width: 100%; height: 52px; border: none; border-radius: var(--radius); cursor: pointer;
    background: var(--primary); color: #fff; font-family: var(--font-body);
    font-size: 14px; font-weight: 600; letter-spacing: 0.01em;
    transition: background 0.2s, transform 0.1s; box-shadow: 0 2px 8px rgba(211,47,47,0.3);
}
.btn-primary:active { background: var(--primary-dark); transform: scale(0.98); }
.forgot-link { text-align: center; font-size: 14px; font-weight: 500; color: var(--tertiary); text-decoration: none; }
.forgot-link:hover { color: var(--primary); }
.alert { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-radius: var(--radius); font-size: 13px; }
.alert-error { background: #FFF0F0; color: var(--primary); border: 1px solid var(--primary-light); }
.pwa-install {
    display: flex; align-items: center; gap: 12px; margin-top: 2rem; padding: 14px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.pwa-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--primary-bg); display: flex; align-items: center; justify-content: center; color: var(--primary); }
.pwa-text { flex: 1; }
.pwa-text strong { font-size: 13px; display: block; }
.pwa-text small { font-size: 11px; color: var(--tertiary); }
.btn-pwa { padding: 8px 16px; border-radius: var(--radius); background: var(--primary); color: #fff; border: none; font-size: 12px; font-weight: 600; cursor: pointer; }
.login-footer { text-align: center; margin-top: 2rem; font-size: 11px; color: var(--tertiary); display: flex; align-items: center; justify-content: center; gap: 4px; }

/* === APP SHELL === */
.app-header {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100; height: 56px;
    background: var(--primary); color: #fff; display: flex; align-items: center;
    justify-content: space-between; padding: 0 16px;
    box-shadow: 0 2px 8px rgba(211,47,47,0.2);
}
.header-left { display: flex; align-items: center; gap: 10px; }
.header-logo {
    width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,0.2);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-headline); font-weight: 800; font-size: 14px;
}
.header-title { font-family: var(--font-headline); font-size: 16px; font-weight: 700; }
.header-right { display: flex; align-items: center; gap: 8px; }
.header-btn { background: rgba(255,255,255,0.15); border: none; color: #fff; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.header-avatar {
    width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,0.25);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-headline); font-weight: 700; font-size: 14px; cursor: pointer;
}
.app-content { padding: 72px 16px calc(72px + var(--safe-bottom)); min-height: 100dvh; }

/* Bottom Nav */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 100; height: calc(64px + var(--safe-bottom));
    background: #FFF; border-top: 1px solid var(--border); display: flex;
    padding-bottom: var(--safe-bottom);
    box-shadow: 0 -2px 12px rgba(0,0,0,0.04);
}
.nav-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; background: none; border: none; cursor: pointer; color: var(--tertiary);
    font-family: var(--font-body); transition: color 0.2s;
}
.nav-item .material-icons-round { font-size: 24px; transition: transform 0.2s; }
.nav-label { font-size: 10px; font-weight: 600; letter-spacing: 0.02em; }
.nav-item.active { color: var(--primary); }
.nav-item.active .material-icons-round { transform: scale(1.1); }

/* FAB */
.fab {
    position: fixed; bottom: calc(80px + var(--safe-bottom)); right: 16px; z-index: 99;
    width: 56px; height: 56px; border-radius: 16px; background: var(--primary); color: #fff;
    border: none; cursor: pointer; box-shadow: var(--shadow-lg); display: flex;
    align-items: center; justify-content: center; transition: transform 0.2s;
}
.fab:active { transform: scale(0.92); }
.fab .material-icons-round { font-size: 28px; }

/* === CARDS === */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.stat-card {
    background: var(--surface-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 16px; box-shadow: var(--shadow-sm); transition: transform 0.2s;
}
.stat-card:active { transform: scale(0.97); }
.stat-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.stat-icon.red { background: var(--primary-bg); color: var(--primary); }
.stat-icon.blue { background: var(--info-bg); color: var(--info); }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.orange { background: var(--warning-bg); color: var(--warning); }
.stat-value { font-family: var(--font-headline); font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.stat-label { font-size: 12px; color: var(--tertiary); font-weight: 500; margin-top: 2px; }

/* Section */
.section-title { font-family: var(--font-headline); font-size: 18px; font-weight: 600; margin-bottom: 12px; letter-spacing: -0.01em; }
.section-card { background: var(--surface-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }

/* Progress bars */
.district-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.district-name { width: 90px; font-size: 13px; font-weight: 500; flex-shrink: 0; }
.district-bar { flex: 1; height: 8px; background: #F1F5F9; border-radius: 4px; overflow: hidden; }
.district-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width 0.6s ease; }
.district-pct { width: 40px; text-align: right; font-size: 12px; font-weight: 600; color: var(--tertiary); flex-shrink: 0; }

/* Voter/Station list items */
.list-item {
    display: flex; align-items: center; gap: 12px; padding: 14px 0;
    border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.item-avatar {
    width: 42px; height: 42px; border-radius: 50%; background: #F1F5F9;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-headline); font-weight: 700; font-size: 14px; color: var(--tertiary); flex-shrink: 0;
}
.item-info { flex: 1; min-width: 0; }
.item-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-meta { font-size: 12px; color: var(--tertiary); margin-top: 2px; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 9999px; font-size: 11px; font-weight: 600; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-danger { background: var(--primary-bg); color: var(--primary); }

/* Search */
.search-bar {
    display: flex; align-items: center; gap: 8px; background: var(--surface-card);
    border: 1px solid var(--border); border-radius: var(--radius); padding: 0 14px;
    height: 48px; margin-bottom: 12px;
}
.search-bar input { flex: 1; border: none; outline: none; font-size: 14px; font-family: var(--font-body); background: transparent; color: var(--text-primary); }
.search-bar input::placeholder { color: var(--tertiary); }

/* Filter chips */
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 12px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chip-row::-webkit-scrollbar { display: none; }
.chip {
    flex-shrink: 0; padding: 6px 16px; border-radius: 9999px; font-size: 13px; font-weight: 500;
    border: 1px solid var(--border); background: #FFF; color: var(--text-primary); cursor: pointer;
    transition: all 0.2s; white-space: nowrap;
}
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 200; display: none; }
.modal {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 201;
    background: #FFF; border-radius: 20px 20px 0 0; max-height: 90vh;
    overflow-y: auto; transform: translateY(100%); transition: transform 0.3s ease;
    padding: 24px 16px calc(24px + var(--safe-bottom));
}
.modal.open { transform: translateY(0); }
.modal-overlay.open { display: block; }
.modal-title { font-family: var(--font-headline); font-size: 20px; font-weight: 700; margin-bottom: 20px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--tertiary); margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; height: 48px; padding: 0 14px; border: 1px solid var(--border);
    border-radius: var(--radius); font-family: var(--font-body); font-size: 14px;
    color: var(--text-primary); background: #FFF; outline: none; transition: border-color 0.2s;
}
.form-group textarea { height: 80px; padding: 12px 14px; resize: vertical; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--secondary); }

/* Chart container */
.chart-container { position: relative; height: 220px; margin-bottom: 16px; }

/* Welcome bar */
.welcome-bar {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px; padding: 14px 16px; background: var(--surface-card);
    border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.welcome-text strong { font-family: var(--font-headline); font-size: 15px; display: block; }
.welcome-text small { font-size: 12px; color: var(--tertiary); }
.live-badge { display: flex; align-items: center; gap: 4px; padding: 4px 12px; border-radius: 9999px; background: var(--success-bg); color: var(--success); font-size: 11px; font-weight: 600; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); animation: pulse 1.5s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Empty state */
.empty-state { text-align: center; padding: 48px 20px; }
.empty-state .material-icons-round { font-size: 48px; color: var(--border); margin-bottom: 12px; }
.empty-state p { font-size: 14px; color: var(--tertiary); }

/* Btn row */
.btn-row { display: flex; gap: 10px; margin-top: 16px; }
.btn-secondary {
    flex: 1; height: 48px; border: 1.5px solid var(--secondary); background: transparent;
    border-radius: var(--radius); font-family: var(--font-body); font-size: 13px;
    font-weight: 600; color: var(--secondary); cursor: pointer; display: flex;
    align-items: center; justify-content: center; gap: 6px;
}
.btn-primary.btn-full { flex: 1; }

/* Spinner */
.spinner { display: flex; justify-content: center; padding: 40px; }
.spinner::after {
    content: ''; width: 32px; height: 32px; border: 3px solid var(--border);
    border-top-color: var(--primary); border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Settings */
.settings-item {
    display: flex; align-items: center; gap: 14px; padding: 16px;
    background: var(--surface-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); margin-bottom: 10px; cursor: pointer;
    transition: background 0.2s;
}
.settings-item:active { background: #F5F5F5; }
.settings-icon { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.settings-info { flex: 1; }
.settings-info strong { font-size: 14px; display: block; }
.settings-info small { font-size: 12px; color: var(--tertiary); }
.settings-arrow { color: var(--tertiary); }

/* Toast */
.toast {
    position: fixed; bottom: calc(80px + var(--safe-bottom)); left: 50%; transform: translateX(-50%) translateY(100px);
    background: var(--secondary); color: #fff; padding: 12px 24px; border-radius: var(--radius-lg);
    font-size: 14px; font-weight: 500; z-index: 300; opacity: 0; transition: all 0.3s;
    box-shadow: var(--shadow-lg); white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* =========== DESKTOP RESPONSIVE =========== */

/* Tablet — 768px+ */
@media (min-width: 768px) {
    .login-container { padding: 3rem 2rem; }
    .stat-grid { grid-template-columns: repeat(4, 1fr); }
    
    .app-content { 
        max-width: 100%; 
        padding: 72px 32px calc(72px + var(--safe-bottom)); 
    }
    
    .card { max-width: 100%; }
    .search-bar { max-width: 100%; }
    .filter-row { padding: 0; }
}

/* Desktop — 1024px+ */
@media (min-width: 1024px) {
    /* Sidebar Navigation */
    .bottom-nav {
        position: fixed;
        top: 56px;
        left: 0;
        bottom: 0;
        width: 220px;
        height: auto;
        flex-direction: column;
        border-top: none;
        border-right: 1px solid var(--border);
        padding: 16px 8px;
        padding-bottom: 0;
        box-shadow: 2px 0 12px rgba(0,0,0,0.04);
        gap: 4px;
        justify-content: flex-start;
        align-items: stretch;
    }
    .nav-item {
        flex: unset;
        flex-direction: row;
        justify-content: flex-start;
        padding: 12px 16px;
        border-radius: 10px;
        gap: 12px;
        transition: all 0.2s;
    }
    .nav-item:hover { background: #fff3f3; }
    .nav-item.active { background: #fff0f0; color: var(--primary); }
    .nav-label { font-size: 14px; font-weight: 600; }
    
    /* Main Content Area */
    .app-content {
        margin-left: 220px;
        max-width: 100%;
        padding: 72px 40px 40px;
    }
    
    /* Header */
    .app-header {
        left: 0;
        padding: 0 40px;
    }
    .header-title { font-size: 18px; }
    .header-logo-img { height: 40px; width: 40px; }
    
    /* Dashboard Grid */
    .stat-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
    .card { max-width: 100%; }
    
    /* Voter List — wider */
    .list-item { padding: 14px 20px; }
    .item-name { font-size: 16px; }
    .item-meta { font-size: 13px; }
    .item-avatar { width: 44px; height: 44px; font-size: 15px; }
    
    /* Filter row — inline */
    .filter-row { padding: 0; gap: 12px; }
    .filter-row select { font-size: 14px; padding: 10px 14px; }
    .search-bar input { font-size: 15px; }
    
    /* Voter count bar */
    .voter-count-bar span { font-size: 15px; }
    .btn-sm { font-size: 13px; padding: 8px 16px; }
    
    /* FAB position */
    #fabBtn { right: 40px; bottom: 40px; }
    
    /* Pagination */
    .pagination { gap: 16px; }
    .page-btn { padding: 10px 24px; font-size: 14px; }
}

/* Wide Desktop — 1400px+ */
@media (min-width: 1400px) {
    .bottom-nav { width: 260px; }
    .app-content { margin-left: 260px; padding: 80px 60px 40px; }
    .nav-item { padding: 14px 20px; }
    .nav-label { font-size: 15px; }
    
    /* 2-column dashboard */
    .dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
    
    /* Voter list items wider */
    .list-item { padding: 16px 24px; }
}

/* Filter row */
.filter-row { display:flex; gap:8px; margin-bottom:12px; padding:0 16px; }
.filter-row select { padding:10px 12px; border:1px solid var(--border); border-radius:10px; background:#fff; font-size:13px; font-family:var(--font-body); color:var(--text); appearance:none; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' fill='none' stroke='%2394a3b8' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 10px center; padding-right:28px; }

/* Voter count bar */
.voter-count-bar { display:flex; justify-content:space-between; align-items:center; padding:8px 16px; margin-bottom:8px; }
.voter-count-bar span { font-size:13px; color:var(--tertiary); font-weight:500; }
.btn-sm { display:flex; align-items:center; gap:4px; padding:6px 12px; border:1px solid var(--primary); color:var(--primary); background:transparent; border-radius:8px; font-size:12px; font-weight:600; cursor:pointer; transition:all .2s; }
.btn-sm:hover { background:var(--primary); color:#fff; }

/* Export buttons */
.export-buttons { display:flex; flex-direction:column; gap:8px; }
.btn-outline { display:flex; align-items:center; justify-content:center; gap:8px; padding:12px 16px; border:1px solid var(--border); color:var(--text); background:#fff; border-radius:10px; font-size:14px; font-weight:500; cursor:pointer; transition:all .2s; }
.btn-outline:hover { border-color:var(--primary); color:var(--primary); }

/* Report stat row */
.report-stat { display:flex; justify-content:space-between; align-items:center; padding:10px 0; border-bottom:1px solid var(--border); font-size:14px; }
.report-stat:last-child { border-bottom:none; }
.report-district { margin-bottom:12px; padding-bottom:12px; border-bottom:1px solid var(--border); }
.report-district:last-child { border-bottom:none; margin-bottom:0; padding-bottom:0; }
.report-district-header { display:flex; justify-content:space-between; margin-bottom:6px; font-size:14px; }

/* Bulk import preview table */
#bulkPreview table th { font-size:11px; }

/* Pagination */
.pagination { display:flex; justify-content:center; align-items:center; gap:12px; padding:16px; margin-top:8px; }
.page-btn { padding:10px 20px; background:var(--primary); color:#fff; border:none; border-radius:10px; font-size:14px; font-weight:600; cursor:pointer; transition:all .2s; }
.page-btn:hover { opacity:.85; transform:scale(1.02); }
.page-info { font-size:14px; color:var(--tertiary); font-weight:500; }

/* =========== PRINT MODAL =========== */
.print-modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 9999; display: flex; align-items: center; justify-content: center; animation: fadeIn 0.2s; }
.print-modal { background: #fff; border-radius: 16px; width: 90%; max-width: 680px; max-height: 85vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.3); animation: slideUp 0.25s; }
.print-modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid #eee; }
.print-modal-header h3 { font-size: 18px; color: #222; margin: 0; }
.print-modal-body { padding: 16px 20px; }
.print-section { margin-bottom: 16px; }
.print-label { display: block; font-weight: 700; font-size: 13px; color: #333; margin-bottom: 8px; }
.print-section select { width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; background: #f9f9f9; }
.print-station-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 4px; max-height: 180px; overflow-y: auto; padding: 8px; background: #f9f9f9; border-radius: 8px; border: 1px solid #eee; }
.station-check { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 4px 6px; border-radius: 4px; cursor: pointer; transition: background 0.15s; }
.station-check:hover { background: #fee; }
.station-check input { accent-color: var(--primary); }
.print-col-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; }
.col-check { display: flex; align-items: center; gap: 6px; font-size: 13px; padding: 6px 8px; border-radius: 6px; cursor: pointer; transition: background 0.15s; }
.col-check:hover { background: #fff0f0; }
.col-check input { accent-color: var(--primary); }
.print-modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 20px; border-top: 1px solid #eee; }
.btn-cancel { padding: 10px 20px; border: 1px solid #ddd; border-radius: 8px; background: #fff; cursor: pointer; font-size: 14px; color: #666; }
.btn-cancel:hover { background: #f5f5f5; }
.btn-print-go { padding: 10px 24px; border: none; border-radius: 8px; background: var(--primary); color: #fff; cursor: pointer; font-size: 14px; font-weight: 700; }
.btn-print-go:hover { background: #a01010; }
.btn-sm-outline { padding: 4px 10px; border: 1px solid #ddd; border-radius: 6px; background: #fff; cursor: pointer; font-size: 11px; color: #555; }
.btn-sm-outline:hover { background: #f5f5f5; }
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }


/* =========== FILTER PANEL v2 =========== */
.filter-panel {
    background: var(--surface-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.filter-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}
.filter-panel-header:hover { background: #fafafa; }
.filter-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.filter-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 0 6px;
}
.filter-chevron {
    color: var(--tertiary);
    transition: transform 0.2s;
}
.filter-panel-body {
    padding: 0 16px 16px;
    transition: max-height 0.3s ease, opacity 0.2s ease, padding 0.3s ease;
    max-height: 500px;
    opacity: 1;
    overflow: hidden;
}
.filter-panel-body.collapsed {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
}
.filter-cascade {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}
.filter-cascade-item {
    flex: 1;
    min-width: 0;
}
.filter-cascade-item label.filter-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--tertiary);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.filter-cascade-item select {
    width: 100%;
    padding: 10px 28px 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    font-size: 13px;
    font-family: var(--font-body);
    color: var(--text-primary);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' fill='none' stroke='%2394a3b8' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: border-color 0.2s, box-shadow 0.2s;
    cursor: pointer;
}
.filter-cascade-item select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(211,47,47,0.1);
    outline: none;
}
.filter-cascade-item select.disabled-select {
    background: #f5f5f5;
    color: #aaa;
    cursor: not-allowed;
}
.filter-cascade-arrow {
    display: flex;
    align-items: center;
    padding-bottom: 8px;
    color: var(--border);
    flex-shrink: 0;
}
.filter-extra-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.filter-clear-all-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    border: 1px solid var(--primary);
    border-radius: 8px;
    background: var(--primary-bg);
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    margin-left: auto;
}
.filter-clear-all-btn:hover {
    background: var(--primary);
    color: #fff;
}

/* Active filter chips */
.active-filters-bar {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 10px;
    padding: 0 2px;
}
.active-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    background: var(--primary-bg);
    color: var(--primary);
    border: 1px solid rgba(211,47,47,0.2);
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.active-filter-chip:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.active-filter-chip .chip-remove {
    font-size: 14px;
    margin-left: 2px;
    opacity: 0.7;
}
.active-filter-chip:hover .chip-remove {
    opacity: 1;
}

/* Table responsive */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface-card);
}
.voter-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 900px;
}
.voter-table thead th {
    position: sticky;
    top: 0;
    background: #f8fafc;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--tertiary);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
.voter-table tbody tr {
    cursor: pointer;
    transition: background 0.15s;
}
.voter-table tbody tr:hover { background: #fff5f5; }
.voter-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    white-space: nowrap;
}
.td-station .station-badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--primary-bg);
    color: var(--primary);
    border-radius: 6px;
    font-weight: 700;
    font-size: 12px;
}

/* Mobile: Stack cascade vertically */
@media (max-width: 767px) {
    .filter-cascade {
        flex-direction: column;
        gap: 10px;
    }
    .filter-cascade-arrow {
        display: none;
    }
    .filter-extra-row {
        flex-direction: column;
        align-items: stretch;
    }
    .filter-extra-row .filter-cascade-item {
        max-width: 100% !important;
    }
    .filter-clear-all-btn {
        margin-left: 0;
        justify-content: center;
    }
}

/* Desktop: tighter cascade */
@media (min-width: 1024px) {
    .filter-cascade {
        gap: 12px;
    }
    .filter-cascade-item select {
        font-size: 14px;
        padding: 10px 32px 10px 14px;
    }
}


/* ===== View Toggle Buttons ===== */
.view-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--tertiary);
    cursor: pointer;
    transition: all .2s;
}
.view-toggle-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.view-toggle-btn:hover:not(.active) {
    border-color: var(--primary);
    color: var(--primary);
}

/* ===== Voter Region Groups (Card View) ===== */
.voter-region-group {
    margin-bottom: 16px;
}
.voter-region-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: linear-gradient(135deg, var(--primary), #c62828);
    color: #fff;
    border-radius: 10px 10px 0 0;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.3px;
    position: sticky;
    top: 0;
    z-index: 2;
}
.voter-region-count {
    margin-left: auto;
    background: rgba(255,255,255,.2);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* ===== Voter Cards ===== */
.voter-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    cursor: pointer;
    transition: all .2s;
}
.voter-card:last-child {
    border-radius: 0 0 10px 10px;
}
.voter-card:hover {
    background: rgba(211,47,47,.04);
}
.voter-card:active {
    background: rgba(211,47,47,.08);
}

/* Card top row: avatar + name + badge */
.voter-card-top {
    display: flex;
    align-items: center;
    gap: 10px;
}
.voter-card-avatar {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #ef5350);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.voter-card-info {
    flex: 1;
    min-width: 0;
}
.voter-card-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.voter-card-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--tertiary);
    margin-top: 2px;
}

/* Card details grid */
.voter-card-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 12px;
}
.voter-card-detail {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--secondary);
    padding: 4px 0;
}
.voter-card-detail .material-icons-round {
    font-size: 16px;
    color: var(--tertiary);
    flex-shrink: 0;
}
.voter-card-detail strong {
    color: var(--text);
}

/* ===== Mobile: full width cards ===== */
@media (max-width: 480px) {
    .voter-card-details {
        grid-template-columns: 1fr;
    }
    .voter-card-name {
        font-size: 14px;
    }
}

/* ===== Voter Row hover (table view) ===== */
.voter-row {
    cursor: pointer;
    transition: background .15s;
}
.voter-row:hover {
    background: rgba(211,47,47,.04);
}
.td-name {
    white-space: nowrap;
}
.td-region {
    min-width: 120px;
}
.td-seq {
    text-align: center;
    font-weight: 600;
    color: var(--secondary);
}


/* ===== Reports: Collapsible Neighborhoods ===== */
.report-hoods {
    max-height: 2000px;
    overflow: hidden;
    transition: max-height .3s ease;
}
.report-hoods.collapsed {
    max-height: 0;
}
.report-district-header:hover {
    background: #f1f5f9 !important;
}


/* ===== Quick Vote Banner ===== */
.quick-vote-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #C62828, #E53935);
    color: #fff;
    border-radius: 12px;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
    box-shadow: 0 4px 12px rgba(198,40,40,.25);
}
.quick-vote-banner:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(198,40,40,.35);
}
.quick-vote-banner:active {
    transform: scale(.98);
}
.quick-vote-banner .material-icons-round:first-child {
    font-size: 28px;
    background: rgba(255,255,255,.2);
    padding: 6px;
    border-radius: 10px;
}

/* ===== Quick Vote Modal Results ===== */
.qv-voter-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 8px;
    border-bottom: 1px solid #f0f0f0;
    border-radius: 8px;
    transition: background .15s;
}
.qv-voter-row:hover {
    background: #f8fafc;
}
.qv-voter-row.qv-voted {
    background: rgba(22,163,74,.06);
}
.qv-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s;
    flex-shrink: 0;
}
.qv-btn .material-icons-round {
    font-size: 18px;
}
.qv-btn-vote {
    background: var(--primary);
    color: #fff;
}
.qv-btn-vote:hover {
    background: #a01010;
}
.qv-btn-undo {
    background: #f1f5f9;
    color: var(--secondary);
    border: 1px solid var(--border);
}
.qv-btn-undo:hover {
    background: #e2e8f0;
}

/* Mobile: stack quick vote row */
@media (max-width: 480px) {
    .qv-voter-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .qv-btn {
        justify-content: center;
        padding: 10px;
    }
}


/* ===== Voter Form v2 ===== */
.voter-form-header {
    display: flex; align-items: center; gap: 14px;
    padding-bottom: 16px; margin-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}
.voter-form-avatar {
    width: 52px; height: 52px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #ef5350);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 700; flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(211,47,47,0.3);
}
.voter-form-avatar.voted {
    background: linear-gradient(135deg, #16A34A, #22C55E);
    box-shadow: 0 4px 12px rgba(22,163,74,0.3);
}
.voter-form-header-info { flex: 1; min-width: 0; }
.voter-form-title {
    font-family: var(--font-headline); font-size: 18px; font-weight: 700;
    color: var(--text); margin: 0; line-height: 1.3;
}
.voter-form-subtitle { font-size: 13px; color: var(--tertiary); margin: 2px 0 0; }
.voter-form-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.vf-badge {
    display: inline-flex; align-items: center; gap: 3px;
    font-size: 11px; font-weight: 600; padding: 3px 8px;
    border-radius: 6px; white-space: nowrap;
}
.vf-badge .material-icons-round { font-size: 13px; }
.vf-badge.station { background: #EDE9FE; color: #7C3AED; }
.vf-badge.region { background: #DBEAFE; color: #2563EB; }
.vf-badge.voted { background: #DCFCE7; color: #16A34A; }
.vf-badge.pending { background: #FEF3C7; color: #D97706; }

.vf-readonly-banner {
    background: #FFF3E0; border: 1px solid #FFE0B2; border-radius: 8px;
    padding: 10px 14px; margin-bottom: 16px; font-size: 12px; color: #E65100;
    display: flex; align-items: center; gap: 8px;
}
.vf-readonly-banner .material-icons-round { font-size: 18px; }

.vf-section {
    background: #f8fafc; border: 1px solid #e2e8f0;
    border-radius: 12px; padding: 16px; margin-bottom: 14px;
}
.vf-section-header {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; font-weight: 700; color: var(--primary);
    margin-bottom: 14px; padding-bottom: 10px;
    border-bottom: 2px solid rgba(211,47,47,0.1);
}
.vf-section-header .material-icons-round { font-size: 18px; }

.vf-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 12px; margin-bottom: 12px;
}
.vf-grid:last-child { margin-bottom: 0; }

.vf-field label, .vf-field-full label {
    display: block; font-size: 12px; font-weight: 600;
    color: #64748b; margin-bottom: 5px; letter-spacing: 0.02em;
}
.vf-field input, .vf-field select, .vf-field textarea,
.vf-field-full input, .vf-field-full select, .vf-field-full textarea {
    width: 100%; padding: 10px 12px; border: 1px solid #e2e8f0;
    border-radius: 8px; font-size: 14px; font-family: var(--font-body);
    color: var(--text); background: #fff; transition: all 0.2s;
    box-sizing: border-box;
}
.vf-field input:focus, .vf-field select:focus, .vf-field textarea:focus,
.vf-field-full input:focus, .vf-field-full select:focus, .vf-field-full textarea:focus {
    border-color: var(--primary); box-shadow: 0 0 0 3px rgba(211,47,47,0.1);
    outline: none;
}
.vf-field input:disabled, .vf-field select:disabled, .vf-field textarea:disabled,
.vf-field-full input:disabled, .vf-field-full select:disabled, .vf-field-full textarea:disabled {
    background: #f1f5f9; color: #94a3b8; cursor: not-allowed;
}
.vf-field-full { margin-bottom: 12px; }
.vf-field-full:last-child { margin-bottom: 0; }

.vf-input-icon {
    position: relative;
}
.vf-input-icon .material-icons-round {
    position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
    font-size: 18px; color: #94a3b8; pointer-events: none;
}
.vf-input-icon input { padding-left: 36px; }

.vf-actions {
    display: flex; gap: 8px; margin-top: 18px;
}
.vf-btn-save {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 12px 20px; background: var(--primary); color: #fff;
    border: none; border-radius: 10px; font-size: 15px; font-weight: 600;
    cursor: pointer; transition: all 0.2s; font-family: var(--font-body);
}
.vf-btn-save:hover { background: #B71C1C; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(211,47,47,0.3); }
.vf-btn-save .material-icons-round { font-size: 20px; }

.vf-btn-delete {
    display: flex; align-items: center; justify-content: center; gap: 4px;
    padding: 12px 16px; background: #fff; color: var(--primary);
    border: 2px solid var(--primary); border-radius: 10px; font-size: 14px;
    font-weight: 600; cursor: pointer; transition: all 0.2s; font-family: var(--font-body);
}
.vf-btn-delete:hover { background: #FFF5F5; }
.vf-btn-delete .material-icons-round { font-size: 18px; }

.vf-btn-vote {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 12px 20px; background: #16A34A; color: #fff;
    border: none; border-radius: 10px; font-size: 15px; font-weight: 600;
    cursor: pointer; transition: all 0.2s; font-family: var(--font-body);
}
.vf-btn-vote:hover { background: #15803D; }
.vf-btn-vote .material-icons-round { font-size: 20px; }

/* Backward compat */
.form-section {
    background: #f8fafc; border: 1px solid #e2e8f0;
    border-radius: 12px; padding: 16px; margin-bottom: 14px;
}
.form-section-title {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; font-weight: 700; color: var(--primary);
    margin-bottom: 14px; padding-bottom: 10px;
    border-bottom: 2px solid rgba(211,47,47,0.1);
}
.form-section-title .material-icons-round { font-size: 18px; }
.form-row {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Mobile responsive */
@media (max-width: 480px) {
    .vf-grid, .form-row { grid-template-columns: 1fr; gap: 0; }
    .voter-form-header { gap: 10px; }
    .voter-form-avatar { width: 44px; height: 44px; font-size: 15px; }
    .voter-form-title { font-size: 16px; }
    .vf-section { padding: 12px; }
    .vf-actions { flex-direction: column; }
}
