:root {
  --preto: #010506;
  --grafite: #1e2325;
  --texto: #2b3032;
  --texto-2: #55595a;
  --linha: #e2e0d8;
  --fundo: #f6f5f1;
  --branco: #ffffff;
  --laranja: #e35f21;
  --laranja-esc: #b4471a;
  --azul: #008aa6;
  --azul-esc: #00708a;
  --ok: #1b7f5b;
  --raio: 10px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Red Hat Display", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--texto);
  background: var(--fundo);
  font-size: 15px;
  line-height: 1.45;
}
[hidden] { display: none !important; }
h1, h2 { color: var(--preto); margin: 0; line-height: 1.15; }
h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.01em; }
h2 { font-size: 18px; font-weight: 800; }
.sub { color: var(--texto-2); margin: 6px 0 0; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- login ---------- */
.tela-login {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 32px 16px; gap: 20px;
  background: var(--preto) url("/img/fundo-login.svg") center / cover no-repeat;
}
.cartao-login {
  width: 100%; max-width: 440px; background: var(--branco); border: 1px solid var(--linha);
  border-radius: 16px; padding: 40px 36px 32px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.logo-mae { display: block; width: 260px; max-width: 100%; height: auto; margin: 0 0 28px; }
.cartao-login h1 { font-size: 22px; }
#form-login { margin-top: 26px; display: flex; flex-direction: column; gap: 10px; }
label { font-weight: 700; color: var(--preto); font-size: 14px; }
select, input[type="search"] {
  font: inherit; color: var(--preto); background: var(--branco);
  border: 1px solid #c9c6bb; border-radius: 8px; padding: 0 12px; min-height: 44px; width: 100%;
}
select:focus-visible, input:focus-visible, button:focus-visible {
  outline: 3px solid rgba(0, 138, 166, 0.45); outline-offset: 2px;
}
.btn-primario {
  margin-top: 8px; min-height: 48px; border: 0; border-radius: 8px; cursor: pointer;
  background: var(--preto); color: var(--branco); font: inherit; font-weight: 700; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
}
.btn-primario:hover:not(:disabled) { background: var(--grafite); }
.btn-primario:disabled { background: #b9bcbd; cursor: not-allowed; }
.ajuda { margin: 4px 0 0; font-size: 13px; color: var(--texto-2); }
.rodape { font-size: 12px; color: #c9c5b8; margin: 0; }

.aviso { margin-top: 18px; padding: 12px 14px; border-radius: 8px; font-size: 14px; }
.aviso-erro { background: #fbe9df; color: #7a2e0c; border: 1px solid #f1c2a6; }
.aviso-info { background: #e0f1f5; color: #0b4c5c; border: 1px solid #a9d7e2; margin: 0 0 18px; }

/* ---------- carregando ---------- */
.tela-carregando { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--texto-2); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--linha); border-top-color: var(--laranja); animation: gira 0.9s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

/* ---------- painel ---------- */
.topo {
  background: var(--branco); border-bottom: 1px solid var(--linha);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 14px clamp(16px, 4vw, 40px);
}
.logo-empresa { height: 42px; width: auto; display: block; }
.topo-dir { display: flex; align-items: center; gap: 16px; }
.quem { display: flex; flex-direction: column; align-items: flex-end; }
.quem-nome { font-weight: 700; color: var(--preto); }
.quem-det { font-size: 12px; color: var(--texto-2); }
.btn-sec {
  min-height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid #c9c6bb; background: var(--branco);
  font: inherit; font-weight: 700; color: var(--preto); cursor: pointer;
}
.btn-sec:hover { background: var(--fundo); }

.conteudo { max-width: 1280px; margin: 0 auto; padding: 28px clamp(16px, 4vw, 40px) 48px; }
.titulo-linha { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.selo { font-size: 12px; font-weight: 700; color: var(--laranja-esc); background: #fbe9df; border-radius: 999px; padding: 5px 12px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin: 22px 0 26px; }
.kpi { background: var(--branco); border: 1px solid var(--linha); border-radius: var(--raio); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.kpi-rot { font-size: 13px; color: var(--texto-2); font-weight: 500; }
.kpi strong { font-size: 30px; font-weight: 800; color: var(--preto); letter-spacing: -0.02em; }
.kpi-alerta strong { color: var(--laranja-esc); }

.bloco { background: var(--branco); border: 1px solid var(--linha); border-radius: var(--raio); padding: 20px; margin-bottom: 20px; }
.bloco h2 { margin-bottom: 14px; }
.bloco-cab { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.bloco-cab h2 { margin: 0; }
.filtros { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filtros .campo { min-width: 200px; }
.chk { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; min-height: 44px; cursor: pointer; }
.chk input { width: 18px; height: 18px; accent-color: var(--azul); }

.tabela-rolagem { overflow-x: auto; position: relative; }
.tabela { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabela th, .tabela td { padding: 10px 12px; border-bottom: 1px solid var(--linha); text-align: left; vertical-align: top; }
.tabela thead th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--texto-2); font-weight: 700; background: #faf9f6; }
.tabela .num { text-align: right; white-space: nowrap; }
.col-barra { min-width: 200px; }
.barra { display: inline-block; vertical-align: middle; width: 140px; height: 8px; border-radius: 99px; background: #ecebe5; overflow: hidden; }
.barra span { display: block; height: 100%; background: var(--azul); border-radius: 99px; }
.pct { margin-left: 10px; font-weight: 700; color: var(--preto); font-size: 13px; }
.mista { margin-left: 8px; font-size: 11px; font-weight: 700; color: var(--azul-esc); background: #e0f1f5; border-radius: 99px; padding: 2px 8px; text-transform: none; letter-spacing: 0; }

.tag { display: inline-block; font-size: 11px; font-weight: 700; border-radius: 4px; padding: 2px 7px; text-transform: none; letter-spacing: 0; }
.tag-treinamento { background: #eef0f0; color: var(--grafite); }
.tag-politica { background: #fdeee6; color: var(--laranja-esc); }

.matriz { min-width: 760px; }
.matriz thead th.grupo { text-align: center; color: var(--preto); border-left: 1px solid var(--linha); }
.matriz thead th.sub-col { text-transform: none; letter-spacing: 0; color: var(--preto); font-size: 13px; border-left: 1px solid var(--linha); min-width: 150px; }
.matriz thead th.sub-col div { margin-top: 4px; font-weight: 700; }
.matriz tbody td { border-left: 1px solid var(--linha); }
.matriz .fixa { position: sticky; left: 0; background: var(--branco); z-index: 1; min-width: 210px; }
.matriz thead .fixa { background: #faf9f6; }
.pessoa { font-weight: 700; color: var(--preto); }
.email { font-size: 12px; color: var(--texto-2); font-weight: 400; }
.st { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 99px; padding: 3px 10px; white-space: nowrap; }
.st-concluido { background: #e3f3ec; color: var(--ok); }
.st-em_andamento { background: #e0f1f5; color: var(--azul-esc); }
.st-nao_iniciado { background: #eef0f0; color: #3e4446; }
.st-atrasado { background: #fbe9df; color: var(--laranja-esc); }
.det { font-size: 12px; color: var(--texto-2); margin-top: 4px; }
.vazio { color: #9a9d9e; }
.nota { font-size: 13px; color: var(--texto-2); margin: 12px 0 0; }

@media (max-width: 640px) {
  .cartao-login { padding: 28px 20px 24px; }
  .quem { align-items: flex-start; }
  .topo-dir { width: 100%; justify-content: space-between; }
  .filtros .campo { min-width: 0; flex: 1 1 100%; }
}

/* ---------- consulta por treinamento ---------- */
.consulta { border-top: 4px solid var(--azul); }
.consulta-ctrl { display: flex; flex-wrap: wrap; gap: 14px 18px; align-items: flex-end; margin-bottom: 16px; }
.campo-conteudo { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.segmento { display: inline-flex; flex-wrap: wrap; border: 1px solid #c9c6bb; border-radius: 8px; padding: 3px; margin: 0; gap: 3px; }
.segmento label { position: relative; font-weight: 500; }
.segmento input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmento label > span { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; border-radius: 6px; color: var(--texto); white-space: nowrap; }
.segmento b { font-variant-numeric: tabular-nums; font-size: 12px; background: #eef0f0; color: var(--grafite); border-radius: 99px; padding: 1px 8px; }
.segmento input:checked + span { background: var(--preto); color: var(--branco); }
.segmento input:checked + span b { background: rgba(255, 255, 255, 0.18); color: var(--branco); }
.segmento input:focus-visible + span { outline: 3px solid rgba(0, 138, 166, 0.45); outline-offset: 1px; }
.c-resumo { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.c-resumo strong { color: var(--preto); font-size: 15px; font-variant-numeric: tabular-nums; }
.barra-larga { width: min(320px, 100%); height: 10px; }
.btn-link { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; color: var(--azul-esc); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; min-height: 32px; }
.btn-link:hover { color: var(--preto); }

/* ---------- portal v2: menu, início e administração ---------- */
input:not([type]), input[type="email"], input[type="text"] {
  font: inherit; color: var(--preto); background: var(--branco);
  border: 1px solid #c9c6bb; border-radius: 8px; padding: 0 12px; min-height: 44px; width: 100%;
}
.topo-esq { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.menu { display: flex; gap: 4px; }
.menu a {
  color: var(--texto); text-decoration: none; font-weight: 700; padding: 8px 12px; border-radius: 8px; min-height: 40px;
  display: inline-flex; align-items: center;
}
.menu a:hover { background: var(--fundo); }
.menu a[aria-current="page"] { background: var(--preto); color: var(--branco); }
.menu a:focus-visible { outline: 3px solid rgba(0, 138, 166, 0.45); outline-offset: 2px; }

.bloco-espaco { margin-top: 22px; }
.nota-0 { margin: 0; }
.cartoes { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.cartao-emp {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  border: 1px solid var(--linha); border-radius: var(--raio); background: #fcfbf8;
}
.cartao-emp-logo { width: 48px; height: 48px; object-fit: contain; flex: none; }
.cartao-emp strong { color: var(--preto); }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; white-space: nowrap; }

.dlg {
  border: 1px solid var(--linha); border-radius: 14px; padding: 0; width: min(520px, calc(100vw - 32px));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35); color: var(--texto); background: var(--branco);
}
.dlg::backdrop { background: rgba(1, 5, 6, 0.55); }
.form { display: flex; flex-direction: column; gap: 14px; padding: 24px; }
.form > label:not(.chk) { display: flex; flex-direction: column; gap: 6px; }
.form .ajuda { font-weight: 400; margin: 0; }
.form-acoes { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.btn-curto { margin-top: 0; min-height: 40px; padding: 0 20px; }
.extras { border: 1px solid var(--linha); border-radius: 8px; padding: 8px 14px 6px; margin: 0; }
.extras legend { font-weight: 700; color: var(--preto); font-size: 14px; padding: 0 4px; }
.extras .chk { min-height: 36px; display: flex; }
.extras #lista-extras:empty::after { content: "Não há outras empresas ativas."; color: var(--texto-2); font-size: 13px; }

@media (max-width: 640px) {
  .topo-esq { gap: 12px; }
  .form { padding: 18px; }
}
.acesso-adm { margin: 18px 0 0; text-align: center; font-size: 13px; }
.acesso-adm .btn-link { color: var(--texto-2); font-weight: 500; }
.ajuda-chk { margin: -8px 0 0 26px; font-size: 13px; color: var(--texto-2); }
.acoes { white-space: nowrap; }
.acoes .btn-link + .btn-link { margin-left: 14px; }
.btn-link:disabled { color: #9a9d9e; cursor: not-allowed; text-decoration: none; }
