@import url('/css/tokens.css');
@import url('/css/grid.css');
@import url('/css/telas.css');

/* Nomes antigos, mantidos para as telas e os testes que ainda os usam: apontam para os tokens. */
:root {
  --navy: var(--text);
  --navy-2: var(--primary);
  --sol: var(--warn);
  --sol-claro: var(--warn-bg);
  --tinta: var(--text);
  --mudo: var(--text-2);
  --linha: var(--border);
  --fundo: var(--bg);
  --cartao: var(--surface);
  --ok-fundo: var(--ok-bg);
  --erro: var(--error);
  --erro-fundo: var(--error-bg);
  --alerta-fundo: var(--warn-bg);
  --alerta-borda: var(--warn);
  --raio: var(--radius-card);
  --sombra: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; color-scheme: dark; overflow-x: clip; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--text); }
a:hover { color: #fff; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
[hidden] { display: none !important; }
*:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.num, .tabela td { font-variant-numeric: tabular-nums; }

/* ---------- Topo antigo (telas de entrada e testes) ---------- */
.topo { background: var(--sidebar); color: var(--text); border-bottom: 1px solid var(--grid-line); position: sticky; top: 0; z-index: 20; }
.topo .dentro { max-width: 1440px; margin: 0 auto; padding: 0 16px; height: 56px; display: flex; align-items: center; gap: 24px; }
.marca { display: flex; align-items: center; gap: 10px; font-weight: 800; white-space: nowrap; }
.marca .sol { width: 22px; height: 22px; border-radius: 6px; border: 1.5px dashed var(--text-4); }
.menu { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; }
.menu a { color: var(--text-2); text-decoration: none; padding: 8px 12px; border-radius: var(--radius); font-weight: 600; white-space: nowrap; }
.menu a:hover { background: var(--surface-2); color: #fff; }
.menu a[aria-current="page"] { background: var(--surface-2); color: #fff; box-shadow: inset 0 -2px 0 var(--primary); }

/* ---------- Esqueleto: barra lateral + conteúdo ---------- */
body.com-menu { padding-left: var(--menu-aberto); }
.menu-lateral {
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 30; width: var(--menu-aberto);
  display: flex; flex-direction: column; gap: 18px; padding: 16px 12px; overflow-y: auto;
  background: var(--sidebar); border-right: 1px solid var(--grid-line); color: var(--text);
}
/* Barra recolhida (só ícones): só no computador; no celular a barra abre sempre inteira. */
@media (min-width: 901px) {
  body.com-menu.menu-recolhido { padding-left: var(--menu-fechado); }
  .menu-recolhido .menu-lateral { width: var(--menu-fechado); align-items: center; }
  .menu-recolhido .menu-lateral .so-aberto { display: none !important; }
  .menu-recolhido .ml-topo { flex-direction: column; }
  .menu-recolhido .ml-alternar { width: 44px; }
  .menu-recolhido .ml-novo { flex: none; width: 44px; padding: 0; }
  .menu-recolhido .ml-item { justify-content: center; padding: 0; width: 44px; }
}
.ml-topo { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 40px; }
.ml-marca { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); min-width: 0; }
.ml-logo { flex: none; width: 32px; height: 32px; border-radius: 9px; border: 1.5px dashed #5A5A5A; display: inline-flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 800; color: var(--text-3); }
.ml-marca b { font-weight: 800; font-size: 15px; white-space: nowrap; }
.ml-marca small { display: block; font-size: 11px; color: var(--text-3); font-weight: 500; }
.ml-alternar { flex: none; width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border-2); background: transparent; color: var(--text-2); cursor: pointer; font: inherit; }
.ml-alternar:hover { color: #fff; background: var(--surface-2); }
.ml-acoes { display: flex; gap: 6px; width: 100%; }
.ml-novo { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 10px;
  background: var(--primary); color: var(--on-primary); font-size: 14px; font-weight: 700; text-decoration: none; border: 0; cursor: pointer; font-family: inherit; }
.ml-novo:hover { background: var(--primary-hover); color: var(--on-primary); }
.ml-busca { flex: none; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border-2); background: transparent; color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.ml-busca:hover { color: #fff; background: var(--surface-2); }
.ml-grupo { display: flex; flex-direction: column; gap: 2px; width: 100%; }
.ml-titulo { font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--text-4); padding: 6px 10px; text-transform: uppercase; }
.ml-item { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px; border-radius: 9px; font-size: 14px; font-weight: 600;
  color: var(--text-2); text-decoration: none; white-space: nowrap; background: none; border: 0; font-family: inherit; cursor: pointer; width: 100%; text-align: left; }
.ml-item:hover { background: var(--surface-2); color: #fff; }
.ml-item[aria-current="page"] { background: #1A1A1A; color: #fff; box-shadow: inset 2px 0 0 var(--primary); }
.ml-item svg { flex: none; }
.ml-item .ml-texto { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.ml-item.em-breve { cursor: default; opacity: .6; }
.ml-item.em-breve:hover { background: none; color: var(--text-2); }
.ml-item small { font-size: 11px; color: var(--text-4); font-weight: 600; }
.ml-visao { min-height: 36px; font-size: 13px; }
.ml-ponto { flex: none; width: 8px; height: 8px; border-radius: 999px; }
.ml-contador { font-size: 12px; color: var(--primary); font-variant-numeric: tabular-nums; font-weight: 600; }
.ml-contador.cinza { color: var(--text-4); }
.ml-contador.alerta { color: var(--error); }
.ml-titulo-acao { display: flex; justify-content: space-between; align-items: center; }
.ml-fixar { width: 28px; height: 28px; margin: -6px -6px -6px 0; border: 0; border-radius: 7px; background: transparent; color: var(--text-4); font: inherit; font-size: 15px; cursor: pointer; }
.ml-fixar:hover, .ml-fixar:focus-visible { background: var(--surface-2); color: #fff; }
.ml-visao-linha { position: relative; }
.ml-tirar { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border: 0; border-radius: 7px;
  background: var(--surface-2); color: var(--text-2); font: inherit; font-size: 12px; cursor: pointer; opacity: 0; }
.ml-visao-linha:hover .ml-tirar, .ml-tirar:focus-visible { opacity: 1; }
.ml-visao-linha:hover .ml-contador { visibility: hidden; }
.ml-rodape { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 12px; border-top: 1px solid var(--grid-line); width: 100%; }
.ml-perfil { display: flex; align-items: center; gap: 10px; padding: 8px 6px 0; }
.ml-avatar { flex: none; width: 32px; height: 32px; border-radius: 999px; background: #1F1F1F; border: 1px solid var(--border-2); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; }
.ml-perfil-nome { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ml-perfil-nome b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ml-perfil-nome small { font-size: 11px; color: var(--text-3); }
.ml-sair { font: inherit; font-size: 12px; font-weight: 700; color: var(--text-2); background: none; border: 0; min-height: 36px; cursor: pointer; padding: 0 4px; }
.ml-sair:hover { color: #fff; }
.faixa-ambiente { font-size: 12px; font-weight: 600; text-align: center; padding: 6px 16px; background: var(--warn-bg); color: var(--warn); border-bottom: 1px solid var(--grid-line); }
.faixa-ambiente.real { background: var(--surface); color: var(--text-3); }
.menu-celular, .menu-baixo, .menu-veu { display: none; }

@media (max-width: 900px) {
  body.com-menu { padding-left: 0; padding-top: 56px; }
  .menu-lateral { width: min(300px, 86vw); transform: translateX(-105%); transition: transform .2s; }
  .menu-lateral .ml-alternar { display: none; }
  body.menu-celular-aberto .menu-lateral { transform: none; }
  .menu-veu { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 25; }
  body.menu-celular-aberto .menu-veu { display: block; }
  .menu-celular { display: flex; align-items: center; gap: 12px; position: fixed; top: 0; left: 0; right: 0; height: 56px; z-index: 24;
    padding: 0 16px; background: var(--sidebar); border-bottom: 1px solid var(--grid-line); }
  .menu-celular button { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--border-2); background: transparent; color: var(--text); font-size: 18px; cursor: pointer; }
  .menu-celular b { font-weight: 800; font-size: 16px; }
  /* Integrador no celular: menu embaixo (Gerar, Histórico, Projetos, Mais). */
  body.com-menu-baixo { padding-bottom: 64px; }
  .menu-baixo { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 24;
    background: var(--sidebar); border-top: 1px solid var(--grid-line); }
  .menu-baixo a, .menu-baixo button { min-height: 60px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--text-2); text-decoration: none; font: inherit; font-size: 12px; font-weight: 700; background: none; border: 0; cursor: pointer; }
  .menu-baixo [aria-current="page"] { color: var(--primary); box-shadow: inset 0 2px 0 var(--primary); font-weight: 800; }
}

.pagina { max-width: 1440px; margin: 0 auto; padding: 24px 28px 40px; }
.pagina.estreita { max-width: 900px; }
@media (max-width: 600px) { .pagina { padding: 16px 16px 32px; } }
.titulo-pagina { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.titulo-pagina h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; color: var(--text); }

/* ---------- Cartões e campos ---------- */
.bloco {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 18px;
  margin: 0 0 14px;
}
.bloco > h2 { font-size: 16px; font-weight: 800; color: var(--text); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.bloco > h2 small { font-weight: 500; color: var(--text-3); font-size: 13px; }
.bloco > p.nota { margin: -6px 0 12px; color: var(--text-2); font-size: 13px; }

.grade { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px 14px; }
.c1 { grid-column: span 1; } .c2 { grid-column: span 2; } .c3 { grid-column: span 3; }
.c4 { grid-column: span 4; } .c5 { grid-column: span 5; } .c6 { grid-column: span 6; }
@media (max-width: 560px) {
  .grade { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .c1, .c2 { grid-column: span 1; }
  .c3, .c4, .c5, .c6 { grid-column: span 2; }
}

.campo { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.campo > label, .campo > .rotulo { font-size: 13px; font-weight: 600; color: var(--text-2); }
.campo > label .obr { color: var(--error); margin-left: 2px; }
input[type="text"], input[type="number"], input[type="date"], input[type="tel"], input[type="email"], input[type="password"], input[type="search"], select, textarea {
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: 8px 12px;
  min-height: 44px;
}
input::placeholder, textarea::placeholder { color: var(--text-4); }
textarea { resize: vertical; min-height: 76px; }
input:hover, select:hover, textarea:hover { border-color: #3A3A3A; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: var(--primary); }
.invalido input, .invalido select, .invalido textarea, input.invalido { border-color: var(--error); }
.ajuda { font-size: 12px; color: var(--text-3); }
.ajuda.erro { color: var(--error); font-weight: 600; }
.contador { font-size: 12px; color: var(--text-3); text-align: right; }
.contador.estourou { color: var(--error); font-weight: 600; }

.com-acao { display: flex; gap: 6px; }
.com-acao input { flex: 1; min-width: 0; }

/* Interruptor sim/não */
.interruptor { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; font-size: 14px; user-select: none; min-height: 44px; }
.interruptor input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.interruptor .trilho { width: 44px; height: 26px; border-radius: 999px; background: var(--border-2); position: relative; transition: background .15s; flex: none; }
.interruptor .trilho::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--text); transition: transform .15s; }
.interruptor input:checked + .trilho { background: var(--primary); }
.interruptor input:checked + .trilho::after { transform: translateX(18px); background: var(--on-primary); }
.interruptor input:focus-visible + .trilho { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- Botões ---------- */
.botao {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border-2);
  background: transparent;
  color: var(--text);
  padding: 0 16px;
  min-height: 40px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.botao:hover { background: var(--surface-2); color: #fff; }
.botao.primario { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.botao.primario:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--on-primary); }
.botao.destaque { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.botao.destaque:hover { background: var(--primary-hover); color: var(--on-primary); }
.botao.perigo { color: var(--error); border-color: #4A2222; }
.botao.perigo:hover { background: var(--error-bg); color: var(--error); }
.botao.pequeno { padding: 0 12px; min-height: 36px; font-size: 13px; }
.botao.grande { padding: 0 20px; font-size: 15px; min-height: 48px; }
.botao:disabled, .botao.desabilitado { background: #1C1C1C; border-color: #1C1C1C; color: #6A6A6A; cursor: not-allowed; }
.botao-link { background: none; border: 0; padding: 0; font: inherit; font-size: 13px; font-weight: 700; color: var(--primary); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.botao-link:hover { color: var(--primary-hover); }

/* ---------- Avisos ---------- */
.aviso {
  border-radius: 12px;
  padding: 12px 16px;
  margin: 0 0 14px;
  font-size: 14px;
  border: 0;
  background: var(--surface-2);
  color: var(--text);
}
.aviso.alerta { background: var(--warn-bg); color: var(--warn); }
.aviso.erro { background: var(--error-bg); color: var(--error); }
.aviso.ok { background: var(--ok-bg); color: var(--ok); }
.aviso.info { background: var(--info-bg); color: var(--info); }
.aviso a { color: inherit; font-weight: 700; }
.aviso ul { margin: 6px 0 0; padding-left: 18px; }
.aviso strong { font-weight: 800; }

/* ---------- Gerador ---------- */
.gerador { display: grid; grid-template-columns: minmax(360px, 560px) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1000px) { .gerador { grid-template-columns: minmax(0, 1fr); } }

.barra-negocio { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.barra-negocio .qual { font-size: 13px; color: var(--text-2); }
.barra-negocio .qual b { color: var(--text); }

.seletor {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
  margin-bottom: 14px;
}
.seletor button {
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  border: 0;
  border-radius: var(--radius);
  min-height: 40px;
  padding: 0 6px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.seletor button:hover { color: #fff; }
.seletor button[aria-pressed="true"] { background: var(--surface-2); color: #fff; box-shadow: inset 0 -2px 0 var(--primary); }
.seletor .ponto { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }

.adicional { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 2fr) 70px auto; gap: 8px; align-items: end; margin-bottom: 8px; }
@media (max-width: 560px) { .adicional { grid-template-columns: minmax(0, 1fr) 70px auto; } .adicional .esp { grid-column: 1 / -1; grid-row: 2; } }

.calculado input { background: var(--surface-2); }
.calculado.manual input { border-style: dashed; border-color: var(--warn); }

.conferencia { font-size: 13.5px; font-weight: 600; padding: 10px 12px; border-radius: var(--radius); }
.conferencia.ok { background: var(--ok-bg); color: var(--ok); }
.conferencia.falta { background: var(--error-bg); color: var(--error); }

.resumo {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-card);
  padding: 12px 16px;
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 12px;
  font-variant-numeric: tabular-nums;
}
.resumo .rot { display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--primary); margin-bottom: 2px; font-weight: 800; }

.acoes { display: flex; flex-direction: column; gap: 10px; }
.acoes .dica { font-size: 13px; color: var(--text-3); margin: 0; }
.proximos { display: flex; gap: 8px; flex-wrap: wrap; }

/* Prévia (o documento continua branco, como sai no PDF) */
.lado-previa { position: sticky; top: 16px; }
@media (max-width: 1000px) { .lado-previa { position: static; } }
.previa-topo { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.previa-topo h2 { font-size: 15px; font-weight: 800; color: var(--text); }
.previa-topo span { font-size: 12.5px; color: var(--text-3); }
.previa {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 12px;
  max-height: calc(100vh - 120px);
  overflow: auto;
}
@media (max-width: 1000px) { .previa { max-height: 75vh; } }
.previa .palco { position: relative; overflow: hidden; margin: 0 auto; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.5); }
.previa iframe { position: absolute; left: 0; top: 0; border: 0; width: 210mm; transform-origin: 0 0; background: #fff; }
.previa iframe.carregando { visibility: hidden; }

.whats { margin-top: 16px; }
.whats textarea { min-height: 260px; font-size: 13.5px; line-height: 1.5; }
.whats .botoes { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

/* ---------- Histórico ---------- */
.negocios { display: flex; flex-direction: column; gap: 10px; }
.negocio {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px 16px;
  align-items: center;
}
.negocio .quem b { font-size: 15px; display: block; overflow-wrap: anywhere; }
.negocio .quem small { color: var(--text-3); font-size: 12px; }
.negocio .valor { font-weight: 800; color: var(--text); white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.negocio .valor small { display: block; font-weight: 500; color: var(--text-3); font-size: 12px; }
.negocio .selos { display: flex; gap: 6px; flex-wrap: wrap; }
.negocio .botoes { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 640px) {
  .negocio { grid-template-columns: minmax(0, 1fr); }
  .negocio .valor { text-align: left; }
  .negocio .botoes { justify-content: flex-start; }
}
.selo {
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  padding: 4px 10px;
  border: 1px dashed #3A3A3A;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.selo:hover { border-color: var(--primary); color: #fff; }
.selo.gerado { border: 0; background: var(--ok-bg); color: var(--ok); }
.selo.gerado:hover { background: #22301A; }
.vazio-lista { text-align: center; color: var(--text-3); padding: 40px 16px; background: transparent; border: 1px dashed var(--border-2); border-radius: var(--radius-card); }

/* ---------- Configurações ---------- */
.logo-previa { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.logo-previa img { max-height: 56px; max-width: 200px; border: 1px solid var(--border-2); border-radius: 8px; padding: 4px; background: #fff; }
.destaque-linha { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px; margin-bottom: 8px; }
.procurador-linha { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; align-items: end; margin-bottom: 10px; }
.procurador-linha.fixo { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 10px 12px; border: 1px dashed var(--border-2); border-radius: var(--radius); }
.procurador-linha.invalido { outline: 1px solid var(--error); outline-offset: 4px; border-radius: 4px; }
@media (max-width: 560px) { .procurador-linha { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .procurador-linha .campo:first-child { grid-column: 1 / -1; } }
.rodape-salvar {
  position: sticky; bottom: 0;
  background: rgba(10, 10, 10, .92);
  border-top: 1px solid var(--grid-line);
  padding: 12px 0;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.rodape-salvar .estado { font-size: 14px; color: var(--text-2); }

.fixo { background: var(--surface-2); border: 1px dashed var(--border-2); border-radius: var(--radius); padding: 10px 12px; font-size: 13.5px; color: var(--text-2); }

/* Mensagem curta no canto */
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: var(--text); color: var(--on-primary); padding: 14px 16px; border-radius: 12px;
  font-size: 14px; font-weight: 700; z-index: 50; box-shadow: 0 12px 32px rgba(0,0,0,.5);
  max-width: calc(100vw - 32px);
}
@media (max-width: 900px) { .com-menu-baixo .toast { bottom: 76px; } }

/* =====================================================================
   Área do eletrotécnico (homologação)
   ===================================================================== */
.faixa-privacidade { background: var(--surface); color: var(--text-3); font-size: 12.5px; text-align: center; padding: 4px 16px; }
.menu-sair { font: inherit; font-weight: 600; color: var(--text-2); background: none; border: 1px solid var(--border-2); border-radius: var(--radius); padding: 6px 10px; cursor: pointer; margin-left: 4px; }
.menu-sair:hover { color: #fff; background: var(--surface-2); }
body.ocupado, body.ocupado * { cursor: progress !important; }

.trava { position: fixed; inset: 0; background: rgba(0, 0, 0, .7); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 40; }
.trava-caixa { width: 100%; max-width: 380px; margin: 0; }

.tabela-rolagem { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); }
/* Nenhuma barra de rolagem para o lado à vista (pedido do eletrotécnico): quando falta espaço, ainda dá para
   arrastar para o lado (toque, Shift + roda do mouse). As grades já se ajustam à largura (js/grid.js). */
.tabela-rolagem, .cfg-tabela-rolagem, .pj-etapas, .menu, .grid-rolagem { scrollbar-width: none; }
.tabela-rolagem::-webkit-scrollbar, .cfg-tabela-rolagem::-webkit-scrollbar, .pj-etapas::-webkit-scrollbar, .menu::-webkit-scrollbar,
.grid-rolagem::-webkit-scrollbar { display: none; }
.tabela { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabela th { text-align: left; font-size: 12px; color: var(--text-3); font-weight: 700; padding: 0 12px; height: 40px; border-bottom: 1px solid var(--grid-line); white-space: nowrap; background: var(--grid-head); }
.tabela td { padding: 10px 12px; min-height: 46px; border-bottom: 1px solid var(--grid-line); vertical-align: middle; }
.tabela tbody tr:last-child td { border-bottom: 0; }
.tabela tbody tr[data-id] { cursor: pointer; }
.tabela tbody tr:hover td { background: var(--row-hover); }
.acoes-col { text-align: right; width: 1%; white-space: nowrap; }
.botoes-linha { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-start; align-items: center; }
.acoes-col .botoes-linha { justify-content: flex-end; flex-wrap: nowrap; }

.selos-doc { display: flex; gap: 4px; flex-wrap: wrap; }
.selo-doc { font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--warn-bg); color: var(--warn); border: 0; }
.selo-doc.gerado { background: var(--ok-bg); color: var(--ok); }

.gerador.homologacao { grid-template-columns: minmax(380px, 680px) minmax(0, 1fr); }
@media (max-width: 1100px) { .gerador.homologacao { grid-template-columns: minmax(0, 1fr); } }

details.secao, details.leitura-ia { padding: 0; }
details.secao > summary, details.leitura-ia > summary { list-style: none; cursor: pointer; padding: 16px 18px; font-weight: 800; color: var(--text); font-size: 15px; display: flex; gap: 4px; flex-wrap: wrap; align-items: baseline; min-height: 44px; }
details.secao > summary::-webkit-details-marker, details.leitura-ia > summary::-webkit-details-marker { display: none; }
details.secao > summary::before, details.leitura-ia > summary::before { content: "▸"; color: var(--text-3); margin-right: 6px; transition: transform .15s; display: inline-block; }
details.secao[open] > summary::before, details.leitura-ia[open] > summary::before { transform: rotate(90deg); }
details.secao > summary .falta { font-weight: 600; font-size: 13px; color: var(--warn); }
details.secao > summary .falta.ok { color: var(--ok); }
details.secao > :not(summary), details.leitura-ia > :not(summary) { margin-left: 18px; margin-right: 18px; }
details.secao[open], details.leitura-ia[open] { padding-bottom: 18px; }
.subtitulo { font-size: 14px; font-weight: 800; color: var(--text); margin: 16px 0 8px; }
.subtitulo small { font-weight: 500; color: var(--text-3); }

.anexo { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; border: 1.5px dashed #3A3A3A; border-radius: 12px; padding: 10px 12px; background: var(--field); }
.anexo.tem { border-style: solid; border-color: var(--border-2); }
.anexo-nome { font-size: 13.5px; color: var(--text-2); flex: 1; min-width: 140px; overflow-wrap: anywhere; }
.anexo.tem .anexo-nome { color: var(--text); }
.miniatura { max-height: 56px; max-width: 120px; border-radius: 6px; border: 1px solid var(--border-2); background: #fff; }

.carga-edit input { min-height: 36px; padding: 4px 8px; font-size: 14px; }
.carga-edit td { padding: 6px; }
.carga-edit td.calc { white-space: nowrap; font-weight: 700; color: var(--text); text-align: right; }
.carga-edit th:nth-child(1) { width: 64px; } .carga-edit th:nth-child(3), .carga-edit th:nth-child(4) { width: 96px; }
.carga-edit tfoot td { background: var(--grid-head); font-weight: 800; text-align: right; }
.carga-edit tfoot td:first-child { text-align: left; }

.acoes-gerais { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.cartoes-doc { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; margin-bottom: 10px; }
.cartao-doc { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.cartao-doc.selecionado { border-color: var(--primary); background: var(--row-selected); }
.cartao-topo { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.cartao-nome { font: inherit; font-size: 14px; text-align: left; background: none; border: 0; padding: 0; color: var(--text); cursor: pointer; }
.cartao-nome b { color: var(--text-2); margin-right: 4px; font-variant-numeric: tabular-nums; }
.cartao-doc p { margin: 0; }
.aviso-doc { color: var(--warn) !important; }
.status { font-size: 12px; font-weight: 700; border-radius: 999px; padding: 3px 9px; white-space: nowrap; }
.status.ok { background: var(--ok-bg); color: var(--ok); }
.status.ok::before { content: "✓ "; }
.status.pronto { background: var(--info-bg); color: var(--info); }
.status.pronto::before { content: "● "; }
.status.pendente { background: var(--warn-bg); color: var(--warn); }
.status.pendente::before { content: "⚠ "; }

.dialogo { border: 1px solid var(--border-2); border-radius: 16px; padding: 18px; width: min(640px, calc(100vw - 32px));
  background: #141414; color: var(--text); box-shadow: 0 16px 40px rgba(0,0,0,.5); }
.dialogo::backdrop { background: rgba(0, 0, 0, .7); }
.dialogo-topo { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.dialogo-topo h2 { font-size: 16px; font-weight: 800; color: var(--text); }
.linha-trt { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--grid-line); }
.linha-trt > div { flex: 1; min-width: 0; }
.linha-trt small { display: block; font-size: 12px; color: var(--text-3); font-weight: 600; }
.linha-trt span { overflow-wrap: anywhere; }
.linha-cfg-trt { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.2fr) minmax(0, 1.4fr) auto; gap: 6px; margin-bottom: 6px; align-items: center; }
@media (max-width: 640px) { .linha-cfg-trt { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.padroes input { min-height: 36px; padding: 4px 8px; font-size: 13.5px; min-width: 110px; }
.padroes td:first-child { font-size: 13px; color: var(--text-2); min-width: 170px; }
button.selo-doc { font: inherit; font-size: 11.5px; font-weight: 700; cursor: pointer; }
.grupo-equip + .grupo-equip, .grupo-equip + .botao { margin-top: 6px; }
.subtitulo .botao { margin-left: 8px; vertical-align: middle; }

/* Lista de sugestões (js/combobox.js): colada embaixo do campo, mesma largura. */
.combo { position: relative; }
.combo > input { width: 100%; }
.combo-lista {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 30;
  margin: 2px 0 0; padding: 4px 0; list-style: none;
  max-height: 240px; overflow-y: auto;
  background: var(--surface-2); border: 1px solid var(--border-2); border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.5);
}
.combo-lista.acima { top: auto; bottom: 100%; margin: 0 0 2px; }
.combo-lista li { padding: 10px 12px; cursor: pointer; font-size: 14px; color: var(--text-2); }
.combo-lista li:hover, .combo-lista li[aria-selected="true"] { background: #1F1F1F; color: var(--text); font-weight: 700; }
input:disabled, select:disabled, textarea:disabled { background: #101010; color: #6A6A6A; border-color: var(--border); cursor: not-allowed; }
.maiusculas { text-transform: uppercase; }

/* Anexos com vários arquivos */
.arquivos { display: flex; flex-direction: column; gap: 0; margin-top: 6px; }
.arquivo { display: flex; align-items: center; gap: 12px; border-top: 1px solid var(--grid-line); padding: 10px 0; background: transparent; }
.arquivo .ordem { font-weight: 700; color: var(--text-3); width: 18px; text-align: center; }
.arquivo .miniatura, .arquivo .icone-pdf { width: 72px; height: 52px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border-2); flex: none; }
.arquivo .icone-pdf { display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--error); background: #1C1C1C; }
.arquivo .nome-arq { flex: 1; min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
.arquivo .nome-arq small { display: block; color: var(--text-3); font-size: 12px; }

/* Anexos do cadastro dentro do projeto (datasheet / INMETRO) */
.anexos-equip { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 6px; font-size: 13px; }
.anexos-equip .tem-anexo { color: var(--ok); font-weight: 600; }

/* Resultado do "Baixar tudo" */
.resultado-zip { margin: 0 0 12px; }
.resultado-zip ul { margin: 6px 0 0; padding-left: 18px; }

/* Listas reordenáveis (Configurações) */
.linha-ordem { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--grid-line); }
.linha-ordem .ordem { color: var(--text-3); font-weight: 700; margin-right: 2px; }
.linha-ordem.fora .interruptor > span:last-child, .linha-cfg-trt.fora input[type="text"], .linha-cfg-trt.fora select { opacity: .5; }
.linha-ordem .interruptor { font-weight: 500; }
.linha-cfg-trt { grid-template-columns: auto minmax(0, 1.2fr) minmax(0, 1.2fr) minmax(0, 1.4fr) auto; }
@media (max-width: 640px) { .linha-cfg-trt { grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr); } }

/* ---------- Entrar (login e 2FA) ---------- */
.pagina.entrar { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.entrar-caixa { width: 100%; max-width: 420px; }
.entrar-caixa form, .entrar-caixa [data-etapa] { display: flex; flex-direction: column; gap: 12px; }
.entrar-caixa [hidden] { display: none !important; }
.entrar-botoes { display: flex; gap: 12px; align-items: center; margin-top: 4px; }
.entrar-passos { margin: 0; padding-left: 18px; font-size: 13px; color: var(--text-2); display: grid; gap: 4px; }
.entrar-qr { display: flex; justify-content: center; padding: 12px; background: #fff; border-radius: 12px; }
.entrar-qr img { width: 220px; max-width: 100%; height: auto; aspect-ratio: 1; image-rendering: pixelated; }
.entrar-caixa code { font-size: 15px; letter-spacing: .5px; word-break: break-all; user-select: all; color: var(--primary); }
.entrar-caixa .aviso { margin: 12px 0 0; }
.entrar-abas { display: flex; gap: 16px; margin: -4px 0 12px; border-bottom: 1px solid var(--grid-line); padding-bottom: 8px; }
.entrar-abas .botao-link { font-size: 14px; text-decoration: none; color: var(--text-2); }
.entrar-abas .botao-link[aria-selected="true"] { color: var(--text); font-weight: 800; box-shadow: 0 10px 0 -8px var(--primary); }
.entrar-caixa .interruptor { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; }
.entrar-caixa .interruptor input { margin-top: 3px; }
.captcha:empty { display: none; }

/* Selos de status: cor + ícone + texto (nunca só cor) */
.situacao { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.situacao.rascunho { background: transparent; color: var(--text-2); border: 1px dashed #3A3A3A; }
.situacao.enviado { background: var(--info-bg); color: var(--info); }
.situacao.enviado::before { content: "●"; }
.situacao.recebido { background: var(--ok-bg); color: var(--ok); }
.situacao.recebido::before { content: "✓"; }
.andamento-selo { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap;
  background: #1C1C1C; color: var(--text-2); }
.andamento-selo.aguardando_envio::before { content: "○"; }
.andamento-selo.em_analise { background: var(--info-bg); color: var(--info); }
.andamento-selo.em_analise::before { content: "◔"; }
.andamento-selo.aprovado { background: var(--ok-bg); color: var(--ok); }
.andamento-selo.aprovado::before { content: "✓"; }
.andamento-selo.finalizado { background: var(--text); color: var(--on-primary); }
.andamento-selo.finalizado::before { content: "✓✓"; }
.andamento-selo.rede { background: var(--warn-bg); color: var(--warn); }
.andamento-selo.rede::before { content: "⚠"; }

/* Documentos: só o selecionado mostra os detalhes. */
.cartao-doc:not(.selecionado) > p.ajuda { display: none; }

/* Ler documentos com IA (projeto e gerador) */
.leitura-ia { border-color: var(--border); background: var(--surface); }
.leitura-ia .soltar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border: 1.5px dashed #3A3A3A; border-radius: 12px; padding: 14px; background: var(--field); }
.leitura-ia .soltar.arrastando { border-color: var(--primary); background: var(--row-selected); }
.leitura-ia .aviso { margin: 12px 0 0; }
.leitura-ia .subtitulo { margin-top: 14px; }
.ia-tabela td small { display: block; }
.ia-tabela tr.nao-conferido td { background: var(--error-bg); }
.ia-tabela select { max-width: 220px; }
.ia-tabela input[type="checkbox"], input[type="checkbox"] { accent-color: var(--primary); width: 18px; height: 18px; }
