/* Página de acesso remoto — Regulador de Vazão Peristáltica */
:root {
  --bg: #EEF3F6;
  --card: #FFFFFF;
  --ink: #0F2F3A;
  --muted: #5E7680;
  --line: #D6E1E7;
  --brand: #115271;
  --brand-ink: #FFFFFF;
  --accent: #1FA7A8;
  --plan: #9AA8AF;
  --ok: #1B7F2A;
  --warn: #B26A00;
  --bad: #B02020;
  --orange: #E5521C;
  --shadow: 0 1px 2px rgba(15, 47, 58, .08), 0 4px 16px rgba(15, 47, 58, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F1A21;
    --card: #17252E;
    --ink: #E4EEF2;
    --muted: #8CACBA;
    --line: #26394A;
    --brand: #2C7FA6;
    --accent: #3CC4C4;
    --plan: #5F7480;
    --ok: #4CC36B;
    --warn: #E6A23C;
    --bad: #FF6B6B;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
button { font: inherit; }

/* ---------- topo ---------- */
.topo {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; background: #0F1A21; color: #fff;
  border-bottom: 3px solid var(--orange);
}
.topo img { width: 34px; height: 34px; }
.topo .t1 { font-weight: 700; font-size: 15px; line-height: 1.15; }
.topo .t2 { font-size: 11px; letter-spacing: 2px; color: #8CACBA; }
.topo .espaco { flex: 1; }
.topo button {
  background: transparent; color: #8CACBA; border: 1px solid #2B4250;
  border-radius: 8px; padding: 6px 10px; font-size: 13px; cursor: pointer;
}

main { max-width: 760px; margin: 0 auto; padding: 14px 16px 40px; display: grid; gap: 14px; }

.card { background: var(--card); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); }
.card h2 {
  margin: 0 0 10px; font-size: 13px; font-weight: 700; letter-spacing: .6px;
  text-transform: uppercase; color: var(--muted);
}

/* ---------- estado ---------- */
.linha-estado { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.nome { font-size: 18px; font-weight: 700; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.selo {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px;
  font-size: 13px; font-weight: 700; color: #fff; background: #6E7F87; white-space: nowrap;
}
.selo.RUNNING { background: #1B7F2A; }
.selo.PAUSED { background: #C77700; }
.selo.FINISHED { background: #1F5FA8; }
.selo.STOPPED { background: #4A4A4A; }
.selo.INTERRUPTED { background: #B02020; }
.selo.RUNNING::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: pulsa 1.4s infinite; }
@keyframes pulsa { 50% { opacity: .25; } }
.sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.sub .bom { color: var(--ok); font-weight: 600; }
.sub .ruim { color: var(--bad); font-weight: 600; }

.barra { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 14px 0 8px; }
.barra > div { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .6s; }
.tempos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.tempos b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }
.tempos span { font-size: 12px; color: var(--muted); }

/* ---------- números ---------- */
.numeros { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.numero .valor { font-size: 32px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.numero .valor small { font-size: 14px; font-weight: 600; color: var(--muted); margin-left: 4px; }
.numero .rot { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.numero .plano { font-size: 12px; color: var(--muted); margin-top: 2px; }

.temps { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.temp {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line);
}
.temp i { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.temp b { font-size: 19px; font-variant-numeric: tabular-nums; margin-left: auto; white-space: nowrap; }
.temp span { font-size: 13px; font-weight: 600; white-space: nowrap; }

canvas { width: 100%; height: 220px; display: block; }
.legenda { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legenda i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }

/* ---------- eventos ---------- */
.eventos { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.eventos li { display: flex; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); }
.eventos li:first-child { border-top: 0; }
.eventos time { color: var(--muted); font-variant-numeric: tabular-nums; }
.vazio { color: var(--muted); font-size: 14px; }

/* ---------- emergência ---------- */
.botoes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bt {
  border: 0; border-radius: 12px; padding: 14px 10px; font-weight: 700; font-size: 16px;
  cursor: pointer; color: #fff; min-height: 52px;
}
.bt:disabled { opacity: .35; cursor: default; }
.bt.pausar { background: #C77700; }
.bt.parar { background: #B02020; }
.bt.retomar { background: #1B7F2A; }
.bt[hidden] { display: none; }
.nota { font-size: 12px; color: var(--muted); margin-top: 10px; }

/* ---------- downloads ---------- */
.arquivos { list-style: none; margin: 0; padding: 0; }
.arquivos li { padding: 10px 0; border-top: 1px solid var(--line); }
.arquivos li:first-child { border-top: 0; }
.arquivos .n { font-weight: 600; overflow-wrap: anywhere; }
.arquivos .d { font-size: 12px; color: var(--muted); }
.arquivos .links { display: flex; gap: 8px; margin-top: 6px; }
.arquivos a {
  text-decoration: none; font-size: 13px; font-weight: 600; color: var(--brand);
  border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px;
}
@media (prefers-color-scheme: dark) { .arquivos a { color: #9ED3EE; } }

/* ---------- avisos ---------- */
.offline {
  display: none; background: var(--bad); color: #fff; text-align: center; padding: 8px; font-size: 14px;
}
.offline.on { display: block; }
.rodape { text-align: center; color: var(--muted); font-size: 12px; }

/* ---------- PIN ---------- */
.fundo-modal {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .55); display: none;
  align-items: center; justify-content: center; padding: 16px; z-index: 10;
}
.fundo-modal.on { display: flex; }
.modal { background: var(--card); border-radius: 16px; padding: 20px; width: 100%; max-width: 360px; }
.modal p { margin: 0 0 14px; }
.modal input, .login input {
  width: 100%; font-size: 22px; padding: 12px; border-radius: 10px; letter-spacing: 4px;
  border: 2px solid var(--line); background: var(--bg); color: var(--ink); text-align: center;
}
.modal .erro, .login .erro { color: var(--bad); font-size: 14px; min-height: 20px; margin: 8px 0; }
.modal .botoes .bt.cancelar { background: var(--line); color: var(--ink); }
.modal .botoes .bt.confirmar { background: var(--brand); }

/* ---------- login ---------- */
.login { max-width: 360px; margin: 10vh auto 0; padding: 0 16px; text-align: center; }
.login img { width: 84px; }
.login h1 { font-size: 20px; margin: 12px 0 2px; }
.login .t2 { font-size: 12px; letter-spacing: 2px; color: var(--muted); margin-bottom: 28px; }
.login input { letter-spacing: normal; text-align: left; font-size: 18px; }
.login .bt { width: 100%; background: var(--brand); margin-top: 6px; }

/* ---------- downloads: atual + experimentos anteriores ---------- */
.sub-t { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
#atual .links { display: flex; gap: 8px; flex-wrap: wrap; }
#atual a, .arquivos a {
  text-decoration: none; font-size: 13px; font-weight: 600; color: var(--brand);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px;
}
@media (prefers-color-scheme: dark) { #atual a, .arquivos a { color: #9ED3EE; } }
.bt-lista {
  display: block; width: 100%; margin-top: 14px; padding: 13px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
  font-weight: 600; text-align: left; cursor: pointer;
}
.bt-lista #qtd { color: var(--muted); font-weight: 400; }
.tela-lista { position: fixed; inset: 0; z-index: 8; background: var(--bg); overflow-y: auto; }
.tela-lista[hidden] { display: none; }
.tela-lista .topo button { margin-right: 4px; }
.busca {
  width: 100%; font-size: 16px; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
}
body.lista-aberta { overflow: hidden; }

/* ---------- fim do experimento ---------- */
.modal.fim { text-align: center; }
.fim-icone {
  width: 56px; height: 56px; margin: 0 auto 10px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 700; color: #fff; background: var(--ok);
}
.fim-icone.ruim { background: var(--bad); }
.fim-icone.neutro { background: #4A4A4A; }
.modal.fim h3 { margin: 0 0 6px; font-size: 19px; }
.modal.fim p { color: var(--muted); font-size: 14px; }
.fim-links { display: grid; gap: 10px; margin: 6px 0 12px; }
.fim-links a {
  display: block; padding: 13px; border-radius: 12px; text-decoration: none;
  font-weight: 700; color: #fff; background: var(--brand);
}
.fim-links a.sec { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.modal.fim .bt { width: 100%; }
.modal.fim .bt.cancelar { background: var(--line); color: var(--ink); }
