/* ==========================================================================
   Design System — DF.com.vc (Leandro Grass 13 + Lula 13 • segundo turno)
   Identidade de produto digital (70%) + identidade da campanha (30%).
   Base neutra de tokens; a identidade DF.com.vc fica em df.css, carregado
   DEPOIS deste arquivo (Painel->Marca sobrescreve via applyBranding).
   ========================================================================== */
:root {
  /* --- cores semanticas (nomes de var preservados para whitelabel) --- */
  --verde: #1b4fc2;      /* PRIMÁRIO (applyBranding: primary_color) */
  --verde-ink: #153a8f;
  --teal: #00A651;       /* ACÃO/participação (adoção verde)  */
  --amarelo: #F9B900;    /* destaque/alerta */
  --vinho: #A51E45;      /* identidade política/PT */
  --azulao: #29358F;     /* azul profundo: títulos/estrutura */
  --roxo: #A51E45;       /* roxo->vermelho PT (special_color) */
  --laranja: #FF6B00;    /* acento secundário */
  --ceu: #4F8FD6;
  /* --- superficie / texto --- */
  --bg: #f2f4fa;
  --card: #ffffff;
  --ink: #1d233d;
  --muted: #5a6181;
  --text: #1d233d;
  --hairline: #e2e5f0;
  /* --- tokens de forma --- */
  --radius-sm: 8px;
  --radius: 10px;                 /* cards/botões (8–14px) */
  --radius-lg: 14px;
  --radius-pill: 999px;
  /* --- sombras: discretas, sem 3D/papercut --- */
  --shadow-sm: 0 1px 3px rgba(29, 35, 61, .08);
  --shadow: 0 3px 10px rgba(29, 35, 61, .10);
  --shadow-lg: 0 10px 28px rgba(29, 35, 61, .14);
  --ring: 0 0 0 3px rgba(27, 79, 194, .22);
  /* --- tipografia --- */
  --font-title: "Archivo Black", "Manrope", system-ui, sans-serif;
  --font-body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  /* faixa proprietária da campanha (usada com moderação) */
  --stripe: linear-gradient(90deg, var(--verde) 0 34%, var(--amarelo) 34% 55%,
                              var(--laranja) 55% 78%, var(--vinho) 78% 100%);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: var(--font-body);
  background: var(--bg); color: var(--ink);
  padding-bottom: 96px; padding-top: 58px;
  -webkit-tap-highlight-color: transparent; text-rendering: optimizeLegibility;
}
body.auth-open { padding-top: 0; }
.hidden, #gps-fields-fim, #gps-fields-pub { display: none !important; }
.center-msg { text-align: center; color: var(--muted); padding: 48px 16px; }
::placeholder { color: #9aa1bd; opacity: 1; }
.icon { vertical-align: -4px; }
a { color: var(--verde); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible {
  outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm);
}

/* ---------- Topbar ---------- */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 56px; z-index: 50;
  display: flex; align-items: center; padding: 0 12px; gap: 8px;
  background: var(--azulao); color: #fff;
  box-shadow: 0 1px 0 rgba(0,0,0,.12);
}
/* faixa multicolorida fina abaixo do topo (elemento proprietário da campanha) */
#topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 4px;
  background: var(--stripe);
}
.brand {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-title); font-weight: 400; letter-spacing: .2px;
  font-size: 1.02rem; color: #fff; min-width: 0;
}
.brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-name b { font-family: var(--font-title); font-weight: 400; }
.spacer { flex: 1; }
.chip {
  font-family: var(--font-body); font-size: .78rem; font-weight: 700; color: #fff;
  background: rgba(255,255,255,.16); padding: 5px 12px; border-radius: var(--radius-pill);
  text-decoration: none; max-width: 42vw; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
}
.icon-btn {
  background: rgba(255,255,255,.14); border: none; color: #fff;
  width: 38px; height: 38px; border-radius: var(--radius-sm); cursor: pointer;
  position: relative; display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:active { transform: scale(.96); }
.bell-badge {
  position: absolute; top: -5px; right: -6px; background: var(--amarelo); color: #3c2d00;
  font-family: var(--font-body); font-weight: 800; font-size: .6rem; line-height: 1;
  border-radius: var(--radius-pill); padding: 3px 6px; box-shadow: var(--shadow-sm);
}

/* ---------- Bottom nav ---------- */
#bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; height: 62px; z-index: 50;
  background: #fff; display: flex; border-top: 1px solid var(--hairline);
  box-shadow: 0 -2px 6px rgba(29,35,61,.06);
}
#bottomnav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; text-decoration: none; color: var(--muted);
  padding-top: 4px; border-top: 3px solid transparent;
}
#bottomnav a span { font-size: .68rem; font-weight: 800; letter-spacing: .1px; }
#bottomnav a.active { color: var(--azulao); border-top-color: var(--verde); }
#bottomnav a.active svg { stroke-width: 2.4px; }

/* ---------- Layout ---------- */
#view { max-width: 980px; margin: 0 auto; padding: 14px; }
.page-title {
  font-family: var(--font-title); font-weight: 400; letter-spacing: .2px;
  font-size: 1.42rem; color: var(--azulao); margin: 4px 0 12px;
}
.greeting {
  font-family: var(--font-title); font-weight: 400; font-size: 1.4rem;
  color: var(--azulao); margin: 10px 0 2px; letter-spacing: .2px;
}
.greeting .accent { color: var(--verde); }
.sub { color: var(--muted); margin-bottom: 12px; line-height: 1.45; }
.team-strip {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .75rem; font-weight: 800; color: var(--azulao);
  background: #fff; border: 1px solid var(--hairline);
  border-left: 4px solid var(--verde); padding: 6px 12px; border-radius: var(--radius-sm);
  margin-bottom: 12px; box-shadow: var(--shadow-sm);
}
.team-strip::before { content: ""; width: 26px; height: 8px; background: var(--stripe); border-radius: 2px; }

/* ---------- Cards ---------- */
.card {
  display: flow-root;
  background: var(--card); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease;
}
a.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card h3 { font-family: var(--font-body); font-weight: 800; font-size: 1.02rem; margin-bottom: 5px; color: var(--ink); }
.card p { font-size: .9rem; color: var(--muted); }

/* ---------- KPIs ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.kpi {
  background: var(--card); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 14px 10px; text-align: center;
  box-shadow: var(--shadow-sm); border-top: 4px solid var(--teal);
  transition: transform .15s ease;
}
.kpi:nth-child(4n+2) { border-top-color: var(--amarelo); }
.kpi:nth-child(4n+3) { border-top-color: var(--vinho); }
.kpi:nth-child(4n+4) { border-top-color: var(--laranja); }
a.kpi-link { text-decoration: none; color: inherit; cursor: pointer; }
a.kpi-link:hover, a.kpi-link:focus-visible { transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi .num {
  font-family: var(--font-title); font-weight: 400;
  font-size: 1.75rem; color: var(--azulao); line-height: 1.1;
}
.kpi .lbl { font-size: .69rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
@media (min-width: 760px) { .kpi-grid { grid-template-columns: repeat(4, 1fr); } }

/* ---------- Botões (sólidos, adultos, táteis) ---------- */
.btn {
  display: block; width: 100%; padding: 14px 16px; border: none; border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 1rem; font-weight: 800; letter-spacing: .2px;
  cursor: pointer; text-align: center; text-decoration: none; margin: 8px 0;
  color: #fff; background: var(--verde);
  box-shadow: 0 3px 0 var(--verde-ink);
  transition: transform .1s ease, box-shadow .1s ease, filter .1s ease;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--verde-ink); }
.btn.secondary { background: var(--azulao); box-shadow: 0 3px 0 #1b2568; }
.btn.secondary:active { box-shadow: 0 1px 0 #1b2568; }
.btn.warn {
  background: var(--amarelo); color: #3c2d00;
  box-shadow: 0 3px 0 #c79500;
}
.btn.danger { background: var(--vinho); box-shadow: 0 3px 0 #771430; }
.btn.ghost {
  background: #fff; color: var(--azulao); border: 1px solid var(--hairline);
  box-shadow: 0 2px 0 var(--hairline);
}
.btn:disabled { opacity: .55; cursor: default; }
.btn-row { display: flex; gap: 8px; }
.btn .icon { margin-right: 6px; }

#btn-admin-panel { font-size: 1.5em; }

/* ---------- Formulários ---------- */
label.field { display: block; margin-bottom: 10px; font-size: .82rem; font-weight: 800; color: var(--azulao); }
label.field input, label.field select, label.field textarea {
  width: 100%; margin-top: 4px; padding: 12px; border: 1.5px solid var(--hairline);
  border-radius: var(--radius-sm); font-size: 1rem; font-weight: 600; color: var(--ink);
  background: #fff; transition: border-color .12s ease, box-shadow .12s ease;
  min-height: 46px; /* alvo de toque confortável */
}
label.field input:focus, label.field select:focus, label.field textarea:focus {
  outline: none; border-color: var(--verde); box-shadow: var(--ring);
}
textarea { resize: vertical; min-height: 76px; }
.form-grid { width: 100%; display: grid; gap: 0 10px; }
@media (min-width: 760px) { .form-grid { grid-template-columns: 1fr 1fr; } }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; padding: 4px 10px; border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: .7rem; font-weight: 800;
  letter-spacing: .2px; border: 1px solid transparent;
}
.b-ASSUMIDA { background: #e3ecfd; color: var(--verde-ink); border-color: #bcd2f3; }
.b-EM_ANDAMENTO { background: #fff3cd; color: #7a5b00; border-color: #f0db9c; }
.b-ENVIADA, .b-PENDENTE_APROVACAO { background: var(--amarelo); color: #3c2d00; }
.b-APROVADA { background: #0b5a30; color: #fff; }
.b-REJEITADA { background: var(--vinho); color: #fff; }
.b-CORRECAO_SOLICITADA { background: #6d3aa0; color: #fff; }
.b-CANCELADA { background: #e6e9f4; color: var(--muted); border-color: var(--hairline); }
.b-EXPIRADA { background: #6b7280; color: #fff; }
.b-PUBLISHED { background: #0b5a30; color: #fff; }
.b-DRAFT { background: #e6e9f4; color: var(--muted); border-color: var(--hairline); }
.b-FINISHED, .b-CANCELLED { background: var(--vinho); color: #fff; }
.b-PENDING { background: var(--amarelo); color: #3c2d00; }
.b-SENT { background: #0b5a30; color: #fff; }
.b-FAILED { background: var(--vinho); color: #fff; }
.b-OK { background: #0b5a30; color: #fff; }

/* ---------- Filtros / tabs / chips ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; }
.chips button {
  white-space: nowrap; border: 1.5px solid var(--hairline); background: #fff;
  border-radius: var(--radius-sm); padding: 9px 14px;
  font-family: var(--font-body); font-size: .82rem; font-weight: 700; cursor: pointer;
  color: var(--azulao); transition: all .12s ease;
}
.chips button.active {
  background: var(--azulao); color: #fff; border-color: var(--azulao);
}
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs a {
  padding: 8px 13px; border-radius: var(--radius-sm); background: #fff;
  border: 1.5px solid var(--hairline); color: var(--azulao);
  text-decoration: none; font-family: var(--font-body); font-size: .8rem; font-weight: 700;
}
.tabs a.active { background: var(--verde); border-color: var(--verde); color: #fff; }
.tabs a:focus-visible { box-shadow: var(--ring); }

/* ---------- Misc ---------- */
.meta { font-size: .78rem; color: var(--muted); margin-top: 4px; }
.points { color: var(--verde); font-weight: 800; }
.alert {
  padding: 12px 14px; border-radius: var(--radius-sm); font-size: .88rem;
  margin: 8px 0; font-weight: 600; border-left: 4px solid;
}
.alert.ok { background: #dff5e9; color: #0b5a30; border-color: var(--teal); }
.alert.warn { background: #fff3cd; color: #7a5b00; border-color: var(--amarelo); }
.alert.err { background: #fde3ea; color: var(--vinho); border-color: var(--vinho); }
table.tbl { width: 100%; border-collapse: collapse; font-size: .82rem; background: #fff; border-radius: var(--radius-sm); overflow: hidden; }
table.tbl th { background: #eef1f8; color: var(--azulao); font-weight: 800; }
table.tbl th, table.tbl td { padding: 10px 8px; border-bottom: 1px solid #eef0f7; text-align: left; }
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--hairline); box-shadow: var(--shadow-sm); }
.map-box { height: 320px; border-radius: var(--radius-sm); overflow: hidden; margin: 10px 0; border: 1px solid var(--hairline); }
#pub-map { width: 100%; }
.mini-map { height: 170px; border-radius: var(--radius-sm); overflow: hidden; margin: 10px 0; border: 1px solid var(--hairline); }
.timeline-item { border-left: 3px solid var(--verde); padding: 4px 0 14px 12px; position: relative; }
.timeline-item::before {
  content: ""; position: absolute; left: -7px; top: 7px; width: 11px; height: 11px;
  border-radius: 50%; background: var(--verde); border: 2px solid #fff; box-shadow: var(--shadow-sm);
}
.img-thumb { max-width: 88px; max-height: 88px; border-radius: var(--radius-sm); margin: 4px 6px 0 0; object-fit: cover; border: 1px solid var(--hairline); cursor: zoom-in; }

/* Galeria de evidencias (admin) */
.gal-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 760px) { .gal-grid { grid-template-columns: repeat(4, 1fr); } }
.gal-item { background: #fff; border: 1px solid var(--hairline); border-radius: var(--radius-sm); overflow: hidden; display: flex; flex-direction: column; }
.gal-thumb { aspect-ratio: 1 / 1; min-height: 90px; display: flex; align-items: center; justify-content: center; background: #f2f4fa; overflow: hidden; }
.gal-img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.gal-doc { text-decoration: none; color: var(--azulao); font-size: 2rem; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px; }
.gal-info { padding: 6px 8px 8px; font-size: .8rem; display: flex; flex-direction: column; gap: 2px; word-break: break-word; }
.gal-info a { font-weight: 700; }

/* Instrucao da missao (texto puro) acima da descricao rica */
.mission-instructions {
  font-size: .95rem; font-weight: 700; color: var(--ink);
  background: #f2f6fd; border-left: 4px solid var(--verde);
  padding: 12px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 8px 0 0;
}

/* Descricao rica (admin pode escrever HTML) */
.rich { font-size: .95rem; line-height: 1.6; color: var(--ink); }
.rich h1, .rich h2, .rich h3 { font-family: var(--font-title); font-weight: 400; color: var(--azulao); margin: 12px 0 6px; }
.rich p { margin: 8px 0; }
.rich img, .rich video, .rich iframe { max-width: 100%; border-radius: var(--radius-sm); }
.rich a { color: var(--verde); font-weight: 700; }
.rich ul, .rich ol { padding-left: 20px; margin: 8px 0; }
.rich blockquote { border-left: 4px solid var(--amarelo); background: #fff8e0; padding: 10px 14px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 10px 0; }
.rich table { border-collapse: collapse; width: 100%; }
.rich td, .rich th { border: 1px solid var(--hairline); padding: 6px; }

/* ---------- Paginação ---------- */
.pager { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 14px 0 4px; padding: 8px; background: #fff; border: 1px solid var(--hairline); border-radius: var(--radius-sm); }
.pg-btn { border: 1px solid var(--hairline); background: #fff; padding: 8px 14px; border-radius: var(--radius-sm); font-weight: 800; cursor: pointer; color: var(--azulao); font-size: .85rem; }
.pg-btn:hover:not(:disabled) { background: #eef1f8; }
.pg-btn:disabled { opacity: .4; cursor: default; }
.pg-info { font-size: .85rem; color: var(--text); }
.pg-size { font-size: .82rem; color: var(--muted); font-weight: 800; }
.pg-size-sel { padding: 6px 8px; border-radius: var(--radius-sm); border: 1.5px solid var(--hairline); font-weight: 800; background: #fff; }

/* ---------- Editor WYSIWYG ---------- */
.wysiwyg { border: 1.5px solid var(--hairline); border-radius: var(--radius-sm); overflow: hidden; background: #fff; }
.wysiwyg-toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; background: #eef1f8; border-bottom: 1px solid var(--hairline); }
.wy-btn { min-width: 30px; padding: 6px 9px; border: 1px solid #cfd6ea; border-radius: 7px; background: #fff; font-size: .82rem; cursor: pointer; color: var(--azulao); font-weight: 700; }
.wy-btn:hover { background: #e3ecfd; }
.wysiwyg-editor { min-height: 140px; max-height: 420px; overflow-y: auto; padding: 12px; font-size: .95rem; line-height: 1.5; outline: none; }
.wysiwyg-editor:empty::before { content: "Escreva aqui…"; color: #a3aacb; }
.wysiwyg textarea { font-family: ui-monospace, "Cascadia Code", monospace; font-size: .85rem; }
.wysiwyg textarea.hidden { display: none; }

#toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 84px;
  background: var(--azulao); color: #fff;
  padding: 12px 18px; border-radius: var(--radius-sm); font-weight: 700; font-size: .88rem;
  z-index: 99; max-width: 92vw; text-align: center;
  box-shadow: var(--shadow-lg);
  animation: toastIn .18s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(10px); } }

/* ---------- Destaques (semana de participação) ---------- */
.rk-pos {
  width: 46px; min-width: 46px; height: 46px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-title); font-weight: 400; font-size: 1rem;
  background: #eef1f8; color: var(--azulao);
}
.rk-1 { background: var(--azulao); color: #fff; box-shadow: 0 3px 0 #1b2568; }
.rk-2 { background: var(--verde); color: #fff; box-shadow: 0 3px 0 var(--verde-ink); }
.rk-3 { background: var(--amarelo); color: #3c2d00; box-shadow: 0 3px 0 #c79500; }

/* ---------- Autenticacao / públicas ---------- */
.auth-box {
  max-width: 430px; margin: 4vh auto; background: #fff;
  border: 1px solid var(--hairline); border-top: 5px solid var(--verde);
  border-radius: var(--radius-lg); padding: 26px 20px;
  box-shadow: var(--shadow); position: relative;
}
.auth-box h1 {
  font-family: var(--font-title); font-weight: 400; color: var(--azulao);
  font-size: 1.4rem; letter-spacing: .2px; text-align: center; margin-bottom: 4px;
}
.auth-box .sub { text-align: center; }
.brand-logo-img { display: block; width: min(270px, 86%); height: auto; margin: 0 auto 12px; }
.auth-switch { text-align: center; margin-top: 10px; font-size: .85rem; }
.auth-switch a { color: var(--verde); font-weight: 800; }

/* ---------- Compartilhamento ---------- */
.share-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.share-row .ghost {
  border: 1px solid var(--hairline); background: #fff; border-radius: var(--radius-sm);
  padding: 7px 13px; font-family: var(--font-body); font-weight: 700; font-size: .82rem;
  color: var(--azulao); cursor: pointer; text-decoration: none;
}
.share-row .share-wpp-link { background: #dff5e9; color: #0b5a30; border-color: #b7e4ca; }

/* ---------- Modal de convite para Push ---------- */
.push-overlay {
  position: fixed; inset: 0; background: rgba(20, 24, 45, .5);
  backdrop-filter: blur(2px); z-index: 90;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  animation: toastIn .2s ease;
}
.push-modal { margin: 0; text-align: center; }
.push-modal .sub { text-align: center; }

/* ---------- Rodape com assinatura ---------- */
#app-footer { margin: 26px 0 0; padding: 18px 12px 26px; text-align: center; }
#app-footer .barra { height: 8px; margin: 0 auto 12px; max-width: 520px; border-radius: 2px; background: var(--stripe); }
#app-footer p { font-weight: 700; font-size: .72rem; letter-spacing: .6px; color: var(--azulao); opacity: .9; }
#app-footer a { color: var(--verde); font-weight: 800; }
#app-footer .rich { display: inline; font-size: inherit; }

/* ---------- Acessibilidade extra ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
