/* Acabamento visual global: ritmo, textura e componentes institucionais. */
:root {
	--space-6: 24px;
	--space-7: 32px;
	--space-8: 40px;
	--page-gutter: clamp(16px, 2.4vw, 32px);
	--page-top: clamp(20px, 3vw, 32px);
	--page-bottom: clamp(36px, 5vw, 64px);
	--section-gap: clamp(18px, 2.2vw, 28px);
	--panel-padding: clamp(16px, 1.8vw, 22px);
	--app-texture: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cpath d='M0 18H72M18 0V72' stroke='%23246b45' stroke-opacity='.028' stroke-width='.7'/%3E%3Ccircle cx='54' cy='54' r='.8' fill='%23246b45' fill-opacity='.055'/%3E%3C/svg%3E");
}

html.theme-dark {
	--app-texture: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cpath d='M0 18H72M18 0V72' stroke='%23d7e4da' stroke-opacity='.025' stroke-width='.7'/%3E%3Ccircle cx='54' cy='54' r='.8' fill='%23d7e4da' fill-opacity='.05'/%3E%3C/svg%3E");
}

body {
	font-size: calc(15px * var(--font-scale));
	line-height: 1.5;
	padding-top: var(--navbar-h);
	background-color: var(--bg);
	background-image: var(--app-texture);
	background-size: 72px 72px;
}

html { scroll-padding-top: calc(var(--navbar-h) + 12px); }

main { padding: var(--page-top) var(--page-gutter) var(--page-bottom); }
.navbar-inner { padding-inline: var(--page-gutter); }
.site-footer { padding: 18px var(--page-gutter); }

/* Cabeçalho permanente, encostado nas bordas da janela. */
.navbar {
	position: fixed;
	inset: 0 0 auto;
	width: 100%;
	height: var(--navbar-h);
}
.navbar-inner { height: var(--navbar-h); }
.navbar-brand { flex: 0 0 auto; margin-right: 4px; }
.logo-mark {
	width: 46px;
	height: 34px;
	border-radius: var(--radius-sm);
	font-size: 13px;
	font-weight: 750;
	letter-spacing: .08em;
}
.nav-submenu { top: 100%; border-radius: 0; }
.nav-submenu a { display: flex; align-items: center; gap: 8px; }
.site-footer { background: transparent; }
.footer-inner { text-align: center; }

.std-page,
.search-page,
.economia-page,
.feiras-page,
.demografia-page,
.otf-page { gap: var(--section-gap); }

.page-header {
	gap: var(--space-6);
	align-items: center;
	padding-bottom: var(--space-5);
	margin-bottom: var(--space-2);
	background: transparent !important;
	box-shadow: none !important;
}
.page-header__body { gap: 6px; }
.page-header__body .programa-badge { width: max-content; justify-self: start; }
.page-title { margin: 0; }
.page-sub { font-size: 13px; }
.municipios-page .map-header {
	align-items: center;
	margin-bottom: var(--space-2);
	padding: 0 0 var(--space-5);
	border: 0;
	border-bottom: 1px solid var(--border);
}

.std-panel,
.std-strip-item,
.panel-card,
.admin-main,
.observatory-kpi,
.ds-card__body { padding: var(--panel-padding); }

.std-panel,
.std-strip-item,
.panel-card,
.admin-main,
.observatory-kpi,
.admin-card { gap: var(--space-3); }

.std-layout,
.admin-layout,
.programas-grid,
.feiras-grid,
.dashboard-chart-grid { gap: var(--section-gap); }

.std-strip,
.observatory-kpis,
.peer-cards,
.admin-grid { gap: var(--space-4); }

.std-section-title {
	gap: var(--space-3);
	padding-bottom: var(--space-3);
}

.dashboard-filters {
	gap: var(--space-4);
	padding: var(--panel-padding);
}

.dashboard-filter { gap: var(--space-2); }
.dashboard-filter-actions { gap: var(--space-2); }

/* Abas: uma única faixa sem card, com estado ativo inequívoco. */
:is(.economia-tabs, .demografia-tabs, .feiras-tabs) {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0 0 10px;
	border: 0;
	border-bottom: 1px solid var(--border);
	border-radius: 0;
	background: transparent;
}

:is(.economia-tab, .demografia-tab-pill, .feiras-tab-pill, .economia-pill) {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 38px;
	padding: 8px 13px;
	border: 1px solid var(--border-hi);
	border-radius: var(--radius-md);
	background: transparent;
	color: var(--muted);
	font-size: 12px;
	font-weight: 700;
}
.economia-tab::before { display: none; }

:is(.economia-tab, .demografia-tab-pill, .feiras-tab-pill, .economia-pill).is-active,
.municipios-page .map-view-pill.is-active,
.municipios-page .dossier-tab.is-active,
.ds-tab.is-active,
.otf-map-controls .ds-btn.is-active {
	border-color: var(--brand);
	background: var(--brand);
	color: var(--text-on-accent);
	box-shadow: none !important;
}

.municipios-page :is(.map-view-switch, .dossier-tabs) {
	display: flex;
	width: 100%;
	gap: 6px;
	padding: 0 0 9px;
	border: 0;
	border-bottom: 1px solid var(--border);
	border-radius: 0;
	background: transparent;
	box-shadow: none;
}

/* Conteúdo sem cartões: seções e indicadores são separados por linhas. */
:is(.std-panel, .std-strip-item, .panel-card, .admin-main, .admin-card, .observatory-kpi, .ceasa-card, .ceasa-kpi) {
	border-radius: 0;
	background: transparent;
	box-shadow: none !important;
}

:is(.std-panel, .std-strip-item, .panel-card, .admin-main, .admin-card) {
	padding: var(--panel-padding) 0;
	border: 0;
	border-top: 1px solid var(--border);
}

.dashboard-filters.std-panel {
	padding: var(--panel-padding) 0;
	border: 0;
	border-top: 2px solid var(--brand);
	border-bottom: 1px solid var(--border);
	background: transparent;
}

:is(.observatory-kpis, .std-strip) {
	gap: 0;
	border-top: 1px solid var(--border);
	border-bottom: 1px solid var(--border);
}

:is(.observatory-kpi, .std-strip-item) {
	border: 0;
	border-right: 1px solid var(--border);
}
:is(.observatory-kpi, .std-strip-item):last-child { border-right: 0; }
:is(.observatory-kpi, .std-strip-item):hover { background: var(--hover-bg); }

.search-page .filtros-row {
	padding: 0 0 12px;
	border: 0;
	border-bottom: 1px solid var(--border);
	border-radius: 0;
	background: transparent;
}
.search-page .kpi-panel.ativo {
	gap: 0;
	border: 0;
	border-top: 1px solid var(--border);
	border-bottom: 1px solid var(--border);
	border-radius: 0;
}
.search-page .kpi-card { border-right: 1px solid var(--border); background: transparent; }
.search-page .agregacoes-grid { gap: 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.search-page .ag-item {
	border: 0;
	border-right: 1px solid var(--border);
	border-radius: 0;
	background: transparent;
}
.search-page .ag-item:last-child { border-right: 0; }
.search-page .card {
	border: 0;
	border-bottom: 1px solid var(--border);
	border-radius: 0;
	background: transparent;
}
.search-page :is(.inicio-state, .empty-state) { background: transparent; }

.admin-side {
	padding-left: 0;
	border: 0;
	border-right: 1px solid var(--border);
	border-radius: 0;
	background: transparent;
}
.programas-catalogo article { background: transparent; }

.ceasa-market-grid,
.ceasa-kpis {
	gap: 0;
	border-top: 1px solid var(--border);
	border-bottom: 1px solid var(--border);
}
.ceasa-card,
.ceasa-kpi {
	padding: var(--panel-padding);
	border: 0;
	border-right: 1px solid var(--border);
}
.ceasa-market-grid > .ceasa-card:last-child,
.ceasa-kpi:last-child { border-right: 0; }
.ceasa-chart-card,
.ceasa-observations { border-top: 1px solid var(--border); }
.demografia-pyramid { background: transparent; }

html.design-brutalist :is(.std-panel, .std-strip-item, .panel-card, .admin-main, .admin-card, .observatory-kpi, .ceasa-card, .ceasa-kpi) {
	background: transparent !important;
	box-shadow: none !important;
}

/* Sem degradês: cores sólidas e mistura de cor uniforme. */
.theme-chip.is-active,
.metric-fill,
.programas-bar-fill,
.economia-progress-fill { background: var(--success) !important; background-image: none !important; }
.programas-bar-fill { background: var(--accent-cool) !important; }
.weather-current { background: color-mix(in srgb, var(--success-bg) 52%, var(--surface)) !important; }
.municipios-page .official-photo { background: color-mix(in srgb, var(--success) 10%, var(--surface-2)) !important; }

/* Programas identificados no dossiê municipal: linhas, não cartões. */
.municipios-page .municipio-programas-panel {
	grid-column: 1 / -1;
	border-top: 1px solid var(--border);
	border-bottom: 1px solid var(--border);
}
.municipio-programas-panel__head,
.municipio-programa-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-4);
}
.municipio-programas-panel__head { padding: 14px 0; }
.municipio-programas-panel__head div { display: grid; gap: 2px; }
.municipio-programas-panel__head span,
.municipio-programas-dialog__eyebrow {
	font-family: var(--font-mono);
	font-size: 10px;
	font-weight: 700;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--brand);
}
.municipio-programas-panel__head strong { font-size: 16px; }
.municipio-programas-panel__head > small,
.municipio-programa-row small,
.municipio-programas-dialog__meta { color: var(--muted); }
.municipio-programas-list { border-top: 1px solid var(--border); }
.municipio-programa-row { padding: 13px 0; border-bottom: 1px solid var(--border); }
.municipio-programa-row:last-child { border-bottom: 0; }
.municipio-programa-row > div { display: grid; gap: 3px; }
.municipio-programa-row strong { font-size: 14px; }
.municipio-programas-empty,
.municipio-programas-loading { grid-column: 1 / -1; margin: 0; padding: 18px 0; color: var(--muted); }
.municipio-programas-source-status { margin: 0; padding: 10px 0; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }
.municipio-programas-dialog { width: min(620px, calc(100vw - 28px)); }
.municipio-programas-dialog header > div { display: grid; gap: 3px; }
.municipio-programas-dialog__meta { margin: 0 0 14px; }
.municipio-beneficiarios-list { display: grid; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--border); }
.municipio-beneficiarios-list li { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.municipio-beneficiarios-list li:last-child { border-bottom: 0; }
.municipio-beneficiarios-list span { color: var(--muted); font-size: 12px; }
.municipio-beneficiario-link { display: inline-flex; align-items: center; gap: 6px; color: var(--brand); font-weight: 700; text-decoration: none; }
.municipio-beneficiario-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.municipio-beneficiario-link svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.7; }

.otf-beneficiarios-dialog { width: min(620px, calc(100vw - 28px)); }
.otf-beneficiarios-dialog header > div { display: grid; gap: 3px; }
.otf-beneficiarios-dialog__eyebrow { font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--brand); }
.otf-beneficiarios-dialog__meta { margin: 0 0 14px; color: var(--muted); }
.otf-beneficiarios-list { display: grid; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--border); }
.otf-beneficiarios-list li { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.otf-beneficiarios-list li:last-child { border-bottom: 0; }
.otf-beneficiarios-list span, .otf-beneficiarios-empty { color: var(--muted); font-size: 12px; }
.otf-beneficiarios-empty { margin: 0; padding: 14px 0; }

/* Vocabulário único para controles legados e novos. */
:is(.theme-chip.form-action, .form-action, .pag-btn, .filtro-btn) {
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 38px;
	padding: 0 14px;
	border: var(--border-w) solid var(--border-hi);
	border-radius: var(--radius-md);
	background: var(--surface);
	color: var(--text-2);
	font-family: var(--font-sans);
	font-size: 12px;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
	transition: background .16s var(--ease-out), border-color .16s var(--ease-out), color .16s var(--ease-out);
}

:is(.theme-chip.form-action, .form-action) {
	border-color: var(--brand);
	background: var(--brand);
	color: var(--text-on-accent);
}

:is(.theme-chip:not(.form-action), .pag-btn, .filtro-btn):hover {
	border-color: var(--brand);
	background: var(--hover-bg);
	color: var(--text);
}

.theme-chip.form-action:hover,
.form-action:hover { border-color: var(--brand-hover); background: var(--brand-hover); }

.filtro-btn:is(.ativo-todos, .ativo-pf, .ativo-pj, .ativo-campo) {
	border-color: var(--brand);
	background: var(--brand-bg);
	color: var(--brand);
}

:is(.form-control, .form-select, .admin-input, .dashboard-filter input, .dashboard-filter select, .beneficiario-select select, .map-select) {
	min-height: var(--control-h);
	padding: 9px 11px;
	border: var(--border-w) solid var(--border-hi);
	border-radius: var(--radius-md);
	background: var(--control-bg);
	color: var(--text);
	font: inherit;
}

:is(.form-control, .form-select, .admin-input, .dashboard-filter input, .dashboard-filter select, .beneficiario-select select, .map-select):focus {
	outline: 0;
	border-color: var(--brand);
	box-shadow: var(--focus-ring);
}

:is(.admin-table, .ds-table, .otf-table) th {
	background: var(--surface-2);
	color: var(--text-2);
}

:is(.admin-table, .ds-table, .otf-table) tbody tr:hover { background: var(--hover-bg); }
:is(.admin-table, .ds-table, .otf-table) td { padding-block: 12px; }

.ui-icon {
	display: inline-block;
	flex: 0 0 auto;
	width: 17px;
	height: 17px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.7;
	stroke-linecap: round;
	stroke-linejoin: round;
	pointer-events: none;
}
.ui-icon--sm { width: 14px; height: 14px; }
.ui-icon--lg { width: 22px; height: 22px; }
.ui-icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Tendências representam direção, não juízo de valor: só devem acompanhar
   métricas que têm uma base de comparação explícita. */
.metric-trend { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.metric-trend .ui-icon { width: .9em; height: .9em; }
.metric-trend--price-rise { color: var(--danger); }
.metric-trend--price-fall { color: var(--success); }
.metric-trend--neutral { color: var(--muted); }
.economia-kpi strong .metric-trend { font-size: inherit; }
.ceasa-market-row__value .metric-trend { justify-content: flex-end; }

/* Consulta financeira no detalhe da pesquisa: linhas informativas, sem cards. */
.search-page .processos-programas-lista {
	display: grid;
	border-top: 1px solid var(--border);
}
.search-page .processos-programas-linha {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(220px, .9fr);
	gap: 20px;
	padding: 13px 0;
	border-bottom: 1px solid var(--border);
}
.search-page .processos-programas-linha__principal,
.search-page .processos-programas-linha__dados {
	display: grid;
	align-content: start;
	gap: 4px;
}
.search-page .processos-programas-linha__principal strong {
	color: var(--text);
	font-size: 14px;
}
.search-page .processos-programas-linha__principal span,
.search-page .processos-programas-linha__dados span {
	color: var(--muted);
	font-size: 12px;
	line-height: 1.45;
}
.search-page .processos-programas-linha__dados .processos-programas-linha__proa {
	font-family: var(--font-mono);
	font-size: 10px;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--brand);
}
.search-page .processos-programas-vazio {
	display: grid;
	gap: 4px;
	padding: 18px 0;
	border-bottom: 1px solid var(--border);
	text-align: left;
}
.search-page .processos-programas-vazio strong { color: var(--text); font-size: 14px; }
.search-page .processos-programas-vazio span { color: var(--muted); font-size: 12px; }

/* Listagens das rotas de Pessoas e dos recortes exclusivos de Programas. */
.entidades-lista,
.programas-detalhe-lista {
	display: grid;
	border-top: 1px solid var(--border);
}
.entidades-lista__cabecalho,
.entidades-lista__linha,
.programas-detalhe-lista__cabecalho,
.programas-detalhe-lista__linha {
	display: grid;
	gap: 14px;
	align-items: center;
	border-bottom: 1px solid var(--border);
}
.entidades-lista__cabecalho,
.entidades-lista__linha {
	grid-template-columns: minmax(210px, 1.6fr) minmax(130px, 1fr) minmax(130px, .8fr) 110px;
}
.programas-detalhe-lista__cabecalho,
.programas-detalhe-lista__linha {
	grid-template-columns: minmax(180px, 1.5fr) repeat(4, minmax(90px, 1fr));
}
.entidades-lista__cabecalho,
.programas-detalhe-lista__cabecalho {
	padding: 9px 0;
	font-family: var(--font-mono);
	font-size: 9px;
	font-weight: 700;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--muted);
}
.entidades-lista__linha,
.programas-detalhe-lista__linha { padding: 13px 0; }
.entidades-lista__linha > div { display: grid; gap: 3px; }
.entidades-lista__linha strong,
.programas-detalhe-lista__linha strong { color: var(--text); font-size: 13px; }
.entidades-lista__linha span,
.entidades-lista__linha time,
.programas-detalhe-lista__linha span { color: var(--muted); font-size: 12px; }
.entidades-lista__vazio {
	display: grid;
	gap: 4px;
	padding: 18px 0;
	border-bottom: 1px solid var(--border);
}
.entidades-lista__vazio strong { color: var(--text); font-size: 14px; }
.entidades-lista__vazio span { color: var(--muted); font-size: 12px; }

.nav-link { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.nav-hub__trigger::after {
	content: "";
	width: 6px;
	height: 6px;
	margin-left: 1px;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: translateY(-2px) rotate(45deg);
}

.inicio-state .state-icon {
	display: grid;
	place-items: center;
	width: 42px;
	height: 42px;
	border: 1px solid var(--border);
	background: var(--surface-2);
	color: var(--brand);
}

@media (max-width: 960px) {
	.navbar { height: var(--navbar-h); min-height: var(--navbar-h); }
	.navbar-inner { height: var(--navbar-h); min-height: var(--navbar-h); flex-wrap: nowrap; padding-block: 0; }
	.navbar-links { order: initial; width: auto; min-width: 0; overflow-x: auto; padding-bottom: 0; }
	.navbar-end { margin-left: auto; }
	.page-header { grid-template-columns: 1fr; }
	.page-header__meta { justify-items: start; text-align: left; }
}

@media (max-width: 640px) {
	:root { --panel-padding: 14px; --section-gap: 16px; }
	.navbar-brand .logo-sub { display: none; }
	.navbar-end > .badge-accent { display: none; }
	.dashboard-filter-actions > * { min-height: 40px; }
	.observatory-kpis, .peer-cards, .std-strip { grid-template-columns: 1fr; }
	:is(.observatory-kpi, .std-strip-item) { border-right: 0; border-bottom: 1px solid var(--border); }
	:is(.observatory-kpi, .std-strip-item):last-child { border-bottom: 0; }
	.ceasa-market-grid, .ceasa-kpis { grid-template-columns: 1fr; }
	.ceasa-card, .ceasa-kpi { border-right: 0; border-bottom: 1px solid var(--border); }
	.ceasa-market-grid > .ceasa-card:last-child, .ceasa-kpi:last-child { border-bottom: 0; }
	.search-kbd { display: none; }
	.beneficiario-select { flex: 1 1 100%; justify-content: space-between; }
	.beneficiario-select select { flex: 1; max-width: 190px; }
	.search-page .processos-programas-linha { grid-template-columns: 1fr; gap: 9px; }
	.entidades-lista__cabecalho,
	.programas-detalhe-lista__cabecalho { display: none; }
	.entidades-lista__linha,
	.programas-detalhe-lista__linha { grid-template-columns: 1fr; gap: 6px; }
	.municipio-programas-panel__head,
	.municipio-programa-row,
	.municipio-beneficiarios-list li,
	.otf-beneficiarios-list li { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Login: fotografia com véu sólido e textura, também sem degradê. */
.auth-parallax__image { background: url("../imagens/agricultura-familiar-parallax.png") center / cover no-repeat !important; }
.auth-parallax::after { content: ""; position: absolute; inset: 0; z-index: 1; background: rgba(4, 18, 13, .68); }
.auth-parallax__grain { z-index: 2; background-image: var(--app-texture) !important; background-size: 72px 72px !important; }
.borda-gaucha { border-bottom: 2px solid #009b3a !important; border-image: none !important; box-shadow: 0 2px 0 #ffdf00, 0 4px 0 #ed1c24; }
