/* Implantador Supernova — identidade herdada do app desktop (cabeçalho azul-marinho, fundo verde-acinzentado,
   cartões sóbrios, acentos azuis só onde há ação). Tema escuro automático. Sem estilos inline (CSP). */
:root {
  --bg: #e5eae7; --surface: #f5f7f6; --surface-2: #ebf0ed; --surface-hover: #dce4e0;
  --line: #c4cfc9; --line-soft: #d3dcd7; --line-strong: #aebdb5;
  --text: #1d2824; --muted: #5e6b65;
  --accent: #2453a4; --accent-hover: #244c9d; --accent-2: #2d68c4; --accent-soft: #d9e5f6;
  --header: #10243a; --header-text: #ffffff; --header-sub: #d7e3f6;
  --ok: #16856f; --ok-bg: #d7ebe5; --ok-text: #0f6a59;
  --warn: #86520a; --warn-bg: #f8ead0; --warn-line: #e6c88b;
  --err: #b02a3c; --err-bg: #f4e0e4; --info: #2453a4; --info-bg: #d9e5f6;
  --neutral: #4b5a54; --neutral-bg: #dfe6e2;
  --ring: #2d68c455; --radius: 10px; --radius-sm: 6px;
  --shadow: 0 1px 2px #10243a14, 0 6px 18px #10243a0d;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1722; --surface: #152231; --surface-2: #101c29; --surface-hover: #1c2c3e;
    --line: #26384b; --line-soft: #1f3042; --line-strong: #35506b;
    --text: #e6edf4; --muted: #92a3b4;
    --accent: #4b86e0; --accent-hover: #6397ea; --accent-2: #6aa0f5; --accent-soft: #17304f;
    --header: #0a1623; --header-text: #ffffff; --header-sub: #b9cbe3;
    --ok: #4cc9ac; --ok-bg: #11332d; --ok-text: #5fd9bd;
    --warn: #f0be63; --warn-bg: #352a10; --warn-line: #5b4620;
    --err: #ff8795; --err-bg: #3a1a20; --info: #8ab8ff; --info-bg: #17304f;
    --neutral: #a9b8c6; --neutral-bg: #1e2f40;
    --ring: #6aa0f555; --shadow: 0 1px 2px #00000040, 0 8px 22px #00000030;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: light dark; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.55 "Segoe UI", "Inter", system-ui, -apple-system, Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1 { font-size: 1.55rem; line-height: 1.2; margin: 0 0 .2rem; letter-spacing: -.01em; }
h2 { font-size: 1rem; margin: 0 0 .4rem; color: var(--accent); font-weight: 700; display: flex; align-items: center; gap: .5rem; }
p { margin: .25rem 0 .8rem; }
.muted { color: var(--muted); }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 1px; border-radius: 4px; }
.ico { width: 1.15em; height: 1.15em; flex: none; }

/* ── Cabeçalho ─────────────────────────────────────────────────────────────── */
.topbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.25rem; padding: .7rem 1.25rem;
  background: var(--header); border-bottom: 2px solid var(--accent-2); color: var(--header-text);
}
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: var(--header-text); }
.brand-logo { width: 42px; height: 42px; border-radius: 10px; background: #fff; border: 2px solid #ffffff55; padding: 0; }
.brand-txt { display: grid; line-height: 1.15; }
.brand-txt b { font-size: 1.15rem; font-weight: 700; letter-spacing: -.01em; }
.brand-txt small { color: var(--header-sub); font-size: .78rem; }
.nav { display: flex; gap: .25rem; flex-wrap: wrap; margin-left: .5rem; }
.nav a {
  display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .85rem; border-radius: 8px;
  text-decoration: none; color: var(--header-sub); font-weight: 600; font-size: .92rem;
}
.nav a:hover { background: #ffffff14; color: #fff; }
.nav a[aria-current="page"] { background: #ffffff26; color: #fff; box-shadow: inset 0 -2px 0 var(--accent-2); }
.spacer { flex: 1; }
.topbar select {
  width: auto; background: #ffffff14; color: #fff; border: 1px solid #ffffff2e; padding: .4rem .6rem; border-radius: 8px;
}
.topbar select option { background: var(--header); color: #fff; }
.chip-usuario {
  background: #ffffff1f; border: 1px solid #ffffff2e; border-radius: 8px; padding: .4rem .75rem; font-size: .8rem;
  font-weight: 600; color: #fff; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar button { background: transparent; color: #fff; border: 1px solid #ffffff4d; }
.topbar button:hover { background: #ffffff1f; }

/* ── Layout ────────────────────────────────────────────────────────────────── */
.page { max-width: 1100px; margin: 0 auto; padding: 1.6rem 1.25rem 3.5rem; }
.pagehead { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem 1.5rem; margin-bottom: 1.1rem; }
.pagehead > div:first-child { flex: 1 1 320px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.25rem; box-shadow: var(--shadow); margin-bottom: 1rem;
}
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); }
.row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; }
.row > .grow { flex: 1 1 200px; }
.row.topo { margin-top: .75rem; }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty .ico { width: 2.4rem; height: 2.4rem; color: var(--accent-2); margin-bottom: .5rem; }

/* ── Formulários e botões ──────────────────────────────────────────────────── */
label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: .25rem; font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select {
  width: 100%; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit;
}
input:hover, select:hover { border-color: var(--line-strong); }
input:focus, select:focus { border-color: var(--accent-2); outline: none; box-shadow: 0 0 0 3px var(--ring); }
input:disabled { background: var(--surface-hover); color: var(--muted); }
button, .btn {
  font: inherit; font-weight: 600; cursor: pointer; padding: .55rem 1rem; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--accent); text-decoration: none;
  display: inline-flex; align-items: center; gap: .5rem; transition: background .15s, border-color .15s;
}
button:hover, .btn:hover { background: var(--surface-hover); border-color: var(--accent-2); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.danger { color: var(--err); border-color: #cf3d4f66; }
button.danger:hover { background: var(--err-bg); border-color: var(--err); }
button.small { padding: .3rem .7rem; font-size: .85rem; }
button:disabled { opacity: .5; cursor: not-allowed; }
.field { margin-bottom: .8rem; }
.check { display: flex; gap: .55rem; align-items: center; color: var(--text); font-size: .95rem; font-weight: 500; }
.check input { width: 1.05rem; height: 1.05rem; accent-color: var(--accent); }

/* ── Selos e avisos ────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .65rem; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.tone-ok { background: var(--ok-bg); color: var(--ok-text); }
.tone-warn { background: var(--warn-bg); color: var(--warn); }
.tone-err { background: var(--err-bg); color: var(--err); }
.tone-info { background: var(--info-bg); color: var(--info); }
.tone-neutral { background: var(--neutral-bg); color: var(--neutral); }
.notice { display: flex; gap: .6rem; align-items: flex-start; padding: .75rem 1rem; border-radius: var(--radius); margin: 0 0 1rem; border: 1px solid transparent; }
.notice.tone-warn { border-color: var(--warn-line); }
.notice.tone-info { border-color: #2d68c44d; }
.notice.tone-err { border-color: #cf3d4f66; }
#toasts { position: fixed; right: 1rem; bottom: 1rem; display: grid; gap: .5rem; z-index: 10; max-width: min(380px, calc(100vw - 2rem)); }
.toast { padding: .7rem 1rem; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); border-left: 4px solid var(--accent-2); background: var(--surface); }
.toast.err { border-left-color: var(--err); }
.toast.ok { border-left-color: var(--ok); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Painel de progresso ───────────────────────────────────────────────────── */
.lote-topo { display: flex; align-items: center; gap: 1rem; margin-bottom: .6rem; }
.lote-topo h2 { flex: 1; margin: 0; font-size: 1.05rem; }
.pct { font-size: 2.2rem; font-weight: 800; line-height: 1; color: var(--accent); letter-spacing: -.02em; }
progress { width: 100%; height: 16px; border-radius: 999px; overflow: hidden; appearance: none; border: 0; background: var(--neutral-bg); }
progress::-webkit-progress-bar { background: var(--neutral-bg); }
progress::-webkit-progress-value { background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; transition: width .5s; }
progress::-moz-progress-bar { background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; }
.stats { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 1rem 0 .5rem; }
.stat { background: var(--surface-2); border: 1px solid var(--line-soft); border-left: 4px solid var(--line-strong); border-radius: 8px; padding: .65rem .85rem; }
.stat-valor { font-size: 1.6rem; font-weight: 800; line-height: 1.15; }
.stat-rotulo { font-size: .8rem; color: var(--muted); font-weight: 600; }
.stat.ok { border-left-color: var(--ok); background: var(--ok-bg); }
.stat.ok .stat-valor { color: var(--ok-text); }
.stat.warn { border-left-color: #d38a20; }
.stat.warn .stat-valor { color: var(--warn); }
.stat.err { border-left-color: var(--err); }
.stat.err .stat-valor { color: var(--err); }

/* ── Navegador remoto (gov.br) e termo ─────────────────────────────────────── */
.janela { max-width: 1280px; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; background: #000; box-shadow: var(--shadow); }
.janela-barra { display: flex; align-items: center; gap: .6rem; background: var(--header); color: var(--header-sub); padding: .45rem .8rem; font-size: .8rem; font-weight: 600; }
.janela-barra i { width: 10px; height: 10px; border-radius: 50%; background: #ffffff40; }
.janela-barra .ico { width: 1em; height: 1em; margin-left: .3rem; }
.tela-remota { width: 100%; aspect-ratio: 16 / 9; background: #000; touch-action: none; cursor: default; display: block; }
.entrada-remota { position: fixed; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; resize: none; }
.termo {
  white-space: pre-wrap; font: inherit; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: .9rem 1rem; max-height: 320px; overflow: auto; margin: .6rem 0;
}

/* ── Login / primeiro acesso ───────────────────────────────────────────────── */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(300px, 1fr) minmax(360px, 1fr); }
.auth-brand {
  background: radial-gradient(900px 420px at 0% 0%, #2d68c47a 0%, transparent 65%), var(--header);
  color: #fff; padding: 3rem clamp(1.5rem, 5vw, 4rem); display: flex; flex-direction: column; justify-content: center; gap: 1.6rem;
}
.auth-brand .logo-grande { width: 84px; height: 84px; border-radius: 20px; background: #fff; border: 3px solid #ffffff55; }
.auth-brand h1 { font-size: 2.2rem; color: #fff; }
.auth-brand p { color: var(--header-sub); font-size: 1.05rem; max-width: 34ch; }
.auth-brand ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .8rem; }
.auth-brand li { display: flex; gap: .7rem; align-items: center; color: #e8f0fb; font-weight: 500; }
.auth-brand li .ico { width: 1.5rem; height: 1.5rem; padding: .3rem; border-radius: 8px; background: #ffffff1f; color: #bfd5f6; }
.auth-form { display: grid; place-items: center; padding: 2rem 1.25rem; }
.auth-form .card { width: min(100%, 420px); padding: 1.6rem; }
.auth-form h2 { font-size: 1.25rem; color: var(--text); }
@media (max-width: 860px) {
  .auth-wrap { grid-template-columns: 1fr; min-height: 0; }
  .auth-brand { padding: 1.6rem 1.25rem; gap: 1rem; }
  .auth-brand .logo-grande { width: 56px; height: 56px; border-radius: 14px; }
  .auth-brand h1 { font-size: 1.5rem; }
  .auth-brand ul { display: none; }
}
@media (max-width: 640px) {
  .page { padding: 1.1rem .85rem 3rem; }
  .topbar { padding: .6rem .85rem; }
  .nav { margin-left: 0; }
  .chip-usuario { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat-valor { font-size: 1.4rem; }
  .pct { font-size: 1.8rem; }
}

/* ── Lista de pessoas do lote ─────────────────────────────────────────────── */
.pessoas { margin-top: 1rem; border-top: 1px solid var(--line-soft); padding-top: .9rem; }
.pessoas .busca { width: 100%; }
.tabela-rolagem { overflow-x: auto; max-height: 28rem; overflow-y: auto; margin-top: .6rem; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); }
.pessoas table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.pessoas th, .pessoas td { text-align: left; padding: .45rem .7rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.pessoas th { position: sticky; top: 0; background: var(--surface-2); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.pessoas .col-check { width: 2.2rem; }
.pessoas input[type=checkbox] { width: 1.05rem; height: 1.05rem; accent-color: var(--accent); }

/* ── Conector local ───────────────────────────────────────────────────────── */
.codigo { font-size: 2.2rem; font-weight: 800; letter-spacing: .25em; text-align: center; padding: 1rem; margin: .75rem 0;
  border: 2px dashed var(--accent-2); border-radius: var(--radius); color: var(--accent); user-select: all; }
.lista-pcs { list-style: none; padding: 0; margin: .5rem 0 0; display: grid; gap: .5rem; }
.passos { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: .9rem; }
.passo { display: flex; gap: .8rem; align-items: flex-start; }
.passo-n { flex: none; width: 1.8rem; height: 1.8rem; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 800; }
.duas-colunas { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin: 1rem 0; }
.duas-colunas ul { margin: .4rem 0 0; padding-left: 1.2rem; }
