/* =============================================================================
   Identidade visual compartilhada com o CDLhub (docs/guia-visual.md).

   Este arquivo é a versão em CSS puro dos componentes do CDLhub (Botao, MODAL,
   TABELA, KpiCard, Tabs, Segmentado, Dica, Toasts, Feedback). As telas usam estas
   classes; nenhuma tela escreve o próprio botão, campo, modal ou tabela.

   Chapado, contorno hairline, sem sombra (só no que flutua), raio máximo 8px,
   verde #009845 só para seleção, aba ativa, primário, progresso e foco.
   ============================================================================= */

/* ---- Fonte: Open Sans local (o app não depende de rede para a tipografia) ---- */
@font-face { font-family: 'Open Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/open-sans-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Open Sans'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/open-sans-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Open Sans'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/open-sans-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Open Sans'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/open-sans-latin-700-normal.woff2') format('woff2'); }
/* Itálicos: só no nome da marca. */
@font-face { font-family: 'Open Sans'; font-style: italic; font-weight: 600; font-display: block; src: url('../fonts/open-sans-latin-600-italic.woff2') format('woff2'); }
@font-face { font-family: 'Open Sans'; font-style: italic; font-weight: 700; font-display: block; src: url('../fonts/open-sans-latin-700-italic.woff2') format('woff2'); }

/* ---- Tokens (seção 11 do guia; mesmos valores do tailwind.config.js) ---- */
:root {
  --sel: #009845; --sel-dark: #007a37; --excl: #dddddd; --ink: #555555;
  --qblue: #4477aa; --qblue-dark: #35608c; --qblue-2: #7db8da; --qgray: #b0afae;
  --slate-50: #fafafa; --slate-100: #f2f2f2; --slate-200: #dddddd; --slate-300: #c4c4c4;
  --slate-400: #858585; --slate-500: #6e6e6e; --slate-600: #666666; --slate-700: #5c5c5c;
  --slate-800: #555555; --slate-900: #333333;
  --emerald-50: #ecfdf5; --emerald-500: #10b981; --emerald-700: #047857;
  --amber-50: #fffbeb; --amber-200: #fde68a; --amber-500: #f59e0b; --amber-700: #b45309; --amber-800: #92400e;
  --rose-50: #fff1f2; --rose-200: #fecdd3; --rose-300: #fda4af; --rose-500: #f43f5e; --rose-600: #e11d48; --rose-700: #be123c;
  --sky-50: #f0f9ff; --sky-500: #0ea5e9; --sky-700: #0369a1;
  --fonte: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html, body { font-family: var(--fonte); color: var(--slate-800); background: var(--slate-50); }
body { -webkit-font-smoothing: antialiased; letter-spacing: -0.01em; }
.tabular-nums, input[type="number"] { font-variant-numeric: tabular-nums; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--sel); width: 12px; height: 12px; cursor: pointer; }

/* Scrollbar: 6px, polegar slate-200, trilho transparente. */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--slate-200); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--slate-300); }
.scrollbar-none::-webkit-scrollbar { display: none; }
.scrollbar-none { -ms-overflow-style: none; scrollbar-width: none; }

/* ---- Movimento (4.4) ---- */
@keyframes fadeIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(50px); } to { opacity: 1; transform: translateX(0); } }
@keyframes scaleUp { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes girar { to { transform: rotate(360deg); } }
.animate-fade-in { animation: fadeIn 0.2s ease-out forwards; }
.animate-slide-in { animation: slideIn 0.3s ease-out forwards; }
.animate-scale-up { animation: scaleUp 0.2s ease-out forwards; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---- 6.1 Botão: 30px, 12px/500, raio 4px, px 14px ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; padding: 0 14px; border-radius: 4px; border: 1px solid transparent;
  font-family: inherit; font-size: 12px; font-weight: 500; line-height: 1; white-space: nowrap;
  cursor: pointer; text-decoration: none; transition: background-color .15s, border-color .15s, color .15s;
}
.btn:disabled, .btn[aria-disabled="true"] { opacity: .4; cursor: not-allowed; }
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }
/* Primário: verde sólido. Máximo um por tela. */
.btn-primario { background: var(--sel); border-color: var(--sel); color: #fff; }
.btn-primario:hover:not(:disabled) { background: var(--sel-dark); border-color: var(--sel-dark); }
/* Secundário: só contorno. */
.btn-secundario { background: #fff; border-color: var(--slate-200); color: var(--slate-800); }
.btn-secundario:hover:not(:disabled) { border-color: var(--slate-400); background: var(--slate-50); }
/* Ghost: sem contorno, ação terciária. */
.btn-ghost { background: transparent; color: var(--slate-600); }
.btn-ghost:hover:not(:disabled) { color: var(--slate-900); background: var(--slate-100); }
/* Perigo: contorno, nunca sólido. */
.btn-perigo { background: #fff; border-color: var(--rose-200); color: var(--rose-600); }
.btn-perigo:hover:not(:disabled) { background: var(--rose-50); border-color: var(--rose-300); }
/* Botão só de ícone: quadrado de 30px (ou 26px com .btn-icone-sm), ícone slate-400. */
.btn-icone {
  display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
  border-radius: 4px; border: 1px solid transparent; background: transparent; color: var(--slate-400);
  cursor: pointer; transition: color .15s, background-color .15s; flex-shrink: 0;
}
.btn-icone svg { width: 16px; height: 16px; }
.btn-icone:hover { color: var(--qblue-dark); background: var(--slate-100); }
.btn-icone.perigo:hover { color: var(--rose-600); background: var(--rose-50); }
.btn-icone-sm { width: 26px; height: 26px; border-radius: 3px; }
.btn-icone-sm svg { width: 14px; height: 14px; }
/* Ação em texto (dentro de uma linha): 12px qblue-dark, sem borda nem fundo. */
.acao-texto { background: none; border: 0; padding: 0; font: inherit; font-size: 12px; font-weight: 500; color: var(--qblue-dark); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.acao-texto:hover { text-decoration: underline; }
.acao-texto-perigo { background: none; border: 0; padding: 0; font: inherit; font-size: 12px; color: var(--slate-400); cursor: pointer; }
.acao-texto-perigo:hover { color: var(--rose-600); }

/* ---- 6.2 Campo, busca e seleção: 30px, 11px, borda slate-200, foco sel ---- */
.campo {
  display: block; width: 100%; height: 30px; padding: 0 10px; background: #fff;
  border: 1px solid var(--slate-200); border-radius: 4px; font-family: inherit; font-size: 11px;
  color: var(--slate-800); outline: none; transition: border-color .15s;
}
.campo::placeholder { color: var(--slate-400); }
.campo:hover:not(:focus):not(:disabled) { border-color: var(--slate-300); }
.campo:focus { border-color: var(--sel); }
.campo:disabled { background: var(--slate-50); color: var(--slate-500); }
textarea.campo { height: auto; min-height: 60px; padding: 6px 10px; line-height: 1.5; resize: vertical; }
select.campo { appearance: none; padding-right: 28px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23858585' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; }
.campo.invalido, .campo.input-erro, .input-erro { border-color: var(--rose-200) !important; }
/* Rótulo de campo: 10px slate-500, acima do campo. */
.rotulo { display: block; font-size: 10px; color: var(--slate-500); margin-bottom: 4px; }
/* Mensagem de erro de campo (validação de formulário do base.html). */
.campo-erro-msg { display: block; margin-top: 4px; font-size: 10px; color: var(--rose-700); }
/* Dica de campo: 10px slate-400. */
.campo-dica { display: block; margin-top: 4px; font-size: 10px; color: var(--slate-400); }

/* ---- Rótulo de seção (caixa alta pequena) ---- */
.rotulo-secao { font-size: 10px; font-weight: 500; color: var(--slate-400); text-transform: uppercase; letter-spacing: .025em; }

/* ---- Cartão: branco, hairline, raio 8px ---- */
.cartao { background: #fff; border: 1px solid var(--slate-200); border-radius: 8px; }
.cartao-cabecalho { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--slate-100); }
.cartao-titulo { font-size: 12px; font-weight: 600; color: var(--slate-900); letter-spacing: -0.025em; }
.cartao-subtitulo { font-size: 10px; color: var(--slate-500); margin-top: 2px; }
.cartao-corpo { padding: 16px; }

/* ---- Cabeçalho de página: nome (12px/600) + descrição (10px) + filete qblue de 2px ---- */
.pagina-cabecalho { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pagina-titulo { border-left: 2px solid var(--qblue); padding-left: 10px; }
.pagina-titulo h1 { font-size: 12px; font-weight: 600; color: var(--slate-900); letter-spacing: -0.025em; line-height: 16px; margin: 0; }
.pagina-titulo p { font-size: 10px; color: var(--slate-500); line-height: 14px; margin: 0; }
.pagina-acoes { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.pagina-titulo { min-width: 0; }

/* ---- 6.4 Cartão de KPI: hairline, filete esquerdo de 2px, rótulo 10px, número 18px/600 ---- */
.kpi-faixa { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 768px) { .kpi-faixa { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi {
  background: #fff; padding: 10px 14px; border-radius: 4px; border: 1px solid var(--slate-200);
  border-left-width: 2px; border-left-color: var(--slate-300); min-width: 0; transition: border-color .15s, box-shadow .15s;
}
.kpi[data-dica] { cursor: help; }
.kpi[data-dica]:hover { border-top-color: var(--slate-300); border-right-color: var(--slate-300); border-bottom-color: var(--slate-300); box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); }
.kpi-rotulo { font-size: 10px; color: var(--slate-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-valor { font-size: 18px; font-weight: 600; color: var(--slate-900); line-height: 1.25; margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-valor small { font-size: 10px; font-weight: 400; color: var(--slate-500); margin-left: 4px; }
/* O número é neutro; o sentido vive no filete. */
.filete-ganho { border-left-color: var(--emerald-500); }
.filete-perda { border-left-color: var(--rose-500); }
.filete-atencao { border-left-color: var(--amber-500); }
.filete-curso { border-left-color: var(--sky-500); }
.filete-dado { border-left-color: var(--qblue); }
.filete-neutro { border-left-color: var(--slate-300); }

/* Valor com sentido (ganho/perda) em texto. */
.valor-ganho { color: var(--emerald-700); }
.valor-perda { color: var(--rose-600); }
.valor-atencao { color: var(--amber-700); }

/* ---- 6.5 Abas: 12px/500, ativa com sublinhado verde de 2px ---- */
.abas { display: flex; align-items: center; gap: 24px; border-bottom: 1px solid var(--slate-200); }
.aba {
  display: inline-flex; align-items: center; gap: 6px; padding: 0 0 4px; margin-bottom: -1px;
  background: none; border: 0; border-bottom: 2px solid transparent; font: inherit; font-size: 12px; font-weight: 500;
  color: var(--slate-500); cursor: pointer; text-decoration: none; letter-spacing: -0.025em; transition: color .15s;
}
.aba:hover { color: var(--slate-800); }
.aba.ativa, .aba[aria-selected="true"] { color: var(--slate-900); border-bottom-color: var(--sel); }

/* ---- 6.2 Segmentado: segmentos em slate-100, ativo em branco com contorno, 30px ---- */
.segmentado { display: inline-flex; padding: 2px; background: var(--slate-100); border-radius: 4px; }
.segmento {
  height: 26px; padding: 0 12px; border-radius: 3px; border: 1px solid transparent; background: transparent;
  font: inherit; font-size: 12px; color: var(--slate-500); cursor: pointer; white-space: nowrap; transition: color .15s;
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
}
.segmento:hover { color: var(--slate-800); }
.segmento.ativo, .segmento[aria-pressed="true"] { background: #fff; border-color: var(--slate-200); color: var(--slate-900); font-weight: 500; }

/* ---- Seletor de período (‹ Mês de Ano ›): controles de 30px ---- */
.periodo { display: inline-flex; align-items: center; gap: 2px; height: 30px; border: 1px solid var(--slate-200); border-radius: 4px; background: #fff; }
.periodo a, .periodo button.seta { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; color: var(--slate-400); border-radius: 3px; background: none; border: 0; cursor: pointer; }
.periodo a:hover, .periodo button.seta:hover { color: var(--qblue-dark); background: var(--slate-50); }
.periodo a svg, .periodo button.seta svg { width: 14px; height: 14px; }
.periodo .rotulo-periodo { min-width: 132px; text-align: center; font-size: 12px; font-weight: 500; color: var(--slate-800); font-variant-numeric: tabular-nums; }

/* ---- 6.3 Chip de seleção: 26px, verde sólido ---- */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 4px 0 10px; border-radius: 4px; background: var(--sel); color: #fff; font-size: 11px; white-space: nowrap; }
.chip .chip-rotulo { color: rgba(255,255,255,.7); }
.chip .chip-valor { font-weight: 500; }
.chip button, .chip a { width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; border-radius: 2px; color: #fff; background: none; border: 0; cursor: pointer; }
.chip button:hover, .chip a:hover { background: var(--sel-dark); }

/* ---- 6.6 Tabela: cabeçalho slate-50 9,5px/700 caixa alta, linhas 10px slate-600 ---- */
.tabela-moldura { background: #fff; border: 1px solid var(--slate-200); border-radius: 8px; overflow: auto; position: relative; }
.tabela { width: 100%; border-collapse: collapse; }
.tabela th {
  position: sticky; top: 0; z-index: 1; background: var(--slate-50); border-bottom: 1px solid var(--slate-200);
  padding: 8px 10px; font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--slate-500); text-align: left; white-space: nowrap; user-select: none;
}
.tabela th.ordenavel { cursor: pointer; }
.tabela th.ordenavel:hover { background: var(--slate-100); }
.tabela td { padding: 6px 10px; border-bottom: 1px solid var(--slate-100); font-size: 10px; color: var(--slate-600); white-space: nowrap; vertical-align: middle; }
.tabela tbody tr { transition: background-color .15s; }
.tabela tbody tr:hover { background: rgb(250 250 250 / .5); }
.tabela tbody tr:last-child td { border-bottom: 0; }
.tabela tbody tr.marcada { background: rgb(0 152 69 / .05); }
.tabela tbody tr.marcada:hover { background: rgb(0 152 69 / .1); }
/* Números (quantidade, valor, percentual) centralizados, com o cabeçalho centralizado sobre eles. */
.tabela th.num, .tabela td.num { text-align: center; font-variant-numeric: tabular-nums; }
.tabela th.acoes, .tabela td.acoes { text-align: right; width: 1%; }
.tabela td.check, .tabela th.check { width: 34px; text-align: center; padding-left: 0; padding-right: 0; }
.tabela tfoot td { position: sticky; bottom: 0; background: var(--slate-50); border-top: 1px solid var(--slate-200); border-bottom: 0; padding: 8px 10px; font-weight: 600; color: var(--slate-800); font-variant-numeric: tabular-nums; }
/* Estilos de cada tipo de valor (CELULA do CDLhub). */
.cel-nome { font-weight: 600; color: var(--slate-800); letter-spacing: -0.025em; }
.cel-data { font-weight: 500; color: var(--slate-600); font-variant-numeric: tabular-nums; }
.cel-codigo { font-family: 'JetBrains Mono', 'Fira Code', monospace; color: var(--slate-600); }
.cel-email { color: var(--qblue-dark); text-transform: lowercase; }
.cel-apagado { color: var(--slate-500); }
.cel-vazio { color: var(--slate-300); }

/* ---- 6.7 Badge: 8,5px/700, caixa alta, raio 4px, fundo -50 e texto -700 ---- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; border-radius: 4px; font-size: 8.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .025em; line-height: 1.2; white-space: nowrap; background: var(--slate-100); color: var(--slate-500); }
.badge-ganho { background: var(--emerald-50); color: var(--emerald-700); }
.badge-atencao { background: var(--amber-50); color: var(--amber-700); }
.badge-perda { background: var(--rose-50); color: var(--rose-700); }
.badge-curso { background: var(--sky-50); color: var(--sky-700); }
.badge-neutro { background: var(--slate-100); color: var(--slate-500); }

/* Ponto de status (até 8px) e ponto de categoria (cor do dado do usuário). */
.ponto { display: inline-block; width: 8px; height: 8px; border-radius: 9999px; flex-shrink: 0; }
.ponto-sm { width: 6px; height: 6px; }

/* ---- 6.8 Modal: moldura única ---- */
.modal-fundo {
  position: fixed; inset: 0; z-index: 1500; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgb(51 51 51 / .3); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}
.modal-fundo.hidden { display: none; }
.modal-caixa {
  background: #fff; border: 1px solid var(--slate-200); border-radius: 8px;
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25); display: flex; flex-direction: column; overflow: hidden;
  width: 95%; max-width: 448px; max-height: 92vh; animation: scaleUp 0.2s ease-out forwards;
}
.modal-caixa.largo { max-width: 576px; }
.modal-caixa.extra-largo { max-width: 768px; }
.modal-cabecalho { padding: 20px 24px 16px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-shrink: 0; }
.modal-titulo { font-size: 13px; font-weight: 600; color: var(--slate-900); letter-spacing: -0.025em; margin: 0; }
.modal-subtitulo { font-size: 11px; color: var(--slate-500); margin: 4px 0 0; }
.modal-fechar {
  width: 26px; height: 26px; margin-right: -6px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  border-radius: 3px; border: 0; background: none; color: var(--slate-400); cursor: pointer; transition: color .15s, background-color .15s;
}
.modal-fechar:hover { color: var(--slate-700); background: var(--slate-50); }
.modal-fechar svg { width: 16px; height: 16px; }
.modal-corpo { padding: 0 24px 20px; overflow-y: auto; }
.modal-rodape { padding: 12px 24px; border-top: 1px solid var(--slate-200); display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-shrink: 0; }
.modal-rodape .esquerda { margin-right: auto; }

/* ---- 6.10 Tooltip: o único fundo escuro ---- */
.dica-caixa {
  position: fixed; z-index: 5000; max-width: 288px; width: max-content; pointer-events: none;
  background: var(--slate-900); color: var(--slate-300); border-radius: 4px; padding: 12px 14px;
  font-size: 11px; font-weight: 400; line-height: 1.6; text-align: left; white-space: normal; letter-spacing: normal;
  animation: fadeIn 0.2s ease-out forwards;
}
.dica-titulo { font-size: 11px; font-weight: 600; color: #fff; margin-bottom: 6px; }
.dica-grade { display: grid; grid-template-columns: auto auto; column-gap: 16px; row-gap: 2px; }
.dica-rotulo { color: var(--slate-300); }
.dica-valor { text-align: right; font-weight: 600; color: #fff; font-variant-numeric: tabular-nums; }
.dica-divisor { grid-column: 1 / -1; border-top: 1px solid rgb(255 255 255 / .1); margin: 4px 0; }
.dica-rodape { border-top: 1px solid rgb(255 255 255 / .1); margin-top: 8px; padding-top: 6px; color: var(--slate-400); }
/* Valores com sentido sobre o fundo escuro. */
.dica-ganho { color: #34d399; }
.dica-perda { color: #fb7185; }
.dica-icone { display: inline-flex; color: var(--slate-300); cursor: help; }
.dica-icone:hover { color: var(--slate-500); }
.dica-icone svg { width: 14px; height: 14px; }

/* ---- 6.11 Toast: canto inferior direito, 36px, filete de 4px e ponto ---- */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 12px; pointer-events: none; }
.toast {
  pointer-events: all; display: flex; align-items: center; gap: 12px; min-height: 36px; padding: 6px 20px;
  background: #fff; border: 1px solid var(--slate-200); border-left: 4px solid var(--qblue); border-radius: 4px;
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);
  font-size: 12px; font-weight: 600; color: var(--slate-800); cursor: pointer; max-width: 420px;
  animation: slideIn 0.3s ease-out forwards; transition: opacity .3s, transform .3s;
}
.toast .ponto { background: var(--qblue); }
.toast.erro { border-left-color: var(--rose-500); }
.toast.erro .ponto { background: var(--rose-500); }
.toast .acao-texto { font-weight: 600; margin-left: 8px; }

/* ---- 6.12 Aviso (banner): 30px, amber, uma ação em texto ---- */
.aviso { display: flex; align-items: center; gap: 8px; min-height: 30px; padding: 4px 24px; background: var(--amber-50); color: var(--amber-800); font-size: 11px; border-bottom: 1px solid var(--amber-200); }
.aviso a, .aviso button { color: var(--amber-800); font-weight: 600; text-decoration: underline; background: none; border: 0; cursor: pointer; font: inherit; font-weight: 600; }

/* ---- 6.13 Estados: carregando, vazio, erro ---- */
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--slate-200); border-top-color: var(--sel); border-radius: 9999px; animation: girar 0.8s linear infinite; flex-shrink: 0; }
.spinner.grande { width: 24px; height: 24px; }
.carregando { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 48px 0; font-size: 11px; color: var(--slate-400); }
.vazio { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; padding: 48px 24px; }
.vazio-titulo { font-size: 13px; font-weight: 600; color: var(--slate-600); margin: 0; }
.vazio-detalhe { font-size: 11px; color: var(--slate-400); max-width: 460px; line-height: 1.6; margin: 0; }
.vazio .vazio-acoes { display: flex; gap: 8px; padding-top: 8px; }
.erro-banner { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 4px; border: 1px solid var(--rose-200); background: var(--rose-50); font-size: 11px; color: var(--rose-700); }

/* ---- 6.14 Progresso: trilho de 4px slate-100, raio 2px, preenchimento verde ---- */
.progresso { height: 4px; background: var(--slate-100); border-radius: 2px; overflow: hidden; }
.progresso > span, .progresso > div { display: block; height: 100%; background: var(--sel); border-radius: 2px; transition: width .5s; }
.progresso.atencao > span, .progresso.atencao > div { background: var(--amber-500); }
.progresso.perda > span, .progresso.perda > div { background: var(--rose-500); }
.progresso.ganho > span, .progresso.ganho > div { background: var(--emerald-500); }

/* ---- 6.18 Área de envio de arquivo ---- */
.envio-arquivo { display: flex; align-items: center; justify-content: center; gap: 8px; height: 72px; border: 1px dashed var(--slate-300); border-radius: 4px; background: #fff; font-size: 12px; color: var(--slate-500); cursor: pointer; transition: color .15s, border-color .15s, background-color .15s; }
.envio-arquivo:hover, .envio-arquivo.arrastando { border-color: var(--qblue-dark); color: var(--qblue-dark); background: var(--slate-50); }
.envio-arquivo svg { width: 16px; height: 16px; }
.envio-arquivo .formatos { color: var(--slate-400); }

/* ---- Barra dos marcados (6.17): 42px, raio 8px, contorno sel/30, fundo sel/5 ---- */
.barra-marcados { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 6px 12px; border-radius: 8px; border: 1px solid rgb(0 152 69 / .3); background: rgb(0 152 69 / .05); }
.barra-marcados .contagem { font-size: 11px; font-weight: 600; color: var(--slate-800); }

/* ---- Combobox (CSD) com os estados do motor associativo ---- */
.csd-wrap { position: relative; display: inline-block; }
.csd-wrap.csd-full { display: block; width: 100%; }
.csd-trigger {
  display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; box-sizing: border-box;
  height: 30px; padding: 0 10px; min-width: 100%; background: #fff; border: 1px solid var(--slate-200); border-radius: 4px;
  font-size: 11px; color: var(--slate-800); white-space: nowrap; outline: none; transition: border-color .15s;
}
.csd-trigger:hover { border-color: var(--slate-300); }
.csd-trigger.open, .csd-trigger:focus { border-color: var(--sel); }
.csd-lbl { flex: 1; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.csd-trigger.csd-vazio .csd-lbl { color: var(--slate-500); }
.csd-arrow { flex-shrink: 0; width: 14px; height: 14px; color: var(--slate-400); transition: transform .15s; }
.csd-trigger.open .csd-arrow { transform: rotate(180deg); }
.csd-list {
  position: absolute; left: 0; right: 0; top: 34px; z-index: 2000; display: none; max-height: 260px; overflow-y: auto;
  background: #fff; border: 1px solid var(--slate-200); border-radius: 4px; padding: 4px 0;
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);
}
.csd-list.open { display: block; }
.csd-opt { display: flex; align-items: center; gap: 8px; padding: 6px 12px; font-size: 11px; color: var(--slate-800); cursor: pointer; transition: background-color .12s; }
.csd-opt:hover { background: var(--slate-50); }
/* Escolhido: verde sólido, texto branco (é seleção). */
.csd-opt.csd-active { background: var(--sel); color: #fff; }
.csd-opt.csd-ph { color: var(--slate-500); }
.csd-opt.csd-ph.csd-active { background: var(--slate-100); color: var(--slate-700); }
.csd-opt .dot, .csd-trigger .dot { width: 8px; height: 8px; border-radius: 9999px; flex-shrink: 0; }

/* ---- Menu lateral (seção 5, item 1) ---- */
.menu { width: 215px; background: #fff; border-right: 1px solid var(--slate-200); display: flex; flex-direction: column; flex-shrink: 0; position: relative; z-index: 40; transition: width .3s; }
.menu-cabecalho { height: 48px; border-bottom: 1px solid var(--slate-200); display: flex; align-items: center; padding: 0 18px; flex-shrink: 0; overflow: hidden; transition: padding .3s; }
.menu-recolher {
  position: absolute; right: -12px; top: 36px; width: 24px; height: 24px; border-radius: 4px; border: 1px solid var(--slate-200);
  background: #fff; color: var(--slate-500); display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 50; transition: color .15s, background-color .15s;
}
.menu-recolher:hover { background: var(--slate-50); color: var(--qblue-dark); }
.menu-recolher svg { width: 14px; height: 14px; transition: transform .3s; }
.menu-nav { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 8px 0; }
.menu-grupo { padding: 4px 0; }
.menu-grupo-titulo { padding: 0 18px 4px; font-size: 9px; font-weight: 500; color: var(--slate-400); text-transform: uppercase; letter-spacing: .025em; white-space: nowrap; }
.menu-item {
  position: relative; width: 100%; height: 30px; display: flex; align-items: center; gap: 8px; padding: 0 16px;
  border-left: 2px solid transparent; color: var(--slate-500); font-size: 11px; text-decoration: none; white-space: nowrap; transition: color .15s, background-color .15s;
}
.menu-item:hover { color: var(--slate-800); background: var(--slate-50); }
.menu-item svg { width: 14px; height: 14px; flex-shrink: 0; }
.menu-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* Item ativo: filete verde de 2px e fundo sel/10. */
.menu-item.ativo { border-left-color: var(--sel); background: rgb(0 152 69 / .1); color: var(--slate-900); font-weight: 600; }
.menu-item.ativo svg { color: var(--sel-dark); }
.menu-subitem { height: 26px; padding-left: 38px; font-size: 10.5px; }
.menu-subitem svg { width: 12px; height: 12px; }
.menu-divisor { margin: 4px 16px 4px 38px; border-top: 1px solid var(--slate-100); }
/* Módulo com subníveis (como no CDLhub): seta de 28px na altura da linha; ›, girada 90° quando aberto. */
.menu-expandir { width: 28px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border: 0; background: none; color: var(--slate-400); cursor: pointer; }
.menu-expandir:hover { color: var(--slate-700); background: var(--slate-50); }
.menu-expandir svg { width: 14px; height: 14px; transition: transform .15s; }
.menu-expandir.aberto svg { transform: rotate(90deg); }
.menu-modulo .menu-item:not(.menu-subitem) { padding-right: 4px; }
.menu-submenu { padding-bottom: 4px; }
/* O módulo cuja página filha está aberta: filete verde e texto em destaque, sem o fundo da seleção. */
.menu-item.pai-ativo { border-left-color: var(--sel); color: var(--slate-900); font-weight: 600; }
.menu-item.pai-ativo svg { color: var(--sel-dark); }
.menu-rodape { margin-top: auto; border-top: 1px solid var(--slate-200); background: var(--slate-50); flex-shrink: 0; padding: 10px 12px; display: flex; align-items: center; gap: 4px; }
.menu-quem { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 2px 4px; border-radius: 4px; text-decoration: none; transition: background-color .15s; }
.menu-quem:hover { background: var(--slate-100); }
.menu-quem .nome { font-size: 11px; font-weight: 600; color: var(--slate-800); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-quem .papel { font-size: 10px; color: var(--slate-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Avatar de iniciais: 26px, cinza, nunca colorido. */
.avatar { width: 26px; height: 26px; border-radius: 4px; background: var(--slate-200); color: var(--slate-700); font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; text-transform: uppercase; }

/* Recolhido: 60px, só ícones. */
.menu.recolhido { width: 60px; }
.menu.recolhido .menu-cabecalho { padding: 0 14px; }
.menu.recolhido .menu-recolher svg { transform: rotate(180deg); }
.menu.recolhido .marca-nome, .menu.recolhido .menu-grupo-titulo, .menu.recolhido .menu-item span,
.menu.recolhido .menu-subitem, .menu.recolhido .menu-divisor, .menu.recolhido .menu-expandir, .menu.recolhido .menu-submenu, .menu.recolhido .menu-quem .texto, .menu.recolhido .so-aberto { display: none; }
.menu.recolhido .menu-item { justify-content: center; padding: 0; }
.menu.recolhido .menu-rodape { flex-direction: column; padding: 12px 0; gap: 8px; }
.menu.recolhido .menu-quem { flex: none; }

/* Telas pequenas (exclusivo do Keystone): o menu vira gaveta sobre o conteúdo. */
.topo-movel { display: none; }
@media (max-width: 1023px) {
  .topo-movel { display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 16px; background: #fff; border-bottom: 1px solid var(--slate-200); flex-shrink: 0; }
  .menu { position: fixed; top: 0; bottom: 0; left: 0; z-index: 1400; transform: translateX(-100%); transition: transform .3s; width: 215px !important; }
  .menu.aberto-movel { transform: none; box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25); }
  .menu-recolher { display: none; }
  .menu-fundo-movel { position: fixed; inset: 0; z-index: 1399; background: rgb(51 51 51 / .3); backdrop-filter: blur(2px); }
}

/* ---- Marca (seção 7): a marca do produto e o nome em texto ---- */
.marca { display: flex; align-items: center; gap: 6px; text-decoration: none; min-width: 0; }
.marca svg { height: 24px; width: auto; flex-shrink: 0; }
.marca-nome { display: flex; flex-direction: column; line-height: 1; white-space: nowrap; }
.marca-nome .linha { font-style: italic; font-size: 15px; transform: scaleY(.88) skewX(4deg); transform-origin: 0 100%; letter-spacing: -0.01em; }
.marca-nome .p1 { color: #284d92; font-weight: 700; }
.marca-nome .p2 { color: var(--sel); font-weight: 600; }
.marca-nome .sub { font-size: 9px; color: var(--slate-500); margin-top: 1px; }
/* Empilhada (telas de acesso): símbolo em cima, nome no meio, assinatura embaixo. */
.marca-empilhada { display: flex; flex-direction: column; align-items: center; text-decoration: none; }
.marca-empilhada img { width: 64px; height: 64px; margin: -12px 0 -8px; } /* the symbol is wide: trims the empty top and bottom of its square box */
.marca-empilhada .marca-nome .linha { font-size: 22px; transform-origin: 50% 100%; }
.marca-assinatura { margin-top: 6px; font-size: 9px; font-weight: 500; color: var(--slate-400); text-transform: uppercase; letter-spacing: .05em; }

/* ---- Conteúdo: 24px lateral, 20px topo ---- */
.conteudo { padding: 20px 24px 24px; }
@media (max-width: 639px) { .conteudo { padding: 16px; } }

/* ---- 6.21 Menu suspenso (abre de um botão): 240px, hairline, shadow-lg, itens de 30px ---- */
.menu-suspenso { position: absolute; z-index: 2000; min-width: 200px; padding: 4px 0; background: #fff; border: 1px solid var(--slate-200); border-radius: 4px; box-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1); }
.menu-suspenso-item { width: 100%; height: 30px; display: flex; align-items: center; gap: 8px; padding: 0 12px; background: none; border: 0; font: inherit; font-size: 11px; color: var(--slate-800); text-align: left; cursor: pointer; text-decoration: none; }
.menu-suspenso-item:hover { background: var(--slate-50); }
.menu-suspenso-item svg { width: 14px; height: 14px; color: var(--slate-400); }
.menu-suspenso-item.perigo { color: var(--rose-600); }
.menu-suspenso-item.perigo svg { color: var(--rose-600); }
.menu-suspenso-divisor { margin: 4px 0; border-top: 1px solid var(--slate-100); }
.menu-suspenso-titulo { padding: 6px 12px 4px; font-size: 11px; font-weight: 600; color: var(--slate-900); }
.menu-suspenso-titulo small { display: block; font-size: 10px; font-weight: 400; color: var(--slate-500); }
.menu-suspenso-secao { padding: 6px 12px 2px; }
.menu-suspenso-item.escolhido { color: var(--sel-dark); font-weight: 600; }
.menu-suspenso-item.escolhido svg { color: var(--sel-dark); }

/* ---- 6.18 Cartão selecionável ---- */
.cartao-selecionavel { cursor: pointer; transition: border-color .15s, background-color .15s; }
.cartao-selecionavel:hover { border-color: var(--slate-300); }
.cartao-selecionavel.selecionado { border-color: var(--sel); background: rgb(0 152 69 / .05); }

/* ---- 6.23 Editor de extrato (padrão do Power Query, o mesmo do CDLhub 6.24) ---- */
.modal-caixa.tela { width: 96%; max-width: 1400px; height: 93vh; max-height: 960px; }
.modal-caixa.tela .modal-cabecalho { border-bottom: 1px solid var(--slate-200); }
.editor-faixa { display: flex; align-items: stretch; padding: 8px 14px; border-bottom: 1px solid var(--slate-200); background: #fff; overflow-x: auto; flex-shrink: 0; }
.faixa-grupo { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; border-right: 1px solid var(--slate-100); }
.faixa-grupo:first-child { padding-left: 0; }
.faixa-grupo-titulo { padding-left: 10px; font-size: 9px; font-weight: 500; color: var(--slate-400); text-transform: uppercase; letter-spacing: .025em; }
.faixa-botoes { display: flex; gap: 2px; }
.faixa-botao { height: 30px; padding: 0 10px; display: inline-flex; align-items: center; gap: 6px; border-radius: 4px; border: 0; background: none; font: inherit; font-size: 11px; font-weight: 500; color: var(--slate-700); cursor: pointer; white-space: nowrap; }
.faixa-botao:hover:not(:disabled) { background: var(--slate-100); }
.faixa-botao:disabled { opacity: .4; cursor: default; }
.faixa-botao svg { width: 14px; height: 14px; color: var(--qblue-dark); flex-shrink: 0; }
.faixa-botao svg.ok { width: 12px; height: 12px; color: var(--sel-dark); }
.faixa-direita { margin-left: auto; display: flex; align-items: flex-end; gap: 2px; padding-left: 10px; }
.editor-corpo { display: flex; flex: 1; min-height: 0; }
.editor-principal { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; padding: 12px 16px; }
.editor-barra { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.editor-barra-info { font-size: 10px; color: var(--slate-400); }
.editor-grade { flex: 1; min-height: 0; }
.editor-grade .tabela { table-layout: fixed; width: max-content; min-width: 100%; }
.editor-grade thead { position: sticky; top: 0; z-index: 2; }
.editor-grade .tabela th { position: static; width: 150px; max-width: 150px; }
.editor-grade .tabela td { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.editor-grade .tabela thead tr:first-child th { border-bottom: 0; }
.editor-grade .tabela th.num-linha, .editor-grade .tabela td.num-linha { width: 44px; text-align: right; color: var(--slate-300); font-variant-numeric: tabular-nums; }
.editor-grade .tabela th.coluna-nova, .editor-grade .tabela .linha-perfil th.coluna-nova { background: var(--slate-100); width: 120px; }
.coluna-cabeca { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.coluna-cabeca span { overflow: hidden; text-overflow: ellipsis; }
.coluna-menu { width: 18px; height: 18px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 3px; background: none; color: var(--slate-400); cursor: pointer; }
.coluna-menu:hover { color: var(--qblue-dark); background: var(--slate-100); }
.coluna-menu svg { width: 12px; height: 12px; }
.linha-perfil th { padding: 0 10px 6px; border-bottom: 1px solid var(--slate-200); font-weight: 400; text-transform: none; letter-spacing: 0; }
.barra-qualidade { display: flex; gap: 1px; height: 4px; background: #fff; border-radius: 2px; overflow: hidden; margin-bottom: 3px; }
.barra-qualidade .valido { background: var(--emerald-500); }
.barra-qualidade .invalido { background: var(--rose-500); }
.barra-qualidade .vazio { background: var(--slate-200); }
.perfil-texto { display: block; font-size: 9.5px; color: var(--slate-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.editor-grade .tabela td.mudou { color: var(--slate-900); font-weight: 500; }
.ponto-mudou, .editor-grade .tabela td.mudou::before { content: ''; display: inline-block; width: 5px; height: 5px; margin-right: 4px; vertical-align: middle; border-radius: 9999px; background: var(--qblue-dark); }
.editor-grade .tabela tr.sai td:not(.entra) { color: var(--slate-300); text-decoration: line-through; }
.editor-grade .tabela td.entra { color: var(--slate-400); }
.editor-legenda { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 10px; color: var(--slate-500); }
.editor-etapas { width: 300px; flex-shrink: 0; border-left: 1px solid var(--slate-200); display: flex; flex-direction: column; min-height: 0; background: #fff; }
.etapas-cabecalho { padding: 12px 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.etapas-cabecalho p { margin: 0; font-size: 10px; color: var(--slate-400); }
.etapas-lista { flex: 1; overflow-y: auto; }
.etapa { border-bottom: 1px solid var(--slate-100); border-left: 2px solid transparent; }
.etapa.ativa { border-left-color: var(--sel); background: rgb(0 152 69 / .1); }
.etapa-linha { display: flex; align-items: flex-start; gap: 8px; padding: 8px 8px 8px 10px; cursor: pointer; }
.etapa-num { width: 16px; flex-shrink: 0; font-size: 10px; color: var(--slate-400); font-variant-numeric: tabular-nums; line-height: 16px; }
.etapa-texto { flex: 1; min-width: 0; }
.etapa-nome { display: block; font-size: 11px; font-weight: 500; color: var(--slate-900); }
.etapa-detalhe { display: block; font-size: 10px; color: var(--slate-500); }
.etapa-remover { width: 22px; height: 22px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 3px; background: none; color: var(--slate-300); cursor: pointer; }
.etapa-remover:hover { color: var(--rose-600); background: var(--slate-50); }
.etapa-remover svg { width: 14px; height: 14px; }
.etapa-controles { padding: 0 12px 12px 36px; display: flex; flex-direction: column; gap: 8px; }
.etapas-destino { border-top: 1px solid var(--slate-200); padding: 12px; display: flex; flex-direction: column; gap: 8px; max-height: 60%; overflow-y: auto; flex-shrink: 0; }
.editor-contas { font-size: 11px; color: var(--slate-600); font-variant-numeric: tabular-nums; }
.editor-contas strong { font-weight: 600; color: var(--slate-900); }
.editor-contas span { white-space: nowrap; }
@media (max-width: 767px) {
  .editor-corpo { flex-direction: column; overflow-y: auto; }
  .editor-principal { min-height: 60vh; }
  .editor-etapas { width: 100%; border-left: 0; border-top: 1px solid var(--slate-200); }
  .modal-caixa.tela .modal-rodape { flex-wrap: wrap; }
  .modal-caixa.tela .editor-contas { flex-basis: 100%; }
}
