/* DP Amorix — componentes de página no padrão Conecta/Guia Amorix.
   Entra DEPOIS de tema-amorix.css. Regra do arquivo: NENHUMA cor fixa
   (nada de #hex, rgb(), rgba(), nome de cor) — só var(--token) do tema,
   ou color-mix() sobre tokens. Espaçamento em múltiplos de 4.
   Escala de tipo: 34/20(título da tela, do tema)/17/14/13(tabela)/12/11. */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { -webkit-font-smoothing: antialiased; }
[hidden], .hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ic { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: -3px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.spin { animation: giro .8s linear infinite; }
@keyframes giro { to { transform: rotate(360deg); } }
.num, .font-mono { font-variant-numeric: tabular-nums; } /* Inter, nunca mono (decisão do Hebert) */
.num { text-align: right; }
td.num, .font-mono, .badge { white-space: nowrap; }  /* CPF, data, valor: nunca quebram no meio (também o <small>/<span> dentro da célula) */
.font-mono.arquivo { white-space: normal; overflow-wrap: anywhere; }
.muted { color: var(--muted); }

/* ---------- Conteúdo ---------- */
.conteudo > main { padding: 24px 28px 64px; }
.tela { display: block; }
.section-head {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 8px 16px; margin-bottom: 16px; min-height: 40px;
}
.hint { font-size: 12px; color: var(--muted); margin: 0; }
.section-head .hint { font-size: 13px; }
.mt-16 { margin-top: 16px; }
/* Repetidos aqui (já existem no global.css) para valer também sobre .hint { margin: 0 }: .hint.mt-8, .hint.mb-16 */
.mt-8 { margin-top: 8px; }
.mb-16 { margin-bottom: 16px; }

.card {
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r);
  padding: 20px;
}
h2.card-titulo {
  display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700;
  margin: 0 0 12px; color: var(--text);
}
h2.card-titulo .ic { color: var(--muted); }
.card-texto { font-size: 13px; color: var(--muted); margin: 0 0 16px; max-width: 80ch; }
.card-texto strong { color: var(--text); font-weight: 600; }

/* ---------- Botões (cor/borda/raio vêm do tema) ---------- */
.btn-primary, .btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px; font-family: inherit; font-size: 13.5px; cursor: pointer;
  white-space: nowrap;
}
.btn-secondary { font-weight: 600; }
.btn-primary:disabled, .btn-secondary:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { min-height: 32px; padding: 4px 12px; font-size: 12.5px; }
.btn-icone {
  display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0;
  background: none; border: 1px solid transparent; border-radius: 8px; color: var(--muted); cursor: pointer;
}
.btn-icone:hover { color: var(--text); background: var(--surface-2); border-color: var(--line); }

/* ---------- Campos ---------- */
label, .rotulo { display: block; font-size: 12px; font-weight: 700; color: var(--text-secondary); margin-bottom: 4px; }
input[type="text"], input[type="password"], input[type="month"], input[type="date"], input[type="search"],
input[type="number"], input[type="email"], input[type="tel"], select {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--text); font-family: inherit; font-size: 13.5px; margin: 0;
}
input::placeholder { color: var(--faint); }
input:disabled, select:disabled { opacity: .6; }
.busca { position: relative; flex: 1 1 240px; max-width: 360px; min-width: 0; }
.busca .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.busca input { padding-left: 36px; }
input[type="checkbox"] { width: 20px; height: 20px; margin: 0; accent-color: var(--destaque); flex: none; }
input[type="radio"] { width: 18px; height: 18px; margin: 0; accent-color: var(--destaque); flex: none; }
.checkbox-row { display: flex; align-items: center; gap: 12px; font-size: 13px; font-weight: 400; color: var(--text); cursor: pointer; margin: 0 0 16px; }

/* Cabeçalho do cartão de lista: filtros à esquerda, ação à direita */
.table-card-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.table-card-head select { width: auto; min-width: 128px; }
.table-card-head .sp { flex: 1; }
.table-card-head .card-titulo, .table-card-head .desc { margin: 0; }
.table-card-head .desc { font-size: 13px; color: var(--muted); flex: 1 1 280px; min-width: 0; }

/* ---------- Tabelas: rolam DENTRO do cartão (nunca alargam a página) ---------- */
.table-wrap { position: relative; overflow-x: auto; container-type: inline-size; }  /* relative: o .sr-only de th/td não escapa da rolagem */
/* Alerta (erro/vazio) dentro de célula de tabela larga: acompanha a largura VISÍVEL do cartão
   (não a do min-width da tabela) e fica colado à esquerda ao rolar. */
td > .alert-info, td > .alert-success, td > .alert-warning, td > .alert-danger {
  position: sticky; left: 8px; box-sizing: border-box; width: calc(100cqi - 16px); max-width: 720px;
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tabela-6 { min-width: 760px; }
table.tabela-7 { min-width: 860px; }
table.tabela-8 { min-width: 980px; }
table.tabela-10 { min-width: 1000px; }
table.tabela-10 th, table.tabela-10 td { padding-left: 8px; padding-right: 8px; }  /* 10 colunas de valor: cabe em 1366 sem rolar */
table.tabela-11 { min-width: 1100px; }  /* Resultado por plano (11 colunas); usar junto com .tabela-10 (célula justa) */
/* Tabela dentro de bloco ou de linha expandida (faixas, contratos da fatura, vidas do titular) */
table.tabela-aninhada { font-size: 12px; }
td.nw { white-space: nowrap; }
th {
  text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 12px; border-bottom: 1px solid var(--gridline); vertical-align: middle; overflow-wrap: break-word; }
th.num, td.num { text-align: right; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
th:first-child, td:first-child { padding-left: 8px; }
th:last-child, td:last-child { padding-right: 8px; }
td strong { font-weight: 600; }
td.col-nome { min-width: 200px; }
.col-acoes { text-align: right; white-space: nowrap; width: 1%; }
tfoot td { font-weight: 700; border-top: 1px solid var(--line); border-bottom: 0; }

/* Selo de estado: sempre ponto + texto escrito (cor nunca sozinha) */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; line-height: 1.2; white-space: nowrap;
  background: var(--surface-2); color: var(--text-secondary);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); flex: none; }
.badge-green { background: var(--ok-bg); color: var(--ok-text); }
.badge-green::before { background: var(--ok); }
.badge-red { background: var(--bad-bg); color: var(--bad-text); }
.badge-red::before { background: var(--bad); }
.badge-blue { background: var(--info-bg); color: var(--text); }
.badge-blue::before { background: var(--link); }
.badge-yellow, .badge-orange { background: var(--warn-bg); color: var(--text); }
.badge-yellow::before, .badge-orange::before { background: var(--warn); }
.badge-gray { background: var(--surface-2); color: var(--muted); }
.badge-gray::before { background: var(--faint); }
.badge .ic { width: 12px; height: 12px; vertical-align: 0; }
.badge:has(.ic)::before { display: none; }
.tipo { font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--text-secondary); }
td .badge + .badge, td strong + .badge { margin-left: 8px; }

/* ---------- Alertas (nomes do DP mantidos) ---------- */
.alert-info, .alert-success, .alert-warning, .alert-danger {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border: 1px solid; border-radius: 10px;
  font-size: 13px; line-height: 1.5; color: var(--text);
}
.alert-info .ic, .alert-success .ic, .alert-warning .ic, .alert-danger .ic { margin-top: 1px; }
.alert-info { background: var(--info-bg); border-color: color-mix(in srgb, var(--link) 40%, transparent); }
.alert-info .ic { color: var(--link); }
.alert-success { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 40%, transparent); color: var(--ok-text); }
.alert-success .ic { color: var(--ok); }
.alert-warning { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.alert-warning .ic { color: var(--warn); }
.alert-danger { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 40%, transparent); color: var(--bad-text); }
.alert-danger .ic { color: var(--bad); }
.alert-corpo { min-width: 0; flex: 1; }

/* ---------- Duas colunas (Resumo RH): colapsa em 1 no celular ---------- */
.grid-2col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 820px) { .grid-2col { grid-template-columns: minmax(0, 1fr); } }
.alert-nota { display: block; font-size: 12px; opacity: .9; margin-top: 4px; }
.alert-corpo ul { margin: 8px 0 0; padding-left: 20px; }
.alert-corpo li + li { margin-top: 4px; }
.alert-acao { margin-left: auto; align-self: center; }

/* ---------- Estados de lista ---------- */
.empty-state {
  display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 48px 20px;
  color: var(--muted); font-size: 14px; text-align: center;
}
.empty-state .ic { width: 32px; height: 32px; color: var(--faint); }
.skel {
  display: block; height: 12px; border-radius: 6px;
  background: linear-gradient(90deg, var(--line-soft) 25%, var(--line) 50%, var(--line-soft) 75%);
  background-size: 200% 100%; animation: brilho 1.4s linear infinite;
}
.skel-title { height: 28px; width: 70%; border-radius: 8px; }
@keyframes brilho { to { background-position: -200% 0; } }
.skel-row td { padding: 16px 12px; }
.skel-kpi-rotulo { width: 60%; margin-bottom: 8px; }
.skel-kpi-valor { width: 80%; margin-bottom: 8px; }
.skel-kpi-sub { width: 40%; }
.skel-row:hover td { background: none; }

/* ---------- Abas (sublinhado amarelo) ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tab-btn {
  padding: 12px 16px; min-height: 44px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  background: none; font-family: inherit; font-size: 13.5px; font-weight: 700; color: var(--muted); cursor: pointer;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--text); border-bottom-color: var(--destaque); }
/* 2º nível (planos): mesmo sublinhado, mais leve, sem linha de base */
.tabs.tabs-sub { border-bottom: 0; margin-bottom: 16px; gap: 0; }
.tabs.tabs-sub .tab-btn { padding: 8px 16px; min-height: 40px; font-size: 13px; font-weight: 600; margin-bottom: 0; }

/* ---------- Indicadores (cartão de número — Guia §12) ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 16px; }
.kpi-card {
  container-type: inline-size; min-width: 0; display: flex; flex-direction: column; gap: 4px;
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r); padding: 16px;
}
.kpi-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
/* Pior texto plausível: "R$ 999.999.999,99" em Inter 800 tabular. O "R$ " pode quebrar (o número em si nunca
   quebra), então o que precisa caber numa linha é "999.999.999,99" (~8,1em): coeficiente 11cqi com folga.
   Em cartão estreito o "R$" desce para a linha de cima; o número fica inteiro. Piso 20px vale com cartão ≥ 200px. */
.kpi-value {
  display: block; font-size: clamp(20px, 11cqi, 34px); font-weight: 800; line-height: 1.15;
  font-variant-numeric: tabular-nums; white-space: normal; color: var(--text);
}
.kpi-sub { font-size: 12px; color: var(--muted); }
.kpi-card.blue .kpi-value { color: var(--link); }
.kpi-card.green .kpi-value { color: var(--ok); }
.kpi-card.red .kpi-value { color: var(--bad); }
.kpi-card.yellow .kpi-value { color: var(--destaque); }
.kpi-card.orange .kpi-value { color: var(--warn); }
/* Contagens curtas (Importar Domínio): cartão menor, 2 por linha no celular */
.kpi-grid.contagem { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

/* ---------- Dropzone ---------- */
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; cursor: pointer;
  padding: 32px 20px; border: 2px dashed var(--line); border-radius: var(--r); background: var(--bg);
  transition: border-color .16s ease, background .16s ease;
}
.dropzone:hover, .dropzone.dragging { border-color: var(--link); background: var(--info-bg); }
.dropzone .dz-icon { width: 32px; height: 32px; color: var(--link); }
.dropzone .dz-text strong { display: block; font-size: 14px; font-weight: 600; color: var(--text); }
.dropzone .dz-text span { font-size: 12.5px; color: var(--muted); }
.dropzone .dz-file { font-size: 12.5px; font-weight: 600; color: var(--ok-text); min-height: 16px; overflow-wrap: anywhere; }
.acoes { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.fila-resumo { font-size: 13px; color: var(--muted); margin: 0 0 12px; }

/* ---------- Formulário em linha (Ocorrências) ---------- */
.ticket-form { display: grid; gap: 16px; }
.ticket-form.em-linha { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px 12px; }
.ticket-form .campo { flex: 1 1 140px; min-width: 0; }
/* Seletor com opção longa não passa da largura do campo (celular). */
.ticket-form .campo select, .ticket-form .campo input:not([type=checkbox]):not([type=radio]) { max-width: 100%; }
.ticket-form .campo.estreito { flex: 0 1 128px; }
.ticket-form .campo.medio { flex: 1 1 168px; }
.ticket-form .campo.check { flex: 0 0 auto; }
.ticket-form .campo.check .caixa { height: 40px; display: flex; align-items: center; }
.ticket-form .acao { flex: 0 0 auto; }
.ticket-form label { margin-bottom: 4px; }
.feedback { margin-top: 12px; }
.feedback:empty { display: none; }

/* ---------- Dados "rótulo / valor" em grade (Extrato, vigências, ficha do beneficiário) ---------- */
.dados { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px 16px; }
.dado { min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
.dado > small { font-size: 11px; }
.dado .total { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.total-competencia { text-align: right; }
.total-competencia .total { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .dados { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* <details> "Vidas e coparticipação" do Extrato */
.detalhes > summary {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 13px; font-weight: 600;
  cursor: pointer; list-style: none; border-radius: 4px; width: fit-content; max-width: 100%;
}
.detalhes > summary::-webkit-details-marker { display: none; }
.detalhes > summary::before {
  content: ""; width: 7px; height: 7px; flex: none; margin: 0 4px 0 2px; color: var(--muted);
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s;
}
.detalhes[open] > summary::before { transform: rotate(45deg); }
.detalhes > summary:focus-visible { outline: 2px solid var(--foco); outline-offset: 2px; }
.detalhes > div { font-size: 13px; }
.detalhes ul { margin: 0; padding-left: 20px; }
.detalhes li + li { margin-top: 4px; }

/* ---------- Caixa de sugestões da busca (Usuários, Extrato, Planos): sobre o formulário, não o empurra.
   O JS mostra/esconde com style.display ('none' | 'block'). ---------- */
.autocompletar { position: relative; }
.sugestoes {
  position: absolute; z-index: 20; left: 0; top: 100%; margin-top: 4px; min-width: min(360px, 80vw);
  max-height: 320px; overflow: auto; padding: 4px; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: 0 12px 32px var(--sombra);
}
.sugestoes .hint, .sugestoes .alert-danger { margin: 8px; }
.sugestoes .dep-tit-opcao:last-child { margin-bottom: 0; }

/* ---------- Regras de Saúde: 14 campos em grade, cada um com <label for> ---------- */
.regras-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.regras-grid .form-group { min-width: 0; }
.regra-input { font-variant-numeric: tabular-nums; }
.status-linha { font-size: 13px; color: var(--muted); }
.status-linha.ok { color: var(--ok-text); }
.status-linha.ok .ic { color: var(--ok); }

/* ---------- Modal (Conecta: .modal-overlay/.modal-box/.modal-head/.modal-close) ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: var(--fundo-dialogo);
}
.modal-box {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r);
  padding: 24px; width: 100%; max-width: 760px; max-height: 88vh; overflow-y: auto; box-shadow: 0 18px 48px var(--sombra);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.modal-head h2 { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; font-size: 16px; font-weight: 800; margin: 0; min-width: 0; overflow-wrap: anywhere; }
.modal-head .titulo-linha { display: inline-flex; align-items: flex-start; gap: 8px; min-width: 0; }
.modal-head .titulo-linha .ic { margin-top: 2px; }
.modal-close {
  flex: none; width: 36px; height: 36px; display: grid; place-items: center; background: none; border: 0;
  border-radius: 8px; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer;
}
.modal-close:hover { color: var(--text); background: var(--surface); }
.ficha-secao { padding-top: 16px; margin-top: 16px; border-top: 1px solid var(--line); }
.ficha-secao:first-child { padding-top: 0; margin-top: 0; border-top: 0; }
.ficha-secao h3 { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 12px; }
.ficha-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 24px; }
.ficha-grid dt { font-size: 11px; font-weight: 700; color: var(--muted); margin: 0 0 4px; }
.ficha-grid dd { font-size: 14px; margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
@media (max-width: 820px) { .ficha-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Modal largo para tabelas: abrirModal(titulo, conteudo, { larga: true }) e os popups de Faturas */
.modal-box.larga { max-width: min(1200px, calc(100vw - 32px)); }
.modal-box.larga.media { max-width: min(1000px, calc(100vw - 32px)); }
.modal-box.larga .modal-head:has(.fp-controles) { flex-wrap: wrap; }  /* só quando há controles no cabeçalho (Faturas); o X fica ao lado do título */
@media (max-width: 560px) {
  .ficha-grid { grid-template-columns: minmax(0, 1fr); }
  .modal-overlay { padding: 0; align-items: stretch; }
  .modal-box, .modal-box.larga, .modal-box.larga.media { max-width: none; max-height: none; height: 100%; border-radius: 0; padding: 16px; }
}

/* ---------- Toast (mesma assinatura toast(msg, tipo): ok | err | inf | warn) ---------- */
.toast {
  position: fixed; right: 24px; bottom: 24px; z-index: 120; max-width: min(360px, calc(100vw - 32px));
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-left-width: 4px;
  border-radius: 10px; font-size: 13px; font-weight: 500; line-height: 1.4; box-shadow: 0 18px 48px var(--sombra);
  opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .25s ease, transform .25s ease;
}
.toast.show { opacity: 1; transform: none; pointer-events: auto; }
.toast .ic { margin-top: 1px; }
.toast.ok { border-left-color: var(--ok); } .toast.ok .ic { color: var(--ok); }
.toast.err { border-left-color: var(--bad); } .toast.err .ic { color: var(--bad); }
.toast.inf { border-left-color: var(--link); } .toast.inf .ic { color: var(--link); }
.toast.warn { border-left-color: var(--warn); } .toast.warn .ic { color: var(--warn); }

/* ---------- Casca: peças que o tema não traz ---------- */
.logo .logo-produto {
  display: inline-flex; align-items: center; gap: 4px; color: var(--destaque); white-space: nowrap;
  border-left: 1px solid var(--line); padding-left: 8px;
}
.logo .logo-produto .ic { width: 16px; height: 16px; vertical-align: 0; }
.logo .logo-produto b { font-size: 12.5px; font-weight: 800; letter-spacing: .08em; line-height: 1; }
.rail .me { align-items: flex-start; }
.rail .me .me-info { min-width: 0; flex: 1; }
.rail .me .me-perfil { display: block; font-size: 12px; color: var(--muted); }
.rail .me .me-acoes { margin-top: 4px; }
.navlink:focus-visible, .rail .me button:focus-visible { outline-offset: -2px; }
.top .top-titulo { min-width: 0; }
.top .crumb { display: block; margin-bottom: 4px; }
.top h1 { overflow-wrap: anywhere; }

/* Seletor de competência VISÍVEL (campo de mês estilizado) */
.comp {
  display: inline-flex; align-items: center; gap: 8px; margin-left: auto;
  padding: 4px 4px 4px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
}
.comp > .ic { color: var(--muted); }
.comp label { margin: 0; font-size: 12px; font-weight: 600; color: var(--muted); }
.comp input[type="month"] {
  width: 152px; height: 32px; border: 0; border-radius: 6px; background: var(--surface-2);
  font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; padding: 0 8px;
}
.comp:focus-within { border-color: var(--foco); }
.comp input[type="month"]:focus { outline: 0; }

/* ---------- Login ---------- */
.login-pg { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.login {
  display: grid; grid-template-columns: 1fr 1fr; width: min(880px, 100%); min-height: 440px;
  border-radius: var(--r); overflow: hidden; border: 1px solid var(--line-soft); box-shadow: 0 18px 48px var(--sombra);
}
.login .brand {
  background: var(--surface-2); box-shadow: inset 0 4px 0 var(--amx-azul); border-right: 1px solid var(--line-soft);
  padding: 32px; display: flex; flex-direction: column; justify-content: space-between; gap: 24px;
}
.login .brand .logo { padding: 0; }
.login .brand .logo img { height: 36px; }
.login .brand h2 { font-size: 34px; line-height: 1.15; font-weight: 800; margin: 0 0 8px; letter-spacing: -.01em; }
.login .brand h2 em { font-style: normal; background: var(--destaque); color: var(--bg); padding: 0 8px; border-radius: 6px; }
.login .brand p { color: var(--muted); font-size: 14px; margin: 0; }
.login-card { background: var(--surface); padding: 32px; display: flex; flex-direction: column; justify-content: center; }
.login-card h1 { font-size: 20px; margin: 0 0 24px; }
.login-card .form-group { margin-bottom: 16px; }
.login-card label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.login-card input { height: 44px; font-size: 14px; }
.login-card .btn-primary { width: 100%; min-height: 44px; font-size: 14px; margin-top: 8px; }
.login-error { display: none; margin-bottom: 16px; }
.login-error.show { display: flex; }
/* Fim de sessão / acesso sem sessão (telaFimDeSessao, js/auth.js): cartão do login, sozinho */
.fim-sessao-card { width: 100%; max-width: 480px; border: 1px solid var(--line); border-radius: var(--r); }
.fim-sessao-card h1 { margin-bottom: 8px; }
.fim-sessao-card p { color: var(--muted); font-size: 14px; margin: 0; }
.fim-sessao-card .acoes a { text-decoration: none; }
.login-card .acoes .btn-primary { width: auto; margin-top: 0; }

/* Login único (INV-70/82): divisor "ou", aviso de contingência e o botão "Entrar pelo Conecta" */
.login-divisor { display: flex; align-items: center; gap: 12px; margin: 20px 0 0; font-size: 12px; color: var(--faint); }
.login-divisor::before, .login-divisor::after { content: ""; flex: 1; border-top: 1px solid var(--line-soft); }
.login-contingencia { font-size: 12.5px; color: var(--muted); text-align: center; margin: 12px 0 0; }
.login-card .login-conecta { width: 100%; min-height: 44px; margin-top: 8px; justify-content: center; text-decoration: none; }
.login-rodape { text-align: center; font-size: 11px; color: var(--muted); margin: 24px 0 0; padding-top: 16px; border-top: 1px solid var(--line-soft); }
@media (max-width: 760px) {
  .login { grid-template-columns: 1fr; min-height: 0; }
  .login .brand { padding: 24px; gap: 16px; border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .login .brand h2 { font-size: 22px; }
  .login-card { padding: 24px; }
}

/* ---------- Celular (≤760): faixa horizontal no topo, toque 44px ---------- */
@media (max-width: 760px) {
  .conteudo > main { padding: 16px 16px 48px; }
  .comp { margin-left: 0; width: 100%; }
  .comp input[type="month"] { flex: 1; width: auto; height: 36px; }
  .navlink { min-height: 44px; }
  .btn-primary, .btn-secondary, .tab-btn, input, select { min-height: 44px; }
  .btn-sm { min-height: 40px; }
  .btn-icone, .modal-close { width: 44px; height: 44px; }
  .card { padding: 16px; }
  .busca { flex: 1 1 100%; max-width: none; }
  .table-card-head select { flex: 1; }
  .table-card-head .sp { display: none; }
  .table-card-head .btn-secondary, .table-card-head .btn-primary { flex: 1 1 100%; }
  .acoes .btn-primary, .acoes .btn-secondary { flex: 1 1 100%; }
  .ticket-form .campo, .ticket-form .campo.estreito, .ticket-form .campo.medio { flex: 1 1 calc(50% - 6px); }
  .ticket-form .acao { flex: 1 1 100%; }
  .ticket-form .acao .btn-primary { width: 100%; }
  .toast { left: 16px; right: 16px; bottom: 16px; max-width: none; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab-btn { white-space: nowrap; }
  .kpi-grid { grid-template-columns: minmax(0, 1fr); }
  .kpi-grid.contagem { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .skel, .spin { animation: none; }
  .toast { transition: none; }
}

/* ---------- Casca do DP: peças do shell (index.html) ---------- */
/* Grupo do menu embrulhado num <div> (Importações: data-requer no grupo todo,
   para não sobrar título solto). O <div> não entra no layout. */
.rail nav > div { display: contents; }
.rail nav > div > .grp:first-child { padding-top: 16px; } /* o tema zera o 1º título do menu; este não é o 1º */
/* Carregando / erro ao abrir uma tela (navegarParaPagina) */
.page-loading, .page-error {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  min-height: 200px; padding: 32px 16px; text-align: center; font-size: 13px; color: var(--muted);
}
.page-loading .ic { width: 32px; height: 32px; color: var(--link); }
.page-error .ic { width: 32px; height: 32px; color: var(--bad); }
.page-error strong { font-size: 14px; color: var(--text); }
.page-error .acoes { justify-content: center; margin-top: 4px; }
/* Celular: com tela curta a grade (min-height 100vh) esticava também a linha
   do menu e sobrava um vão abaixo da faixa. O conteúdo fica com a sobra. */
@media (max-width: 760px) { .app { grid-template-rows: auto 1fr; } }

/* Celular: alvos de toque de 44px no cartão do usuário (Sair e sol/lua) */
@media (max-width: 760px) {
  .rail .me .me-acoes a, .rail .me .me-acoes button { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: flex-start; }
  .rail .me .ui-tema { min-width: 44px; min-height: 44px; }
}

/* ════════════════════════════════════════════════
   CLASSES QUE VIERAM DA MAIN (Planos, Colaboradores, dependentes) — só tokens
   ════════════════════════════════════════════════ */

/* Título das colunas fica parado enquanto a tabela rola (INV-269) */
.tabela-cabecalho-fixo { position: relative; max-height: calc(100vh - 230px); min-height: 240px; overflow: auto; }
.tabela-cabecalho-fixo thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); }
.tabela-compacta th, .tabela-compacta td { padding-left: 10px; padding-right: 10px; }

/* Valor sensível: só o olho; o valor aparece com o mouse em cima ou no toque (INV-269) */
.valor-oculto { display: inline-grid; justify-items: end; align-items: center; cursor: default; color: var(--muted); outline: none; border-radius: 4px; }
.valor-oculto:focus-visible { outline: 2px solid var(--foco); outline-offset: 2px; }
.valor-oculto > * { grid-area: 1 / 1; }
.valor-oculto > span { visibility: hidden; color: var(--text); white-space: nowrap; }
.valor-oculto:hover > i, .valor-oculto:focus > i,
.valor-oculto:hover > .ic, .valor-oculto:focus > .ic { visibility: hidden; }
.valor-oculto:hover > span, .valor-oculto:focus > span { visibility: visible; }

/* Bloco dentro de um card (vigências do plano, reajuste, vínculo do beneficiário, plano no Extrato; INV-269) */
.bloco-plano { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 14px 16px; }

/* Linha de registro inativo (dependente inativo) e "Carregando…" dentro de cartão/modal */
.linha-inativa { opacity: .55; }
/* Campo de valor da tabela de faixas (Planos) */
input.campo-faixa { max-width: 150px; }
@media (max-width: 760px) { input.campo-faixa { max-width: none; } }
.carregando-linha { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 16px 0; font-size: 13px; color: var(--muted); }

/* Colaboradores (9 colunas): linha mais justa para caber no cartão em 1366 px */
.tabela-colaboradores th, .tabela-colaboradores td { padding-left: 7px; padding-right: 7px; }
.tabela-colaboradores td.col-nome { min-width: 150px; }
.tabela-colaboradores .col-acoes .btn-sm { padding-left: 9px; padding-right: 9px; gap: 6px; }
.btn-dependentes .badge::before { display: none; }
/* Os dois botões ficam lado a lado quando cabe; senão, um embaixo do outro */
.tabela-colaboradores td.col-acoes { white-space: normal; }
.tabela-colaboradores .acoes-linha { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.tabela-colaboradores .acoes-linha .btn-sm { flex: 1 0 auto; }
/* Ações presas à direita quando a tabela rola (telas mais estreitas que 1366 px) */
@media (min-width: 761px) {
  .tabela-colaboradores th.col-acoes, .tabela-colaboradores td.col-acoes {
    position: sticky; right: 0; z-index: 1; background: var(--surface); box-shadow: -1px 0 0 var(--line);
  }
  .tabela-colaboradores thead th.col-acoes { z-index: 3; }
  .tabela-colaboradores tbody tr:hover td.col-acoes { background: var(--surface-2); }
}
@media (max-width: 760px) { .tabela-cabecalho-fixo { max-height: 70vh; } }

/* Dependentes do colaborador (INV-260): formulário em 4 colunas que vira 1 no celular. */
.dep-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 2fr) minmax(0, 1.1fr) minmax(0, 1.1fr); gap: 0 12px; }
.dep-plano { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; }
.dep-plano-campos { display: flex; gap: 8px; flex-wrap: wrap; }
.dep-plano-campos label { display: flex; flex-direction: column; gap: 2px; }
.dep-plano-campos .form-control { width: 160px; }
.dep-titulo { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 16px 0 8px; }
.dep-titulo:first-child { margin-top: 0; }
.dep-form { margin-top: 16px; padding-top: 4px; border-top: 1px solid var(--line); }
.dep-fatura { font-size: 13px; padding: 10px 12px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 8px; overflow-wrap: anywhere; }
.dep-texto { margin: 12px 0 8px; font-size: 13.5px; }
.dep-busca { max-width: 420px; }
.dep-tit-lista { margin-top: 8px; }
.dep-tit-opcao { display: flex; width: 100%; justify-content: flex-start; text-align: left; margin-bottom: 4px; white-space: normal; }
.dep-tit-opcao small { margin-left: 6px; }
.dep-cpf { display: flex; gap: 8px; }
.dep-cpf .form-control { flex: 1; min-width: 0; }
.dep-msg { font-size: 12.5px; }
.dep-plano-nome { display: flex; gap: 8px; align-items: center; font-weight: 600; min-width: 0; }
.dep-acoes { justify-content: flex-end; }
.dep-status { margin-top: 8px; font-size: 13px; }
@media (max-width: 900px) { .dep-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
@media (max-width: 560px) {
  .dep-grid { grid-template-columns: minmax(0, 1fr); }
  .dep-plano-campos, .dep-plano-campos label { width: 100%; }
  .dep-plano-campos .form-control { width: 100%; }
  .dep-rot { display: none; }
}

/* Versão no canto (INV-214): o visual está em tema-amorix.css; aqui só some na impressão */
@media print { .ui-versao, .ui-versao-balao { display: none; } }

/* ════════════════════════════════════════════════
   FATURAS E CÁLCULO e FECHAMENTO DO MÊS (vieram dos <style> das duas páginas) — só tokens.
   Ficam no fim do arquivo, como estavam (depois de tudo), para manter a mesma cascata.
   ════════════════════════════════════════════════ */

/* Pendências da competência: 3 tiles que filtram a lista */
.fp-pend-resumo { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tile-filtro {
  container-type: inline-size; min-width: 0; text-align: left; border: 1px solid var(--line); border-radius: var(--r);
  padding: 12px; background: var(--surface); color: var(--text); cursor: pointer; font: inherit; font-size: 13px;
}
.tile-filtro strong { display: block; font-size: clamp(18px, 12cqi, 28px); font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tile-filtro small { color: var(--muted); }
.tile-filtro:hover { border-color: var(--faint); }
.tile-filtro[aria-pressed="true"] { border-color: var(--destaque); outline: 2px solid var(--foco); outline-offset: 1px; }
.tile-filtro.trava strong { color: var(--bad); }

/* Grupo (por colaborador) e item de pendência/divergência */
.grupo-pend { border: 1px solid var(--line); border-radius: var(--r-sm); margin-top: 12px; overflow: hidden; }
.grupo-pend > header { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; padding: 12px; background: var(--surface-2); overflow-wrap: anywhere; }
.fp-pend-selos { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.item-pend { padding: 12px; border-top: 1px solid var(--line); font-size: 13px; overflow-wrap: anywhere; }
.item-pend.trava { box-shadow: inset 3px 0 0 var(--bad); }
.item-pend .badge, .fp-badge-quebra { white-space: normal; }
.fp-pend-onde, .fp-pend-det, .fc-pend-det { color: var(--muted); margin-top: 4px; }
.fp-pend-resolver, .fc-pend-resolver { margin-top: 8px; }
.fp-pend-atalhos, .fc-pend-acoes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
/* No modal de divergências do Fechamento o item é mais justo dos lados */
.fc-pend-item { padding: 12px 4px; }
.fc-pend-item.trava { padding-left: 12px; }

/* Sugestão de vínculo da fatura (INV-264) */
.sugestao-vinculo { margin-top: 8px; padding: 8px 12px; border: 1px dashed var(--link); border-radius: 8px; background: var(--surface-2); }
.sugestao-vinculo ul, .fp-lista { margin: 4px 0 0; padding-left: 18px; list-style: disc; }
.sugestao-vinculo li { margin: 4px 0; }
.sugestao-vinculo .bloq { color: var(--muted); }
.barra-sugestao {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 12px; padding: 12px;
  border: 1px solid var(--link); border-radius: var(--r-sm); font-size: 13px;
}

/* Selo que é botão (abre a lista de pendências, o quadro de CPFs ou as divergências do plano) */
.badge-btn { border: 0; cursor: pointer; font-family: inherit; white-space: normal; text-align: left; }
.badge-btn:hover { text-decoration: underline dotted; text-underline-offset: 3px; }
.badge-btn:focus-visible { outline: 2px solid var(--foco); outline-offset: 2px; }
td .fp-badge-quebra { display: flex; text-align: left; margin: 0 0 4px; }
td .fp-badge-quebra + .fp-badge-quebra { margin-left: 0; }
/* Fechamento: o botão envolve o selo (painel, coluna Divergências) */
.fc-div-link { border: 0; padding: 0; background: none; cursor: pointer; font: inherit; border-radius: 999px; }
.fc-div-link .badge { text-decoration: underline dotted; text-underline-offset: 3px; }
.fc-div-link:focus-visible { outline: 2px solid var(--foco); outline-offset: 2px; }
.fc-div-link + .fc-div-link { margin-left: 8px; }

/* Cores de ícone e textos */
.fp-ico-ruim { color: var(--bad); }
.fp-ico-ok { color: var(--ok); }
.fp-ico-link { color: var(--link); }
.fp-erro { color: var(--bad-text); white-space: normal; }
.fp-quebra { overflow-wrap: anywhere; }
.fp-texto, .fc-texto { font-size: 13px; }
.fc-pequeno { font-size: 12px; }
.fc-lista { font-size: 13px; list-style: disc; padding-left: 18px; }
.fc-lista li + li { margin-top: 4px; }

/* Fila de importação: nome do arquivo e competência em campo compacto */
.fp-fila-arquivo { min-width: 120px; max-width: 150px; overflow-wrap: anywhere; }
input.campo-comp { width: 96px; height: 32px; padding: 0 8px; }
.fp-linha-clicavel { cursor: pointer; }
.fp-linha-clicavel:focus-visible td { outline: 2px solid var(--foco); outline-offset: -2px; }

/* Tabela rolável com cabeçalho preso dentro de modal (Carga inicial) */
.table-wrap.fixo { max-height: 55vh; overflow: auto; }
.table-wrap.fixo thead th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); }

/* Popups da tela de Faturas (Detalhes e CPFs): controles no cabeçalho */
.fp-controles { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-left: auto; }
.fp-controles .checkbox-row { margin: 0; }
.fp-cpf-item { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px; margin-bottom: 12px; }
.fp-cpf-cols { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between; }
.fp-cpf-col { flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }
.fp-cpf-acao { flex: 0 1 auto; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; }
.fp-cpf-form { margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.fp-cpf-form fieldset { border: 0; padding: 0; margin: 0; }
.fp-cpf-form legend { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.fp-cpf-form .checkbox-row { margin: 8px 0; }
.fp-cpf-form .campo label { font-weight: 600; }
.fp-colab-btn { white-space: normal; text-align: left; justify-content: flex-start; max-width: 100%; height: auto; }

/* Fechamento: campos das abas Divergências, Descontos e PJ/MEI */
.fc-cont { width: auto; min-width: 150px; height: 32px; margin-top: 4px; }
.fc-pix { width: 150px; }
.fc-pix-valor { width: 110px; }
#fc-desc .checkbox-row { margin: 0; }

@media (max-width: 560px) {
  .fp-pend-resumo { gap: 8px; }
  .tile-filtro { padding: 8px; font-size: 12px; }
  .tile-filtro small { display: none; }
  .fp-controles { margin-left: 0; width: 100%; }
}

/* Botão Ajuda no topo (INV-328): link com cara de botão */
.btn-ajuda { text-decoration: none; }
@media (max-width: 760px) { .btn-ajuda { min-height: 40px; } }

/* Decisão em lote (INV-349): lista de quem precisa de decisão individual e do que falhou. */
.lista-simples { margin: 6px 0 0; padding-left: 18px; max-height: 240px; overflow-y: auto; }
.lista-simples li { margin: 2px 0; overflow-wrap: anywhere; }

.lote-tipos { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); margin-top: 8px; }
.lote-tipo { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); overflow-wrap: anywhere; }
.lote-tipo select { width: 100%; max-width: 100%; }
