:root {
  --bg: #131520;
  --surface: #1a1d2b00;
  --surface-solid: #1a1d2b;
  --surface2: #22253a;
  --border: rgba(255,255,255,0.08);
  --text: #e8eaf0;
  --muted: #6b7280;
  --accent: #3b82f6;
  --accent2: #60a5fa;
  --z-norte: #ef4444;
  --z-leste: #3b82f6;
  --z-sul: #22c55e;
  --z-sudeste: #a855f7;
  --z-rural: #f59e0b;
  --green: #22c55e;
  --red: #ef4444;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  display: flex;
  flex-direction: column;
}

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: 220px;
  background: #1a1d2b;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 200;
}

.sidebar-logo {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: #131520;
  display: flex;
  align-items: center;
  gap: 12px;
}

.sice-logo-sm {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.sidebar-logo h1 {
  font-family: 'DM Sans', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  letter-spacing: 0.04em;
}

.sidebar-logo p {
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 2px;
}

.sidebar-nav {
  padding: 12px 10px;
  flex: 1;
  overflow-y: auto;
}

.nav-label {
  font-size: 0.67rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 8px 10px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
  margin-bottom: 3px;
}

.nav-item:hover { background: rgba(255,255,255,0.04); }

.nav-item.active {
  background: rgba(255,255,255,0.06);
  border-color: var(--border);
}

.nav-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.nav-item .nav-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  flex: 1;
}

.nav-item.active .nav-name {
  font-weight: 600;
}

.nav-item .nav-count {
  font-size: 0.73rem;
  color: var(--muted);
  background: rgba(255,255,255,0.05);
  padding: 2px 7px;
  border-radius: 10px;
}

.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  font-size: 0.7rem;
  color: var(--muted);
}

/* ===== MAIN ===== */
.main {
  margin-left: 220px;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* TOPBAR */
.topbar {
  flex-shrink: 0;
  background: #22253a;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 16px;
  overflow: visible;
}

.zone-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.zone-badge {
  width: 12px; height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.zone-title h2 {
  font-family: 'DM Sans', sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.topbar-pills {
  display: none;
  gap: 8px;
  margin-left: 16px;
}

.pill {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 4px 12px;
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}

.pill strong { color: var(--text); }

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tools-menu {
  position: relative;
}

.filters-menu {
  position: relative;
}

.tools-menu summary,
.filters-menu summary {
  list-style: none;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  cursor: pointer;
  font-size: .86rem;
  font-weight: 600;
  padding: 9px 14px;
  white-space: nowrap;
}

.tools-menu summary::-webkit-details-marker { display: none; }
.filters-menu summary::-webkit-details-marker { display: none; }
.tools-menu summary:hover,
.filters-menu summary:hover { border-color: var(--muted); color: var(--text); }

.tools-menu-list,
.filters-menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 220px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 16px 44px rgba(0,0,0,.28);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  z-index: 500;
}

.filters-menu-list {
  min-width: 260px;
}

.tools-menu-list .btn,
.filters-menu-list .btn {
  width: 100%;
  justify-content: flex-start;
}

.filters-menu-list select {
  width: 100%;
}

#filtro-coord {
  border-color: rgba(59,130,246,.4);
  color: #93c5fd;
  font-weight: 600;
}

#filtro-coord option { color: var(--text); font-weight: 400; }


/* Financeiro panel */
.financeiro-area { background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; margin-top: 12px; }
.financeiro-card { padding: 16px; max-width: 560px; }
.financeiro-card h3 { font-family: 'DM Sans', sans-serif; margin-bottom: 10px; font-size: 1rem; }
.financeiro-card .fg label { font-size: 0.72rem; }
.financeiro-card input { width: 160px; }
.financeiro-card #fin-total { font-weight:800; }

/* SUMMARY STRIP */
.summary-strip {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(37, 40, 48, 0.92);
}

.strip-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1 1 180px;
  min-width: 180px;
  padding: 24px 22px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  position: relative;
  overflow: hidden;
  transition: transform 0.18s ease, background 0.18s ease;
  min-height: 140px;
}

.strip-card:hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,0.08);
}

.strip-card::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 4px;
}

.strip-card.s-total::after    { background: #3b82f6; }
.strip-card.s-l::after        { background: var(--z-leste); }
.strip-card.s-m::after        { background: var(--green); }
.strip-card.s-le::after       { background: var(--z-sudeste); }
.strip-card.s-me::after       { background: #f59e0b; }
.strip-card.s-empregado::after { background: var(--z-sudeste); }
.strip-card.s-custo::after    { background: var(--z-rural); }

.strip-label {
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  margin-bottom: 12px;
  font-weight: 600;
}

.strip-value {
  font-family: 'DM Sans', sans-serif;
  font-size: 2rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.1;
  word-break: break-word;
  overflow-wrap: break-word;
}

.strip-card.s-custo .strip-value {
  font-size: 1.65rem;
}

.strip-sub {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 10px;
}

.strip-card.s-custo { display: none; }

/* ── Tablet landscape (981–1180px) ── */
@media (min-width: 981px) and (max-width: 1180px) {
  .strip-card {
    flex: 1 1 140px;
    min-width: 130px;
    min-height: 100px;
    padding: 14px 16px;
  }
  .strip-value { font-size: 1.6rem; }
  .strip-label { font-size: .65rem; margin-bottom: 6px; }
  .strip-sub   { font-size: .72rem; margin-top: 6px; }
  .summary-strip { gap: 8px; padding: 10px 12px; }
  /* Dashboard inline redundante — strip já mostra os totais */
  .dashboard-area:not(.expanded) { display: none !important; }
}

/* ── Tablet retrato / iPad (769–980px) ── */
@media (min-width: 769px) and (max-width: 980px) {
  .summary-strip { gap: 8px; padding: 10px 12px; justify-content: flex-start; }
  .strip-card {
    flex: 1 1 120px;
    min-width: 110px;
    min-height: 88px;
    padding: 12px 14px;
  }
  .strip-value { font-size: 1.4rem; }
  .strip-label { font-size: .62rem; margin-bottom: 4px; }
  .strip-sub   { font-size: .68rem; margin-top: 4px; }
  /* Dashboard inline redundante no tablet */
  .dashboard-area:not(.expanded) { display: none !important; }
}

@media (max-width: 720px) {
  /* Cards em linha horizontal deslizável — não ocupa altura vertical */
  .summary-strip {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 8px;
    padding: 8px 12px;
  }
  .summary-strip::-webkit-scrollbar { display: none; }
  .strip-card {
    flex: 0 0 auto;
    min-width: 110px;
    max-width: 140px;
    min-height: unset;
    padding: 10px 12px;
    border-radius: 12px;
  }
  .strip-card::after { top: 0; left: 0; width: 100%; height: 3px; bottom: auto; border-radius: 12px 12px 0 0; }
  .strip-label { font-size: .62rem; }
  .strip-value { font-size: 1.6rem; margin: 2px 0 1px; }
  .strip-sub   { font-size: .6rem; }

  .topbar { padding: 0 10px; gap: 8px; height: 52px; }
  .zone-title { flex: 1; min-width: 0; overflow: hidden; }
  .zone-title h2 { font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-actions { gap: 5px; flex-shrink: 0; }
  .btn-logout { display: none; }
  .tools-menu summary { font-size: .75rem; padding: 6px 8px; }
  .zone-badge { display: none; }

  /* Dashboard oculto no mobile — summary-strip já mostra os totais */
  .dashboard-area { display: none !important; }

  /* Tabela: esconde colunas menos importantes no mobile */
  table th:nth-child(6),  /* Ponto */
  table td:nth-child(6),
  table th:nth-child(7),  /* Seção */
  table td:nth-child(7),
  table th:nth-child(8),  /* Cód. */
  table td:nth-child(8),
  table th:nth-child(10), /* Reunião */
  table td:nth-child(10),
  table th:nth-child(12), /* Jul */
  table td:nth-child(12),
  table th:nth-child(13), /* Ago */
  table td:nth-child(13),
  table th:nth-child(14), /* Set */
  table td:nth-child(14),
  table th:nth-child(15), /* Out */
  table td:nth-child(15),
  table th:nth-child(16), /* Total */
  table td:nth-child(16) { display: none; }
}

/* CONTROLS */
.controls-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 18px;
  background: var(--surface-solid);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.search-wrap {
  flex: 1;
  min-width: 220px;
  position: relative;
}

.search-wrap input {
  width: 100%;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  padding: 10px 13px 10px 38px;
  outline: none;
  transition: border-color 0.2s;
}

.search-wrap input:focus { border-color: var(--accent, #e8433a); }
.search-wrap input::placeholder { color: var(--muted); }

.search-icon {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
}

select {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  padding: 10px 13px;
  outline: none;
  cursor: pointer;
}

select:focus { border-color: var(--accent, #e8433a); }

.btn {
  padding: 9px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent, #e8433a);
  color: #fff;
}

.btn-primary:hover { opacity: 0.88; transform: translateY(-1px); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}

.btn-outline:hover { border-color: #3b82f6; color: #3b82f6; }

.result-info {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

/* TABLE AREA — this is the scrollable part */
.table-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  position: relative;
  background: #131520;
}

/* Custom scrollbar */
.table-area::-webkit-scrollbar { width: 6px; height: 6px; }
.table-area::-webkit-scrollbar-track { background: transparent; }
.table-area::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.table-area::-webkit-scrollbar-thumb:hover { background: var(--muted); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  min-width: 680px;
}

/* Tela principal mais limpa: campos secundários continuam no drawer. */
th:nth-child(1), td:nth-child(1),
th:nth-child(6), td:nth-child(6),
th:nth-child(7), td:nth-child(7),
th:nth-child(8), td:nth-child(8),
th:nth-child(9), td:nth-child(9),
th:nth-child(10), td:nth-child(10),
th:nth-child(11), td:nth-child(11),
th:nth-child(12), td:nth-child(12),
th:nth-child(13), td:nth-child(13),
th:nth-child(14), td:nth-child(14),
th:nth-child(15), td:nth-child(15),
th:nth-child(16), td:nth-child(16) {
  display: none;
}

thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #22253a;
}

th {
  padding: 13px 16px;
  text-align: left;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

th:hover { color: var(--text); }
th.sorted { color: var(--text); }
th .si { opacity: 0.35; }
th.sorted .si { opacity: 1; }

td {
  padding: 13px 16px;
  border-bottom: 1px solid rgba(37,42,64,0.6);
  vertical-align: middle;
  white-space: nowrap;
}

tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255,255,255,0.02); }

.badge {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 12px;
  font-size: 0.71rem;
  font-weight: 700;
  font-family: 'DM Sans', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-L { background: rgba(59,130,246,.15); color: #60a5fa; border: 1px solid rgba(59,130,246,.3); }
.badge-M { background: rgba(34,197,94,.12); color: #4ade80; border: 1px solid rgba(34,197,94,.3); }
.badge-LE { background: rgba(168,85,247,.15); color: #c084fc; border: 1px solid rgba(168,85,247,.3); }
.badge-ME { background: rgba(234,179,8,.15); color: #facc15; border: 1px solid rgba(234,179,8,.3); }
.badge-CA { background: rgba(251,146,60,.18); color: #fb923c; border: 1px solid rgba(251,146,60,.35); }

.nome-td {
  font-weight: 500;
  color: var(--text);
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.muted-td { color: var(--muted); font-size: 0.82rem; }

.mono { font-family: 'DM Mono', monospace; }

.votos-td {
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  text-align: center;
}

.num-td { text-align: right; }

.c0 { color: var(--muted); }
.c1 { color: #4ade80; }
.c2 { color: #fb923c; }
.c3 { color: #f87171; }

.total-td {
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  text-align: right;
}

.btn-ico {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 7px;
  font-size: 12px;
  transition: all 0.15s;
}

.btn-ico:hover { border-color: var(--border); color: var(--text); }
.btn-ico.view:hover { color: #60a5fa; border-color: rgba(59,130,246,.3); }
.btn-ico.edit:hover { color: #4ade80; border-color: rgba(34,197,94,.3); }
.btn-ico.del:hover { color: #f87171; border-color: rgba(248,113,113,.3); }

/* PAGINATION */
.pagination {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.pbn {
  min-width: 36px; height: 36px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.82rem;
  display: flex; align-items: center; justify-content: center;
  padding: 0 10px;
  transition: all 0.15s;
}

.pbn:hover { border-color: var(--muted); color: var(--text); }
.pbn.active { background: #3b82f6; border-color: #3b82f6; color: #fff; }
.pbn:disabled { opacity: 0.25; cursor: not-allowed; }

.p-info { font-size: 0.74rem; color: var(--muted); padding: 0 10px; }

/* EMPTY */
.empty {
  padding: 70px 20px;
  text-align: center;
  color: var(--muted);
}

.empty .ei { font-size: 36px; margin-bottom: 10px; }
.empty p { font-size: 0.85rem; }

/* MODAL */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.overlay.on { display: flex; }

.modal {
  background: #22253a;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 26px 28px;
  width: 100%;
  max-width: 600px;
  max-height: 88vh;
  overflow-y: auto;
  animation: su .2s ease;
}

.modal::-webkit-scrollbar { width: 4px; }
.modal::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

@keyframes su { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:translateY(0); } }

.modal h2 {
  font-family: 'DM Sans', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 20px;
}

.fg { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.fg label { font-size: 0.70rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.fg input, .fg select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.87rem;
  padding: 11px 13px;
  outline: none;
  width: 100%;
}

.fg input:focus, .fg select:focus { border-color: var(--accent, #e8433a); }

.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.full { grid-column: 1 / -1; }
.fsep {
  grid-column: 1/-1;
  font-size: 0.67rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  margin-top: 4px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* DETAIL DRAWER */
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 320px;
  background: #22253a;
  border-left: 1px solid var(--border);
  z-index: 400;
  padding: 24px 22px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform .25s ease;
  box-shadow: -12px 0 40px rgba(0,0,0,.5);
}

.drawer.open { transform: translateX(0); }
.drawer::-webkit-scrollbar { width: 4px; }
.drawer::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.drawer-close {
  position: absolute; top: 16px; right: 16px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 7px; color: var(--muted); cursor: pointer;
  padding: 5px 9px; font-size: 12px;
}

.drawer-close:hover { color: var(--text); }

.d-badge-wrap { margin-bottom: 8px; }
.d-name { font-family: 'DM Sans', sans-serif; font-size: 1.1rem; font-weight: 600; color: #fff; line-height: 1.35; margin-bottom: 14px; }
.d-row { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid rgba(37,42,64,.8); gap: 13px; font-size: 0.875rem; }
.d-row:last-child { border-bottom: none; }
.d-lbl { color: var(--muted); font-size: 0.74rem; text-transform: uppercase; letter-spacing: .05em; flex-shrink: 0; }
.d-val { color: var(--text); text-align: right; }
.d-total-box { background: var(--bg); border-radius: 12px; padding: 14px 16px; margin-top: 14px; }
.d-total-lbl { font-size: 0.70rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 8px; }
.d-total-val { font-family: 'DM Sans', sans-serif; font-size: 1.4rem; font-weight: 600; }
.cost-bar { height: 5px; background: var(--bg); border-radius: 3px; overflow: hidden; margin-top: 8px; border: 1px solid var(--border); }
.cost-fill { height: 100%; border-radius: 3px; transition: width .5s ease; }

/* TOAST */
.toast {
  position: fixed; bottom: 22px; right: 22px;
  background: #22253a; border: 1px solid var(--green);
  color: var(--green); padding: 10px 18px; border-radius: 10px;
  font-size: 0.82rem; font-weight: 500; z-index: 9999;
  transform: translateY(60px); opacity: 0;
  transition: all .25s ease;
  box-shadow: 0 4px 20px rgba(34,197,94,.2);
}

.toast.show { transform: translateY(0); opacity: 1; }
.toast.err { border-color: var(--red); color: var(--red); box-shadow: 0 4px 20px rgba(232,67,58,.2); }

/* TREE VIEW */
.tree-area {
  flex: 1;
  overflow-y: auto;
  display: none;
  padding: 20px 24px;
  background: var(--bg);
}

.tree-area.active { display: block; }
.tree-area::-webkit-scrollbar { width: 6px; }
.tree-area::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* RELATÓRIO FINANCEIRO */
.relatorio-area {
  flex: 1;
  overflow-y: auto;
  display: none;
  padding: 20px 0 40px;
  background: var(--bg);
}
.relatorio-area.active { display: block; }
.relatorio-area::-webkit-scrollbar { width: 6px; }
.relatorio-area::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.relatorio-area .tree-header { padding: 0 24px 0; }

.fin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
.fin-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 1;
}
.fin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.fin-table tbody tr:hover td { background: rgba(255,255,255,.03); }
.fin-table tfoot td {
  padding: 14px 16px;
  border-top: 2px solid var(--border);
  border-bottom: none;
  background: rgba(255,255,255,.025);
}

body.theme-light .relatorio-area { background: #f0f2f8; }
body.theme-light .fin-table th { background: #f0f2f8; }
body.theme-light .fin-table tbody tr:hover td { background: rgba(0,0,0,.03); }
body.theme-light .fin-table tfoot td { background: rgba(0,0,0,.02); }

/* ── FILTROS RELATÓRIO ── */
.rel-filter-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 0 24px 14px; flex-wrap: wrap;
}
.rel-zone-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.rel-zpill {
  padding: 5px 12px; border-radius: 20px; font-size: .75rem; font-weight: 500;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); cursor: pointer; transition: all .15s;
}
.rel-zpill:hover { opacity: .8; }
.rel-zpill.active { color: var(--text); border-color: currentColor; font-weight: 700; }
.rel-search {
  flex: 1; min-width: 180px; max-width: 280px;
  padding: 7px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: .82rem; font-family: inherit;
}
.rel-search:focus { outline: none; border-color: #3b82f6; }
body.theme-light .rel-zpill { background: #fff; }
body.theme-light .rel-search { background: #fff; }

/* ── RELATÓRIO FINANCEIRO NOVO ── */
.fin-wrap { padding: 0 20px 40px; }
.fin-top { display: flex; flex-direction: column; gap: 14px; margin-bottom: 20px; }

.fin-month-cards { display: flex; gap: 10px; flex-wrap: wrap; }
.fin-mc {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px; flex: 1; min-width: 110px;
}
.fin-mc-total { border-style: dashed; }
.fin-mc-lbl { font-size:.65rem; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); margin-bottom:5px; }
.fin-mc-val { font-size:1rem; font-weight:700; }

.fin-chart-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px 24px 14px;
}
.fin-chart { display:flex; align-items:flex-end; gap:20px; height:130px; }
.fin-bar-col { flex:1; display:flex; flex-direction:column; align-items:center; gap:4px; height:100%; justify-content:flex-end; max-width:120px; }
.fin-bar { width:100%; border-radius:6px 6px 0 0; min-height:4px; }
.fin-bl { font-size:.72rem; color:var(--muted); font-weight:500; }
.fin-bv { font-size:.72rem; font-weight:600; color:var(--text); text-align:center; }

.fin-accordion { display:flex; flex-direction:column; gap:8px; }
.fin-acc-item { background:var(--surface); border:1px solid var(--border); border-radius:12px; overflow:hidden; }
.fin-acc-hd {
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 18px; cursor:pointer; gap:12px; user-select:none;
}
.fin-acc-hd:hover { background:rgba(255,255,255,.03); }
.fin-acc-left { display:flex; align-items:center; gap:10px; min-width:160px; flex-shrink:0; }
.fin-acc-dot { width:9px; height:9px; border-radius:50%; flex-shrink:0; }
.fin-acc-nome { font-weight:600; font-size:.88rem; }
.fin-acc-sub { font-size:.68rem; margin-top:2px; }
.fin-acc-stats { display:flex; align-items:center; gap:14px; flex-wrap:wrap; }
.fin-acc-s { font-size:.82rem; display:flex; flex-direction:column; align-items:flex-end; gap:1px; }
.fin-acc-s em { font-style:normal; font-size:.6rem; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; }
.fin-acc-total { font-weight:800; font-size:.95rem; min-width:80px; text-align:right; }
.fin-acc-arrow { color:var(--muted); font-size:.7rem; flex-shrink:0; width:16px; text-align:center; }

.fin-acc-body { display:none; border-top:1px solid var(--border); overflow-x:auto; }
.fin-acc-body.open { display:block; }

.fin-mem-table { width:100%; border-collapse:collapse; font-size:.82rem; }
.fin-mem-table th {
  padding:8px 14px; font-size:.62rem; text-transform:uppercase; letter-spacing:.05em;
  color:var(--muted); background:rgba(255,255,255,.02); border-bottom:1px solid var(--border);
  white-space:nowrap; text-align:left;
}
.fin-mem-table td { padding:9px 14px; border-bottom:1px solid rgba(255,255,255,.04); vertical-align:middle; }
.fin-mem-table tbody tr:last-child td { border-bottom:none; }
.fin-mem-table tbody tr:hover td { background:rgba(255,255,255,.025); }

.fin-badge {
  display:inline-block; padding:2px 7px; border-radius:5px;
  font-size:.7rem; font-weight:700; white-space:nowrap;
}

body.theme-light .fin-mc,
body.theme-light .fin-chart-box,
body.theme-light .fin-acc-item { background:#fff; }
body.theme-light .fin-acc-hd:hover { background:rgba(0,0,0,.02); }
body.theme-light .fin-mem-table th { background:#f8f9fd; }
body.theme-light .fin-mem-table td { border-bottom-color:#eef0f8; }
body.theme-light .fin-mem-table tbody tr:hover td { background:rgba(0,0,0,.015); }

.tree-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.tree-header h3 {
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
}

.tree-search {
  flex: 1;
  max-width: 280px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  padding: 7px 12px;
  outline: none;
}

.tree-search:focus { border-color: var(--accent, #e8433a); }

.tree-stats {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tree-stat {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 0.75rem;
  color: var(--muted);
}

.tree-stat strong { color: var(--text); font-family: 'DM Sans', sans-serif; }

/* CA node */
.tree-ca {
  background: #22253a;
  border: 1px solid rgba(59,130,246,.25);
  border-left: 4px solid #3b82f6;
  border-radius: 12px;
  margin-bottom: 16px;
  overflow: hidden;
}

.tree-ca-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  cursor: pointer;
  transition: background .15s;
  user-select: none;
}

.tree-ca-header:hover { background: rgba(251,146,60,.05); }

.tree-ca-avatar {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: rgba(251,146,60,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.tree-ca-info { flex: 1; }
.tree-ca-nome {
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: .9rem;
  color: #fff;
}

.tree-ca-sub { font-size: .72rem; color: var(--muted); margin-top: 2px; }

.tree-ca-counts {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tree-count-pill {
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3px 10px;
  font-size: .7rem;
  color: var(--muted);
  white-space: nowrap;
}

.tree-count-pill strong { color: var(--text); }

.tree-toggle { color: var(--muted); font-size: .8rem; transition: transform .2s; }
.tree-toggle.open { transform: rotate(90deg); }

.tree-ca-body { display: none; padding: 0 18px 14px 18px; }
.tree-ca-body.open { display: block; }

/* Liderança node */
.tree-l {
  background: rgba(59,130,246,.06);
  border: 1px solid rgba(59,130,246,.2);
  border-left: 3px solid #3b82f6;
  border-radius: 10px;
  margin: 8px 0 8px 16px;
  overflow: hidden;
}

.tree-l-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background .15s;
  user-select: none;
}

.tree-l-header:hover { background: rgba(59,130,246,.06); }

.tree-l-avatar {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: rgba(59,130,246,.15);
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem;
  flex-shrink: 0;
}

.tree-l-nome {
  flex: 1;
  font-weight: 500;
  font-size: .83rem;
  color: var(--text);
}

.tree-l-sub { font-size: .7rem; color: var(--muted); }

.tree-l-body { display: none; padding: 4px 14px 10px 14px; }
.tree-l-body.open { display: block; }

/* Mobilizador node */
.tree-m {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  margin: 4px 0 4px 20px;
  border-radius: 8px;
  background: rgba(34,197,94,.05);
  border: 1px solid rgba(34,197,94,.15);
  transition: background .15s;
  cursor: pointer;
}

.tree-m:hover { background: rgba(34,197,94,.1); }

.tree-m-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
}

.tree-m-nome { font-size: .8rem; color: var(--text); flex: 1; }
.tree-m-bairro { font-size: .7rem; color: var(--muted); }
.tree-m-votos { font-size: .75rem; font-weight: 700; color: var(--accent, #e8433a); white-space: nowrap; }

/* Sem vínculo */
.tree-orphans {
  margin-top: 24px;
  background: #22253a;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.tree-orphans-header {
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

.tree-orphans-header h4 {
  font-family: 'DM Sans', sans-serif;
  font-size: .82rem;
  font-weight: 700;
  color: var(--muted);
  flex: 1;
}

.tree-orphans-body { padding: 10px 18px; display: none; }
.tree-orphans-body.open { display: block; }

.orphan-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(37,42,64,.5);
  font-size: .8rem;
}

.orphan-item:last-child { border-bottom: none; }
.orphan-name { flex: 1; color: var(--text); }
.orphan-bairro { color: var(--muted); font-size: .72rem; }

.topbar-view-btn {
  background: rgba(255,255,255,.06) !important;
  border: 1px solid var(--border) !important;
  color: var(--muted) !important;
  border-radius: 8px !important;
  padding: 7px 10px !important;
  font-size: 1rem !important;
  min-width: unset !important;
  flex-shrink: 0;
}
.topbar-view-btn.active {
  background: rgba(59,130,246,.15) !important;
  border-color: rgba(59,130,246,.4) !important;
  color: #3b82f6 !important;
}
body.theme-light .topbar-view-btn { background: #f0f2f8 !important; border-color: #dde1ee !important; color: #7880a0 !important; }
body.theme-light .topbar-view-btn.active { background: rgba(59,130,246,.1) !important; color: #3b82f6 !important; }

.btn-tree-toggle {
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 8px;
  padding: 7px 14px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: .82rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all .15s;
}

.btn-tree-toggle:hover, .btn-tree-toggle.active {
  background: rgba(59,130,246,.15);
  border-color: #3b82f6;
  color: #3b82f6;
}

/* MAP FULLSCREEN */
.map-fullscreen .sidebar { display: none; }
.map-fullscreen .main { margin-left: 0 !important; }
.map-fullscreen .campanha-bar { display: none !important; }
.map-fullscreen .summary-strip { display: none !important; }
.map-fullscreen .controls-bar { display: none !important; }
.map-fullscreen .table-area { display: none !important; }
.map-fullscreen .tree-area { display: none !important; }
.map-fullscreen .dashboard-area { display: none !important; }
.map-fullscreen .pagination { display: none !important; }
.map-fullscreen .topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
}
.map-fullscreen .map-area {
  position: fixed !important;
  top: 54px; left: 0; right: 0; bottom: 0;
  z-index: 999;
}
.map-fullscreen #map { width: 100% !important; height: 100% !important; }

/* MAP VIEW */
.map-area {
  flex: 1;
  display: none;
  position: relative;
}
.map-area.active { display: block; }
.table-area.hidden { display: none; }
#map { width: 100%; height: 100%; }

.map-filter-bar {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(19,21,32,0.92);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 6px 14px;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
}
.mfb-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #6b7280;
  margin-right: 4px;
}
.mfb-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: #6b7280;
  font-size: .75rem;
  font-weight: 700;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all .15s;
}
.mfb-btn.active {
  background: rgba(255,255,255,0.1);
  color: #e8eaf0;
  border-color: rgba(255,255,255,0.2);
}
.mfb-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.mfb-btn:not(.active) .mfb-dot { opacity: 0.3; }
.mfb-all {
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);
  background: transparent;
  color: #6b7280;
  font-size: .7rem;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  margin-left: 4px;
  transition: color .15s;
}
.mfb-all:hover { color: #e8eaf0; }

/* DASHBOARD VIEW */
.dashboard-area {
  display: none;
  flex-shrink: 0;
  background: var(--bg);
  padding: 8px 18px 6px;
  border-bottom: 1px solid var(--border);
}

.dashboard-area .dashboard-header { display: none; }
.dashboard-area .dashboard-panels { display: none; }

.dashboard-area.active { display: block; }
.dashboard-area.hidden-by-view { display: none !important; }

/* Modo expandido (árvore/mapa fechados) mostra tudo */
.dashboard-area.expanded .dashboard-header { display: flex; }
.dashboard-area.expanded .dashboard-panels { display: grid; }

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.dashboard-kicker {
  color: var(--muted);
  font-size: .70rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.dashboard-header h3 {
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  margin-top: 4px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 0;
}

/* Cards compactos no modo inline (acima da tabela) */
.dashboard-area:not(.expanded) .dashboard-card {
  padding: 8px 12px 8px 16px;
}
.dashboard-area:not(.expanded) .dashboard-card-label { font-size: .68rem; }
.dashboard-area:not(.expanded) .dashboard-card-value { font-size: 1.3rem; margin: 1px 0; }
.dashboard-area:not(.expanded) .dashboard-card-sub   { font-size: .65rem; }

.dashboard-card,
.dashboard-panel {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.dashboard-card {
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}

/* Faixa colorida lateral para dar identidade visual a cada cartão */
.dashboard-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent);
}

.dashboard-card:nth-child(1)::before { background: #3b82f6; }
.dashboard-card:nth-child(2)::before { background: #22c55e; }
.dashboard-card:nth-child(3)::before { background: #a855f7; }
.dashboard-card:nth-child(4)::before { background: #fb923c; }
.dashboard-card:nth-child(5)::before { background: #06b6d4; }
.dashboard-card:nth-child(6)::before { background: #eab308; }
.dashboard-card:nth-child(7)::before { background: #ef4444; }
.dashboard-card:nth-child(8)::before { background: #ec4899; }

.dashboard-card-label {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.dashboard-card-value {
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 1.85rem;
  font-weight: 600;
  margin-top: 10px;
  line-height: 1.1;
}

.dashboard-card-sub {
  color: var(--muted);
  font-size: .78rem;
  margin-top: 6px;
}

.dashboard-panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.dashboard-panel {
  padding: 16px 18px;
}

.dashboard-panel h4 {
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: .95rem;
  font-weight: 600;
  margin-bottom: 14px;
}

.dash-bar-row {
  display: grid;
  grid-template-columns: minmax(80px, 1fr) 1.8fr auto;
  align-items: center;
  gap: 11px;
  margin-bottom: 11px;
  font-size: .84rem;
}

.dash-bar-label {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-bar-value {
  color: var(--text);
  font-weight: 700;
  text-align: right;
}

.dash-bar-track {
  background: rgba(255,255,255,.06);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}

.dash-bar-fill {
  background: var(--accent, #3b82f6);
  border-radius: 999px;
  height: 100%;
  min-width: 3px;
}

.dash-empty {
  color: var(--muted);
  font-size: .78rem;
  padding: 8px 0;
}

.map-legend {
  position: absolute;
  bottom: 20px; left: 20px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  z-index: 1000;
  font-size: 0.75rem;
  min-width: 140px;
}

.map-legend h4 {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  color: var(--text);
}

.legend-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.3);
}

.map-info-bar {
  position: absolute;
  top: 12px; left: 50%;
  transform: translateX(-50%);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 16px;
  z-index: 1000;
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

.map-info-bar strong { color: var(--text); }

.geocode-progress {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px 32px;
  z-index: 2000;
  text-align: center;
  display: none;
}

.geocode-progress.active { display: block; }

.gc-spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent, #e8433a);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }
.gc-text { font-size: 0.82rem; color: var(--muted); }
.gc-sub { font-size: 0.72rem; color: var(--muted); margin-top: 4px; }

/* Leaflet popup custom */
.leaflet-popup-content-wrapper {
  background: var(--surface2) !important;
  border: 1px solid var(--border) !important;
  border-radius: 12px !important;
  box-shadow: 0 8px 32px rgba(0,0,0,.5) !important;
  color: var(--text) !important;
  font-family: 'DM Sans', sans-serif !important;
}

.leaflet-popup-tip { background: var(--surface2) !important; }

.popup-nome { font-family: 'DM Sans', sans-serif; font-weight: 700; font-size: .9rem; margin-bottom: 6px; color: #1e2235; }
.popup-row { display: flex; justify-content: space-between; gap: 10px; font-size: .75rem; padding: 3px 0; border-bottom: 1px solid rgba(37,42,64,.6); }
.popup-row:last-child { border: none; }
.popup-lbl { color: var(--muted); }
.popup-val { color: var(--text); font-weight: 500; }

/* View toggle btn */
.btn-map-toggle {
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 8px;
  padding: 7px 14px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: .82rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all .15s;
}
.btn-map-toggle:hover, .btn-map-toggle.active {
  background: rgba(59,130,246,.15);
  border-color: #3b82f6;
  color: #3b82f6;
}

/* LOGIN SCREEN */
.login-screen {
  position: fixed;
  inset: 0;
  background: #131520;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.login-screen.hidden { display: none; }

.login-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px 40px;
  width: 100%;
  max-width: 380px;
  animation: su .25s ease;
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.sice-logo-lg {
  width: 72px;
  height: 72px;
  display: block;
  margin: 0 auto 12px;
}

.login-logo h1 {
  font-family: 'DM Sans', sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.08em;
}

.login-logo p {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 4px;
}

.login-field {
  margin-bottom: 14px;
}

.login-field label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  margin-bottom: 6px;
}

.login-field input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  padding: 11px 14px;
  outline: none;
  transition: border-color .2s;
}

.login-field input:focus { border-color: var(--accent, #e8433a); }

.login-btn {
  width: 100%;
  background: #3b82f6;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  transition: opacity .2s;
}

.login-btn:hover { opacity: .88; }
.login-btn:disabled { opacity: .5; cursor: not-allowed; }

.login-error {
  background: rgba(232,67,58,.12);
  border: 1px solid rgba(232,67,58,.3);
  border-radius: 8px;
  color: #f87171;
  font-size: 0.8rem;
  padding: 10px 12px;
  margin-top: 12px;
  display: none;
  text-align: center;
}

.login-error.show { display: block; }

.login-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.72rem;
  color: var(--muted);
}

/* User info in topbar */
.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
}

.user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #60a5fa);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  flex-shrink: 0;
}

.user-email {
  font-size: 0.72rem;
  color: var(--muted);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar .user-email { display: none; }

.btn-logout {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--muted);
  cursor: pointer;
  padding: 5px 10px;
  font-size: 0.72rem;
  font-family: 'DM Sans', sans-serif;
  transition: all .15s;
  white-space: nowrap;
}

.btn-logout:hover { border-color: var(--accent, #e8433a); color: var(--accent, #e8433a); }

/* Import button */


.btn-import { background: rgba(255,255,255,.05); border: 1px solid var(--border); color: var(--muted); }
.btn-import:hover { border-color: var(--muted); color: var(--text); }

.btn-dashboard {
  background: rgba(59,130,246,.12);
  border: 1px solid rgba(59,130,246,.25);
  color: #93c5fd;
  padding: 8px 12px;
}

.btn-dashboard:hover,
.btn-dashboard.active {
  background: rgba(59,130,246,.2);
  border-color: #3b82f6;
  color: #bfdbfe;
}

/* ============================================================
   CAMPANHAS
   ============================================================ */
.campanha-bar {
  background: #1a1d28;
  border-bottom: 1px solid var(--border);
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  flex-shrink: 0;
}

body.theme-light .campanha-bar { background: #e8eaf5; border-bottom-color: #dde1ee; }

.campanha-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  white-space: nowrap;
}

.campanha-tabs {
  display: flex;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
}

.campanha-select {
  flex: 1;
  min-width: 180px;
  max-width: 360px;
  height: 32px;
  padding: 6px 12px;
  font-size: .75rem;
  background: rgba(255,255,255,.04);
  border-color: var(--border);
}

.campanha-tab {
  padding: 3px 10px;
  border-radius: 6px;
  font-size: .7rem;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  white-space: nowrap;
  border: 1px solid transparent;
  color: var(--muted);
  transition: all .15s;
  background: transparent;
}

.campanha-tab:hover { background: rgba(255,255,255,.06); color: var(--text); }
.campanha-tab.active { background: rgba(59,130,246,.15); border-color: rgba(59,130,246,.3); color: #60a5fa; }

.campanha-clear-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color .15s;
}

.campanha-clear-btn:hover { color: #ef4444; }

body.theme-light .campanha-tab:hover { background: rgba(0,0,0,.05); color: #1e2235; }
body.theme-light .campanha-tab.active { background: rgba(59,130,246,.1); border-color: rgba(59,130,246,.25); color: #2563eb; }

.btn-nova-campanha {
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-size: .68rem;
  padding: 3px 8px;
  font-family: 'DM Sans', sans-serif;
  transition: all .15s;
  white-space: nowrap;
}

.btn-nova-campanha:hover { border-color: #3b82f6; color: #3b82f6; }
.btn-nova-campanha:disabled {
  opacity: .45;
  cursor: not-allowed;
}

/* Modal de campanha */
.modal-campanha {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal-campanha.open { display: flex; }

.modal-campanha-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px 32px;
  width: 100%;
  max-width: 480px;
  animation: su .2s ease;
}

body.theme-light .modal-campanha-box { background: #fff; border-color: #dde1ee; }

.modal-campanha-box h2 {
  font-family: 'DM Sans', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 20px;
}

body.theme-light .modal-campanha-box h2 { color: #1e2235; }

.mc-field { margin-bottom: 14px; }
.mc-field label { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 6px; }
.mc-field input, .mc-field select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: .88rem;
  padding: 10px 12px;
  outline: none;
}

body.theme-light .mc-field input, body.theme-light .mc-field select { background: #f0f2f8; border-color: #dde1ee; color: #1e2235; }

.mc-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
body.theme-light .mc-footer { border-top-color: #dde1ee; }

/* Migrar badge no drawer */
/* Modal de seleção de campanhas */
.modal-camps-sel {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 3000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal-camps-sel.open { display: flex; }

.modal-camps-sel-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px 28px;
  width: 100%;
  max-width: 420px;
  animation: su .2s ease;
}

body.theme-light .modal-camps-sel-box { background: #fff; border-color: #dde1ee; }

.modal-camps-sel-box h3 {
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

body.theme-light .modal-camps-sel-box h3 { color: #1e2235; }

.modal-camps-sel-box p {
  font-size: .78rem;
  color: var(--muted);
  margin-bottom: 16px;
}

.mcs-search {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: .82rem;
  padding: 9px 11px;
  margin-bottom: 10px;
  outline: none;
}

.mcs-search:focus { border-color: #3b82f6; }

.mcs-actions {
  display: none;
  gap: 8px;
  margin-bottom: 12px;
}

.mcs-actions.on { display: flex; }

.mcs-actions .btn {
  flex: 1;
  justify-content: center;
  padding: 7px 10px;
}

body.theme-light .mcs-search {
  background: #f0f2f8;
  border-color: #dde1ee;
  color: #1e2235;
}

.camp-check-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
  max-height: 280px;
  overflow-y: auto;
}

.camp-check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all .15s;
  user-select: none;
}

body.theme-light .camp-check-item { background: #f0f2f8; border-color: #dde1ee; }

.camp-check-item:hover { border-color: #3b82f6; }
.camp-check-item.selected { background: rgba(59,130,246,.1); border-color: rgba(59,130,246,.35); }

.camp-check-item input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: #3b82f6;
  flex-shrink: 0;
}

.camp-check-nome {
  font-size: .83rem;
  font-weight: 500;
  color: var(--text);
  flex: 1;
}

body.theme-light .camp-check-nome { color: #1e2235; }

.camp-check-cargo {
  font-size: .68rem;
  color: var(--muted);
  padding: 2px 8px;
  background: rgba(255,255,255,.05);
  border-radius: 8px;
}

body.theme-light .camp-check-cargo { background: rgba(0,0,0,.05); }

.mcs-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

body.theme-light .mcs-footer { border-top-color: #dde1ee; }

.migrar-zona-btn {
  width: 100%;
  margin-top: 8px;
  background: rgba(59,130,246,.1);
  border: 1px solid rgba(59,130,246,.25);
  border-radius: 8px;
  color: #60a5fa;
  cursor: pointer;
  font-size: .78rem;
  font-family: 'DM Sans', sans-serif;
  padding: 8px 12px;
  transition: all .15s;
}

.migrar-zona-btn:hover { background: rgba(59,130,246,.2); }

/* ============================================================
   PAINEL DE ZONAS (visão todas)
   ============================================================ */
#zone-panel {
  display: none;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  padding: 16px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.zone-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-top: 3px solid #3b82f6;
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}

.zone-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}

.zone-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.zone-card-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.zone-card-name {
  font-family: 'DM Sans', sans-serif;
  font-size: .82rem;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.zone-card-count {
  font-size: .7rem;
  color: var(--muted);
  background: rgba(255,255,255,.05);
  padding: 2px 8px;
  border-radius: 10px;
}

.zone-card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.zone-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.zone-stat-val {
  font-family: 'DM Sans', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1;
}

.zone-stat-lbl {
  font-size: .65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.zone-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* Light theme zone cards */
body.theme-light .zone-card { background: #ffffff; border-color: #dde1ee; }
body.theme-light .zone-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,.08); }
body.theme-light .zone-card-name { color: #1e2235; }
body.theme-light .zone-card-count { background: #f0f2f8; color: #7880a0; }
body.theme-light .zone-card-footer { border-top-color: #eef0f8; }

@media (max-width: 768px) {
  #zone-panel {
    grid-template-columns: 1fr 1fr;
    padding: 10px 12px;
    gap: 8px;
  }
  .zone-card { padding: 10px 12px; }
  .zone-stat-val { font-size: .95rem; }
}

/* ============================================================
   TEMA CLARO
   ============================================================ */
body.theme-light {
  --bg: #f0f2f8;
  --surface: #ffffff00;
  --surface-solid: #ffffff;
  --surface2: #ffffff;
  --border: #dde1ee;
  --text: #1e2235;
  --muted: #7880a0;
  background: #f0f2f8;
  color: #1e2235;
}

body.theme-light .sidebar { background: #ffffff; border-right-color: #dde1ee; }
body.theme-light .sidebar-logo { background: #f8f9fd; border-bottom: 1px solid #dde1ee; }
body.theme-light .sidebar-logo h1 { color: #1e2235; }
body.theme-light .sidebar-logo p { color: #7880a0; }
body.theme-light .nav-item .nav-name { color: #1e2235; }
body.theme-light .nav-item .nav-count { color: #7880a0; background: #eef0f8; }
body.theme-light .nav-item:hover { background: #f0f2f8; }
body.theme-light .nav-item.active { background: rgba(59,130,246,.1); border-color: rgba(59,130,246,.3); }
body.theme-light .nav-label { color: #a0a8c0; }
body.theme-light .nav-dot { opacity: .85; }
body.theme-light .nav-region-label { color: #1e2235; }
body.theme-light .nav-coord-indicator { opacity: .85; }
body.theme-light .sidebar-footer { color: #a0a8c0; border-top-color: #dde1ee; background: #f8f9fd; }

body.theme-light .topbar { background: #ffffff; border-bottom-color: #dde1ee; }
body.theme-light .summary-strip { background: #ffffff; border-bottom-color: #dde1ee; }
body.theme-light .strip-card { border-right-color: #dde1ee; }
body.theme-light .strip-value { color: #1e2235; }
body.theme-light .strip-label { color: #7880a0; }
body.theme-light .strip-sub { color: #7880a0; }

body.theme-light .controls-bar { background: #f0f2f8; border-bottom-color: #dde1ee; }
body.theme-light .search-wrap input { background: #ffffff; border-color: #dde1ee; color: #1e2235; }
body.theme-light .search-wrap input::placeholder { color: #a0a8c0; }
body.theme-light select { background: #ffffff; border-color: #dde1ee; color: #1e2235; }

body.theme-light .table-area { background: #f8f9fd; }
body.theme-light thead { background: #eef0f8; }
body.theme-light th { color: #7880a0; border-bottom-color: #dde1ee; }
body.theme-light td { border-bottom-color: #eef0f8; color: #1e2235; }
body.theme-light tbody tr:hover td { background: rgba(59,130,246,.04); }
body.theme-light .nome-td { color: #1e2235; }
body.theme-light .muted-td { color: #7880a0; }

body.theme-light .modal { background: #ffffff; border-color: #dde1ee; }
body.theme-light .fg input, body.theme-light .fg select, body.theme-light .fgrid select { background: #f0f2f8; border-color: #dde1ee; color: #1e2235; }
body.theme-light .fsep { color: #7880a0; border-bottom-color: #dde1ee; }
body.theme-light .modal h2 { color: #1e2235; }

body.theme-light .drawer { background: #ffffff; border-left-color: #dde1ee; }
body.theme-light .d-lbl { color: #7880a0; }
body.theme-light .d-val { color: #1e2235; }
body.theme-light .d-row { border-bottom-color: #eef0f8; }
body.theme-light .d-name { color: #1e2235; }
body.theme-light .d-total-box { background: #f0f2f8; border: 1px solid #dde1ee; border-radius: 10px; padding: 12px 14px; }
body.theme-light .d-total-lbl { color: #7880a0; }
body.theme-light .drawer-tabs { border-bottom-color: #dde1ee; }
body.theme-light .drawer-tab { color: #7880a0; }
body.theme-light .cost-bar { background: #dde1ee; border-color: #dde1ee; }

body.theme-light .btn-outline { border-color: #dde1ee; color: #7880a0; }
body.theme-light .btn-outline:hover { border-color: #3b82f6; color: #3b82f6; }
body.theme-light .btn-ico { color: #7880a0; }
body.theme-light .btn-ico:hover { border-color: #dde1ee; color: #1e2235; }

body.theme-light .pagination { background: #f0f2f8; border-top-color: #dde1ee; }
body.theme-light .pbn { border-color: #dde1ee; color: #7880a0; background: #ffffff; }
body.theme-light .pbn:hover { border-color: #3b82f6; color: #3b82f6; }
body.theme-light .p-info { color: #7880a0; }

body.theme-light .tree-area { background: #f0f2f8; }
body.theme-light .tree-ca { background: #ffffff; border-color: rgba(59,130,246,.2); }
body.theme-light .tree-ca-header:hover { background: rgba(59,130,246,.04); }
body.theme-light .tree-ca-nome { color: #1e2235; }
body.theme-light .tree-ca-sub { color: #7880a0; }
body.theme-light .tree-count-pill { background: #f0f2f8; border-color: #dde1ee; color: #7880a0; }
body.theme-light .tree-count-pill strong { color: #1e2235; }
body.theme-light .tree-l { background: rgba(59,130,246,.04); border-color: rgba(59,130,246,.15); }
body.theme-light .tree-l-nome { color: #1e2235; }
body.theme-light .tree-l-sub { color: #7880a0; }
body.theme-light .tree-m { background: rgba(34,197,94,.04); border-color: rgba(34,197,94,.12); }
body.theme-light .tree-m-nome { color: #1e2235; }
body.theme-light .tree-m-bairro { color: #7880a0; }
body.theme-light .tree-orphans { background: #ffffff; border-color: #dde1ee; }
body.theme-light .tree-orphans-header h4 { color: #7880a0; }
body.theme-light .orphan-name { color: #1e2235; }
body.theme-light .orphan-bairro { color: #7880a0; }
body.theme-light .orphan-item { border-bottom-color: #eef0f8; }
body.theme-light .tree-header h3 { color: #1e2235; }
body.theme-light .tree-search { background: #ffffff; border-color: #dde1ee; color: #1e2235; }
body.theme-light .tree-stat { background: #ffffff; border-color: #dde1ee; color: #7880a0; }
body.theme-light .tree-stat strong { color: #1e2235; }

body.theme-light .map-legend { background: #ffffff; border-color: #dde1ee; }
body.theme-light .map-legend h4 { color: #7880a0; }
body.theme-light .legend-item { color: #1e2235; }

/* DASHBOARD — tema claro */
body.theme-light .dashboard-area { background: #f0f2f8; }
body.theme-light .dashboard-card,
body.theme-light .dashboard-panel { background: #ffffff; border-color: #dde1ee; box-shadow: 0 1px 3px rgba(16,24,64,.05); }
body.theme-light .dashboard-card-label { color: #7880a0; }
body.theme-light .dashboard-card-value { color: #1e2235; }
body.theme-light .dashboard-card-sub { color: #7880a0; }
body.theme-light .dashboard-kicker { color: #7880a0; }
body.theme-light .dashboard-header h3 { color: #1e2235; }
body.theme-light .dashboard-panel h4 { color: #1e2235; }
body.theme-light .dash-bar-label { color: #7880a0; }
body.theme-light .dash-bar-value { color: #1e2235; }
body.theme-light .dash-bar-track { background: #eef0f8; }
body.theme-light .dash-empty { color: #7880a0; }

body.theme-light .zone-title h2 { color: #1e2235; }
body.theme-light .zone-badge { border: 2px solid rgba(0,0,0,.1); }
body.theme-light .pill { background: #f0f2f8; border-color: #dde1ee; color: #7880a0; }
body.theme-light .pill strong { color: #1e2235; }
body.theme-light .user-email { color: #7880a0; }
body.theme-light .btn-logout { border-color: #dde1ee; color: #7880a0; }
body.theme-light .btn-logout:hover { border-color: #3b82f6; color: #3b82f6; }
body.theme-light .btn-map-toggle, body.theme-light .btn-tree-toggle { background: #f0f2f8; border-color: #dde1ee; color: #7880a0; }
body.theme-light .mob-menu-btn { background: #f0f2f8; border-color: #dde1ee; color: #1e2235; }

body.theme-light .login-screen { background: #f0f2f8; }
body.theme-light .login-box { background: #ffffff; border-color: #dde1ee; }
body.theme-light .login-logo h1 { color: #1e2235; }
body.theme-light .login-logo p { color: #7880a0; }
body.theme-light .login-field label { color: #7880a0; }
body.theme-light .login-field input { background: #f0f2f8; border-color: #dde1ee; color: #1e2235; }
body.theme-light .login-footer { color: #7880a0; }

body.theme-light .toast { background: #ffffff; }
body.theme-light .reuniao-item { background: #f0f2f8; border-color: #dde1ee; }
body.theme-light .reuniao-item-obs { color: #1e2235; }
body.theme-light .mini-modal { background: #f0f2f8; border-color: #dde1ee; }
body.theme-light .mini-modal input, body.theme-light .mini-modal textarea, body.theme-light .mini-modal select { background: #ffffff; border-color: #dde1ee; color: #1e2235; }
body.theme-light .btn-add-sm { background: rgba(255,255,255,.8); border-color: #dde1ee; color: #7880a0; }
body.theme-light .drawer-tab-content { color: #1e2235; }

/* ============================================================
   STATUS / REUNIÃO / PAGAMENTOS
   ============================================================ */

.status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 10px;
  font-size: .65rem; font-weight: 700;
  font-family: 'DM Sans', sans-serif; text-transform: uppercase;
  letter-spacing: .04em;
}

.status-ativo    { background: rgba(34,197,94,.15);  color: #4ade80; border: 1px solid rgba(34,197,94,.3); }
.status-inativo  { background: rgba(239,68,68,.12);  color: #f87171; border: 1px solid rgba(239,68,68,.3); }
.status-pendente { background: rgba(234,179,8,.13);  color: #facc15; border: 1px solid rgba(234,179,8,.3); }

.reuniao-badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 8px; border-radius: 10px; font-size: .65rem;
}

.reuniao-sim { background: rgba(34,197,94,.1); color: #4ade80; border: 1px solid rgba(34,197,94,.25); }
.reuniao-nao { background: rgba(107,114,148,.1); color: var(--muted); border: 1px solid var(--border); }

/* Aba de detalhes no drawer */
.drawer-tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px; margin-top: 12px;
}

.drawer-tab {
  flex: 1; padding: 8px 4px;
  text-align: center; font-size: .72rem;
  font-weight: 500; color: var(--muted);
  cursor: pointer; border-bottom: 2px solid transparent;
  transition: all .15s;
}

.drawer-tab.active { color: #3b82f6; border-bottom-color: #3b82f6; }

.drawer-tab-content { display: none; }
.drawer-tab-content.active { display: block; }

/* Histórico de pagamentos */
.pag-mes {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid rgba(37,42,64,.6);
  font-size: .8rem;
}

.pag-mes:last-child { border-bottom: none; }
.pag-mes-nome { color: var(--muted); font-size: .72rem; }
.pag-mes-valor { font-weight: 600; }
.pag-mes-status { font-size: .68rem; padding: 2px 7px; border-radius: 8px; }
.pag-pago   { background: rgba(34,197,94,.12); color: #4ade80; }
.pag-aberto { background: rgba(234,179,8,.12); color: #facc15; }

/* Reuniões no drawer */
.reuniao-item {
  background: var(--bg); border-radius: 8px;
  padding: 10px 12px; margin-bottom: 8px;
  border: 1px solid var(--border);
}

.reuniao-item-data { font-size: .7rem; color: var(--muted); margin-bottom: 4px; }
.reuniao-item-obs  { font-size: .78rem; color: var(--text); }

.btn-add-sm {
  width: 100%; background: rgba(255,255,255,.04);
  border: 1px dashed var(--border); border-radius: 8px;
  color: var(--muted); cursor: pointer; padding: 8px;
  font-size: .78rem; font-family: 'DM Sans', sans-serif;
  transition: all .15s; margin-top: 6px;
}

.btn-add-sm:hover { border-color: var(--accent, #e8433a); color: var(--accent, #e8433a); }

/* Mini modal de reunião/pagamento */
.mini-modal {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 14px; padding: 16px; margin-top: 10px;
  display: none;
}

.mini-modal.open { display: block; }
.mini-modal label { font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); display: block; margin-bottom: 4px; margin-top: 10px; }
.mini-modal input, .mini-modal textarea, .mini-modal select {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: 7px; color: var(--text); font-family: 'DM Sans', sans-serif;
  font-size: .82rem; padding: 8px 10px; outline: none;
}
.mini-modal textarea { resize: vertical; min-height: 60px; }

/* ============================================================
   MOBILE RESPONSIVO (max-width: 768px)
   ============================================================ */
@media (max-width: 768px) {

  /* Sidebar vira drawer lateral */
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 500;
    width: 280px;
    box-shadow: 4px 0 24px rgba(0,0,0,.6);
  }

  .sidebar.mob-open { transform: translateX(0); }

  /* Overlay para fechar sidebar */
  .mob-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 499;
    backdrop-filter: blur(2px);
  }

  .mob-overlay.active { display: block; }

  /* Main ocupa tudo */
  .main { margin-left: 0; }

  /* Topbar mobile */
  .topbar {
    padding: 0 12px;
    height: 54px;
    gap: 8px;
  }

  .zone-title h2 { font-size: .85rem; }

  .topbar-pills { display: none; }

  /* Hamburguer button */
  .mob-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    font-size: 16px;
    flex-shrink: 0;
  }

  /* Esconde textos na topbar, mantém ícones */
  .topbar-actions { gap: 6px; }

  .btn-tree-toggle,
  .btn-map-toggle { padding: 7px 10px; font-size: .75rem; }

  .btn-import span { display: none; }

  .user-email { display: none; }
  .user-avatar { width: 28px; height: 28px; font-size: .68rem; }


  .controls-bar {
    padding: 8px 12px;
    gap: 8px;
  }

  .search-wrap { min-width: unset; }

  .controls-bar select { flex: 1; font-size: .78rem; padding: 8px 8px; }

  /* Tabela — scroll horizontal, colunas compactas */
  .table-area { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  table { font-size: .75rem; min-width: 700px; }

  th, td { padding: 9px 10px; }

  .nome-td { max-width: 140px; }

  /* Oculta colunas menos importantes no mobile */
  th:nth-child(7),  td:nth-child(7),   /* Jul */
  th:nth-child(8),  td:nth-child(8),   /* Ago */
  th:nth-child(9),  td:nth-child(9),   /* Set */
  th:nth-child(10), td:nth-child(10),  /* Out */
  th:nth-child(4),  td:nth-child(4) {  /* Telefone */
    display: none;
  }

  /* Pagination compacta */
  .pagination { padding: 8px 12px; gap: 4px; flex-wrap: wrap; }
  .pbn { min-width: 30px; height: 30px; font-size: .75rem; }
  .p-info { font-size: .68rem; }

  /* Modal ocupa tela toda */
  .overlay { padding: 0; align-items: flex-end; }

  .modal {
    border-radius: 20px 20px 0 0;
    max-height: 92vh;
    padding: 20px 18px;
  }

  .fgrid { grid-template-columns: 1fr; }
  .full { grid-column: 1; }
  .fsep { grid-column: 1; }

  /* Drawer ocupa tela toda no mobile */
  .drawer { width: 100%; border-left: none; border-top: 1px solid var(--border); }

  /* Mapa mobile */
  .map-legend {
    bottom: 10px; left: 10px;
    padding: 8px 12px;
    font-size: .68rem;
  }

  .map-info-bar { font-size: .7rem; padding: 5px 12px; top: 8px; }

  .map-filter-bar {
    top: 8px;
    max-width: calc(100vw - 24px);
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-radius: 12px;
    padding: 5px 10px;
  }
  .map-filter-bar::-webkit-scrollbar { display: none; }
  .mfb-all { display: none; }

  /* Árvore mobile */
  .tree-area { padding: 12px; }

  .tree-ca-header { padding: 12px 14px; gap: 8px; }
  .tree-ca-avatar { width: 32px; height: 32px; font-size: .9rem; }
  .tree-ca-nome { font-size: .82rem; }
  .tree-ca-counts { flex-wrap: wrap; gap: 4px; }
  .tree-count-pill { font-size: .65rem; padding: 2px 7px; }

  .tree-l-header { padding: 9px 12px; }
  .tree-l { margin-left: 8px; }
  .tree-m { margin-left: 10px; }

  /* Login mobile */
  .login-box { padding: 24px 20px; border-radius: 16px; }

  /* Loading mobile */
  #loading-overlay div:first-child { width: 32px; height: 32px; }
}

/* ── Phones pequenos (< 480px) ── */
@media (max-width: 480px) {
  /* Tabela mais compacta — esconde bairro também */
  table { min-width: 360px; font-size: .72rem; }
  th, td { padding: 8px 8px; }
  th:nth-child(5), td:nth-child(5) { display: none; } /* Bairro */
  .nome-td { max-width: 120px; }

  /* Controls bar empilha busca acima dos filtros */
  .controls-bar { flex-direction: column; align-items: stretch; gap: 7px; padding: 8px 10px; }
  .search-wrap { min-width: unset; width: 100%; }
  .controls-bar select { width: 100%; }

  /* Strip cards menores */
  .strip-card { min-width: 90px; padding: 8px 10px; }
  .strip-value { font-size: 1.4rem; }

  /* Topbar ainda mais compacta */
  .topbar { height: 48px; padding: 0 8px; }
  .zone-title h2 { font-size: .78rem; }
  .btn-tree-toggle, .btn-map-toggle { font-size: .7rem; padding: 5px 8px; }

  /* Modal tela cheia */
  .modal { border-radius: 0; max-height: 100vh; padding: 16px 14px; }
}

/* Hamburguer só aparece no mobile */
.mz-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 7px;
  cursor: pointer;
  font-size: .78rem;
  color: var(--text);
  transition: background .15s;
  user-select: none;
}

.mz-item:hover { background: rgba(255,255,255,.05); }
body.theme-light .mz-item:hover { background: rgba(0,0,0,.04); }

.mz-item input[type="checkbox"] {
  accent-color: #3b82f6;
  width: 14px; height: 14px;
  flex-shrink: 0;
}

.nav-coord-sub {
  font-size: .7rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.nav-coord-item { align-items: center; padding-left: 4px; }

/* Grupo de região collapsível */
.nav-region-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 16px;
  cursor: pointer;
  border-radius: 8px;
  user-select: none;
  transition: background .15s;
}
.nav-region-header:hover { background: rgba(255,255,255,.06); }
.nav-region-label { flex: 1; font-size: .82rem; font-weight: 600; color: var(--text); }
.nav-region-arrow { font-size: .65rem; color: var(--muted); transition: transform .2s; margin-left: 2px; }

/* Sub-itens da região */
.nav-region-children { display: none; overflow: hidden; }
.nav-region-children.open { display: block; }

/* Linha lateral colorida nos sub-itens */
.nav-coord-indicator {
  width: 2px;
  height: 28px;
  border-radius: 2px;
  flex-shrink: 0;
  margin-right: 6px;
}

/* Item "Norte · total" */
.nav-region-total {
  align-items: center;
  padding-left: 4px;
  margin-bottom: 4px;
  opacity: .7;
}
.nav-region-total:hover { opacity: 1; }

.mob-menu-btn { display: none; }

@media (max-width: 768px) {
  .mob-menu-btn { display: flex; }
}

/* ===== MODAL GERENCIAR USUÁRIOS ===== */
.nu-modal {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 94vw;
  max-width: 520px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,.4);
}

.nu-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.nu-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px 22px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.nu-modal-body::-webkit-scrollbar { width: 3px; }
.nu-modal-body::-webkit-scrollbar-track { background: transparent; }
.nu-modal-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.nu-modal-body::-webkit-scrollbar-thumb:hover { background: var(--muted); }

.nu-section {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.nu-section-summary {
  list-style: none;
  padding: 11px 14px;
  font-size: .875rem;
  font-weight: 600;
  color: var(--accent2);
  cursor: pointer;
  user-select: none;
}

.nu-section-summary::-webkit-details-marker { display: none; }
.nu-section[open] .nu-section-summary { border-bottom: 1px solid var(--border); }

.nu-create-form {
  padding: 14px;
}

.nu-user-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 6px;
  font-size: .84rem;
  transition: background .15s;
}

.nu-user-row:hover { background: rgba(255,255,255,.03); }

.nu-user-name { font-weight: 600; color: var(--text); }
.nu-user-sub { font-size: .75rem; color: var(--muted); margin-top: 2px; }

.nu-edit-panel {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 8px;
}

.nu-edit-panel h4 {
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 12px;
}

.nu-badge-role {
  font-size: .68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.nu-badge-admin { background: rgba(59,130,246,.15); color: #60a5fa; border: 1px solid rgba(59,130,246,.3); }
.nu-badge-regional { background: rgba(34,197,94,.12); color: #4ade80; border: 1px solid rgba(34,197,94,.3); }
