/* E-Valida — folha de estilo única (sem dependências externas). */
:root {
  --fundo: #f4f6f8;
  --superficie: #ffffff;
  --superficie-2: #f8fafb;
  --borda: #dde3e8;
  --borda-forte: #c4ced6;
  --texto: #17232d;
  --texto-2: #4f5f6c;
  --texto-3: #6f7e8a;
  --marca: #0d5c63;
  --marca-escura: #0a454a;
  --marca-clara: #e3f1f1;
  --foco: #1f6feb;
  --ok: #1f7a4d;
  --ok-fundo: #e6f4ec;
  --atencao: #8a5a00;
  --atencao-fundo: #fff4d6;
  --alerta: #b42318;
  --alerta-fundo: #fdecea;
  --neutro: #475467;
  --neutro-fundo: #eef1f4;
  --raio: 8px;
  --sombra: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --fonte: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: var(--fonte); color: var(--texto); background: var(--fundo); line-height: 1.5; }
a { color: var(--marca); }
a:hover { color: var(--marca-escura); }
:focus-visible { outline: 3px solid var(--foco); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6rem; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.15rem; margin-top: 1.6rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8rem; }
small, .pequeno { font-size: .85rem; }
.mudo { color: var(--texto-3); }
.mono { font-family: var(--mono); font-size: .88em; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.pular { position: absolute; left: -999px; top: 0; background: var(--marca); color: #fff; padding: .5rem 1rem; z-index: 10; }
.pular:focus { left: 1rem; }

/* estrutura */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; background: linear-gradient(to right, var(--marca-escura) 236px, var(--fundo) 236px); }
.lateral { background: var(--marca-escura); color: #dbeceb; padding: 1.1rem .8rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.marca { display: flex; align-items: center; gap: .55rem; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.15rem; padding: 0 .5rem 1rem; letter-spacing: .2px; }
.marca:hover { color: #fff; }
.marca-sinal { width: 30px; height: 30px; border-radius: 7px; background: #fff; color: var(--marca-escura); display: grid; place-items: center; font-weight: 800; font-size: .95rem; }
.lateral nav a { display: block; color: #dbeceb; text-decoration: none; padding: .5rem .7rem; border-radius: 6px; font-size: .95rem; }
.lateral nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.lateral nav a[aria-current="page"] { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; }
.lateral .grupo { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: #9cc5c3; margin: 1.1rem .7rem .3rem; }
.lateral .usuario { border-top: 1px solid rgba(255,255,255,.15); margin-top: 1.2rem; padding: .9rem .7rem 0; font-size: .85rem; }
.lateral .usuario button { background: none; border: 1px solid rgba(255,255,255,.35); color: #fff; border-radius: 6px; padding: .3rem .7rem; cursor: pointer; margin-top: .4rem; }
.principal { padding: 1.4rem 2rem 3rem; max-width: 1480px; width: 100%; }
.trilha { font-size: .85rem; color: var(--texto-3); margin-bottom: .4rem; }
.trilha a { color: var(--texto-2); }
.topo { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.topo .acoes { display: flex; gap: .5rem; flex-wrap: wrap; }

/* cartões */
.cartao { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); padding: 1.1rem 1.2rem; box-shadow: var(--sombra); margin-bottom: 1rem; }
.cartao > h2:first-child, .cartao > h3:first-child { margin-top: 0; }
.grade { display: grid; gap: 1rem; }
.grade-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grade-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.kpi { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); padding: .8rem 1rem; box-shadow: var(--sombra); border-top: 4px solid var(--neutro); }
.kpi .rot { font-size: .8rem; color: var(--texto-2); }
.kpi .val { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: .78rem; color: var(--texto-3); }
.kpi.ok { border-top-color: var(--ok); } .kpi.atencao { border-top-color: #d99a00; } .kpi.alerta { border-top-color: var(--alerta); } .kpi.destaque { border-top-color: var(--marca); }
.kpi a { color: inherit; text-decoration: none; }
.kpi a:hover .val { text-decoration: underline; }

/* tabelas */
.tabela-wrap { overflow-x: auto; border: 1px solid var(--borda); border-radius: var(--raio); background: var(--superficie); }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { padding: .5rem .65rem; border-bottom: 1px solid var(--borda); vertical-align: top; text-align: left; }
thead th { background: var(--superficie-2); font-weight: 600; color: var(--texto-2); position: sticky; top: 0; font-size: .82rem; text-transform: none; white-space: nowrap; }
tbody tr:hover { background: #fafcfd; }
tfoot td { font-weight: 700; background: var(--superficie-2); }
table.compacta td, table.compacta th { padding: .35rem .5rem; }
caption { text-align: left; font-weight: 600; padding: .5rem .65rem; color: var(--texto-2); }

/* selos */
.selo { display: inline-block; padding: .08rem .5rem; border-radius: 999px; font-size: .76rem; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.selo-ok { background: var(--ok-fundo); color: var(--ok); border-color: #b8e0c9; }
.selo-atencao { background: var(--atencao-fundo); color: var(--atencao); border-color: #f2d48a; }
.selo-alerta { background: var(--alerta-fundo); color: var(--alerta); border-color: #f5b7b1; }
.selo-neutro { background: var(--neutro-fundo); color: var(--neutro); border-color: #d5dbe1; }
.achado { display: inline-block; font-size: .76rem; padding: 0 .35rem; border-radius: 4px; margin: 0 .2rem .2rem 0; }
.achado.DIVERGENCIA { background: var(--alerta-fundo); color: var(--alerta); }
.achado.PENDENCIA { background: var(--atencao-fundo); color: var(--atencao); }
.achado.INFORMATIVA { background: var(--neutro-fundo); color: var(--neutro); }

/* avisos */
.flash { border-radius: var(--raio); padding: .7rem 1rem; margin-bottom: 1rem; border: 1px solid; }
.flash-ok { background: var(--ok-fundo); border-color: #b8e0c9; color: #14532d; }
.flash-erro { background: var(--alerta-fundo); border-color: #f5b7b1; color: #7a1a12; }
.flash-aviso { background: var(--atencao-fundo); border-color: #f2d48a; color: #6b4500; }
.nota { border-left: 4px solid var(--marca); background: var(--marca-clara); padding: .6rem .9rem; border-radius: 0 var(--raio) var(--raio) 0; margin-bottom: 1rem; font-size: .92rem; }
.nota.atencao { border-color: #d99a00; background: var(--atencao-fundo); }
.nota.alerta { border-color: var(--alerta); background: var(--alerta-fundo); }

/* formulários */
form.linha { display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap; }
.campo { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .8rem; min-width: 0; }
form.linha .campo { margin-bottom: 0; }
label, .rotulo { font-size: .85rem; font-weight: 600; color: var(--texto-2); }
.ajuda { font-size: .8rem; color: var(--texto-3); font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=datetime-local], input[type=number], input[type=file], input[type=month], select, textarea {
  font: inherit; padding: .45rem .6rem; border: 1px solid var(--borda-forte); border-radius: 6px; background: #fff; color: var(--texto); min-width: 0; max-width: 100%;
}
textarea { min-height: 76px; resize: vertical; width: 100%; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--alerta); background: #fffafa; }
.erro-campo { color: var(--alerta); font-size: .82rem; margin: 0; }
fieldset { border: 1px solid var(--borda); border-radius: var(--raio); padding: .8rem 1rem; margin: 0 0 1rem; }
legend { font-weight: 600; padding: 0 .3rem; }
.opcoes label { font-weight: 400; display: flex; align-items: center; gap: .4rem; color: var(--texto); }
.form-grade { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0 1rem; }

.botao, button.botao { display: inline-flex; align-items: center; gap: .35rem; font: inherit; font-weight: 600; font-size: .9rem; padding: .48rem .95rem; border-radius: 6px; border: 1px solid var(--marca); background: var(--marca); color: #fff; cursor: pointer; text-decoration: none; white-space: nowrap; }
.botao:hover { background: var(--marca-escura); color: #fff; }
.botao.secundario { background: #fff; color: var(--marca); }
.botao.secundario:hover { background: var(--marca-clara); color: var(--marca-escura); }
.botao.perigo { background: var(--alerta); border-color: var(--alerta); }
.botao.perigo:hover { background: #8f1c13; }
.botao.pequeno { padding: .22rem .55rem; font-size: .8rem; }
.botao[disabled] { opacity: .5; cursor: not-allowed; }

details { border: 1px solid var(--borda); border-radius: var(--raio); background: var(--superficie); margin-bottom: .8rem; }
details > summary { cursor: pointer; padding: .6rem .9rem; font-weight: 600; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸"; display: inline-block; width: 1em; color: var(--texto-3); transition: transform .15s; }
details[open] > summary::before { transform: rotate(90deg); }
details > .corpo { padding: 0 .9rem .9rem; }

dl.def { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0; font-size: .92rem; }
dl.def dt { color: var(--texto-2); font-weight: 600; }
dl.def dd { margin: 0; }

.paginacao { display: flex; gap: .4rem; align-items: center; margin: .8rem 0; flex-wrap: wrap; }
.linha-tempo { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--borda); }
.linha-tempo li { position: relative; padding: 0 0 .9rem 1rem; font-size: .9rem; }
.linha-tempo li::before { content: ""; position: absolute; left: -6px; top: .4rem; width: 10px; height: 10px; border-radius: 50%; background: var(--marca); }
pre.json { background: var(--superficie-2); border: 1px solid var(--borda); border-radius: 6px; padding: .6rem; font-size: .8rem; overflow-x: auto; max-height: 340px; white-space: pre-wrap; word-break: break-word; }
.barra { height: 10px; background: var(--neutro-fundo); border-radius: 99px; overflow: hidden; display: flex; }
.barra span { display: block; height: 100%; }
.barra .b-ok { background: var(--ok); } .barra .b-at { background: #e3a600; } .barra .b-al { background: var(--alerta); } .barra .b-mu { background: #9fb5c1; }
.legenda { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .8rem; color: var(--texto-2); margin-top: .35rem; }
.legenda i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: .3rem; vertical-align: -1px; }

/* login */
.caixa-login { max-width: 400px; margin: 9vh auto; }
.caixa-login .marca { color: var(--marca-escura); justify-content: center; font-size: 1.5rem; }
.caixa-login .marca-sinal { background: var(--marca); color: #fff; }

@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .lateral { position: static; height: auto; }
  .lateral nav { display: flex; flex-wrap: wrap; gap: .2rem; }
  .lateral .grupo { display: none; }
  .principal { padding: 1rem; }
  .grade-2, .grade-3 { grid-template-columns: 1fr; }
}

@media print {
  .lateral, .nao-imprimir, .topo .acoes, form { display: none !important; }
  .app { display: block; }
  body { background: #fff; font-size: 11px; }
  .principal { padding: 0; max-width: none; }
  .cartao, .kpi, .tabela-wrap { box-shadow: none; break-inside: avoid; }
  thead th { position: static; }
  a { color: inherit; text-decoration: none; }
}
td.mono, span.mono { white-space: nowrap; }
dd.mono, .quebra { word-break: break-all; }
