/* Cores da SBD-MG: azul-petróleo #5d97a3 e cinza #78787b (logotipo). O azul da marca tem
   contraste 3,3:1 no branco: serve para detalhes; texto e botões usam o tom escuro (--accent).
   Séries dos gráficos validadas (dataviz validate_palette): a 1ª é o azul-petróleo saturado.
   Só tema claro (identidade da SBD-MG). */
:root {
  color-scheme: light;
  --surface-0: #f4f7f8; --surface-1: #ffffff; --surface-2: #f4f7f8; --border: #e3e8ea;
  --text-primary: #1f2326; --text-secondary: #55575a; --text-muted: #6e6f72;
  --brand: #5d97a3; --brand-gray: #78787b; --accent: #36707c; --on-accent: #ffffff; --accent-soft: #e9f2f4;
  --series-1: #00879f; --series-2: #eb6834; --series-3: #6250d6; --series-4: #eda100; --series-5: #e87ba4;
  --neutral: #edf1f2; --grid: #edf0f1;
  --good: #0ca30c; --warning: #fab219; --critical: #d03b3b;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--surface-0); color: var(--text-primary);
  font: 15px/1.55 "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
main, footer, .topo-in, .abertura { max-width: 960px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }

/* topo: logo da SBD-MG + nome do produto; duas faixas como as do logotipo */
.topo { background: var(--surface-1); }
.topo-in { display: flex; align-items: center; gap: 18px; padding-top: 14px; padding-bottom: 14px; }
.topo img { height: 52px; width: auto; display: block; }
.topo .sep { width: 1px; align-self: stretch; background: var(--border); }
.topo .produto { font-weight: 600; font-size: 15px; color: var(--text-primary); letter-spacing: .01em; }
.topo .tag { font-size: 12.5px; color: var(--text-muted); }
.faixas { height: 6px; background: linear-gradient(var(--brand-gray) 0 2px, transparent 2px 4px, var(--brand) 4px 6px); }
.abertura { padding-top: 36px; padding-bottom: 8px; }
.abertura h1 { margin: 0; font-size: 30px; line-height: 1.2; letter-spacing: -.015em; font-weight: 650; }
.abertura h1 em { font-style: normal; color: var(--accent); }
.abertura p { margin: 10px 0 0; color: var(--text-secondary); max-width: 620px; font-size: 16px; }
@media (max-width: 560px) {
  .topo img { height: 40px; } .topo .tag { display: none; }
  .abertura h1 { font-size: 24px; } .abertura { padding-top: 24px; }
}

main { padding-top: 22px; padding-bottom: 8px; }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 16px; padding: 22px; margin-bottom: 18px; }
.card[hidden] { display: none; }
.card h2 { font-size: 17px; margin: 0 0 4px; font-weight: 650; }
.sub { color: var(--text-secondary); font-size: 13.5px; margin: 0 0 16px; }
.passo { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  border: 1.5px solid var(--brand); color: var(--accent); font-size: 12.5px; font-weight: 700; margin-right: 10px; vertical-align: 1px; }
.campos { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
label.campo { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--text-secondary); font-weight: 500; }
label.campo small { color: var(--text-muted); font-size: 12px; font-weight: 400; }
select, input { font: inherit; padding: 10px 11px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); color: var(--text-primary); min-width: 0; width: 100%; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; background: var(--surface-1); }
button { font: inherit; cursor: pointer; }
.btn { padding: 9px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-1); color: var(--text-primary); }
.btn.primario { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.link { background: none; border: 0; color: var(--accent); padding: 0; font-weight: 500; }

/* procedimentos */
.procs { display: flex; flex-direction: column; }
.proc { display: grid; grid-template-columns: minmax(0, 1.5fr) 128px minmax(0, 2fr); gap: 6px 16px;
  align-items: center; padding: 12px 0; border-top: 1px solid var(--border); }
.proc:first-child { border-top: 0; }
.proc .nome { font-weight: 600; }
.proc .cod { color: var(--text-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.proc .rs { position: relative; }
.proc .rs span { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.proc .rs input { padding-left: 32px; text-align: right; font-variant-numeric: tabular-nums; }
.proc .info { font-size: 13.5px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.proc .info b { color: var(--text-primary); font-weight: 600; }
.proc .resultado { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.proc .frase { font-size: 13px; color: var(--text-secondary); width: 100%; }
.proc .mod { font-size: 12.5px; color: var(--text-muted); width: 100%; }
.proc .remover { font-size: 12px; color: var(--text-muted); background: none; border: 0; padding: 0; margin-left: 6px; }
.selo { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.selo i { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: #fff;
  font-style: normal; font-size: 11px; background: var(--c); }
.selo.baixo { --c: var(--critical); } .selo.meio { --c: var(--warning); } .selo.ok { --c: var(--good); }
.selo.meio i { color: #0b0b0b; }
.adicionar { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.adicionar select { width: min(460px, 100%); }
.semdado { color: var(--text-muted); font-size: 13px; }
@media (max-width: 720px) {
  .proc { grid-template-columns: minmax(0, 1fr) 120px; }
  .proc .info { grid-column: 1 / -1; }
}

/* resumo */
.destaque { font-size: 19px; line-height: 1.4; margin: 0 0 6px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-top: 14px; }
.tile { background: var(--accent-soft); border-radius: 12px; padding: 14px 16px; }
.tile .rot { font-size: 13px; color: var(--text-secondary); }
.tile .val { font-size: 26px; font-weight: 650; color: var(--text-primary); font-variant-numeric: tabular-nums; line-height: 1.25; margin-top: 2px; }
.tile .det { font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; color: var(--text-secondary); font-weight: 600; }
td.num, th.num { text-align: right; white-space: nowrap; }
.tabela-wrap { overflow-x: auto; }
.acoes { display: flex; gap: 10px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.aviso { color: var(--text-muted); font-size: 13px; }

/* gráficos */
svg text { fill: var(--text-secondary); font-size: 12px; }
.legenda { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-secondary); margin-top: 6px; }
.legenda span::before { content: ""; display: inline-block; width: 14px; height: 0; border-top: 2px var(--estilo, solid) var(--c);
  margin-right: 6px; vertical-align: 4px; }
.tip { position: fixed; pointer-events: none; background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 10px; font-size: 13px; box-shadow: 0 4px 16px rgb(0 0 0 / .15);
  display: none; z-index: 10; max-width: 300px; font-variant-numeric: tabular-nums; }
details summary { cursor: pointer; color: var(--text-secondary); font-size: 13px; margin-top: 10px; }
.barras { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.barra { display: grid; grid-template-columns: minmax(0, 220px) 1fr 52px 76px; gap: 10px; align-items: center; font-size: 13px; }
.barra.cab { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; }
.barra.cab span:last-child { text-align: right; }
.barra .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-secondary); }
.barra .b { height: 12px; border-radius: 0 4px 4px 0; background: var(--series-1); min-width: 2px; }
.barra .p { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .barra { grid-template-columns: minmax(0, 104px) 1fr 44px 56px; gap: 8px; } }
footer { padding-top: 4px; padding-bottom: 36px; color: var(--text-muted); font-size: 12.5px; }
footer details summary { font-size: 12.5px; }
footer ul { padding-left: 18px; margin: 8px 0; }

/* navegação entre os painéis */
.nav { background: var(--surface-1); border-bottom: 1px solid var(--border); }
.nav-in { max-width: 960px; margin: 0 auto; padding: 0 16px; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.nav a { padding: 11px 12px; color: var(--text-secondary); text-decoration: none; font-size: 13.5px; font-weight: 500;
  white-space: nowrap; border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--text-primary); }
.nav a[aria-current="page"] { color: var(--accent); border-color: var(--brand); font-weight: 600; }
.topo a { text-decoration: none; color: inherit; display: contents; }
.local { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 18px; }
.local label.campo { min-width: 180px; flex: 1 1 180px; max-width: 320px; }
.explorar { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.explorar a { display: block; padding: 16px; border-radius: 12px; background: var(--accent-soft); color: var(--text-primary); text-decoration: none; }
.explorar a b { display: block; color: var(--accent); margin-bottom: 4px; }
.explorar a span { font-size: 13.5px; color: var(--text-secondary); }
.explorar a:hover { outline: 1.5px solid var(--brand); }
table.ordenavel th { cursor: pointer; user-select: none; }
table.ordenavel th[aria-sort]::after { content: " ▾"; color: var(--text-muted); }
table.ordenavel th[aria-sort="ascending"]::after { content: " ▴"; }
tr.clicavel { cursor: pointer; } tr.clicavel:hover td { background: var(--accent-soft); }
tr.selecionada td { background: var(--accent-soft); }
.alerta { display: inline-flex; gap: 4px; align-items: center; font-size: 12px; color: var(--text-secondary); }
.alerta i { font-style: normal; display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%;
  background: var(--critical); color: #fff; font-size: 10px; font-weight: 700; }
.pior { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.pior.ruim::before { content: "▲ "; color: var(--critical); }
.pior.bom::before { content: "▼ "; color: var(--good); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.grid2 > div > h3 { font-size: 14px; margin: 0 0 2px; }
.fontes h3 { font-size: 15px; margin: 22px 0 6px; }
.fontes ul { margin: 0; padding-left: 18px; }
.fontes li { margin-bottom: 8px; }
.fontes a { color: var(--accent); }
.fontes code { font-size: 12.5px; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; word-break: break-all; }

/* checklist */
.check { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.check label { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; flex: none; accent-color: var(--accent); }
.check input:checked + span { color: var(--text-muted); text-decoration: line-through; }

/* relatório: só na impressão */
.so-impressao { display: none; }
@media print {
  @page { margin: 14mm 12mm; }
  :root:root:root { color-scheme: light; --surface-0: #fff; --surface-1: #fff; --surface-2: #fff; --border: #bbb;
    --text-primary: #000; --text-secondary: #333; --text-muted: #555; --accent: #36707c; --accent-soft: #eef4f5; }
  body { background: #fff; font-size: 10.5pt; }
  body > *:not(main), main > *:not(#relatorio) { display: none !important; }
  main { padding: 0; max-width: none; }
  #relatorio { display: block !important; }
  .rel-topo { display: flex; gap: 16px; align-items: center; border-bottom: 2px solid #5d97a3; padding-bottom: 8px; margin-bottom: 10px; }
  .rel-topo img { height: 48px; width: auto; }
  .rel h1 { font-size: 16pt; margin: 0; }
  .rel-topo p { margin: 2px 0 0; color: #555; font-size: 9.5pt; }
  .rel h2 { font-size: 12pt; margin: 16px 0 6px; color: #36707c; }
  .rel table { font-size: 9.5pt; }
  .rel th, .rel td { padding: 4px 5px; }
  .rel small { color: #555; }
  .rel-dados th { width: 130px; color: #333; }
  .rel ul { padding-left: 18px; margin: 4px 0; }
  .rel li { margin-bottom: 5px; }
  .rel-check { list-style: none; padding-left: 0 !important; }
  .rel-check li { display: flex; gap: 8px; }
  .caixa { display: inline-grid; place-items: center; width: 13px; height: 13px; border: 1.5px solid #000; font-size: 10px; flex: none; margin-top: 2px; }
  .rel-fontes { margin-top: 14px; font-size: 8.5pt; color: #555; }
  tr, li { break-inside: avoid; }
}
