:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #eef3f8;
  --border: #d7e0ea;
  --accent: #2563eb;
  --green: #16a34a;
  --yellow: #d97706;
  --red: #dc2626;
  --purple: #7c3aed;
  --text: #172033;
  --muted: #516174;
  --faint: #718096;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.cidadeviva-body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

.topbar {
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex: 0 0 auto;
  gap: 12px;
  justify-content: space-between;
  min-height: 62px;
  padding: 10px 16px;
  position: relative;
  z-index: 1000;
}

.logo {
  color: var(--text);
  font-size: 1.12rem;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.logo span {
  color: var(--accent);
}

.tabs {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  gap: 4px;
  padding: 3px;
}

.tab {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--faint);
  font-size: 0.78rem;
  font-weight: 700;
  min-height: 30px;
  padding: 0 12px;
  white-space: nowrap;
}

.tab.active {
  background: var(--accent);
  color: #fff;
}

.topbar-right {
  align-items: center;
  display: flex;
  flex-shrink: 0;
  gap: 8px;
}

.session-chip {
  border-right: 1px solid var(--border);
  display: grid;
  gap: 2px;
  max-width: 220px;
  padding-right: 10px;
}

.session-chip span {
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-chip small {
  color: var(--faint);
  font-size: 0.68rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  background: var(--red);
  border-radius: 999px;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 3px 8px;
  white-space: nowrap;
}

.btn-add,
.btn-ghost,
.btn-submit,
.btn-cancel,
.tool-button,
.google-button,
.icon-button {
  border-radius: 8px;
  min-height: 36px;
}

.btn-add {
  background: var(--accent);
  border: 0;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 0 14px;
  white-space: nowrap;
}

.btn-add:hover,
.btn-submit:hover {
  background: #2563eb;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0 12px;
}

.nav-link {
  align-items: center;
  display: inline-flex;
  justify-content: center;
  text-decoration: none;
}

.admin-secret-link {
  align-items: center;
  border: 0;
  color: var(--faint);
  display: inline-flex;
  font-size: 1.05rem;
  height: 24px;
  justify-content: center;
  min-height: 24px;
  opacity: 0.16;
  text-decoration: none;
  width: 18px;
}

.admin-secret-link:hover,
.admin-secret-link:focus-visible {
  opacity: 0.58;
}

.main {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex: 0 0 320px;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.sidebar-header {
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 6px;
  padding: 16px 16px 12px;
}

.sidebar-header h1 {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  margin: 0;
  text-transform: uppercase;
}

.sidebar-header p {
  color: var(--faint);
  font-size: 0.78rem;
  line-height: 1.4;
  margin: 0;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 16px;
}

.chip {
  border: 1.5px solid transparent;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  min-height: 28px;
  padding: 0 10px;
  transition: opacity 0.15s, transform 0.15s;
}

.chip:not(.active) {
  opacity: 0.55;
}

.chip:hover {
  transform: translateY(-1px);
}

.chip.all {
  background: #dbeafe;
  border-color: var(--accent);
  color: #1d4ed8;
}

.chip.prob {
  background: #dbeafe;
  border-color: var(--accent);
  color: #1d4ed8;
}

.chip.vaga {
  background: #dcfce7;
  border-color: var(--green);
  color: #166534;
}

.chip.produto {
  background: #fef3c7;
  border-color: var(--yellow);
  color: #92400e;
}

.chip.grave {
  background: #fee2e2;
  border-color: var(--red);
  color: #991b1b;
}

.chip.mutirao {
  background: #ede9fe;
  border-color: var(--purple);
  color: #6d28d9;
}

.feed {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 12px 14px;
}

.feed::-webkit-scrollbar {
  width: 4px;
}

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

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  display: grid;
  gap: 7px;
  padding: 12px;
  text-align: left;
  transition: border-color 0.15s, transform 0.15s;
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.card.highlighted {
  border-color: #f59e0b;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.22), 0 10px 24px rgba(245, 158, 11, 0.08);
}

.highlight-badge {
  background: #fef3c7;
  border-radius: 6px;
  color: #92400e;
  font-size: 0.65rem;
  font-weight: 900;
  padding: 5px 7px;
  text-transform: uppercase;
}

.highlight-action {
  background: transparent;
  border: 1px solid #f59e0b;
  border-radius: 7px;
  color: #b45309;
  font-size: 0.7rem;
  font-weight: 800;
  min-height: 32px;
  padding: 5px 9px;
}

.card-top {
  align-items: flex-start;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: flex-end;
}

.card-title {
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.25;
}

.card-tag,
.dias-badge {
  border-radius: 6px;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1;
  padding: 5px 7px;
  text-transform: uppercase;
  white-space: nowrap;
}

.tag-prob {
  background: #dbeafe;
  color: #1d4ed8;
}

.tag-vaga {
  background: #dcfce7;
  color: #166534;
}

.tag-produto {
  background: #fef3c7;
  color: #92400e;
}

.tag-grave {
  background: #fee2e2;
  color: #991b1b;
}

.tag-mutirao {
  background: #ede9fe;
  color: #6d28d9;
}

.card-meta,
.upvotes {
  color: var(--faint);
  font-size: 0.72rem;
}

.card-desc {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.42;
}

.card-footer {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.exposure-period {
  color: #1d4ed8;
  font-size: 0.72rem;
  font-weight: 700;
}

.dias-ok {
  background: #dcfce7;
  color: #166534;
}

.dias-warn {
  background: #fef3c7;
  color: #92400e;
}

.dias-crit {
  background: #fee2e2;
  color: #991b1b;
}

.map-wrap {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  position: relative;
}

#map {
  background: #e8eef5;
  height: 100%;
  width: 100%;
}

.leaflet-container {
  background: #e8eef5;
}

.leaflet-top,
.leaflet-bottom {
  z-index: 700;
}

.metrics-overlay {
  display: grid;
  gap: 8px;
  pointer-events: none;
  position: absolute;
  right: 12px;
  top: 12px;
  width: min(180px, calc(100% - 24px));
  z-index: 900;
}

.metric-box {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.14);
  display: grid;
  gap: 2px;
  padding: 10px 14px;
  pointer-events: auto;
}

.metric-label {
  color: var(--faint);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.metric-value {
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1;
}

.mv-red {
  color: var(--red);
}

.mv-yellow {
  color: var(--yellow);
}

.mv-green {
  color: var(--green);
}

.mv-purple {
  color: var(--purple);
}

.panel-metrics {
  background: var(--surface);
  display: none;
  flex: 1 1 auto;
  gap: 12px;
  overflow-y: auto;
  padding: 16px;
}

.panel-metrics.active {
  display: grid;
}

.metrics-title {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.bairro-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 14px;
}

.bairro-header {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.bairro-name {
  font-size: 0.94rem;
  font-weight: 900;
}

.score-pill {
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 900;
  padding: 4px 10px;
  white-space: nowrap;
}

.score-a {
  background: #dcfce7;
  color: #166534;
}

.score-b {
  background: #ecfccb;
  color: #3f6212;
}

.score-c {
  background: #fef3c7;
  color: #92400e;
}

.score-d {
  background: #fee2e2;
  color: #991b1b;
}

.progress-bar {
  background: var(--border);
  border-radius: 4px;
  height: 7px;
  overflow: hidden;
}

.progress-fill {
  border-radius: 4px;
  height: 100%;
}

.bairro-stats {
  color: var(--faint);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 0.74rem;
}

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

.modal-overlay {
  align-items: center;
  background: rgba(15, 23, 42, 0.45);
  display: none;
  inset: 0;
  justify-content: center;
  padding: 16px;
  position: fixed;
  z-index: 2000;
}

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

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 92dvh;
  max-width: 460px;
  overflow-y: auto;
  padding: 22px;
  position: relative;
  width: 100%;
}

.modal h2 {
  font-size: 1.1rem;
  margin: 0 0 16px;
}

.btn-close-modal {
  background: transparent;
  border: 0;
  color: var(--faint);
  font-size: 1.1rem;
  font-weight: 900;
  height: 34px;
  line-height: 1;
  position: absolute;
  right: 12px;
  top: 10px;
  width: 34px;
}

.form-group {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.form-group > span {
  color: var(--faint);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.form-hint {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.form-group input,
.form-group select,
.form-group textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  outline: 0;
  padding: 10px 12px;
  width: 100%;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
}

.form-group textarea {
  min-height: 88px;
  resize: vertical;
}

.location-picker {
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.18);
  border-radius: 8px;
  padding: 10px;
}

.location-status {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.location-actions {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.btn-map-pick,
.btn-use-center {
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 900;
  min-height: 38px;
  padding: 0 10px;
}

.btn-map-pick {
  background: var(--accent);
  border: 0;
  color: #fff;
}

.btn-use-center {
  background: var(--bg);
  border: 1.5px solid var(--border);
  color: var(--muted);
}

.severity-row {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.sev-btn {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--faint);
  font-size: 0.74rem;
  font-weight: 900;
  min-height: 38px;
}

.sev-btn.sel-low {
  background: #dcfce7;
  border-color: var(--green);
  color: #166534;
}

.sev-btn.sel-med {
  background: #fef3c7;
  border-color: var(--yellow);
  color: #92400e;
}

.sev-btn.sel-high {
  background: #fee2e2;
  border-color: var(--red);
  color: #991b1b;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.btn-cancel {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--muted);
  flex: 1;
  font-weight: 800;
  padding: 0 12px;
}

.btn-submit {
  background: var(--accent);
  border: 0;
  color: #fff;
  flex: 2;
  font-weight: 900;
  padding: 0 14px;
}

.toast {
  background: #eff6ff;
  border: 1px solid var(--accent);
  border-radius: 8px;
  bottom: 22px;
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 800;
  left: 50%;
  max-width: calc(100vw - 24px);
  opacity: 0;
  padding: 12px 18px;
  position: fixed;
  transform: translateX(-50%) translateY(18px);
  transition: opacity 0.2s, transform 0.2s;
  white-space: nowrap;
  z-index: 3000;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.admin-body {
  background: var(--bg);
  min-height: 100dvh;
}

.admin-nav {
  display: flex;
  gap: 8px;
}

.admin-shell {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  margin: 0 auto;
  max-width: 1120px;
  padding: 18px;
}

.admin-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
}

.admin-heading {
  align-items: flex-start;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.admin-heading h1,
.admin-help h2 {
  font-size: 1.1rem;
  margin: 0 0 6px;
}

.admin-heading p,
.admin-help p {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
  margin: 0;
}

.admin-badge {
  background: #dbeafe;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: #1d4ed8;
  flex: 0 0 auto;
  font-size: 0.68rem;
  font-weight: 900;
  padding: 4px 8px;
  text-transform: uppercase;
}

.admin-form {
  display: grid;
  gap: 16px;
}

.admin-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-wide {
  grid-column: 1 / -1;
}

.admin-requests-panel {
  grid-column: 1 / -1;
}

.highlight-request-list {
  display: grid;
  gap: 10px;
}

.highlight-request-card {
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 12px;
}

.highlight-request-card strong,
.highlight-request-card small {
  display: block;
}

.highlight-request-card small,
.empty-state {
  color: var(--faint);
  font-size: 0.74rem;
}

.highlight-approve {
  background: #166534;
  border: 0;
  border-radius: 8px;
  color: #dcfce7;
  font-weight: 800;
  min-height: 36px;
  padding: 0 12px;
}

.public-building-admin-map {
  background: #e8eef5;
  border: 1px solid var(--border);
  border-radius: 8px;
  height: 360px;
  margin-top: 4px;
  overflow: hidden;
  width: 100%;
}

.public-building-preview {
  border: 1px solid var(--border);
  border-radius: 8px;
  display: block;
  max-height: 260px;
  object-fit: cover;
  width: min(100%, 420px);
}

.public-building-list {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.public-building-admin-card {
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  padding: 10px;
}

.public-building-admin-card img,
.public-building-image-placeholder {
  align-items: center;
  background: color-mix(in srgb, var(--public-building-color, #475569) 14%, white);
  border-radius: 7px;
  color: var(--public-building-color, #475569);
  display: flex;
  font-size: 1.2rem;
  font-weight: 900;
  height: 58px;
  justify-content: center;
  object-fit: cover;
  width: 72px;
}

.public-building-image-placeholder svg {
  height: 30px;
  width: 30px;
}

.public-building-admin-card strong,
.public-building-admin-card small {
  display: block;
}

.public-building-admin-card small {
  color: var(--faint);
  margin-top: 3px;
}

.public-building-edit {
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: var(--accent);
  font-weight: 800;
  min-height: 36px;
  padding: 0 12px;
}

.marker-public-building {
  align-items: center;
  background: var(--public-building-color, #475569);
  border: 3px solid #ffffff;
  border-radius: 50% 50% 50% 8px;
  box-shadow: 0 5px 14px rgba(15, 23, 42, 0.34);
  color: #ffffff;
  display: flex;
  height: 36px;
  justify-content: center;
  transform: rotate(-45deg);
  transition: filter 140ms ease, transform 140ms ease;
  width: 36px;
}

.marker-public-building span {
  align-items: center;
  display: flex;
  height: 21px;
  justify-content: center;
  transform: rotate(45deg);
  width: 21px;
}

.marker-public-building svg,
.public-building-image-placeholder svg {
  fill: none;
  height: 100%;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
  width: 100%;
}

.marker-public-building:hover {
  filter: brightness(1.08);
  transform: rotate(-45deg) scale(1.08);
}

.public-building-visual--administracao {
  --public-building-color: #7c3aed;
}

.public-building-visual--saude {
  --public-building-color: #0284c7;
}

.public-building-visual--educacao {
  --public-building-color: #ca8a04;
}

.public-building-visual--seguranca {
  --public-building-color: #1d4ed8;
}

.public-building-visual--bombeiros {
  --public-building-color: #dc2626;
}

.public-building-visual--assistencia {
  --public-building-color: #059669;
}

.public-building-visual--cultura {
  --public-building-color: #ea580c;
}

.public-building-visual--esporte {
  --public-building-color: #16a34a;
}

.public-building-visual--outro {
  --public-building-color: #475569;
}

.public-building-popup-image {
  border-radius: 7px;
  height: 120px;
  object-fit: cover;
  width: 100%;
}

.public-building-popup-status {
  color: #0f766e;
  font-size: 0.72rem;
  font-weight: 800;
}

.public-building-phone {
  color: #0369a1;
  font-size: 0.8rem;
  font-weight: 800;
  text-decoration: none;
}

.public-building-phone:hover {
  text-decoration: underline;
}

.admin-toggle {
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  gap: 12px;
  padding: 12px;
}

.admin-toggle input {
  height: 18px;
  width: 18px;
}

.admin-toggle span {
  display: grid;
  gap: 2px;
}

.admin-toggle strong {
  font-size: 0.84rem;
}

.admin-toggle small {
  color: var(--faint);
  font-size: 0.74rem;
}

.admin-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.assistant-admin-control {
  align-items: center;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 12px;
}

.assistant-admin-control div {
  display: grid;
  gap: 3px;
}

.assistant-admin-control small {
  color: var(--faint);
}

.assistant-admin-control button.is-connected {
  border-color: #dc2626;
  color: #b91c1c;
}

.assistant-launcher[hidden] {
  display: none;
}

.admin-actions .btn-cancel,
.admin-actions .btn-submit {
  flex: 0 0 auto;
  min-width: 150px;
}

.admin-help {
  align-self: start;
  display: grid;
  gap: 12px;
}

.admin-map-link {
  align-items: center;
  display: inline-flex;
  justify-content: center;
  text-decoration: none;
}

.civic-marker {
  align-items: center;
  border: 3px solid #ffffff;
  border-radius: 50% 50% 50% 8px;
  box-shadow: 0 5px 14px rgba(15, 23, 42, 0.34);
  color: #fff;
  display: flex;
  height: 36px;
  justify-content: center;
  transform: rotate(-45deg);
  transition: filter 140ms ease, transform 140ms ease;
  width: 36px;
}

.civic-marker span {
  align-items: center;
  display: flex;
  height: 21px;
  justify-content: center;
  transform: rotate(45deg);
  width: 21px;
}

.civic-marker svg {
  fill: none;
  height: 100%;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
  width: 100%;
}

.civic-marker:hover {
  filter: brightness(1.08);
  transform: rotate(-45deg) scale(1.08);
}

.marker-prob {
  background: var(--accent);
}

.marker-vaga {
  background: var(--green);
}

.marker-produto {
  background: var(--yellow);
  color: #1f2937;
}

.marker-grave {
  background: var(--red);
}

.marker-mutirao {
  background: var(--purple);
}

.marker-draft {
  background: #38bdf8;
  height: 36px;
  width: 36px;
}

.dark-popup .leaflet-popup-content-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
}

.dark-popup .leaflet-popup-tip {
  background: var(--surface);
}

.popup-card {
  display: grid;
  gap: 7px;
  min-width: 190px;
}

.popup-title {
  font-weight: 900;
}

.popup-meta,
.popup-desc,
.popup-foot {
  color: var(--muted);
  font-size: 0.78rem;
}

.popup-desc {
  color: #334155;
  line-height: 1.35;
}

.popup-foot {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.donation-overlay {
  z-index: 2100;
}

.donation-modal {
  max-width: 420px;
}

.donation-message {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
  margin: 0 0 18px;
}

.donation-options {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 14px;
}

.donation-value {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-weight: 800;
  min-height: 42px;
}

.donation-value.active {
  background: #dbeafe;
  border-color: #3b82f6;
  color: #1d4ed8;
}

.pix-key-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 6px;
  margin-top: 14px;
  padding: 12px;
}

.pix-key-box span {
  color: var(--faint);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.pix-key-box code {
  color: #1d4ed8;
  overflow-wrap: anywhere;
}

.pix-key-box strong {
  color: var(--text);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.highlight-instructions {
  display: block;
  margin-top: 12px;
}

.sr-only {
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.assistant-launcher {
  align-items: center;
  background: #166534;
  border: 0;
  border-radius: 999px;
  bottom: 22px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.24);
  color: #fff;
  display: inline-flex;
  font-weight: 900;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  position: fixed;
  right: 22px;
  z-index: 1800;
}

.assistant-launcher span {
  color: #bbf7d0;
  font-size: 1.15rem;
}

.assistant-panel {
  background: #fff;
  border: 1px solid #dbe4dc;
  border-radius: 14px;
  bottom: 82px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.28);
  display: grid;
  grid-template-rows: auto minmax(180px, 1fr) auto auto auto;
  max-height: min(640px, calc(100vh - 110px));
  overflow: hidden;
  position: fixed;
  right: 22px;
  width: min(390px, calc(100vw - 28px));
  z-index: 1850;
}

.assistant-panel[hidden] {
  display: none;
}

.assistant-header {
  align-items: center;
  background: #14532d;
  color: #fff;
  display: flex;
  justify-content: space-between;
  padding: 14px 16px;
}

.assistant-header div {
  display: grid;
  gap: 2px;
}

.assistant-header small {
  color: #bbf7d0;
  font-size: 0.72rem;
}

.assistant-header button {
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  padding: 2px 6px;
}

.assistant-messages {
  background: #f8faf8;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 14px;
}

.assistant-message {
  border-radius: 10px;
  font-size: 0.86rem;
  line-height: 1.45;
  max-width: 88%;
  overflow-wrap: anywhere;
  padding: 10px 12px;
  white-space: pre-wrap;
}

.assistant-message-bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #dbe4dc;
  color: #26342b;
}

.assistant-message-user {
  align-self: flex-end;
  background: #166534;
  color: #fff;
}

.assistant-message-status {
  color: #64748b;
  font-style: italic;
}

.assistant-suggestions {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 12px 0;
}

.assistant-suggestions button {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  color: #166534;
  flex: 0 0 auto;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 7px 9px;
}

.assistant-form {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto;
  padding: 10px 12px;
}

.assistant-form textarea {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #17211b;
  font: inherit;
  max-height: 120px;
  min-height: 44px;
  padding: 10px;
  resize: vertical;
}

.assistant-form button {
  align-self: stretch;
  background: #166534;
  border: 0;
  border-radius: 8px;
  color: #fff;
  font-weight: 900;
  padding: 0 14px;
}

.assistant-form button:disabled,
.assistant-suggestions button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.assistant-privacy {
  border-top: 1px solid #e2e8f0;
  color: #64748b;
  font-size: 0.66rem;
  line-height: 1.35;
  margin: 0;
  padding: 8px 12px;
}

.launch-body {
  align-items: center;
  background: #f6f7f4;
  color: #19201c;
  display: grid;
  min-height: 100vh;
  padding: 24px;
}

.launch-shell {
  display: grid;
  place-items: center;
}

.launch-panel {
  display: grid;
  gap: 24px;
  max-width: 420px;
  text-align: center;
  width: 100%;
}

.launch-logo {
  background: #fff;
  border: 1px solid #d9dfd7;
  border-radius: 8px;
  display: grid;
  height: 86px;
  justify-self: center;
  place-items: center;
  width: 86px;
}

.launch-logo span {
  background:
    linear-gradient(90deg, transparent 47%, rgba(255, 255, 255, 0.9) 47% 53%, transparent 53%),
    linear-gradient(0deg, transparent 47%, rgba(255, 255, 255, 0.9) 47% 53%, transparent 53%),
    linear-gradient(135deg, #22c55e, #3b82f6);
  border-radius: 8px;
  display: block;
  height: 52px;
  width: 52px;
}

.launch-copy {
  display: grid;
  gap: 10px;
}

.launch-copy h1,
.launch-copy p {
  margin: 0;
}

.launch-copy h1 {
  font-size: 2rem;
}

.launch-copy p,
.auth-message {
  color: #65716a;
}

.google-button {
  align-items: center;
  background: #fff;
  border: 1px solid #d9dfd7;
  color: #19201c;
  display: inline-flex;
  font-weight: 800;
  gap: 12px;
  height: 52px;
  justify-content: center;
  padding: 0 18px;
  width: 100%;
}

.google-button svg {
  flex: 0 0 auto;
  height: 22px;
  width: 22px;
}

.auth-message {
  font-size: 0.9rem;
  min-height: 1.4em;
}

@media (max-width: 940px) {
  .topbar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .tabs {
    order: 3;
    width: 100%;
  }

  .tab {
    flex: 1;
  }

  .session-chip {
    display: none;
  }

  .sidebar {
    flex-basis: 292px;
  }

  .admin-shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .cidadeviva-body {
    overflow: auto;
  }

  .topbar {
    position: sticky;
    top: 0;
  }

  .main {
    display: grid;
    grid-template-rows: minmax(430px, 58vh) auto;
    overflow: visible;
  }

  .map-wrap {
    min-height: 430px;
    order: 1;
  }

  .sidebar {
    border-right: 0;
    flex: none;
    max-height: none;
    order: 2;
  }

  .metrics-overlay {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    left: 12px;
    right: 12px;
    top: 12px;
    width: auto;
  }

  .metric-box {
    padding: 8px 10px;
  }

  .metric-value {
    font-size: 1.12rem;
  }

  .panel-metrics.active {
    min-height: 100vh;
  }

  .badge {
    display: none;
  }

  .admin-shell {
    padding: 12px;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .admin-heading,
  .admin-actions {
    display: grid;
  }

  .admin-actions .btn-cancel,
  .admin-actions .btn-submit {
    width: 100%;
  }

  .public-building-admin-card {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .public-building-admin-card img,
  .public-building-image-placeholder {
    width: 58px;
  }

  .public-building-edit {
    grid-column: 1 / -1;
    width: 100%;
  }

  .assistant-launcher {
    bottom: 14px;
    right: 14px;
  }

  .assistant-panel {
    bottom: 72px;
    max-height: calc(100vh - 88px);
    right: 14px;
  }
}
