/* Sistema WGP — estilo simples, letras grandes e bom contraste */
:root {
  --fundo: #f4f6f8; --papel: #fff; --texto: #1c2430; --suave: #5b6675; --linha: #d9dee5;
  --azul: #1f4e8c; --azul-escuro: #163a69; --verde: #1d7a46; --amarelo: #9a6700; --vermelho: #b42318;
  --fundo-ok: #e6f4ec; --fundo-atencao: #fff4d6; --fundo-ruim: #fde8e6; --fundo-info: #e8f0fb;
}
* { box-sizing: border-box; }
html { font-size: 17px; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--texto); background: var(--fundo); line-height: 1.45; }
a { color: var(--azul); }
h1 { font-size: 1.6rem; margin: 0 0 .6rem; }
.sub { color: var(--suave); margin-top: 0; }
.miudo { color: var(--suave); font-size: .85rem; }
.mono { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* casca com menu lateral */
.casca { display: flex; min-height: 100vh; }
.menu { width: 220px; flex-shrink: 0; background: var(--azul-escuro); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.marca { font-weight: 800; font-size: 1.4rem; padding: 1.1rem 1.2rem; letter-spacing: .02em; }
.marca span { display: block; font-weight: 400; font-size: .85rem; opacity: .8; letter-spacing: 0; }
.menu ul { list-style: none; margin: 0; padding: 0; flex: 1; overflow-y: auto; }
.menu a { display: block; padding: .6rem 1.2rem; color: #dbe6f5; text-decoration: none; border-left: 4px solid transparent; }
.menu a:hover { background: rgba(255,255,255,.08); color: #fff; }
.menu a.atual { background: rgba(255,255,255,.14); color: #fff; border-left-color: #8fb8ff; font-weight: 600; }
.quem { padding: 1rem 1.2rem; border-top: 1px solid rgba(255,255,255,.15); font-size: .9rem; }
.quem form { margin: .3rem 0 0; }
button.link { background: none; border: 0; padding: 0; color: #b9d2ff; text-decoration: underline; cursor: pointer; font: inherit; }
.conteudo { flex: 1; padding: 1.6rem 2rem; max-width: 1200px; }

/* botões e alertas */
.botao { display: inline-block; background: var(--azul); color: #fff; border: 0; border-radius: 6px; padding: .6rem 1.2rem; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.botao:hover { background: var(--azul-escuro); }
.alerta { padding: .7rem 1rem; border-radius: 6px; border-left: 5px solid; }
.alerta.ok { background: var(--fundo-ok); border-color: var(--verde); }
.alerta.erro { background: var(--fundo-ruim); border-color: var(--vermelho); }
.alerta.info { background: var(--fundo-info); border-color: var(--azul); }
.etiqueta { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .85rem; font-weight: 600; }
.etiqueta.atencao { background: var(--fundo-atencao); color: var(--amarelo); }
.etiqueta.ruim { background: var(--fundo-ruim); color: var(--vermelho); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.cartao { background: var(--papel); padding: 2rem; border-radius: 10px; box-shadow: 0 4px 24px rgba(0,0,0,.08); width: 100%; max-width: 380px; }
.cartao h1 { color: var(--azul-escuro); }
.cartao h1 span { font-weight: 400; }
.cartao label { display: block; margin-bottom: .9rem; font-weight: 600; }
.cartao input { display: block; width: 100%; margin-top: .3rem; }
.cartao .botao { width: 100%; padding: .8rem; font-size: 1.05rem; }

/* campos */
input, select, textarea { font: inherit; padding: .5rem .6rem; border: 1px solid var(--linha); border-radius: 6px; background: #fff; color: var(--texto); }
input:focus, select:focus, textarea:focus { outline: 3px solid #a9c7f5; border-color: var(--azul); }

/* panorama */
.blocos { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.bloco { background: var(--papel); border: 1px solid var(--linha); border-left: 6px solid var(--azul); border-radius: 8px; padding: 1rem 1.2rem; text-decoration: none; color: var(--texto); }
.bloco b { display: block; font-size: 2rem; }
.bloco.atencao { border-left-color: var(--amarelo); }
.bloco.ruim { border-left-color: var(--vermelho); }

/* empresas */
.topo { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.filtros { display: flex; gap: .6rem; flex-wrap: wrap; margin: .8rem 0; }
.filtros input[type=search] { flex: 1; min-width: 240px; }
.tabela { width: 100%; border-collapse: collapse; background: var(--papel); border: 1px solid var(--linha); border-radius: 8px; }
.tabela th, .tabela td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--linha); vertical-align: top; }
.tabela th { background: #eef1f5; font-size: .9rem; color: var(--suave); }
.tabela tr.inativa td { color: var(--suave); }
.tabela .vazio { text-align: center; color: var(--suave); padding: 2rem; }

.ficha fieldset { background: var(--papel); border: 1px solid var(--linha); border-radius: 8px; margin: 0 0 1rem; padding: 1rem 1.2rem; }
.ficha legend { font-weight: 700; padding: 0 .4rem; }
.ficha label { display: block; font-weight: 600; font-size: .95rem; margin-bottom: .6rem; }
.ficha input:not([type=checkbox]), .ficha select, .ficha textarea { display: block; width: 100%; margin-top: .25rem; font-weight: 400; }
.grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 1rem; }
.caixas span { display: block; font-weight: 600; font-size: .95rem; margin-bottom: .35rem; }
label.caixa { display: inline-flex; align-items: center; gap: .3rem; margin-right: .8rem; font-weight: 400; }
.com-erro input, .com-erro select { border-color: var(--vermelho); }
.erro-campo { color: var(--vermelho); font-weight: 400; }
.acoes { display: flex; align-items: center; gap: 1rem; }

@media (max-width: 800px) {
  .casca { flex-direction: column; }
  .menu { width: 100%; height: auto; position: static; }
  .menu ul { display: flex; flex-wrap: wrap; }
  .menu a { border-left: 0; padding: .4rem .8rem; }
  .conteudo { padding: 1rem; }
}

/* fase 3: fiscal, empresa, pendências */
h2 { font-size: 1.15rem; margin: 0 0 .6rem; }
.painel { background: var(--papel); border: 1px solid var(--linha); border-radius: 8px; padding: 1rem 1.2rem; margin-bottom: 1rem; }
.resumo-empresa { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1rem; }
.resumo-empresa .painel { margin-bottom: 1rem; }
.dados { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0; }
.dados dt { color: var(--suave); font-size: .9rem; }
.dados dd { margin: 0; }
.dados.mini { font-size: .85rem; }
.observacoes { white-space: pre-wrap; line-height: 1.55; }
.observacoes-linha { white-space: pre-wrap; }
.alerta.atencao { background: var(--fundo-atencao); border-color: var(--amarelo); }
.etiqueta { background: #eef1f5; color: var(--suave); }
.etiqueta.ok { background: var(--fundo-ok); color: var(--verde); }
.etiqueta.sev-critica { background: var(--fundo-ruim); color: var(--vermelho); }
.etiqueta.sev-aviso { background: var(--fundo-atencao); color: var(--amarelo); }
.etiqueta.sev-info { background: var(--fundo-info); color: var(--azul); }
.etiqueta.st-importada { background: var(--fundo-info); color: var(--azul); }
.etiqueta.st-transmitida, .etiqueta.st-conferida { background: var(--fundo-ok); color: var(--verde); }
details.editar { margin: 1rem 0; }
details.editar > summary { cursor: pointer; font-weight: 700; padding: .6rem 0; color: var(--azul); }
.num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabela.compacta th, .tabela.compacta td { padding: .35rem .5rem; font-size: .9rem; }
.rolagem { overflow-x: auto; }
.quebra { word-break: break-all; }
.abas { display: flex; gap: .3rem; border-bottom: 2px solid var(--linha); margin-bottom: 1rem; flex-wrap: wrap; }
.abas a { padding: .5rem 1rem; text-decoration: none; border-radius: 6px 6px 0 0; }
.abas a.atual { background: var(--azul); color: #fff; }
.mes-nav { display: flex; align-items: center; gap: .8rem; font-size: 1.1rem; }
.mes-nav a { text-decoration: none; font-size: 1.3rem; padding: 0 .4rem; }
.botao.secundario { background: #e3e8ef; color: var(--texto); }
.botao.secundario:hover { background: #d3dae4; }
.botao.pequeno { padding: .3rem .7rem; font-size: .85rem; }
.botao[disabled] { opacity: .6; cursor: not-allowed; }
.acoes-linha { white-space: nowrap; }
.paginacao { display: flex; gap: 1rem; align-items: center; }
.filtros a { align-self: center; }
