/* ═══════════════════════════════════════════════════════════
   PoliCore Administration Portal — Production Styles
   ═══════════════════════════════════════════════════════════ */

/* ── 0. Self-hosted Inter (CSP: font-src 'self') ── */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/Inter-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/Inter-Medium.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/Inter-SemiBold.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/Inter-Bold.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('fonts/Inter-ExtraBold.woff2') format('woff2');
}

/* ── 1. Tokens & Reset ── */
:root {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;

  /* Brand — restrained saffron */
  --brand: #e86a12;
  --brand-dark: #c7560a;
  --brand-light: #f59e42;
  --brand-bg: #fdf3ea;
  --brand-ring: rgba(232,106,18,.16);
  --green: #157f3c;
  --green-bg: #e9f6ee;
  --navy: #0f172a;

  /* One cohesive neutral scale (slate) */
  --canvas: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #fbfcfd;
  --line: #e7ebf0;
  --line-strong: #d6dce4;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --text: #0f172a;
  --text-2: #334155;
  --accent: var(--brand);

  /* Status */
  --ok: #157f3c;      --ok-bg: #e9f6ee;
  --warn: #b45309;    --warn-bg: #fdf3e7;
  --danger: #dc2626;  --danger-bg: #fef2f2;  --danger-line: #fecaca;
  --info: #2563eb;    --info-bg: #eef3fe;

  /* Spacing scale */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s7: 32px; --s8: 40px;

  /* Radius scale */
  --r-xs: 8px; --r-sm: 10px; --r: 14px; --r-lg: 18px; --r-xl: 24px; --r-pill: 999px;
  --radius: 14px;
  --radius-lg: 18px;

  /* Softer, layered shadows */
  --shadow-sm: 0 1px 2px rgba(15,23,42,.05), 0 1px 3px rgba(15,23,42,.04);
  --shadow-md: 0 4px 12px rgba(15,23,42,.06), 0 2px 4px rgba(15,23,42,.04);
  --shadow-lg: 0 14px 34px rgba(15,23,42,.10), 0 4px 10px rgba(15,23,42,.05);
  --shadow-xl: 0 28px 64px rgba(15,23,42,.16);

  color: var(--text);
  background: var(--canvas);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; display: flex; min-height: 100vh; background: var(--canvas); color: var(--text); }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
#portal-root { display: contents; }

/* ── 2. Sidebar ── */
aside {
  width: 268px;
  background: linear-gradient(168deg, #0f172a, #1e293b 60%, #1e293b);
  color: #e2e8f0;
  padding: 28px 20px;
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 2;
  border-right: 1px solid rgba(255,255,255,.06);
}

.brand {
  font-size: 28px;
  font-weight: 800;
  text-decoration: none;
  color: white;
  letter-spacing: -1px;
  display: block;
}
.brand span { color: var(--brand-light); }
.brand small {
  display: block;
  font-size: 9px;
  letter-spacing: 2.5px;
  margin-top: 5px;
  color: #94a3b8;
  font-weight: 600;
}

.district-label {
  font-size: 13px;
  color: #94a3b8;
  margin: 24px 0 20px;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.district-label .badge {
  display: flex;
  width: fit-content;
  margin-top: 10px;
  background: rgba(255,255,255,.06);
  color: var(--brand-light);
  font-size: 9px;
  letter-spacing: 1px;
  border: 1px solid rgba(255,255,255,.08);
}

.nav-group {
  display: block;
  margin: 20px 8px 8px;
  color: #64748b;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
}

nav { display: grid; gap: 3px; }
nav button {
  background: transparent;
  text-align: left;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 500;
  padding: 11px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  transition: background .18s, color .18s, transform .18s;
  min-height: 42px;
  white-space: nowrap;
}
nav button span { font-size: 10px; color: #64748b; font-variant-numeric: tabular-nums; }
nav button:hover { background: rgba(255,255,255,.055); color: #f1f5f9; }
nav button.selected {
  background: linear-gradient(90deg, rgba(232,106,18,.22), rgba(232,106,18,.08));
  border-color: rgba(232,106,18,.28);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--brand-light), 0 0 18px rgba(232,106,18,.12);
  font-weight: 600;
}
nav button.selected span { color: var(--brand-light); }
nav button.selected:hover { background: linear-gradient(90deg, rgba(232,106,18,.28), rgba(232,106,18,.1)); color: #fff; }
.nav-icon { width: 20px; height: 20px; flex-shrink: 0; }
#nav .selected .nav-icon { color: var(--brand-light); }

.sidebar-foot {
  margin-top: auto;
  padding-top: 28px;
  font-size: 11px;
  line-height: 1.8;
  color: #94a3b8;
  border-top: 1px solid rgba(255,255,255,.06);
}
.sidebar-foot small { color: #64748b; }
.connection-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  margin-right: 6px;
  box-shadow: 0 0 6px #22c55e80;
}

/* A single, subtle tricolor accent at the sidebar foot — the one flag nod. */
aside::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  opacity: .7;
  background: linear-gradient(90deg, #f59e42 33%, #e2e8f0 33% 66%, #157f3c 66%);
}

/* ── 3. Main content ── */
main {
  margin-left: 268px;
  padding: 28px 36px;
  width: calc(100% - 268px);
  max-width: 1600px;
  min-width: 0;
  flex: none;
}

/* Header bar */
header, .toolbar, .dialog-head, .section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
main > header {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px 26px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
main > header::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--brand);
}

h1 { font-size: clamp(22px, 2.2vw, 29px); letter-spacing: -.4px; margin: 4px 0; font-weight: 800; color: var(--text); }
h2 { font-size: 18px; letter-spacing: -.2px; margin: 6px 0; font-weight: 700; color: var(--text); }
h3 { font-size: 15px; font-weight: 600; color: var(--text); }
p { line-height: 1.6; color: var(--muted); }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 1.2px; color: var(--brand); margin: 0; text-transform: uppercase; }
.header-detail { margin: 6px 0 0; font-size: 12px; line-height: 1.6; max-width: 70ch; overflow-wrap: anywhere; color: var(--muted); }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── 4. Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card:hover { box-shadow: var(--shadow-md); }

/* ── 5. Buttons ── */
button {
  font-size: 13px;
  font-weight: 600;
  background: var(--brand);
  color: white;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 9px 16px;
  min-height: 40px;
  cursor: pointer;
  letter-spacing: .1px;
  transition: background .15s, border-color .15s, transform .12s, box-shadow .15s;
}
button:hover { background: var(--brand-dark); box-shadow: var(--shadow-sm); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .55; cursor: not-allowed; }
button.secondary {
  background: var(--surface);
  color: var(--text-2);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-sm);
}
button.secondary:hover { background: var(--surface-2); border-color: var(--muted-2); box-shadow: var(--shadow-md); }
button.danger { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-line); }
button.danger:hover { background: #fee2e2; box-shadow: var(--shadow-sm); }
button.primary {
  background: var(--brand);
  box-shadow: 0 2px 6px var(--brand-ring);
}
button.primary:hover { background: var(--brand-dark); box-shadow: 0 4px 12px var(--brand-ring); }
button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ── 6. Forms ── */
form { display: grid; gap: 16px; }
label { display: grid; gap: 6px; font-size: 12px; font-weight: 600; color: #374151; }
input, select, textarea {
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  width: 100%;
  min-height: 42px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}
progress { width: 100%; height: 8px; accent-color: var(--brand); }

/* ── 7. Hero banner ── */
.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 28px 32px;
  border-radius: var(--r-xl);
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(232,106,18,.22), transparent 60%),
    linear-gradient(135deg, #111c30, #1a2740);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.hero::after {
  content: '';
  position: absolute;
  right: -40px;
  top: -80px;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(232,106,18,.18), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
}
.hero .eyebrow { color: var(--brand-light); }
.hero h2 { font-size: 25px; color: #fff; letter-spacing: -.3px; margin-top: 10px; }
.hero p:not(.eyebrow) { font-size: 13px; color: #cbd5e1; margin-bottom: 0; }
.hero-actions { display: grid; gap: 8px; min-width: 150px; }
.hero-actions > button:first-child { background: var(--brand); color: #fff; font-weight: 600; }
.hero-actions > button:first-child:hover { background: var(--brand-light); }
.hero-actions .secondary { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.22); box-shadow: none; }
.hero-actions .secondary:hover { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.35); }

/* ── 8. Stats cards ── */
.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 20px 0 24px;
}
.overview-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 16px 0; }
.stats span { font-size: 12px; color: var(--muted); font-weight: 500; }
.stats strong {
  display: block;
  font-size: 30px;
  letter-spacing: -1px;
  margin: 8px 0 4px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  color: var(--text);
}
.stats small { color: var(--muted); font-size: 11px; }
.stats .card { position: relative; overflow: hidden; padding: 18px 20px; }
.stats .card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
/* A single restrained accent bar on the left, same for every stat card. */
.stats .card::before {
  content: '';
  position: absolute;
  left: 0; top: 14px; bottom: 14px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--brand);
}
.overview-stats .card:nth-child(2)::before { background: var(--green); }
.overview-stats .card:nth-child(3)::before { background: var(--info); }
.overview-stats .card:nth-child(4)::before { background: var(--muted-2); }

.metric-link {
  background: transparent !important;
  color: var(--brand-dark) !important;
  padding: 0;
  min-height: 28px;
  font-size: 11px;
  font-weight: 600;
  border: 0 !important;
  text-decoration: none;
}
.metric-link:hover { text-decoration: underline; }

/* Progress meter in stats */
.overview-stats meter { width: 100%; height: 8px; margin-top: 10px; }
.overview-stats meter::-webkit-meter-bar { border: 0; background: var(--line); border-radius: var(--r-pill); }
.overview-stats meter::-webkit-meter-optimum-value { background: linear-gradient(90deg, var(--brand-dark), var(--brand-light)); border-radius: var(--r-pill); }

/* ── 9. Gender overview ── */
.gender-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 20px;
}
.gender-overview button {
  --metric-color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text);
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  border-left: 4px solid var(--metric-color);
  background: var(--surface);
  min-width: 0;
  transition: transform .2s, box-shadow .2s;
}
.gender-overview .gender-female { --metric-color: var(--green); }
.gender-overview .gender-other { --metric-color: #7c3aed; }
.gender-overview .gender-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.gender-overview strong { font-size: 26px; font-variant-numeric: tabular-nums; font-weight: 800; overflow-wrap: anywhere; }
.gender-overview button:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.gender-overview button:focus-visible { outline: 3px solid var(--metric-color); outline-offset: 3px; }

.metric-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(232,106,18,.08);
  color: var(--metric-color);
  flex-shrink: 0;
}
.gender-female .metric-icon { background: rgba(19,136,8,.08); }
.gender-other .metric-icon { background: rgba(124,58,237,.08); }
.metric-icon svg { width: 22px; height: 22px; transition: transform .2s ease; }
.gender-overview button:hover .metric-icon svg { transform: scale(1.1); }

/* ── 10. Dashboard grid ── */
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dashboard-grid .card { padding: 20px; }
.dashboard-grid h2::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 18px;
  background: var(--brand);
  border-radius: 3px;
  margin-right: 10px;
  vertical-align: middle;
}
.section-head { margin-bottom: 16px; flex-wrap: wrap; }
.section-head button { font-size: 11px; min-height: 34px; padding: 7px 12px; }
.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}
.summary-row:last-child { border: 0; }
.summary-row strong { color: var(--text); font-size: 18px; font-weight: 700; }

/* Section Headers & Architecture */
.overview-section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 32px 0 16px 0;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--line);
}
.overview-section-header:first-of-type {
  margin-top: 18px;
}
.section-num-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 2px 5px rgba(234, 88, 12, 0.3);
  flex-shrink: 0;
}
.overview-section-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--brand-dark);
  margin: 0;
  letter-spacing: -0.2px;
}
.overview-section-header span.section-desc {
  font-size: 12px;
  color: var(--muted);
  margin-left: 2px;
}

/* Feed */
.overview-feed { margin-top: 20px; }
.feed-row { padding: 16px 0; border-top: 1px solid var(--line); }
.feed-row h3 { margin: 10px 0 4px; }
.feed-row p { margin: 0; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ── 11. Toolbar ── */
.toolbar { margin: 24px 0 18px; }
.toolbar p { margin: 4px 0; font-size: 13px; }

/* ── 12. Filter bar ── */
.filter-bar {
  display: grid;
  grid-template-columns: minmax(200px, 2fr) repeat(3, minmax(130px, 1fr));
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 16px 0 10px;
  box-shadow: var(--shadow-sm);
}
.search { min-width: 0; }

#people .filter-bar {
  grid-template-columns: minmax(160px, 1.5fr) repeat(4, minmax(120px, 1fr));
  padding: 14px;
  gap: 10px;
}

/* ── 13. Enhanced People Cards ── */
.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}
.person {
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
}
.person:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.person-header-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.person-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}
.person-avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #fff7ed 0%, #fed7aa 100%);
  color: #ea580c;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(234, 88, 12, 0.2);
}
.person:nth-child(2n) .person-avatar {
  background: linear-gradient(135deg, #eff6ff 0%, #bfdbfe 100%);
  color: #2563eb;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.2);
}
.person:nth-child(3n) .person-avatar {
  background: linear-gradient(135deg, #f0fdf4 0%, #bbf7d0 100%);
  color: #16a34a;
  box-shadow: inset 0 0 0 1px rgba(22, 163, 74, 0.2);
}
.person-status-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid var(--surface);
}
.person-status-dot.active { background: #16a34a; }
.person-status-dot.blocked { background: #dc2626; }
.person-status-dot.removed { background: #94a3b8; }

.person-identity {
  flex: 1;
  min-width: 0;
}
.person-name-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.person-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--brand-dark);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.person-role-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #475569;
}
.role-owner { background: #fef3c7; color: #b45309; }
.role-admin { background: #ffedd5; color: #c2410c; }
.role-staff { background: #e0e7ff; color: #4338ca; }
.role-user { background: #f0fdf4; color: #15803d; }

.person-designation {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 3px 0;
}
.person-email {
  font-size: 12px;
  color: #64748b;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.person-scope-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: var(--surface-2);
  border-radius: 8px;
  margin: 10px 0;
  font-size: 11px;
}
.scope-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--brand-dark);
  font-weight: 500;
}
.scope-permission-chip {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}
.chip-edit-yes { background: #dcfce7; color: #166534; }
.chip-edit-no { background: #fee2e2; color: #991b1b; }
.chip-export { background: #e0f2fe; color: #075985; }

.person-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  padding: 10px 6px;
  margin-bottom: 12px;
  text-align: center;
}
.p-metric-item small {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 2px;
}
.p-metric-item strong {
  font-size: 15px;
  color: var(--brand-dark);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Per-user political-leaning breakdown */
.person-leaning { margin-bottom: 12px; }
.person-leaning-title {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--muted);
  font-weight: 600;
  margin: 0 0 6px 2px;
}
.leaning-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.leaning-chip {
  text-align: center;
  padding: 8px 4px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line);
  background: var(--surface);
  border-left: 3px solid var(--muted-2);
}
.leaning-chip strong { display: block; font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text); }
.leaning-chip small { font-size: 9.5px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); font-weight: 600; }
.leaning-chip.leaning-supporter { border-left-color: var(--green); background: var(--green-bg); }
.leaning-chip.leaning-opposition { border-left-color: var(--danger); background: var(--danger-bg); }
.leaning-chip.leaning-undecided { border-left-color: var(--warn); background: var(--warn-bg); }
.leaning-chip.leaning-no_info { border-left-color: var(--info); background: var(--info-bg); }

.person-actions-panel {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.person-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.person-action-row button, .person-action-row a {
  flex: 1 1 auto;
  font-size: 11px;
  padding: 6px 10px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
}
.btn-quick-action {
  background: #fff;
  border: 1px solid #cbd5e1;
  color: #334155;
}
.btn-quick-action:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}
.btn-danger-subtle {
  color: #dc2626 !important;
  border-color: #fecaca !important;
  background: #fef2f2 !important;
}
.btn-danger-subtle:hover {
  background: #fee2e2 !important;
  border-color: #fca5a5 !important;
}
.protected-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #64748b;
  padding: 8px 12px;
  background: #f1f5f9;
  border-radius: 6px;
  margin-top: 4px;
  font-weight: 500;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: var(--r-pill);
  background: var(--ok-bg);
  color: var(--ok);
  padding: 4px 11px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .2px;
}
.badge.off { background: var(--danger-bg); color: var(--danger); }
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 14px;
}
.actions button { font-size: 11px; padding: 8px 12px; min-height: 36px; }

/* ── 14. Notices ── */
.notice { margin: 14px 0; }
.notice p { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ── 15. Tables ── */
.table-wrap {
  overflow: auto;
  padding: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  max-height: 65vh;
  border: 1px solid var(--line);
}
table { border-collapse: collapse; width: 100%; min-width: 760px; font-size: 13px; }
th {
  background: var(--surface-2);
  text-align: left;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  padding: 13px 16px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: .4px;
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom: 1px solid var(--line-strong);
}
td { padding: 13px 16px; border-top: 1px solid var(--line); color: var(--text-2); max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.wrap { white-space: normal; overflow-wrap: anywhere; }
tbody tr { transition: background .14s; }
tbody tr:nth-child(even) { background: var(--surface-2); }
tbody tr:hover { background: var(--brand-bg); }
.table-wrap button { padding: 6px 12px; min-height: 32px; background: var(--surface); border: 1px solid var(--line-strong); color: var(--brand-dark); border-radius: var(--r-xs); font-size: 12px; box-shadow: none; }
.table-wrap button:hover { background: var(--brand-bg); border-color: var(--brand-light); box-shadow: none; }

/* ── 16. Voter search form ── */
#voter-search-form {
  grid-template-columns: minmax(120px, 1.2fr) minmax(150px, 1.6fr) repeat(4, minmax(95px, 1fr)) auto;
  padding: 12px;
  gap: 10px;
}
#voter-search-form input, #voter-search-form select { padding: 10px; min-height: 42px; }
#voter-detail dd { white-space: pre-wrap; }
#voter-detail h3 { padding-top: 16px; border-top: 1px solid var(--line); }

/* ── 17. Areas ── */
.area-filters {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 16px;
  margin: 16px 0;
  padding: 18px;
}
.area-filters label { font-size: 12px; }
.area-filters select { background: white; min-height: 44px; border-radius: 10px; }
.area-filters p { grid-column: 1 / -1; margin: 0; }
.area-directory .area-row { padding: 14px 0; }
.area-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.area-row:last-child { border: 0; }
.area-info { flex: 1; min-width: 0; }
.area-info h3 { margin: 4px 0; overflow-wrap: anywhere; }
.area-row button { font-size: 11px; }
.depth-1 { padding-left: 20px; }
.depth-2 { padding-left: 40px; }
.depth-3 { padding-left: 60px; }
.depth-4 { padding-left: 80px; }

/* ── 18. Details / Voter detail ── */
dl { display: grid; gap: 8px; }
dt { font-size: 11px; color: var(--muted); margin-top: 10px; text-transform: uppercase; letter-spacing: .5px; }
dd { margin: 0; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.detail-grid dd { font-size: 14px; }

/* Survey codes */
.survey-code {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  border: 1px solid var(--line);
  padding: 6px 14px;
  border-radius: 100px;
  background: #f9fafb;
  font-size: 12px;
}
.survey-code::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.code-RED { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.code-RED::before { background: #ef4444; }
.code-AQUA { background: #ecfeff; color: #0e7490; border-color: #a5f3fc; }
.code-AQUA::before { background: #06b6d4; }
.code-GREEN { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.code-GREEN::before { background: #22c55e; }
.code-BLUE { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.code-BLUE::before { background: #3b82f6; }
.code-YELLOW { background: #fefce8; color: #854d0e; border-color: #fef08a; }
.code-YELLOW::before { background: #eab308; }

/* Tags */
.tag-options {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: #f9fafb;
}
.tag-options label { display: flex; align-items: center; gap: 6px; font-weight: 500; }
.tag-options input { width: 18px; min-height: 18px; margin: 0; }
#survey-person { font-weight: 600; font-size: 13px; margin-bottom: 0; }

/* WhatsApp + Dialer */
.whatsapp {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #16a34a;
  color: white;
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13px;
}
.whatsapp:hover { background: #15803d; }
.whatsapp svg { width: 22px; height: 22px; }
.detail-actions .whatsapp, .dialer {
  width: 44px;
  height: 44px;
  min-height: 44px;
  box-sizing: border-box;
  padding: 10px;
  justify-content: center;
  display: inline-flex;
  align-items: center;
  border-radius: 12px;
}
.dialer { background: var(--brand-bg); color: var(--brand); text-decoration: none; }
.dialer svg { width: 22px; height: 22px; }
.dialer:hover { background: #fed7aa; }

/* ── 19. Hints, Errors, Status ── */
.hint, footer { font-size: 12px; line-height: 1.7; color: var(--muted); }
footer { padding: 28px 0; max-width: 900px; border-top: 1px solid var(--line); margin-top: 32px; }
.error { color: var(--danger); margin: 0; font-size: 13px; }
.hint.is-error { color: var(--danger); }
.hint.is-loading { color: var(--muted); display: inline-flex; align-items: center; gap: 8px; }
.hint.is-loading::before {
  content: '';
  width: 14px; height: 14px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* Empty state — framed, with icon + message */
.empty-state {
  display: grid;
  place-items: center;
  gap: 8px;
  text-align: center;
  padding: 40px 24px;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--surface-2);
}
.empty-state .empty-icon {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--brand-bg);
  color: var(--brand);
  font-size: 22px;
  margin-bottom: 4px;
}
.empty-state strong { color: var(--text-2); font-size: 14px; font-weight: 600; }
.empty-state p { margin: 0; font-size: 12.5px; max-width: 42ch; }

/* Skeleton loaders */
.skeleton {
  background: linear-gradient(90deg, var(--line) 25%, var(--surface-2) 37%, var(--line) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--r-xs);
}
.skeleton-row { height: 44px; margin: 8px 0; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

#status:not(:empty) {
  background: var(--warn-bg);
  border: 1px solid #fcd9a8;
  border-radius: var(--r-sm);
  padding: 12px 18px;
  font-size: 13px;
  color: var(--warn);
}
#retry-session { width: 100%; margin-top: 14px; min-height: 44px; }

/* ── 20. Dialogs ── */
dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: min(600px, 94vw);
  max-height: 90vh;
  color: inherit;
  box-shadow: var(--shadow-xl);
  background: var(--surface);
}
dialog::backdrop { background: rgba(15,23,42,.5); backdrop-filter: blur(6px); }
.dialog-head h2 { margin: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checks { display: grid; gap: 10px; }
.checks label { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.checks input { width: 20px; min-height: 20px; margin: 0; accent-color: var(--brand); }

/* ── 21. Audit log ── */
.audit { padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 13px; overflow-wrap: anywhere; }
.audit:last-child { border: 0; }
.audit small { display: block; color: var(--muted); margin-top: 4px; }

/* ── 22. Availability / Settings ── */
.availability { padding: 14px 0; border-bottom: 1px solid var(--line); }
.availability p { font-size: 13px; margin-bottom: 0; }

/* ── 23. Work metrics ── */
.work-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 12px 0; }
.work-metrics strong { display: block; font-size: 17px; color: var(--brand-dark); }
.work-metric { padding: 10px 6px; background: #f9fafb; border: 1px solid var(--line); border-radius: 10px; font-size: 11px; text-align: center; overflow-wrap: anywhere; }
.work-visit { padding: 12px; border: 1px solid var(--line); border-radius: 12px; margin: 8px 0; background: #f9fafb; overflow-wrap: anywhere; }
#work-history { max-height: 55vh; overflow: auto; }
#work-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 12px 16px; background: var(--brand-bg); border-radius: 12px; font-weight: 600; }

/* ── 24. Import ── */
#import-form details { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin: 4px 0; }
#import-form details summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-2); }
#import-form details[open] summary { margin-bottom: 10px; }
#import-form #booth-removal { background: var(--danger-bg); border-color: var(--danger-line); }
#import-form #booth-removal summary { color: var(--danger); }
#import-form .muted { font-size: 12px; line-height: 1.5; }

/* ── 25. Survey dialog ── */
#survey-dialog {
  width: min(760px, 94vw);
  padding: 28px;
  background: linear-gradient(150deg, #fff, #fffbf7);
}
#survey-dialog .dialog-head {
  padding: 20px;
  border-radius: 16px;
  background: linear-gradient(110deg, #ea580c, #f97316);
  color: white;
}
#survey-dialog .dialog-head .eyebrow, #survey-dialog .dialog-head p { color: #fed7aa; }
#survey-dialog .dialog-head p { margin-bottom: 0; }
#survey-dialog .tag-options { padding: 14px; border-color: #fde68a; background: #fff; border-radius: 14px; }
#survey-dialog .survey-verification { padding: 14px; border: 1px solid #fde68a; border-radius: 14px; background: #fffbeb; }
#survey-dialog select { border-color: var(--line); background: white; }
#survey-dialog .checks { padding: 12px; border-radius: 12px; background: #fffbeb; }
#survey-dialog button:not(.close) { min-height: 46px; background: linear-gradient(110deg, var(--brand), var(--brand-dark)); }

/* ── 26. Results ── */
.results-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 28px;
  border-radius: var(--radius-lg);
  background: linear-gradient(115deg, #ea580c, #f97316 58%, #fb923c);
  color: white;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.results-hero::before {
  content: '';
  position: absolute;
  width: 200px;
  height: 200px;
  border: 36px solid rgba(255,255,255,.06);
  border-radius: 50%;
  right: 18%;
  top: -140px;
  pointer-events: none;
  z-index: -1;
}
.results-hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--brand-light), #fff, #138808, transparent);
  z-index: 1;
}
.results-hero h2 { margin: 6px 0; font-size: 28px; }
.results-hero p { color: #fed7aa; margin: 0; }
.results-hero .eyebrow { color: #fed7aa; }
.results-emblem {
  width: 56px;
  height: 56px;
  padding: 12px;
  flex: none;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 16px;
  color: #fed7aa;
}
.results-hero > div:first-of-type { flex: 1; min-width: 0; }
.results-hero .actions { margin: 0; padding: 0; border: 0; }
.results-hero .secondary { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.25); color: white; }

.results-filters { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 14px; margin-bottom: 18px; padding: 18px; }
.result-tabs { display: flex; gap: 6px; margin: 18px 0; padding: 4px; background: #f1f5f9; border: 1px solid var(--line); width: fit-content; border-radius: 100px; }
.result-tabs button { border-radius: 100px; padding: 8px 20px; border: 0; min-height: 36px; }
.result-tabs .selected { background: var(--navy); color: white; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.result-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.result-stats article { padding: 20px; border-top: 3px solid var(--brand); background: var(--surface); }
.result-stats article:nth-child(2) { border-color: var(--brand-dark); }
.result-stats article:nth-child(3) { border-color: var(--green); }
.result-stats article:nth-child(4) { border-color: var(--green); }
.result-stats span { display: block; color: var(--muted); font-size: 12px; }
.result-stats strong { display: block; font-size: 26px; margin-top: 8px; font-variant-numeric: tabular-nums; }
.result-stats article:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.result-stats article { transition: transform .2s, box-shadow .2s; }

#result-panel > .card, .result-editor { margin-bottom: 18px; }
.candidate-row { padding: 18px 0; border-top: 1px solid var(--line); }
.candidate-row > div { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.candidate-row span { color: var(--muted); }
.candidate-row strong { font-size: 15px; }
.candidate-row meter { width: 100%; height: 16px; border: 0; border-radius: 8px; }
.candidate-row meter::-webkit-meter-bar { border: 0; background: #f1f5f9; border-radius: 8px; }
.candidate-row meter::-webkit-meter-optimum-value { background: linear-gradient(90deg, var(--brand), var(--brand-light)); border-radius: 8px; }
.candidate-row:nth-child(3n) meter::-webkit-meter-optimum-value { background: linear-gradient(90deg, var(--green), #4ade80); }
.candidate-chart h3 { margin: 0 0 18px; }
.candidate-row:last-child { padding-bottom: 4px; }

#result-panel td meter { display: block; width: 100%; max-width: 150px; height: 8px; margin-top: 4px; }
#result-panel td meter::-webkit-meter-bar { background: #f1f5f9; border: 0; border-radius: 6px; }
#result-panel td meter::-webkit-meter-optimum-value { background: var(--brand); border-radius: 6px; }

/* ── 27. WhatsApp support button ── */
.support-whatsapp {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #16a34a;
  color: white;
  box-shadow: 0 4px 16px rgba(22,163,74,.3);
  transition: transform .18s, box-shadow .18s;
  text-decoration: none;
}
.support-whatsapp:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(22,163,74,.35); background: #15803d; }
.support-whatsapp svg { width: 28px; height: 28px; }

/* ── 28. Login ── */
body.signed-out {
  background: radial-gradient(ellipse at 8% 12%, var(--brand-bg), transparent 48%),
              radial-gradient(ellipse at 95% 90%, var(--green-bg), transparent 45%),
              var(--canvas);
}
.signed-out aside, .signed-out main > header { display: none; }
.signed-out main {
  margin: 0;
  padding: 42px 24px;
  width: 100%;
  max-width: none;
  min-height: 100vh;
  display: grid;
  align-content: center;
}
.signed-out #status, .signed-out #setup { width: min(100%, 1000px); margin: 0 auto 16px; }
.signed-out #status:empty { display: none; }

#login {
  width: min(100%, 1000px);
  max-width: 1000px;
  margin: 0 auto;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  border-radius: 24px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xl);
}
#login[hidden] { display: none; }

.login-intro {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(120% 120% at 100% 0%, rgba(232,106,18,.28), transparent 55%),
    linear-gradient(150deg, #0c1526, #16233c 60%, #1a2a47);
  padding: 44px;
  color: #fff;
}
.login-brand { display: inline-block; font-size: 30px; font-weight: 800; letter-spacing: -.5px; color: white; text-decoration: none; }
.login-brand > span { color: var(--brand-light); }
.login-brand small { display: block; font-size: 9px; letter-spacing: 2.5px; margin-top: 5px; color: #94a3b8; }
.login-intro h2 { font-size: 31px; line-height: 1.2; letter-spacing: -.5px; margin: 10px 0 16px; color: #fff; }
.login-intro p { color: #cbd5e1; font-size: 14px; margin: 0; }
.login-features { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.login-features span { font-size: 11px; color: #e2e8f0; border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.07); padding: 7px 12px; border-radius: var(--r-pill); }

.login-art { position: relative; height: 180px; display: grid; place-items: center; margin: 20px 0 16px; }
.login-emblem {
  position: relative;
  display: grid;
  place-items: center;
  width: 100px;
  height: 100px;
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(245,158,66,.25), rgba(255,255,255,.08));
  border: 1px solid rgba(245,158,66,.3);
  box-shadow: 0 12px 32px rgba(0,0,0,.2);
  transform: rotate(-7deg);
}
.login-emblem svg { width: 56px; height: 56px; color: #fed7aa; transform: rotate(7deg); }
.login-orbit { position: absolute; width: 170px; height: 170px; border: 1px solid rgba(245,158,66,.15); border-radius: 50%; }
.login-art-dot { position: absolute; width: 14px; height: 14px; border-radius: 5px; }
.dot-one { background: var(--brand-light); left: 22%; top: 23%; transform: rotate(20deg); }
.dot-two { background: #fed7aa; right: 22%; bottom: 20%; transform: rotate(-15deg); }

.login-panel { padding: 44px 40px 36px; align-self: center; }
.login-lock { display: grid; place-items: center; width: 50px; height: 50px; background: #fff7ed; color: var(--brand); border-radius: 16px; margin-bottom: 22px; }
.login-lock svg { width: 24px; height: 24px; }
.login-panel h2 { font-size: 28px; margin: 6px 0; }
.login-panel > p:not(.eyebrow) { font-size: 13px; margin: 0 0 24px; }
.login-panel form { gap: 18px; }
.login-field { position: relative; display: flex; align-items: center; }
.login-field > svg { position: absolute; left: 14px; width: 20px; height: 20px; color: #9ca3af; pointer-events: none; }
.login-field input { padding: 12px 44px; min-height: 48px; background: #f9fafb; border-radius: 10px; }
.login-field:focus-within > svg { color: var(--brand); }
.login-field .password-toggle { position: absolute; right: 4px; padding: 10px; background: transparent; color: #9ca3af; box-shadow: none; min-width: 44px; border: 0; }
.password-toggle svg { display: block; width: 20px; height: 20px; }
.password-toggle:hover { color: var(--brand); }

.login-panel #login-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  border-radius: 10px;
  background: linear-gradient(110deg, var(--brand), var(--brand-dark));
  box-shadow: 0 4px 16px rgba(232,106,18,.2);
  position: relative;
  overflow: hidden;
}
.login-arrow { width: 18px; height: 18px; transition: transform .2s; }
#login-submit:hover .login-arrow { transform: translateX(4px); }
.login-spinner { display: none; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: white; border-radius: 50%; }
#login-form[aria-busy=true] .login-spinner { display: block; animation: spin .7s linear infinite; }
#login-form[aria-busy=true] .login-arrow { display: none; }
.login-panel #forgot-password { display: block; margin: 12px auto 0; background: transparent; border: 0; color: var(--brand); font-weight: 600; }
.login-panel .login-footnote { font-size: 11px !important; text-align: center; margin: 20px 0 0 !important; color: #9ca3af; }
.login-panel #login-error { margin: 0; padding: 12px; background: #fef2f2; border: 1px solid #fecaca; border-radius: 10px; font-size: 12px; line-height: 1.5; color: #dc2626; }

/* ── 29. Animations ── */
@keyframes arrive { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes workspace-entry { from { opacity: .5; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes login-arrive { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes login-emblem { from { opacity: 0; transform: translateY(14px) rotate(-15deg); } to { opacity: 1; transform: rotate(-7deg); } }
@keyframes login-dot { from { opacity: 0; translate: 0 14px; } to { opacity: 1; translate: 0 0; } }
@keyframes count-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes dialog-pop { from { opacity: 0; transform: scale(.94) translateY(6px); } to { opacity: 1; transform: none; } }

#login { animation: login-arrive .5s ease-out; }
.login-emblem { animation: login-emblem 1.2s ease-out; }
.dot-one { animation: login-dot 1.5s ease-out; }
.dot-two { animation: login-dot 1.8s ease-out; }
.page:not([hidden]) { animation: workspace-entry .25s ease both; }
dialog[open] { animation: dialog-pop .22s cubic-bezier(.22, 1, .36, 1); }
.stats .card, .person { animation: count-up .3s ease-out both; }
.stats .card:nth-child(2), .person:nth-child(2) { animation-delay: .04s; }
.stats .card:nth-child(3), .person:nth-child(3) { animation-delay: .08s; }
.stats .card:nth-child(4), .person:nth-child(4) { animation-delay: .12s; }
.person:nth-child(5) { animation-delay: .16s; }

tbody tr { animation: count-up .2s ease both; }
tbody tr:nth-child(2) { animation-delay: .02s; }
tbody tr:nth-child(3) { animation-delay: .04s; }
tbody tr:nth-child(4) { animation-delay: .06s; }
tbody tr:nth-child(5) { animation-delay: .08s; }

/* ── 30. Responsive ── */
@media (max-width: 1200px) {
  #voter-search-form { grid-template-columns: 1fr 1fr; }
  #voter-search-form button { grid-column: 1 / -1; }
  #people .filter-bar { grid-template-columns: 1fr 1fr; }
  #people .filter-bar .search { grid-column: 1 / -1; }
}

@media (max-width: 1100px) {
  main { padding: 24px; }
  .filter-bar { grid-template-columns: 1fr 1fr; }
  .overview-stats { grid-template-columns: 1fr 1fr; }
  .hero h2 { font-size: 22px; }
  .result-stats { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 850px) {
  body { display: block; }
  aside {
    position: static;
    width: 100%;
    padding: 18px 20px;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
  }
  aside::after { display: none; }
  .brand { font-size: 24px; }
  .district-label, .sidebar-foot, .nav-group { display: none; }
  nav { display: flex; flex-wrap: wrap; gap: 4px; width: 100%; margin-top: 12px; }
  nav button { padding: 8px 12px; font-size: 12px; gap: 6px; min-height: 36px; }
  main { margin: 0; padding: 20px; width: 100%; }
  h1 { font-size: 24px; }
  .results-hero { flex-direction: column; align-items: flex-start; }
  .results-filters { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .signed-out main { padding: 20px 16px; }
  #login { grid-template-columns: 1fr; border-radius: 20px; }
  .login-intro { padding: 24px 28px; }
  .login-art, .login-features, .login-intro > p, .login-intro > h2 { display: none; }
  .login-panel { padding: 28px 24px; }
  .login-lock { margin-bottom: 18px; }
  .login-panel h2 { font-size: 26px; }
}

@media (max-width: 550px) {
  header { align-items: flex-start; flex-direction: column; gap: 12px; }
  .header-actions { width: 100%; }
  .header-actions button { flex: 1; }
  .hero { align-items: flex-start; flex-direction: column; padding: 20px; }
  .hero::after { display: none; }
  .hero-actions { display: flex; flex-wrap: wrap; }
  .hero h2 { font-size: 22px; }
  .stats { gap: 8px; }
  .stats .card { padding: 14px 12px; border-radius: 12px; }
  .stats strong { font-size: 24px; }
  .stats span { font-size: 11px; }
  .stats small { font-size: 10px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .toolbar { align-items: flex-start; flex-direction: column; }
  .form-grid, .filter-bar { grid-template-columns: 1fr; }
  .filter-bar { padding: 14px; }
  main { padding: 16px; }
  .card { padding: 18px; }
  .area-filters { grid-template-columns: 1fr; gap: 12px; }
  .area-row { flex-wrap: wrap; gap: 8px; }
  .area-row .hint { display: none; }
  .area-row button { padding: 8px; min-height: 36px; }
  .depth-1 { padding-left: 8px; }
  .depth-2 { padding-left: 16px; }
  .depth-3 { padding-left: 24px; }
  .depth-4 { padding-left: 32px; }
  .section-head { gap: 8px; }
  nav button span { display: none; }
  .gender-overview { gap: 8px; }
  .gender-overview button { padding: 10px 6px; gap: 8px; flex-direction: column; }
  .gender-overview strong { font-size: 20px; }
  .metric-icon { width: 32px; height: 32px; }
  .detail-grid { grid-template-columns: 1fr; }
  .voter-stats { grid-template-columns: 1fr 1fr; }
  #voter-search-form label:nth-child(-n+2) { grid-column: 1 / -1; }
  .work-metrics, #work-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .results-hero h2 { font-size: 24px; }
  .result-stats { grid-template-columns: 1fr 1fr; }
}

/* ── 31. Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  nav button:hover,
  button:not(:disabled):active,
  .result-stats article:hover,
  .stats .card:hover,
  .gender-overview button:hover,
  .person:hover { transform: none; }
}

/* ── 32. Scrollbar ── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }
aside::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); }
aside::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.25); }

/* ── 33. Tricolor bar (kept for compatibility) ── */
.tricolor-bar { display: flex; height: 3px; }
.tricolor-bar > span:nth-child(1) { flex: 1; background: var(--brand-light); }
.tricolor-bar > span:nth-child(2) { flex: 1; background: #fff; }
.tricolor-bar > span:nth-child(3) { flex: 1; background: #138808; }
.brand span { color: var(--brand-light) !important; }

/* ── 34. Quick Voter Slip & WhatsApp Module ── */
.quick-slip-card {
  margin-top: 24px;
  background: linear-gradient(180deg, #ffffff, #fafbfe);
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}
.badge-quick {
  background: #ecfdf5 !important;
  color: #059669 !important;
  border: 1px solid #a7f3d0 !important;
  font-weight: 600;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
}
.section-sub {
  color: #64748b;
  font-size: 13px;
  margin: 4px 0 0;
}
.quick-slip-search-bar {
  display: flex;
  gap: 12px;
  margin: 18px 0;
}
.quick-slip-search-bar input {
  flex: 1;
  padding: 12px 16px;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
  transition: border-color .2s, box-shadow .2s;
}
.quick-slip-search-bar input:focus {
  border-color: var(--brand);
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.15);
}
.quick-slip-search-bar button {
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0 22px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, transform .1s;
}
.quick-slip-search-bar button:hover {
  background: var(--brand-dark);
}
.quick-slip-result {
  min-height: 48px;
}
.quick-slip-hint {
  margin: 8px 0;
  color: #94a3b8;
  font-size: 13px;
}
.voter-slip-preview {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-left: 5px solid var(--brand);
  border-radius: 12px;
  padding: 20px;
  margin-top: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.slip-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  border-bottom: 1px dashed #e2e8f0;
  padding-bottom: 10px;
}
.slip-badge-official {
  font-size: 11px;
  font-weight: 700;
  color: #1e293b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.slip-booth-pill {
  background: #f1f5f9;
  color: #334155;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.slip-voter-name {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 14px;
}
.slip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
  background: #f8fafc;
  padding: 14px;
  border-radius: 8px;
}
.slip-grid-item small {
  display: block;
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.slip-grid-item strong {
  font-size: 14px;
  color: #0f172a;
  font-weight: 600;
}
.slip-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.slip-whatsapp-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #25d366;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 8px;
  transition: background .2s, transform .1s;
}
.slip-whatsapp-btn:hover {
  background: #1ebc57;
  color: #fff;
  transform: translateY(-1px);
}
.slip-copy-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.slip-copy-btn:hover {
  background: #e2e8f0;
}

/* ── 35. Voter Sentiment & Feedback Module ── */
.sentiment-card {
  margin-top: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.badge-sentiment {
  background: var(--brand-bg);
  color: var(--brand-dark);
  border: 1px solid var(--line);
  font-weight: 600;
  font-size: 11px;
  padding: 4px 11px;
  border-radius: var(--r-pill);
}
.sentiment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin: 18px 0;
}
.sentiment-box {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.sentiment-box:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--line-strong);
}

.sentiment-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
.sentiment-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.favorable-dot { background: var(--green); }
.followup-dot { background: var(--info); }
.pending-dot { background: var(--warn); }
.review-dot { background: var(--danger); }

.sentiment-box strong {
  display: block;
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  margin: 8px 0 2px;
}
.sentiment-box small {
  color: var(--muted);
  font-size: 11px;
}

.sentiment-progress-bar {
  display: flex;
  height: 10px;
  border-radius: var(--r-pill);
  overflow: hidden;
  background: var(--line);
  margin-top: 8px;
}
.bar-segment {
  height: 100%;
  transition: width .4s ease;
}
.favorable-bar { background: var(--green); }
.followup-bar { background: var(--info); }
.pending-bar { background: var(--warn); }
.review-bar { background: var(--danger); }

/* ── 33. Language Switcher (EN / मराठी) ── */
.lang-switch {
  display: inline-flex;
  align-items: center;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.03);
}
.lang-btn {
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .2px;
  padding: 4px 12px;
  min-height: 28px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: all .15s cubic-bezier(.4, 0, .2, 1);
  box-shadow: none;
}
.lang-btn:hover {
  color: #0f172a;
  background: rgba(255,255,255,.5);
}
.lang-btn.active {
  background: #ffffff;
  color: var(--brand);
  box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
}

.login-panel-top {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}
.login-lang-switch {
  background: #f8fafc;
  border-color: #e2e8f0;
}

/* ── 34. Polling Day Turnout & Victory Margin Estimator ── */
.turnout-card {
  margin-top: 18px;
  border-left: 4px solid #3b82f6;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}
.badge-turnout {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}
.turnout-calculator-grid {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 20px;
  margin: 18px 0 14px;
  align-items: center;
}
.turnout-control-panel {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--r);
  padding: 16px 18px;
}
.turnout-slider-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 10px;
}
.turnout-slider-label strong {
  font-size: 18px;
  font-weight: 800;
  color: #2563eb;
  font-variant-numeric: tabular-nums;
}
.turnout-slider {
  width: 100%;
  accent-color: #2563eb;
  cursor: pointer;
  height: 6px;
  background: #cbd5e1;
  border-radius: 999px;
  outline: none;
}
.turnout-presets {
  display: flex;
  gap: 6px;
  margin-top: 12px;
}
.preset-btn {
  flex: 1;
  padding: 5px 8px;
  min-height: 28px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  transition: all .15s ease;
  box-shadow: none;
}
.preset-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}
.preset-btn.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 1px 3px rgba(37,99,235,.25);
}

.turnout-metrics-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.turnout-stat-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--r);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.turnout-stat-box.highlight-box {
  background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
  border-color: #bbf7d0;
}
.turnout-stat-box small {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .4px;
}
.turnout-stat-box strong {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  margin: 6px 0 2px;
}
.turnout-stat-box.highlight-box strong {
  color: var(--green);
}
.turnout-stat-box .stat-sub {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.3;
}
.turnout-stat-box .stat-diff {
  font-weight: 700;
}

.turnout-progress-container {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--r-sm);
  padding: 12px 16px;
  margin-top: 10px;
}
.turnout-bar-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}
.turnout-progress-track {
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}
.turnout-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6 0%, #10b981 100%);
  border-radius: 999px;
  transition: width .4s cubic-bezier(.4, 0, .2, 1);
}

@media (max-width: 960px) {
  .turnout-calculator-grid {
    grid-template-columns: 1fr;
  }
  .turnout-metrics-row {
    grid-template-columns: 1fr;
  }
}

/* ── 35. CSV Roll Management & Deletion (Dharashiv Admin) ── */
.voter-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.btn-danger {
  background: #dc2626 !important;
  color: #ffffff !important;
  border-color: #dc2626 !important;
}
.btn-danger:hover {
  background: #b91c1c !important;
  border-color: #b91c1c !important;
}
.btn-danger-outline {
  background: transparent !important;
  color: #dc2626 !important;
  border: 1px solid #fca5a5 !important;
}
.btn-danger-outline:hover {
  background: #fef2f2 !important;
  border-color: #ef4444 !important;
  color: #b91c1c !important;
}
.import-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 6px;
}
.danger-callout {
  background: #fff5f5;
  border: 1px solid #fed7d7;
  border-left: 4px solid #e53e3e;
  border-radius: var(--r-sm);
  padding: 14px 16px;
  margin: 14px 0 10px;
}
.danger-callout strong {
  display: block;
  color: #9b2c2c;
  font-size: 13px;
  margin-bottom: 6px;
}
.danger-callout p {
  color: #742a2a;
  font-size: 12px;
  margin: 0 0 8px;
}
.danger-callout input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #feb2b2;
  border-radius: var(--r-xs);
  font-weight: 700;
  letter-spacing: 1px;
  background: #ffffff;
  color: #9b2c2c;
}
.danger-callout input:focus {
  outline: none;
  border-color: #e53e3e;
  box-shadow: 0 0 0 3px rgba(229,62,62,.15);
}

/* ── 36. Executive Header Presentation ── */
.executive-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px 26px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(15,23,42,.04);
  position: relative;
  overflow: hidden;
}
.header-brand-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.header-status-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.live-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #059669;
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px rgba(16,185,129,.7);
  animation: pulse-dot 2s infinite ease-in-out;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .4; transform: scale(.8); }
}
.header-shortcuts {
  display: flex;
  align-items: center;
  gap: 8px;
}
.shortcut-btn {
  padding: 6px 14px;
  min-height: 32px;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--r-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ── 37. Dashboard Two-Column Grid Presentation ── */
.dashboard-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
@media (max-width: 1024px) {
  .dashboard-two-col {
    grid-template-columns: 1fr;
  }
}

/* ── 38. Voter Demographics Card ── */
.demographics-card {
  border-left: 4px solid #8b5cf6;
  background: linear-gradient(180deg, #ffffff 0%, #faf8ff 100%);
}
.badge-demographics {
  background: #f5f3ff;
  color: #7c3aed;
  border: 1px solid #ddd6fe;
}
.demographics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 16px 0 14px;
}
.demo-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--r-sm);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}
.demo-box-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
}
.demo-tag {
  font-size: 10px;
  padding: 2px 6px;
  background: #f1f5f9;
  border-radius: 4px;
}
.demo-box strong {
  display: block;
  font-size: 20px;
  font-weight: 800;
  margin: 6px 0 2px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.demo-box small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 6px;
}
.demo-bar-track {
  height: 6px;
  background: #f1f5f9;
  border-radius: 999px;
  overflow: hidden;
}
.demo-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width .4s ease;
}
.youth-fill { background: #8b5cf6; }
.adult-fill { background: #3b82f6; }
.senior-fill { background: #f59e0b; }

/* ── 39. War Room Broadcast Hub ── */
.broadcast-hub-card {
  border-left: 4px solid var(--brand);
  margin-bottom: 20px;
}
.badge-broadcast {
  background: var(--brand-bg);
  color: var(--brand);
  border: 1px solid var(--brand-light);
}
.broadcast-templates-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 16px;
}
@media (max-width: 960px) {
  .broadcast-templates-grid {
    grid-template-columns: 1fr;
  }
}
.broadcast-template-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--r);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease;
}
.broadcast-template-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.tpl-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.tpl-icon {
  font-size: 24px;
  line-height: 1;
}
.tpl-header strong {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  display: block;
  margin-bottom: 4px;
}
.tpl-header p {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
  margin: 0;
}
.tpl-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}
.tpl-copy-btn {
  flex: 1;
  min-height: 32px;
  font-size: 11px;
  font-weight: 600;
}
.tpl-wa-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  min-height: 32px;
  font-size: 11px;
  font-weight: 700;
  background: #25d366;
  color: #ffffff;
  border-radius: var(--r-sm);
  text-decoration: none;
  transition: background .15s ease;
}
.tpl-wa-btn:hover {
  background: #1ebc59;
}

/* ── 40. Voter Quick Filter Chips ── */
.filter-chips-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.filter-chip {
  padding: 5px 14px;
  min-height: 30px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  transition: all .15s ease;
  box-shadow: none;
}
.filter-chip:hover {
  background: #f1f5f9;
  color: #0f172a;
}
.filter-chip.active {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand);
  box-shadow: 0 1px 3px rgba(232,106,18,.25);
}

/* ============================================================
   Per-user profile drill-down (#user-detail)
   ============================================================ */
.person-header-clickable { cursor: pointer; border-radius: var(--r); transition: background .12s ease; }
.person-header-clickable:hover { background: var(--brand-bg); }
.person-header-clickable:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.ud-back {
  margin-bottom: var(--s4);
  display: inline-flex; align-items: center; gap: 6px;
}

.ud-header {
  display: flex; align-items: flex-start; gap: var(--s4);
  flex-wrap: wrap;
}
.ud-avatar {
  flex: 0 0 auto;
  width: 64px; height: 64px; border-radius: var(--r-lg);
  display: grid; place-items: center;
  font-size: 22px; font-weight: 800; letter-spacing: .5px;
  color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  box-shadow: var(--shadow-sm);
}
.ud-identity { flex: 1 1 260px; min-width: 0; }
.ud-name-row { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.ud-name-row h2 { margin: 0; font-size: 20px; }
.ud-header-actions { display: flex; flex-direction: column; gap: var(--s2); align-items: stretch; }
.ud-header-actions button { white-space: nowrap; }

.ud-metrics {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--s3); margin: var(--s4) 0;
}
.ud-metric {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: var(--s3) var(--s4); text-align: center; box-shadow: var(--shadow-sm);
}
.ud-metric strong { display: block; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text); }
.ud-metric small { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 600; }

.ud-leaning { margin: var(--s4) 0; }
.ud-leaning-title { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 700; margin-bottom: var(--s2); }

.ud-tabs {
  display: flex; gap: var(--s1); flex-wrap: wrap;
  border-bottom: 2px solid var(--line); margin-bottom: var(--s4);
}
.ud-tab {
  appearance: none; background: transparent; border: none;
  padding: 10px var(--s4); font-size: 14px; font-weight: 600; color: var(--muted);
  cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px;
  border-radius: var(--r-xs) var(--r-xs) 0 0; min-height: 44px;
}
.ud-tab:hover { color: var(--text); background: var(--surface-2); }
.ud-tab.selected { color: var(--brand-dark); border-bottom-color: var(--brand); }
.ud-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }

.ud-overview-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--s3); margin-bottom: var(--s4);
}
.ud-ov-card { padding: var(--s4); text-align: center; }
.ud-ov-card strong { display: block; font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--brand-dark); }
.ud-ov-card small { font-size: 11px; color: var(--muted); font-weight: 600; }

.ud-count { font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: var(--s3); }
.ud-loading, .ud-empty { color: var(--muted); padding: var(--s5) 0; text-align: center; }
.ud-error { color: var(--danger); padding: var(--s4) 0; }
.ud-contact-cell { display: flex; gap: var(--s2); align-items: center; }
.ud-no-phone { color: var(--muted-2); font-size: 12px; }
.ud-update small { display: block; color: var(--muted); margin-top: var(--s2); font-size: 12px; }

@media (max-width: 640px) {
  .ud-header-actions { flex-direction: row; flex-wrap: wrap; }
  .ud-tabs { overflow-x: auto; flex-wrap: nowrap; }
}


