@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root, [data-theme="light"] {
  --bg: #eef2f0;
  --card-grad: #ffffff;
  --card-border: #e6ede8;
  --header-bg: #ffffff;
  --header-border: #e1e9e4;
  --ink-primary: #0c2c23;
  --ink-secondary: #11332a;
  --text-muted: #8aa097;
  --track-bg: #eef2f0;
  --primary-green: #00875a;
  --hero-green-start: #00734a;
  --hero-green-end: #004d30;
  --blue-vaf: #3f6fd1;
  --amber-igual: #e08a0b;
}

[data-theme="dark"] {
  --bg: #08231c;
  --card-grad: #0f2c24;
  --card-border: #1d3f34;
  --header-bg: #0c2620;
  --header-border: #1d3f34;
  --ink-primary: #f1faf5;
  --ink-secondary: #eaf5ef;
  --text-muted: #7fa395;
  --track-bg: #16382d;
  --primary-green: #2fbe85;
  --hero-green-start: #0c8a5b;
  --hero-green-end: #053b27;
  --blue-vaf: #5b8cf0;
  --amber-igual: #f0a93a;
}

/* Reset and Layout Lock */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body, #_dash-app-content {
  min-height: 100%;
  background: var(--bg);
  color: var(--ink-secondary);
  font-family: 'IBM Plex Sans', sans-serif;
}

.dashboard-root {
  min-height: 100vh;
  width: 100%;
  min-width: 1100px;
  display: flex;
  flex-direction: column;
}

.skip-link {
  position: absolute;
  top: -999px;
  left: -999px;
  z-index: 9999;
  background: var(--header-bg);
  padding: 8px;
}
.skip-link:focus {
  top: 0;
  left: 0;
}

/* Header */
.app-header {
  height: 78px;
  flex: none;
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
}

.header-brand {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--ink-primary);
  letter-spacing: -0.01em;
}

.brand-subtitle {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-top: 2px;
}

/* Nav Tabs */
.header-nav {
  display: flex;
  background: var(--track-bg);
  border-radius: 10px;
  padding: 4px;
}

.nav-tab {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  padding: 8px 15px;
  transition: all 0.2s ease;
}

.nav-tab[aria-current="page"], .nav-tab.active {
  background: var(--primary-green);
  color: #fff;
  border-radius: 7px;
}

/* Header Controls */
.header-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.filters-container {
  display: flex;
  gap: 12px;
}

.filter-chip {
  display: flex;
  flex-direction: column;
}
.filter-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: -2px;
  padding-left: 10px;
}
.filter-chip .Select-control {
  background: var(--header-bg);
  border: 1px solid var(--header-border);
  border-radius: 6px;
  box-shadow: none;
  min-height: 32px;
  min-width: 120px;
}
.filter-chip .Select-value-label {
  color: var(--ink-primary) !important;
  font-weight: 600;
  font-size: 13px;
}
.filter-chip .Select-menu-outer {
  background: var(--header-bg);
  border: 1px solid var(--header-border);
  color: var(--ink-primary);
  font-size: 13px;
}

.theme-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--ink-primary);
}

/* Main Content Area */
.page-content {
  flex: 1;
  padding: 20px 32px;
  display: flex;
  flex-direction: column;
}

#_pages_content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

#_pages_content > div {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Cards */
.card {
  background: var(--card-grad);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-primary);
}

.card-subtitle {
  font-size: 11.5px;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 4px;
  margin-bottom: 12px;
}

/* ---- KPI Hero ---- */
.card-hero-green {
  background: linear-gradient(135deg, var(--hero-green-start), var(--hero-green-end));
  border-radius: 16px;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #eafff6;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}
.card-hero-green::before {
  content: "";
  position: absolute;
  right: -30px;
  top: -30px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  pointer-events: none;
}
.hero-title-lbl { font-size: 11px; letter-spacing: 0.14em; font-weight: 600; opacity: 0.8; }
.hero-total-val { font-size: 52px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; margin-top: 8px; white-space: nowrap; }
.hero-total-unit { font-size: 28px; font-weight: 600; opacity: 0.85; margin-left: 6px; }
.hero-sub { font-size: 13px; opacity: 0.78; margin-top: 8px; }

/* ---- KPI Cards ---- */
.kpi-card {
  background: var(--card-grad);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.kpi-label { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; }
.kpi-value-container { margin-top: 6px; line-height: 1; }
.kpi-value { font-size: 34px; font-weight: 700; color: var(--ink-primary); letter-spacing: -0.02em; }
.kpi-unit { font-size: 18px; font-weight: 600; color: var(--text-muted); margin-left: 4px; }
.kpi-note { font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.kpi-progress { height: 6px; background: var(--track-bg); border-radius: 4px; overflow: hidden; }
.kpi-progress > div { height: 100%; border-radius: 4px; }

/* Typography Utilities */
.text-mono {
  font-family: 'IBM Plex Mono', monospace;
}

.text-hero-num {
  font-size: 46px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.text-kpi-num {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink-primary);
}

.text-cq-num {
  font-size: 58px;
  font-weight: 700;
  font-family: 'IBM Plex Mono', monospace;
}

/* Grid Layouts */
.grid-visao-geral {
  flex: 1;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1.12fr;
  gap: 18px;
  min-height: 450px;
}

.grid-kpi-band {
  display: grid;
  grid-template-columns: 1.18fr 1fr 1fr 1fr;
  gap: 18px;
  height: 150px;
  flex: none;
}

.kpi-hero {
  border-top: none !important;
  position: relative;
  overflow: hidden;
}

.col-flex {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 0;
}

/* Footer */
.app-footer {
  height: 26px;
  flex: none;
  background: var(--header-bg);
  border-top: 1px solid var(--card-border);
  font-size: 10.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  padding: 0 32px;
}

/* ---- Scatter DRE legend (HTML, abaixo do gráfico Plotly) ---- */
.vg-scatter-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 8px;
  flex: none;
}
.vg-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  color: var(--text-muted);
}
.vg-legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
}

/* ---- Timeline (Faixa Ciclo D-2) ---- */
.timeline-container {
  display: flex;
  align-items: flex-start;
  background: var(--card-grad);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 20px 24px;
  margin-top: 4px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}
.timeline-brand {
  width: 220px;
  flex-shrink: 0;
  padding-right: 20px;
  border-right: 1px solid var(--card-border);
  margin-right: 20px;
}
.timeline-title-main { font-size: 13px; font-weight: 800; color: var(--primary-green); text-transform: uppercase; letter-spacing: 1px; }
.timeline-sub-main { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.timeline-track {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  position: relative;
}
.timeline-line {
  position: absolute;
  top: 15px;
  left: 5%; right: 5%;
  height: 1px;
  background: var(--primary-green); opacity: 0.5;
  z-index: 1;
}
.timeline-node {
  background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  position: relative; z-index: 2;
  width: 160px;
  transition: transform 0.15s;
  padding: 0;
}
.timeline-node:hover { transform: scale(1.05); }
.node-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--text-muted);
  margin-bottom: 12px;
  margin-top: 8px;
  box-shadow: 0 0 0 4px var(--bg);
}
.node-dot.blue  { border-color: var(--blue-vaf); }
.node-dot.amber { border-color: var(--amber-igual); }
.node-dot.green { border-color: var(--primary-green); }
.node-dot.empty { border-color: var(--text-muted); border-width: 2px; border-style: dashed; }
.node-dot.active.blue  { background: var(--blue-vaf);     box-shadow: 0 0 0 4px var(--bg), 0 0 0 7px rgba(91,140,240,.2); }
.node-dot.active.amber { background: var(--amber-igual);  box-shadow: 0 0 0 4px var(--bg), 0 0 0 7px rgba(240,169,58,.2); }
.node-dot.active.green { background: var(--primary-green);box-shadow: 0 0 0 4px var(--bg), 0 0 0 7px rgba(47,190,133,.2); }
.node-title { font-size: 13px; font-weight: 800; color: var(--ink-primary); text-align: center; }
.node-sub   { font-size: 11px; color: var(--text-muted); margin-top: 2px; text-align: center; }

/* ============================================================
   Ranking & Potencial (redesign handoff §7) — 100% CSS, theme-aware
   ============================================================ */

.rk-page {
  flex: 1;
  display: flex;
  flex-direction: row;
  gap: 20px;
  min-height: 0;
}
/* vence o seletor por id que força flex-direction:column nas páginas */
#_pages_content > div.rk-page { flex-direction: row; }

/* ---- Painel esquerdo: lista ---- */
.rk-list-card {
  width: 480px;
  flex: none;
  background: var(--card-grad);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.rk-list-head {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--card-border);
  flex: none;
}
.rk-list-title { font-size: 15px; font-weight: 700; color: var(--ink-primary); }
.rk-list-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.rk-list-foot {
  padding: 9px 22px;
  border-top: 1px solid var(--card-border);
  font-size: 10.5px;
  color: var(--text-muted);
  flex: none;
}

.rank-list { overflow-y: auto; flex: 1; }
.rank-list::-webkit-scrollbar { width: 5px; }
.rank-list::-webkit-scrollbar-track { background: transparent; }
.rank-list::-webkit-scrollbar-thumb { background: var(--card-border); border-radius: 4px; }

.rk-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  cursor: pointer;
  border-left: 3px solid transparent;
  border-bottom: 1px solid var(--card-border);
  transition: background 0.15s ease;
}
.rk-row:hover { background: rgba(47, 190, 133, 0.06); }
.rk-row.sel {
  border-left: 3px solid var(--primary-green);
  background: rgba(47, 190, 133, 0.14);
}
.rk-row-rank {
  font-size: 10.5px; font-weight: 600; font-family: 'IBM Plex Mono', monospace;
  color: var(--text-muted); width: 30px; flex: none; text-align: right;
}
.rk-row-name {
  font-size: 12.5px; font-weight: 500; flex: 1; color: var(--ink-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rk-row-track {
  width: 150px; flex: none; height: 8px;
  background: var(--track-bg); border-radius: 4px; overflow: hidden;
}
.rk-row-bar { height: 8px; border-radius: 4px; transition: width 0.3s ease; }
.rk-row-val {
  font-size: 11px; font-weight: 600; font-family: 'IBM Plex Mono', monospace;
  color: var(--text-muted); width: 88px; flex: none; text-align: right;
}

/* ---- Painel direito: detalhe ---- */
.rk-detail {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  overflow: auto;
  padding-bottom: 20px;
}
.rk-empty { color: var(--text-muted); font-size: 14px; padding: 24px; }

/* Hero gradiente (texto sempre claro — gradiente verde nos dois temas) */
.rk-hero {
  flex: none;
  background: linear-gradient(135deg, var(--hero-green-start), var(--hero-green-end));
  border-radius: 16px;
  padding: 20px 26px;
  color: #eafff6;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}
.rk-hero-left { flex: 1; min-width: 0; }
.rk-hero-right { flex: none; text-align: right; min-width: 220px; }
.rk-hero-eyebrow { font-size: 10.5px; letter-spacing: 0.14em; font-weight: 600; opacity: 0.82; }
.rk-hero-right .rk-hero-eyebrow { font-size: 9.5px; letter-spacing: 0.12em; opacity: 0.75; }
.rk-hero-name { font-size: 30px; font-weight: 700; letter-spacing: -0.01em; margin-top: 8px; white-space: nowrap; }
.rk-hero-meta { font-size: 13px; opacity: 0.82; margin-top: 4px; }
.rk-hero-cq { font-size: 28px; font-weight: 700; font-family: 'IBM Plex Mono', monospace; margin-top: 6px; white-space: nowrap; }
.rk-hero-meta-cq { font-size: 14px; font-weight: 500; opacity: 0.72; }
.rk-hero-track { margin-top: 10px; height: 7px; background: rgba(255, 255, 255, 0.18); border-radius: 4px; overflow: hidden; }
.rk-hero-bar { height: 7px; background: rgba(255, 255, 255, 0.75); border-radius: 4px; }
.rk-scale {
  display: flex; justify-content: space-between; margin-top: 4px;
  font-size: 9px; font-family: 'IBM Plex Mono', monospace; opacity: 0.65;
}

/* 3 KPIs */
.rk-kpi-grid { flex: none; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.rk-kpi {
  background: var(--card-grad);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 16px 18px;
  border-top: 3px solid var(--card-border);
}
.rk-kpi.t-green { border-top-color: var(--primary-green); }
.rk-kpi.t-amber { border-top-color: var(--amber-igual); }
.rk-kpi.t-blue { border-top-color: var(--blue-vaf); }
.rk-kpi-label { font-size: 10px; letter-spacing: 0.1em; font-weight: 600; color: var(--text-muted); }
.rk-kpi-value { font-size: 26px; font-weight: 700; color: var(--ink-primary); margin-top: 6px; white-space: nowrap; }
.rk-kpi-note { font-size: 11px; margin-top: 4px; font-weight: 500; }
.rk-kpi-note.t-green { color: var(--primary-green); }
.rk-kpi-note.t-amber { color: var(--amber-igual); }
.rk-kpi-note.t-blue { color: var(--blue-vaf); }

/* 2 cards inferiores */
.rk-cards-2 { flex: none; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.rk-card {
  background: var(--card-grad);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 18px 20px;
}
.rk-cq-card { display: flex; flex-direction: column; justify-content: space-between; }
.rk-card-title { font-size: 15px; font-weight: 700; color: var(--ink-primary); }
.rk-card-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.rk-cq-mid { text-align: center; padding: 16px 0; }
.rk-cq-big { font-size: 58px; font-weight: 700; font-family: 'IBM Plex Mono', monospace; color: var(--ink-primary); line-height: 1; }
.rk-cq-meta-line { font-size: 13px; color: var(--text-muted); margin-top: 8px; }
.rk-cq-meta { color: var(--primary-green); font-weight: 600; }
.rk-cq-track { height: 10px; background: var(--track-bg); border-radius: 5px; overflow: hidden; margin-bottom: 7px; }
.rk-cq-bar { height: 10px; background: var(--primary-green); border-radius: 5px; }

/* Composição empilhada */
.rk-comp-bar { display: flex; height: 18px; border-radius: 6px; overflow: hidden; margin-top: 18px; }
.rk-comp-seg { height: 100%; }
.rk-comp-legend { display: flex; flex-direction: column; gap: 11px; margin-top: 16px; }
.rk-comp-legend-row { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; }
.rk-comp-legend-label { display: flex; align-items: center; gap: 8px; color: var(--ink-secondary); }
.rk-comp-dot { width: 10px; height: 10px; border-radius: 3px; display: block; flex-shrink: 0; }
.rk-comp-legend-val { font-weight: 700; font-family: 'IBM Plex Mono', monospace; color: var(--ink-primary); }

/* ============================================================
   Educação · IDESE (redesign handoff v1.0) — theme-aware
   ============================================================ */

/* ---- Ciclo Strip (72px) ---- */
.ed-ciclo-strip {
  flex: none;
  height: 72px;
  background: var(--card-grad);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  align-items: stretch;
}
.ed-ciclo-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 22px;
  gap: 3px;
  border-right: 1px solid var(--card-border);
}
.ed-ciclo-card:last-child { border-right: none; }
.ed-ciclo-card[data-accent="blue"]  { border-left: 4px solid var(--blue-vaf); }
.ed-ciclo-card[data-accent="amber"] { border-left: 4px solid var(--amber-igual); }
.ed-ciclo-card[data-accent="green"] { border-left: 4px solid var(--primary-green); }
.ed-ciclo-card.active { background: linear-gradient(90deg, rgba(0,135,90,.06), var(--card-grad)); }
.ed-ciclo-card.future .ed-ciclo-title { color: var(--text-muted); }
.ed-ciclo-label {
  font-size: 9px; letter-spacing: 0.14em; font-weight: 600;
  color: var(--text-muted); font-family: 'IBM Plex Mono', monospace;
}
.ed-ciclo-title {
  font-size: 17px; font-weight: 700; color: var(--ink-primary);
  letter-spacing: -0.01em;
}
.ed-ciclo-note { font-size: 10.5px; font-weight: 500; }
.ed-ciclo-note.c-blue  { color: var(--blue-vaf); }
.ed-ciclo-note.c-amber { color: var(--amber-igual); }
.ed-ciclo-note.c-green { color: var(--primary-green); }
.ed-ciclo-note.c-teal  { color: #1aa3a3; }
[data-theme="dark"] .ed-ciclo-note.c-teal { color: #2fc0c0; }

.ed-pulse-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--primary-green);
  box-shadow: 0 0 0 3px rgba(0,135,90,.18);
}

/* ---- Grid principal (3 colunas) ---- */
.ed-grid-main {
  flex: 1;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 18px;
  min-height: 300px;
}

/* ---- Raio-X (coluna C) ---- */
.ed-raiox {
  background: var(--card-grad);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
}
.ed-raiox-hero {
  display: flex; align-items: baseline; gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--card-border);
}
.ed-raiox-idese-label {
  font-size: 10px; font-weight: 600; letter-spacing: 0.1em;
  color: var(--text-muted); font-family: 'IBM Plex Sans', sans-serif;
}
.ed-raiox-score {
  font-size: 38px; font-weight: 700; color: var(--ink-primary);
  font-family: 'IBM Plex Mono', monospace; line-height: 1;
}
.ed-raiox-delta {
  font-size: 13px; font-weight: 700;
  font-family: 'IBM Plex Mono', monospace;
}
.ed-raiox-delta.up   { color: var(--primary-green); }
.ed-raiox-delta.down { color: #e8556d; }
.ed-raiox-dre {
  font-size: 10.5px; color: var(--text-muted);
}

/* ---- Etapa cards (2×2 grid inside Raio-X) ---- */
.ed-etapa-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  flex: 1;
  min-height: 0;
}
.ed-etapa-card {
  background: var(--track-bg);
  border-radius: 10px;
  padding: 12px 14px;
  border-top: 2.5px solid var(--card-border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.ed-etapa-card[data-cor="blue"]  { border-top-color: #3f6fd1; }
.ed-etapa-card[data-cor="green"] { border-top-color: #00875a; }
.ed-etapa-card[data-cor="amber"] { border-top-color: #e08a0b; }
.ed-etapa-card[data-cor="purple"]{ border-top-color: #7a5cd0; }
[data-theme="dark"] .ed-etapa-card[data-cor="blue"]  { border-top-color: #5b8cf0; }
[data-theme="dark"] .ed-etapa-card[data-cor="green"] { border-top-color: #2fbe85; }
[data-theme="dark"] .ed-etapa-card[data-cor="amber"] { border-top-color: #f0a93a; }
[data-theme="dark"] .ed-etapa-card[data-cor="purple"]{ border-top-color: #9277e6; }

.ed-etapa-label {
  font-size: 9.5px; font-weight: 600; letter-spacing: 0.1em;
  color: var(--text-muted); font-family: 'IBM Plex Mono', monospace;
  text-transform: uppercase;
}
.ed-etapa-score {
  font-size: 24px; font-weight: 700; color: var(--ink-primary);
  font-family: 'IBM Plex Mono', monospace; line-height: 1;
  margin-top: 6px;
}
.ed-etapa-bar {
  height: 4px; background: var(--track-bg); border-radius: 2px;
  overflow: hidden; margin-top: 8px;
}
.ed-etapa-bar > div { height: 100%; border-radius: 2px; }
.ed-etapa-sub {
  font-size: 9px; color: var(--text-muted);
  font-family: 'IBM Plex Mono', monospace;
  margin-top: 6px; line-height: 1.55;
}

/* ---- DRE Strip (barra inferior, 88px) ---- */
.ed-dre-strip {
  flex: none;
  height: 88px;
  background: var(--card-grad);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  display: flex;
  align-items: center;
  overflow: hidden;
}
.ed-dre-label-block {
  width: 108px;
  flex: none;
  padding: 0 18px;
  border-right: 1px solid var(--card-border);
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.ed-dre-label-title {
  font-size: 11px; font-weight: 700; color: var(--primary-green);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.ed-dre-label-sub {
  font-size: 9px; color: var(--text-muted); margin-top: 2px;
  line-height: 1.3;
}
.ed-dre-cols {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  overflow-x: auto;
}
.ed-dre-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.ed-dre-col-name {
  font-size: 9.5px; font-weight: 600;
  font-family: 'IBM Plex Mono', monospace;
  white-space: nowrap;
}
.ed-dre-bar-wrap {
  width: 100%; height: 24px;
  background: var(--track-bg);
  border-radius: 4px; overflow: hidden;
  position: relative;
}
.ed-dre-bar-fill {
  height: 100%; border-radius: 4px;
  opacity: 0.75;
}
.ed-dre-bar-val {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--ink-primary);
}
.ed-dre-col-count {
  font-size: 9px; color: var(--text-muted);
  font-family: 'IBM Plex Mono', monospace;
}
.ed-dre-col {
  transition: opacity .2s ease;
}
.ed-dre-strip:has(.ed-dre-col.active) .ed-dre-col:not(.active) {
  opacity: 0.35;
}
.ed-dre-col.active .ed-dre-col-name {
  font-weight: 800;
  font-size: 10.5px;
}
.ed-dre-col.active .ed-dre-bar-val {
  font-weight: 700;
}
.ed-dre-col.active .ed-dre-col-count {
  color: var(--ink-primary);
}

/* ---- Raio-X empty state ---- */
.ed-raiox-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; flex: 1;
  color: var(--text-muted); font-size: 13px;
  padding: 24px;
}

/* ---- Viewport-lock: Educação only ----
   Trava a cadeia flex em height:100vh para que os gráficos
   preencham exatamente a tela sem scroll.                    */
.dashboard-root:has(.ed-page) {
  height: 100vh;
  overflow: hidden;
}
.dashboard-root:has(.ed-page) .page-content {
  min-height: 0;
  overflow: hidden;
}
.dashboard-root:has(.ed-page) .page-content > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.dashboard-root:has(.ed-page) #_pages_content {
  min-height: 0;
}
.dashboard-root:has(.ed-page) #_pages_content > div {
  min-height: 0;
}
.ed-page { min-height: 0; overflow: hidden; }
.ed-grid-main { min-height: 0; }
.ed-grid-main > .card { min-height: 0; }
#ed-raiox {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#ed-raiox > .ed-raiox { flex: 1; }
.ed-chart-fill {
  flex: 1;
  min-height: 0;
}

/* ---- Slope header + badges ---- */
.ed-slope-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.ed-slope-badges {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.ed-slope-badge {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all .2s ease;
  background: transparent;
  line-height: 1.3;
}
.ed-slope-badge.subiu {
  color: var(--slope-subiu, #5aa02c);
  border-color: rgba(90,160,44,.25);
}
.ed-slope-badge.caiu {
  color: var(--slope-caiu, #e8556d);
  border-color: rgba(232,85,109,.25);
}
.ed-slope-badge.subiu:hover,
.ed-slope-badge.subiu.active {
  background: rgba(90,160,44,.12);
  border-color: var(--slope-subiu, #5aa02c);
}
.ed-slope-badge.caiu:hover,
.ed-slope-badge.caiu.active {
  background: rgba(232,85,109,.12);
  border-color: var(--slope-caiu, #e8556d);
}
.ed-slope-badge.active {
  box-shadow: 0 0 8px rgba(0,0,0,.08);
}

/* ============================================================
   RESPONSIVIDADE MOBILE — media queries
   Empilha grids em coluna, header compacto, scroll onde necessário.
   Desktop (≥850px) não é afetado.
   ============================================================ */

@media (max-width: 850px) {

  /* ---- Reset de largura mínima ---- */
  .dashboard-root {
    min-width: 0;
    overflow-x: hidden;
  }

  /* ---- Header compacto ---- */
  .app-header {
    height: auto;
    flex-wrap: wrap;
    padding: 12px 16px;
    gap: 10px;
  }
  .header-brand { width: 100%; }
  .brand-title { font-size: 16px; }
  .brand-subtitle { font-size: 9px; }

  .header-nav {
    order: 3;
    width: 100%;
    justify-content: center;
  }
  .nav-tab { font-size: 11px; padding: 6px 10px; }

  .header-controls {
    order: 2;
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }
  .filters-container {
    flex-wrap: wrap;
    width: 100%;
    gap: 8px;
  }
  .filter-chip { flex: 1; min-width: 100px; }
  .theme-btn { position: absolute; top: 12px; right: 16px; }

  /* ---- Page content ---- */
  .page-content { padding: 12px 14px; }

  /* ---- Footer ---- */
  .app-footer { padding: 0 14px; }

  /* ============================================
     Visão Geral — mobile
     ============================================ */

  .grid-kpi-band {
    grid-template-columns: 1fr 1fr;
    height: auto;
    gap: 10px;
  }
  .grid-visao-geral {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .grid-visao-geral > .card { min-height: 300px; }

  .vg-scatter-legend { gap: 4px 8px; }
  .vg-legend-item { font-size: 9px; }

  .timeline-container {
    flex-direction: column;
    padding: 14px;
  }
  .timeline-brand {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--card-border);
    padding: 0 0 10px;
    margin: 0 0 10px;
  }
  .timeline-track {
    overflow-x: auto;
    justify-content: flex-start;
    gap: 16px;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
  }
  .timeline-node { width: 120px; flex-shrink: 0; }

  /* ============================================
     Ranking — mobile
     ============================================ */

  .rk-page { flex-direction: column !important; }
  #_pages_content > div.rk-page { flex-direction: column; }

  .rk-list-card {
    width: 100%;
    max-height: 350px;
  }
  .rk-detail { overflow: visible; }
  .rk-hero {
    flex-direction: column;
    gap: 12px;
  }
  .rk-hero-right { text-align: left; min-width: 0; }
  .rk-hero-name { font-size: 22px; }
  .rk-kpi-grid { grid-template-columns: 1fr; gap: 10px; }
  .rk-cards-2 { grid-template-columns: 1fr; }
  .rk-cq-big { font-size: 42px; }

  /* ============================================
     Educação — mobile
     ============================================ */

  /* Desativar viewport-lock no mobile */
  .dashboard-root:has(.ed-page) {
    height: auto;
    overflow: visible;
  }
  .dashboard-root:has(.ed-page) .page-content {
    overflow: visible;
  }
  .dashboard-root:has(.ed-page) .page-content > div {
    min-height: auto;
  }

  .ed-ciclo-strip {
    height: auto;
    flex-wrap: wrap;
  }
  .ed-ciclo-card {
    min-width: 140px;
    flex: 1 1 45%;
    padding: 10px 14px;
  }
  .ed-ciclo-card:nth-child(2) { border-right: none; }
  .ed-ciclo-title { font-size: 14px; }

  .ed-grid-main {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .ed-grid-main > .card { min-height: 300px; }
  .ed-chart-fill { min-height: 280px; }
  .ed-raiox { min-height: auto; }
  .ed-etapa-grid { grid-template-columns: 1fr 1fr; }

  .ed-dre-strip {
    height: auto;
    flex-wrap: wrap;
    padding: 12px;
  }
  .ed-dre-label-block {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--card-border);
    padding: 0 0 8px;
    margin-bottom: 8px;
  }
  .ed-dre-cols {
    flex-wrap: wrap;
    gap: 8px;
  }
  .ed-dre-col { flex: 0 0 calc(20% - 8px); min-width: 70px; }

  .ed-raiox-score { font-size: 30px; }
  .ed-etapa-score { font-size: 20px; }
}

/* ---- Extra-small screens (≤480px) ---- */
@media (max-width: 480px) {
  .grid-kpi-band { grid-template-columns: 1fr; }
  .ed-ciclo-card { flex: 1 1 100%; }
  .ed-ciclo-card:nth-child(n) { border-right: none; }
  .ed-etapa-grid { grid-template-columns: 1fr; }
  .ed-dre-col { flex: 0 0 calc(33% - 8px); }
  .rk-hero-cq { font-size: 22px; }
  .hero-total-val { font-size: 36px; }
  .hero-total-unit { font-size: 20px; }
  .kpi-value { font-size: 26px; }
}
