/* ==========================================================================
   AUDITORIAS E DOSSIER SPDA — DESIGN "INSTRUMENTO DE CAMPO"
   Tema escuro storm-slate · âmbar elétrico · mobile-first
   Tipografia: Barlow Condensed (display) · Barlow (texto) · IBM Plex Mono (dados)
   ========================================================================== */

:root {
  --ink-0: #0b0f15;         /* fundo profundo */
  --ink-1: #10161f;         /* fundo página */
  --ink-2: #171f2b;         /* cartões */
  --ink-3: #1f2937;         /* cartões elevados */
  --linha: #2a3546;
  --texto: #e8edf4;
  --texto-2: #9fadc0;
  --texto-3: #64748b;

  --amber: #f5b32b;         /* âmbar elétrico — ação primária */
  --amber-forte: #ffc94d;
  --azul: #4dc3ff;          /* informação / relatórios */
  --verde: #43d17c;         /* conforme */
  --vermelho: #ff5d5d;      /* não conforme / crítico */
  --roxo: #c792ff;          /* DST */
  --laranja: #ff9a3d;

  --raio: 14px;
  --raio-s: 9px;
  --sombra: 0 6px 24px rgba(0, 0, 0, .45);
  --tap: 52px;              /* alvo de toque mínimo */

  --f-display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --f-texto: 'Barlow', 'Segoe UI', system-ui, sans-serif;
  --f-mono: 'IBM Plex Mono', 'Consolas', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--f-texto);
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(77, 195, 255, .06), transparent 60%),
    radial-gradient(900px 420px at -10% 8%, rgba(245, 179, 43, .05), transparent 55%),
    var(--ink-1);
  color: var(--texto);
  font-size: 15.5px;
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: 88px; /* espaço para a tabbar */
}
/* textura de grão subtil */
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='.6'/%3E%3C/svg%3E");
}
#ads-main { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; padding: 14px 14px 40px; }

h1, h2, h3 { font-family: var(--f-display); font-weight: 600; letter-spacing: .3px; }
.mono { font-family: var(--f-mono); font-size: .92em; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea {
  width: 100%; background: var(--ink-0); color: var(--texto);
  border: 1px solid var(--linha); border-radius: var(--raio-s);
  padding: 12px 12px; font-size: 16px; font-family: inherit;
  min-height: 48px;
}
textarea { min-height: 72px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--amber); outline-offset: 1px; border-color: transparent;
}
input:disabled, textarea:disabled, select:disabled { opacity: .55; }
details summary { cursor: pointer; color: var(--texto-2); padding: 8px 0; font-weight: 600; }

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 10px 20px;
  border: 1px solid transparent; border-radius: var(--raio-s);
  font-family: var(--f-display); font-size: 1.06rem; font-weight: 600; letter-spacing: .4px;
  text-transform: uppercase;
  background: var(--ink-3); color: var(--texto);
  transition: transform .08s, filter .15s;
}
.btn:active { transform: scale(.97); }
.btn.amber { background: var(--amber); color: #17130a; box-shadow: 0 4px 18px rgba(245, 179, 43, .25); }
.btn.amber:hover { background: var(--amber-forte); }
.btn.azul { background: var(--azul); color: #06202e; }
.btn.danger { background: var(--vermelho); color: #2b0808; }
.btn.ghost { background: transparent; border-color: var(--linha); color: var(--texto-2); }
.btn.ghost:hover { color: var(--texto); border-color: var(--texto-3); }
.btn.danger.ghost { color: var(--vermelho); border-color: rgba(255, 93, 93, .4); background: transparent; }
.btn.mini { min-height: 38px; padding: 6px 12px; font-size: .92rem; }
.btn-icon { background: none; border: 0; color: var(--texto-2); font-size: 1.15rem; padding: 8px; }
.btn-volta {
  min-width: 44px; min-height: 44px; border-radius: var(--raio-s);
  background: var(--ink-3); border: 1px solid var(--linha); color: var(--texto);
  font-size: 1.5rem; line-height: 1;
}
.row-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; justify-content: flex-end; }
.row-btns .btn { flex: 1 1 auto; }

/* ---------- hero (dashboard) ---------- */
.hero { position: relative; padding: 26px 6px 18px; overflow: hidden; }
.hero-marca {
  font-family: var(--f-mono); font-size: .72rem; letter-spacing: 4px;
  color: var(--amber); margin-bottom: 6px;
  display: inline-block; text-decoration: none; transition: opacity .15s;
}
.hero-marca:hover { opacity: .75; text-decoration: underline; }
.hero h1 {
  font-size: clamp(2.4rem, 9vw, 3.4rem); line-height: .95; text-transform: uppercase;
  background: linear-gradient(120deg, #fff 30%, var(--amber) 90%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { color: var(--texto-2); margin-top: 8px; font-size: .92rem; }
.hero-risco {
  position: absolute; right: -30px; top: 8px; width: 130px; height: 130px; opacity: .16;
  background:
    conic-gradient(from 200deg at 50% 50%, transparent 70%, var(--amber) 72%, transparent 78%),
    radial-gradient(circle at 50% 50%, transparent 55%, var(--azul) 56%, transparent 58%);
  border-radius: 50%;
  border: 1px dashed var(--linha);
}

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 8px 0 20px; }
@media (min-width: 560px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
.kpi {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  background: var(--ink-2); border: 1px solid var(--linha); border-radius: var(--raio);
  padding: 14px 14px 12px; min-height: 84px; text-align: left;
  position: relative; overflow: hidden;
}
.kpi b { font-family: var(--f-display); font-size: 2rem; line-height: 1; }
.kpi span { color: var(--texto-2); font-size: .8rem; line-height: 1.25; }
.kpi::after {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
}
.kpi.k-amber::after { background: var(--amber); }
.kpi.k-red::after { background: var(--vermelho); }
.kpi.k-blue::after { background: var(--azul); }
.kpi.k-amber b { color: var(--amber); }
.kpi.k-red b { color: var(--vermelho); }
.kpi.k-blue b { color: var(--azul); }
.kpi.zero b { color: var(--texto-3); }
.kpi.zero::after { background: var(--linha); }

/* ---------- blocos e listas ---------- */
.bloco {
  background: var(--ink-2); border: 1px solid var(--linha); border-radius: var(--raio);
  padding: 16px; margin-bottom: 14px; box-shadow: var(--sombra);
}
.bloco h2 {
  font-size: 1.15rem; text-transform: uppercase; letter-spacing: 1px;
  color: var(--texto-2); margin-bottom: 10px;
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
}
.bloco h2 small { color: var(--texto-3); text-transform: none; letter-spacing: 0; }
.vazio { color: var(--texto-3); font-size: .9rem; padding: 8px 2px; }

.linha, .card-linha {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--ink-3); border: 1px solid var(--linha); border-radius: var(--raio-s);
  padding: 12px 14px; margin-bottom: 8px; min-height: var(--tap);
  color: var(--texto); transition: border-color .15s;
}
.linha:hover, .card-linha:hover { border-color: var(--texto-3); }
.linha > div:first-child { flex: 1; min-width: 0; }
.linha b { display: block; font-size: .98rem; }
.linha small, .card-linha small { color: var(--texto-2); font-size: .8rem; display: block; margin-top: 1px; }
.linha-extra { color: var(--texto-2); font-size: .85rem; white-space: nowrap; }
.linha.inativo { opacity: .5; }
.linha.estatica { cursor: default; }
.linha.anomalia.critica {
  border-color: rgba(255, 93, 93, .5);
  background:
    linear-gradient(var(--ink-3), var(--ink-3)) padding-box,
    repeating-linear-gradient(-45deg, var(--vermelho) 0 10px, #3a1515 10px 20px) border-box;
  border: 2px solid transparent;
}
.card-linha .avatar {
  width: 44px; height: 44px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--ink-0); border: 1px solid var(--linha);
  font-family: var(--f-display); font-size: 1.2rem; color: var(--amber);
}
.card-linha .avatar.inst { font-size: 1.3rem; }
.card-linha-txt { flex: 1; min-width: 0; }
.card-linha-txt b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-linha-fim { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.seta { color: var(--texto-3); font-size: 1.4rem; }

/* ---------- chips de estado ---------- */
.chip {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-family: var(--f-display); font-size: .82rem; font-weight: 600;
  letter-spacing: .5px; text-transform: uppercase; white-space: nowrap;
  border: 1px solid transparent;
}
.chip.ok  { background: rgba(67, 209, 124, .14); color: var(--verde); border-color: rgba(67, 209, 124, .4); }
.chip.nc  { background: rgba(255, 154, 61, .13); color: var(--laranja); border-color: rgba(255, 154, 61, .4); }
.chip.rep { background: rgba(255, 93, 93, .14); color: var(--vermelho); border-color: rgba(255, 93, 93, .45); }
.chip.obs { background: rgba(245, 179, 43, .12); color: var(--amber); border-color: rgba(245, 179, 43, .4); }
.chip.inc { background: rgba(159, 173, 192, .12); color: var(--texto-2); border-color: rgba(159, 173, 192, .35); }
.chip.nv  { background: rgba(100, 116, 139, .15); color: var(--texto-3); border-color: rgba(100, 116, 139, .35); }

/* ---------- cabeçalhos de página ---------- */
.pagehead {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 2px 14px;
}
.pagehead h1 { font-size: 1.9rem; text-transform: uppercase; }
.pagehead.ficha { align-items: center; }
.ficha-tit { flex: 1; min-width: 0; }
.ficha-tit h1 { font-size: 1.35rem; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ficha-tit small { color: var(--texto-2); }

.subtabs {
  display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 12px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.subtabs::-webkit-scrollbar { display: none; }
.subtabs button {
  flex-shrink: 0; padding: 9px 16px; min-height: 42px;
  background: transparent; color: var(--texto-2);
  border: 1px solid var(--linha); border-radius: 30px;
  font-family: var(--f-display); font-size: .98rem; letter-spacing: .5px; text-transform: uppercase;
}
.subtabs button.on { background: var(--amber); color: #17130a; border-color: var(--amber); font-weight: 700; }

/* ---------- dashboards e grelhas ---------- */
.dados-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.dados-grid span { display: block; color: var(--texto-3); font-size: .74rem; text-transform: uppercase; letter-spacing: 1px; }
.dados-grid b { font-size: .95rem; font-weight: 600; }
.mini-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mini-kpis > div {
  background: var(--ink-0); border: 1px solid var(--linha); border-radius: var(--raio-s);
  text-align: center; padding: 12px 4px;
}
.mini-kpis b { display: block; font-family: var(--f-display); font-size: 1.7rem; color: var(--amber); }
.mini-kpis span { color: var(--texto-2); font-size: .74rem; text-transform: uppercase; letter-spacing: 1px; }

/* ---------- formulários ---------- */
.campo { display: block; margin-bottom: 12px; }
.campo > span {
  display: block; font-size: .76rem; text-transform: uppercase; letter-spacing: 1px;
  color: var(--texto-3); margin-bottom: 5px; font-weight: 600;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 420px) { .grid2 { grid-template-columns: 1fr; gap: 0; } }
.calc-caixa {
  background: var(--ink-0); border: 1px dashed var(--amber); border-radius: var(--raio-s);
  padding: 12px 14px; margin-bottom: 12px; font-size: .92rem; color: var(--texto-2);
}
.calc-caixa b { color: var(--amber); font-size: 1.05rem; }
.check-linha {
  display: flex; align-items: center; gap: 10px; min-height: 46px;
  font-size: .95rem; border-bottom: 1px solid var(--linha); padding: 4px 2px;
}
.check-linha input { width: 22px; height: 22px; min-height: 0; accent-color: var(--amber); }
.modos-check { display: grid; gap: 4px; }
.modos-check label { display: flex; gap: 8px; align-items: center; font-size: .88rem; color: var(--texto-2); }
.modos-check input { width: 18px; height: 18px; min-height: 0; accent-color: var(--amber); }

/* ---------- bottom sheet ---------- */
#ads-sheet { position: fixed; inset: 0; z-index: 200; display: none; }
#ads-sheet.on { display: block; }
.sheet-back { position: absolute; inset: 0; background: rgba(4, 7, 12, .72); backdrop-filter: blur(3px); }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 92vh;
  background: var(--ink-2); border-radius: 22px 22px 0 0;
  border-top: 1px solid var(--linha);
  display: flex; flex-direction: column;
  animation: sheet-sobe .28s cubic-bezier(.2, .9, .3, 1);
  max-width: 760px; margin: 0 auto;
}
@keyframes sheet-sobe { from { transform: translateY(60px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-grip { width: 44px; height: 5px; background: var(--linha); border-radius: 4px; margin: 10px auto 0; }
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 18px 6px;
}
.sheet-head h3 { font-size: 1.3rem; text-transform: uppercase; letter-spacing: .5px; }
.sheet-body { overflow-y: auto; padding: 6px 18px calc(20px + env(safe-area-inset-bottom)); }
.sheet-sub { font-family: var(--f-display); text-transform: uppercase; color: var(--texto-3); letter-spacing: 1px; margin: 12px 0 6px; }
.conf-msg { padding: 8px 2px 4px; }

/* ---------- badge de sincronização ---------- */
.sync-badge {
  position: fixed; top: 10px; right: 10px; z-index: 95;
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 20px; border: 1px solid var(--linha);
  background: rgba(16, 22, 31, .88); backdrop-filter: blur(8px);
  color: var(--texto-2); font-size: .74rem; font-weight: 600;
  box-shadow: var(--sombra);
}
.sync-badge.sb-anon { color: var(--texto-2); border-color: var(--linha); }
.sync-badge.sb-ok { color: var(--verde); border-color: rgba(67, 209, 124, .4); }
.sync-badge.sb-syncing { color: var(--azul); border-color: rgba(77, 195, 255, .4); animation: sb-pulsa 1.2s ease-in-out infinite; }
.sync-badge.sb-conflict { color: var(--amber); border-color: rgba(255, 185, 66, .55); }
.sync-badge.sb-error { color: var(--vermelho); border-color: rgba(255, 93, 93, .45); }
.sync-conflito { margin: 10px 0; padding: 12px; border: 1px solid rgba(255, 185, 66, .45); border-radius: 10px; background: rgba(255, 185, 66, .08); }
.sync-conflito small { display: block; margin-top: 4px; color: var(--texto-2); }
.sync-conflito p { margin: 8px 0; font-size: .88rem; }
@keyframes sb-pulsa { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

/* ---------- toast ---------- */
.ads-toast {
  position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 24px);
  background: var(--ink-3); color: var(--texto); border: 1px solid var(--linha);
  border-left: 4px solid var(--verde);
  border-radius: var(--raio-s); padding: 12px 18px; font-size: .92rem;
  box-shadow: var(--sombra); z-index: 300; opacity: 0; transition: all .3s;
  max-width: min(92vw, 480px);
}
.ads-toast.on { opacity: 1; transform: translate(-50%, 0); }
.ads-toast.error { border-left-color: var(--vermelho); }
.ads-toast.warn { border-left-color: var(--amber); }

/* ---------- tabbar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
  display: flex; justify-content: space-around;
  background: rgba(11, 15, 21, .92); backdrop-filter: blur(12px);
  border-top: 1px solid var(--linha);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tabbar button {
  flex: 1; max-width: 160px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: 0; color: var(--texto-3); padding: 6px 2px; min-height: 54px;
  font-family: var(--f-display); font-size: .78rem; letter-spacing: 1px; text-transform: uppercase;
}
.tabbar button .tb-ico { font-size: 1.3rem; line-height: 1; }
.tabbar button.on { color: var(--amber); }
.tabbar button.on .tb-ico { filter: drop-shadow(0 0 8px rgba(245, 179, 43, .6)); }

/* ---------- FAB ---------- */
.fab {
  position: fixed; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 90;
  min-height: 54px; padding: 12px 22px;
  background: var(--amber); color: #17130a; border: 0; border-radius: 30px;
  font-family: var(--f-display); font-size: 1.05rem; font-weight: 700;
  letter-spacing: .5px; text-transform: uppercase;
  box-shadow: 0 8px 26px rgba(245, 179, 43, .4);
  animation: fab-pulsa 3.2s ease-in-out infinite;
}
@keyframes fab-pulsa {
  0%, 100% { box-shadow: 0 8px 26px rgba(245, 179, 43, .35); }
  50% { box-shadow: 0 8px 34px rgba(245, 179, 43, .6); }
}

/* ---------- tipos de intervenção (sheet) ---------- */
.tipos-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
@media (max-width: 420px) { .tipos-grid { grid-template-columns: 1fr; } }
.tipo-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
  background: var(--ink-3); border: 1px solid var(--linha); border-radius: var(--raio);
  padding: 14px; min-height: 104px; color: var(--texto); transition: border-color .15s;
}
.tipo-card:hover { border-color: var(--amber); }
.tipo-card .tipo-icon { font-size: 1.5rem; }
.tipo-card b { font-family: var(--f-display); font-size: 1.02rem; line-height: 1.15; }
.tipo-card small { color: var(--texto-3); font-size: .76rem; line-height: 1.3; }

/* ---------- runner da checklist ---------- */
.runner-head {
  display: flex; align-items: center; gap: 12px; padding: 12px 2px;
}
.runner-tit { flex: 1; min-width: 0; }
.runner-tit b { font-family: var(--f-display); font-size: 1.1rem; display: block; }
.runner-tit small { color: var(--texto-2); }
.progresso {
  height: 6px; background: var(--ink-3); border-radius: 4px; overflow: hidden; margin-bottom: 10px;
}
.progresso div {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--amber), var(--amber-forte));
  box-shadow: 0 0 12px rgba(245, 179, 43, .5);
  transition: width .35s;
}
.sec-rail {
  display: flex; gap: 6px; overflow-x: auto; padding-bottom: 12px; scrollbar-width: none;
}
.sec-rail::-webkit-scrollbar { display: none; }
.sec-rail button {
  flex-shrink: 0; width: 42px; height: 42px; border-radius: 50%;
  background: var(--ink-3); border: 1px solid var(--linha); color: var(--texto-2);
  font-family: var(--f-display); font-weight: 700; font-size: 1rem;
}
.sec-rail button.done { border-color: var(--verde); color: var(--verde); }
.sec-rail button.on { background: var(--amber); color: #17130a; border-color: var(--amber); }

.pergunta-card {
  background: var(--ink-2); border: 1px solid var(--linha); border-radius: var(--raio);
  padding: 18px 16px; box-shadow: var(--sombra);
  animation: card-entra .25s ease-out;
}
@keyframes card-entra { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
.pc-sec {
  font-family: var(--f-mono); font-size: .74rem; letter-spacing: 1px; text-transform: uppercase;
  color: var(--texto-3); margin-bottom: 8px; display: flex; justify-content: space-between;
}
.pergunta-card h2 { font-size: 1.4rem; line-height: 1.2; margin-bottom: 10px; font-weight: 600; }
.pc-ajuda { background: var(--ink-0); border-radius: var(--raio-s); padding: 4px 12px; margin-bottom: 10px; }
.pc-ajuda p { color: var(--texto-2); font-size: .9rem; padding-bottom: 10px; }
.pc-instr, .pc-evid { font-size: .88rem; color: var(--texto-2); margin-bottom: 6px; }
.pc-instr b, .pc-evid b { color: var(--texto); }
.pc-flags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; }
.flag {
  font-family: var(--f-mono); font-size: .7rem; letter-spacing: .5px;
  background: var(--ink-0); border: 1px solid var(--linha); border-radius: 5px;
  padding: 3px 8px; color: var(--texto-2);
}
.flag.rep { color: var(--vermelho); border-color: rgba(255, 93, 93, .5); }
.flag.grav-critica { color: var(--vermelho); }
.flag.grav-maior { color: var(--laranja); }

.pc-anterior {
  background: rgba(77, 195, 255, .07); border: 1px solid rgba(77, 195, 255, .25);
  border-radius: var(--raio-s); padding: 8px 12px; margin-bottom: 12px;
  font-size: .85rem; color: var(--texto-2);
}
.pc-anterior small { display: block; color: var(--texto-3); margin-top: 2px; }
.pc-anterior .ant-ok { color: var(--verde); }
.pc-anterior .ant-nc { color: var(--vermelho); }
.pc-anterior .ant-nx { color: var(--amber); }
.pc-anterior .ant-co { color: var(--azul); }
.pc-anterior .ant-na, .pc-anterior .ant-nv { color: var(--texto-2); }

.resp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.resp {
  min-height: 58px; border-radius: var(--raio-s); border: 1px solid var(--linha);
  background: var(--ink-3); color: var(--texto);
  font-family: var(--f-display); font-size: 1.05rem; font-weight: 600; letter-spacing: .4px;
  text-transform: uppercase; transition: all .12s;
}
.resp:active { transform: scale(.96); }
.resp.ok.on  { background: rgba(67, 209, 124, .18); border-color: var(--verde); color: var(--verde); box-shadow: 0 0 16px rgba(67, 209, 124, .25); }
.resp.nc.on  { background: rgba(255, 93, 93, .16); border-color: var(--vermelho); color: var(--vermelho); box-shadow: 0 0 16px rgba(255, 93, 93, .3); }
.resp.na.on, .resp.nv.on { background: rgba(159, 173, 192, .16); border-color: var(--texto-2); color: var(--texto); }
.resp.nx.on  { background: rgba(245, 179, 43, .14); border-color: var(--amber); color: var(--amber); }
.resp.co.on  { background: rgba(77, 195, 255, .14); border-color: var(--azul); color: var(--azul); }

.fotos-mini { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.foto-thumb { position: relative; width: 76px; height: 76px; border-radius: var(--raio-s); overflow: hidden; border: 1px solid var(--linha); }
.foto-thumb img { width: 100%; height: 100%; object-fit: cover; }
.foto-thumb button {
  position: absolute; top: 2px; right: 2px; width: 24px; height: 24px;
  border-radius: 50%; border: 0; background: rgba(0, 0, 0, .65); color: #fff; font-size: .8rem;
}

.runner-nav {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px; position: sticky; bottom: calc(76px + env(safe-area-inset-bottom));
  background: rgba(16, 22, 31, .94); backdrop-filter: blur(10px);
  border: 1px solid var(--linha); border-radius: var(--raio);
  margin-top: 14px; box-shadow: var(--sombra);
}
.runner-nav .mono { color: var(--texto-3); }
.runner-nav .btn { flex: 1; }

/* ---------- resumo final ---------- */
.resumo-final details { margin: 4px 0; }
.resumo-dial {
  text-align: center; padding: 22px 14px; border-radius: var(--raio);
  margin-bottom: 14px; border: 1px solid var(--linha);
}
.resumo-dial b { display: block; font-family: var(--f-display); font-size: 2rem; text-transform: uppercase; letter-spacing: 1px; }
.resumo-dial span { color: var(--texto-3); font-size: .78rem; text-transform: uppercase; letter-spacing: 2px; }
.resumo-ok  { background: rgba(67, 209, 124, .08); border-color: rgba(67, 209, 124, .4); }
.resumo-ok b { color: var(--verde); }
.resumo-obs { background: rgba(245, 179, 43, .08); border-color: rgba(245, 179, 43, .4); }
.resumo-obs b { color: var(--amber); }
.resumo-nc  { background: rgba(255, 154, 61, .08); border-color: rgba(255, 154, 61, .4); }
.resumo-nc b { color: var(--laranja); }
.resumo-rep {
  border: 2px solid transparent;
  background:
    linear-gradient(var(--ink-2), var(--ink-2)) padding-box,
    repeating-linear-gradient(-45deg, var(--vermelho) 0 12px, #351111 12px 24px) border-box;
}
.resumo-rep b { color: var(--vermelho); }
.resumo-inc b { color: var(--texto-2); }
.resumo-linhas { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.resumo-linhas .rl {
  background: var(--ink-0); border: 1px solid var(--linha); border-radius: var(--raio-s);
  padding: 10px 12px; font-size: .82rem; color: var(--texto-2);
}
.resumo-linhas .rl b { font-family: var(--f-display); font-size: 1.3rem; color: var(--texto); margin-right: 6px; }
.resumo-linhas .rl.mau { border-color: rgba(255, 93, 93, .5); }
.resumo-linhas .rl.mau b { color: var(--vermelho); }
.resumo-linhas .rl.aviso { border-color: rgba(245, 179, 43, .45); }
.resumo-linhas .rl.aviso b { color: var(--amber); }
.mini-lista { padding-left: 18px; color: var(--texto-2); font-size: .88rem; }
.mini-lista li { margin: 4px 0; }
.proxima-acao {
  margin-top: 12px; padding: 12px; border-radius: var(--raio-s);
  background: rgba(77, 195, 255, .07); border: 1px solid rgba(77, 195, 255, .3);
  font-size: .9rem;
}
.aviso-inline { color: var(--laranja); font-size: .85rem; margin: 8px 0; }
.final-btns { display: flex; }

/* ---------- mapa ---------- */
.mapa-bloco { padding: 12px; }
.mapa-modo {
  display: flex; gap: 6px; margin-bottom: 10px;
  background: var(--ink-0); border: 1px solid var(--linha); border-radius: 30px; padding: 4px;
}
.mapa-modo button {
  flex: 1; min-height: 42px; border: 0; border-radius: 26px;
  background: transparent; color: var(--texto-2);
  font-family: var(--f-display); font-size: 1rem; letter-spacing: .5px; text-transform: uppercase;
}
.mapa-modo button.on { background: var(--amber); color: #17130a; font-weight: 700; }
.mapa-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.mapa-wrap { border-radius: var(--raio-s); overflow: hidden; border: 1px solid var(--linha); touch-action: none; }
.mapa-wrap canvas { display: block; }
#mapa-geo { width: 100%; height: min(62vh, 520px); min-height: 320px; background: var(--ink-0); }
#mapa-geo .leaflet-control-attribution { font-size: 9px; }
.geo-pin-wrap { background: none; border: none; }
.geo-pin {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--pin, var(--amber)); border: 2px solid rgba(0, 0, 0, .55);
  display: flex; align-items: center; justify-content: center;
  font: 700 14px system-ui; color: #10161f;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .5);
}
.geo-pin-lbl {
  margin-top: 2px; text-align: center;
  font: 700 10px system-ui; color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .9); white-space: nowrap;
}
.geo-pin-temp {
  background: var(--azul); color: #06202e;
  animation: pin-pulsa 1.4s ease-in-out infinite;
}
@keyframes pin-pulsa {
  0%, 100% { box-shadow: 0 0 0 0 rgba(77, 195, 255, .6); }
  50% { box-shadow: 0 0 0 12px rgba(77, 195, 255, 0); }
}
.geo-pesquisa { display: flex; gap: 8px; margin-bottom: 10px; }
.geo-pesquisa input { flex: 1; }
.geo-pesquisa .btn { min-width: 52px; }
#geo-pesq-res .linha small {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: block; max-width: 100%;
}
.mapa-camadas { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.camada {
  padding: 7px 12px; min-height: 38px; border-radius: 20px;
  border: 1px solid var(--linha); background: transparent; color: var(--texto-3);
  font-size: .8rem;
}
.camada.on { border-color: var(--amber); color: var(--texto); background: rgba(245, 179, 43, .08); }
.mapa-dica { color: var(--texto-3); font-size: .78rem; margin-top: 10px; }
.sep-global { margin-bottom: 12px; font-size: .95rem; display: flex; gap: 10px; align-items: center; }

/* ---------- identidade da empresa (administração) ---------- */
.logo-linha { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.logo-preview {
  width: 110px; height: 72px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--linha); border-radius: var(--raio-s);
  overflow: hidden;
}
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-preview span { color: #94a3b8; font-size: .72rem; }
.logo-btns { display: flex; flex-direction: column; gap: 8px; }
.cor-input {
  width: 64px; height: 44px; padding: 4px; min-height: 0;
  border: 1px solid var(--linha); border-radius: var(--raio-s); background: var(--ink-0);
  cursor: pointer;
}

/* ---------- administração ---------- */
.aviso-restrito { border-color: rgba(245, 179, 43, .4); }
.aviso-restrito b { display: block; color: var(--amber); font-family: var(--f-display); font-size: 1.05rem; margin-bottom: 6px; }
.aviso-restrito .btn { margin-top: 6px; }
.admin-sec { margin: 18px 0 8px; color: var(--texto-2); text-transform: uppercase; letter-spacing: 1px; font-size: 1rem; }
.nota-admin { color: var(--texto-3); font-size: .85rem; margin-bottom: 12px; }
.tab-per { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.tab-per th, .tab-per td { border: 1px solid var(--linha); padding: 8px; text-align: center; font-size: .9rem; }
.tab-per input { text-align: center; min-height: 42px; }
.norm-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.norm-head h2 { margin-bottom: 0; }
.norm-progresso {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; margin: 12px 0; border: 1px solid var(--linha);
  border-radius: var(--raio-s); background: var(--ink-1); color: var(--texto-2);
}
.norm-progresso b { color: var(--amber); font-family: var(--f-mono); }
.norm-progresso small { width: 100%; color: var(--texto-3); }
.norm-mapeamentos { display: grid; gap: 10px; }
.norm-item { padding: 12px; border: 1px solid var(--linha); border-radius: var(--raio-s); background: var(--ink-1); }
.norm-item.completo { border-left: 3px solid var(--verde); }
.norm-item-titulo { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.norm-item-titulo b { color: var(--amber); flex: 0 0 40px; }
.norm-item-titulo span { color: var(--texto-2); font-size: .9rem; }
.norm-check, .norm-declaracao { display: flex; gap: 9px; align-items: flex-start; color: var(--texto-2); font-size: .86rem; }
.norm-check input, .norm-declaracao input { width: auto; min-height: 0; margin-top: 2px; }
.norm-declaracao { padding: 12px; margin: 14px 0; border: 1px solid rgba(245, 179, 43, .4); border-radius: var(--raio-s); }
.norm-assinatura .logo-preview { width: 180px; height: 90px; }
.norm-historico { display: grid; gap: 8px; }
.norm-evento { cursor: default; }
.norm-evento .chip { flex-shrink: 0; }
.norm-erro { padding: 10px 12px; border-left: 3px solid var(--vermelho); background: rgba(255, 93, 93, .08); color: var(--vermelho); }
@media (max-width: 700px) {
  .norm-item .grid-2 { grid-template-columns: 1fr; }
  .norm-evento { align-items: flex-start; }
}

/* ==========================================================================
   RELATÓRIO (impressão)
   ========================================================================== */
#ads-print { display: none; }
body.ads-printing #ads-print { display: block; }
.rl-status-doc {
  padding: 8px 12px; margin-bottom: 14px; border: 2px solid #9b1c1c;
  color: #9b1c1c; background: #fff0f0; text-align: center;
  font: 700 .82rem/1.2 var(--f-mono); letter-spacing: 1.2px;
}
.rl-validado .rl-status-doc { border-color: #14713f; color: #14713f; background: #e9f9ef; }
.rl-alerta { border-left: 3px solid #a16207; padding-left: 10px; background: #fff8e1; }
.rl-aprovacao-normativa {
  display: flex; justify-content: space-between; align-items: center; gap: 18px;
  padding: 10px 12px; margin: 8px 0 14px; border: 1px solid #14713f; background: #eef9f2;
}
.rl-aprovacao-normativa img { width: 145px; height: 58px; object-fit: contain; background: #fff; }

@page { size: A4; margin: 14mm; }

@media print {
  body { background: #fff; padding: 0; }
  body.ads-printing > *:not(#ads-print) { display: none !important; }
  .sync-badge { display: none !important; }
  body::before { display: none; }

  .rl-doc {
    font-family: 'Segoe UI', Arial, sans-serif; color: #1a2330; font-size: 10.5pt; line-height: 1.45;
  }
  .rl-status-doc {
    border: 1.5pt solid #9b1c1c; color: #9b1c1c; background: #fff0f0;
    padding: 5pt; margin-bottom: 8pt; font: 700 9pt/1.2 'Consolas', monospace;
    text-align: center; letter-spacing: 1pt;
  }
  .rl-validado .rl-status-doc { border-color: #14713f; color: #14713f; background: #e9f9ef; }
  .rl-capa {
    min-height: 88vh; display: flex; flex-direction: column; justify-content: center;
    text-align: center; page-break-after: always; position: relative;
    border: 3px solid var(--rl-primary, #16324f); padding: 40px; border-radius: 6px;
  }
  .rl-capa-logo { max-height: 26mm; max-width: 70mm; object-fit: contain; margin: 0 auto 10px; }
  .rl-capa-marca { font-size: 10pt; letter-spacing: 4px; color: #b07f16; text-transform: uppercase; }
  .rl-capa-raio { font-size: 42pt; margin: 12px 0; }
  .rl-capa h1 { font-size: 22pt; color: var(--rl-primary, #16324f); margin: 6px 0 4px; }
  .rl-capa-empresa {
    margin-top: 34px; padding-top: 10px; border-top: 1px solid #c6d0dc;
    font-size: 8.5pt; color: #5a6a7a; line-height: 1.6;
  }
  .rl-capa-inst { font-size: 15pt; color: #33475e; margin-bottom: 26px; }
  .rl-capa-meta { display: inline-block; text-align: left; margin: 0 auto; font-size: 10.5pt; }
  .rl-capa-meta div { padding: 3px 0; }
  .rl-capa-meta b { display: inline-block; width: 150px; color: #5a6a7a; font-weight: 600; }
  .rl-capa-resultado {
    margin: 30px auto 0; padding: 10px 34px; border-radius: 30px;
    font-size: 14pt; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
    border: 2px solid #999;
  }
  .rl-res-ok  { color: #14713f; border-color: #14713f !important; background: #e9f9ef; }
  .rl-res-obs { color: #8a6100; border-color: #b07f16 !important; background: #fdf4dc; }
  .rl-res-nc  { color: #a04a00; border-color: #c96a10 !important; background: #fdeadb; }
  .rl-res-rep { color: #9b1c1c; border-color: #9b1c1c !important; background: #fde4e4; }
  .rl-res-inc { color: #4a5568; border-color: #4a5568 !important; background: #eef1f5; }

  .rl-h2 {
    font-size: 13pt; color: var(--rl-primary, #16324f); border-bottom: 2px solid #b07f16;
    margin: 18pt 0 8pt; padding-bottom: 3pt; page-break-after: avoid;
  }
  .rl-h2 span { color: #b07f16; }
  .rl-h3 { font-size: 11pt; color: #33475e; margin: 12pt 0 6pt; page-break-after: avoid; }

  .rl-tab { width: 100%; border-collapse: collapse; margin: 6pt 0 10pt; page-break-inside: auto; }
  .rl-tab th, .rl-tab td { border: 1px solid #c6d0dc; padding: 5pt 7pt; text-align: left; vertical-align: top; font-size: 9.5pt; }
  .rl-tab th { background: var(--rl-primary, #16324f); color: #fff; font-weight: 600; }
  .rl-tab tr { page-break-inside: avoid; }
  .rl-trace { page-break-inside: avoid; }
  .rl-tab tr:nth-child(even) td { background: #f4f7fa; }
  .rl-tab-id th { width: 130px; background: #eef2f7; color: #33475e; }

  .rl-obs { color: #5a6a7a; font-size: 8.5pt; margin-top: 2pt; }
  .rl-est { font-weight: 700; white-space: nowrap; }
  .rl-est-ok { color: #14713f; }
  .rl-est-nc { color: #9b1c1c; }
  .rl-est-na, .rl-est-nv { color: #64748b; }
  .rl-est-nx { color: #8a6100; }
  .rl-est-co { color: #0e5f8a; }
  .rl-vazio { color: #64748b; font-style: italic; }
  .rl-nota { font-size: 8.5pt; color: #5a6a7a; }
  .rl-lista { padding-left: 18pt; margin: 4pt 0 8pt; }
  .rl-lista li { margin: 3pt 0; }
  .rl-docline { display: flex; justify-content: space-between; border-bottom: 1px solid #e2e8f0; padding: 4pt 0; }
  .rl-planta { max-width: 100%; border: 1px solid #c6d0dc; border-radius: 4px; margin: 6pt 0; }

  .rl-fotos { display: grid; grid-template-columns: 1fr 1fr; gap: 10pt; }
  .rl-fotos figure { page-break-inside: avoid; margin: 0; }
  .rl-fotos img { width: 100%; border: 1px solid #c6d0dc; border-radius: 4px; }
  .rl-fotos figcaption { font-size: 8.5pt; color: #5a6a7a; margin-top: 2pt; }

  .rl-resultado-final {
    text-align: center; padding: 14pt; border: 2px solid; border-radius: 8px; margin: 8pt 0;
  }
  .rl-resultado-final b { display: block; font-size: 16pt; text-transform: uppercase; }
  .rl-resultado-final span { font-size: 9pt; }
  .rl-declaracao { border: 1px solid #c6d0dc; background: #f8fafc; padding: 10pt; border-radius: 4px; font-style: italic; }
  .rl-assinaturas { display: flex; gap: 40pt; margin-top: 50pt; }
  .rl-assinaturas > div { flex: 1; border-top: 1px solid #33475e; text-align: center; padding-top: 5pt; font-size: 9pt; color: #5a6a7a; }
  .rl-rodape { margin-top: 24pt; padding-top: 6pt; border-top: 1px solid #c6d0dc; font-size: 8pt; color: #8a97a5; text-align: center; }
  .rl-rodape-empresa { font-weight: 600; color: #5a6a7a; margin-bottom: 2pt; }
  .rl-rodape-estado { font-weight: 700; color: #5a6a7a; margin-bottom: 2pt; }
  .mono { font-family: 'Consolas', monospace; }
}

/* vista de pré-visualização do relatório no ecrã (fallback) */
body.ads-printing #ads-print { background: #fff; color: #1a2330; padding: 20px; }

/* ---------- acessibilidade ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
