/* UNIVC Analytics Dashboard — branco + verde escuro */
:root {
  --primary: #0B3D2E;
  --primary-dark: #062A1F;
  --primary-light: #1B5E3B;
  --accent: #2D6A4F;
  --mint: #52B788;
  --sage: #D8F3DC;
  --gold: #D4A843;
  --bg: #F4F7F5;
  --surface: #FFFFFF;
  --border: #E2EBE6;
  --text: #1A2E1A;
  --text-muted: #5C6F63;
  --shadow: 0 1px 3px rgba(11, 61, 46, 0.08), 0 4px 16px rgba(11, 61, 46, 0.06);
  --shadow-lg: 0 8px 32px rgba(11, 61, 46, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 280px;
  --header-h: 64px;
  --font: 'Source Sans 3', system-ui, -apple-system, sans-serif;
  --display: 'Outfit', var(--font);
  --warning: #F59E0B;
  --warning-bg: #FFFBEB;
  --warning-border: rgba(245, 158, 11, 0.3);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* Layout */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  background: var(--primary-dark);
  color: #fff;
  padding: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 100;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-top {
  flex-shrink: 0;
  padding: 1.25rem 1.25rem 0;
}

.sidebar-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sidebar-alert {
  flex-shrink: 0;
  margin: 0 1.25rem 1rem;
  padding: 0.55rem 0.65rem;
  font-size: 0.72rem;
  line-height: 1.4;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-alert:empty,
.sidebar-alert.is-hidden {
  display: none;
}

.sidebar-alert svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--mint);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 1rem;
  margin-bottom: 0.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

.brand-icon {
  width: 42px;
  height: 42px;
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-icon svg { width: 22px; height: 22px; color: var(--mint); }

.brand h1 {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
}

.brand p {
  font-size: 0.7rem;
  opacity: 0.65;
  font-weight: 400;
}

/* Upload */
.upload-zone {
  border: 2px dashed rgba(255,255,255,0.25);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: rgba(255,255,255,0.04);
}

.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--mint);
  background: rgba(82, 183, 136, 0.1);
}

.upload-zone svg { width: 28px; height: 28px; color: var(--mint); margin-bottom: 0.5rem; }

.upload-zone p { font-size: 0.78rem; opacity: 0.8; margin-top: 0.25rem; }

.upload-zone input { display: none; }

.upload-queue {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.upload-queue[hidden] { display: none !important; }

.upload-queue li {
  font-size: 0.68rem;
  opacity: 0.8;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.5rem;
  background: rgba(255,255,255,0.06);
  border-radius: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-queue li svg { width: 12px; height: 12px; color: var(--mint); flex-shrink: 0; }

#uploadStatus {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
}

#uploadStatus.is-error {
  background: rgba(198, 40, 40, 0.15);
  border-color: rgba(198, 40, 40, 0.35);
  color: #ffcdd2;
}

/* Filters */
.filters-section h3 {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.55;
  margin-bottom: 0.75rem;
}

.filter-group { margin-bottom: 0.85rem; }

.filter-group label {
  display: block;
  font-size: 0.72rem;
  opacity: 0.7;
  margin-bottom: 0.3rem;
}

.filter-select {
  width: 100%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.5rem;
  font-size: 0.78rem;
  font-family: var(--font);
  min-height: 72px;
}

.filter-select option { background: var(--primary-dark); color: #fff; }

.search-input {
  width: 100%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  font-family: var(--font);
}

.search-input::placeholder { color: rgba(255,255,255,0.4); }

.btn-reset {
  width: 100%;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.8);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  cursor: pointer;
  font-family: var(--font);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.2s;
}

.btn-reset:hover { background: rgba(255,255,255,0.08); }
.btn-reset svg { width: 14px; height: 14px; }

/* Main */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}

.topbar h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
}

.topbar-actions { display: flex; align-items: center; gap: 1rem; }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-right: 0.75rem;
  border-right: 1px solid var(--border);
  margin-right: 0.25rem;
}

.topbar-user-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-logout:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--sage);
}

.btn-logout svg { width: 14px; height: 14px; }

.filter-badge {
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--bg);
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.filter-badge.active {
  background: var(--sage);
  color: var(--primary);
  border-color: var(--mint);
  font-weight: 600;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  transition: background 0.2s;
}

.btn-primary:hover { background: var(--primary-light); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary svg { width: 16px; height: 16px; }

/* Content */
#dashboardContent {
  padding: 1.75rem 2rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

/* KPIs */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 1rem;
}

.kpi-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}

.kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--sage);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-icon svg { width: 20px; height: 20px; color: var(--primary); }

.kpi-value {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

.kpi-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.kpi-sub {
  font-size: 0.68rem;
  color: var(--accent);
  font-weight: 600;
}

/* Insights */
.insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.85rem;
}

.insight-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  display: flex;
  gap: 0.85rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.insight-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.insight-icon svg { width: 18px; height: 18px; }

.insight-destaque .insight-icon { background: #FFF8E7; color: var(--gold); }
.insight-modalidade .insight-icon { background: var(--sage); color: var(--primary); }
.insight-alerta .insight-icon { background: var(--warning-bg); color: var(--warning); }
.insight-atencao .insight-icon { background: var(--warning-bg); color: var(--warning); }
.insight-polo .insight-icon { background: #E8F5E9; color: var(--accent); }
.insight-atencao .insight-icon { background: #FFEBEE; color: #C62828; }

.insight-card strong { font-size: 0.82rem; display: block; margin-bottom: 0.15rem; }
.insight-card p { font-size: 0.78rem; color: var(--text-muted); }

/* Section */
.section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.section-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-header h3 svg { width: 18px; height: 18px; }

.section-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg);
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
}

/* Charts */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.chart-card {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 1.1rem;
  border: 1px solid var(--border);
}

.chart-card h4 {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.chart-card.full { grid-column: 1 / -1; }

.chart-wrap {
  position: relative;
  height: 280px;
}

.chart-wrap.chart-sm { height: 220px; }

/* Tables */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

thead th {
  text-align: left;
  padding: 0.65rem 0.85rem;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
thead th:last-child { border-radius: 0 var(--radius-sm) 0 0; }

tbody td {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:hover { background: var(--bg); }
tbody tr.row-critical { background: var(--warning-bg); }

.td-curso { max-width: 220px; font-weight: 500; }
.td-unidades { font-size: 0.72rem; color: var(--text-muted); max-width: 180px; }

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.75rem;
  background: var(--bg);
  color: var(--text-muted);
}

.rank-1 { background: #FFF8E7; color: #B8860B; }
.rank-2 { background: #F0F0F0; color: #666; }
.rank-3 { background: #FFF3E0; color: #BF6000; }

/* Tags */
.tag {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 600;
  white-space: nowrap;
}

.tag-presencial { background: var(--sage); color: var(--primary); }
.tag-ead { background: #E8F5E9; color: #2E7D32; }
.tag-semipresencial { background: #E0F2F1; color: #00695C; }
.tag-outros { background: #F5F5F5; color: #666; }

.text-warn { color: var(--warning); font-weight: 700; }

/* Unit tabs */
.unit-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.unit-tab {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.85rem;
  font-size: 0.78rem;
  font-family: var(--font);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
  transition: all 0.2s;
}

.unit-tab svg { width: 14px; height: 14px; }

.unit-tab:hover { border-color: var(--accent); color: var(--primary); }

.unit-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.tab-count {
  background: rgba(255,255,255,0.2);
  padding: 0.1rem 0.45rem;
  border-radius: 10px;
  font-size: 0.68rem;
  font-weight: 700;
}

.unit-tab:not(.active) .tab-count {
  background: var(--sage);
  color: var(--primary);
}

.unit-panel { display: none; }
.unit-panel.active { display: block; }

.unit-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.unit-header h3 { font-size: 1.1rem; color: var(--primary); }

.unit-type-badge {
  display: inline-block;
  margin-top: 0.25rem;
  font-size: 0.7rem;
  background: var(--sage);
  color: var(--primary);
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  font-weight: 600;
}

.unit-stats { display: flex; flex-wrap: wrap; gap: 1rem; }

.unit-stat {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.unit-stat svg { width: 14px; height: 14px; color: var(--accent); }
.unit-stat strong { color: var(--text); }

.unit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.unit-chart-card, .unit-detail-card {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 1rem;
  border: 1px solid var(--border);
}

.unit-detail-card.full { grid-column: 1 / -1; }

.unit-chart-card h4, .unit-detail-card h4 {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.detail-list { list-style: none; }
.detail-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0;
  font-size: 0.78rem;
  border-bottom: 1px solid var(--border);
}

.detail-list li:last-child { border-bottom: none; }

.course-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.course-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.25rem 0.65rem;
  font-size: 0.72rem;
}

.course-chip em {
  font-style: normal;
  font-weight: 700;
  color: var(--primary);
  margin-left: 0.25rem;
}

/* ── Hero ── */
.hero-section {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--accent) 100%);
  border-radius: var(--radius);
  padding: 2rem;
  color: #fff;
  box-shadow: var(--shadow-lg);
}

.hero-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
}

.hero-subtitle {
  font-size: 0.85rem;
  opacity: 0.75;
}

.hero-polos-meta {
  font-size: 0.78rem;
  opacity: 0.85;
  margin-top: 0.5rem;
  background: rgba(255,255,255,0.1);
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
}

.sync-warn { color: #FFB74D; font-size: 0.7rem; }

.api-alert {
  margin-top: 0.65rem;
  background: rgba(255, 183, 77, 0.15);
  border: 1px solid rgba(255, 183, 77, 0.35);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  font-size: 0.72rem;
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  line-height: 1.4;
  text-align: left;
}

.api-alert svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 2px; color: #FFB74D; }
.api-alert a { color: var(--mint); font-weight: 600; }

.hero-unit-empty {
  opacity: 0.75;
  border-style: dashed;
}

.hero-unit-empty-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  font-size: 0.58rem;
  background: rgba(255,255,255,0.15);
  padding: 0.1rem 0.35rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.hero-unit-empty-badge svg { width: 10px; height: 10px; }

.link-polo {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  font-size: 0.78rem;
}

.link-polo:hover { text-decoration: underline; }

.polos-resumo-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1.25rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.polos-resumo-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
}

.polos-resumo-item svg { width: 22px; height: 22px; flex-shrink: 0; }
.polos-resumo-item strong { display: block; font-size: 1.35rem; color: var(--primary); line-height: 1; }
.polos-resumo-item span { font-size: 0.68rem; color: var(--text-muted); }

.polos-resumo-total svg { color: var(--primary); }
.polos-resumo-ok { border-color: var(--mint); background: var(--sage); }
.polos-resumo-ok svg { color: var(--accent); }
.polos-resumo-warn svg { color: #E65100; }

.polos-resumo-arrow, .polos-resumo-plus {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-muted);
}

.polos-com-matricula {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.polos-com-matricula h4 {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.polos-com-matricula h4 svg { width: 16px; height: 16px; color: var(--accent); }

.polos-chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }

.polo-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  border: 1px solid var(--border);
  background: var(--surface);
}

.polo-chip svg { width: 12px; height: 12px; }
.polo-chip-ok { background: var(--sage); border-color: var(--mint); }
.polo-chip em { font-style: normal; font-weight: 700; color: var(--primary); margin-left: 0.2rem; }

.td-empty { text-align: center; color: var(--text-muted); font-style: italic; padding: 1.5rem !important; }

.comp-card-empty { opacity: 0.7; border-style: dashed; }

.unit-empty-msg {
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.unit-empty-msg svg { width: 16px; height: 16px; flex-shrink: 0; }

.hero-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin: 1.5rem 0 0.75rem;
}

.hero-extra-meta {
  font-size: 0.8rem;
  opacity: 0.75;
  margin-bottom: 1.25rem;
}

.hero-kpi {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.hero-kpi-main {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.25);
}

.hero-kpi svg { width: 28px; height: 28px; color: var(--mint); flex-shrink: 0; }
.hero-kpi-main svg { width: 36px; height: 36px; }

.hero-kpi-value {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
}

.hero-kpi-main .hero-kpi-value { font-size: 2.4rem; }

.hero-kpi-label {
  font-size: 0.72rem;
  opacity: 0.7;
  margin-top: 0.15rem;
}

.hero-unidades-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 0.85rem;
}

.hero-unit-card {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-sm);
  padding: 1rem;
  text-align: center;
  position: relative;
  transition: all 0.2s;
}

.hero-unit-card:hover {
  background: rgba(255,255,255,0.14);
  transform: translateY(-2px);
}

.hero-unit-leader {
  border-color: var(--gold);
  background: rgba(212, 168, 67, 0.12);
}

.hero-unit-crown {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  font-size: 0.62rem;
  background: var(--gold);
  color: var(--primary-dark);
  padding: 0.1rem 0.4rem;
  border-radius: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.hero-unit-crown svg { width: 10px; height: 10px; }

.hero-unit-icon {
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.12);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.5rem;
}

.hero-unit-icon svg { width: 18px; height: 18px; color: var(--mint); }

.hero-unit-name {
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.15rem;
}

.hero-unit-type {
  font-size: 0.65rem;
  opacity: 0.6;
  margin-bottom: 0.5rem;
}

.hero-unit-alunos {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
}

.hero-unit-label {
  font-size: 0.65rem;
  opacity: 0.6;
}

.hero-unit-meta {
  font-size: 0.62rem;
  opacity: 0.55;
  margin-top: 0.35rem;
}

.hero-unit-filter {
  margin-top: 0.6rem;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  border-radius: 20px;
  padding: 0.25rem 0.65rem;
  font-size: 0.68rem;
  cursor: pointer;
  font-family: var(--font);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.2s;
}

.hero-unit-filter:hover { background: rgba(255,255,255,0.22); }
.hero-unit-filter svg { width: 12px; height: 12px; }

/* ── Comparativo ── */
.section-comparacao { border-left: 4px solid var(--primary); }

.section-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.comparacao-verdict { margin-bottom: 1.25rem; }

.verdict-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: var(--sage);
  border: 1px solid var(--mint);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.1rem;
  font-size: 0.82rem;
  color: var(--primary);
}

.verdict-card svg { width: 22px; height: 22px; flex-shrink: 0; color: var(--gold); }
.verdict-info { background: #E8F4FD; border-color: #90CAF9; color: #1565C0; }
.verdict-info svg { color: #1565C0; }

.comparacao-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}

.comparacao-cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.comp-card {
  display: flex;
  gap: 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  transition: all 0.2s;
}

.comp-card-leader {
  border-color: var(--mint);
  background: linear-gradient(90deg, var(--sage) 0%, var(--bg) 40%);
}

.comp-card-rank {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-muted);
  min-width: 28px;
}

.comp-card-leader .comp-card-rank { color: var(--primary); }

.comp-card-body { flex: 1; min-width: 0; }

.comp-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.comp-card-name {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--primary);
}

.comp-leader-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: var(--gold);
  color: var(--primary-dark);
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 10px;
}

.comp-leader-badge svg { width: 10px; height: 10px; }

.comp-card-stats {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.comp-card-stats div {
  display: flex;
  flex-direction: column;
  font-size: 0.72rem;
}

.comp-card-stats strong { font-size: 0.95rem; color: var(--primary); }
.comp-card-stats span { color: var(--text-muted); }

.comp-bar-wrap {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.comp-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--mint));
  border-radius: 3px;
  transition: width 0.5s ease;
}

.comp-percent {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.comparacao-chart {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
}

.comparacao-chart h4 {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

/* ── Collapsible sections ── */
.section-collapsible {
  padding: 0;
  overflow: hidden;
}

.section-collapse-btn {
  width: 100%;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}

.section-header-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  margin: 0;
}

.section-header-btn h3 {
  flex: 1;
  margin: 0;
}

.section-collapse-body {
  padding: 0 1.25rem 1.25rem;
}

.section-collapse-body[hidden] {
  display: none !important;
}

.collapse-chevron {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.section-collapse-btn.is-open .collapse-chevron {
  transform: rotate(180deg);
}

.charts-grid-compact {
  gap: 0.85rem;
}

/* ── Tag Filters ── */
.section-filters { border-left: 4px solid var(--mint); }

.active-tags-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  min-height: 42px;
  padding: 0.65rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
}

.tags-empty {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.tags-empty svg { width: 14px; height: 14px; }

.filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.25rem 0.35rem 0.25rem 0.65rem;
  font-size: 0.75rem;
  animation: tagIn 0.15s ease;
}

@keyframes tagIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.filter-tag-cat {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
}

.filter-tag-label { font-weight: 600; color: var(--primary); }

.filter-tag-unidades { border-color: var(--primary); background: var(--sage); }
.filter-tag-cursos { border-color: #1565C0; background: #E3F2FD; }
.filter-tag-modalidades { border-color: #2E7D32; background: #E8F5E9; }

.filter-tag-remove {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.15rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  color: var(--text-muted);
  transition: all 0.15s;
}

.filter-tag-remove:hover {
  background: rgba(198, 40, 40, 0.12);
  color: #C62828;
}

.filter-tag-remove svg { width: 14px; height: 14px; }

.tags-clear-all {
  background: none;
  border: 1px dashed var(--border);
  border-radius: 20px;
  padding: 0.25rem 0.65rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: auto;
  transition: all 0.15s;
}

.tags-clear-all:hover { border-color: #C62828; color: #C62828; }
.tags-clear-all svg { width: 13px; height: 13px; }

.tag-filter-body {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1rem;
}

.tag-categories {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.tag-category-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  font-size: 0.78rem;
  font-family: var(--font);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-muted);
  text-align: left;
  transition: all 0.15s;
}

.tag-category-btn svg { width: 14px; height: 14px; }

.tag-category-btn:hover { border-color: var(--accent); color: var(--primary); }

.tag-category-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.tag-options-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  min-height: 120px;
}

.tag-options-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-weight: 500;
}

.tag-options-header svg { width: 14px; height: 14px; }

.tag-options-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag-option {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  font-family: var(--font);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--text);
  transition: all 0.15s;
}

.tag-option svg { width: 12px; height: 12px; color: var(--accent); }

.tag-option:hover {
  border-color: var(--primary);
  background: var(--sage);
  color: var(--primary);
}

.tag-option.selected {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  cursor: default;
  opacity: 0.7;
}

.tag-option.selected svg { color: #fff; }

.section-header-inline {
  margin-top: 0.5rem;
}

.section-header-inline h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-header-inline h3 svg { width: 18px; height: 18px; }

/* SEI sync — sidebar */
.sei-sync-panel {
  margin-top: 0;
  padding: 1rem;
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(27, 67, 50, 0.45), rgba(13, 40, 24, 0.6));
  border: 1px solid rgba(82, 183, 136, 0.25);
}

.sei-sync-head {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  margin-bottom: 0.85rem;
}

.sei-sync-head svg {
  width: 22px;
  height: 22px;
  color: var(--mint);
  flex-shrink: 0;
  margin-top: 2px;
}

.sei-sync-head strong {
  display: block;
  font-size: 0.9rem;
  color: #fff;
}

.sei-sync-head p {
  font-size: 0.72rem;
  opacity: 0.75;
  margin-top: 0.15rem;
}

.sei-mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  padding: 0.25rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
}

.sei-mode-btn {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.45rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.sei-mode-btn.active {
  background: var(--mint);
  color: var(--primary-dark);
}

.sei-manual-fields {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.sei-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.8);
}

.sei-field input[type="date"] {
  width: 100%;
  padding: 0.45rem 0.55rem;
  border-radius: 6px;
  border: 1px solid rgba(82, 183, 136, 0.35);
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  font-family: inherit;
  font-size: 0.8rem;
}

.sei-field input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.85);
}

.sei-auto-hint {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.sei-auto-hint span {
  display: block;
  margin-top: 0.25rem;
  font-weight: 600;
  color: var(--mint);
}

.btn-sei-sync {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.65rem 1rem;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--mint), #95d5b2);
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.2s;
}

.btn-sei-sync:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn-sei-sync:disabled {
  opacity: 0.55;
  cursor: wait;
}

.btn-sei-sync svg { width: 18px; height: 18px; }

/* Overlay de sincronização */
body.sei-syncing { overflow: hidden; }

.sei-sync-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 20, 14, 0.82);
  backdrop-filter: blur(8px);
  animation: seiFadeIn 0.25s ease;
}

.sei-sync-overlay[hidden] { display: none !important; }

@keyframes seiFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.sei-sync-modal {
  text-align: center;
  padding: 2rem 2.25rem;
  max-width: 360px;
  width: 90%;
  border-radius: var(--radius);
  background: linear-gradient(160deg, #1b4332, #0d2818);
  border: 1px solid rgba(82, 183, 136, 0.35);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}

.sei-sync-modal h3 {
  font-size: 1.1rem;
  color: #fff;
  margin-bottom: 0.35rem;
}

.sei-sync-step {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 1.25rem;
  min-height: 1.2em;
}

.sei-sync-spinner {
  width: 52px;
  height: 52px;
  margin: 0 auto 1.25rem;
  border-radius: 50%;
  border: 3px solid rgba(82, 183, 136, 0.2);
  border-top-color: var(--mint);
  animation: seiSpin 0.9s linear infinite;
}

@keyframes seiSpin {
  to { transform: rotate(360deg); }
}

.sei-sync-steps {
  list-style: none;
  text-align: left;
  font-size: 0.75rem;
  display: grid;
  gap: 0.4rem;
}

.sei-sync-steps li {
  padding: 0.4rem 0.55rem;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.45);
  transition: color 0.2s, background 0.2s;
}

.sei-sync-steps li.active {
  color: #fff;
  background: rgba(82, 183, 136, 0.15);
}

.sei-sync-steps li.done {
  color: var(--mint);
}

.sei-sync-steps li.done::before {
  content: '✓ ';
}

/* Documentos — sidebar */
.doc-status {
  margin-top: 0;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  background: rgba(82, 183, 136, 0.12);
  border: 1px solid rgba(82, 183, 136, 0.35);
}

.doc-status-badge {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.78rem;
}

.doc-status-badge svg {
  width: 16px;
  height: 16px;
  color: var(--mint);
  flex-shrink: 0;
  margin-top: 2px;
}

.doc-status-badge strong {
  display: block;
  font-size: 0.85rem;
  color: #fff;
}

.doc-status-badge span {
  opacity: 0.75;
  font-size: 0.72rem;
}

.doc-status-meta {
  margin-top: 0.45rem;
  font-size: 0.7rem;
  opacity: 0.8;
  line-height: 1.45;
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
}

.doc-status-meta svg { width: 12px; height: 12px; flex-shrink: 0; margin-top: 2px; }

.doc-merge-info {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.68rem;
  opacity: 0.85;
  color: rgba(255, 255, 255, 0.75);
}

.doc-history {
  margin-top: 0;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.doc-history h3,
.doc-compare-panel h3 {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.55;
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.doc-history h3 svg,
.doc-compare-panel h3 svg { width: 13px; height: 13px; }

.doc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 160px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(82, 183, 136, 0.4) transparent;
}

.doc-item-btn {
  width: 100%;
  text-align: left;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.6rem;
  color: #fff;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  align-items: flex-start;
  overflow: hidden;
}

.doc-item-btn:hover { background: rgba(255,255,255,0.1); border-color: rgba(82, 183, 136, 0.4); }

.doc-item-active .doc-item-btn {
  background: rgba(82, 183, 136, 0.15);
  border-color: rgba(82, 183, 136, 0.5);
}

.doc-item-sem {
  font-size: 0.62rem;
  font-weight: 700;
  background: rgba(255,255,255,0.12);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  white-space: nowrap;
}

.doc-item-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  min-width: 0;
}

.doc-item-name {
  flex: 1;
  font-size: 0.7rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.doc-item-merge {
  font-size: 0.58rem;
  font-style: normal;
  text-transform: uppercase;
  color: var(--mint);
  font-weight: 700;
  flex-shrink: 0;
}

.doc-item-date {
  font-size: 0.65rem;
  opacity: 0.65;
}

.doc-item-badge {
  font-size: 0.6rem;
  color: var(--mint);
  font-weight: 600;
  flex-shrink: 0;
}

.doc-compare-panel {
  margin-top: 0;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}

.doc-compare-fields {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.doc-compare-fields label span {
  display: block;
  font-size: 0.68rem;
  opacity: 0.65;
  margin-bottom: 0.2rem;
}

.doc-select {
  width: 100%;
  max-width: 100%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.5rem;
  font-size: 0.7rem;
  font-family: var(--font);
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-select option { background: var(--primary-dark); color: #fff; }

.btn-doc-compare {
  width: 100%;
  background: var(--mint);
  color: var(--primary-dark);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: opacity 0.15s;
}

.btn-doc-compare:hover { opacity: 0.9; }
.btn-doc-compare:disabled { opacity: 0.5; cursor: wait; }
.btn-doc-compare svg { width: 14px; height: 14px; }

/* Comparativo entre documentos */
.doc-compare-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.doc-compare-kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.doc-compare-kpi span { font-size: 0.75rem; color: var(--text-muted); }
.doc-compare-kpi strong { font-size: 1.4rem; color: var(--primary); }
.doc-compare-kpi em { font-size: 0.78rem; color: var(--text-muted); font-style: normal; }

.delta-up { color: #2E7D32; font-weight: 600; }
.delta-down { color: #C62828; font-weight: 600; }
.delta-neutral { color: var(--text-muted); }

/* PDF print */
@media print {
  .sidebar, .topbar { display: none; }
  .app-layout { grid-template-columns: 1fr; }
  .section { break-inside: avoid; }
}

/* ───── Checkbox on unit cards ───── */
.hero-unit-check {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  cursor: pointer;
  z-index: 2;
}

.hero-unit-check input { display: none; }

.hero-check-icon svg {
  width: 18px;
  height: 18px;
  color: rgba(255, 255, 255, 0.4);
  transition: color 0.15s;
}

.hero-unit-card:hover .hero-check-icon svg { color: rgba(255, 255, 255, 0.7); }

.hero-unit-selected {
  border-color: var(--mint) !important;
  box-shadow: 0 0 0 2px rgba(82, 183, 136, 0.35);
}

.hero-unit-selected .hero-check-icon svg { color: var(--mint); }

/* ───── Empty units collapse ───── */
.hero-empty-collapse {
  grid-column: 1 / -1;
}

.hero-empty-toggle {
  width: 100%;
  background: rgba(245, 158, 11, 0.08);
  border: 1px dashed var(--warning-border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1rem;
  color: var(--warning);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background 0.15s;
}

.hero-empty-toggle:hover { background: rgba(245, 158, 11, 0.14); }
.hero-empty-toggle svg { width: 16px; height: 16px; }

.hero-empty-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.75rem 0 0;
}

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

.hero-empty-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  padding: 0.25rem 0.55rem;
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-radius: 20px;
  color: #92400E;
}

.hero-empty-chip svg { width: 12px; height: 12px; color: var(--warning); }

/* ───── FAB (Floating Action Button) ───── */
.fab-compare {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
  color: #fff;
  border: none;
  border-radius: 28px;
  padding: 0.85rem 1.5rem;
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 8px 28px rgba(11, 61, 46, 0.35);
  z-index: 999;
  transition: transform 0.15s, box-shadow 0.15s;
  animation: fabSlideUp 0.3s ease-out;
}

.fab-compare:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 36px rgba(11, 61, 46, 0.45);
}

.fab-compare svg { width: 18px; height: 18px; }

@keyframes fabSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ───── Load more button ───── */
.btn-load-more {
  display: block;
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.65rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--primary);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-load-more:hover {
  background: var(--sage);
  border-color: var(--mint);
}

/* ───── Tag search input ───── */
.tag-search-input {
  width: 100%;
  padding: 0.5rem 0.65rem 0.5rem 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.82rem;
  color: var(--text);
  background: var(--surface);
  margin-bottom: 0.65rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.tag-search-input:focus {
  outline: none;
  border-color: var(--mint);
  box-shadow: 0 0 0 3px rgba(82, 183, 136, 0.15);
}

.tag-search-wrap {
  position: relative;
}

.tag-search-wrap > svg {
  position: absolute;
  left: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.tag-group-header {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0.5rem 0 0.3rem;
  grid-column: 1 / -1;
}

/* Técnico tag color */
.tag-técnico, .tag-tecnico { background: #FFF8E1; color: #8D6E00; border: 1px solid rgba(141, 110, 0, 0.2); }

@media (max-width: 1100px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    max-height: none;
    flex-direction: column;
  }
  .sidebar-body {
    overflow: visible;
    max-height: none;
  }
  .doc-list { max-height: 140px; }
  .hero-kpis { grid-template-columns: repeat(2, 1fr); }
  .comparacao-layout { grid-template-columns: 1fr; }
  .tag-filter-body { grid-template-columns: 1fr; }
  .tag-categories { flex-direction: row; flex-wrap: wrap; }
  .charts-grid { grid-template-columns: 1fr; }
  .unit-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  #dashboardContent { padding: 1rem; }
  .topbar { padding: 0 1rem; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Public polo dashboard ── */
body.public-app {
  --bg: #F0F5F2;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-solid: #FFFFFF;
  --ink: #0F2419;
  position: relative;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

body.polo-open { overflow: hidden; }

.ambient-layer {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}
.ambient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(48px);
  opacity: 0.55;
}
.ambient-orb-a {
  width: 420px; height: 420px;
  top: -80px; left: -60px;
  background: radial-gradient(circle, rgba(82,183,136,0.45), transparent 70%);
}
.ambient-orb-b {
  width: 380px; height: 380px;
  top: 20%; right: -100px;
  background: radial-gradient(circle, rgba(11,61,46,0.28), transparent 70%);
}
.ambient-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(11,61,46,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(11,61,46,0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, #000 20%, transparent 75%);
}

.public-shell {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 4.5rem;
}

.public-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2.25rem;
  padding: 1.05rem 1.35rem;
  background: linear-gradient(135deg, #062A1F 0%, #0B3D2E 55%, #145C3F 100%);
  color: #fff;
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(6, 42, 31, 0.28);
  border: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(8px);
}

.public-brand { display: flex; align-items: center; gap: 0.85rem; }
.public-brand-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  background: #fff;
  color: #9BE7BF;
  box-shadow: inset 0 0 0 1px rgba(155, 231, 191, 0.25);
  overflow: hidden;
  padding: 5px;
}
.public-brand-icon img { width: 100%; height: 100%; object-fit: contain; }
.public-brand h1 {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.public-brand p { font-size: 0.78rem; opacity: 0.68; }

.public-topbar-actions {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
}
.public-doc-meta {
  font-size: 0.78rem;
  opacity: 0.72;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
}

.btn-gestao-link {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.55rem 0.95rem;
  border-radius: 12px;
  background: rgba(255,255,255,0.12);
  color: #fff;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  transition: background 0.2s, transform 0.2s;
}
.btn-gestao-link:hover { background: rgba(255,255,255,0.22); transform: translateY(-1px); }

.eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #2D6A4F;
  margin-bottom: 0.55rem;
}

.public-hero {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 2.25rem;
  margin-bottom: 2rem;
  align-items: end;
}
.public-hero-title {
  font-family: var(--display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.05;
  color: var(--ink);
}
.title-accent {
  background: linear-gradient(110deg, #0B3D2E 15%, #52B788 45%, #D4A843 70%, #0B3D2E 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: accent-pan 8s ease-in-out infinite alternate;
}
@keyframes accent-pan {
  from { background-position: 0% 50%; }
  to { background-position: 100% 50%; }
}
.public-hero-sub {
  color: var(--text-muted);
  margin-top: 0.75rem;
  max-width: 36ch;
  font-size: 1.02rem;
  line-height: 1.55;
}

.public-hero-kpis {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
.ph-kpi {
  background: var(--surface-solid);
  border: 1px solid rgba(11,61,46,0.08);
  border-radius: 16px;
  padding: 1rem 1.05rem;
  box-shadow: 0 10px 28px rgba(11, 61, 46, 0.06);
  position: relative;
  overflow: hidden;
}
.ph-kpi::after {
  content: '';
  position: absolute;
  inset: auto -20% -40% auto;
  width: 90px; height: 90px;
  background: radial-gradient(circle, rgba(82,183,136,0.18), transparent 70%);
  pointer-events: none;
}
.ph-kpi-label {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
  font-weight: 600;
}
.ph-kpi strong {
  font-family: var(--display);
  font-size: 1.65rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}
.ph-kpi-primary {
  background: linear-gradient(150deg, #0B3D2E 0%, #145C3F 100%);
  border-color: rgba(255, 255, 255, 0.1);
  color: #fff;
  box-shadow: 0 14px 32px rgba(6, 42, 31, 0.28);
  animation: kpi-breathe 5s ease-in-out infinite;
}
@keyframes kpi-breathe {
  0%, 100% { box-shadow: 0 14px 32px rgba(6, 42, 31, 0.28); }
  50% { box-shadow: 0 16px 40px rgba(6, 42, 31, 0.4), 0 0 24px rgba(82, 183, 136, 0.22); }
}
.ph-kpi-primary .ph-kpi-label { color: #9BE7BF; }
.ph-kpi-primary::after {
  background: radial-gradient(circle, rgba(155, 231, 191, 0.28), transparent 70%);
}

.overview-charts {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr;
  gap: 1.15rem;
  margin-bottom: 2rem;
}
/* min-width evita o "grid blowout": sem isso o canvas do Chart.js
   trava a largura do painel e a página ganha scroll horizontal */
.overview-charts > *,
.public-hero > *,
.focus-rail > *,
.polo-tables > * {
  min-width: 0;
}
.chart-wrap canvas { max-width: 100%; }
.chart-panel {
  background: var(--surface-solid);
  border: 1px solid rgba(11,61,46,0.08);
  border-radius: 18px;
  padding: 1rem 1.1rem 1.15rem;
  box-shadow: 0 10px 28px rgba(11, 61, 46, 0.05);
}
.chart-panel-wide { grid-column: 1 / -1; }
.chart-panel-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid rgba(11, 61, 46, 0.07);
}
.chart-panel-head h3 {
  font-family: var(--display);
  font-size: 0.98rem;
  font-weight: 700;
}
.chart-panel-head span {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.chart-wrap-lg { height: 240px; position: relative; }
.chart-wrap-md { height: 200px; position: relative; }

.public-filters {
  background: var(--surface-solid);
  border: 1px solid rgba(11,61,46,0.08);
  border-radius: 18px;
  padding: 1.15rem 1.25rem;
  margin-bottom: 1.85rem;
  box-shadow: 0 10px 28px rgba(11, 61, 46, 0.05);
}
.filter-row {
  display: grid;
  grid-template-columns: 1.8fr 0.55fr 1fr 0.85fr 1.1fr;
  gap: 0.75rem;
}
.filter-field { display: flex; flex-direction: column; gap: 0.3rem; }
.filter-field span {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 700;
}
.filter-field input,
.filter-field select {
  font: inherit;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.6rem 0.8rem;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.filter-field input:focus,
.filter-field select:focus {
  outline: none;
  border-color: var(--mint);
  box-shadow: 0 0 0 3px rgba(82,183,136,0.2);
}
.parceiro-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
}
.parceiro-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.75rem 0.35rem 0.4rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.parceiro-chip:hover {
  border-color: var(--mint);
}
.parceiro-chip.is-active {
  border-color: var(--forest, #0B3D2E);
  background: rgba(11, 61, 46, 0.06);
  box-shadow: 0 0 0 2px rgba(82,183,136,0.25);
}
.parceiro-chip-logo {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  background: #f1f5f9;
  flex-shrink: 0;
}
.parceiro-chip--plain {
  padding-left: 0.75rem;
}
.filter-summary {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.polos-board {
  margin-bottom: 2rem;
}
.polos-board-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 1rem;
}
.polos-board-head h3 {
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.board-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}
.section-count {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: var(--sage);
  color: var(--primary);
}

.polos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1.15rem;
}

.polo-card {
  position: relative;
  text-align: left;
  border: 1px solid rgba(11,61,46,0.1);
  background: var(--surface-solid);
  border-radius: 18px;
  padding: 1.1rem 1.15rem;
  cursor: pointer;
  font: inherit;
  color: inherit;
  box-shadow: 0 8px 24px rgba(11, 61, 46, 0.05);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.25s, transform 0.2s;
}
.polo-card-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(125deg, transparent 40%, rgba(82,183,136,0.08) 50%, transparent 60%);
  transform: translateX(-120%);
  pointer-events: none;
}
.polo-card:hover {
  border-color: rgba(82, 183, 136, 0.55);
  box-shadow: 0 18px 40px rgba(11, 61, 46, 0.12);
  transform: translateY(-3px);
}
.polo-card:hover .polo-card-shine {
  animation: shine-sweep 0.85s ease;
}
@keyframes shine-sweep {
  to { transform: translateX(120%); }
}
.polo-card:focus-visible {
  outline: 3px solid rgba(82,183,136,0.45);
  outline-offset: 2px;
}
.polo-card-top {
  display: flex; justify-content: space-between; gap: 0.5rem; align-items: flex-start;
}
.polo-card-top strong {
  font-family: var(--display);
  font-size: 1.02rem;
  line-height: 1.25;
  letter-spacing: -0.015em;
}
.polo-card-alunos {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, #D8F3DC, #BBF7D0);
  color: #0B3D2E;
  padding: 0.2rem 0.55rem;
  border-radius: 10px;
  font-size: 0.88rem;
}
.polo-card-loc {
  margin: 0.4rem 0 0.85rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.polo-sede-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.1rem;
}

.sede-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: #0B3D2E;
  color: #D8F3DC;
}

.polo-card.is-sede {
  border-color: rgba(11, 61, 46, 0.22);
  background:
    linear-gradient(160deg, rgba(216, 243, 220, 0.45) 0%, transparent 42%),
    var(--surface, #fff);
}

.polo-esteira { display: flex; flex-direction: column; gap: 0.55rem; }
.phase-sausages {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.32rem;
  width: 100%;
}
.phase-sausage {
  flex: 0 0 auto;
  width: 22px;
  height: 10px;
  border-radius: 999px;
  background: #E5EBF0;
  opacity: 0.7;
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s, opacity 0.2s;
}
.phase-sausage.is-done {
  opacity: 1;
  background: #4ADE80;
}
.phase-sausage.is-current {
  opacity: 1;
  width: 28px;
  height: 12px;
  background: #0B3D2E;
  box-shadow: 0 0 0 3px rgba(11, 61, 46, 0.18);
  transform: none;
}
.phase-sausage.is-current[data-stage="inativo"] {
  background: #64748B;
  box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.25);
}
.phase-sausage.is-current[data-stage="contrato_assinado"] {
  background: #4F46E5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.22);
}
.phase-sausage.is-current[data-stage="situacao_fachada"] {
  background: #D97706;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.22);
}
.phase-sausage.is-current[data-stage="cadastro_mec"] {
  background: #DB2777;
  box-shadow: 0 0 0 3px rgba(219, 39, 119, 0.22);
}
.phase-sausage.is-current[data-stage="inicio_captacao"] {
  background: #0891B2;
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.22);
}
.phase-sausage.is-current[data-stage="ativo"] {
  background: #15803D;
  box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.22);
}

.polo-esteira-bar { display: none; }
.polo-esteira-bar span { display: none; }
.polo-stage-badge {
  align-self: flex-start;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.22rem 0.58rem;
  border-radius: 999px;
  background: var(--sage);
  color: var(--primary);
}
.polo-stage-badge[data-stage="inativo"] { background: #E2E8F0; color: #475569; }
.polo-stage-badge[data-stage="ativo"] { background: #BBF7D0; color: #166534; }
.polo-stage-badge[data-stage="contrato_assinado"] { background: #E0E7FF; color: #3730A3; }
.polo-stage-badge[data-stage="situacao_fachada"] { background: #FEF3C7; color: #92400E; }
.polo-stage-badge[data-stage="cadastro_mec"] { background: #FCE7F3; color: #9D174D; }
.polo-stage-badge[data-stage="inicio_captacao"] { background: #CFFAFE; color: #155E75; }

.polos-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2.25rem 1rem;
  color: var(--text-muted);
  background: rgba(255,255,255,0.65);
  border: 1px dashed var(--border);
  border-radius: 16px;
}

/* Overlay panel */
.polo-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  justify-items: end;
}
.polo-overlay[hidden] { display: none !important; }
.polo-overlay-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: rgba(6, 22, 16, 0.48);
  backdrop-filter: blur(6px);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
}
.polo-panel {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  height: 100%;
  background: #FBFDFA;
  box-shadow: -24px 0 64px rgba(6, 42, 31, 0.28);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.polo-panel-glow {
  position: absolute;
  top: -80px; right: -40px;
  width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(82,183,136,0.35), transparent 70%);
  pointer-events: none;
}
.polo-panel-inner {
  position: relative;
  overflow-y: auto;
  padding: 1.25rem 1.25rem 2.5rem;
  height: 100%;
}

.polo-detail-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.85rem;
  align-items: start;
  margin-bottom: 1.25rem;
}
.polo-detail-titles h3 {
  font-family: var(--display);
  font-size: 1.55rem;
  letter-spacing: -0.025em;
  line-height: 1.15;
}
.polo-detail-sub { color: var(--text-muted); font-size: 0.88rem; margin-top: 0.3rem; }

.btn-back {
  display: inline-flex; align-items: center; gap: 0.35rem;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 12px;
  padding: 0.5rem 0.75rem;
  font: inherit;
  cursor: pointer;
  color: var(--text);
  flex-shrink: 0;
  transition: background 0.15s;
}
.btn-back:hover { background: var(--sage); }

.esteira-track {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.esteira-step {
  text-align: center;
  padding: 0.7rem 0.35rem;
  border-radius: 14px;
  background: #F1F5F3;
  border: 1px solid transparent;
}
.esteira-step.is-done { background: #D8F3DC; }
.esteira-step.is-current {
  border-color: #52B788;
  box-shadow: 0 0 0 3px rgba(82, 183, 136, 0.22);
  background: #EEFBF3;
}
.esteira-step[data-stage="inativo"].is-current {
  border-color: #94A3B8;
  box-shadow: 0 0 0 3px rgba(148,163,184,0.25);
  background: #F8FAFC;
}
.esteira-dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #C5D5CB;
  margin-bottom: 0.3rem;
}
.esteira-step.is-done .esteira-dot,
.esteira-step.is-current .esteira-dot { background: var(--primary); }
.esteira-label { display: block; font-size: 0.68rem; font-weight: 700; line-height: 1.25; }

.detail-kpis {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
  margin-bottom: 1.15rem;
}
.detail-kpi {
  background: #fff;
  border-radius: 14px;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(11,61,46,0.08);
}
.detail-kpi span {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.2rem;
  font-weight: 700;
}
.detail-kpi strong {
  font-family: var(--display);
  font-size: 1.3rem;
  letter-spacing: -0.02em;
}

.detail-charts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  margin-bottom: 1.15rem;
}
.detail-charts .chart-card {
  background: #fff;
  border: 1px solid rgba(11,61,46,0.08);
  border-radius: 14px;
  padding: 0.85rem 1rem;
}
.detail-charts .chart-card h4 {
  font-size: 0.85rem;
  margin-bottom: 0.45rem;
  font-family: var(--display);
}
.detail-charts .chart-wrap { height: 200px; position: relative; }

.detail-section {
  background: #fff;
  border: 1px solid rgba(11,61,46,0.08);
  border-radius: 14px;
  padding: 0.85rem 1rem 1rem;
  margin-bottom: 0.85rem;
}
.detail-section .section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.55rem;
}
.detail-section .section-header h3 {
  font-family: var(--display);
  font-size: 0.95rem;
}

.public-inst-section {
  margin-top: 2rem;
  background: var(--surface-solid);
  border: 1px solid rgba(11,61,46,0.08);
  border-radius: 18px;
  padding: 1.15rem 1.25rem;
  box-shadow: 0 10px 28px rgba(11, 61, 46, 0.05);
}
.outras-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}
.outra-card {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  background: #F6FAF7;
  border: 1px solid rgba(11,61,46,0.07);
  border-radius: 14px;
  padding: 0.95rem 1rem;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.outra-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(11,61,46,0.08);
  border-color: rgba(82, 183, 136, 0.5);
}
.outra-card:focus-visible {
  outline: 3px solid rgba(82,183,136,0.45);
  outline-offset: 2px;
}
.outra-card.is-selected {
  border-color: #52B788;
  background: #EEFBF3;
  box-shadow: 0 0 0 3px rgba(82,183,136,0.28), 0 12px 28px rgba(11, 61, 46, 0.1);
}
.outra-card strong {
  display: block;
  margin-bottom: 0.25rem;
  font-family: var(--display);
}
.outra-card > span { display: block; font-size: 0.82rem; color: var(--text-muted); }
.outra-card-cta {
  margin-top: 0.6rem;
  display: inline-flex !important;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem !important;
  font-weight: 700;
  color: var(--primary) !important;
}
.outra-card-cta svg {
  width: 14px; height: 14px;
  transition: transform 0.2s;
}
.outra-card:hover .outra-card-cta svg { transform: translateX(3px); }

.public-toast {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  max-width: 360px;
  background: var(--primary-dark);
  color: #fff;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 90;
  font-size: 0.9rem;
}
.public-toast.is-error { background: #7F1D1D; }

.empty-row { text-align: center; color: var(--text-muted); padding: 1rem !important; }

@media (max-width: 960px) {
  .public-hero { grid-template-columns: 1fr; }
  .overview-charts { grid-template-columns: 1fr; }
  .filter-row { grid-template-columns: 1fr 1fr; }
  .polo-detail-head { grid-template-columns: auto 1fr; }
  .polo-detail-head .polo-stage-badge { grid-column: 2; justify-self: start; }
}
@media (max-width: 560px) {
  .filter-row { grid-template-columns: 1fr; }
  .public-hero-kpis { grid-template-columns: 1fr 1fr; }
  .esteira-track { grid-template-columns: 1fr 1fr; }
  .polo-panel { width: 100%; }
  .ranking-head { flex-direction: column; align-items: stretch; }
  .ranking-head-actions { justify-content: flex-start; }
  .ranking-area-field select { min-width: 0; flex: 1 1 10rem; }
}

@media (prefers-reduced-motion: reduce) {
  .polo-card:hover .polo-card-shine { animation: none; }
  .ambient-orb { transition: none; }
  .title-accent { animation: none; }
  .ph-kpi-primary { animation: none; }
  .polo-card:hover { transform: none; }
}


/* Selection focus */
.btn-clear-selection {
  margin-top: 1.1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid rgba(11,61,46,0.15);
  background: #fff;
  color: var(--primary);
  border-radius: 12px;
  padding: 0.55rem 0.9rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.btn-clear-selection:hover { background: var(--sage); transform: translateY(-1px); }

.focus-rail {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1.15rem;
  margin-bottom: 2rem;
}
.focus-rail-card {
  background: var(--surface-solid);
  border: 1px solid rgba(11,61,46,0.08);
  border-radius: 18px;
  padding: 1.15rem 1.25rem;
  box-shadow: 0 10px 28px rgba(11, 61, 46, 0.05);
}
.focus-rail-card h3 {
  font-family: var(--display);
  font-size: 0.95rem;
  margin-bottom: 0.85rem;
}
.esteira-track-inline {
  grid-template-columns: repeat(3, 1fr);
}
.admins-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}
.admin-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  background: #EEFBF3;
  border: 1px solid rgba(82,183,136,0.35);
  font-weight: 600;
  font-size: 0.88rem;
}
.admins-empty {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.polo-card.is-selected {
  border-color: #52B788;
  box-shadow: 0 0 0 3px rgba(82,183,136,0.28), 0 18px 40px rgba(11, 61, 46, 0.12);
}
.polo-card.is-dimmed {
  opacity: 0.55;
  filter: saturate(0.75);
}
.polo-card.is-dimmed:hover { opacity: 0.85; }

.polo-card-admins {
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.polo-card-admins svg { width: 14px; height: 14px; flex-shrink: 0; }

.polo-parceiro-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.55rem;
}
.parceiro-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  max-width: 100%;
  padding: 0.18rem 0.5rem 0.18rem 0.22rem;
  border-radius: 999px;
  border: 1px solid rgba(11, 61, 46, 0.12);
  background: rgba(11, 61, 46, 0.04);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--primary, #0B3D2E);
  line-height: 1.2;
}
.parceiro-tag-logo {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: #e2e8f0;
}

.polo-tables {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.15rem;
  margin-bottom: 2rem;
}
.table-panel {
  background: var(--surface-solid);
  border: 1px solid rgba(11,61,46,0.08);
  border-radius: 18px;
  padding: 1rem 1.15rem 1.15rem;
  box-shadow: 0 10px 28px rgba(11, 61, 46, 0.05);
}
.table-panel .section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}
.table-panel .section-header h3 {
  font-family: var(--display);
  font-size: 0.98rem;
}

.turma-alunos-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.turma-alunos-n {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--primary);
  min-width: 1.5rem;
}
.btn-turma-alunos {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 10px;
  border: 1px solid rgba(11, 61, 46, 0.14);
  background: #fff;
  color: var(--primary);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s, box-shadow 0.15s;
}
.btn-turma-alunos svg {
  width: 15px;
  height: 15px;
}
.btn-turma-alunos:hover {
  border-color: var(--mint, #52B788);
  background: rgba(82, 183, 136, 0.12);
  box-shadow: 0 0 0 3px rgba(82, 183, 136, 0.16);
  transform: translateY(-1px);
}

.turma-alunos-modal {
  margin: auto;
  border: none;
  padding: 0;
  width: min(520px, calc(100vw - 1.5rem));
  max-height: min(84vh, 720px);
  background: transparent;
  color: inherit;
}
.turma-alunos-modal::backdrop {
  background: rgba(6, 22, 16, 0.55);
  backdrop-filter: blur(5px);
}
.turma-alunos-box {
  background: var(--surface-solid, #fff);
  border: 1px solid rgba(11, 61, 46, 0.1);
  border-radius: 20px;
  box-shadow: 0 28px 70px rgba(6, 42, 31, 0.28);
  display: flex;
  flex-direction: column;
  max-height: min(84vh, 720px);
  overflow: hidden;
}
.turma-alunos-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.85rem;
  align-items: start;
  padding: 1.2rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(11, 61, 46, 0.08);
  background:
    linear-gradient(180deg, rgba(82, 183, 136, 0.1), transparent 70%),
    #fff;
}
.turma-alunos-icon {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: rgba(11, 61, 46, 0.08);
  color: var(--primary);
}
.turma-alunos-icon svg { width: 1.2rem; height: 1.2rem; }
.turma-alunos-eyebrow {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.turma-alunos-head-text h3 {
  margin: 0.15rem 0 0.2rem;
  font-family: var(--display);
  font-size: 1.05rem;
  line-height: 1.25;
  color: var(--primary);
}
.turma-alunos-meta {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.35;
}
.turma-alunos-close {
  width: 2rem;
  height: 2rem;
  border-radius: 10px;
  border: 1px solid rgba(11, 61, 46, 0.12);
  background: #fff;
  color: var(--text-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.turma-alunos-close svg { width: 16px; height: 16px; }
.turma-alunos-close:hover {
  color: var(--primary);
  border-color: rgba(11, 61, 46, 0.25);
}
.turma-alunos-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem 0.55rem;
}
.turma-alunos-count {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
  background: rgba(11, 61, 46, 0.07);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  white-space: nowrap;
}
.turma-alunos-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--border, rgba(11,61,46,0.14));
  border-radius: 12px;
  padding: 0.4rem 0.7rem;
  background: #fff;
}
.turma-alunos-search svg {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.turma-alunos-search input {
  border: 0;
  outline: none;
  width: 100%;
  font: inherit;
  font-size: 0.86rem;
  background: transparent;
}
.turma-alunos-list {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0.85rem 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  scrollbar-width: thin;
}
.turma-aluno-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.7rem;
  align-items: center;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  background: #F6FAF7;
  border: 1px solid rgba(11, 61, 46, 0.06);
}
.turma-aluno-idx {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.turma-aluno-info strong {
  display: block;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.25;
}
.turma-aluno-info span {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.turma-alunos-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 1.5rem 1rem;
  font-size: 0.9rem;
}

@media (max-width: 560px) {
  .turma-alunos-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}

body.is-polo-focused .public-hero-title {
  font-size: clamp(1.7rem, 3.4vw, 2.4rem);
}

@media (max-width: 960px) {
  .focus-rail, .polo-tables { grid-template-columns: 1fr; }
}


/* Pendência + ranking */
.dash-morph { will-change: transform, opacity; }

.pendencia-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  margin-bottom: 1.75rem;
  padding: 1rem 1.15rem;
  border-radius: 16px;
  border: 1px solid rgba(180, 83, 9, 0.28);
  background: linear-gradient(135deg, #FFFBEB, #FEF3C7);
  color: #78350F;
  box-shadow: 0 10px 28px rgba(180, 83, 9, 0.08);
}
.pendencia-banner.is-ok {
  border-color: rgba(21, 128, 61, 0.25);
  background: linear-gradient(135deg, #F0FDF4, #DCFCE7);
  color: #14532D;
}
.pendencia-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: rgba(255,255,255,0.65);
  flex-shrink: 0;
}
.pendencia-body { flex: 1; min-width: 0; }
.pendencia-body strong {
  display: block;
  font-family: var(--display);
  font-size: 1rem;
  margin-bottom: 0.2rem;
}
.pendencia-body p { font-size: 0.9rem; line-height: 1.45; opacity: 0.92; }

.ranking-section {
  background: var(--surface-solid);
  border: 1px solid rgba(11,61,46,0.08);
  border-radius: 18px;
  padding: 1.2rem 1.3rem 1.35rem;
  margin-bottom: 2rem;
  box-shadow: 0 10px 28px rgba(11, 61, 46, 0.05);
}
.ranking-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.ranking-head-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.ranking-area-field {
  display: contents;
}
.ranking-area-field select,
.btn-ranking-toggle {
  box-sizing: border-box;
  height: 2.25rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
  color: var(--primary);
  background-color: #fff;
  border: 1px solid rgba(11, 61, 46, 0.16);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.ranking-area-field select {
  appearance: none;
  -webkit-appearance: none;
  min-width: 10.5rem;
  padding: 0 2rem 0 0.9rem;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%230B3D2E' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  background-size: 14px;
}
.ranking-area-field select:focus,
.btn-ranking-toggle:focus {
  outline: none;
  border-color: var(--mint, #52B788);
  box-shadow: 0 0 0 3px rgba(82, 183, 136, 0.18);
}
.btn-ranking-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0 0.9rem;
  white-space: nowrap;
}
.btn-ranking-toggle svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}
.btn-ranking-toggle:hover:not(:disabled) {
  border-color: var(--mint, #52B788);
  box-shadow: 0 0 0 3px rgba(82, 183, 136, 0.18);
}
.btn-ranking-toggle.is-active {
  background: rgba(11, 61, 46, 0.07);
  border-color: var(--primary);
}
.btn-ranking-toggle:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.ranking-head-actions .section-count {
  box-sizing: border-box;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  padding: 0 0.7rem;
  margin: 0;
}
.ranking-head h3 {
  font-family: var(--display);
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.ranking-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.ranking-list.is-expanded {
  max-height: min(70vh, 560px);
  overflow-y: auto;
  padding-right: 0.25rem;
  scrollbar-width: thin;
}
.ranking-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.85rem;
  align-items: center;
  padding: 0.75rem 0.9rem;
  border-radius: 14px;
  background: #F6FAF7;
  border: 1px solid rgba(11,61,46,0.06);
}
.ranking-pos {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 3.2rem;
  color: var(--primary);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.ranking-pos svg { width: 18px; height: 18px; }
.ranking-info strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 0.1rem;
}
.ranking-info span {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.ranking-metric {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
  color: var(--primary);
}
.ranking-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 1.25rem;
}

.status-hint {
  margin: 0 0 0.95rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  background: rgba(11,61,46,0.04);
}

/* hidden must win over display:flex utilities */
.pendencia-banner[hidden],
.focus-rail[hidden],
.polo-tables[hidden],
.btn-clear-selection[hidden],
.btn-ranking-toggle[hidden],
.public-inst-section[hidden] {
  display: none !important;
}

/* Skeleton de carregamento dos polos */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.polo-skeleton {
  height: 148px;
  border-radius: 18px;
  border: 1px solid rgba(11, 61, 46, 0.08);
  background: linear-gradient(100deg,
    rgba(255, 255, 255, 0.9) 40%,
    rgba(216, 243, 220, 0.75) 50%,
    rgba(255, 255, 255, 0.9) 60%);
  background-size: 220% 100%;
  animation: skeleton-sweep 1.4s ease-in-out infinite;
}

@keyframes skeleton-sweep {
  from { background-position: 130% 0; }
  to { background-position: -30% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .polo-skeleton { animation: none; background: rgba(255, 255, 255, 0.85); }
}

/* Medalhas do ranking */
.ranking-item[data-pos="1"] .ranking-pos { color: #B8860B; }
.ranking-item[data-pos="2"] .ranking-pos { color: #64748B; }
.ranking-item[data-pos="3"] .ranking-pos { color: #B45309; }
.ranking-item[data-pos="1"] {
  border-color: rgba(212, 168, 67, 0.45);
  background: linear-gradient(90deg, #FFF8E7 0%, #F6FAF7 55%);
}

/* ── Rodapé público ── */
.public-footer {
  position: relative;
  z-index: 2;
  margin-top: 3.5rem;
  background:
    radial-gradient(80% 120% at 0% 0%, rgba(82, 183, 136, 0.18), transparent 55%),
    linear-gradient(180deg, #0B3D2E 0%, #062A1F 100%);
  color: rgba(255, 255, 255, 0.88);
  border-top: 1px solid rgba(155, 231, 191, 0.18);
}

.public-footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 2rem;
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 2rem 2.5rem;
  align-items: start;
}

.public-footer-brand {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.public-footer-logo {
  height: 44px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
  object-position: left center;
}

.public-footer-tag {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(216, 243, 220, 0.7);
}

.public-footer-contacts {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.public-footer-link {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: #fff;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.15s, transform 0.15s;
}

.public-footer-link svg {
  width: 17px;
  height: 17px;
  color: #9BE7BF;
  flex-shrink: 0;
}

.public-footer-link:hover {
  color: #D8F3DC;
  transform: translateX(2px);
}

.public-footer-meta {
  font-size: 0.86rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.72);
}

.public-footer-meta strong {
  color: #9BE7BF;
  font-weight: 700;
}

.public-footer-copy {
  margin-top: 0.85rem;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.5);
}

@media (max-width: 860px) {
  .public-footer-inner {
    grid-template-columns: 1fr;
    gap: 1.75rem;
    padding: 2rem 1.25rem 1.75rem;
  }
}

