/* Laudos — casca no padrão Janus (sidebar marinho, topbar azul, cards arredondados) sobre Bootstrap 5.
   Componentes próprios (chips, checklist, abas, fotos, medidas) mantidos e responsivos. */
:root {
  --azul: #0d6efd; --marinho: #001d3d; --ciano: #0dcaf0;
  --bg: #f1f4f8; --paper: #ffffff; --bg-2: #e9eef5;
  --ink: #212529; --ink-2: #5b6470; --ink-3: #8a94a0;
  --line: #dde3ea; --line-2: #c4ccd6;
  --accent: #0d6efd; --accent-soft: #e2edff;
  --ok: #198754; --ok-soft: #dcf3e6; --warn: #b8860b; --warn-soft: #fff3cd; --bad: #dc3545; --bad-soft: #f8d7da;
  --ember: #d9480f;
  --sidebar-bg: #001d3d; --sidebar-w: 250px; --topbar-bg: #0d6efd; --topbar-h: 56px;
  --sombra: 0 .35rem 1rem rgba(0, 29, 61, .08);
  --mono: Consolas, "Courier New", monospace;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #12161c; --paper: #1b2129; --bg-2: #232b35;
  --ink: #e6e9ee; --ink-2: #aeb6c2; --ink-3: #7f8996;
  --line: #2d3641; --line-2: #414c5a;
  --accent: #5b9dff; --accent-soft: #1b2c47;
  --ok: #4cc384; --ok-soft: #173a2a; --warn: #e0b341; --warn-soft: #3a3115; --bad: #ef6b6b; --bad-soft: #3d2022;
  --ember: #f0783c;
  --sidebar-bg: #0a0f16; --topbar-bg: #15202f;
  --sombra: 0 .35rem 1rem rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; }
html { font-size: 15.5px; }
body { margin: 0; background: var(--bg); color: var(--ink); min-height: 100vh; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.15; }
h1 { font-size: 1.45rem; font-weight: 700; margin: 0 0 .25rem; } h2 { font-size: 1.15rem; font-weight: 600; margin: 0 0 .6rem; } h3 { font-size: 1rem; font-weight: 600; margin: 0 0 .5rem; }
.muted { color: var(--ink-2); } .small { font-size: .85rem; } .mono { font-family: var(--mono); }

/* ---------- sidebar ---------- */
.sidebar { width: var(--sidebar-w); background: var(--sidebar-bg); color: #fff; position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; overflow-y: auto; z-index: 1030; }
.tabela-rolagem { overflow-x: auto; }
table.pmta-tab td, table.pmta-tab th { padding: 4px 4px; white-space: nowrap; font-size: .85rem; vertical-align: middle; }
table.pmta-tab input, table.pmta-tab select { padding: 4px 6px; font-size: .85rem; min-width: 70px; }
table.pmta-res td.gov, table.pmta-res tr.gov td { background: rgba(255,193,7,.18); font-weight: 600; }
td.acoes.icones { white-space: nowrap; } td.acoes.icones .mini { width: 34px; height: 30px; padding: 0; justify-content: center; margin-right: 4px; }
.badge.pri-alta { background:#f8d7da; color:#842029; } .badge.pri-media { background:#fff3cd; color:#664d03; } .badge.pri-baixa { background:#d1e7dd; color:#0f5132; }
.sidebar .marca { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 20px 16px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar .marca img { max-height: 84px; max-width: 150px; background: #fff; border-radius: 10px; padding: 6px 10px; }
.sidebar .marca i { font-size: 2.4rem; color: var(--ciano); }
.sidebar .marca strong { display: block; font-size: 1.15rem; letter-spacing: .02em; }
.sidebar .marca small { display: block; font-size: .74rem; opacity: .75; line-height: 1.2; }
.sidebar nav { padding: 10px 0; flex: 1; }
.sidebar nav a { color: #fff; padding: 11px 20px; display: flex; align-items: center; gap: 12px; text-decoration: none; transition: background .2s; font-size: .95rem; }
.sidebar nav a:hover, .sidebar nav a.active { background: var(--azul); }
.sidebar nav a i { width: 20px; text-align: center; font-size: 1.05rem; }
/* 'Sair' é POST (logout-CSRF): botão vestido de item de menu */
.sidebar nav .link-sair { color: #fff; padding: 11px 20px; display: flex; align-items: center; gap: 12px; background: none; border: 0; width: 100%; text-align: left; font: inherit; font-size: .95rem; cursor: pointer; }
.sidebar nav .link-sair:hover { background: var(--azul); }
.sidebar nav .link-sair i { width: 20px; text-align: center; font-size: 1.05rem; }
.sidebar nav .grupo { padding: 14px 20px 4px; font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; opacity: .55; }
.sidebar .rodape { text-align: center; font-size: .72rem; opacity: .75; padding: 12px; border-top: 1px solid var(--azul); }
.sidebar-offcanvas { width: var(--sidebar-w) !important; border: 0; }
.sidebar-offcanvas .sidebar { position: static; height: 100%; width: 100%; }

/* ---------- topbar + conteúdo ---------- */
.content { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { background: var(--topbar-bg); color: #fff; height: var(--topbar-h); padding: 0 18px; display: flex; align-items: center; gap: 12px; box-shadow: 0 2px 6px rgba(0,0,0,.12); position: sticky; top: 0; z-index: 1020; }
.topbar .username { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .95rem; }
.topbar .username i { font-size: 1.35rem; }
.btn-topbar { color: #fff; border: 1px solid rgba(255,255,255,.35); width: 36px; height: 36px; padding: 0; border-radius: 50%; display: inline-grid; place-items: center; }
.btn-topbar:hover { background: rgba(255,255,255,.15); color: #fff; }
#btn-tema .sol { display: none; } html[data-theme="dark"] #btn-tema .sol { display: block; } html[data-theme="dark"] #btn-tema .lua { display: none; }
.wrap { padding: 22px 24px 80px; max-width: 1240px; width: 100%; min-width: 0; }   /* tabela larga rola dentro do .tbl, não estica a página */
.barra { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.publico { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: linear-gradient(135deg, var(--marinho) 0%, var(--azul) 100%); }
@media (max-width: 991.98px) {
  .content { margin-left: 0; }
  .wrap { padding: 16px 14px 90px; }
  html { font-size: 16px; }
}

/* ---------- cards ---------- */
.card { border: 1px solid var(--line); border-radius: 1rem; box-shadow: var(--sombra); padding: 1.35rem 1.5rem; margin-bottom: 1.25rem; background: var(--paper); color: var(--ink); display: block; }
.card h2 { display: flex; align-items: center; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.card h2 i { color: var(--accent); }
@media (max-width: 575.98px) { .card { padding: 1rem 1rem; border-radius: .8rem; } }

/* ---------- tabelas ---------- */
.tbl { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--ink); }
thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); font-weight: 600; background: var(--bg-2); border-bottom: 1px solid var(--line-2); }
tr.link { cursor: pointer; } tr.link:hover { background: var(--accent-soft); }

/* ---------- badges de estado ---------- */
.badge-estado, .badge.b-rascunho, .badge.b-revisao, .badge.b-aprovado, .badge.b-emitido, .badge.b-vencido, .badge.b-ok, .badge.b-warn,
.b-rascunho, .b-revisao, .b-aprovado, .b-emitido, .b-vencido, .b-ok, .b-warn { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .76rem; font-weight: 600; white-space: nowrap; }
.b-rascunho { background: var(--bg-2); color: var(--ink-2); }
.b-revisao { background: var(--warn-soft); color: var(--warn); }
.b-aprovado { background: var(--accent-soft); color: var(--accent); }
.b-emitido { background: var(--ok-soft); color: var(--ok); }
.b-vencido { background: var(--bad-soft); color: var(--bad); }
.b-ok { background: var(--ok-soft); color: var(--ok); }
.b-warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- formulários ---------- */
label, .lbl { display: block; font-size: .8rem; color: var(--ink-2); margin-bottom: 4px; font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; font: inherit; font-size: 1rem; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: .55rem; background: var(--paper); color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 .2rem rgba(13,110,253,.2); }
textarea { min-height: 90px; resize: vertical; }
.campo { margin-bottom: 12px; }
/* campo com seletores dos dois lados (tipo de conexão + medida + mm/pol): o input estica, os seletores não; ocupa 2 colunas da .grid
   quando cabe — numa coluna de 220 px o input ficava com 40 px e parecia não aceitar edição (Djalma, print 03/10/2026) */
.campo-medida > div { display: flex; gap: 6px; }
.campo-medida > div > input[type=text] { flex: 1 1 60px; min-width: 60px; }
.campo-medida > div > select { flex: 0 0 auto; width: auto; padding-left: 8px; padding-right: 8px; }
@media (min-width: 560px) { .grid > .campo-medida { grid-column: span 2; } }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-3 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.acoes { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline { display: inline; }

/* botões: <button> puro = primário; .sec = contorno; .ok/.warn/.bad = estados; .mini = pequeno */
button, .btn { font: inherit; font-size: .93rem; font-weight: 600; padding: 9px 16px; border-radius: .6rem; border: 1px solid var(--azul); background: var(--azul); color: #fff; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; line-height: 1.2; transition: filter .15s, background .15s; }
button:hover, .btn:hover { filter: brightness(.93); color: #fff; }
.btn.sec, button.sec { background: var(--paper); color: var(--accent); border-color: var(--accent); }
.btn.sec:hover, button.sec:hover { background: var(--accent-soft); color: var(--accent); filter: none; }
.btn.ok, button.ok { background: var(--ok); border-color: var(--ok); }
.btn.warn, button.warn { background: var(--paper); color: var(--warn); border-color: var(--warn); } .btn.warn:hover, button.warn:hover { color: var(--warn); }
.btn.bad, button.bad { background: var(--paper); color: var(--bad); border-color: var(--bad); } .btn.bad:hover, button.bad:hover { color: var(--bad); }
.btn.mini, button.mini { padding: 4px 10px; min-height: 30px; font-size: .8rem; border-radius: .45rem; }
button:disabled { opacity: .5; cursor: default; }
.btn-close { background-color: transparent; border: 0; min-height: 0; padding: .5rem; }   /* alerta do bootstrap */
.btn-topbar, .btn-topbar:hover { background: transparent; }
.alert { border-radius: .8rem; }

/* chips (sim/não/na, tipo, periodicidade) */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { position: relative; }
.chip input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.chip span { display: inline-block; padding: 7px 14px; border: 1px solid var(--line-2); border-radius: .55rem; background: var(--paper); font-size: .9rem; min-width: 54px; text-align: center; color: var(--ink); }
.chip input:checked + span { background: var(--marinho); color: #fff; border-color: var(--marinho); }
html[data-theme="dark"] .chip input:checked + span { background: var(--accent); color: #0f1418; border-color: var(--accent); }
.chip input:focus-visible + span { box-shadow: 0 0 0 .2rem rgba(13,110,253,.3); }
.chip.sim input:checked + span, .chip.otima input:checked + span { background: var(--ok); border-color: var(--ok); color: #fff; }
.chip.nao input:checked + span, .chip.ruim input:checked + span { background: var(--bad); border-color: var(--bad); color: #fff; }
.chip.boa input:checked + span { background: var(--warn); border-color: var(--warn); color: #fff; }

/* checklist */
.item { display: grid; grid-template-columns: 1fr auto; gap: 10px 16px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.item.sub { padding-left: 22px; }
.item .num { font-family: var(--mono); color: var(--ink-3); font-size: .85rem; margin-right: 6px; }
.item.nota { grid-template-columns: 1fr; color: var(--ember); font-size: .9rem; font-weight: 600; }
.item.grupo { grid-template-columns: 1fr; font-weight: 600; }
.item .extra { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; }
.item .extra input { max-width: 200px; }
@media (max-width: 640px) { .item { grid-template-columns: 1fr; } }

/* abas (topo no desktop; barra inferior fixa no celular na tela do laudo) */
.abas { display: flex; gap: 2px; flex-wrap: wrap; border-bottom: 2px solid var(--line-2); margin-bottom: 16px; }
.abas a { padding: 9px 13px; text-decoration: none; color: var(--ink-2); border-bottom: 3px solid transparent; margin-bottom: -2px; font-weight: 600; font-size: .9rem; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.abas a.ativa { color: var(--accent); border-bottom-color: var(--accent); }
.abas a .n { background: var(--bg-2); border-radius: 999px; padding: 0 7px; font-size: .74rem; }
@media (max-width: 991.98px) {
  .abas.abas-laudo { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; background: var(--paper); border-top: 1px solid var(--line-2); border-bottom: 0; z-index: 1025; flex-wrap: nowrap; overflow-x: auto; padding: 4px 6px calc(4px + env(safe-area-inset-bottom)); box-shadow: 0 -2px 8px rgba(0,0,0,.08); gap: 0; }
  .abas.abas-laudo a { flex: 1 0 auto; flex-direction: column; gap: 2px; font-size: .68rem; padding: 6px 10px; border-bottom: 0; border-top: 3px solid transparent; margin: 0; min-width: 64px; }
  .abas.abas-laudo a.ativa { border-top-color: var(--accent); }
  .abas.abas-laudo a i { font-size: 1.1rem; }
  .abas.abas-laudo a .n { display: none; }
}
.abas a i { font-size: .95em; }

/* status de salvamento */
.salvo { position: fixed; right: 16px; bottom: 16px; background: var(--marinho); color: #fff; padding: 8px 14px; border-radius: .6rem; font-size: .85rem; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 1040; }
.salvo.on { opacity: 1; } .salvo.erro { background: var(--bad); }
@media (max-width: 991.98px) { .salvo { bottom: 78px; } }

/* medidas */
.medidas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.medidas-grid label { font-size: .75rem; margin: 0; }
.medidas-grid input { padding: 6px 8px; font-size: .95rem; text-align: right; }

/* fotos */
.fotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
@media (max-width: 575.98px) { .fotos { grid-template-columns: repeat(2, 1fr); gap: 8px; } }
.foto { background: var(--paper); border: 1px solid var(--line); border-radius: .8rem; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--sombra); }
.foto .img { aspect-ratio: 4/3; background: var(--bg-2); display: grid; place-items: center; color: var(--ink-3); font-size: .85rem; }
.foto .img img { width: 100%; height: 100%; object-fit: cover; }
.foto .corpo { padding: 8px; display: grid; gap: 6px; }
.foto .corpo input { padding: 6px 8px; font-size: .88rem; }
.foto .n { font-family: var(--mono); font-size: .75rem; color: var(--ink-3); }
.foto .acoes { gap: 4px; }
.upload { border: 2px dashed var(--line-2); border-radius: .8rem; padding: 16px; text-align: center; color: var(--ink-2); background: var(--paper); }
.upload input[type=file] { margin-top: 8px; }

/* válvulas */
.valv table input { padding: 5px 7px; font-size: .9rem; }
.valv th, .valv td { text-align: center; }
.valv td:first-child, .valv th:first-child { text-align: left; }

/* fluxo do laudo */
.fluxo { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: .82rem; color: var(--ink-3); }
.fluxo span { padding: 4px 10px; border-radius: 999px; background: var(--bg-2); }
.fluxo span.atual { background: var(--accent); color: #fff; }
.fluxo span.feito { background: var(--ok-soft); color: var(--ok); }

/* diversos */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; font-size: .93rem; margin: 0; }
.kv dt { color: var(--ink-2); font-weight: 500; } .kv dd { margin: 0; }
.aviso { background: var(--warn-soft); border: 1px solid var(--warn); color: var(--ink); padding: 10px 14px; border-radius: .6rem; margin-bottom: 12px; font-size: .9rem; }
.lista-simples { list-style: none; padding: 0; margin: 0; }
.lista-simples li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.lista-simples li input { flex: 1; min-width: 160px; }
.flash { padding: 10px 14px; border-radius: .6rem; margin-bottom: 16px; background: var(--ok-soft); color: var(--ok); border: 1px solid var(--ok); }
.flash.erro { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }

/* ---------- login ---------- */
.login-card { width: 100%; max-width: 440px; border-radius: 1rem; overflow: hidden; box-shadow: 0 1rem 3rem rgba(0,0,0,.3); background: var(--paper); padding: 0; }
.login-card .cabeca { background: linear-gradient(135deg, var(--azul), var(--ciano)); color: #fff; text-align: center; padding: 26px 20px 20px; }
.login-card .cabeca img { max-height: 120px; max-width: 80%; background: #fff; border-radius: 10px; padding: 8px 14px; margin-bottom: 12px; }
.login-card .cabeca i { font-size: 2.6rem; margin-bottom: 8px; }
.login-card .cabeca h1 { color: #fff; margin: 0; font-size: 1.4rem; }
.login-card .cabeca p { margin: 4px 0 0; opacity: .9; font-size: .9rem; }
.login-card .corpo { padding: 24px; }
.login-card .pe { text-align: center; color: var(--ink-3); font-size: .78rem; padding: 12px; border-top: 1px solid var(--line); background: var(--bg-2); }

/* ---------- painel ---------- */
.numero-grande { text-align: center; }
.numero-grande .valor { font-size: 3.4rem; font-weight: 800; color: var(--accent); line-height: 1; display: flex; align-items: center; justify-content: center; gap: 14px; }
.numero-grande .valor i { font-size: 2.2rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile { border: 1px solid var(--line); border-radius: .8rem; padding: 14px 12px; text-align: center; text-decoration: none; color: inherit; display: block; background: var(--paper); transition: transform .12s; }
.tile:hover { transform: translateY(-2px); color: inherit; }
.tile .v { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.tile .l { font-size: .8rem; color: var(--ink-2); margin-top: 4px; }
.tile.bad { border-color: var(--bad); background: var(--bad-soft); } .tile.bad .v { color: var(--bad); }
.tile.warn { border-color: var(--warn); background: var(--warn-soft); } .tile.warn .v { color: var(--warn); }
.tile.ok .v { color: var(--ok); } .tile.accent .v { color: var(--accent); } .tile.muted .v { color: var(--ink-2); }
.graficos { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 991.98px) { .graficos { grid-template-columns: 1fr; } }
.grafico-box { position: relative; height: 260px; }

/* listas viram cartões no celular */
@media (max-width: 767.98px) {
  table.responsiva thead { display: none; }
  table.responsiva, table.responsiva tbody, table.responsiva tr, table.responsiva td { display: block; width: 100%; }
  table.responsiva tr { border: 1px solid var(--line); border-radius: .7rem; margin-bottom: 10px; padding: 8px 10px; background: var(--paper); }
  table.responsiva td { border: 0; padding: 3px 0; }
  table.responsiva td[data-l]::before { content: attr(data-l) ": "; color: var(--ink-3); font-size: .78rem; }
  table.responsiva td.principal { font-size: 1.02rem; }
}

/* selo de recurso em teste, ao lado do nome no menu lateral */
.selo-beta { display: inline-block; margin-left: 7px; padding: 1px 6px; border-radius: 999px;
  background: var(--warn-soft); color: var(--warn); font-size: .62rem; font-weight: 800;
  letter-spacing: .06em; text-transform: uppercase; vertical-align: middle; }

/* ficha de PMTA embutida na aba do laudo */
iframe.ficha-pmta { width: 100%; height: 1150px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }

/* auditoria */
.filtros-aud { display: flex; flex-direction: row; flex-wrap: wrap; gap: .6rem .8rem; align-items: flex-end; }  /* .card do Bootstrap é coluna */
.filtros-aud label { display: flex; flex-direction: column; font-size: .8rem; gap: .2rem; flex: 1 1 150px; margin: 0; }
.filtros-aud .acoes { flex: 0 0 auto; }
.filtros-aud label:first-child { flex: 3 1 240px; }
table.aud details summary { cursor: pointer; }
table.aud-campos { margin-top: .4rem; width: 100%; font-size: .78rem; }
table.aud-campos td { word-break: break-word; max-width: 320px; vertical-align: top; }
/* tabela de enquadramento NR-13 (planilha do Djalma): amarelo = editável, como nela */
.enq-amarelo:not(:disabled) { background: #fff2a8; }
table.enq { width: 100%; border-collapse: collapse; margin: .35rem 0; font-size: .85rem; }
table.enq th, table.enq td { border: 1px solid #c9ced6; padding: .25rem .4rem; text-align: center; }
table.enq th { background: #eef1f5; font-weight: 600; }
.enq-tit { font-weight: 600; font-size: .85rem; margin: .5rem 0 .1rem; }
