:root {
  --bg: #ffffff;
  --wash: #eaf7ee;
  --surface: #ffffff;
  --border: #dbe6de;
  --text: #0c1f16;
  --text-soft: #4c5f54;
  --text-dim: #5a685e;
  --green-dark: #0f5d3c;
  --green: #17864f;
  --green-light: #4cd07d;
  --green-wash: #eaf7ee;
  --amber: #f2b705;
  --amber-ink: #4a3a00;
  --danger: #c1372a;
  --radius: 14px;
  --radius-sm: 9px;
  --font: "Inter", sans-serif;
  --font-num: "Space Mono", monospace;
  --on-accent: #ffffff;
  --bottom-bar-h: 68px;
}

:root[data-theme="dark"] {
  --bg: #081410;
  --wash: #0e2018;
  --surface: #0e2018;
  --border: #1c3327;
  --text: #eef7f1;
  --text-soft: #a8bcb0;
  --text-dim: #93a398;
  --danger: #ff8a7a;
  --green-dark: #2fbf78;
  --green: #22d573;
  --green-light: #5be89a;
  --green-wash: #10281c;
  --on-accent: #04150c;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--bottom-bar-h) + 16px);
}

.wrap { max-width: 480px; margin: 0 auto; padding: 0 16px; }
a { color: inherit; }
code { font-family: var(--font-num); background: var(--wash); padding: .1em .4em; border-radius: 3px; font-size: .9em; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

.skip-link {
  position: absolute; left: 12px; top: -48px;
  background: var(--green-dark); color: #fff; padding: 10px 16px;
  border-radius: 8px; font-weight: 700; font-size: .85rem; z-index: 200;
  transition: top .15s ease;
}
.skip-link:focus { top: 12px; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: var(--font); font-size: .85rem; font-weight: 700;
  padding: 10px 14px; border-radius: 10px; border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none;
  white-space: nowrap;
}
.btn-ghost:hover { border-color: var(--green); }
.btn-solid { background: var(--green-dark); border-color: var(--green-dark); color: #fff; }
.btn-solid:hover { background: var(--green); }
.btn-danger { color: var(--danger); border-color: rgba(193,55,42,.35); }
.btn-danger:hover { border-color: var(--danger); background: rgba(193,55,42,.08); }
.btn-icon {
  width: 40px; height: 40px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.1rem; border-radius: 10px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
}
.btn-icon:hover { border-color: var(--green); }
.btn-block { width: 100%; }

/* ---------- header ---------- */

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky; top: 0; z-index: 30;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.brand-badge {
  background: var(--green-dark); color: #fff; font-family: var(--font-num); font-weight: 800; font-size: .78rem;
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 8px;
}
.brand-name { color: var(--green-dark); font-weight: 800; font-size: .82rem; letter-spacing: .06em; }
.header-actions { display: flex; align-items: center; gap: 8px; }

/* ---------- hero (banner verde, como o site do Daniel Radar) ---------- */

.hero {
  background: var(--green-wash);
  border-bottom: 1px solid var(--border);
  padding: 22px 16px 18px;
}
.hero-inner { max-width: 480px; margin: 0 auto; }
.hero-eyebrow {
  font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--green-dark); margin-bottom: 6px;
}
.hero h1 { font-size: 1.55rem; font-weight: 800; margin: 0 0 6px; letter-spacing: -.01em; }
.hero p { margin: 0 0 14px; color: var(--text-soft); font-size: .92rem; }

.uf-static {
  display: inline-block; font-size: .78rem; font-weight: 700; color: var(--green-dark);
  background: var(--surface); border: 1px solid var(--border); padding: 5px 11px; border-radius: 999px; margin-bottom: 12px;
}

.candidato-strip {
  display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 12px; margin-top: 4px;
}
.candidato-strip-photo { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex: none; border: 1px solid var(--border); }
.candidato-strip-text { display: flex; flex-direction: column; font-size: .74rem; line-height: 1.35; }
.candidato-strip-text strong { font-size: .8rem; color: var(--text); }
.candidato-strip-text span { color: var(--text-dim); }

/* ---------- meta row ---------- */

.meta-row {
  display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center;
  padding: 12px 0 6px; font-size: .74rem; color: var(--text-dim);
}
.meta-row .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); display: inline-block; margin-right: 5px; }
.countdown { font-family: var(--font-num); color: var(--green-dark); font-weight: 800; }
.progress-wrap { flex-basis: 100%; display: flex; align-items: center; gap: 8px; }
.progress-track { flex: 1; height: 6px; background: var(--wash); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--green); width: 0%; transition: width .2s ease; }
.progress-label { font-family: var(--font-num); font-size: .74rem; white-space: nowrap; }

/* ---------- cargo cards (compacto, estilo colinha.ai) ---------- */

.ballot { display: flex; flex-direction: column; gap: 10px; margin: 14px 0 28px; }

.cargo-card {
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; transition: border-color .15s ease;
}
.cargo-card.filled { border-color: var(--green); }
.cargo-card.locked { border-color: var(--green-dark); background: var(--green-wash); }

.cargo-label-row { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.cargo-title { font-size: .84rem; font-weight: 800; margin: 0; }
.cargo-sub { font-size: .68rem; color: var(--text-dim); font-family: var(--font-num); }

/* estado vazio: só as caixinhas */
.cargo-empty-row { display: flex; align-items: center; gap: 10px; }
.digit-input-row { display: flex; gap: 6px; flex: 1; }
.digit-cell { flex: 1; max-width: 46px; }
.digit-box {
  width: 100%; height: 44px; text-align: center; font-family: var(--font-num); font-size: 1.15rem; font-weight: 800;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text);
}
.digit-box::placeholder { color: var(--border); }
.digit-box:focus-visible { outline: 2px solid var(--green); border-color: var(--green); }
.digit-box.filled { border-color: var(--green); }
.digit-box:disabled { color: var(--text); opacity: 1; cursor: not-allowed; border-color: var(--green-dark); background: var(--surface); }

.cargo-actions-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.pill-btn {
  font-family: var(--font); font-size: .74rem; font-weight: 700; padding: 6px 11px; border-radius: 999px;
  border: 1.5px solid var(--border); background: var(--wash); color: var(--text-soft); cursor: pointer;
}
.pill-btn:hover { border-color: var(--text-dim); }
.pill-btn.active { background: var(--green-dark); border-color: var(--green-dark); color: #fff; }
.search-open-btn {
  margin-left: auto; background: none; border: none; color: var(--green-dark); font-weight: 700; font-size: .78rem; cursor: pointer;
  display: flex; align-items: center; gap: 4px;
}

/* estado preenchido: foto + numero + nome + partido, tudo numa linha (como colinha.ai) */
.cargo-filled-row { display: flex; align-items: center; gap: 10px; }
.filled-avatar { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; flex: none; background: var(--wash); border: 1px solid var(--border); }
.filled-avatar.initials { display: flex; align-items: center; justify-content: center; color: var(--green-dark); font-weight: 800; font-size: .85rem; }
.filled-mid { flex: 1; min-width: 0; }
.filled-numbers { display: flex; gap: 4px; margin-bottom: 3px; }
.filled-digit {
  width: 26px; height: 32px; display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--green); border-radius: 6px; font-family: var(--font-num); font-weight: 800; font-size: .92rem; color: var(--green-dark);
  background: var(--green-wash);
}
.filled-name { font-weight: 800; font-size: .82rem; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.filled-party { font-size: .72rem; color: var(--text-dim); }
.filled-badge {
  flex: none; width: 34px; height: 34px; border-radius: 8px; background: var(--wash); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: .62rem; font-weight: 800; color: var(--green-dark); text-align: center;
}
.filled-remove { flex: none; background: none; border: none; color: var(--danger); font-size: 1.1rem; cursor: pointer; padding: 4px; line-height: 1; }
.filled-lock { flex: none; font-size: .68rem; font-weight: 800; color: var(--amber-ink); background: rgba(242,183,5,.22); padding: 4px 8px; border-radius: 999px; }

.result-warning {
  display: inline-block; margin-top: 4px; font-size: .68rem; font-weight: 700; color: var(--danger);
  background: rgba(193,55,42,.08); padding: 2px 7px; border-radius: 999px;
}
.result-pending {
  display: inline-block; margin-top: 4px; font-size: .68rem; font-weight: 700; color: var(--text);
  background: rgba(242,183,5,.24); padding: 2px 7px; border-radius: 999px;
}
.card-aviso {
  margin: 8px 0 0; padding: 8px 10px; font-size: .76rem; font-weight: 700; color: var(--danger);
  background: rgba(193,55,42,.09); border-radius: var(--radius-sm);
}
.result-socials { display: flex; gap: 5px; margin-top: 5px; flex-wrap: wrap; }
.result-socials a {
  font-size: .66rem; font-weight: 700; color: var(--green-dark); text-decoration: none; border: 1px solid var(--border);
  padding: 2px 7px; border-radius: 999px; background: var(--wash);
}

.locked-callout {
  margin-top: 10px; padding: 8px 10px; background: var(--surface); border: 1px dashed var(--green);
  border-radius: var(--radius-sm); font-size: .74rem; color: var(--text-soft);
}

.search-hint { font-size: .74rem; color: var(--text-dim); margin: 8px 0 0; }

/* ---------- modal de busca (tela cheia no mobile, como colinha.ai) ---------- */

.search-modal {
  position: fixed; inset: 0; background: var(--bg); z-index: 100;
  display: flex; flex-direction: column;
}
.search-modal[hidden] { display: none; }
.search-modal-head { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.search-modal-head input {
  flex: 1; font-family: var(--font); font-size: .95rem; padding: 12px 14px; border: 1.5px solid var(--border);
  border-radius: 10px; background: var(--wash); color: var(--text);
}
.search-modal-head input:focus-visible { outline: 2px solid var(--green); }
.search-modal-close { background: none; border: none; font-size: 1.3rem; color: var(--text-dim); cursor: pointer; padding: 4px; }
.search-modal-count { padding: 8px 16px; font-size: .72rem; color: var(--text-dim); font-family: var(--font-num); border-bottom: 1px solid var(--border-soft, var(--border)); }
.search-modal-list { flex: 1; overflow-y: auto; padding: 8px 10px 24px; }

.special-list { display: flex; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.special-list .pill-btn { flex: 1; text-align: center; }

.match-card {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px; border: none; background: transparent;
  border-radius: var(--radius-sm); cursor: pointer; text-align: left; margin-bottom: 2px;
}
.match-card:hover, .match-card:focus-visible { background: var(--wash); }
.match-avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; flex: none; background: var(--wash); border: 1px solid var(--border); }
.match-avatar.initials { display: flex; align-items: center; justify-content: center; color: var(--green-dark); font-weight: 800; font-size: .8rem; }
.match-mid { flex: 1; min-width: 0; }
.match-numbers { display: flex; gap: 3px; margin-bottom: 2px; }
.match-digit {
  width: 20px; height: 24px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border);
  border-radius: 4px; font-family: var(--font-num); font-weight: 700; font-size: .74rem; color: var(--text-soft);
}
.match-name { font-weight: 700; font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.match-party { font-size: .68rem; color: var(--text-dim); }

/* ---------- resumo ---------- */

.summary { border-top: 1px solid var(--border); padding: 22px 0 20px; }
.summary-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.summary-head h2 { font-size: 1rem; margin: 0; font-weight: 800; }
.summary-list { list-style: none; margin: 0 0 12px; padding: 0; border: 1.5px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.summary-list li { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border); background: var(--surface); font-size: .82rem; }
.summary-list li:last-child { border-bottom: none; }
.summary-list .s-cargo { color: var(--text-dim); font-size: .68rem; width: 10ch; flex: none; }
.summary-list .s-num { font-family: var(--font-num); font-weight: 800; color: var(--green-dark); width: 5.5ch; flex: none; }
.summary-list .s-name { flex: 1; color: var(--text); }
.summary-list .s-empty { color: var(--text-dim); font-style: italic; }
.summary-foot { color: var(--text-dim); font-size: .76rem; margin: 0 0 4px; }

/* ---------- barra fixa inferior (mobile-first, como colinha.ai) ---------- */

.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: var(--bg); border-top: 1px solid var(--border);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  display: flex; gap: 8px;
}
.bottom-bar .btn { flex: 1; }
.bottom-bar .btn-whatsapp { background: #147a45; border-color: #147a45; color: #fff; }
.bottom-bar .btn-whatsapp:hover { background: #0f5d3c; }

/* ---------- footer ---------- */

.footer-candidato {
  display: flex; align-items: center; gap: 10px; background: var(--green-wash); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px; margin-bottom: 14px;
}
.footer-candidato img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; flex: none; border: 1px solid var(--border); }
.footer-candidato div { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: .74rem; line-height: 1.4; }
.footer-candidato strong { font-size: .82rem; color: var(--green-dark); }
.footer-candidato span { color: var(--text-dim); }
.footer-candidato .btn { flex: none; padding: 7px 12px; font-size: .72rem; }

.site-footer { border-top: 1px solid var(--border); padding: 18px 0 28px; font-size: .74rem; color: var(--text-dim); }
.site-footer a:not(.btn) { color: var(--green-dark); font-weight: 600; }
.footer-legal { margin-top: 8px; font-size: .68rem; line-height: 1.6; }
.footer-links { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }

/* ---------- skeleton ---------- */

.skeleton-card { background: var(--wash); border: 1.5px solid var(--border); border-radius: var(--radius); height: 76px; position: relative; overflow: hidden; }
.skeleton-card::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.5), transparent);
  transform: translateX(-100%); animation: shimmer 1.3s infinite;
}
:root[data-theme="dark"] .skeleton-card::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent); }
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* ---------- banner de cookies ---------- */

.cookie-banner[hidden] { display: none !important; }
.cookie-banner {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--bottom-bar-h) + 12px);
  max-width: 456px; margin: 0 auto; background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: 0 8px 24px rgba(0,0,0,.12); display: flex; flex-direction: column; gap: 10px; z-index: 50;
}
.cookie-banner p { margin: 0; font-size: .76rem; color: var(--text-soft); }

/* ---------- print (recibo) ---------- */

#print-area { display: none; }

#print-sheet { font-family: var(--font); background: #fff; color: #0c1f16; max-width: 640px; margin: 0 auto; }
.print-head { text-align: center; padding: 30px 0 16px; border-bottom: 2px solid #dbe6de; }
.print-brand { display: block; font-weight: 800; font-size: 1rem; color: #0f5d3c; letter-spacing: .04em; margin-bottom: 10px; }
.print-brand em { font-style: normal; color: #8a6500; }
.print-head h1 { font-size: 1.5rem; margin: 4px 0; }
.print-head p { color: #5a685e; margin: 0; font-size: .9rem; }
.print-row { display: flex; align-items: center; gap: 20px; padding: 14px 24px; border-bottom: 1px solid #e7ebe3; }
.print-photo { width: 92px; height: 92px; border-radius: 50%; object-fit: cover; flex: none; border: 4px solid #0f5d3c; }
.print-photo.print-initials { display: flex; align-items: center; justify-content: center; background: #eaf7ee; color: #0f5d3c; font-weight: 800; font-size: 1.6rem; }
.print-photo.print-empty { background: #f7f8f6; border: 2px dashed #dbe6de; }
.print-mid { flex: 1; text-align: left; }
.print-cargo { font-size: .72rem; font-weight: 800; color: #5a685e; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.print-numbers { display: flex; justify-content: flex-start; gap: 7px; margin-bottom: 8px; }
.print-numbers span { width: 42px; height: 50px; display: flex; align-items: center; justify-content: center; border: 2.5px solid #0f5d3c; border-radius: 8px; font-family: var(--font-num); font-weight: 800; font-size: 1.6rem; color: #0f5d3c; background: #eaf7ee; }
.print-name { font-weight: 800; font-size: 1.05rem; text-transform: uppercase; }
.print-foot { background: #0f5d3c; color: #fff; text-align: center; padding: 22px 16px; margin-top: 4px; }
.print-foot strong { display: block; font-size: 1.05rem; margin-bottom: 6px; }
.print-foot span { display: block; font-size: .8rem; color: rgba(255,255,255,.85); margin-top: 2px; }

@media print {
  body * { visibility: hidden; }
  #print-area, #print-area * { visibility: visible; }
  #print-area { display: block; position: absolute; left: 0; top: 0; width: 100%; padding: 0; margin: 0; background: #fff; }
  body { padding-bottom: 0; }
}

/* desktop: centraliza igual mobile, sem esticar (fiel ao pedido "priorizado pro celular") */
@media (min-width: 520px) {
  body { background: var(--wash); }
  .site-header, .hero, main, .site-footer, .bottom-bar-outer { }
  .wrap { background: var(--bg); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .skeleton-card::after { animation: none; }
}
