/* UniControl · Protótipo de coleta + BI (offline-first) */
:root {
  --brand: #0e9d6e;
  --brand-dark: #0c3b34;
  --brand-darker: #08291f;
  --bg: #eef2f4;
  --card: #ffffff;
  --ink: #15303a;
  --muted: #6b8089;
  --line: #e3e9ec;
  --ok: #16a34a;
  --warn: #f59e0b;
  --bad: #e11d48;
  --info: #2563eb;
  --shadow: 0 6px 22px rgba(12, 59, 52, .08);
  --radius: 16px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--ink);
  display: flex; min-height: 100vh; flex-direction: column;
}
button { font-family: inherit; cursor: pointer; }
h1, h2, h3 { margin: 0; }

/* ---------- Top bar ---------- */
/* Barra chapada, não degradê diagonal: o degradê em ângulo era o que dava
   o ar de template. Verde da marca, uma linha de luz embaixo, e fim. */
.topbar {
  background: var(--brand-dark);
  color: #fff; padding: 0 18px; height: 56px; display: flex; align-items: center; gap: 12px;
  position: sticky; top: 0; z-index: 20;
  box-shadow: inset 0 -1px 0 rgba(255,255,255,.08);
}
.brand { display: flex; align-items: center; gap: 9px; color: #fff; text-decoration: none; }
/* O símbolo é quadrado e tem respiro interno no próprio PNG; 30px de
   altura o deixa do tamanho ótico do texto ao lado. */
.brand-mark { display: block; flex: 0 0 auto; }
.brand-mark img { display: block; height: 30px; width: auto; }
.brand-nome { font-size: 17px; font-weight: 600; letter-spacing: -.2px; }
.brand-logo { display: block; background: #fff; border-radius: 9px; padding: 3px 8px; line-height: 0; }
.brand-logo img { display: block; height: 30px; width: auto; }
.topbar .spacer { flex: 1; }
.pill {
  background: rgba(255,255,255,.1); padding: 5px 11px; border-radius: 8px;
  font-size: 12px; display: inline-flex; align-items: center; gap: 6px;
  color: rgba(255,255,255,.85);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 3px rgba(52,211,153,.25); }

/* ---------- Layout ---------- */
main { flex: 1; padding: 16px 16px 92px; max-width: 1100px; width: 100%; margin: 0 auto; }
.view { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin: 18px 4px 10px; }

/* ---------- Cards ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card + .card { margin-top: 14px; }

/* ---------- Form controls ---------- */
label.field { display: block; margin-bottom: 12px; }
label.field span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
select, input[type=text], input[type=password], input[type=date] {
  width: 100%; padding: 13px 12px; border: 1px solid var(--line); border-radius: 11px;
  font-size: 15px; background: #fff; color: var(--ink); appearance: none; font-family: inherit;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.btn {
  border: none; border-radius: 12px; padding: 14px 18px; font-size: 15px; font-weight: 700;
  background: var(--brand); color: #fff; width: 100%; box-shadow: 0 4px 14px rgba(14,157,110,.3);
}
.btn:active { transform: translateY(1px); }
.btn.secondary { background: #fff; color: var(--brand-dark); border: 1px solid var(--line); box-shadow: none; }
.btn.ghost { background: transparent; color: var(--muted); box-shadow: none; width: auto; padding: 8px 10px; }
.btn.danger { background: var(--bad); box-shadow: none; }

/* ---------- KPI grid ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; position: relative; overflow: hidden; }
.kpi .ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-size: 18px; margin-bottom: 8px; }
.kpi .val { font-size: 26px; font-weight: 800; line-height: 1; }
.kpi .lbl { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi .sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.ic.g { background: #d8f5e9; color: var(--brand); }
.ic.b { background: #dbeafe; color: var(--info); }
.ic.a { background: #fef3c7; color: var(--warn); }
.ic.r { background: #ffe1e8; color: var(--bad); }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.ok { background: #d8f5e9; color: var(--brand); }
.badge.med { background: #fef3c7; color: #b45309; }
.badge.alto { background: #ffe1e8; color: var(--bad); }

/* ---------- Charts ---------- */
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.chart-card h3 { font-size: 15px; margin-bottom: 4px; }
.chart-card .hint { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
svg.chart { width: 100%; height: auto; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 4px; vertical-align: middle; }

/* ---------- Device list ---------- */
.tabs { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.tab { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 14px; font-size: 13px; font-weight: 600; color: var(--muted); }
.tab.active { background: var(--brand-dark); color: #fff; border-color: var(--brand-dark); }
.dev { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.dev:last-child { border-bottom: none; }
.dev .num { font-weight: 800; background: #f0f4f5; border-radius: 9px; padding: 8px 10px; font-size: 13px; min-width: 54px; text-align: center; }
.dev .meta { flex: 1; }
.dev .meta b { font-size: 14px; }
.dev .meta small { display: block; color: var(--muted); font-size: 12px; }
.dev .state { font-size: 12px; font-weight: 700; }
.dev .state.pend { color: var(--muted); }
.dev .state.done { color: var(--brand); }
.dev .state.anom { color: var(--bad); }
.dev .chev { color: var(--muted); }

/* ---------- Bottom sheet (modal) ---------- */
.sheet-bg { position: fixed; inset: 0; background: rgba(8,41,31,.45); display: none; z-index: 70; /* 31/10: acima do comprovante (60) — o "Validar e assinar" abria atrás dele */ align-items: flex-end; }
.sheet-bg.open { display: flex; }
.sheet { background: #fff; width: 100%; max-width: 560px; margin: 0 auto; border-radius: 20px 20px 0 0; padding: 18px 18px 24px; max-height: 88vh; overflow-y: auto; animation: up .25s ease; }
@keyframes up { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet .grab { width: 44px; height: 5px; background: var(--line); border-radius: 999px; margin: 0 auto 14px; }
.sheet h3 { font-size: 18px; }
.sheet .sub { color: var(--muted); font-size: 13px; margin: 2px 0 16px; }

/* toggle chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1.5px solid var(--line); background: #fff; border-radius: 11px; padding: 11px 14px; font-size: 14px; font-weight: 600; color: var(--ink); }
.chip.on { border-color: var(--brand); background: #e9faf2; color: var(--brand-dark); }
.chip.on.bad { border-color: var(--bad); background: #ffeef2; color: var(--bad); }

/* toggle switch row */
.toggle { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); }
.toggle b { font-size: 15px; }
.switch { width: 52px; height: 30px; border-radius: 999px; background: #d6dee1; position: relative; transition: .2s; border: none; }
.switch.on { background: var(--brand); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch.on::after { left: 25px; }

/* counters */
.counter { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.counter:last-of-type { border-bottom: none; }
.counter .cl { font-size: 15px; font-weight: 600; }
.counter .ctrl { display: flex; align-items: center; gap: 14px; }
.counter button { width: 42px; height: 42px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; font-size: 22px; font-weight: 800; color: var(--brand-dark); line-height: 1; }
.counter button.plus { background: var(--brand); color: #fff; border-color: var(--brand); }
.counter .cv { min-width: 34px; text-align: center; font-size: 20px; font-weight: 800; }

/* ---------- Bottom nav ---------- */
.nav {
  position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line);
  display: flex; justify-content: space-around; padding: 8px 6px calc(8px + env(safe-area-inset-bottom)); z-index: 30;
}
.nav a { text-decoration: none; color: var(--muted); font-size: 11px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-weight: 600; padding: 4px 14px; border-radius: 12px; }
.nav a .nic { font-size: 20px; }
.nav a.active { color: var(--brand); }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.toast { position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%); background: var(--brand-dark); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow); z-index: 90; animation: fade .2s; }

.note { background: #f5f9f8; border: 1px dashed var(--brand); color: var(--brand-dark); border-radius: 12px; padding: 10px 12px; font-size: 12.5px; }

@media (max-width: 720px) {
  .chart-grid { grid-template-columns: 1fr; }
}

/* ============ Refinos v2 ============ */
.screen-title { font-size: 18px; letter-spacing: -.2px; margin-bottom: 3px; }
.screen-sub { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.kpi .val .vt { font-size: 15px; color: var(--muted); font-weight: 700; }
.kpi.nivel.alto { box-shadow: 0 6px 22px rgba(225,29,72,.16); }
.btn.small { width: auto; padding: 9px 14px; font-size: 13px; border-radius: 10px; }
.toast.out { opacity: 0; transform: translateX(-50%) translateY(8px); transition: .3s; }

/* visitas em andamento */
.resume { border: 1px solid #d6ece2; background: linear-gradient(180deg,#f4fbf8,#fff); }
.resume-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.resume-row:first-of-type { border-top: none; }
.resume-row b { font-size: 14px; } .resume-row small { display: block; color: var(--muted); font-size: 12px; }

/* cabeçalho da visita + progresso */
.visit-head .vh-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.vh-os { font-size: 12px; color: var(--muted); font-weight: 800; letter-spacing: .3px; }
.vh-ring { text-align: center; flex-shrink: 0; }
.ring-num { font-size: 22px; font-weight: 800; color: var(--brand-dark); line-height: 1; }
.ring-num small { font-size: 13px; color: var(--muted); font-weight: 700; }
.ring-lbl { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.progress { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: #e9eef0; margin-top: 14px; }
.progress .seg { height: 100%; transition: width .35s ease; }
.progress .seg.ok { background: var(--brand); }
.progress .seg.an { background: var(--bad); }
.progress-legend { display: flex; gap: 16px; margin-top: 10px; font-size: 12px; color: var(--muted); font-weight: 600; }
.progress-legend i.d { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 5px; }
i.d.ok { background: var(--brand); } i.d.an { background: var(--bad); } i.d.pe { background: #cdd6da; }

/* badges nas abas */
.tab .pendbadge { background: var(--bad); color: #fff; border-radius: 999px; padding: 0 7px; font-size: 11px; margin-left: 2px; }
.tab .okbadge { color: var(--brand); margin-left: 2px; }
.tab.active .pendbadge { background: #fff; color: var(--brand-dark); }
.tab.active .okbadge { color: #fff; }

/* busca */
.searchbar { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; margin-bottom: 12px; }
.searchbar span { color: var(--muted); }
.searchbar input { border: none; padding: 12px 0; flex: 1; font-size: 14px; outline: none; }

/* linha de dispositivo (estados) */
.dev { border-left: 3px solid transparent; padding-left: 8px; border-radius: 8px; }
.dev.st-anom { border-left-color: var(--bad); background: #fff7f8; }
.dev.st-capt { border-left-color: var(--warn); }
.dev.st-ok { opacity: .92; }
.dev .state.pend { color: var(--muted); font-weight: 600; }
.dev .state.ok { color: var(--brand); }
.dev .state.capt { color: #b45309; }
.dev .state.anom { color: var(--bad); font-weight: 700; }
.dev .check { width: 38px; height: 38px; border-radius: 11px; border: 1.5px solid var(--line); background: #fff; font-size: 17px; color: var(--muted); flex-shrink: 0; }
.dev .check.on { background: var(--brand); border-color: var(--brand); color: #fff; }

.btn.batch { margin-top: 12px; font-size: 13.5px; }
.footer-actions { display: flex; gap: 10px; margin-top: 14px; }
.footer-actions .btn:first-child { flex: 1; } .footer-actions .btn:last-child { flex: 2; }

/* contagem ao vivo */
.counter-head { display: flex; align-items: center; justify-content: space-between; }
.live-total { font-size: 13px; color: var(--muted); }
.live-total b { font-size: 18px; color: var(--brand-dark); }
.counter.has .cv { color: var(--brand); }
.counter.has { background: #f4fbf8; border-radius: 8px; }

/* revisão */
.review-kpis { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin: 6px 0 4px; }
.review-kpis > div { background: #f5f8f9; border-radius: 12px; padding: 12px; text-align: center; }
.review-kpis b { display: block; font-size: 24px; font-weight: 800; color: var(--brand-dark); }
.review-kpis span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.review-kpis .warn b { color: var(--bad); }
.alert { background: #fff4e5; border: 1px solid #ffd9a8; color: #92500e; border-radius: 12px; padding: 11px 13px; font-size: 13px; margin-top: 12px; }
.alert.ok { background: #e9faf2; border-color: #b6e8d3; color: var(--brand-dark); }
.review-list { display: flex; flex-direction: column; gap: 6px; }
.rev-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.rev-row .num { font-weight: 800; background: #f0f4f5; border-radius: 7px; padding: 4px 8px; font-size: 12px; }
.rev-row .rt { flex: 1; font-size: 13px; font-weight: 600; }
.rev-row small { color: var(--muted); font-size: 12px; }

/* input digitável no contador de espécies */
.counter input.cv {
  width: 60px; text-align: center; font-size: 20px; font-weight: 800;
  color: var(--brand-dark); border: 1.5px solid var(--line); border-radius: 10px;
  padding: 9px 4px; background: #fff; -moz-appearance: textfield; appearance: textfield;
}
.counter input.cv:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14,157,110,.15); }
.counter input.cv::-webkit-outer-spin-button,
.counter input.cv::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.counter.has input.cv { color: var(--brand); border-color: var(--brand); }
.counter .ctrl button.minus, .counter .ctrl button.plus { width: 40px; height: 44px; }

/* ============ Login & perfis (v3) ============ */
.login-view { display: flex; align-items: center; justify-content: center; min-height: 68vh; }
.login-card { width: 100%; max-width: 380px; }
.login-marca { display: block; width: 64px; height: auto; margin: 4px auto 10px; }
.login-marca.completo { width: 220px; max-width: 80%; }
.login-nome { text-align: center; font-size: 22px; margin: 0 0 18px; }
/* Na troca de senha o título é acompanhado de um subtítulo, que já dá o
   respiro — senão a margem dobra e a tela fica com um buraco no meio. */
.login-nome + .screen-sub { text-align: center; margin: -10px 0 18px; }
.login-err { color: var(--bad); font-size: 13px; font-weight: 700; margin: -2px 0 10px; }
.login-hint { margin-top: 14px; text-align: center; }
body:not(.logged) .nav { display: none; }
#btn-logout { font-weight: 700; }

/* ============ Admin / cadastros (v3) ============ */
.addrow { display: flex; gap: 8px; margin-top: 10px; }
.addrow input { flex: 1; padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; font-size: 14px; }
.addrow .btn.small { flex-shrink: 0; }
.adm-row { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--line); }
.adm-row:last-child { border-bottom: none; }
.adm-row .meta { flex: 1; }
.adm-row .meta b { font-size: 14px; }
.adm-row .meta small { display: block; color: var(--muted); font-size: 12px; }
.adm-row .num { font-weight: 800; background: #f0f4f5; border-radius: 8px; padding: 6px 9px; font-size: 12.5px; min-width: 52px; text-align: center; }
.adm-row.dev.off { opacity: .45; }
.adm-row > small { color: var(--muted); font-size: 12px; text-align: right; }
.chip .x { margin-left: 6px; opacity: .65; font-weight: 800; }

/* filtro de período (estilo BI) */
.presets { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.preset { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 14px; font-size: 13px; font-weight: 700; color: var(--muted); }
.preset.active { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 3px 10px rgba(14,157,110,.25); }
.daterange .field { margin-bottom: 6px; }
.daterange input[type=date] { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 11px; font-size: 14px; background: #fff; color: var(--ink); font-family: inherit; }

/* ===================== v3 · componentes novos ===================== */

/* RF-09 · par mutuamente exclusivo (dano × substituição) */
.excl-pair { display: flex; gap: 8px; margin: 2px 0 10px; }
.excl-pair .chip { flex: 1; text-align: center; }

/* RF-10 · botão de substituir lâmpada (ação de um clique) */
.lamp-btn { margin-top: 4px; }
.lamp-btn.on { background: #e9faf2; border-color: var(--brand); color: var(--brand-dark); }

/* §1 · aplicação química */
.quim-card { margin-top: 12px; }
.quim-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.quim-row .meta small { color: var(--muted); }
.quim-form .field { margin-bottom: 10px; }
.quim-form input[readonly] { background: #f6f8f8; color: var(--muted); font-weight: 700; }

.quim-info {
  background: #f4fbf8; border: 1px solid #d6efe5; border-radius: 12px;
  padding: 10px 12px; margin: 4px 0 12px;
}
.qi-line { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 3px 0; }
.qi-line span { color: var(--muted); }
.qi-line b { text-align: right; }
.qi-warn {
  margin-top: 8px; padding-top: 8px; border-top: 1px dashed #bfe3d4;
  font-size: 12.5px; color: #8a6d1f;
}

/* RF-03 · linha de dispositivo no cadastro, com editar + inativar */
.adm-row.dev { gap: 6px; }
.adm-row.dev .ed { flex: 0 0 auto; }


/* =====================================================================
   v8 · Histórico, correção retroativa e acessos
   ===================================================================== */

/* A barra passou de 3 para 4 itens: com o padding antigo, "Histórico" e
   "Cadastro" encostavam um no outro em tela de 360px. */
.nav a { padding: 4px 10px; }
@media (max-width: 380px) {
  .nav a { padding: 4px 6px; font-size: 10px; }
  .nav a .nic { font-size: 18px; }
}

/* Faixa de correção — âmbar, não verde: quem está aqui mexe em número
   que já saiu em relatório, e a tela tem que dizer isso o tempo todo. */
.edit-banner {
  display: flex; align-items: center; gap: 12px;
  background: #fff8e8; border: 1px solid #f0d9a6; border-left: 4px solid var(--warn);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px;
}
.edit-banner > div { flex: 1; min-width: 0; }
.edit-banner b { font-size: 14px; color: #8a5a00; display: block; }
.edit-banner small { display: block; color: #9a7430; font-size: 12px; margin-top: 2px; }
.edit-banner .btn { flex: 0 0 auto; color: #8a5a00; }

/* ---------- lista do histórico ---------- */
.hist-row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 2px; border-bottom: 1px solid var(--line);
}
.hist-row:last-child { border-bottom: none; }
.hist-main { flex: 1; min-width: 0; }
.hist-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hist-top b { font-size: 14px; }
.hist-data { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.hist-main small { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.hist-acts { display: flex; gap: 6px; flex: 0 0 auto; }
.hist-acts .btn { width: auto; padding: 8px 11px; font-size: 12.5px; }
.hist-acts .btn[disabled] { opacity: .4; cursor: not-allowed; }

/* ---------- etiquetas ---------- */
.tag-edit, .tag-perfil, .tag-off {
  font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px;
  letter-spacing: .2px; white-space: nowrap;
}
.tag-edit   { background: #fef3c7; color: #92660a; }
/* v32 · tipo da O.S. no Histórico */
.tag-tipo { font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
.tag-tipo.t-monitoramento { background: #dcf3ec; color: #0f6b5a; }
.tag-tipo.t-quimica { background: #e0ecfb; color: #1f5a9e; }
.tag-tipo.t-plano { background: #fde8e6; color: #a3342a; }
.tag-perfil { background: #eef2f4; color: var(--muted); }
.tag-perfil.admin { background: #dbeafe; color: var(--info); }
.tag-perfil.cliente { background: #dcf3ec; color: #0f6b5a; }
/* 27/10/2026 · dados da contratante e assinatura do RT no Cadastro */
.cli-doc { margin: 14px 0 4px; border: 1px solid var(--line, #e3e9ec); border-radius: 12px; padding: 8px 12px; }
.cli-doc summary { cursor: pointer; font-weight: 700; padding: 4px 0; }
.cli-doc[open] summary { margin-bottom: 4px; }
.rt-row { align-items: center; gap: 10px; }
.rt-previa { height: 44px; max-width: 140px; object-fit: contain; background: #fff; border: 1px solid var(--line, #e3e9ec); border-radius: 6px; }
/* v30 · vínculo do técnico com os clientes (Cadastro → acessos) */
.vinc-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; max-height: 45vh; overflow-y: auto; }
.vinc-cli { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border: 1px solid var(--line, #e3e9ec); border-radius: 8px; font-size: 14px; cursor: pointer; }
.vinc-cli input { width: 18px; height: 18px; margin: 0; }
/* v17 · validação da O.S. pelo cliente */
.tag-valida { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #fff4d6; color: #8a5a00; }
.tag-valida.ok { background: #dcf3ec; color: #0f6b5a; }
.valida-conf { display: flex; gap: 10px; align-items: flex-start; margin: 14px 4px 0; font-size: 14px; line-height: 1.35; cursor: pointer; }
.valida-conf input { width: 20px; height: 20px; flex: none; margin-top: 1px; accent-color: var(--primary, #0e9d6e); }
.tag-off    { background: #ffe1e8; color: var(--bad); }

/* ---------- acessos ---------- */
.user-row.off { opacity: .5; }
.user-row .meta b { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ---------- trilha de auditoria ---------- */
.log-row { align-items: flex-start; }
.log-row .rt { font-size: 13px; line-height: 1.45; }
.log-row small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 3px; }

/* ---------- seletor de unidade com busca (v9) ---------- */
/* O botão tem que parecer o <select> que ele substituiu: mesma altura,
   mesma borda, mesmo raio — ninguém deve notar a troca, só que agora
   abre uma busca. */
/* Altura igual à do <select> ao lado (48px): os dois dividem a mesma
   .row2, e 9px de diferença entre eles lê como campo desalinhado. */
.picker {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 6px 12px; min-height: 48px; border: 1px solid var(--line); border-radius: 11px;
  background: #fff; color: var(--ink); font-family: inherit; font-size: 15px;
}
.picker:active { background: #f7fafb; }
/* `label.field span` é bloco e cinza — o que serve para o rótulo do campo
   estragaria o conteúdo do botão. Reposto aqui, e só aqui. */
label.field .picker span { display: inline; font-size: inherit; color: inherit; margin: 0; font-weight: inherit; }
.picker .pk-txt { flex: 1; min-width: 0; }
.picker .pk-txt b { display: block; font-size: 14.5px; font-weight: 700; line-height: 1.25;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker .pk-txt b.off { color: var(--muted); font-weight: 600; }
.picker .pk-txt small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.picker .pk-ic { flex: 0 0 auto; opacity: .55; font-size: 15px; }

.pk-list { max-height: 52vh; overflow-y: auto; margin: 0 -4px; }
.pk-row {
  width: 100%; text-align: left; background: #fff; border: none;
  border-bottom: 1px solid var(--line); border-radius: 0; padding: 11px 6px;
  font-family: inherit; color: var(--ink); display: flex; align-items: center; gap: 10px;
}
.pk-row .meta { flex: 1; min-width: 0; }
.pk-row .meta b { display: block; font-size: 14px; line-height: 1.3; }
.pk-row .meta small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
/* Marca a unidade que veio de outra empresa: escolhê-la troca a empresa
   junto, e isso precisa estar visível ANTES do toque. */
.pk-row .meta small.pk-cli { color: var(--brand); font-weight: 700; }
.pk-row.on { background: #e9faf2; }
.pk-row.on .meta b { color: var(--brand-dark); }
.pk-row .pk-ck { flex: 0 0 auto; color: var(--brand); font-weight: 800; opacity: .8; }
.pk-row:active { background: #f0f4f5; }

/* ---------- folha em tela larga ---------- */
/* A folha nasceu para o celular: encostada embaixo, onde o polegar chega.
   Na janela do desktop isso vira um painel colado na borda inferior, longe
   do campo que o abriu e do olho de quem clicou — foi o que o Charles viu
   como "centralização ruim". Acima de 720px ela vira caixa centralizada,
   com os quatro cantos arredondados. O celular não muda em nada. */
@media (min-width: 721px) {
  .sheet-bg { align-items: center; }
  .sheet { border-radius: 20px; max-height: 82vh; animation: fadein .18s ease; }
  .sheet .grab { display: none; }
  .pk-list { max-height: 56vh; }
}
@keyframes fadein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Nome e CNPJ lado a lado só cabem em tela larga: em 414px viram dois
   campos de 180px onde nem o placeholder cabe. No celular, um por linha. */
@media (max-width: 560px) {
  .addrow-uni { flex-wrap: wrap; }
  .addrow-uni input { min-width: 100%; }
}

/* Comprovante de Execução de Serviços (tela cheia, app.js abrirComprovante) */
.comp-bg { position: fixed; inset: 0; z-index: 60; background: #eef2f4; display: flex; flex-direction: column; }
.comp-barra { display: flex; align-items: center; gap: 10px; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--brand-dark, #0c3b34); color: #fff; }
.comp-barra b { flex: 1; font-size: 14px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.comp-doc { flex: 1; width: 100%; border: 0; background: #fff; }

/* Não conformidades (v11 · app.js openNC / fillNCList) */
textarea { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 11px; font-size: 15px;
  background: #fff; color: var(--ink); font-family: inherit; resize: vertical; min-height: 48px; }
.rot-campo { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.rot-campo small { font-weight: 400; }
.nc-riscos .chip { flex: 1; text-align: center; padding: 9px 10px; }
.nc-riscos .chip.on.r-Baixo { border-color: #16a34a; background: #e9faf2; color: #0b6b4b; }
.nc-riscos .chip.on.r-Médio { border-color: #f59e0b; background: #fff6db; color: #8a5a00; }
.nc-riscos .chip.on.r-Alto  { border-color: var(--bad); background: #ffeef2; color: var(--bad); }
.nc-fotos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.nc-fotos:empty { display: none; }
.nc-thumb { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #f0f4f5; }
.nc-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nc-thumb.perdida::after { content: "foto não encontrada"; position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 11px; color: var(--muted); text-align: center; }
.nc-thumb button { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.55); color: #fff; font-size: 16px; line-height: 1; cursor: pointer; }
.nc-foto-btns { display: flex; gap: 8px; margin-top: 8px; }
.nc-foto-btns .btn { flex: 1; cursor: pointer; }
.nc-foto-msg { font-size: 12px; color: var(--muted); margin-top: 6px; }
.nc-foto-msg:empty { display: none; }
.nc-row { cursor: pointer; }
.nc-mini { width: 46px; height: 46px; flex: 0 0 46px; border-radius: 9px; overflow: hidden; background: #f0f4f5;
  display: grid; place-items: center; font-size: 20px; }
.nc-mini img { width: 100%; height: 100%; object-fit: cover; }
.nc-row .meta small { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.nc-risco-tag { display: inline-block; padding: 0 7px; border-radius: 99px; font-size: 11px; font-weight: 700; background: #f0f4f5; }
.nc-risco-tag.r-Baixo { background: #e9faf2; color: #0b6b4b; }
.nc-risco-tag.r-Médio { background: #fff6db; color: #8a5a00; }
.nc-risco-tag.r-Alto  { background: #ffeef2; color: var(--bad); }

/* ---- 22/10/2026 · assinatura do cliente e resumo na O.S. ---- */
.os-resumo { width: 100%; box-sizing: border-box; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; font: inherit; font-size: 14px; resize: vertical; min-height: 76px; }
.os-resumo:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14,157,110,.15); }
.assin-campo .field { margin-bottom: 8px; }
.assin-quadro { position: relative; border: 1.5px dashed #b9c7cd; border-radius: 12px; background: #fff; overflow: hidden; }
.assin-campo.ok .assin-quadro { border-style: solid; border-color: var(--brand); }
.assin-quadro { aspect-ratio: 3 / 1; cursor: pointer; }
.assin-previa { display: block; width: 100%; height: 100%; object-fit: contain; }
.assin-dica { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #8a9ba2; font-size: 14px; pointer-events: none; }
.assin-abrir { width: 100%; margin-top: 8px; }
.assin-acoes { display: flex; gap: 8px; justify-content: space-between; margin-top: 8px; flex-wrap: wrap; }
.assin-acoes .assin-img { width: auto; cursor: pointer; }
/* 25/10/2026 · assinatura em tela cheia */
.assin-tela { position: fixed; inset: 0; z-index: 9999; background: #fff; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.assin-tela-topo { display: flex; align-items: baseline; gap: 10px; padding: 10px 16px; background: var(--brand-dark, #0c3b34); color: #fff; }
.assin-tela-topo span { opacity: .8; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assin-tela-area { position: relative; flex: 1; min-height: 0; }
.assin-tela-area canvas { position: absolute; inset: 0; display: block; touch-action: none; cursor: crosshair; }
.assin-tela-linha { position: absolute; left: 8%; right: 8%; bottom: 26%; border-bottom: 2px solid #c9d4d8; pointer-events: none; }
.assin-tela-dica { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #9aaab0; font-size: 20px; pointer-events: none; }
.assin-tela-acoes { display: flex; gap: 10px; padding: 10px 16px 14px; border-top: 1px solid var(--line); background: #f7faf9; }
.assin-tela-acoes .btn { flex: 1; }

/* 25/10/2026 · luminosa com captura e refil mantido */
.lum-dica { color: var(--muted, #6b8089); font-size: 12.5px; margin: 2px 4px 0; }

/* ---- 22/10/2026 · porta-iscas em lote na aplicação química ---- */
.pi-lote { border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin: 4px 0 12px; background: #f7faf9; }
.pi-faixa, .pi-acoes { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.pi-faixa label { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.pi-faixa input { width: 76px; padding: 7px 8px; border: 1.5px solid var(--line); border-radius: 9px; font: inherit; }
.pi-faixa .btn, .pi-acoes .btn { width: auto; }
.pi-acoes select { flex: 1 1 160px; min-width: 0; padding: 7px 8px; border: 1.5px solid var(--line); border-radius: 9px; font: inherit; background: #fff; }
.pi-lista { max-height: 240px; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 6px; }
.pi-lista label { display: flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 6px 8px; font-size: 13px; min-width: 0; }
.pi-lista label.on { border-color: var(--brand); background: #e9faf2; }
.pi-lista small { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pi-conta { font-size: 13px; margin: 8px 2px; color: var(--brand-dark); }
.pi-baixa { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--ink); }
.pi-baixa input { margin-top: 2px; }
