:root {
  color-scheme: light;
  --bg: #eef2f3;
  --surface: #ffffff;
  --ink: #17201b;
  --muted: #66736c;
  --line: #d8e1de;
  --green: #08795f;
  --blue: #1f6fb2;
  --red: #c0453e;
  --gold: #8b6f1d;
  --shadow: 0 18px 42px rgba(23, 32, 27, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(760px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 0 16px 8px;
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 10px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 18px 0 12px;
  background: rgba(238, 242, 243, 0.92);
  backdrop-filter: blur(14px);
}

.brand-title {
  display: block;
  padding-left: 4px;
  color: inherit;
  text-decoration: none;
}

.brand-title:focus-visible {
  border-radius: 6px;
  outline: 3px solid rgba(8, 121, 95, 0.2);
  outline-offset: 4px;
}

.hamburger-button {
  width: 42px;
  height: 42px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 20px rgba(23, 32, 27, 0.06);
  cursor: pointer;
}

.hamburger-button span {
  width: 18px;
  height: 2px;
  display: block;
  border-radius: 999px;
  background: var(--ink);
}

.hamburger-button[aria-expanded='true'] {
  border-color: var(--green);
  background: #f3f8f6;
}

.search-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 14px;
}

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

.search-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.search-panel-head h2 {
  font-size: 1.05rem;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 1.8rem;
  line-height: 1;
}

h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
}

.search-form {
  margin-top: 12px;
  display: grid;
  gap: 12px;
}

label span,
legend {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

input[type='search'],
input[type='text'],
input:not([type]),
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 20px,
    calc(100% - 12px) 20px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

input:focus,
select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(8, 121, 95, 0.14);
}

.filters {
  display: grid;
  grid-template-columns: 0.75fr 1fr;
  gap: 12px;
}

.segmented {
  border: 0;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.segmented label {
  display: block;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  min-height: 38px;
  margin: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8faf9;
  color: var(--ink);
  font-size: 0.84rem;
  text-transform: none;
  cursor: pointer;
}

.segmented input:checked + span {
  border-color: var(--green);
  background: var(--green);
  color: #ffffff;
}

.content {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.content[hidden] {
  display: none;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 220px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: 0 8px 20px rgba(23, 32, 27, 0.05);
}

.stat strong {
  display: block;
  font-size: 1.2rem;
  line-height: 1;
}

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

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 2px 0;
}

#contador {
  color: var(--muted);
  font-size: 0.9rem;
}

.status {
  min-height: 22px;
  color: var(--muted);
}

.results {
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  display: grid;
  gap: 12px;
}

.person-card {
  min-height: 150px;
  display: grid;
  gap: 12px;
  min-width: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 12px 26px rgba(23, 32, 27, 0.07);
}

.card-button {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.card-button:focus-visible {
  outline: 3px solid rgba(8, 121, 95, 0.24);
  outline-offset: 4px;
  border-radius: 8px;
}

.card-head {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.avatar {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  object-fit: cover;
  background: #e7ece8;
  border: 3px solid #ffffff;
  box-shadow: 0 0 0 1px var(--line);
}

.avatar-fallback {
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(--blue);
  font-weight: 800;
  font-size: 1.1rem;
}

.person-main {
  min-width: 0;
  max-width: 100%;
}

.person-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.person-name {
  min-width: 0;
  margin: 0 0 4px;
  font-size: 1.12rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.handle {
  color: var(--muted);
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

.view-profile {
  width: fit-content;
  min-height: 32px;
  display: inline-grid;
  align-items: center;
  margin-top: 10px;
  border-radius: 999px;
  background: rgba(8, 121, 95, 0.1);
  color: var(--green);
  padding: 6px 12px;
  font-size: 0.84rem;
  font-weight: 800;
}

.badge {
  min-width: 0;
  max-width: 100%;
  justify-self: end;
  text-align: center;
  border-radius: 999px;
  padding: 5px 8px;
  color: #ffffff;
  background: var(--blue);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.badge.senador {
  background: var(--red);
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  min-width: 0;
}

.meta span {
  min-width: 0;
  max-width: 100%;
  min-height: 30px;
  display: inline-grid;
  align-items: center;
  border-radius: 999px;
  background: #f3f6f5;
  padding: 5px 10px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.table-name {
  color: var(--gold);
  font-weight: 700;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.actions a {
  max-width: 100%;
  min-height: 36px;
  display: inline-grid;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8faf9;
  padding: 7px 12px;
  color: var(--green);
  font-weight: 700;
  text-decoration: none;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.empty {
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.about-page {
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 18px;
}

.about-page[hidden] {
  display: none;
}

.profile-page {
  display: grid;
  gap: 10px;
}

.profile-page[hidden] {
  display: none;
}

.profile-page-content {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 18px;
}

.profile-page-content .profile-hero {
  padding-right: 0;
}

.profile-panel {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
  padding: 14px;
}

.profile-panel[aria-hidden='false'] {
  pointer-events: auto;
  opacity: 1;
}

.profile-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 25, 21, 0.42);
}

.profile-sheet {
  position: relative;
  width: min(760px, calc(100vw - 28px));
  max-height: calc(100dvh - 28px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 -24px 60px rgba(15, 25, 21, 0.22);
  padding: 18px 18px max(28px, env(safe-area-inset-bottom));
  scroll-padding-bottom: 32px;
}

.profile-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #f8faf9;
  color: var(--ink);
  font-size: 1.4rem;
  cursor: pointer;
}

.profile-hero {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 16px;
  align-items: center;
  padding-right: 46px;
}

.profile-photo {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid #ffffff;
  box-shadow: 0 0 0 1px var(--line), 0 12px 24px rgba(23, 32, 27, 0.12);
}

.profile-hero h2 {
  margin: 10px 0 6px;
  font-size: 1.6rem;
}

.profile-hero p {
  margin: 0;
  color: var(--muted);
}

.profile-facts {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-facts span,
.profile-facts a {
  min-height: 34px;
  display: inline-grid;
  align-items: center;
  border-radius: 999px;
  background: #f3f6f5;
  color: var(--green);
  padding: 6px 12px;
  font-weight: 700;
  text-decoration: none;
}

.project-section {
  margin-top: 22px;
  display: grid;
  gap: 12px;
}

.project-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
}

.project-title h3 {
  margin: 0;
  font-size: 1.05rem;
}

.project-title span,
.project-note {
  color: var(--muted);
  font-size: 0.88rem;
}

.project-note {
  margin: 0;
}

.project-total {
  display: flex;
  align-items: baseline;
  gap: 8px;
  border: 1px solid rgba(8, 121, 95, 0.2);
  border-radius: 8px;
  background: rgba(8, 121, 95, 0.08);
  padding: 10px 12px;
}

.project-total strong {
  color: var(--green);
  font-size: 1.3rem;
  line-height: 1;
}

.project-total span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

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

.project-tab {
  min-width: 0;
  min-height: 58px;
  display: grid;
  gap: 2px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
  color: var(--ink);
  padding: 7px 6px;
  cursor: pointer;
}

.project-tab span {
  max-width: 100%;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  overflow-wrap: anywhere;
}

.project-tab.active {
  border-color: var(--green);
  background: rgba(8, 121, 95, 0.1);
}

.project-tab.active span {
  color: var(--green);
}

.project-list {
  display: grid;
  gap: 10px;
  padding-bottom: 10px;
}

.project-list[hidden] {
  display: none;
}

.project-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 12px;
}

.project-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.project-card-head span,
.project-card small {
  color: var(--muted);
}

.project-card p {
  margin: 0;
  line-height: 1.45;
}

.plain-summary {
  display: grid;
  gap: 4px;
  border-left: 3px solid var(--green);
  background: rgba(8, 121, 95, 0.08);
  padding: 9px 10px;
}

.plain-summary span {
  color: var(--green);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.plain-summary p {
  color: var(--ink);
  font-weight: 650;
}

.project-card a {
  color: var(--green);
  font-weight: 800;
  text-decoration: none;
}

.profile-loading,
.profile-error {
  min-height: 280px;
  display: grid;
  place-items: center;
  padding: 42px 12px;
  color: var(--muted);
  text-align: center;
}

.drawer-panel {
  position: fixed;
  inset: 0;
  z-index: 25;
  pointer-events: none;
}

.drawer-panel[aria-hidden='false'] {
  pointer-events: auto;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 25, 21, 0);
  transition: background 0.18s ease;
}

.drawer-panel[aria-hidden='false'] .drawer-backdrop {
  background: rgba(15, 25, 21, 0.38);
}

.drawer {
  position: absolute;
  top: 0;
  right: 0;
  width: min(330px, calc(100vw - 34px));
  height: 100dvh;
  display: grid;
  align-content: start;
  gap: 12px;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -24px 0 60px rgba(15, 25, 21, 0.2);
  padding: 18px 16px max(22px, env(safe-area-inset-bottom));
  transform: translateX(105%);
  transition: transform 0.2s ease;
}

.drawer-panel[aria-hidden='false'] .drawer {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.drawer-head h2 {
  margin: 0;
  font-size: 1.35rem;
}

.drawer-close {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #f8faf9;
  color: var(--ink);
  font-weight: 200;
  cursor: pointer;
}

.drawer-item {
  width: 100%;
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
  color: var(--ink);
  padding: 15px 14px;
  text-align: left;
  cursor: pointer;
}

.drawer-item span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.drawer-item strong {
  font-size: 1rem;
  line-height: 1.25;
}

.drawer-item:hover {
  border-color: var(--green);
}

.about-sheet {
  max-width: 620px;
}

.about-content {
  display: grid;
  gap: 12px;
  padding-right: 46px;
}

.page-about-content {
  padding-right: 0;
}

.about-content h2 {
  margin: 0;
  font-size: 1.6rem;
}

.about-content p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.donation-box {
  display: grid;
  gap: 5px;
  border: 1px solid rgba(8, 121, 95, 0.24);
  border-radius: 8px;
  background: rgba(8, 121, 95, 0.08);
  padding: 12px;
}

.donation-box span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.donation-box strong {
  color: var(--green);
  font-size: 1rem;
}

.donation-box p,
.contact-box p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.donation-box code {
  max-width: 100%;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

.pix-copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.pix-copy-row button {
  min-height: 36px;
  border: 1px solid var(--green);
  border-radius: 8px;
  background: var(--green);
  color: #ffffff;
  padding: 7px 12px;
  font-size: 0.84rem;
  font-weight: 800;
  cursor: pointer;
}

.pix-copy-row button:hover,
.pix-copy-row button:focus-visible {
  background: #066d55;
  outline: none;
}

.contact-box {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
  padding: 12px;
}

.contact-box span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.contact-box a {
  color: var(--green);
  font-weight: 800;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.contact-box a:hover,
.contact-box a:focus-visible {
  text-decoration: underline;
  outline: none;
}

.source-links {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.source-links h3 {
  margin: 0;
  font-size: 1rem;
}

.source-links a {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
  color: var(--ink);
  padding: 12px;
  text-decoration: none;
}

.source-links a:hover,
.source-links a:focus-visible {
  border-color: var(--green);
  outline: none;
}

.source-links span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.source-links strong {
  color: var(--green);
  font-size: 0.98rem;
}

@media (max-width: 820px) {
  .app-shell {
    padding-inline: 14px;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .stats {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

@media (max-width: 520px) {
  .search-panel {
    padding: 10px;
  }

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

  .segmented {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .segmented span {
    min-height: 36px;
    padding-inline: 4px;
    font-size: 0.74rem;
  }

  .person-card {
    padding: 12px;
  }

  .avatar {
    width: 64px;
    height: 64px;
  }

  .card-head {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .person-top {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .badge {
    width: fit-content;
    justify-self: start;
  }

  .profile-sheet {
    max-height: calc(100dvh - 18px);
    padding: 14px 14px max(30px, env(safe-area-inset-bottom));
  }

  .profile-hero {
    grid-template-columns: 76px 1fr;
    padding-right: 42px;
  }

  .profile-photo {
    width: 76px;
    height: 76px;
  }

  .project-title,
  .project-card-head {
    display: grid;
  }

  .project-tabs {
    gap: 6px;
  }

  .project-tab {
    min-height: 58px;
    padding-inline: 4px;
  }

  .project-tab span {
    font-size: 0.62rem;
  }

  .pix-copy-row {
    grid-template-columns: 1fr;
  }
}
