/* Ballot Insight — Design System */
:root {
  --navy: #10243A;
  --dark-blue: #173B5E;
  --primary: #2463A6;
  --primary-hover: #1d5087;
  --white: #FFFFFF;
  --bg: #F5F7FA;
  --border: #E2E8F0;
  --muted: #64748B;
  --text: #1E293B;
  --success: #16845B;
  --warning: #D99A22;
  --critical: #C83D45;
  --radius: 6px;
  --shadow: 0 1px 3px rgba(16,36,58,.08);
  --font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.5; min-height: 100vh; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }
h1 { font-size: 1.75rem; font-weight: 700; color: var(--navy); }
h2 { font-size: 1.35rem; font-weight: 650; color: var(--navy); }
h3 { font-size: 1.1rem; font-weight: 600; color: var(--navy); }
.text-muted { color: var(--muted); }
.text-sm { font-size: .875rem; }
.text-xs { font-size: .75rem; }
.fw-600 { font-weight: 600; }
.container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 1.25rem; }
.container-wide { max-width: 1440px; }
.page { min-height: 100vh; display: flex; flex-direction: column; }
.main { flex: 1; padding: 1.5rem 0 3rem; }
.demo-banner { background: var(--navy); color: #94A3B8; font-size: .75rem; text-align: center; padding: .4rem 1rem; letter-spacing: .02em; }
.demo-banner strong { color: #FBBF24; }
.site-header { background: var(--white); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 1rem; }
.logo { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.15rem; color: var(--navy); text-decoration: none; }
.logo-mark { width: 32px; height: 32px; background: var(--primary); border-radius: 6px; display: grid; place-items: center; color: white; font-size: .9rem; }
.nav { display: flex; align-items: center; gap: 1.25rem; }
.nav a { color: var(--text); font-weight: 500; font-size: .9rem; text-decoration: none; }
.nav a:hover, .nav a.active { color: var(--primary); }
.nav-dropdown { position: relative; }
.nav-dropdown-btn { background: none; border: none; cursor: pointer; color: var(--text); font-weight: 500; font-size: .9rem; display: flex; align-items: center; gap: .3rem; }
.nav-dropdown-menu { display: none; position: absolute; right: 0; top: 100%; background: white; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 180px; padding: .4rem 0; margin-top: .4rem; z-index: 50; }
.nav-dropdown.open .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a { display: block; padding: .5rem 1rem; color: var(--text); font-size: .875rem; }
.nav-dropdown-menu a:hover { background: var(--bg); text-decoration: none; }
.mobile-toggle { display: none; background: none; border: none; cursor: pointer; padding: .4rem; font-size: 1.25rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .55rem 1.1rem; border-radius: var(--radius); font-weight: 550; font-size: .875rem; border: 1px solid transparent; cursor: pointer; transition: background .15s, border-color .15s, color .15s; text-decoration: none; white-space: nowrap; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); color: white; }
.btn-secondary { background: white; border-color: var(--border); color: var(--text); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--critical); color: white; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-sm { padding: .35rem .7rem; font-size: .8rem; }
.btn-block { width: 100%; }
.panel { background: white; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-header { padding: .85rem 1.1rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.panel-body { padding: 1.1rem; }
.panel-title { font-size: .95rem; font-weight: 600; color: var(--navy); }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .75rem; }
.kpi { background: white; border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem 1rem; }
.kpi.clickable { cursor: pointer; }
.kpi.clickable:hover { border-color: var(--primary); }
.kpi-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: .25rem; }
.kpi-value { font-size: 1.35rem; font-weight: 700; color: var(--navy); line-height: 1.2; }
.kpi-sub { font-size: .75rem; color: var(--muted); margin-top: .15rem; }
.chip { display: inline-flex; align-items: center; gap: .25rem; padding: .15rem .5rem; border-radius: 4px; font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.chip-success { background: #D1FAE5; color: #065F46; }
.chip-warning { background: #FEF3C7; color: #92400E; }
.chip-critical { background: #FEE2E2; color: #991B1B; }
.chip-info { background: #DBEAFE; color: #1E40AF; }
.chip-muted { background: #F1F5F9; color: #475569; }
.chip-received { background: #E0E7FF; color: #3730A3; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: white; }
table.data-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
table.data-table th, table.data-table td { padding: .55rem .65rem; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data-table th { background: #F8FAFC; font-weight: 600; color: var(--navy); position: sticky; top: 0; z-index: 2; }
table.data-table tr:hover td { background: #F8FAFC; }
table.data-table .sticky-col { position: sticky; left: 0; background: white; z-index: 1; box-shadow: 2px 0 4px rgba(0,0,0,.04); }
table.data-table th.sticky-col { z-index: 3; background: #F8FAFC; }
.group-header th { background: var(--dark-blue); color: white; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; text-align: center; }
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: .8rem; font-weight: 550; margin-bottom: .3rem; color: var(--text); }
.form-control { width: 100%; padding: .55rem .75rem; border: 1px solid var(--border); border-radius: var(--radius); background: white; color: var(--text); }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(36,99,166,.15); }
.form-hint { font-size: .75rem; color: var(--muted); margin-top: .25rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-error { color: var(--critical); font-size: .75rem; margin-top: .25rem; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(16,36,58,.5); display: flex; align-items: center; justify-content: center; z-index: 200; padding: 1rem; opacity: 0; pointer-events: none; transition: opacity .2s; }
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal { background: white; border-radius: 8px; width: 100%; max-width: 640px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 40px rgba(0,0,0,.15); }
.modal-lg { max-width: 900px; }
.modal-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-body { padding: 1.25rem; }
.modal-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: .5rem; flex-wrap: wrap; }
.progress-bar { height: 8px; background: #E2E8F0; border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width .3s; }
.progress-fill.success { background: var(--success); }
.progress-fill.warning { background: var(--warning); }
.progress-fill.critical { background: var(--critical); }
.map-schematic { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; max-width: 680px; }
.map-lga { border: 1px solid var(--border); border-radius: 4px; padding: .5rem .4rem; text-align: center; font-size: .7rem; font-weight: 600; cursor: pointer; transition: all .15s; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #F1F5F9; }
.map-lga:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.map-lga .pct { font-size: .65rem; font-weight: 500; margin-top: 2px; }
.map-lga.high { background: #A7F3D0; border-color: #34D399; }
.map-lga.good { background: #D1FAE5; border-color: #6EE7B7; }
.map-lga.moderate { background: #FEF3C7; border-color: #FCD34D; }
.map-lga.low { background: #FECACA; border-color: #F87171; }
.map-lga.none { background: #E2E8F0; border-color: #CBD5E1; }
.feed-item { display: flex; gap: .75rem; padding: .65rem 0; border-bottom: 1px solid var(--border); font-size: .8rem; }
.feed-time { color: var(--muted); min-width: 70px; font-variant-numeric: tabular-nums; }
.feed-body { flex: 1; }
.feed-meta { color: var(--muted); font-size: .75rem; }
.candidate-row { display: grid; grid-template-columns: 140px 1fr 90px; align-items: center; gap: .75rem; margin-bottom: .65rem; }
.candidate-bar-bg { height: 22px; background: #E2E8F0; border-radius: 3px; overflow: hidden; }
.candidate-bar-fill { height: 100%; border-radius: 3px; transition: width .4s; }
.candidate-bar-fill.pdp { background: #16A34A; }
.candidate-bar-fill.apc { background: #2563EB; }
.candidate-bar-fill.lp { background: #DC2626; }
.candidate-bar-fill.nnpp { background: #7C3AED; }
.candidate-bar-fill.others { background: #64748B; }
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, var(--navy) 0%, var(--dark-blue) 100%); padding: 1.5rem; }
.auth-card { background: white; border-radius: 8px; width: 100%; max-width: 400px; padding: 2rem; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.auth-logo { text-align: center; margin-bottom: 1.5rem; }
.demo-creds { background: #F8FAFC; border: 1px dashed var(--border); border-radius: var(--radius); padding: .75rem; margin-top: 1.25rem; font-size: .8rem; color: var(--muted); }
.demo-creds code { background: #E2E8F0; padding: .1rem .3rem; border-radius: 3px; color: var(--navy); }
.agent-actions { display: grid; gap: .75rem; }
.action-card { display: flex; align-items: center; gap: 1rem; padding: 1rem; background: white; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; transition: border-color .15s; text-decoration: none; color: inherit; }
.action-card:hover { border-color: var(--primary); text-decoration: none; }
.action-icon { width: 44px; height: 44px; border-radius: 8px; background: #EFF6FF; color: var(--primary); display: grid; place-items: center; flex-shrink: 0; font-size: 1.2rem; }
.action-icon.danger { background: #FEF2F2; color: var(--critical); }
.alert { padding: .75rem 1rem; border-radius: var(--radius); font-size: .85rem; margin-bottom: 1rem; border: 1px solid transparent; }
.alert-warning { background: #FFFBEB; border-color: #FDE68A; color: #92400E; }
.alert-info { background: #EFF6FF; border-color: #BFDBFE; color: #1E40AF; }
.alert-success { background: #ECFDF5; border-color: #A7F3D0; color: #065F46; }
.alert-critical { background: #FEF2F2; border-color: #FECACA; color: #991B1B; }
.site-footer { background: var(--navy); color: #94A3B8; padding: 2.5rem 0 1.5rem; font-size: .85rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
.footer-brand { color: white; font-weight: 700; margin-bottom: .5rem; }
.footer-col h4 { color: white; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; margin-bottom: .75rem; }
.footer-col a { color: #94A3B8; display: block; margin-bottom: .35rem; }
.footer-col a:hover { color: white; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); padding-top: 1.25rem; text-align: center; font-size: .75rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.hidden { display: none !important; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.sr-toolbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-bottom: 1rem; }
.sr-toolbar .form-control { width: auto; min-width: 140px; }
.pagination { display: flex; gap: .35rem; align-items: center; justify-content: flex-end; margin-top: 1rem; flex-wrap: wrap; }
.pagination button { min-width: 32px; }
.img-preview { max-width: 100%; max-height: 240px; border: 1px solid var(--border); border-radius: var(--radius); margin-top: .5rem; }
@media (max-width: 900px) {
  .nav { display: none; }
  .nav.open { display: flex; flex-direction: column; position: absolute; top: 60px; left: 0; right: 0; background: white; border-bottom: 1px solid var(--border); padding: 1rem; gap: .75rem; z-index: 90; }
  .mobile-toggle { display: block; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .form-row, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .map-schematic { grid-template-columns: repeat(3, 1fr); }
  .candidate-row { grid-template-columns: 100px 1fr 70px; }
}
@media (max-width: 600px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr; }
  .header-inner { height: 52px; }
}
