:root {
  --navy: #003b69;
  --navy-deep: #002f55;
  --blue: #146ea1;
  --blue-soft: #dceaf7;
  --ink: #173b59;
  --text: #52606d;
  --line: #dfe7ee;
  --paper: #ffffff;
  --canvas: #f8f8f7;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); font-family: Arial, Helvetica, sans-serif; color: var(--ink); }
.app-shell { min-height: 100vh; background: var(--canvas); }

._dash-loading {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(248, 248, 247, .96);
  color: transparent;
  font-size: 0;
}
._dash-loading::before {
  content: "";
  width: 50px;
  height: 30px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background:
    radial-gradient(circle at 15px 15px, #6b7280 0 4px, transparent 4.5px),
    radial-gradient(circle at 25px 15px, #9ca3af 0 3px, transparent 3.5px),
    radial-gradient(circle at 35px 15px, #9ca3af 0 3px, transparent 3.5px),
    #fff;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .05);
  animation: figma-loading-pulse 1.05s ease-in-out infinite;
}
._dash-loading::after {
  content: "Carregando aplicação";
  color: #4d5463;
  font-size: 12px;
  font-weight: 600;
}

.figma-loading {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid #ebedf0;
  border-radius: 14px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 8px 20px rgba(18, 23, 33, .08);
}
.figma-loading-bubble {
  display: flex;
  width: 50px;
  height: 30px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
}
.figma-loading-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #9ca3af;
  animation: figma-loading-dot 1.05s ease-in-out infinite;
}
.figma-loading-dot-primary {
  width: 8px;
  height: 8px;
  background: #6b7280;
}
.figma-loading-dot:nth-child(2) { animation-delay: .12s; }
.figma-loading-dot:nth-child(3) { animation-delay: .24s; }
.figma-loading-label {
  color: #4d5463;
  font-size: 12px;
  font-weight: 600;
}

@keyframes figma-loading-dot {
  0%, 80%, 100% { opacity: .45; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}

@keyframes figma-loading-pulse {
  0%, 100% { transform: translateY(0); opacity: .82; }
  50% { transform: translateY(-1px); opacity: 1; }
}

.sidebar { display: none; }
.brand-kicker { color: var(--navy); font-size: 10px; font-weight: 800; letter-spacing: .7px; }
.brand-name { margin-top: 3px; color: #d0202a; font-size: 25px; font-weight: 900; letter-spacing: -1px; }
.brand-subtitle { margin: 2px 0 32px; color: #718096; font-size: 12px; }
.nav-heading { color: #155176; font-size: 10px; font-weight: 800; letter-spacing: .5px; margin: 12px 8px 8px; }
.nav-heading-space { margin-top: 27px; }
.nav-item { padding: 10px 10px; margin-bottom: 2px; color: #64707b; font-size: 14px; line-height: 1.2; border-radius: 3px; cursor: default; }
.nav-icon { display: inline-block; width: 23px; color: #5b6b77; font-size: 17px; vertical-align: -1px; }
.nav-item-active { color: var(--navy); background: #dce9f8; font-weight: 700; }
.nav-item-active .nav-icon { color: var(--navy); }
.sidebar-footer { flex: 1; }
.sidebar-signature { border-top: 1px solid var(--line); margin: 22px 0 0; padding: 16px 8px 0; color: #7b8794; font-size: 11px; }

.main-shell { min-width: 0; width: 100%; }
.topbar { display: none; }
.header-identity { display: flex; align-items: center; gap: 18px; }
.header-brand { color: #dc202b; font-size: 23px; font-weight: 900; letter-spacing: -1px; }
.header-title-group { padding-left: 18px; border-left: 1px solid rgba(255,255,255,.26); }
.header-title { color: #fff; font-size: 17px; font-weight: 700; }
.header-subtitle { margin-top: 2px; color: #c9d8e4; font-size: 11px; font-weight: 600; }
.gov-button { border: 1px solid rgba(255,255,255,.34); border-radius: 5px; padding: 10px 17px; background: #fff; color: var(--navy); box-shadow: none; font-size: 13px; font-weight: 700; }
.content { max-width: 1280px; margin: 0 auto; padding: 48px 5.5% 62px; }
.page-heading { margin-bottom: 25px; }
.eyebrow { margin-bottom: 8px; color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .7px; }
h1 { margin: 0; color: var(--navy-deep); font-size: clamp(30px, 3vw, 42px); line-height: 1.04; letter-spacing: -1.4px; }
.page-lead { margin: 12px 0 0; color: var(--text); font-size: 16px; }

.summary-kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0 0 24px; }
.summary-kpi { display: flex; align-items: center; height: 80px; min-width: 0; overflow: hidden; padding: 12px 12px 12px 0; border: 1px solid #ebedf0; border-radius: 8px; background: #fff; box-shadow: 0 1px 1px rgba(0, 0, 0, .05); }
.summary-kpi-accent-bar { align-self: stretch; flex: 0 0 4px; border-radius: 8px 0 0 8px; background: #1351b4; }
.summary-kpi:nth-child(2) .summary-kpi-accent-bar { background: #00a88e; }
.summary-kpi:nth-child(3) .summary-kpi-accent-bar { background: #e58c1a; }
.summary-kpi:nth-child(4) .summary-kpi-accent-bar { background: #db2626; }
.summary-kpi-content { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 2px; align-items: flex-start; padding-left: 12px; line-height: normal; white-space: nowrap; }
.summary-kpi-value { color: #121721; font-family: Inter, Arial, Helvetica, sans-serif; font-size: 20px; font-weight: 700; line-height: normal; }
.summary-kpi-label { overflow: hidden; max-width: 100%; color: #4d5463; font-family: Inter, Arial, Helvetica, sans-serif; font-size: 11px; font-weight: 400; line-height: normal; text-overflow: ellipsis; }

.filter-card, .map-card, .table-card { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 7px 22px rgba(16, 57, 87, .045); }
.filter-card { padding: 22px 24px 25px; }
.filter-heading h2, .section-heading h2 { margin: 0; color: var(--navy-deep); font-size: 20px; letter-spacing: -.3px; }
.filter-heading p, .section-heading p { margin: 5px 0 0; color: #718096; font-size: 13px; }
.filter-grid { display: grid; grid-template-columns: 1fr 1fr 1fr 1.25fr; gap: 15px; margin-top: 18px; }
.filter-label { display: block; margin-bottom: 7px; color: var(--ink); font-size: 12px; font-weight: 700; }
.Select-control { min-height: 40px !important; border: 1px solid #cbd9e5 !important; border-radius: 4px !important; box-shadow: none !important; }
.Select-value-label, .Select-placeholder { color: #52606d !important; font-size: 13px; }
.Select--multi .Select-value { background: var(--blue-soft) !important; border: 0 !important; color: var(--navy) !important; }

.factor-context, .composition-details { margin-top: 16px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 7px 22px rgba(16, 57, 87, .035); }
.factor-context { padding: 0; overflow: hidden; }
.factor-context-inner { display: grid; grid-template-columns: 1.35fr .65fr; gap: 22px; padding: 19px 22px; border-left: 4px solid var(--blue); background: #f7fbfe; }
.factor-kicker, .panel-eyebrow { color: var(--blue); font-size: 10px; font-weight: 800; letter-spacing: .7px; }
.factor-copy h3, .composition-heading h3, .municipality-heading h3 { margin: 5px 0; color: var(--navy-deep); font-size: 19px; letter-spacing: -.2px; }
.factor-copy p, .factor-reading p, .composition-heading p, .composition-section-title p { margin: 0; color: #64748b; font-size: 13px; line-height: 1.5; }
.factor-reading { padding-left: 22px; border-left: 1px solid var(--line); }
.factor-reading strong { display: block; margin-bottom: 5px; color: #183b56; font-size: 12px; }
.factor-count { display: inline-flex; margin: 10px 8px 0 0; padding: 5px 9px; border-radius: 16px; background: #e7f0f8; color: var(--navy); font-size: 11px; font-weight: 700; }
.factor-count-muted { background: #eef2f6; color: #52606d; }

.composition-details { overflow: hidden; }
.composition-details summary { display: flex; min-height: 56px; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; color: var(--navy-deep); cursor: pointer; font-size: 14px; font-weight: 700; list-style-position: inside; }
.composition-details summary small { color: #718096; font-size: 11px; font-weight: 500; }
.composition-details[open] summary { border-bottom: 1px solid var(--line); background: #f8fbfd; }
.composition-content { padding: 12px 16px 14px; }
.composition-heading { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, .55fr); gap: 10px; align-items: stretch; }
.composition-heading h3 { margin-bottom: 0; font-size: 17px; }
.composition-inline-method { display: flex; min-height: 54px; flex-direction: column; justify-content: center; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #f8fbfd; }
.composition-inline-method-accent { border-color: #f0d59f; background: #fff8e9; }
.composition-inline-method span { color: #718096; font-size: 9px; font-weight: 800; letter-spacing: .6px; }
.composition-inline-method strong { margin-top: 4px; color: #183b56; font-size: 12px; line-height: 1.25; }
.composition-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.composition-variable { display: grid; grid-template-columns: 25px minmax(150px, 1fr); gap: 7px; align-items: center; min-height: 54px; flex: 1 1 245px; padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.composition-number { display: grid; width: 25px; height: 25px; place-items: center; border-radius: 7px; background: #e7f0f8; color: var(--navy); font-size: 9px; font-weight: 800; }
.composition-variable-copy strong { display: block; color: #183b56; font-size: 12px; line-height: 1.25; }
.composition-variable-copy p { margin: 5px 0 9px; color: #64748b; font-size: 11px; line-height: 1.45; }
.composition-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.composition-variable-copy code { display: none; }
.composition-status { margin-top: 4px; padding: 3px 7px; border-radius: 16px; background: #f5f9fd; color: var(--blue); font-size: 9px; font-weight: 700; }
.composition-note { margin: 10px 0 0; padding: 10px 12px; border-left: 4px solid #e58c1a; border-radius: 8px; background: #fff8e9; color: #52606d; font-size: 11px; line-height: 1.45; }

.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 24px 0; }
.metric-card { position: relative; display: flex; align-items: center; min-height: 80px; padding: 12px 12px 12px 0; overflow: hidden; background: #fff; border: 1px solid #ebedf0; border-radius: 8px; box-shadow: 0 1px 1px rgba(0, 0, 0, .05); }
.metric-accent { align-self: stretch; flex: 0 0 4px; border-radius: 0 4px 4px 0; background: #1351b4; }
.metric-content { display: flex; min-width: 0; flex: 1; flex-direction: column; align-items: flex-start; gap: 2px; padding-left: 12px; }
.metric-label { overflow: hidden; max-width: 100%; margin: 0; color: #4d5463; font-size: 11px; font-weight: 400; line-height: normal; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.metric-value { color: #121721; font-size: 20px; font-weight: 700; letter-spacing: 0; line-height: normal; }
.metric-card:nth-child(2) .metric-accent { background: #00a88e; }
.metric-card:nth-child(3) .metric-accent { background: #e58c1a; }
.metric-card:nth-child(4) .metric-accent { background: #db2626; }

.map-card { overflow: hidden; border-radius: 8px; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; padding: 23px 25px 8px; }
.map-heading-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 9px; }
.sector-layer-toggle > label { display: inline-flex; min-height: 30px; align-items: center; gap: 7px; padding: 6px 10px; border: 1px solid #cbd9e5; border-radius: 16px; background: #fff; color: var(--navy); cursor: pointer; font-size: 11px; font-weight: 700; }
.sector-layer-toggle > label:hover { border-color: var(--blue); background: #f7fbfe; }
.sector-layer-toggle > label:has(input:checked) { border-color: var(--blue); background: #e7f0f8; }
.sector-layer-toggle-input { width: 15px; height: 15px; margin: 0; accent-color: var(--blue); cursor: pointer; }
.map-tag { border-radius: 16px; padding: 7px 10px; background: #e7f0f8; color: var(--navy); font-size: 11px; font-weight: 700; }
.map-card .dash-graph { padding: 0 8px 8px; }
.map-loading-parent { position: relative; }
.map-loading-overlay {
  display: grid;
  place-items: center;
  background: rgba(248, 251, 253, .76);
  backdrop-filter: blur(1px);
}
.map-analysis-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 12px; align-items: stretch; padding: 0 8px 8px; }
.map-analysis-grid .dash-graph { padding: 0; min-width: 0; }
.municipality-panel { display: flex; min-height: 100%; flex-direction: column; padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: #f9fbfd; }
.empty-panel { align-items: center; justify-content: center; text-align: center; }
.empty-icon { display: grid; width: 48px; height: 48px; place-items: center; border-radius: 50%; background: #e7f0f8; color: var(--blue); font-size: 22px; }
.empty-panel h3 { margin: 13px 0 6px; color: var(--navy-deep); font-size: 17px; }
.empty-panel p { max-width: 240px; margin: 0; color: #64748b; font-size: 13px; line-height: 1.5; }
.municipality-heading h3 { font-size: 22px; line-height: 1.15; }
.municipality-heading p { margin: 0; color: #64748b; font-size: 12px; }
.municipality-metrics { display: grid; gap: 8px; margin-top: 18px; }
.municipality-metric { display: flex; min-height: 56px; flex-direction: column; justify-content: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.municipality-metric-accent { border-color: #f0d59f; background: #fff8e9; }
.municipality-metric span { color: #64748b; font-size: 10px; }
.municipality-metric strong { margin-top: 3px; color: #183b56; font-size: 15px; }
.classification-block { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.classification-block strong { display: block; margin-top: 7px; color: #183b56; font-size: 14px; line-height: 1.4; }
.classification-block p { margin: 6px 0 0; color: #64748b; font-size: 12px; line-height: 1.5; }
.table-card { margin-top: 24px; overflow: hidden; }
.table-heading { padding-bottom: 19px; }

@media (max-width: 1050px) {
  .filter-grid { grid-template-columns: repeat(2, 1fr); }
  .summary-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .composition-heading { grid-template-columns: 1fr; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .map-analysis-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .content { padding: 28px 18px 40px; }
  .filter-grid, .metrics-grid, .factor-context-inner, .composition-heading { grid-template-columns: 1fr; }
  .summary-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .composition-variable { flex-basis: 100%; }
  .factor-reading { padding-left: 0; border-left: 0; }
  .section-heading { display: block; }
  .map-heading-actions { justify-content: flex-start; margin-top: 12px; }
  .map-tag { display: inline-block; margin-top: 12px; }
  .map-heading-actions .map-tag { margin-top: 0; }
  .composition-details summary { display: block; }
  .composition-details summary small { display: block; margin-top: 4px; }
}
