/* =====================================================================
   BI Conecta C — sistema de design.
   TOKENS: tudo que é cor, espaço, raio e tipo mora aqui (e só aqui).
   Escuro é o padrão (:root); claro em html[data-tema="claro"] — tons
   próprios, não inversão. Hex validados (WCAG AA + daltonismo) e
   registrados no docs/PROGRESSO.md (bloco de 07/10, redesenho).
   graficos.js nunca usa hex: só var(--...).
===================================================================== */

@font-face {
  font-family: "Inter";
  src: url("/publico/vendor/inter-variavel.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;

  /* superfícies — grafite azulado derivado do #273B48 */
  --fundo: #0D1419;
  --superficie: #131C22;
  --superficie-2: #18232B;
  --superficie-3: #1F2C35;
  --zebra: rgba(255, 255, 255, 0.022);
  --hover: rgba(255, 255, 255, 0.045);
  --borda: #22303A;
  --borda-forte: #2E3F4B;
  --veu: rgba(5, 9, 12, 0.66);

  /* texto */
  --texto: #E6EBEE;
  --texto-2: #A9B6BF;
  --texto-3: #85939D;

  /* marca */
  --marca: #273B48;
  --marca-tinta: #E6EBEE;          /* texto sobre --marca */
  --acao: #2E4A5C;                 /* botão primário */
  --acao-hover: #375769;
  --acao-texto: #F1F4F6;
  --destaque: #C9B285;             /* dourado: ênfase, nunca série nem fundo grande */
  --destaque-texto: #C9B285;
  --destaque-fraco: rgba(201, 178, 133, 0.12);
  --foco: #C9B285;
  --link: #8FB8D6;

  /* dados */
  --serie: #6F9AB8;                /* barra de uma série só (sem ênfase) */
  --neutro: #5F6E79;               /* "o resto" na comparação e etapas da esteira */
  --trilho: #1B272F;
  --grade: #24323C;
  /* magnitude: um tom só (petróleo), perto da superfície -> mais claro = mais */
  --tom0: #3B5669; --tom1: #4F6F84; --tom2: #6588A0;
  --tom3: #7CA3BD; --tom4: #93BEDA; --tom5: #ABDAF9;
  --tom-vazio: #172128;
  /* categorias (só onde a cor é identidade: família de perda) */
  --cat1: #4896D3; --cat2: #985593; --cat3: #C47C3B;
  /* status — só onde há limite, sempre com ícone/texto */
  --ok: #72B98E;      --ok-fundo: rgba(114, 185, 142, 0.12);
  --atencao: #D7AA52; --atencao-fundo: rgba(215, 170, 82, 0.12);
  --critico: #E8806F; --critico-fundo: rgba(232, 128, 111, 0.12);

  /* espaço (escala de 4) */
  --e1: 4px; --e2: 8px; --e3: 12px; --e4: 16px; --e5: 20px; --e6: 24px; --e8: 32px; --e10: 40px;
  /* raio */
  --r1: 6px; --r2: 8px; --r3: 12px; --r-pilula: 999px;
  /* tipo */
  --fonte: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --fonte-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --t-micro: 0.6875rem;  /* 11 */
  --t-pequeno: 0.75rem;  /* 12 */
  --t-corpo: 0.8125rem;  /* 13 */
  --t-medio: 0.875rem;   /* 14 */
  --t-titulo: 1rem;      /* 16 */
  --t-tela: 1.375rem;    /* 22 */
  --t-numero: 2rem;      /* 32 */
  --sombra: 0 1px 0 rgba(0, 0, 0, 0.25);
  --sombra-dialog: 0 24px 64px rgba(0, 0, 0, 0.5);
  --lateral: 232px;
}

html[data-tema="claro"] {
  color-scheme: light;
  --fundo: #F3F2EE;
  --superficie: #FFFFFF;
  --superficie-2: #F8F7F4;
  --superficie-3: #EFEDE7;
  --zebra: rgba(39, 59, 72, 0.028);
  --hover: rgba(39, 59, 72, 0.05);
  --borda: #E4E1DA;
  --borda-forte: #D2CEC4;
  --veu: rgba(20, 30, 37, 0.42);

  --texto: #1B2830;
  --texto-2: #46545E;
  --texto-3: #5E6A73;

  --marca: #273B48;
  --marca-tinta: #F3F2EE;
  --acao: #273B48;
  --acao-hover: #324B5B;
  --acao-texto: #FFFFFF;
  --destaque: #A3885A;
  --destaque-texto: #80683D;
  --destaque-fraco: rgba(179, 157, 116, 0.16);
  --foco: #80683D;
  --link: #2D5F80;

  --serie: #3F6984;
  --neutro: #8E989F;
  --trilho: #EEF0F1;
  --grade: #E6E8EA;
  --tom0: #A0B8C8; --tom1: #7E9DB2; --tom2: #5C839D;
  --tom3: #396987; --tom4: #125173; --tom5: #003A60;
  --tom-vazio: #F1F2F3;
  --cat1: #005993; --cat2: #B873B2; --cat3: #934F00;
  --ok: #2B7049;      --ok-fundo: rgba(43, 112, 73, 0.09);
  --atencao: #8A5F0C; --atencao-fundo: rgba(138, 95, 12, 0.09);
  --critico: #B03D31; --critico-fundo: rgba(176, 61, 49, 0.08);
  --sombra: 0 1px 2px rgba(27, 40, 48, 0.04);
  --sombra-dialog: 0 24px 64px rgba(27, 40, 48, 0.22);
}

/* ---------------------------------------------------------------------
   Base
--------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--fonte);
  font-size: var(--t-medio);
  line-height: 1.5;
  background: var(--fundo);
  color: var(--texto);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: var(--t-tela); line-height: 1.25; letter-spacing: -0.02em; }
h2 { font-size: var(--t-titulo); line-height: 1.35; }
h3 { font-size: var(--t-pequeno); color: var(--texto-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; margin: var(--e6) 0 var(--e3); }
p { margin: 0; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
b, strong { font-weight: 600; }
code { font-family: var(--fonte-mono); font-size: 0.92em; background: var(--superficie-3); padding: 1px 5px; border-radius: 4px; }
small { font-size: var(--t-pequeno); }
.num, td, .tile-valor, .funil-n, .bh-n, .emp-n, .hist-n { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--foco); outline-offset: 2px; }

/* ---------------------------------------------------------------------
   Controles
--------------------------------------------------------------------- */
button, .botao {
  font: inherit;
  font-size: var(--t-corpo);
  font-weight: 550;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--e2);
  height: 34px;
  padding: 0 var(--e4);
  border-radius: var(--r2);
  border: 1px solid transparent;
  background: var(--acao);
  color: var(--acao-texto);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}
button:hover { background: var(--acao-hover); }
button:disabled { opacity: 0.5; cursor: default; }
.botao-fantasma {
  background: transparent; color: var(--texto-2); border-color: var(--borda-forte);
}
.botao-fantasma:hover { background: var(--hover); color: var(--texto); }
.botao-secundario {
  background: transparent; color: var(--critico); border-color: var(--borda-forte);
  height: 28px; padding: 0 var(--e3); font-size: var(--t-pequeno);
}
.botao-secundario:hover { background: var(--critico-fundo); border-color: var(--critico); }

label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: var(--t-pequeno); font-weight: 500; color: var(--texto-3);
}
input, select {
  font: inherit; font-size: var(--t-corpo); color: var(--texto);
  height: 34px; padding: 0 var(--e3);
  background: var(--superficie);
  border: 1px solid var(--borda-forte);
  border-radius: var(--r2);
  min-width: 0;
}
input[type="file"] { height: auto; padding: var(--e2); }
input:focus, select:focus { outline: none; border-color: var(--foco); box-shadow: 0 0 0 3px var(--destaque-fraco); }
select {
  appearance: none; -webkit-appearance: none;
  padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--texto-3) 50%), linear-gradient(135deg, var(--texto-3) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
input[type="date"]::-webkit-calendar-picker-indicator { filter: var(--icone-data, invert(0.7)); }
html[data-tema="claro"] input[type="date"]::-webkit-calendar-picker-indicator { filter: none; }

form { margin: 0; }
.erro { color: var(--critico); font-size: var(--t-corpo); }
.sucesso { color: var(--ok); font-size: var(--t-corpo); }

/* ---------------------------------------------------------------------
   Layout: menu lateral fixo + área de trabalho
--------------------------------------------------------------------- */
.lateral {
  position: fixed; inset: 0 auto 0 0; z-index: 30;
  width: var(--lateral);
  display: flex; flex-direction: column;
  background: var(--superficie);
  border-right: 1px solid var(--borda);
  padding: var(--e5) var(--e3) var(--e4);
}
.marca {
  display: flex; align-items: center; gap: var(--e3);
  padding: 0 var(--e2) var(--e5);
}
.marca-selo {
  width: 32px; height: 32px; flex: none;
  display: grid; place-items: center;
  border-radius: var(--r2);
  background: var(--marca);
  color: var(--destaque);
  font-weight: 700; font-size: 15px; letter-spacing: -0.02em;
  border: 1px solid rgba(201, 178, 133, 0.35);
}
html[data-tema="claro"] .marca-selo { color: #CDB78C; }
.marca-nome { display: flex; flex-direction: column; line-height: 1.2; }
.marca-nome strong { font-size: var(--t-medio); font-weight: 650; letter-spacing: -0.01em; }
.marca-nome span { font-size: var(--t-micro); color: var(--texto-3); letter-spacing: 0.08em; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-grupo {
  font-size: var(--t-micro); color: var(--texto-3); text-transform: uppercase; letter-spacing: 0.08em;
  padding: var(--e4) var(--e3) var(--e2);
}
.nav-item {
  all: unset; box-sizing: border-box;
  display: flex; align-items: center; gap: var(--e3);
  height: 34px; padding: 0 var(--e3);
  border-radius: var(--r2);
  font-size: var(--t-corpo); font-weight: 500;
  color: var(--texto-2);
  cursor: pointer;
  position: relative;
}
.nav-item svg { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: 0.85; }
.nav-item:hover { background: var(--hover); color: var(--texto); }
.nav-item.ativa { background: var(--superficie-3); color: var(--texto); }
.nav-item.ativa::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 2px;
  border-radius: 2px; background: var(--destaque);
}
.nav-item.ativa svg { opacity: 1; color: var(--destaque); }
.nav-item:focus-visible { outline: 2px solid var(--foco); outline-offset: -2px; }

.lateral-pe {
  margin-top: auto;
  border-top: 1px solid var(--borda);
  padding-top: var(--e3);
  display: flex; flex-direction: column; gap: 2px;
}
.usuario {
  display: flex; align-items: center; gap: var(--e3);
  padding: var(--e2) var(--e3) var(--e3);
  font-size: var(--t-pequeno); color: var(--texto-3); line-height: 1.3;
}
.usuario-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--superficie-3); color: var(--texto-2);
  font-size: var(--t-pequeno); font-weight: 600;
}
.usuario b { display: block; color: var(--texto); font-weight: 600; font-size: var(--t-corpo); }

.area { margin-left: var(--lateral); min-height: 100vh; }
main#conteudo { padding: var(--e8) var(--e10) var(--e10); max-width: 1320px; }

.barra-movel { display: none; }
.veu-menu { display: none; }

/* ---------------------------------------------------------------------
   Tela: cabeçalho, filtros, rodapé
--------------------------------------------------------------------- */
.tela-cabecalho { margin-bottom: var(--e5); display: flex; flex-direction: column; gap: var(--e2); max-width: 820px; }
.tela-cabecalho .pergunta { font-size: var(--t-medio); }
.sobretitulo { font-size: var(--t-pequeno); color: var(--texto-3); font-weight: 500; }

.barra-filtros {
  position: sticky; top: 0; z-index: 10;
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--e3) var(--e4);
  margin: 0 calc(-1 * var(--e10)) var(--e5);
  padding: var(--e3) var(--e10);
  background: color-mix(in srgb, var(--fundo) 88%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--borda);
}
.barra-filtros label { flex: 0 1 200px; }
.barra-filtros select, .barra-filtros input { width: 100%; }
.barra-filtros button { flex: none; }
.barra-filtros .resumo-filtro { flex-basis: 100%; }

.pergunta { font-size: var(--t-corpo); color: var(--texto-2); line-height: 1.55; }
.pergunta b { color: var(--texto); }
.nota-calibracao, .resumo-filtro { font-size: var(--t-pequeno); color: var(--texto-3); }
.nota-calibracao { margin: 0 0 var(--e4); }
.eixo-legenda { font-size: var(--t-pequeno); color: var(--texto-3); margin: var(--e3) 0 0; }

.rodape-dados {
  margin-top: var(--e8); padding-top: var(--e4);
  border-top: 1px solid var(--borda);
  font-size: var(--t-pequeno); color: var(--texto-3);
}
.rodape-dados .velho { color: var(--atencao); font-weight: 500; }

/* faixa de dado velho (DASH-005) */
.faixa-dado {
  padding: var(--e3) var(--e4); margin-bottom: var(--e5);
  border-radius: var(--r2); font-size: var(--t-corpo); font-weight: 600; line-height: 1.5;
  color: var(--texto);
}
.faixa-ontem { background: var(--atencao-fundo); border: 1px solid color-mix(in srgb, var(--atencao) 35%, transparent); }
.deslogado .faixa-dado { display: none; }
.faixa-antigo { background: var(--critico-fundo); border: 1px solid color-mix(in srgb, var(--critico) 35%, transparent); }

/* avisos */
.aviso-higiene, .alerta {
  display: flex; gap: var(--e3); align-items: flex-start;
  padding: var(--e3) var(--e4);
  border-radius: var(--r2);
  font-size: var(--t-corpo); line-height: 1.5;
  margin-bottom: var(--e5);
}
.aviso-higiene { background: var(--atencao-fundo); border: 1px solid color-mix(in srgb, var(--atencao) 35%, transparent); color: var(--texto); }
.aviso-higiene .ir-higiene { all: unset; cursor: pointer; color: var(--texto); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.aviso-higiene::before { content: "!"; flex: none; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--atencao); color: var(--superficie); margin-top: 1px; }
.alerta { background: var(--critico-fundo); border: 1px solid color-mix(in srgb, var(--critico) 35%, transparent); color: var(--texto); }

/* ---------------------------------------------------------------------
   Cartões
--------------------------------------------------------------------- */
.bloco, .cartao {
  background: var(--superficie);
  border: 1px solid var(--borda);
  border-radius: var(--r3);
  box-shadow: var(--sombra);
}
.bloco { padding: var(--e6); margin-bottom: var(--e5); }
.bloco > h2 + .pergunta { margin-top: var(--e1); }
.bloco > .pergunta { margin-bottom: var(--e5); max-width: 760px; }
.bloco-cabecalho { display: flex; justify-content: space-between; align-items: baseline; gap: var(--e4); flex-wrap: wrap; }
.cartao { padding: var(--e4); margin: var(--e3) 0; }
.grade-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--e5); }
.grade-2 > .bloco { margin-bottom: 0; }
.grade-2 { margin-bottom: var(--e5); align-items: start; }
.bloco > h2 + div[id] { margin-top: var(--e4); }
.lado-a-lado { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--e8); }
.lado-a-lado h3:first-child, .lado-a-lado > div > h3:first-child { margin-top: 0; }
.subbloco { border-top: 1px solid var(--borda); margin-top: var(--e6); padding-top: var(--e2); }

.resumo-linha { display: flex; gap: var(--e6); flex-wrap: wrap; font-size: var(--t-corpo); color: var(--texto-2); }
.resumo-linha b { color: var(--texto); }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--e4); margin-bottom: var(--e5); }
.tile {
  background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--r3);
  padding: var(--e5); display: flex; flex-direction: column; gap: var(--e2);
  box-shadow: var(--sombra); min-width: 0;
}
.tile-rotulo { font-size: var(--t-corpo); color: var(--texto-2); font-weight: 500; }
.tile-linha { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--e3); }
.tile-valor { font-size: var(--t-numero); font-weight: 600; line-height: 1.05; letter-spacing: -0.03em; color: var(--texto); }
.tile-valor.menor { font-size: var(--t-titulo); letter-spacing: 0; line-height: 1.4; font-weight: 500; }
.tile-var { font-size: var(--t-pequeno); color: var(--texto-3); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tile-var .delta { color: var(--texto-2); font-weight: 600; }
.tile-nota { font-size: var(--t-micro); color: var(--texto-3); line-height: 1.4; }
.spark { display: block; overflow: visible; flex: none; }
.spark-linha { stroke: var(--serie); }
.spark-ponto { fill: var(--texto); }

/* ---------------------------------------------------------------------
   Tabelas — densas, zebradas, cabeçalho fixo
--------------------------------------------------------------------- */
.tabela-wrap {
  overflow: auto; max-height: min(72vh, 720px);
  border: 1px solid var(--borda); border-radius: var(--r2);
}
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--t-corpo); }
th, td { text-align: left; padding: 7px var(--e3); border-bottom: 1px solid var(--borda); vertical-align: middle; }
thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--superficie-2);
  color: var(--texto-3); font-weight: 600; font-size: var(--t-pequeno);
  border-bottom: 1px solid var(--borda-forte);
  white-space: nowrap;
}
tbody tr:nth-child(even) td { background: var(--zebra); }
tbody tr:hover td { background: var(--hover); }
tbody tr:last-child td { border-bottom: 0; }
.tabela-simples { background: transparent; }
.tabela-wrap .tabela-simples thead th { top: 0; }
td.num, th.num { text-align: right; }
.tabela-simples .revogada td { color: var(--texto-3); }

/* tabela por corretor (Tela 0) */
.tabela-semaforo { min-width: 900px; }
.tabela-semaforo th { white-space: normal; vertical-align: bottom; line-height: 1.3; text-align: right; min-width: 72px; }
.tabela-semaforo td { text-align: right; }
.tabela-semaforo th:first-child, .tabela-semaforo td:first-child { text-align: left; position: sticky; left: 0; z-index: 1; min-width: 180px; }
.tabela-semaforo thead th:first-child { z-index: 2; }
.tabela-semaforo td:first-child { background: var(--superficie); font-weight: 500; }
.tabela-semaforo tbody tr:nth-child(even) td:first-child { background: color-mix(in srgb, var(--superficie) 97%, var(--texto)); }
.tabela-semaforo td { font-size: var(--t-medio); }
.tabela-semaforo th.ordenavel { cursor: pointer; user-select: none; }
.tabela-semaforo th.ordenavel:hover { color: var(--texto); }
.tabela-semaforo th[aria-sort] { color: var(--texto); }
.tabela-semaforo th[aria-sort]::after { content: " ↓"; color: var(--destaque-texto); }
.celula-metrica { color: var(--texto-2); }
.celula-metrica.zero { color: var(--texto-3); opacity: 0.6; }
.celula-metrica.clicavel { cursor: pointer; color: var(--texto); text-decoration: underline; text-decoration-color: var(--borda-forte); text-underline-offset: 3px; }
.celula-metrica.clicavel:hover { text-decoration-color: var(--destaque); background: var(--destaque-fraco) !important; }
.celula-metrica.clicavel:focus-visible { outline: 2px solid var(--foco); outline-offset: -2px; }
.celula-metrica.acima-mediana { font-weight: 650; }
.indicador-alta { color: var(--texto-3); font-size: 9px; margin-left: 3px; vertical-align: 1px; }
.linha-mediana td {
  font-weight: 700; color: var(--texto);
  border-top: 1px solid var(--borda-forte);
  background: var(--superficie-2) !important;
  position: sticky; bottom: 0;
}
.linha-mediana td:first-child { background: var(--superficie-2) !important; }

/* ---------------------------------------------------------------------
   Diálogo (lista nominal, trocar senha)
--------------------------------------------------------------------- */
dialog {
  border: 1px solid var(--borda-forte); border-radius: var(--r3);
  padding: 0; width: min(94vw, 760px); max-height: 84vh; overflow: auto;
  background: var(--superficie); color: var(--texto);
  box-shadow: var(--sombra-dialog);
}
#dialogSenha { width: min(94vw, 420px); }
dialog::backdrop { background: var(--veu); }
.dialog-cabecalho {
  display: flex; justify-content: space-between; align-items: center; gap: var(--e4);
  padding: var(--e4) var(--e5);
  background: var(--superficie); border-bottom: 1px solid var(--borda);
  position: sticky; top: 0; z-index: 2;
}
.dialog-cabecalho strong { font-size: var(--t-titulo); }
.dialog-cabecalho small { display: block; color: var(--texto-3); font-weight: 400; margin-top: 2px; }
.botao-fechar {
  background: transparent; color: var(--texto-3); border: 1px solid var(--borda);
  width: 30px; height: 30px; padding: 0; font-size: 18px; line-height: 1;
}
.botao-fechar:hover { background: var(--hover); color: var(--texto); }
.dialog-corpo { padding: var(--e4) var(--e5) var(--e5); }
.dialog-corpo thead th { top: 0; }
.dialog-lista .dialog-corpo { padding-top: 0; }
.dialog-lista table { margin-top: var(--e3); }
.dialog-form .dialog-corpo { display: flex; flex-direction: column; gap: var(--e4); }
.dialog-form .dialog-corpo input { width: 100%; }
.dialog-form .dialog-corpo button { align-self: flex-start; }

/* ---------------------------------------------------------------------
   Login
--------------------------------------------------------------------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: var(--e6); }
.login-cartao {
  width: min(100%, 380px);
  background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--r3);
  padding: var(--e8); box-shadow: var(--sombra);
}
.login-cartao .marca { padding: 0 0 var(--e6); }
.login-cartao h1 { font-size: var(--t-titulo); margin-bottom: var(--e1); }
.login-cartao .pergunta { margin-bottom: var(--e6); }
.login-cartao form { display: flex; flex-direction: column; gap: var(--e4); }
.login-cartao input { width: 100%; height: 38px; }
.login-cartao button { height: 38px; margin-top: var(--e2); }
body.deslogado .lateral, body.deslogado .barra-movel { display: none !important; }
body.deslogado .area { margin-left: 0; }
body.deslogado main#conteudo { padding: 0; max-width: none; }

/* ---------------------------------------------------------------------
   Higiene, extensão, upload
--------------------------------------------------------------------- */
.checagem { padding: 0; overflow: hidden; }
.checagem summary {
  list-style: none; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: var(--e4);
  padding: var(--e3) var(--e4); font-weight: 500;
}
.checagem summary::-webkit-details-marker { display: none; }
.checagem summary:hover { background: var(--hover); }
.checagem[open] summary { border-bottom: 1px solid var(--borda); }
.checagem > table, .checagem > p { margin: 0; }
.checagem > p { padding: var(--e3) var(--e4); color: var(--texto-3); }
.checagem > .tabela-wrap { border: 0; border-radius: 0; max-height: 50vh; }
.status {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  font-size: var(--t-pequeno); font-weight: 600;
  padding: 2px var(--e2) 2px 6px; border-radius: var(--r-pilula);
}
.status::before { font-size: 11px; line-height: 1; }
.status-ok { color: var(--ok); background: var(--ok-fundo); }
.status-ok::before { content: "✓"; }
.status-critico { color: var(--critico); background: var(--critico-fundo); }
.status-critico::before { content: "✕"; }
.status-atencao { color: var(--atencao); background: var(--atencao-fundo); }
.status-atencao::before { content: "!"; }
.status-neutro { color: var(--texto-3); background: var(--superficie-3); }

.codigo-pareamento {
  font-family: var(--fonte-mono); font-size: 2rem; letter-spacing: 0.25em; font-weight: 600;
  color: var(--destaque-texto); background: var(--destaque-fraco);
  border: 1px dashed var(--destaque); border-radius: var(--r2);
  padding: var(--e2) var(--e5); display: inline-block; margin: var(--e4) 0 var(--e2);
}
.acoes { display: flex; gap: var(--e3); flex-wrap: wrap; align-items: center; }
.estado-linha { display: flex; gap: var(--e3); align-items: center; font-size: var(--t-corpo); color: var(--texto-2); margin: var(--e2) 0; }

/* ---------------------------------------------------------------------
   Gráficos (graficos.js) — toda cor vem dos tokens acima
--------------------------------------------------------------------- */
.amostra-pequena { opacity: 0.5; }
.selo-amostra { font-size: var(--t-micro); color: var(--texto-3); border: 1px solid var(--borda-forte); border-radius: var(--r-pilula); padding: 0 6px; margin-left: 4px; white-space: nowrap; }
[role="button"] { cursor: pointer; }
[role="button"]:focus-visible { outline: 2px solid var(--foco); outline-offset: 1px; border-radius: 4px; }

.ver-tabela { margin-top: var(--e4); font-size: var(--t-pequeno); }
.ver-tabela summary { cursor: pointer; color: var(--texto-3); display: inline-flex; gap: 6px; align-items: center; user-select: none; }
.ver-tabela summary:hover { color: var(--texto); }
.ver-tabela[open] summary { margin-bottom: var(--e3); }
.ver-tabela table { font-size: var(--t-pequeno); }

.legenda { display: flex; flex-wrap: wrap; gap: var(--e2) var(--e4); font-size: var(--t-pequeno); color: var(--texto-2); margin-bottom: var(--e4); }
.legenda span { display: inline-flex; align-items: center; gap: 6px; }
.legenda i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.legenda .traco-leg { width: 2px; height: 12px; border-radius: 1px; }

/* barras horizontais: funil, barrasH, empilhadas */
.funil-linha, .bh-linha, .emp-linha {
  display: grid; grid-template-columns: minmax(7rem, 13rem) minmax(0, 1fr) 6.5rem;
  align-items: center; gap: var(--e3);
  padding: 5px var(--e2); margin: 0 calc(-1 * var(--e2));
  border-radius: var(--r1);
}
.funil-linha[role="button"]:hover, .bh-linha[role="button"]:hover { background: var(--hover); }
.funil-rotulo, .bh-rotulo, .emp-rotulo { font-size: var(--t-corpo); color: var(--texto-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.funil-trilho, .bh-trilho, .emp-trilho { position: relative; height: 14px; background: var(--trilho); border-radius: 0 4px 4px 0; }
.funil-barra, .bh-barra { display: block; height: 100%; background: var(--serie); border-radius: 0 4px 4px 0; min-width: 2px; }
.funil-barra.esteira, .bh-barra.esteira { background: var(--neutro); }
.funil-barra.destaque, .bh-barra.destaque { background: var(--destaque); }
.funil-n, .bh-n, .emp-n { font-size: var(--t-corpo); text-align: right; color: var(--texto); white-space: nowrap; }
.bh-n small, .emp-n small { color: var(--texto-3); }
.funil-n { font-weight: 600; }
.funil-queda {
  font-size: var(--t-pequeno); color: var(--texto-3);
  padding: 1px 0 1px calc(min(13rem, 30%) + var(--e3));
  display: flex; gap: var(--e2); align-items: center;
}
.funil-queda.destaque { color: var(--destaque-texto); }
.funil-queda .marca-queda { font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; font-size: var(--t-micro); border: 1px solid var(--destaque); border-radius: var(--r-pilula); padding: 0 6px; }
.funil-separador { font-size: var(--t-micro); color: var(--texto-3); text-transform: uppercase; letter-spacing: 0.08em; padding: var(--e3) 0 var(--e1); border-top: 1px dashed var(--borda-forte); margin-top: var(--e2); }
.bh-taxa .bh-linha { grid-template-columns: minmax(7rem, 15rem) minmax(0, 1fr) 11rem; }
.bh-texto .bh-linha { grid-template-columns: minmax(6rem, 12rem) minmax(0, 1fr) 11.5rem; }
.grade-2 .bh-taxa .bh-linha { grid-template-columns: minmax(6rem, 11rem) minmax(0, 1fr) 7.5rem; }
.lado-a-lado .bh-linha { grid-template-columns: minmax(5rem, 9rem) minmax(0, 1fr) 5.5rem; }
.lado-a-lado .bh-taxa .bh-linha { grid-template-columns: minmax(5rem, 9rem) minmax(0, 1fr) 9rem; }
.bh-marca { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--texto); border-radius: 1px; }
.bh-mediana { position: absolute; top: -4px; bottom: -4px; width: 0; border-left: 2px dotted var(--texto-2); }
.lado-a-lado .selo-amostra { display: none; }
input[type="file"]::file-selector-button {
  font: inherit; font-size: var(--t-pequeno); font-weight: 550; color: var(--texto);
  background: var(--superficie-3); border: 1px solid var(--borda-forte); border-radius: var(--r1);
  padding: 4px var(--e3); margin-right: var(--e3); cursor: pointer;
}
.bh-sem-barra { font-size: var(--t-micro); color: var(--texto-3); padding-left: 4px; line-height: 14px; }

.emp-barra { display: flex; height: 100%; gap: 2px; }
.seg { display: block; height: 100%; min-width: 2px; }
.seg:last-child { border-radius: 0 4px 4px 0; }
.seg[role="button"]:hover { filter: brightness(1.18); }
html[data-tema="claro"] .seg[role="button"]:hover { filter: brightness(0.88); }
.tom0 { background: var(--tom0); } .tom1 { background: var(--tom1); } .tom2 { background: var(--tom2); }
.tom3 { background: var(--tom3); } .tom4 { background: var(--tom4); } .tom5 { background: var(--tom5); }
.cat1 { background: var(--cat1); } .cat2 { background: var(--cat2); } .cat3 { background: var(--cat3); }
.cat-neutro { background: var(--neutro); }

/* histograma e colunas por semana */
.hist { display: flex; align-items: stretch; gap: var(--e3); height: 180px; border-bottom: 1px solid var(--grade); }
.hist-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; min-width: 0; padding: 0 2px; border-radius: var(--r1) var(--r1) 0 0; }
.hist-col[role="button"]:hover { background: var(--hover); }
.hist-barra { width: 100%; max-width: 56px; background: var(--serie); border-radius: 4px 4px 0 0; min-height: 2px; }
.hist-col[role="button"]:hover .hist-barra { filter: brightness(1.12); }
.hist-n { font-size: var(--t-pequeno); color: var(--texto-2); font-weight: 600; }
.hist-rotulos { display: flex; gap: var(--e3); }
.hist-rotulos span { flex: 1; text-align: center; font-size: var(--t-pequeno); color: var(--texto-3); padding-top: 6px; min-width: 0; }
.col-area { position: relative; flex: 1; width: 100%; max-width: 56px; display: flex; align-items: flex-end; }
.col-n { position: absolute; left: 0; right: 0; text-align: center; }
.col-semana .hist-barra { max-width: none; }
.col-semana .hist-barra { background: var(--destaque); }
.col-mediana { position: absolute; left: -4px; right: -4px; height: 0; border-top: 2px dotted var(--texto-2); }

/* bullet: este corretor (dourado) x time (cinza) */
.bullet { padding: var(--e3) 0; border-bottom: 1px solid var(--borda); }
.bullet:last-child { border-bottom: 0; }
.bullet-topo { display: flex; justify-content: space-between; align-items: baseline; gap: var(--e3); flex-wrap: wrap; }
.bullet-rotulo { font-size: var(--t-corpo); color: var(--texto); font-weight: 500; }
.bullet-rotulo small { color: var(--texto-3); font-weight: 400; }
.bullet-valor { font-size: var(--t-titulo); font-weight: 600; }
.bullet-trilho { position: relative; height: 16px; background: var(--trilho); border-radius: 0 4px 4px 0; margin: var(--e2) 0 6px; }
.bullet-faixa { position: absolute; top: 0; bottom: 0; background: var(--neutro); opacity: 0.45; }
.bullet-barra { position: absolute; top: 4px; bottom: 4px; left: 0; background: var(--destaque); border-radius: 0 3px 3px 0; min-width: 2px; }
.bullet-mediana { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--texto); border-radius: 1px; }
.bullet-texto { font-size: var(--t-pequeno); color: var(--texto-3); }
.bullet-texto .lado { color: var(--texto-2); font-weight: 500; }

/* heatmap */
.hm { display: grid; gap: 3px; font-size: var(--t-micro); }
.hm-hora { text-align: center; color: var(--texto-3); padding-bottom: 2px; }
.hm-dia { color: var(--texto-3); display: flex; align-items: center; }
.hm-cel { height: 22px; border-radius: 3px; }
.hm-cel.vazio { background: var(--tom-vazio); }
.hm-cel.esmaecida { opacity: 0.4; }
.hm-escala { display: flex; align-items: center; gap: 6px; font-size: var(--t-micro); color: var(--texto-3); margin-top: var(--e3); }
.hm-escala i { width: 18px; height: 10px; border-radius: 2px; display: inline-block; }

/* carteira por etapa (corretor) */
.etapa-esteira td { color: var(--texto-3); }
.tag { display: inline-block; font-size: var(--t-micro); padding: 1px var(--e2); border-radius: var(--r-pilula); border: 1px solid var(--borda-forte); color: var(--texto-3); white-space: nowrap; }
.tag-dele { color: var(--destaque-texto); border-color: color-mix(in srgb, var(--destaque) 50%, transparent); }

.link-ficha { white-space: nowrap; font-size: var(--t-pequeno); }
.vazio-msg { color: var(--texto-3); font-size: var(--t-corpo); padding: var(--e4) 0; }

/* ---------------------------------------------------------------------
   Celular / tablet
--------------------------------------------------------------------- */
@media (max-width: 960px) {
  .lateral { transform: translateX(-100%); transition: transform 0.18s ease; box-shadow: var(--sombra-dialog); }
  body.menu-aberto .lateral { transform: none; }
  body.menu-aberto .veu-menu { display: block; position: fixed; inset: 0; z-index: 25; background: var(--veu); }
  .area { margin-left: 0; }
  .barra-movel {
    display: flex; align-items: center; gap: var(--e3);
    position: sticky; top: 0; z-index: 20;
    height: 52px; padding: 0 var(--e4);
    background: var(--superficie); border-bottom: 1px solid var(--borda);
  }
  .barra-movel .marca { padding: 0; }
  .barra-movel .marca-selo { width: 28px; height: 28px; font-size: 13px; }
  .barra-movel .titulo-movel { font-weight: 600; font-size: var(--t-medio); }
  .botao-menu { background: transparent; color: var(--texto); border: 1px solid var(--borda-forte); width: 36px; height: 36px; padding: 0; }
  .botao-menu svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; }
  main#conteudo { padding: var(--e5) var(--e4) var(--e8); }
  .barra-filtros { top: 52px; margin: 0 calc(-1 * var(--e4)) var(--e4); padding: var(--e3) var(--e4); }
  .grade-2, .lado-a-lado { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  h1 { font-size: 1.25rem; }
  .bloco { padding: var(--e4); border-radius: var(--r2); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--e3); }
  .tile { padding: var(--e3) var(--e4); }
  .tile-valor { font-size: 1.6rem; }
  .tile-linha .spark { width: 64px; }
  .barra-filtros { position: static; backdrop-filter: none; }
  .barra-filtros label { flex: 1 1 calc(50% - var(--e3)); }
  .barra-filtros button { flex: 1 1 100%; }
  .funil-linha, .bh-linha, .emp-linha, .bh-taxa .bh-linha, .lado-a-lado .bh-linha, .lado-a-lado .bh-taxa .bh-linha {
    grid-template-columns: minmax(0, 1fr) auto; row-gap: 4px;
  }
  .funil-trilho, .bh-trilho, .emp-trilho, .emp-linha > .bh-sem-barra { grid-column: 1 / -1; grid-row: 2; }
  .tabela-simples td:first-child { min-width: 9rem; }
  .funil-queda { padding-left: 0; }
  .hist { gap: var(--e1); height: 150px; }
  .hist-rotulos { gap: var(--e1); }
  .hm { gap: 2px; }
  .hm-cel { height: 16px; }
  .hm-hora:nth-child(even) { visibility: hidden; }
  .codigo-pareamento { font-size: 1.5rem; }
  dialog { width: 100vw; max-width: 100vw; max-height: 92vh; margin: auto 0 0; border-radius: var(--r3) var(--r3) 0 0; }
}
