:root {
  color-scheme: light;
  --bg: #faf6f6;
  --panel: #ffffff;
  --ink: #1c1c1c;
  --muted: #5c6168;
  --line: #eadbdb;
  --accent: #d00000;
  --verde: #007030;
  --accent-ink: #ffffff;
  --warn: #8a5a00;
  --warn-bg: #fff6e5;
  --danger: #9d2c2c;
  --danger-bg: #fdecec;
  --ok-bg: #e7f6ee;
}
* { box-sizing: border-box; }
html, body, #app { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  font-family: "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}
#app {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
main, #app { width: 100%; max-width: none; margin: 0; }
#app { padding: clamp(12px, 1.6vw, 28px); }
.topo-fixo {
  flex: none;
  background: var(--bg);
  z-index: 20;
  padding-bottom: 8px;
  border-bottom: 3px solid var(--accent);
}
.miolo {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.miolo:has(.tela-titulos) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.tela-titulos {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 8px;
}
.filtros-fixos {
  flex: none;
  max-height: 42%;
  overflow: auto;
}
.filtros-fixos .stack { gap: 8px; }
.filtros-fixos input,
.filtros-fixos select,
.filtros-fixos button { padding: 6px 8px; }
.grade-scroll {
  flex: 1;
  min-height: 120px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.grade-scroll thead th {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 2;
  vertical-align: bottom;
}
.rodape {
  flex: none;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding: 4px 0 0;
}
.rodape .primary { min-width: 160px; padding: 10px 18px; }
h1, h2, h3 { margin: 0; }
h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 16px; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.ghost { background: transparent; }
button:disabled { opacity: 0.55; cursor: default; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
}
textarea { min-height: 96px; resize: vertical; }
label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.top { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.logo-app { height: 38px; width: auto; display: block; }
#menu-usuario { border-color: var(--verde); color: var(--verde); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.grow { flex: 1; }
.nav { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 18px; }
.nav button[aria-current="page"] { background: #fde8e8; border-color: #e7a3a3; color: #9b0000; }
.grid { display: grid; gap: 12px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.fact { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.fact b { display: block; font-size: clamp(16px, 1.6vw, 22px); margin-bottom: 4px; }
.fact.total { background: var(--danger-bg); border-color: #e3a8a8; }
.fact.total b { color: var(--danger); font-size: clamp(22px, 2.4vw, 32px); }
.risco-painel {
  display: flex; align-items: center; gap: 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
}
.risco-circulo {
  width: 72px; height: 72px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 800; color: #fff; flex: none;
}
.risco-painel.risco-A { background: #e8f6ee; }
.risco-painel.risco-A .risco-circulo, button.risco-A[aria-current="page"] { background: #0f7a4a; color: #fff; box-shadow: 0 0 0 6px #b7e0cb; }
.risco-painel.risco-B { background: #eef3fb; }
.risco-painel.risco-B .risco-circulo, button.risco-B[aria-current="page"] { background: #1d4e89; color: #fff; box-shadow: 0 0 0 6px #c5d7f2; }
.risco-painel.risco-C { background: #fff6e5; }
.risco-painel.risco-C .risco-circulo, button.risco-C[aria-current="page"] { background: #b86e00; color: #fff; box-shadow: 0 0 0 6px #f3d7a1; }
.risco-painel.risco-D { background: #fdecec; }
.risco-painel.risco-D .risco-circulo, button.risco-D[aria-current="page"] { background: #9d2c2c; color: #fff; box-shadow: 0 0 0 6px #f0b4b4; }
.fact.risco-A, .fact.risco-B, .fact.risco-C, .fact.risco-D { border-width: 2px; }
.fact.risco-A { border-color: #0f7a4a; }
.fact.risco-B { border-color: #1d4e89; }
.fact.risco-C { border-color: #b86e00; }
.fact.risco-D { border-color: #9d2c2c; }
.fact.risco-A b { color: #0f7a4a; }
.fact.risco-B b { color: #1d4e89; }
.fact.risco-C b { color: #b86e00; }
.fact.risco-D b { color: #9d2c2c; }
.card, .notice { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.fase-nivel { font-weight: 700; }
.fase-texto {
  display: block;
  font-weight: 700;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.danger { background: var(--danger-bg); color: var(--danger); }
.notice.ok { background: var(--ok-bg); }
.stack { display: grid; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
table { width: 100%; border-collapse: collapse; background: var(--panel); font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
th .abre-filtro {
  margin-left: 6px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}
th .abre-filtro.ativo { color: var(--accent); font-weight: 800; }
#grade { min-width: max-content; }
#grade td { white-space: nowrap; }
#grade td.obs { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.filtro-pop {
  position: fixed;
  z-index: 40;
  width: 280px;
  max-height: 360px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
  padding: 12px;
  display: grid;
  gap: 8px;
}
.filtro-pop .lista-filtro { max-height: 200px; overflow: auto; display: grid; gap: 4px; }
.filtro-pop .filtro-acoes { display: flex; gap: 8px; }
.filtro-pop .filtro-acoes button { border-radius: 999px; }
.filtro-pop .primary { width: 100%; }
.carregando {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(250, 246, 246, 0.88);
}
.carregando img {
  width: min(280px, 62vw);
  height: auto;
  animation: pulso-logo 1.1s ease-in-out infinite;
}
@keyframes pulso-logo {
  0%, 100% { opacity: 0.4; transform: scale(0.96); }
  50% { opacity: 1; transform: scale(1); }
}
.login-acesso input { text-transform: uppercase; }
.num { text-align: right; white-space: nowrap; }
body.tela-login #app { padding: 0; display: block; }
.login-tela { display: grid; grid-template-columns: 1fr 1fr; height: 100%; min-height: 100%; }
.login-marca {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 48px 32px 96px;
}
.login-marca img { width: min(440px, 82%); height: auto; }
.login-rodape {
  position: absolute;
  left: 28px;
  bottom: 28px;
  margin: 0;
  background: var(--verde);
  color: #fff;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 13px;
}
.login-acesso {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #ffffff 0%, #f4faf6 48%, #fff5f5 100%);
  padding: 32px 24px;
}
.login-acesso form { width: min(420px, 100%); display: grid; gap: 14px; }
.acesso-kicker { letter-spacing: 0.2em; font-size: 12px; color: var(--muted); text-align: center; }
.login-acesso h1 { text-align: center; font-weight: 600; }
.login-acesso .lede { text-align: center; color: var(--muted); font-size: 14px; }
.login-acesso input { background: #f4f7fb; border-color: #d5deea; padding: 12px; }
.login-acesso button.primary { width: 100%; padding: 12px; border-radius: 6px; }
.menu { position: relative; }
.menu-panel {
  position: absolute; right: 0; top: 40px; width: 240px; z-index: 2;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px;
}
.scroll { overflow: visible; border: 1px solid var(--line); border-radius: 12px; }
.filtros { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); align-items: end; }
.periodo { border: 1px solid var(--line); border-radius: 10px; margin: 0; padding: 8px 10px 10px; }
.periodo legend { padding: 0 4px; font-size: 13px; color: var(--muted); }
.datas { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opcoes { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.check { display: flex; align-items: center; gap: 6px; color: var(--ink); }
.check input { width: auto; }
.busca { position: relative; }
.sugestoes {
  position: absolute; z-index: 3; left: 0; right: 0; top: 100%;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; max-height: 220px; overflow: auto;
}
.sugestoes button { display: block; width: 100%; text-align: left; border: 0; border-radius: 0; background: transparent; }
.sugestoes button:hover { background: #fdecec; }
.abas { display: flex; gap: 8px; }
.abas button[aria-current="page"] { background: #fde8e8; border-color: #e7a3a3; color: #9b0000; }
.contato-1214 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}
.prox-linha { display: flex; gap: 8px; align-items: center; }
.prox-linha input[type="number"] { width: 72px; }
.extrato-grade { max-height: 480px; }
.extrato-grade tbody tr { cursor: pointer; }
.extrato-grade tbody tr:hover { background: #fdecec; }
.modal-fundo {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal {
  width: min(960px, 100%);
  max-height: 86vh;
  overflow: auto;
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  display: grid;
  gap: 12px;
}
@media (max-width: 900px) {
  .g4, .g2, .facts, .filtros { grid-template-columns: 1fr 1fr; }
  .login-tela { grid-template-columns: 1fr; }
  .login-marca { min-height: 220px; }
  .contato-1214 { grid-template-columns: 1fr; }
}
