:root {
  color-scheme: light dark;
  --bg: #f3f6fa;
  --card: #fff;
  --text: #162338;
  --muted: #4e6077;
  --line: #c8d4e3;
  --accent: #124f9d;
  --button-text: #fff;
  --alert: #8b360b;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111927;
    --card: #1a2638;
    --text: #edf3fc;
    --muted: #b5c6dc;
    --line: #485a73;
    --accent: #9cc8ff;
    --button-text: #111927;
    --alert: #ffc089;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.5 system-ui, sans-serif;
}
main { max-width: 76rem; margin-inline: auto; padding: clamp(1rem, 4vw, 2.5rem); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.65rem, 5vw, 2.25rem); line-height: 1.15; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p, dt { color: var(--muted); }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.acesso {
  min-width: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: .85rem;
}
.aviso, [role="alert"] { color: var(--alert); }
.acesso { max-width: 26rem; margin: 10vh auto 0; width: calc(100% - 2rem); padding: 1.5rem; }
.acesso form { display: grid; gap: .65rem; margin-top: 1rem; }
.acesso p { margin: .75rem 0; }
input, button { font: inherit; border-radius: .5rem; min-height: 44px; padding: .45rem .8rem; }
input { min-width: 0; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
button {
  color: var(--button-text);
  background: var(--accent);
  border: 1px solid var(--accent);
  font-weight: 600;
  cursor: pointer;
}

.pagina-servidores {
  --bg: #f1f4f8;
  --card: #ffffff;
  --text: #142033;
  --muted: #58677a;
  --line: #dce4ed;
  --accent: #3579e8;
  --ok: #1f8a46;
  --warn: #b07800;
  --bad: #d13b3b;
  --trilho: #e8edf4;
  --sem-atribuicao: #64748b;
  --u0: #1565c0;
  --u1: #b24b08;
  --u2: #0e786c;
  --u3: #7c3aad;
  --u4: #8a6006;
  --u5: #b52b73;
  --u6: #0f6e8c;
  --u7: #457316;
  --u8: #3e45bd;
  --u9: #9c4a28;
  --u10: #187840;
  --u11: #8a308f;
  --luminosidade-paleta-extra: 22%;
  --borda-amostra: #344054;
}
@media (prefers-color-scheme: dark) {
  .pagina-servidores {
    --bg: #101722;
    --card: #192332;
    --text: #e4ecf7;
    --muted: #9eacc0;
    --line: #303e52;
    --accent: #6aa3ff;
    --ok: #62d28e;
    --warn: #e9b44e;
    --bad: #ff8f91;
    --trilho: #263347;
    --sem-atribuicao: #8a99ad;
    --u0: #5ca8f5;
    --u1: #f2934b;
    --u2: #3cc9bb;
    --u3: #b986f5;
    --u4: #e0b438;
    --u5: #eb74b2;
    --u6: #49bce8;
    --u7: #8ec940;
    --u8: #8892f0;
    --u9: #de8f6a;
    --u10: #4fd180;
    --u11: #dc7ee8;
    --luminosidade-paleta-extra: 73%;
    --borda-amostra: #c9d4e4;
  }
}
.painel { max-width: 1180px; padding: 16px; font: 15px/1.4 system-ui, sans-serif; }
.painel h1 { font-size: 24px; }
.painel h2 { font-size: 17px; margin-bottom: 10px; }
.painel h3 { font-size: 15px; }
.painel small, .painel p { color: var(--muted); }
.topo, .acoes-topo, .dtopo {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 8px 12px;
}
.acoes-topo, .dtopo { align-items: center; }
.painel button {
  color: var(--text);
  background: var(--card);
  border-color: var(--line);
  font-weight: 400;
}
.painel button:hover { border-color: var(--accent); }
.topo-servidores {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}
#grupos:empty { display: none; }
.painel .anel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 12px 10px;
  border-top: 4px solid var(--line);
  border-radius: 16px;
  text-align: center;
}
.painel .anel.ok { border-top-color: var(--ok); }
.painel .anel.warn { border-top-color: var(--warn); }
.painel .anel.bad { border-top-color: var(--bad); }
.desenho-anel { display: block; width: min(100%, 118px); }
.anel svg { display: block; width: 100%; height: auto; }
.anel .fundo { fill: none; stroke: var(--trilho); }
.anel .divisoria {
  stroke: var(--card);
  stroke-width: 1.5px;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}
.anel .val { fill: var(--text); font: 700 26px system-ui, sans-serif; }
.anel .uni { fill: var(--muted); font: 600 12px system-ui, sans-serif; }
.anel .tit { font-weight: 600; font-size: 14px; }
.anel .frac { font-size: 20px; line-height: 1.12; }
.anel small { font-size: 12px; line-height: 1.25; overflow-wrap: anywhere; }
.painel .anel .aviso { color: var(--alert); }
.memo {
  display: block;
  width: 100%;
  border-top: 1px solid var(--line);
  padding-top: 5px;
  margin-top: 3px;
}
.anel .memo { font-size: 11px; }
.memo span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.memo .disco-alerta { color: var(--bad); }
.legenda-servidores, .card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}
.legenda-servidores { grid-column: 1 / -1; }
.legcores {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-bottom: 4px;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.amostra-cor { width: 13px; height: 13px; margin-right: 5px; vertical-align: -.13em; }
.amostra-cor circle { stroke: var(--borda-amostra); stroke-width: .8; }
.card { margin-top: 14px; }
.scroll { overflow-x: auto; }
.painel table { width: 100%; border-collapse: collapse; font-size: 13.5px; text-align: left; }
.painel :is(th, td) { padding: 8px; border-bottom: 1px solid var(--line); }
.painel thead th { color: var(--muted); font-size: 12px; font-weight: 600; }
.resumo-nos small { display: block; font-weight: 400; }
#fila { margin: 0 0 8px; font-size: 13px; }
.historico-nos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.historico-no { padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.historico-no p, .leg-historico { margin: 4px 0 8px; font-size: 13px; }
.serie { margin: 8px 0; }
.serie figcaption, .eixo-tempo { display: flex; justify-content: space-between; gap: 6px; }
.serie figcaption { font-size: 13.5px; }
.spark { width: 100%; height: 44px; display: block; }
.spark path { fill: none; vector-effect: non-scaling-stroke; }
.spark .guias { stroke: var(--line); }
.spark .curva { stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; }
.spark .pbs { stroke: var(--muted); stroke-dasharray: 3 3; }
.estatistica, .eixo-tempo { font-size: 12.5px; }
.eixo-tempo { border-top: 1px solid var(--line); padding-top: 5px; }
#detalhe {
  width: min(1100px, 96vw);
  max-height: 88vh;
  max-height: 88dvh;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--text);
}
#detalhe[open] { display: flex; flex-direction: column; overflow: hidden; }
#detalhe::backdrop { background: rgb(0 0 0 / 45%); }
.dtopo { flex: none; margin-bottom: 6px; }
.dtopo h2 { margin: 0; }
#dcorpo { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; }
#dcorpo p { margin: 4px 0 8px; font-size: 13px; }
.metricas-no {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px 16px;
  margin: 8px 0 14px;
}
.metrica { padding-top: 4px; border-top: 1px solid var(--line); }
.metrica dt { font-size: 12px; }
.metrica dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.metrica meter { width: 100%; height: 8px; }
.usuarios-no th { overflow-wrap: anywhere; }
@media (min-width: 1020px) {
  .topo-servidores { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .painel { padding: 12px; }
}
@media (max-width: 600px) {
  .topo-servidores { gap: 8px; }
  .painel .anel { padding-inline: 4px; }
  .desenho-anel { max-width: 100px; }
  .painel :is(th, td) { padding-inline: 4px; }
  .historico-nos { grid-template-columns: minmax(0, 1fr); }
  .metricas-no { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 8px; }
  #detalhe { padding: 10px; }
}
@media (max-width: 374px) {
  .topo-servidores { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
