/* public/css/inspec.css */

/* ===== Força tema claro no documento inteiro (evita fundos escuros nativos) ===== */
:root{
  color-scheme: light; /* impede que o UA aplique dark mode automático nos controles */
}

/* Se algum SO/navegador insistir no dark, garantimos fundo claro do body */
@media (prefers-color-scheme: dark){
  body { background-color: #f2f6fc; color:#333; }
}

/* Reset básico */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Corpo geral */
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f2f6fc;
  color: #333;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Container principal para limitar largura e centralizar */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 15px;
  flex-grow: 1;
}
/* ===================== */
/* Submenus (novo)       */
/* ===================== */
.submenu {
  margin: 8px 0 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.submenu .nav-btn {
  padding: 6px 14px;
  border-radius: 8px;
  font-weight: 700;
}
/* (escopo específico p/ submenu) */
.submenu .nav-btn.active {
  background: #cfe0ff;
  outline: 2px solid #99b5ff;
}

/* ===================== */
/* Concluir Inspeções    */
/* ===================== */
.concluir-wrapper {
  display: grid;
  gap: 14px;
}
.concluir-lista {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  overflow: hidden;
}
.concluir-lista table {
  width: 100%;
  border-collapse: collapse;
}
.concluir-lista thead {
  background: #eaf1ff;
  color: #003a99;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.concluir-lista th, .concluir-lista td {
  padding: 10px 12px;
  border-bottom: 1px solid #eef2f8;
  vertical-align: middle;
}
.thumb-50 {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid #e2e8f0;
}
.concluir-detalhe {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  padding: 14px;
}
.concluir-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.btn-ghost {
  background: #f6f8ff;
  color: #004aad;
  border: 1px solid #cfe0ff;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}
.btn-ghost:hover { background: #eaf1ff; }

/* Chips de status (Dashboard compat) */
.chip { display:inline-block; padding:4px 10px; border-radius:999px; font-weight:700; font-size:.85rem; }
.chip-azul  { background:#2196f3; color:#fff; }
.chip-verde { background:#2e7d32; color:#fff; }

/* === Cores oficializadas (pedido do cliente) === */
.chip-corrigida,
.apto-chip.status-corrigida { background: #e3f2ff; border-color: #60a5fa; color: #0b5394; }

.chip-finalizada,
.apto-chip.status-finalizada { background: #dcfce7; border-color: #86efac; color: #065f46; }


/* Modal de imagem cheia (reutilizável) */
#modalImgFull { display:none; position:fixed; inset:0; background:rgba(0,0,0,.85); z-index:11000; }
#modalImgFull .img-wrap { position:absolute; inset:40px; display:flex; align-items:center; justify-content:center; }
#modalImgFull img { max-width:100%; max-height:100%; }
#modalImgFull .close{position:absolute;top:10px;right:16px;font-size:32px;color:#fff;cursor:pointer;user-select:none}

/* ====== Drilldown de chips ====== */
.drill-list{
  display:grid;
  gap:10px;
  max-height:60vh;
  overflow:auto;
}
.drill-item{
  background:#fff;
  border:1.5px solid #dbe6ff;
  border-radius:10px;
  padding:10px 12px;
  box-shadow:0 2px 6px rgba(0,0,0,.05);
  display:grid;
  grid-template-columns: 110px 1fr;
  gap:8px;
}
.drill-item .thumb{
  width:100px; height:70px; object-fit:cover; border-radius:6px; border:1px solid #e5e7eb;
}
.drill-item .meta{
  display:flex; flex-wrap:wrap; gap:6px 12px; align-items:center;
  font-size:14px; color:#1f2937;
}
.drill-item .meta .tag{ padding:4px 8px; border-radius:999px; border:1px solid #cbd5e1; font-weight:700; font-size:12px; }
.drill-empty{ padding:12px; color:#6b7280; }


/* Loader */
/* Correção: remover display:flex padrão para que fique oculto até JS ativar */
#loader {
  display: none; /* oculto inicialmente */
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(255,255,255,0.8);
  z-index: 9999;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
#loader .spin {
  border: 8px solid #e1e4eb;
  border-top: 8px solid #004aad;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: spin 1s linear infinite;
  margin-bottom: 10px;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
#loader .msg {
  font-size: 1.2rem;
  color: #004aad;
  font-weight: 600;
}

/* Toast de aviso */
#toastPrazo {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #222;
  color: #fff;
  padding: 14px 28px;
  border-radius: 30px;
  font-size: 16px;
  box-shadow: 0 2px 12px #0008;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  z-index: 11000;
}
#toastPrazo.show {
  opacity: 1;
  pointer-events: auto;
}

/* Modal genérico */
.modal {
  display: none;
  position: fixed;
  z-index: 11000;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.7);
  overflow-y: auto;
  padding: 20px;
}
.modal-content {
  background: #fff;
  max-width: 420px;
  margin: 40px auto;
  padding: 20px 30px;
  border-radius: 10px;
  box-shadow: 0 6px 15px rgb(0 0 0 / 0.15);
  position: relative;
  text-align: left;
}
.modal-content h2,
.modal-content h3 {
  text-align: center;
  margin-bottom: 18px;
  color: #004aad;
}
.close {
  position: absolute;
  top: 12px;
  right: 18px;
  font-size: 28px;
  font-weight: bold;
  color: #aaa;
  cursor: pointer;
  transition: color 0.2s;
}
.close:hover {
  color: #444;
}

/* Header */
header {
  background-color: #004aad;
  padding: 15px 0;
  margin-bottom: 30px;
}
header h1 {
  color: #fff;
  font-weight: 700;
  text-align: center;
  font-size: 1.8rem;
}
/* Barra de navegação em flex para organizar melhor os botões
   (o "Sair" vai para a direita com margin-left:auto) */
nav {
  margin-top: 15px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
}
/* Spacer invisível que empurra o botão "Sair" para a direita */
nav .nav-spacer{
  flex: 1 1 auto;
}
.nav-btn {
  background: rgba(255,255,255,0.9);
  border: none;
  border-radius: 10px;
  padding: 8px 18px;
  margin: 0 6px 10px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  color: #004aad;
  transition: background-color 0.3s ease;
}
.nav-btn:hover:not(:disabled) {
  background: #cce0ff;
}
/* regra única p/ estado ativo dos botões principais */
.nav-btn.active {
  background: #cce0ff;
  outline: 2px solid #004aad;
  box-shadow: inset 0 0 0 2px rgba(0,74,173,0.08);
  filter: saturate(1.05);
}

/* Ênfase leve no botão Serviços */
#menuServicos.nav-btn {
  font-weight: 700;
}

/* Ênfase leve nos três botões principais */
#btnDefeitos.nav-btn,
#btnServicos.nav-btn,
#btnChecklist.nav-btn {
  font-weight: 700;
}
/* (removido duplicado .nav-btn.active) */

.nav-btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.btn-logout {
  background: #f44336;
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  margin-left: 0;      /* espaçador flex cuida do alinhamento */
}

.btn-logout:hover {
  background: #d32f2f;
}

/* Main */
main.container {
  flex-grow: 1;
}

/* Tela */
.tela {
  display: none;
}
.tela.active {
  display: block;
}

/* Títulos e botões */
.titulo-e-botoes {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}
.titulo-e-botoes h2 {
  font-weight: 700;
  color: #004aad;
  font-size: 1.6rem;
}
.btn-salvar {
  background-color: #004aad;
  color: white;
  border: none;
  border-radius: 12px;
  padding: 10px 22px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.3s ease;
  font-size: 1rem;
}
.btn-salvar:hover {
  background-color: #003080;
}

/* Botão secundário (NOVO) */
.btn-secundario {
  background-color: #e0e8ff;
  color: #004aad;
  border: 1px solid #a2b4ff;
  border-radius: 8px;
  padding: 8px 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s ease;
  font-size: 0.95rem;
}
.btn-secundario:hover {
  background-color: #cfe0ff;
}

/* Botões de ação de foto (Tirar foto / Escolher da galeria) */
.foto-btn {
  background-color: #e0e8ff;
  color: #004aad;
  border: 1px solid #a2b4ff;
  border-radius: 10px;
  padding: 8px 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease;
  font-size: .95rem;
}
.foto-btn:hover {
  background-color: #cfe0ff;
  border-color: #94a3ff;
}

/* Botão Voltar mais moderno/legível */
.btn-voltar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  color: #334155;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  padding: 9px 14px;
  font-weight: 700;
  font-size: 1rem;
  margin-top: 25px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  transition: background .2s ease, border-color .2s ease, transform .06s ease;
}
.btn-voltar:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}
.btn-voltar:active {
  transform: translateY(1px);
}
.btn-voltar:focus-visible {
  outline: 3px solid #a5b4fc;
  outline-offset: 2px;
}

/* Botão limpar */
.btn-limpar {
  background-color: #f44336;
  color: white;
  border: none;
  border-radius: 12px;
  padding: 8px 16px;
  cursor: pointer;
  font-weight: 600;
}
.btn-limpar:hover {
  background-color: #d32f2f;
}

/* Formulários */
form {
  max-width: 100%;
}
.form-group {
  margin-bottom: 18px;
}
.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: #004aad;
}
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="date"],
select,
input[type="file"],
input[type="number"] {
  width: 100%;
  padding: 9px 12px;
  border: 1.8px solid #ccd9ff;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 400;
  transition: border-color 0.3s;
  background-color: #fff;      /* <— força fundo claro */
  color: #0f172a;              /* texto bem legível no fundo branco */
  -webkit-appearance: none;    /* reduz interferência do tema do SO */
  appearance: none;  
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
select:focus,
input[type="file"]:focus {
  border-color: #004aad;
  outline: none;
}

/* Textarea herda os mesmos visuais de input */
textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.8px solid #ccd9ff;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 400;
  transition: border-color 0.3s;
  background-color: #fff; 
  color: #0f172a;
}
textarea:focus { border-color:#004aad; outline:none; }

/* Corrige o autofill amarelo/escuro do Chrome no tema claro */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: #0f172a;
  transition: background-color 9999s ease-in-out 0s;
  box-shadow: 0 0 0px 1000px #fff inset;
}

/* Campos nos cards de foto também garantem fundo branco (caso UA tente escurecer) */
.preview-foto-card select,
.preview-foto-card input[type="text"],
.preview-foto-card input[type="date"],
.preview-foto-card input[type="number"] { background-color:#fff; }

/* ============================= */
/* Telas específicas (novas)     */
/* ============================= */
/* Mantém o padrão .tela {display:none} / .tela.active {display:block} já existente */
#telaDefeitos .titulo-e-botoes h2::after {
  content: " (Inspeções)";
  font-weight: 600;
  font-size: .9rem;
  color: #64748b;
  margin-left: 6px;
}
#telaServicos .titulo-e-botoes h2,
#telaChecklist .titulo-e-botoes h2 {
  color: #0b3ea6;
}

/* Classes especiais */
.full-width {
  width: 100%;
}

/* Listas de itens */
.lista-itens {
  list-style: none;
  margin-top: 6px;
  padding-left: 12px;
}
.lista-itens li {
  background: #e9f0ff;
  margin-bottom: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 600;
  color: #004aad;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.lista-itens li button {
  background: #d32f2f;
  border: none;
  border-radius: 8px;
  color: white;
  font-weight: 700;
  cursor: pointer;
  padding: 3px 9px;
  font-size: 0.9rem;
  transition: background 0.3s ease;
}
.lista-itens li button:hover {
  background: #a22424;
}

/* Listas de registros (obras, empresas) */
.lista-registros {
  margin-top: 20px;
  border-top: 2px solid #004aad;
  padding-top: 12px;
}
.lista-registros .item-lista {
  background: #f7faff;
  border: 1px solid #b0c4ff;
  border-radius: 8px;
  padding: 12px 18px;
  margin-bottom: 10px;
  font-weight: 600;
  color: #004aad;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.lista-registros .item-lista button {
  margin-left: 6px;
  background: #d32f2f;
  border: none;
  border-radius: 6px;
  color: white;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 12px;
  transition: background 0.3s ease;
  font-size: 0.9rem;
}
.lista-registros .item-lista button:hover {
  background: #a22424;
}

/* Preview Fotos */
.preview-fotos {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-top: 20px;
}
 
 /* ===================================================== */
 /* Checklists – Itens e suporte ao modo "N/A" no card    */
 /* ===================================================== */
 /* Container onde os itens do checklist são injetados via JS */
 .itens-checklist{
   display: grid;
   gap: 8px;
 }
 /* Linha de item (checkbox + rótulo), caso o JS use uma div/span por item */
 .itens-checklist .item,
 .itens-checklist .check-row{
   display: flex;
   align-items: center;
   gap: 8px;
 }
 .itens-checklist input[type="checkbox"]{
   transform: translateY(1px);
 }
 .itens-checklist label{
   font-weight: 600;
   color: #1f2a55;
   cursor: pointer;
 }
 
 /* Botão compacto "N/A" que vive ao lado da dica dentro do card */
 .btn-na{
   padding: 4px 8px;
   font-size: 12px;
   line-height: 1.2;
 }
 /* Dica curta sobre como usar o N/A */
 .na-hint{
   font-size: 11px;
   color: #555;
   margin: 4px 0 6px 0;
   display: block;
 }
 /* Aparência quando um item foi marcado como N/A (JS aplica essa classe na linha do item) */
 .check-na-disabled{
   opacity: .65;
 }
 .check-na-disabled label{
   text-decoration: line-through;
 }
.preview-foto-card {
  background: white;
  border: 1.5px solid #c4d1ff;
  border-radius: 12px;
  padding: 15px;
   /* espaço extra para a pequena barra com botão N/A + dica */
   padding-bottom: 18px;
  width: 280px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  transition: box-shadow 0.3s ease;
}
.preview-foto-card:hover {
  box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}
.preview-foto-card canvas {
  border-radius: 8px;
  max-width: 100%;
  height: auto !important;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}
.preview-foto-card select,
.preview-foto-card input[type="text"],
.preview-foto-card input[type="date"],
.preview-foto-card input[type="number"] {
  width: 100%;
  padding: 8px 10px;
  border: 1.5px solid #a2b4ff;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #004aad;
  transition: border-color 0.3s ease;
}
.preview-foto-card select:hover,
.preview-foto-card input[type="text"]:hover,
.preview-foto-card input[type="date"]:hover,
.preview-foto-card input[type="number"]:hover {
  border-color: #002d80;
}
.preview-foto-card select:focus,
.preview-foto-card input[type="text"]:focus,
.preview-foto-card input[type="date"]:focus,
.preview-foto-card input[type="number"]:focus {
  outline: none;
  border-color: #002d80;
}

/* Relatório Botões */
.relatorio-actions {
  margin-top: 15px;
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

/* Histórico */
.filtros-historico {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}
.filtros-historico select,
.filtros-historico input[type="date"],
.filtros-historico input[type="text"] {
  padding: 8px 12px;
  font-size: 1rem;
  border-radius: 8px;
  border: 1.5px solid #a2b4ff;
  color: #004aad;
  transition: border-color 0.3s ease;
  background: #fff;  /* <— garante branco também nos filtros do histórico */
}
.filtros-historico select:hover,
.filtros-historico input[type="date"]:hover,
.filtros-historico input[type="text"]:hover {
  border-color: #002d80;
}
.filtros-historico select:focus,
.filtros-historico input[type="date"]:focus,
.filtros-historico input[type="text"]:focus {
  outline: none;
  border-color: #002d80;
}
#listaHistorico {
  max-height: 400px;
  overflow-y: auto;
}

/* Cards histórico */
.card-historico {
  background: white;
  border: 1.5px solid #a2b4ff;
  border-radius: 10px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.05);
  padding: 18px;
  margin-bottom: 18px;
  display: flex;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}
.card-historico img {
  width: 120px;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 2px 4px #b2c2ff;
}
.card-historico .info {
  flex-grow: 1;
}
.card-historico .acoes {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Destaques de prazos */
.card-vencida {
  border-color: #f44336 !important;
  background: #fff0f0 !important;
}
.card-prazo-avisar {
  border-color: #ff9800 !important;
  background: #fffaf0 !important;
}
.prazo-vencido {
  color: #f44336;
  font-weight: 700;
}
.prazo-avisar {
  color: #ff9800;
  font-weight: 700;
}

/* Modal ferramentas de edição */
.ferramentas-modal {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  justify-content: center;
}
.ferramentas-modal button {
  background-color: #004aad;
  border: none;
  color: white;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 700;
  transition: background-color 0.3s ease;
}
.ferramentas-modal button:hover {
  background-color: #002d80;
}
.ferramentas-modal input[type="color"],
.ferramentas-modal input[type="range"] {
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid #004aad;
  padding: 3px;
  height: 36px;
  width: 60px;
  transition: border-color 0.3s ease;
}
.ferramentas-modal input[type="range"] {
  width: 150px;
}
.ferramentas-modal input[type="color"]:hover,
.ferramentas-modal input[type="range"]:hover {
  border-color: #002d80;
}

#telaServicos .titulo-e-botoes h2 {
  color: #0b3ea6;
}

#servicosConteudo {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 20px;
}

.card-servico {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  padding: 16px;
  width: 280px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-servico h3 {
  font-size: 1.2rem;
  color: #004aad;
  font-weight: 700;
  margin-bottom: 8px;
}

.card-servico p {
  font-size: 0.95rem;
  color: #334155;
  flex-grow: 1;
}

.card-servico button {
  align-self: flex-end;
  font-size: 0.9rem;
  padding: 6px 12px;
}

/* ====== OVERRIDE: Modal de Edição de Foto em largura grande ====== */
#modalEdicao .modal-content{
  max-width: 1100px;                    /* espaço para o canvas em 980x560 */
  width: min(1100px, calc(100vw - 60px));
}
#canvasEdicao{
  display:block;
  width:100%;       /* preenche a largura do modal */
  height:auto;      /* mantém proporção; o Fabric controla a resolução interna */
}

/* Responsividade */
@media (max-width: 720px) {
  .preview-foto-card {
    width: 100%;
  }
  .ferramentas-modal {
    justify-content: flex-start;
  }
  nav { justify-content: center; }
  .nav-btn { margin: 5px 4px; padding: 6px 14px; }
  .btn-logout {
    margin-left: 0;
    order: 99;           /* fica por último nas quebras de linha */
  }
}

/* ============================================= */
/* Override para fazer o SweetAlert2 ficar acima */
/* ============================================= */
.swal2-container {
  z-index: 12000 !important;
}

/* ====== SweetAlert (layout compacto usado nas listagens) ====== */
.swal-compact .swal2-title{
  text-align: left;
  font-size: 1.1rem;
}
.swal-compact .swal2-html-container{
  max-height: 70vh;   /* rolagem interna p/ listas longas */
  overflow: auto;
  text-align: left;
}
.swal-compact img{
  max-width: 100%;
  height: auto;
  border-radius: 10px;
}
/* Miniaturas clicáveis dentro do SweetAlert */
.swal2-popup .thumb-link img,
.swal2-popup .thumb-link-generic img{
  cursor: pointer;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}
.swal2-popup .thumb-link img:hover,
.swal2-popup .thumb-link-generic img:hover{
  box-shadow: 0 0 0 2px #93c5fd;
}

/* ====== OVERRIDE: Modal Editar Grupo de Checklist ====== */
#modalEditarGrupoChecklist .modal-content,
#modalEditarGrupoChecklist .modal-conteudo,      /* compat com nome PT se aparecer */
#modalEditarGrupoChecklist .card {               /* se usar .card como wrapper */
  width: min(96vw, 1100px);
  max-width: 1100px;
}

#modalEditarGrupoChecklist input,
#modalEditarGrupoChecklist select {
  width: 100%;
}

/* Espaçamento mais compacto dentro do modal */
#modalEditarGrupoChecklist .modal-content h3 { margin-bottom: 10px; }
#modalEditarGrupoChecklist .form-group { margin-bottom: 14px; }

/* Lista de itens do grupo (linhas geradas via JS) */
#egcListaItens {
  display: grid;
  gap: 10px;
}

/* Estiliza qualquer “linha” adicionada, mesmo sem classe específica */
#egcListaItens > * {
  display: grid;
  grid-template-columns: 2fr 2fr 110px 42px;  /* Nome | Modelo | Qtd | Remover */
  gap: 8px;
  align-items: center;
  background: #fff;
  border: 1px solid #dbe6ff;
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

/* Inputs das linhas */
#egcListaItens > * input[type="text"],
#egcListaItens > * input[type="number"],
#egcListaItens > * select {
  width: 100%;
}

/* Botão de remover na linha, caso exista */
#egcListaItens > * .btn-remover,
#egcListaItens > * .btn-limpar {
  justify-self: end;
  min-width: 42px;
  padding: 6px 8px;
}

/* Responsivo: empilha os campos em telas menores */
@media (max-width: 720px) {
  #egcListaItens > * {
    grid-template-columns: 1fr;
  }
}


/* ================================ */
/* Quadro de Apartamentos (Dashboard)
/* ================================ */
.apto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
  margin: 10px 0 20px;
}

  /* Grid de ação (seleção/indisponível/remover) */
  .apto-grid .apto-chip {
  background: linear-gradient(135deg, #34d399, #059669); /* disponível por padrão */
  color: #fff;
  border-radius: 12px;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 800;
  padding: 6px;
  box-shadow: 0 8px 18px rgba(0,0,0,.06);
  user-select: none;
  cursor: pointer;
  transition: transform .08s ease, filter .12s ease, outline .08s ease;
}
.apto-grid .apto-chip:hover { transform: translateY(-2px); filter: brightness(1.03); }
.apto-grid .apto-chip._mode { outline: 3px dashed rgba(37,99,235,.35); }
.apto-grid .apto-chip.indisp { background: linear-gradient(135deg, #9ca3af, #6b7280); } /* indisponível */
.apto-grid .apto-chip.removed { background: linear-gradient(135deg, #fb7185, #ef4444); } /* removido (apenas feedback antes de sumir) */

/* ===================================================== */
/* ============= QUADRO DE APARTAMENTOS =================*/
/* ===================================================== */
.quadro-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 16px;
  align-items: center;
}
.quadro-toolbar-left {
  display: flex;
  gap: 10px;
  align-items: center;
}
.quadro-obra-select {
  min-width: 220px;
}
.quadro-toolbar-legend {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.chip {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #cbd5e1;
  background: #fff;
}

/* Cadastro blocos */
.quadro-cadastro {
  background: #f6f9ff;
  border: 1.5px solid #c4d1ff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.cad-card {
  background: #fff;
  border: 1px solid #dbe6ff;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
}
.cad-card h3 {
  margin-bottom: 10px;
  color: #004aad;
}
.cad-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
}
.cad-grid small {
  display: block;
  margin-top: 6px;
  color: #6b7280;
}
.cad-actions {
  display: flex;
  align-items: end;
}
.cad-card .help {
  margin-top: 8px;
  color: #64748b;
  font-size: 0.9rem;
}

@media (max-width: 980px) {
  .cad-grid {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }
}
@media (max-width: 640px) {
  .cad-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }
}

/* Container do quadro */
.quadro-apt-container {
  border: 1.5px solid #c4d1ff;
  border-radius: 12px;
  padding: 16px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* Grupo por Torre */
.torre-card {
  border: 1px solid #dbe6ff;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 14px;
  background: #f9fbff;
}
.torre-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.torre-title {
  font-weight: 800;
  color: #1f2a55;
}
.torre-pill {
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid #cbd5e1;
  background: #fff;
}

/* Linha de piso */
.piso-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
  align-items: start;
  margin-bottom: 8px;
}
.piso-label {
  font-weight: 700;
  color: #334155;
  background: #eef3ff;
  border: 1px solid #dbe6ff;
  padding: 6px 10px;
  border-radius: 8px;
}

/* Chips dos apartamentos */
.apto-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
/* Quadro de status (render por obra/torre/piso) */
.quadro-apt-container .apto-chip {
  padding: 6px 8px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 12px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #1f2937;
  cursor: default;
  user-select: none;
  box-shadow: 0 1px 0 rgba(0,0,0,0.05);
}

/* Cores por status */
.chip-base,
.apto-chip.status-base { background: #ffffff; border-color: #cbd5e1; color: #1f2937; }
.chip-pendente,
.apto-chip.status-pendente { background: #fff8cc; border-color: #f6d860; color: #7a5b00; }
.chip-atrasada,
.apto-chip.status-atrasada { background: #ffe2e2; border-color: #f87171; color: #7f1d1d; }
.chip-corrigida,
.apto-chip.status-corrigida { background: #e3f2ff; border-color: #60a5fa; color: #0b5394; }
.chip-finalizada,
.apto-chip.status-finalizada { background: #dcfce7; border-color: #86efac; color: #065f46; }
.chip-condicoes-ok,
.apto-chip.status-condicoes-ok { background: #ffedd5; border-color: #fdba74; color: #7c2d12; }
.chip-condicoes-no,
.apto-chip.status-condicoes-no { background: #f3e8ff; border-color: #d8b4fe; color: #5b21b6; }

/* NOVO: Chip e status de Restrições */
/* Mantemos as “Restrições” escuras apenas como badge/indicador, não em campos */
.chip-restricao{ background:#111; color:#fff; border:1px solid #000; }

/* Cada célula (apto/ACI/ACE) recebe .status-<nome> */
/* Se preferir menos “preto absoluto” no quadro, troque #111 por um cinza #374151 */
.status-restricao{
  background:#111 !important;
  color:#fff !important;
  border-color:#000 !important;
}

/* Garantir contraste quando “indisponível” combinar com restrição */
.apto-chip.indisp.status-restricao{
  outline:2px dashed #fff;
  outline-offset:-2px;
}

/* NOVO: status visual quando existe checklist concluído (UA/ACI/ACE) */
.apto-chip.status-checklist,
.aci-chip.status-checklist,
.ace-chip.status-checklist{
  background:#e91e63 !important;   /* rosa */
  border-color:#e91e63 !important;
  color:#fff !important;
}


/* ====== Quadro de Apartamentos: colunas alinhadas (prumada) ====== */
:root{
  /* largura fixa das colunas de apartamentos (alinhamento por prumada) */
  --apto-col-w: 72px;
  --gap-apto: 6px;
  --chip-gap: 6px;
}
.quadro-apt-container .piso-row{
  display:flex;
  align-items:flex-start;
  gap:10px;
}
.quadro-apt-container .piso-label{
  min-width:70px;
  font-weight:600;
}
.quadro-apt-container .apto-chips{
  display:grid;
  gap:var(--chip-gap);
}
.quadro-apt-container .apto-chip{
  display:flex;
  align-items:center;
  justify-content:center;
  width:var(--apto-col-w);
  min-height:32px;
  padding:4px 6px;
  border:1px solid #d9e1ff;
  border-radius:8px;
  box-sizing:border-box;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  font-variant-numeric: tabular-nums; /* números 101/201/301 alinham melhor */
}
.quadro-apt-container .apto-chip.placeholder{
  opacity:0;              /* mantém espaço, sem conteúdo visual */
  pointer-events:none;
}
.quadro-apt-container .aci-chip{
  border-style:dashed;    /* diferencia ACI das unidades */
}
/* Quadro expande conforme cresce e permite scroll horizontal */
#quadroAptContainer{
  overflow-x: auto;
  overflow-y: visible;
  min-width: 100%;
  padding-bottom: 12px;
  background-clip: padding-box;
}
/* Indicação de modo de ação diretamente no Quadro */
#quadroAptContainer.action-mode .apto-chip:not(.aci-chip):not(.placeholder){
  cursor: pointer;
  outline: 2px dashed rgba(37,99,235,.35);
}
#quadroAptContainer.mode-indisp .apto-chip:not(.aci-chip):not(.placeholder):hover{
  filter: brightness(0.98);
  background: #e5e7eb;
}
#quadroAptContainer.mode-remover .apto-chip:not(.aci-chip):not(.placeholder):hover{
  filter: brightness(0.98);
  background: #fee2e2;
  border-color:#fca5a5;
}
/* Visual pros indisponíveis dentro do quadro principal */
.quadro-apt-container .apto-chip.indisp{
  background:#e5e7eb;
  border-color:#9ca3af;
  color:#374151;
}

/* Cards crescem para o conteúdo (não quebrar layout) */
.torre-card{
  width: max-content;
  min-width: 100%; /* acompanha o fundo e expande quando o quadro crescer */
}

/* Grid dos chips: usamos grid para colunas fixas dos aptos e colunas de ACI com largura baseada no conteúdo */
.apto-chips{
  display: grid;
  gap: var(--gap-apto);
  align-items: start;
}

/* Apartamentos: mesma largura para todas as colunas (alinhamento vertical perfeito) */
.apto-chip{
  width: var(--apto-col-w);
  box-sizing: border-box;
  text-align: center;
}

/* Placeholders (lacunas onde não há apto/ACI naquele piso) */
.apto-chip.placeholder{
  background: transparent;
  border: none;
  box-shadow: none;
}

/* Áreas Comuns Internas/Externas: largura conforme o nome (coluna usa max-content) */
.aci-chip{
  width: auto;
  min-width: 60px;
  padding: 4px 8px;
  white-space: nowrap;
}

/* Quadro de Apartamentos — placeholders mantêm as colunas alinhadas
   sem “aparecer” visualmente */
.apto-chip.placeholder {
  visibility: hidden;
}
/* ===== NOVO: Chips de legenda para telas novas ===== */
.chip-checklist{
  background:#e91e63;  /* rosa */
  color:#fff;
}
.chip-restricao{
  background:#000;     /* preto */
  color:#fff;
}

/* ===== NOVO: Badges sobre os apartamentos (não altera status já existente) ===== */
.apto-chip{ position:relative; }          /* garante ancoragem do stack */
.badge-stack{
  position:absolute;
  right:2px;
  bottom:2px;
  display:flex;
  gap:2px;
  pointer-events:none;                    /* não interfere no clique do chip */
}
.badge{
  font-size:10px;
  line-height:1;
  padding:2px 4px;
  border-radius:6px;
  font-weight:700;
  border:1px solid rgba(0,0,0,.08);
  box-shadow:0 0 0 1px rgba(255,255,255,.35) inset;
}
/* herdamos as cores já existentes para Serviços (condições) aplicando as classes de chip */
.badge.chip-condicoes-ok{  /* mesma cor dos seus "Cond. OK" */
  /* se já existir regra global, ela prevalece; mantemos aqui só como fallback suave */
}
.badge.chip-condicoes-no{  /* mesma cor dos seus "Sem Cond." */
}
.badge.chip-checklist{ background:#e91e63; color:#fff; }
.badge.chip-restricao{ background:#000;    color:#fff; }

/* Miniatura 50x50 usada na lista de Concluir/Finalizar */
.thumb-50{
  width:50px;
  height:50px;
  object-fit:cover;
  border-radius:6px;
  cursor:zoom-in;
  display:block;
}

/* preview da foto de conclusão (após escolher o arquivo) */
.preview-conclusao{
  margin-top:10px;
  padding:8px;
  background:#f6f7fb;
  border:1px solid #e6e8ef;
  border-radius:8px;
}
.preview-conclusao img{
  display:block;
  max-width:220px;
  max-height:220px;
  border-radius:6px;
}

/* quando em modo concluir/finalizar esconda a grade de inspeções */
body.concluir-ativo #cardsInspecoes{display:none}
body.concluir-ativo #btnVoltarInspecoes{display:inline-block}

/* ===================== Chips de status (dashboard/inspeções) ===================== */
.chip-corrigida,
.apto-chip.status-corrigida {
  background: #e3f2ff;
  border-color: #60a5fa;
  color: #0b5394;
}
.chip-finalizada,
.apto-chip.status-finalizada {
  background: #dcfce7;
  border-color: #86efac;
  color: #065f46;
}

/* Preview da foto de conclusão (Corrigir/Finalizar) */
.preview-conclusao {
  margin-top: 10px;
}
.preview-conclusao img {
  max-width: 320px;
  max-height: 220px;
  display: block;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}

/* Select de serviço do quadro (herda do restante) */
#selectServicoQuadro{ min-width:220px; }

/* Modal imagem cheia – botão fechar (X) visível e clicável */
#modalImgFull .close {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 28px;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  user-select: none;
}

/* garante um pequeno espaçamento quando a área for exibida */
#wrapConcluir{ margin-top:12px; }