:root {
  --tinta: #17212b; --suave: #667482; --linha: #e3e6ea; --fundo: #f4f5f7; --papel: #fff;
  --lateral: #121b24; --acao: #0f6b5c; --acao-forte: #0a5247; --atencao: #8a5a00;
}
* { box-sizing: border-box; }
body { margin: 0; display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh;
  font: 14px/1.5 "Segoe UI", system-ui, sans-serif; background: var(--fundo); color: var(--tinta); }
aside { background: var(--lateral); color: #cfd8e0; padding: 22px 14px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.marca { display: flex; gap: 10px; align-items: center; color: #fff; font-size: 14.5px; font-weight: 600; padding: 0 8px; }
.marca svg { width: 30px; height: 30px; color: #3cbfa6; }
.marca span { display: block; color: #8796a5; font-size: 12px; font-weight: 400; }
nav { display: flex; flex-direction: column; gap: 2px; }
nav a { display: flex; gap: 10px; align-items: center; color: #cfd8e0; text-decoration: none; padding: 9px 10px; border-radius: 6px; }
.estado { margin-top: auto; border: 1px solid #273646; border-radius: 8px; padding: 10px 12px; font-size: 12.5px; }
.estado strong { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 600; }
.estado strong::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #758494; }
.estado.ligado strong::before { background: #3ccf8e; }
.estado.alerta strong::before { background: #e8b23a; }
.estado span { color: #8796a5; }
nav a:hover { background: #1d2935; color: #fff; }
nav a[aria-current] { background: #223140; color: #fff; box-shadow: inset 3px 0 0 #3cbfa6; }
main { padding: 28px 32px; max-width: 1280px; width: 100%; }
h1 { font-size: 22px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 18px 0 10px; }
a { color: var(--acao-forte); }
small { display: block; color: var(--suave); font-size: 12px; }
.topo { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.sub, .nota { color: var(--suave); margin: 4px 0 0; font-size: 12.5px; }
.bloco, .cartao { background: var(--papel); border: 1px solid var(--linha); border-radius: 8px; padding: 18px 20px; margin-bottom: 16px; }
.indicadores { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); background: var(--papel);
  border: 1px solid var(--linha); border-radius: 8px; margin-bottom: 16px; overflow: hidden; }
.indicadores div { padding: 16px 20px; box-shadow: 1px 0 0 var(--linha); }
.indicadores span, .resultado span { display: block; color: var(--suave); font-size: 12px; }
.indicadores strong, .resultado strong { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
.resultado { margin: 12px 0 0; }
.rolagem { overflow-x: auto; }
div.rolagem.bloco { padding: 4px 12px; }
table { width: 100%; border-collapse: collapse; }
th { color: var(--suave); font-size: 12px; font-weight: 600; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--linha); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.curto { white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.apagado { opacity: .5; }
.situacao { white-space: nowrap; color: var(--suave); }
.situacao::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #b7bfc7; margin-right: 7px; }
.situacao.ligado { color: var(--tinta); }
.situacao.ligado::before { background: #1f9d6b; }
.grade { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; align-items: end; }
.colunas { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.linha, .barra, .acoes { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.linha, .barra { margin-bottom: 12px; }
label { display: block; margin-bottom: 8px; font-size: 13px; }
label.marcar { display: inline-block; margin-right: 16px; }
input:not([type=checkbox]), select, textarea { width: 100%; padding: 7px 10px; border: 1px solid #cbd1d8; border-radius: 6px; font: inherit; background: #fff; color: inherit; }
input[type=checkbox] { accent-color: var(--acao); }
:focus-visible { outline: 2px solid var(--acao); outline-offset: 1px; }
.linha input, .linha select, .barra select, .acoes select { width: auto; }
.barra input { flex: 1; min-width: 240px; width: auto; }
button, .botao { background: var(--acao); color: #fff; border: 1px solid var(--acao); border-radius: 6px; padding: 7px 14px; cursor: pointer; text-decoration: none; font: inherit; display: inline-block; white-space: nowrap; }
button:hover, .botao:hover { background: var(--acao-forte); }
button.leve { background: #fff; color: var(--tinta); border-color: #cbd1d8; }
button.leve:hover { background: var(--fundo); }
.rodape { position: sticky; bottom: 0; background: var(--papel); border: 1px solid #cbd1d8; border-radius: 8px; padding: 12px 16px; display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; box-shadow: 0 -4px 16px rgba(18, 27, 36, .08); }
img { max-width: 100%; max-height: 360px; border-radius: 6px; display: block; }
pre { white-space: pre-wrap; word-break: break-word; font: inherit; }
summary { cursor: pointer; color: var(--acao-forte); }
.aviso { background: #e8f4f1; border: 1px solid #bfded7; padding: 10px 14px; border-radius: 6px; }
.aviso.alerta { background: #fdf5e2; border-color: #ecd9a5; color: var(--atencao); }
fieldset { border: 1px solid var(--linha); border-radius: 6px; margin: 0 0 12px; }
.bloco, .cartao, .indicadores { box-shadow: 0 1px 2px rgba(18, 27, 36, .05); }
.indicadores small { margin-top: 2px; }
.etiqueta { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: #eef0f3; color: #4d5a67; }
.etiqueta.ok { background: #e3f4ec; color: #146c46; }
.etiqueta.erro { background: #fbe9e7; color: #a5301f; }
.etiqueta.atencao { background: #fdf2da; color: var(--atencao); }
.secao { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; padding: 20px 0; border-top: 1px solid var(--linha); }
.secao header p { color: var(--suave); margin: 0; font-size: 13px; }
.secao .bloco { margin: 0; }
.lista > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--linha); }
.lista > div:first-child { padding-top: 0; }
.lista > div:last-child { border-bottom: 0; padding-bottom: 0; }
label.chave { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; cursor: pointer; }
label.chave input { appearance: none; flex: none; width: 36px; height: 20px; margin: 0; border-radius: 999px; background: #c5ccd3; position: relative; cursor: pointer; }
label.chave input::before { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; top: 2px; left: 2px; background: #fff; transition: transform .15s; }
label.chave input:checked { background: var(--acao); }
label.chave input:checked::before { transform: translateX(16px); }
tbody tr:hover td, tr.item:hover td { background: #fafbfc; }
code { background: #eef0f3; padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.usuario { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 0 4px; margin-top: auto; }
.usuario a { color: #fff; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usuario + .estado { margin-top: 0; }
body.acesso { display: block; }
body.acesso main { max-width: 440px; margin: 6vh auto; }
body.acesso h1 { margin-bottom: 18px; }
body.acesso .links { display: flex; flex-wrap: wrap; gap: 16px; }
.chave-acesso { font: 600 18px/1.6 Consolas, monospace; letter-spacing: .04em; background: #eef0f3; padding: 12px; border-radius: 6px; word-break: break-all; user-select: all; }
.vitrine { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; margin-bottom: 24px; }
.produto { background: var(--papel); border: 1px solid var(--linha); border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; content-visibility: auto; contain-intrinsic-size: 340px; }
.produto.fora { opacity: .5; }
.foto { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; background: #eef0f3; text-align: center; color: var(--suave); }
.produto[hidden] { display: none; }
a.foto { text-decoration: none; }
.dados strong a { color: inherit; text-decoration: none; }
.foto img { width: 100%; height: 100%; max-height: none; object-fit: cover; border-radius: 0; }
.dados { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 5px; align-items: flex-start; }
.dados strong { font-weight: 600; font-size: 13px; line-height: 1.35; }
.dados form, .dados details { width: 100%; }
/* Nada pode alargar a página: colunas e blocos encolhem até a largura da tela. */
main, aside, .bloco, .cartao, .colunas > *, .secao > * { min-width: 0; }
.colunas { grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); }
.grade { grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }
.sub, .nota, .aviso, td, .dados { overflow-wrap: anywhere; }
@media (max-width: 860px) {
  body { grid-template-columns: minmax(0, 1fr); align-content: start; }
  aside { position: static; height: auto; padding: 12px; gap: 10px; }
  nav { flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  nav a { flex: none; white-space: nowrap; }
  .usuario { margin-top: 0; }
  .estado { margin-top: 0; display: flex; gap: 10px; align-items: center; padding: 8px 12px; }
  .secao { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  main { padding: 16px 12px; }
  input:not([type=checkbox]), select, textarea { font-size: 16px; }  /* evita zoom no celular */
  button, .botao { min-height: 40px; }
  .indicadores { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .indicadores div { padding: 12px; }
  .indicadores strong { font-size: 19px; }
  .barra input, .barra select { min-width: 0; width: 100%; flex: 1 1 100%; }
  .rodape { padding: 8px 10px; gap: 6px; font-size: 12.5px; }
  .rodape .acoes, .rodape select { width: 100%; }
  .rodape button { min-height: 36px; padding: 5px 10px; }
  .vitrine { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  /* Tabelas marcadas viram cartões, com o título de cada coluna ao lado do valor. */
  table.cartoes, table.cartoes tbody, table.cartoes tr, table.cartoes td { display: block; width: 100%; }
  table.cartoes tr:first-child { display: none; }
  table.cartoes tr[hidden] { display: none; }
  table.cartoes tr { border-bottom: 1px solid var(--linha); padding: 10px 0; }
  table.cartoes td { border: 0; padding: 3px 0; text-align: left; white-space: normal; }
  table.cartoes td[data-th] { display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  table.cartoes td[data-th]::before { content: attr(data-th); color: var(--suave); font-size: 12px; text-align: left; }
}
