:root {
  --fundef-ink: #081631;
  --fundef-panel: rgba(12, 34, 78, .76);
  --fundef-panel-strong: rgba(15, 42, 94, .92);
  --fundef-blue: #76aaff;
  --fundef-blue-soft: #c9e0ff;
  --fundef-line: rgba(191, 218, 255, .2);
  --fundef-muted: #bbcae3;
  --fundef-ease: cubic-bezier(.16, 1, .3, 1);
}

html { background: var(--fundef-ink); }

body {
  overflow-x: hidden;
  background:
    radial-gradient(circle at 78% 15%, rgba(48, 107, 208, .33), transparent 23rem),
    radial-gradient(circle at 11% 65%, rgba(57, 94, 166, .24), transparent 26rem),
    linear-gradient(135deg, #07152f 0%, #0b2046 48%, #091936 100%) !important;
  color: #f8fbff;
}

body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  width: min(42vw, 580px);
  aspect-ratio: 1;
  border: 1px solid rgba(140, 187, 255, .15);
  border-radius: 50%;
  pointer-events: none;
}

body::before { top: 16%; right: -14%; box-shadow: 0 0 0 60px rgba(108, 164, 255, .025), 0 0 0 120px rgba(108, 164, 255, .018); }
body::after { bottom: -22%; left: -16%; box-shadow: 0 0 0 80px rgba(108, 164, 255, .025); }

.fundef-header {
  position: fixed;
  z-index: 20;
  inset: 0 0 auto;
  border-bottom: 1px solid rgba(220, 234, 255, .12);
  background: linear-gradient(180deg, rgba(5, 17, 40, .88), rgba(5, 17, 40, .45));
  transition: background .3s var(--fundef-ease), box-shadow .3s var(--fundef-ease), backdrop-filter .3s var(--fundef-ease);
}

.fundef-header.is-scrolled {
  background: rgba(5, 17, 40, .88);
  box-shadow: 0 12px 36px rgba(0, 0, 0, .2);
  backdrop-filter: blur(15px);
}

.fundef-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(1480px, calc(100% - 80px));
  min-height: 84px;
  margin: 0 auto;
}

.fundef-brand { display: flex; align-items: center; gap: 12px; line-height: 1; }
.fundef-brand-icon { width: auto; height: 42px; object-fit: contain; }
.fundef-brand-text { width: auto; height: 34px; object-fit: contain; }

.fundef-back {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid rgba(215, 232, 255, .55);
  border-radius: 999px;
  color: #fff;
  font-family: 'Michroma', sans-serif;
  font-size: 11px;
  letter-spacing: .02em;
  text-decoration: none;
  transition: transform .25s var(--fundef-ease), background .25s var(--fundef-ease), color .25s var(--fundef-ease);
}

.fundef-back:hover { transform: translateY(-2px); background: #fff; color: #071a3d; }
.fundef-back span { font-family: Manrope, sans-serif; font-size: 18px; line-height: 1; }

.page.fundef-main {
  width: min(1340px, calc(100% - 48px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 158px 0 92px;
}

.fundef-intro { max-width: 760px; margin: 0 0 34px; }
.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  color: var(--fundef-blue-soft);
  font-family: 'Michroma', sans-serif;
  font-size: 10px;
  letter-spacing: .18em;
}
.eyebrow::before { width: 31px; height: 2px; border-radius: 999px; background: linear-gradient(90deg, #75a8f0, #c5ddff); content: ""; }
.intro h1,
.dashboard-head h1 {
  margin: 0;
  font-family: 'Michroma', sans-serif;
  font-size: clamp(32px, 4vw, 55px);
  line-height: 1.14;
  letter-spacing: -.035em;
  text-wrap: balance;
}
.intro p { max-width: 645px; margin: 20px 0 0; color: #d4e1f5; font-size: 16px; line-height: 1.7; }

.panel {
  border: 1px solid var(--fundef-line);
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(25, 60, 124, .78), rgba(9, 26, 62, .86));
  box-shadow: 0 24px 80px rgba(1, 9, 28, .3), inset 0 1px 0 rgba(255, 255, 255, .06);
}

.fundef-gate {
  position: relative;
  grid-template-columns: minmax(350px, .85fr) minmax(480px, 1.15fr);
  overflow: hidden;
}

.gate-copy {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 540px;
  padding: clamp(42px, 5vw, 76px);
  overflow: hidden;
  background: linear-gradient(145deg, rgba(38, 85, 170, .74), rgba(14, 39, 89, .82));
}

.gate-copy::before {
  position: absolute;
  top: -140px;
  right: -145px;
  width: 350px;
  height: 350px;
  border: 1px solid rgba(208, 227, 255, .2);
  border-radius: 50%;
  box-shadow: 0 0 0 45px rgba(159, 201, 255, .035), 0 0 0 90px rgba(159, 201, 255, .025);
  content: "";
}

.gate-copy > * { position: relative; z-index: 1; }
.gate-copy .eyebrow { margin-bottom: 18px; color: #b8d5ff; }
.gate-copy h2 { max-width: 510px; margin: 0; font-family: 'Michroma', sans-serif; font-size: clamp(30px, 3.35vw, 48px); line-height: 1.14; letter-spacing: -.045em; }
.gate-copy p { max-width: 465px; margin: 24px 0 0; color: #d8e6fa; font-size: 15px; line-height: 1.7; }
.gate-copy .notice { margin-top: 12px; color: #b4caeb; font-size: 13px; }

.gate-form { padding: clamp(36px, 4.4vw, 64px); background: rgba(5, 20, 53, .34); }
.gate-form h2 { margin: 0; font-family: 'Michroma', sans-serif; font-size: clamp(22px, 2vw, 28px); letter-spacing: -.04em; }
.gate-form > .notice { margin: 10px 0 25px; color: var(--fundef-muted); font-size: 13px; }
.field { gap: 7px; margin: 15px 0; }
.field-grid { grid-template-columns: minmax(0, 1fr) 118px; gap: 12px; }
.field label,
.profile-label { color: #f4f8ff; font-size: 12px; font-weight: 800; }
.field input,
.filter-control {
  border: 1px solid rgba(184, 213, 255, .22);
  border-radius: 12px;
  background: rgba(5, 20, 52, .72);
  color: #fff;
  transition: border-color .25s var(--fundef-ease), background .25s var(--fundef-ease), box-shadow .25s var(--fundef-ease), transform .25s var(--fundef-ease);
}
.field input { min-height: 50px; padding: 0 15px; }
.field input::placeholder,
.filter-control::placeholder { color: #7f99c2; }
.field input:focus,
.filter-control:focus { border-color: #9bc2ff; background: rgba(8, 31, 76, .88); box-shadow: 0 0 0 4px rgba(105, 163, 255, .16); }
#estado { text-transform: uppercase; }

.profile-group { margin: 22px 0; }
.profile-group legend { margin-bottom: 10px; }
.profile-options { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.profile-option { min-height: 74px; padding: 12px; color: #eaf3ff; font-size: 12px; line-height: 1.3; transition: border-color .25s var(--fundef-ease), background .25s var(--fundef-ease), transform .25s var(--fundef-ease); }
.profile-option:hover { border-color: rgba(169, 207, 255, .62); transform: translateY(-2px); }
.profile-option:has(input:checked) { border-color: #8bb9ff; background: rgba(51, 112, 211, .3); }

.consent { margin: 20px 0; color: #b9cbe6; font-size: 11px; }
.consent input { width: 16px; height: 16px; }
.gate-form button,
.filter-button {
  min-height: 52px;
  border: 1px solid rgba(255, 255, 255, .82);
  border-radius: 999px;
  background: linear-gradient(135deg, #fff 0%, #dbe9ff 100%);
  color: #091b38;
  font-size: 14px;
  box-shadow: 0 12px 30px rgba(0, 9, 33, .27), inset 0 1px 0 #fff;
  transition: transform .25s var(--fundef-ease), box-shadow .25s var(--fundef-ease), background .25s var(--fundef-ease);
}
.gate-form button { width: 100%; }
.gate-form button:hover,
.filter-button:hover { transform: translateY(-3px); background: #fff; box-shadow: 0 17px 35px rgba(0, 9, 33, .36), inset 0 1px 0 #fff; }
.error { border-color: rgba(255, 159, 171, .55); background: rgba(115, 25, 53, .42); }

.dashboard-head { align-items: end; margin: 0 0 30px; }
.dashboard-head p { margin-top: 14px; color: var(--fundef-muted); }
.logout { display: inline-flex; align-items: center; min-height: 42px; padding: 0 17px; border: 1px solid var(--fundef-line); border-radius: 999px; color: #d7e8ff; text-decoration: none; transition: background .25s var(--fundef-ease), transform .25s var(--fundef-ease); }
.logout:hover { transform: translateY(-2px); background: rgba(255, 255, 255, .1); }
.diagnostic { padding: 32px; }
.diagnostic .eyebrow { margin-bottom: 13px; }
.diagnostic h2 { font-family: 'Michroma', sans-serif; font-size: 22px; letter-spacing: -.035em; }
.diagnostic p { margin-top: 12px; }
.filters { grid-template-columns: 138px minmax(220px, 1fr) minmax(220px, 1.15fr) auto; gap: 13px; }
.filter-control { min-height: 52px; }
.filter-button { min-height: 52px; padding: 0 23px; }

.metrics { gap: 16px; }
.metric { border-color: var(--fundef-line); border-radius: 18px; background: linear-gradient(145deg, rgba(34, 76, 151, .52), rgba(10, 29, 67, .75)); box-shadow: inset 0 1px rgba(255, 255, 255, .06); }
.metric span { color: #bdd1ee; }
.metric strong { font-family: 'Michroma', sans-serif; font-size: clamp(18px, 1.8vw, 25px); }
.results-title { margin-top: 34px; }
.results-title h2 { font-family: 'Michroma', sans-serif; font-size: 22px; letter-spacing: -.035em; }
.results-title p { color: var(--fundef-muted); }
.results { border-radius: 20px; }
.table th { background: #0a1d42; }
.table tr:hover td { background: rgba(103, 158, 255, .06); }
.export-btn,
.wa-btn { min-height: 42px; border-radius: 999px; padding: 0 17px; }
.scroll-hint { color: #b9d4fb; }
.footnote { color: #a7c0e5; }

@media (max-width: 980px) {
  .fundef-gate { grid-template-columns: 1fr; }
  .gate-copy { min-height: 0; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .fundef-nav { width: min(100% - 30px, 600px); min-height: 72px; }
  .fundef-brand-icon { height: 35px; }
  .fundef-brand-text { height: 28px; }
  .fundef-back { min-height: 38px; padding: 0 12px; font-size: 9px; }
  .fundef-back span { display: none; }
  .page.fundef-main { width: min(100% - 28px, 600px); padding-top: 118px; }
  .intro h1, .dashboard-head h1 { font-size: 30px; }
  .gate-copy, .gate-form, .diagnostic { padding: 28px 22px; }
  .gate-copy h2 { font-size: 29px; }
  .field-grid, .profile-options, .filters { grid-template-columns: 1fr; }
  .profile-option { min-height: 52px; }
  .dashboard-head { display: block; }
  .dashboard-head .logout { margin-top: 18px; }
  .results-title > div:last-child { align-items: stretch !important; }
  .export-btn, .wa-btn { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Painel de resultados */
.metrics .metric {
  position: relative;
  overflow: hidden;
  min-height: 124px;
}

.metrics .metric::after {
  content: "";
  position: absolute;
  width: 130px;
  height: 130px;
  top: -86px;
  right: -43px;
  border: 1px solid rgba(173, 210, 255, .19);
  border-radius: 50%;
  box-shadow: 0 0 0 24px rgba(149, 196, 255, .03);
}

.metrics .metric > * { position: relative; z-index: 1; }
.results-title { align-items: center; padding: 8px 0 15px; }
.results-kicker { display: block; margin-bottom: 8px; color: #a9ccff; font-family: 'Michroma', sans-serif; font-size: 9px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.results-title h2 { margin: 0; font-size: clamp(19px, 2.1vw, 26px); }
.results-title p { margin-top: 7px; color: #b8cbe9; }
.results-title p strong { color: #fff; }

.results-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  flex-wrap: wrap;
}

.results-actions .export-btn,
.results-actions .wa-btn {
  min-height: 43px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12px;
}

.results-actions .export-btn { border-color: rgba(255, 239, 178, .78); }
.results-actions .wa-btn { border-color: rgba(111, 241, 168, .38); }
.results-actions .scroll-hint { width: 100%; margin-top: 3px; font-size: 11px; text-align: right; }

.results {
  max-height: 650px;
  padding: 0 0 10px;
  overflow: auto;
  border-color: rgba(181, 214, 255, .24);
  background: linear-gradient(145deg, rgba(17, 49, 107, .88), rgba(5, 21, 52, .94));
  scrollbar-color: #75aaff #081935;
}

.table {
  min-width: 2700px;
  border-collapse: separate;
  border-spacing: 0;
}

.table th,
.table td { border-color: rgba(185, 214, 255, .13); }
.table th {
  top: 0;
  padding: 16px 15px;
  background: #0b2452;
  color: #bcd9ff;
  box-shadow: inset 0 -1px 0 rgba(185, 214, 255, .2);
}

.table td { padding: 15px; color: #e8f2ff; background: rgba(7, 26, 62, .15); }
.table tbody tr:nth-child(even) td { background: rgba(55, 112, 205, .1); }
.table tbody tr { transition: background .22s var(--fundef-ease), transform .22s var(--fundef-ease); }
.table tbody tr:hover td { background: rgba(75, 146, 249, .19); }
.table tbody tr:hover { transform: translateX(2px); }
.table td strong { color: #fff; font-weight: 800; }
.table th:first-child,
.table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 67px;
  box-shadow: 8px 0 18px rgba(2, 12, 33, .15);
}
.table th:first-child { z-index: 4; background: #0b2452; }
.table tbody tr:nth-child(odd) td:first-child { background: #0a214c; }
.table tbody tr:nth-child(even) td:first-child { background: #102e65; }
.table tbody tr:hover td:first-child { background: #174580; }
.table .external { font-weight: 700; }

.results-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 22px 0 0;
}

.pagination-pages { display: flex; align-items: center; gap: 6px; }
.pagination-link,
.pagination-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  border: 1px solid rgba(190, 217, 255, .22);
  border-radius: 11px;
  color: #d3e4fd;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  transition: color .2s var(--fundef-ease), background .2s var(--fundef-ease), border-color .2s var(--fundef-ease), transform .2s var(--fundef-ease);
}

.pagination-prev,
.pagination-next { min-width: auto; padding: 0 16px; border-radius: 999px; }
.pagination-link:hover { transform: translateY(-2px); border-color: #9bc4ff; background: rgba(93, 158, 255, .18); color: #fff; }
.pagination-link.is-current { border-color: #b9d7ff; background: linear-gradient(135deg, #fff, #cfe3ff); color: #0a234e; box-shadow: 0 7px 18px rgba(3, 15, 40, .26); }
.pagination-ellipsis { min-width: 20px; border: 0; color: #9db9e4; }

@media (max-width: 760px) {
  .results-title { align-items: flex-start; }
  .results-actions { justify-content: flex-start; width: 100%; }
  .results-actions .scroll-hint { text-align: left; }
  .results { max-height: 570px; }
  .results-pagination { gap: 7px; }
  .pagination-prev,
  .pagination-next { min-width: auto; padding: 0 12px; font-size: 11px; }
}

/* Consulta e dados: leitura prioritária */
.dashboard-head h1,
.diagnostic h2,
.results-title h2,
.metric strong {
  font-family: 'Manrope', sans-serif;
  font-weight: 800;
  letter-spacing: -.045em;
}

.dashboard-head h1 { font-size: clamp(34px, 4vw, 52px); }
.diagnostic h2 { font-size: clamp(22px, 2vw, 29px); }
.results-title h2 { font-size: clamp(22px, 2vw, 29px); }
.metric strong { font-size: clamp(23px, 2.3vw, 34px); letter-spacing: -.055em; }

.filters {
  grid-template-columns: repeat(4, minmax(145px, 1fr));
  gap: 15px;
}

.filter-search { grid-column: span 2; }
.filter-field label { color: #c9ddfa; font-size: 10px; letter-spacing: .08em; }
.filter-control { min-height: 54px; font-size: 14px; font-weight: 600; }
.filter-button { min-height: 54px; font-size: 14px; }

.results { max-height: 690px; }
.table { min-width: 1660px; font-family: 'Manrope', sans-serif; }
.table th { padding: 17px 15px; font-size: 10px; letter-spacing: .07em; }
.table td { padding: 16px 15px; font-size: 13px; font-weight: 600; }
.table td small { margin-top: 5px; color: #a9c5ed; font-size: 11px; font-weight: 600; }
.municipality-cell { min-width: 145px; }
.beneficiary-cell { min-width: 230px; white-space: normal !important; }
.beneficiary-cell strong { display: block; font-size: 12px; line-height: 1.42; }
.value-cell { min-width: 148px; color: #fff !important; font-size: 14px !important; font-weight: 800 !important; }

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(155, 197, 255, .3);
  border-radius: 999px;
  color: #d9ebff;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.status-badge.is-alert { border-color: rgba(255, 187, 122, .5); background: rgba(215, 119, 53, .16); color: #ffdaa7; }
.status-badge.is-clear { border-color: rgba(116, 228, 173, .35); background: rgba(36, 166, 111, .13); color: #b6f4d2; }

.process-details { position: relative; min-width: 122px; }
.process-details summary {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid rgba(150, 193, 255, .34);
  border-radius: 9px;
  color: #dcecff;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
  transition: background .2s var(--fundef-ease), border-color .2s var(--fundef-ease), color .2s var(--fundef-ease);
}

.process-details summary::-webkit-details-marker { display: none; }
.process-details summary::after { margin-left: 8px; content: '+'; color: #93c1ff; font-size: 16px; line-height: 1; }
.process-details[open] summary { border-color: #91c0ff; background: rgba(70, 136, 236, .2); color: #fff; }
.process-details[open] summary::after { content: '−'; }
.process-details dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(145px, 1fr));
  gap: 10px 16px;
  width: min(500px, 66vw);
  margin: 12px 0 0;
  padding: 15px;
  border: 1px solid rgba(170, 208, 255, .25);
  border-radius: 13px;
  background: #0a2453;
  box-shadow: 0 18px 35px rgba(0, 8, 28, .35);
}

.process-details dl div { min-width: 0; }
.process-details .detail-wide { grid-column: 1 / -1; }
.process-details dt { margin-bottom: 3px; color: #91bdf5; font-size: 9px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.process-details dd { margin: 0; color: #f1f7ff; font-size: 11px; font-weight: 600; line-height: 1.45; white-space: normal; }

@media (max-width: 1100px) {
  .filters { grid-template-columns: repeat(3, minmax(145px, 1fr)); }
  .filter-search { grid-column: span 2; }
}

@media (max-width: 760px) {
  .filters,
  .filter-search { grid-template-columns: 1fr; grid-column: auto; }
  .process-details dl { grid-template-columns: 1fr; width: min(340px, 74vw); }
  .process-details .detail-wide { grid-column: auto; }
  .table { min-width: 1530px; }
}

/* Leitura da consulta: tipografia simples e barra horizontal sempre exposta. */
body,
button,
input,
select,
.dashboard-head h1,
.diagnostic h2,
.results-title h2,
.metric strong,
.results-kicker,
.table,
.results-pagination,
.process-details {
  font-family: Arial, Helvetica, sans-serif;
}

.dashboard-head h1,
.diagnostic h2,
.results-title h2,
.metric strong {
  font-weight: 600;
  letter-spacing: -.03em;
}

.filter-control { font-weight: 400; }
.filter-field label,
.table th,
.status-badge,
.process-details summary,
.pagination-link { font-weight: 600; }
.table td,
.table td small,
.process-details dd { font-weight: 400; }
.beneficiary-cell strong,
.value-cell { font-weight: 600 !important; }

.results-scroll-rail {
  position: relative;
  width: 100%;
  height: 16px;
  margin: 0 0 10px;
  overflow: hidden;
  border: 1px solid rgba(173, 211, 255, .28);
  border-radius: 999px;
  background: #071a3b;
  box-shadow: inset 0 1px 3px rgba(0, 6, 23, .55);
  cursor: ew-resize;
  touch-action: none;
}

.results-scroll-rail:focus-visible { outline: 2px solid #afd2ff; outline-offset: 3px; }
.results-scroll-thumb {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 0;
  min-width: 74px;
  border-radius: inherit;
  background: linear-gradient(90deg, #4f8eef, #b8d9ff);
  box-shadow: 0 2px 8px rgba(87, 153, 246, .5);
  transition: background .18s ease, box-shadow .18s ease;
}

.results-scroll-rail:hover .results-scroll-thumb,
.results-scroll-rail:focus-visible .results-scroll-thumb { background: linear-gradient(90deg, #77adff, #e0efff); box-shadow: 0 2px 11px rgba(127, 183, 255, .7); }

.results {
  overflow-x: scroll;
  overflow-y: auto;
  scrollbar-width: auto;
}

.table th,
.table td { border-bottom-color: rgba(166, 205, 255, .28); }
.table th + th,
.table td + td { border-left: 1px solid rgba(166, 205, 255, .12); }
.table tbody tr:hover td { border-bottom-color: rgba(180, 218, 255, .45); }

@media (max-width: 760px) {
  .results-scroll-rail { margin-bottom: 8px; }
}
