:root {
  --fundo: #f5f6f4;
  --superficie: #ffffff;
  --superficie-2: #eef1ee;
  --texto: #1d2420;
  --texto-2: #5b6660;
  --borda: #d9dfda;
  --marca: #1f6f5c;
  --marca-texto: #ffffff;
  --ok: #1f7a4d;
  --ok-fundo: #e3f3ea;
  --alto: #a35b00;
  --alto-fundo: #fbf0dc;
  --hipo: #b3261e;
  --hipo-fundo: #fbe7e5;
  --faixa: rgba(31, 122, 77, 0.10);
  --raio: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fundo: #121614; --superficie: #1a201d; --superficie-2: #232b27; --texto: #e6ece8; --texto-2: #9fada5;
    --borda: #2f3934; --marca: #5cc2a3; --marca-texto: #0d1a15; --ok: #6fd39d; --ok-fundo: #173326;
    --alto: #f0b25a; --alto-fundo: #3a2c14; --hipo: #ff8a80; --hipo-fundo: #3d1a18; --faixa: rgba(111, 211, 157, 0.12);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --fundo: #121614; --superficie: #1a201d; --superficie-2: #232b27; --texto: #e6ece8; --texto-2: #9fada5;
  --borda: #2f3934; --marca: #5cc2a3; --marca-texto: #0d1a15; --ok: #6fd39d; --ok-fundo: #173326;
  --alto: #f0b25a; --alto-fundo: #3a2c14; --hipo: #ff8a80; --hipo-fundo: #3d1a18; --faixa: rgba(111, 211, 157, 0.12);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fundo); color: var(--texto); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--marca); }
h1 { font-size: 1.6rem; margin: 0.4rem 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 0.75rem; }
h3 { font-size: 1rem; margin: 1rem 0 0.5rem; }

.topo { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 0.75rem 16px; background: var(--superficie); border-bottom: 1px solid var(--borda); position: sticky; top: 0; z-index: 5; }
.marca { font-weight: 700; text-decoration: none; color: var(--texto); display: flex; align-items: center; gap: 0.5rem; }
.gota { width: 14px; height: 18px; background: var(--hipo); border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; transform: rotate(0deg); display: inline-block; }
.menu { display: flex; gap: 0.25rem; flex-wrap: wrap; align-items: center; }
.menu a { text-decoration: none; color: var(--texto-2); padding: 0.4rem 0.65rem; border-radius: 8px; }
.menu a.ativo, .menu a:hover { background: var(--superficie-2); color: var(--texto); }
.menu .sair button { background: none; border: 0; color: var(--texto-2); padding: 0.4rem 0.65rem; cursor: pointer; font: inherit; }
.menu-botao { display: none; }

.conteudo { max-width: 1100px; margin: 0 auto; padding: 1rem 16px 3rem; }
.rodape { text-align: center; color: var(--texto-2); font-size: 0.85rem; padding: 1rem 16px 2rem; }

.cartao { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.cartao.estreito { max-width: 420px; margin: 3rem auto; }
.cartao.destaque { border-color: var(--marca); }
.cartao.alerta { border-color: var(--hipo); background: var(--hipo-fundo); }
.cartao.centro { text-align: center; }
.cabecalho { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.cabecalho h1, .cabecalho h2 { margin: 0; }
.colunas { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }
.colunas > .cartao { margin-bottom: 0; }
.colunas + .cartao, .cartao + .colunas, .colunas + .colunas { margin-top: 1rem; }
.sutil { color: var(--texto-2); font-size: 0.9rem; }
.falta { color: var(--alto); }

.numeros { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.numero { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); padding: 0.85rem 1rem; display: flex; flex-direction: column; gap: 0.15rem; }
.numero .rotulo { color: var(--texto-2); font-size: 0.85rem; }
.numero .valor { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.numero .valor.pequeno { font-size: 1.2rem; padding: 0.4rem 0; }
.v-ok { color: var(--ok); } .v-alto { color: var(--alto); } .v-hipo { color: var(--hipo); }

.grafico { width: 100%; height: auto; display: block; }
.grafico .faixa-alvo { fill: var(--faixa); }
.grafico .linha-hipo { stroke: var(--hipo); stroke-dasharray: 4 4; stroke-width: 1; }
.grafico .grade { stroke: var(--borda); stroke-width: 1; }
.grafico .eixo { fill: var(--texto-2); font-size: 11px; }
.grafico .linha { fill: none; stroke: var(--texto-2); stroke-width: 1.5; }
.grafico .ponto { stroke: var(--superficie); stroke-width: 1.5; }
.grafico .p-ok { fill: var(--ok); } .grafico .p-alto { fill: var(--alto); } .grafico .p-hipo { fill: var(--hipo); }
.legenda { font-size: 0.85rem; color: var(--texto-2); display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.leg { display: inline-block; width: 18px; height: 10px; border-radius: 2px; }
.leg-alvo { background: var(--faixa); border: 1px solid var(--ok); }
.leg-hipo { border-top: 2px dashed var(--hipo); height: 0; margin-left: 0.75rem; }

.lista { list-style: none; padding: 0; margin: 0; }
.lista li { padding: 0.55rem 0; border-bottom: 1px solid var(--borda); }
.lista li:last-child { border-bottom: 0; }
.mensagens li.saida { color: var(--texto-2); }

.tabela-rolagem { overflow-x: auto; }
.tabela { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.tabela th, .tabela td { text-align: left; padding: 0.55rem 0.5rem; border-bottom: 1px solid var(--borda); vertical-align: top; }
.tabela th { color: var(--texto-2); font-weight: 600; font-size: 0.85rem; }
.tabela tr.inativo { opacity: 0.55; }
.texto-msg { white-space: pre-wrap; max-width: 420px; }

.etiquetas { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.etiqueta { display: inline-block; font-size: 0.78rem; padding: 0.1rem 0.5rem; border-radius: 99px; background: var(--superficie-2); color: var(--texto-2); }
.etiqueta.ok { background: var(--ok-fundo); color: var(--ok); }
.etiqueta.alerta { background: var(--hipo-fundo); color: var(--hipo); }
.etiqueta.registro { background: var(--alto-fundo); color: var(--alto); }

.formulario { display: flex; flex-direction: column; gap: 0.85rem; }
.formulario label { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 500; }
.formulario label.opcao { flex-direction: row; align-items: flex-start; gap: 0.6rem; font-weight: 400; }
.opcao input { margin-top: 0.3rem; width: 18px; height: 18px; flex: none; }
.grade-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.85rem; }
.grade-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0.85rem; }
.dias { display: flex; flex-wrap: wrap; gap: 0.75rem; }
fieldset { border: 1px solid var(--borda); border-radius: var(--raio); padding: 0.75rem 1rem; display: flex; flex-direction: column; gap: 0.6rem; margin: 0; }
legend { font-weight: 600; padding: 0 0.3rem; }
input, select, textarea { font: inherit; color: var(--texto); background: var(--superficie); border: 1px solid var(--borda); border-radius: 8px; padding: 0.55rem 0.65rem; min-height: 44px; width: 100%; }
input[type="checkbox"] { min-height: 0; width: auto; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--marca); outline-offset: 2px; }
button, .botao { font: inherit; cursor: pointer; border: 1px solid var(--borda); background: var(--superficie-2); color: var(--texto); padding: 0.55rem 1rem; border-radius: 8px; min-height: 44px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
button.primario, .botao.primario { background: var(--marca); color: var(--marca-texto); border-color: var(--marca); font-weight: 600; }
button.perigo { color: var(--hipo); border-color: var(--hipo); background: transparent; }
button.link { border: 0; background: none; padding: 0; min-height: 0; color: var(--texto-2); text-decoration: underline; font-size: 0.85rem; }
button.link.perigo { color: var(--hipo); }
button[disabled] { opacity: 0.5; cursor: not-allowed; }
.acoes { display: flex; gap: 0.5rem; flex-wrap: wrap; }
form.inline { display: inline; }

.aviso { padding: 0.75rem 1rem; border-radius: var(--raio); margin-bottom: 1rem; }
.aviso-ok { background: var(--ok-fundo); color: var(--ok); }
.aviso-erro { background: var(--hipo-fundo); color: var(--hipo); }
.qr { width: min(320px, 100%); height: auto; background: #fff; padding: 12px; border-radius: var(--raio); }
.passos { text-align: left; display: inline-block; }

@media (max-width: 720px) {
  .menu-botao { display: inline-flex; min-height: 40px; }
  .menu { display: none; width: 100%; flex-direction: column; align-items: stretch; }
  .menu.aberto { display: flex; }
  .menu a, .menu .sair button { padding: 0.65rem 0.5rem; text-align: left; width: 100%; }
  h1 { font-size: 1.35rem; }
  .numero .valor { font-size: 1.6rem; }
}
