/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-bg:   #282828;
  --sidebar-w:    240px;
  --primary:      #E3DB04;
  --primary-dark: #BAB403;
  --primary-light:#FCFBE6;
  --blue:         #3B82F6; /* cor fixa de status (aguardando análise), não tematizar */
  --blue-bg:      #EFF6FF; /* cor fixa de status (aguardando análise), não tematizar */
  --green:        #22C55E;
  --green-bg:     #F0FDF4;
  --orange:       #F59E0B;
  --orange-bg:    #FFFBEB;
  --red:          #EF4444;
  --red-bg:       #FEF2F2;
  --gray:         #94A3B8;
  --gray-bg:      #F8FAFC;
  --content-bg:   #F1F5F9;
  --white:        #FFFFFF;
  --text:         #0F172A;
  --text-muted:   #64748B;
  --border:       #E2E8F0;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.08);
  --shadow:       0 4px 12px rgba(0,0,0,.10);
  --shadow-lg:    0 8px 32px rgba(0,0,0,.15);
  --radius-sm:    6px;
  --radius:       10px;
  --radius-lg:    14px;
  --topbar-h:     64px;
}

body {
  font-family: 'Poppins', 'Inter', sans-serif;
  background: var(--content-bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }

/* ── Site header (esqueci-senha / redefinir-senha) ────────────────────────── */
.site-header { background: var(--white); border-bottom: 1px solid var(--border); }
.header-inner { max-width: 960px; margin: 0 auto; padding: 0 20px; height: 60px; display: flex; align-items: center; justify-content: space-between; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; color: var(--text); text-decoration: none; }
.logo svg { color: var(--primary); }
.header-nav { display: flex; align-items: center; gap: 12px; }
.nav-link { font-size: 13px; font-weight: 500; color: var(--text-muted); text-decoration: none; }
.nav-link:hover { color: var(--text); }
.btn-link { background: none; border: none; font-size: 13px; color: var(--text-muted); cursor: pointer; font-family: inherit; }

/* Wrapper usado em esqueci-senha e redefinir-senha */
.auth-container {
  min-height: calc(100vh - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  background: var(--content-bg);
}

/* Site footer */
.site-footer { border-top: 1px solid var(--border); padding: 12px 20px; background: var(--white); }
.footer-inner { max-width: 960px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--text-muted); }
.footer-admin-link { font-size: 12px; color: var(--text-muted); }

/* ── App layout ───────────────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 200;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 20px 16px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  text-decoration: none;
}
.sidebar-brand-icon {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-brand-text { color: #fff; font-weight: 700; font-size: 13px; line-height: 1.3; }
.sidebar-brand-text small { display: block; color: rgba(255,255,255,.5); font-weight: 400; font-size: 11px; }

.sidebar-nav { padding: 12px 8px; flex: 1; }
.sidebar-section { margin-bottom: 4px; }
.sidebar-section-label {
  padding: 8px 8px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.3);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.6);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all .15s;
  position: relative;
  margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item svg { flex-shrink: 0; opacity: .8; }
.nav-item.active svg { opacity: 1; }
.nav-badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s;
}
.sidebar-user:hover { background: rgba(255,255,255,.08); }
.sidebar-avatar {
  width: 34px; height: 34px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { color: rgba(255,255,255,.45); font-size: 11px; }
.sidebar-user svg { color: rgba(255,255,255,.4); flex-shrink: 0; }

/* ── Main area ────────────────────────────────────────────────────────────── */
.main-area {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ───────────────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-title { font-size: 18px; font-weight: 700; flex-shrink: 0; }
.topbar-search {
  flex: 1;
  max-width: 380px;
  margin-left: auto;
  position: relative;
}
.topbar-search input {
  width: 100%;
  padding: 9px 12px 9px 38px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color .15s;
  background: var(--gray-bg);
}
.topbar-search input:focus { border-color: var(--primary); background: #fff; }
.topbar-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--primary-dark); color: #fff; text-decoration: none; }
.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .15s;
  text-decoration: none;
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .15s;
}
.btn-ghost:hover { background: var(--gray-bg); color: var(--text); }
.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

/* ── Status badges ────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge-resolvida   { background: var(--green-bg);  color: #166534; }
.badge-andamento   { background: var(--orange-bg); color: #92400E; }
.badge-pendente    { background: var(--red-bg);    color: #991B1B; }
.badge-cancelada   { background: #F1F5F9;          color: #475569; }
.badge-aguardando  { background: var(--blue-bg); color: #1D4ED8; } /* cor fixa de status, não tematizar */

/* ── Flash ────────────────────────────────────────────────────────────────── */
.flash {
  padding: 12px 24px;
  font-size: 13px;
  font-weight: 500;
  border-left: 4px solid;
}
.flash-sucesso { background: var(--green-bg); border-color: var(--green); color: #166534; }
.flash-erro    { background: var(--red-bg);   border-color: var(--red);   color: #991B1B; }

/* ── Card ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title { font-size: 15px; font-weight: 700; }
.card-body { padding: 20px; }

/* ── Mapa público ─────────────────────────────────────────────────────────── */
.mapa-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-h));
  position: relative;
}
#map { width: 100%; height: 100%; }

.mapa-legenda {
  position: absolute;
  top: 16px;
  left: 16px;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  width: 200px;
  z-index: 10;
  overflow: hidden;
}
.mapa-legenda-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.mapa-legenda-body { padding: 12px 16px; }
.legenda-section-title { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; margin-top: 12px; }
.legenda-section-title:first-child { margin-top: 0; }
.legenda-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  margin-bottom: 6px;
  color: var(--text);
}
.legenda-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.legenda-icon {
  width: 20px; height: 20px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  flex-shrink: 0;
}

.mapa-total-card {
  position: absolute;
  bottom: 24px;
  left: 16px;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 10;
  min-width: 200px;
}
.mapa-total-icon {
  width: 42px; height: 42px;
  background: var(--primary-light);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}
.mapa-total-num { font-size: 26px; font-weight: 800; line-height: 1; color: var(--text); }
.mapa-total-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.mapa-total-delta { font-size: 12px; font-weight: 600; color: var(--green); }

/* ── Barra de filtros rápidos ─────────────────────────────────────────────── */
.mapa-filtros-bar {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--white);
  border-radius: 40px;
  padding: 7px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 14px rgba(0,0,0,.18);
  z-index: 10;
}
.filtros-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 2px;
  cursor: pointer;
  user-select: none;
}
.filtros-toggle-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.filtros-toggle-sw {
  position: relative;
  width: 38px;
  height: 21px;
  flex-shrink: 0;
}
.filtros-toggle-sw input { opacity: 0; width: 0; height: 0; position: absolute; }
.filtros-toggle-track {
  position: absolute;
  inset: 0;
  background: #9CA3AF;
  border-radius: 21px;
  transition: background .2s;
  cursor: pointer;
}
.filtros-toggle-sw input:checked ~ .filtros-toggle-track { background: var(--primary); }
.filtros-toggle-track::after {
  content: '';
  position: absolute;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: #fff;
  top: 3px; left: 3px;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.filtros-toggle-sw input:checked ~ .filtros-toggle-track::after { transform: translateX(17px); }
.filtros-sep { width: 1px; height: 30px; background: var(--border); margin: 0 3px; }
.filtro-tipo-btn {
  width: auto; height: auto;
  border-radius: 0;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  transition: opacity .15s, transform .15s;
  flex-shrink: 0;
}
.filtro-tipo-btn img { width: 36px; height: 36px; object-fit: contain; display: block; }
.filtro-tipo-btn.ativo { opacity: 1; }
.filtro-tipo-btn:not(.ativo) { opacity: .3; filter: grayscale(1); }
.filtro-tipo-btn:hover { transform: scale(1.12); }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,41,.6);
  backdrop-filter: blur(2px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 16px; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px;
  border: none;
  background: var(--gray-bg);
  border-radius: 50%;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
  color: var(--text-muted);
}
.modal-close:hover { background: var(--border); color: var(--text); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ── Form ─────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.form-label small { font-weight: 400; color: var(--text-muted); }
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  background: #fff;
  color: var(--text);
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.1); }
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Nova demanda — steps */
.step-header { margin-bottom: 20px; }
.step-num {
  width: 28px; height: 28px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  flex-shrink: 0;
}
.step-title {
  display: flex;
  align-items: center;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}
.step-desc { font-size: 12px; color: var(--text-muted); padding-left: 36px; }

.tipo-grid { display: grid; grid-template-columns: repeat(5,1fr); gap: 8px; }
.tipo-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 6px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  transition: all .15s;
  background: var(--white);
}
.tipo-card input { display: none; }
.tipo-card:has(input:checked) { border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); }
.tipo-card:hover { border-color: var(--primary); }
.tipo-card-icon { font-size: 20px; display: flex; align-items: center; justify-content: center; transition: transform 0.15s ease; }
.tipo-card-icon img { transition: transform 0.15s ease; }

@keyframes tipo-pop {
  0%   { transform: scale(1)    rotate(0deg);  }
  30%  { transform: scale(1.45) rotate(-8deg); }
  60%  { transform: scale(0.85) rotate(4deg);  }
  80%  { transform: scale(1.12) rotate(-2deg); }
  100% { transform: scale(1)    rotate(0deg);  }
}
.tipo-card-animando .tipo-card-icon img { animation: tipo-pop 0.42s cubic-bezier(.36,.07,.19,.97) both; }

.foto-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all .15s;
  color: var(--text-muted);
}
.foto-upload-area:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.foto-preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.foto-preview-item {
  width: 70px; height: 70px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}
.foto-preview-item img { width: 100%; height: 100%; object-fit: cover; }
.foto-preview-item .remove {
  position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px;
  background: rgba(0,0,0,.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 11px;
  display: flex; align-items: center; justify-content: center;
}

.nova-demanda-layout {
  display: grid;
  grid-template-columns: 480px 1fr;
  height: calc(100vh - var(--topbar-h));
}
.nova-demanda-form {
  overflow-y: auto;
  padding: 24px;
  border-right: 1px solid var(--border);
}
.nova-demanda-mapa { position: relative; }
.nova-demanda-mapa #map-nd { width: 100%; height: 100%; }

.local-selecionado {
  background: var(--green-bg);
  border: 1px solid #BBF7D0;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #166534;
  margin-top: 8px;
}
.char-counter { text-align: right; font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ── Ranking page ─────────────────────────────────────────────────────────── */
.ranking-page { padding: 24px; }
.ranking-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.ranking-period-filter {
  display: flex;
  gap: 4px;
  background: var(--gray-bg);
  border-radius: var(--radius-sm);
  padding: 4px;
}
.period-btn {
  padding: 6px 14px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all .15s;
}
.period-btn.active { background: var(--white); color: var(--text); box-shadow: var(--shadow-sm); }

.ranking-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.ranking-item:last-child { border-bottom: none; }
.ranking-pos {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  background: var(--gray-bg);
  color: var(--text-muted);
}
.ranking-pos.gold   { background: #FEF9C3; color: #854D0E; }
.ranking-pos.silver { background: #F1F5F9; color: #475569; }
.ranking-pos.bronze { background: #FEF3C7; color: #92400E; }
.ranking-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ranking-info { flex: 1; min-width: 0; }
.ranking-nome { font-size: 14px; font-weight: 600; }
.ranking-sub  { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.ranking-score { font-size: 18px; font-weight: 800; color: var(--text); text-align: right; }
.ranking-score small { display: block; font-size: 11px; font-weight: 400; color: var(--text-muted); }
.ranking-orgao-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.ranking-stats { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.ranking-taxa { font-size: 14px; font-weight: 700; color: var(--green); }
.ranking-taxa-label { font-size: 10px; color: var(--text-muted); }
.ranking-resolvidas { font-size: 14px; font-weight: 700; }
.ranking-resolvidas-label { font-size: 10px; color: var(--text-muted); }
.ranking-tag { font-size: 11px; color: var(--text-muted); background: var(--gray-bg); padding: 2px 8px; border-radius: 20px; }

.community-highlights {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 20px;
}
.highlight-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.highlight-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.highlight-num { font-size: 22px; font-weight: 800; line-height: 1; }
.highlight-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.highlight-delta { font-size: 11px; font-weight: 600; }
.delta-up   { color: var(--green); }
.delta-down { color: var(--red); }

/* ── Minhas demandas ──────────────────────────────────────────────────────── */
.minhas-demandas-page { display: grid; grid-template-columns: 1fr 360px; height: calc(100vh - var(--topbar-h)); }
.minhas-demandas-content { overflow-y: auto; padding: 24px; }
.minhas-demandas-mapa { border-left: 1px solid var(--border); position: relative; }
.minhas-demandas-mapa #map-md { width: 100%; height: 100%; }

.stats-row {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.stat-mini {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat-mini-num { font-size: 22px; font-weight: 800; }
.stat-mini-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.stat-mini-pct { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}
.tab-btn {
  padding: 10px 16px;
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .15s;
  display: flex; align-items: center; gap: 6px;
}
.tab-btn.active { color: var(--primary); border-color: var(--primary); }
.tab-count {
  background: var(--gray-bg);
  color: var(--text-muted);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 20px;
  font-weight: 600;
}
.tab-btn.active .tab-count { background: var(--primary-light); color: var(--primary-dark); }

.demanda-list-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
}
.demanda-list-item:last-child { border-bottom: none; }
.demanda-list-icon {
  width: 42px; height: 42px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.demanda-list-main { flex: 1; min-width: 0; }
.demanda-list-titulo { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.demanda-list-local { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.demanda-list-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
}
.demanda-list-fotos { display: flex; gap: 4px; }
.demanda-list-fotos img { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; }

/* ── Perfil ───────────────────────────────────────────────────────────────── */
.perfil-page { padding: 24px; }
.perfil-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.perfil-resumo { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-top: 20px; }
.resumo-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.resumo-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}
.resumo-num { font-size: 26px; font-weight: 800; line-height: 1; }
.resumo-label { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.resumo-pct { font-size: 11px; font-weight: 600; }

/* ── Auth pages ───────────────────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}
.auth-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}
.auth-brand-icon {
  width: 42px; height: 42px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
}
.auth-brand-text { font-size: 15px; font-weight: 700; }
.auth-brand-text small { display: block; font-size: 12px; color: var(--text-muted); font-weight: 400; }
.auth-title { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.auth-sub   { color: var(--text-muted); font-size: 13px; margin-bottom: 28px; }
.auth-footer { text-align: center; font-size: 13px; color: var(--text-muted); margin-top: 20px; }
.auth-terms  { font-size: 11px; color: var(--text-muted); margin-top: 12px; text-align: center; }

/* ── Empty ────────────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state svg { opacity: .3; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ── Footer (simple) ──────────────────────────────────────────────────────── */
.page-footer {
  padding: 12px 24px;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
}

/* ── Hamburger button (só mobile) ─────────────────────────────────────────── */
.topbar-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 6px;
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
}
.topbar-hamburger:hover { background: var(--gray-bg); }
.topbar-hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all .2s;
}

/* ── Sidebar overlay (mobile) ─────────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 150; /* topbar=100 → overlay=150 → sidebar=200 */
}
.sidebar-overlay.active { display: block; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .ranking-grid           { grid-template-columns: 1fr; }
  .nova-demanda-layout    { grid-template-columns: 1fr; }
  .nova-demanda-mapa      { display: none; }
  .minhas-demandas-mapa   { display: none; }
  .minhas-demandas-page   { grid-template-columns: 1fr; height: auto; min-height: calc(100vh - var(--topbar-h)); }
  .perfil-grid            { grid-template-columns: 1fr; }
  .perfil-resumo          { grid-template-columns: 1fr 1fr; }
  .community-highlights   { grid-template-columns: 1fr 1fr; }
  .stats-row              { grid-template-columns: 1fr 1fr; }
  .tipo-grid              { grid-template-columns: repeat(3,1fr); }
}

@media (max-width: 768px) {
  /* Sidebar: esconde e desliza ao abrir — z-index: topbar=100, overlay=150, sidebar=200 */
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform .25s ease;
    overflow-y: auto;
  }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; }

  /* Topbar mobile */
  .topbar { padding: 0 14px; gap: 10px; }
  .topbar-hamburger { display: flex; }
  .topbar-title { font-size: 15px; }
  .topbar-search { max-width: none; margin-left: 0; flex: 1; }

  /* Botão Nova Demanda: só ícone no mobile */
  .topbar-nova-txt { display: none; }
  .topbar-nova-btn { padding: 9px 10px; }

  /* Formulário nova demanda — mapa compacto acima do form no mobile */
  .nova-demanda-layout {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - var(--topbar-h));
  }
  .nova-demanda-mapa {
    display: block !important;
    height: 260px;
    flex-shrink: 0;
    order: -1;
  }
  .nova-demanda-mapa #map-nd { height: 260px; }
  .nova-demanda-form { height: auto; border-right: none; }

  /* Mini preview do local selecionado — acima do passo 1 */
  .nd-mini-preview {
    display: none;
    border-radius: 12px;
    overflow: hidden;
    height: 130px;
    position: relative;
    margin-bottom: 16px;
  }
  .nd-mini-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .nd-mini-preview-pin {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -100%);
    font-size: 28px;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,.5));
    pointer-events: none;
  }

  /* Perfil */
  .perfil-page { padding: 16px; }
  .perfil-resumo { grid-template-columns: 1fr 1fr; }

  /* Minhas demandas */
  .minhas-demandas-content { padding: 16px; }

  /* Ranking */
  .ranking-page { padding: 16px; }
  .ranking-period-filter { flex-wrap: wrap; }

  /* Tabs: scroll horizontal */
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; padding-bottom: 1px; }
  .tab-btn { flex-shrink: 0; }

  /* Mapa: legenda e filtros menores */
  .mapa-legenda { width: 170px; left: 8px; right: auto; top: 8px; }
  .mapa-filtros-bar { right: 8px; top: 8px; padding: 5px 8px; gap: 6px; }
  .mapa-total-card { left: 8px; bottom: 16px; padding: 10px 14px; min-width: 0; gap: 10px; }
  .mapa-total-num { font-size: 20px; }
  .mapa-total-icon { width: 34px; height: 34px; }

  /* Auth */
  .auth-card { padding: 28px 20px; }

  /* Stats row 2 col */
  .stats-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  /* Topbar: esconde search quando não tiver showSearch */
  .topbar-search { display: none; }
  .topbar-title { font-size: 14px; }

  /* Stats 1 coluna em telas muito pequenas */
  .stats-row { grid-template-columns: 1fr; }
  .stat-mini { padding: 12px 14px; }

  /* Tipo grid 2 colunas */
  .tipo-grid { grid-template-columns: repeat(2,1fr) !important; }

  /* Perfil resumo 1 coluna */
  .perfil-resumo { grid-template-columns: 1fr; }
  .community-highlights { grid-template-columns: 1fr 1fr; }

  /* Demanda list: meta em coluna */
  .demanda-list-meta { flex-wrap: wrap; gap: 6px; }

  /* Ranking: filtro de período empilhado */
  .ranking-period-filter { justify-content: center; }
  .period-btn { padding: 5px 10px; }

  /* Mapa: legenda colapsada por padrão */
  .mapa-legenda { width: 150px; font-size: 11px; left: 6px; right: auto; }
  .mapa-filtros-bar { gap: 4px; padding: 5px 8px; }
  .filtro-tipo-btn img { width: 28px; height: 28px; }
  .filtros-toggle-label { display: none; }

  /* Flash messages */
  .flash { padding: 10px 14px; }

  /* Minhas demandas */
  .tabs { gap: 0; }
  .tab-btn { padding: 8px 10px; font-size: 12px; }
  .tab-count { display: none; }
}
