/* Identidade: minimalista, tons de cinza, poucos detalhes em vermelho. */
:root {
  color-scheme: light;
  --fundo: #f2f2f2;
  --superficie: #ffffff;
  --superficie-2: #f7f7f7;
  --borda: #d9d9d9;
  --linha: #e6e6e6;
  --texto: #1a1a1a;
  --texto-2: #4d4d4d;
  --texto-3: #6b6b6b;
  --acento: #bb0a30;
  --acento-texto: #ffffff;
  --botao: #1a1a1a;
  --botao-texto: #ffffff;
  --serie: #4d4d4d;
  --ok: #3d7a4a;
  --alerta: #b07800;
  --alarme: #bb0a30;
  --foco: #1a1a1a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --fundo: #121212; --superficie: #1c1c1c; --superficie-2: #242424; --borda: #333333;
    --linha: #2a2a2a; --texto: #f2f2f2; --texto-2: #c2c2c2; --texto-3: #959595;
    --acento: #e3173e; --botao: #f2f2f2; --botao-texto: #121212; --serie: #cfcfcf;
    --ok: #6fbf7f; --alerta: #e0a526; --alarme: #ff4d6a; --foco: #f2f2f2;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --fundo: #121212; --superficie: #1c1c1c; --superficie-2: #242424; --borda: #333333;
  --linha: #2a2a2a; --texto: #f2f2f2; --texto-2: #c2c2c2; --texto-3: #959595;
  --acento: #e3173e; --botao: #f2f2f2; --botao-texto: #121212; --serie: #cfcfcf;
  --ok: #6fbf7f; --alerta: #e0a526; --alarme: #ff4d6a; --foco: #f2f2f2;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--fundo); color: var(--texto);
  font: 400 14px/1.5 system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
b, strong { font-weight: 600; }
h1, h2, h3 { font-weight: 500; margin: 0; }
h1 { font-size: 13px; letter-spacing: .16em; text-transform: uppercase; font-weight: 600; }
h2 { font-size: 22px; margin: 28px 0 16px; letter-spacing: -.01em; font-weight: 500; }
h3 { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--texto-2); margin: 0 0 12px; font-weight: 600; }
.num { font-variant-numeric: tabular-nums; }
.rotulo { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--texto-2); font-weight: 500; }
.muted { color: var(--texto-3); }
.pequeno { font-size: 12px; }

/* Cabeçalho e menu */
header.topo {
  display: flex; align-items: center; gap: 16px; padding: 0 24px; height: 56px;
  background: var(--superficie); border-bottom: 1px solid var(--borda);
}
header.topo .esp { flex: 1; }
/* Marca Neltra: SVG em currentColor; o quadrado do símbolo é o único vermelho fixo da marca. */
.marca { display: inline-flex; align-items: center; gap: 10px; color: var(--texto); text-decoration: none; flex: none; }
.marca-simbolo { height: 12px; width: auto; display: block; }
.marca-simbolo .acento { fill: var(--acento); }
.marca-nome { height: 14px; width: auto; display: block; }
.produto {
  margin-left: 16px; padding-left: 16px; border-left: 1px solid var(--borda); white-space: nowrap;
  font-size: 12px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--texto-2);
  overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.marca-login { display: grid; justify-items: center; gap: 12px; padding-bottom: 4px; }
.marca-login .marca { gap: 20px; }
.marca-login .marca-simbolo { height: 24px; }
.marca-login .marca-nome { height: 28px; }
.marca-login .lema { color: var(--texto-2); font-size: 13px; }
.rodape { max-width: 1120px; margin: 0 auto; padding: 0 24px 24px; font-size: 12px; color: var(--texto-2); }
nav.menu {
  display: flex; gap: 2px; padding: 0 16px; overflow-x: auto; scrollbar-width: none;
  background: var(--superficie); border-bottom: 1px solid var(--borda);
}
nav.menu a {
  text-decoration: none; color: var(--texto-2); padding: 14px 10px 12px; white-space: nowrap;
  font-size: 12px; letter-spacing: .08em; text-transform: uppercase; border-bottom: 2px solid transparent; font-weight: 500;
}
nav.menu a:hover { color: var(--texto); }
nav.menu a.ativo { color: var(--texto); border-bottom-color: var(--acento); font-weight: 600; }
main { padding: 8px 24px 48px; max-width: 1120px; margin: 0 auto; }

/* Superfícies */
.painel { background: var(--superficie); border: 1px solid var(--borda); padding: 20px; margin-bottom: 16px; min-width: 0; }
.painel.desligado { opacity: .55; }
.painel .cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.painel .cab h3 { margin: 0; }
.linha { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.esp { flex: 1; }

/* Tabelas */
.tabela-rolagem { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--linha); vertical-align: middle; }
th { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--texto-2); }
tr:last-child td { border-bottom: 0; }
td.n { width: 48px; color: var(--texto-3); font-variant-numeric: tabular-nums; }
td.valor { font-size: 18px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.valor .un { font-size: 12px; color: var(--texto-3); margin-left: 4px; }
td.acoes { text-align: right; white-space: nowrap; }
tr.desabilitada td { color: var(--texto-3); }
/* Registro que acabou de chegar na página Logs: realce que some em 3 s */
tr.novo td { animation: novo 3s ease-out; }
@keyframes novo { from { background: var(--superficie-2); } to { background: transparent; } }

/* Estado: ponto colorido + texto */
.estado { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.estado::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--texto-3); }
.estado.normal::before { background: var(--ok); }
.estado.alerta { color: var(--alerta); }
.estado.alerta::before { background: var(--alerta); }
/* Alarme: selo vermelho preenchido, com ícone e texto (nunca só a cor). */
.estado.alarme {
  background: var(--acento); color: var(--acento-texto); font-weight: 600;
  padding: 2px 8px 2px 6px; gap: 6px; font-size: 12px; letter-spacing: .04em; text-transform: uppercase;
}
.estado.alarme::before {
  content: "!"; width: 14px; height: 14px; border-radius: 50%; background: var(--acento-texto); color: var(--acento);
  font-size: 11px; font-weight: 700; line-height: 14px; text-align: center; letter-spacing: 0;
}
.estado.ligado::before { background: var(--texto); }
.qualidade { color: var(--alarme); font-size: 12px; letter-spacing: .02em; }
.so-celular { display: none; }

/* Botões */
button, .botao {
  font: inherit; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; font-weight: 500;
  border: 1px solid var(--borda); background: transparent; color: var(--texto);
  padding: 8px 16px; cursor: pointer; text-decoration: none; display: inline-block; border-radius: 0;
}
button:hover:not(:disabled), .botao:hover { border-color: var(--texto); }
button.primario { background: var(--botao); border-color: var(--botao); color: var(--botao-texto); }
button.primario:hover:not(:disabled) { opacity: .88; }
button.discreto { border-color: transparent; padding: 8px 10px; }
button.discreto:hover:not(:disabled) { border-color: var(--borda); }
button.perigo { color: var(--alarme); }
button:disabled { opacity: .35; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--foco); outline-offset: 2px; }
.icone { width: 18px; height: 18px; display: block; fill: none; stroke: currentColor; stroke-width: 1.5; }

/* Escolha entre analógicas e digitais */
.seletor { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin: 24px 0; }
.seletor a {
  display: block; text-decoration: none; background: var(--superficie); border: 1px solid var(--borda);
  padding: 22px 24px; border-top: 2px solid transparent;
}
.seletor a:hover { border-color: var(--texto-3); }
.seletor a.ativo { border-top-color: var(--acento); }
.seletor .titulo { font-size: 18px; font-weight: 500; display: block; }
.seletor .sub { font-size: 12px; color: var(--texto-3); }

/* Formulários */
input, select, textarea {
  font: inherit; font-size: 14px; color: var(--texto); background: var(--superficie);
  border: 0; border-bottom: 1px solid var(--borda); padding: 7px 2px; min-width: 0; width: 100%; border-radius: 0;
}
input:focus, select:focus, textarea:focus { outline: none; border-bottom-color: var(--texto); }
input:disabled, select:disabled { color: var(--texto-3); }
textarea { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; resize: vertical; }
label.campo { display: flex; flex-direction: column; gap: 4px; }
/* Rótulo sempre em uma linha; explicação no "?" (balão) */
label.campo > .rot { display: flex; align-items: center; gap: 6px; min-width: 0; }
.rot .txt, label.campo > span:not(.rot) { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--texto-2); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ajuda {
  display: inline-block; vertical-align: middle; flex: none; width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--texto-3); color: var(--texto-2);
  font-size: 10px; font-weight: 600; line-height: 13px; text-align: center; cursor: help; user-select: none;
}
.ajuda:hover, .ajuda:focus-visible { border-color: var(--texto); color: var(--texto); }
.balao {
  position: fixed; z-index: 10; max-width: min(280px, calc(100vw - 16px)); padding: 10px 12px;
  background: var(--texto); color: var(--fundo); font-size: 12px; line-height: 1.45; pointer-events: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .2);
}
.form { display: grid; gap: 18px 24px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-items: end; }
.barra-acoes { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.trilha { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--texto-2); margin-top: 24px; font-weight: 500; }
.trilha a { text-decoration: none; }
.trilha a:hover { color: var(--texto); }

/* Chave liga/desliga */
.chave { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; color: var(--texto-2); font-weight: 500; }
.chave input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chave .trilho { width: 38px; height: 20px; border-radius: 999px; background: var(--borda); position: relative; transition: background .15s; flex: none; }
.chave .trilho::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #ffffff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.chave input:checked + .trilho { background: var(--acento); }
.chave input:checked + .trilho::after { transform: translateX(18px); }
.chave input:focus-visible + .trilho { outline: 2px solid var(--foco); outline-offset: 2px; }

/* Mensagens */
.msg { padding: 12px 16px; margin: 16px 0; border-left: 3px solid var(--texto-3); background: var(--superficie); white-space: pre-line; }
.msg.erro { border-left-color: var(--alarme); color: var(--alarme); }
.msg.ok { border-left-color: var(--ok); }
.msg.aviso { border-left-color: var(--alerta); }

/* Login */
.centro { display: grid; place-items: center; min-height: 100vh; padding: 16px; position: relative; }
.caixa { width: 100%; max-width: 360px; background: var(--superficie); border: 1px solid var(--borda); padding: 32px; display: grid; gap: 20px; }
.canto { position: absolute; top: 16px; right: 16px; }

/* Identificação (página Sistema) */
.ident { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px 24px; }
.ident div > span { display: block; }
.ident .v { font-size: 15px; font-weight: 500; margin-top: 2px; overflow-wrap: anywhere; }

/* Gráfico */
.grafico { position: relative; }
.grafico svg { display: block; width: 100%; height: 200px; }
.tabela-ips input { min-width: 8.5em; font-variant-numeric: tabular-nums; }
.graficos { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); }
.graficos .painel { margin: 0; }
.grafico .eixo text { fill: var(--texto-2); font-size: 11px; }
.grafico .grade-linha { stroke: var(--linha); stroke-width: 1; }
.grafico .serie { fill: none; stroke: var(--serie); stroke-width: 2; stroke-linejoin: round; }
.grafico .faixa { fill: var(--serie); opacity: .14; }
.grafico .mira { stroke: var(--texto-3); stroke-width: 1; }
.grafico .ponto { fill: var(--texto); stroke: var(--superficie); stroke-width: 2; }
.dica {
  position: absolute; pointer-events: none; background: var(--superficie); border: 1px solid var(--borda);
  padding: 8px 10px; font-size: 12px; white-space: nowrap; box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
}
.dica .t { color: var(--texto-3); }

/* Painel do instrutor (só no simulador) */
.grade { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grade .painel { margin: 0; }
.grande { font-size: 26px; font-weight: 400; font-variant-numeric: tabular-nums; }
input[type="range"] { border: 0; padding: 0; accent-color: var(--acento); }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--acento); }

@media (max-width: 640px) {
  header.topo { padding: 0 16px; }
  main { padding: 4px 16px 40px; }
  .painel { padding: 16px; }
  h2 { font-size: 19px; }
  th, td { padding: 10px 8px; }
  .ocultar-celular { display: none; }
  .so-celular { display: block; margin-top: 4px; }
  header.topo { gap: 8px; }
  header.topo .produto { display: none; }
  .estado.alarme { white-space: normal; letter-spacing: .02em; align-items: flex-start; }
  .estado.alarme::before { flex: none; margin-top: 2px; }
  .rodape { padding: 0 16px 20px; }
  td.acoes .botao { padding: 8px 10px; }
  .tabela-ips td, .tabela-ips th { padding-left: 4px; padding-right: 4px; }
  .tabela-ips td.acoes button { padding: 8px 6px; }
  .tabela-ips input { min-width: 0; font-size: 13px; }
}
