/* ============================================================
   CONTRATOS.CSS - Módulo Contratos e Medições
   CF Obras — seguindo o padrão visual de apartamentos.css
   ============================================================ */

:root {
  --primary: #667eea;
  --secondary: #764ba2;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #fbbf24;
  --info: #3b82f6;
  --bg-color: #f9fafb;
  --text-main: #1f2937;
  --border-color: #e5e7eb;
}

/* ============================= */
/* CABEÇALHO LOCAL               */
/* ============================= */

#contratos-header {
  padding: 20px 30px;
  background: #f5f7fa;
  border-bottom: 1px solid #ddd;
}

body.embed-mode #contratos-header {
  padding-top: 15px;
}

.titulo-modulo {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 15px;
  color: #2c3e50;
}

/* ============================= */
/* SUBMENU TOP                   */
/* ============================= */

#submenu-contratos {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.sub-btn {
  background: #e6e9ef;
  border: none;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  color: #2c3e50;
  transition: 0.2s;
}

.sub-btn:hover {
  background: #d5d9e3;
}

.sub-btn.active {
  background: #667eea;
  color: #fff;
}

/* ============================= */
/* SEÇÕES PRINCIPAIS             */
/* ============================= */

.secao-contratos {
  padding: 25px 35px;
  display: none;
  background: #f9fafb;
}

.secao-contratos.active {
  display: block;
}

/* ============================= */
/* TABS INTERNAS                 */
/* ============================= */

.tabs-param {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tab-param {
  background: #e6e9ef;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  font-weight: 600;
  font-size: 14px;
  transition: 0.2s;
  color: #111827;
}

.tab-param:hover {
  background: #d5dae3;
}

.tab-param.active {
  background: #3498db;
  color: #fff;
}

.tab-content-param {
  display: none;
}

.tab-content-param.active {
  display: block;
}

/* ============================= */
/* CARD BASE                     */
/* ============================= */

.card-contratos {
  background: #fff;
  border-radius: 10px;
  padding: 25px 30px;
  margin-bottom: 25px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.06);
}

.card-contratos h3 {
  margin-bottom: 10px;
  font-weight: 700;
  color: #2c3e50;
  font-size: 20px;
}

.info-text {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 20px;
  line-height: 1.6;
}

/* ============================= */
/* CABEÇALHO DE SEÇÃO            */
/* ============================= */

.cabecalho-saldos {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 15px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.acoes-saldos {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* ============================= */
/* RESUMO CARDS                  */
/* ============================= */

.resumo-saldos {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 25px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 15px;
}

.resumo-item-check {
  background: rgba(255,255,255,0.15);
  padding: 15px;
  border-radius: 8px;
  text-align: center;
}

.resumo-item-check .numero {
  font-size: 26px;
  font-weight: 800;
  display: block;
  margin-bottom: 5px;
}

.resumo-item-check .label {
  font-size: 12px;
  opacity: 0.9;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Badge resumo (tipos de ap) */
.badge-resumo {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ============================= */
/* FILTRO / BUSCA                */
/* ============================= */

.inp-filtro {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
  min-width: 220px;
}

.inp-filtro:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(102,126,234,0.1);
}

/* ============================= */
/* TABELA DE DADOS               */
/* ============================= */

.table-wrapper-contratos {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.data-table-contratos {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
}

.data-table-contratos thead tr {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.data-table-contratos th {
  padding: 11px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data-table-contratos td {
  padding: 11px 14px;
  border-bottom: 1px solid #e5e7eb;
  color: #1f2937;
  vertical-align: middle;
}

.data-table-contratos tbody tr:hover { background: #fafbff; }
.data-table-contratos tbody tr:last-child td { border-bottom: none; }

/* Badges situação */
.badge-situacao {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-medido   { background: #d1fae5; color: #065f46; }
.badge-parcial  { background: #fef3c7; color: #92400e; }
.badge-aberto   { background: #dbeafe; color: #1e40af; }
.badge-encerrado{ background: #f3f4f6; color: #4b5563; }

/* ============================= */
/* BOTÕES DE AÇÃO                */
/* ============================= */

.btn-salvar {
  background: #3498db;
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font-weight: bold;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s;
  font-size: 14px;
  white-space: nowrap;
}
.btn-salvar:hover { background: #2980b9; }
.btn-salvar.btn-large { padding: 12px 28px; font-size: 15px; }

.btn-cancelar {
  background: #9ca3af;
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font-weight: bold;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s;
  font-size: 14px;
  white-space: nowrap;
}
.btn-cancelar:hover { background: #6b7280; }

.btn-danger {
  background: #ef4444;
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font-weight: bold;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s;
  font-size: 14px;
}
.btn-danger:hover { background: #dc2626; }

.btn-acao-verde {
  background: #10b981;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}
.btn-acao-verde:hover { background: #059669; }

.btn-acao-pequeno {
  padding: 5px 10px;
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-acao-pequeno:hover { background: #f3f4f6; }
.btn-acao-azul { border-color: #bfdbfe; color: #1d4ed8; background: #eff6ff; }
.btn-acao-azul:hover { background: #dbeafe; }

.btn-danger-small {
  padding: 5px 10px;
  border: none;
  background: #fef2f2;
  color: #ef4444;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.btn-danger-small:hover { background: #fee2e2; }

/* ============================= */
/* FORMULÁRIOS                   */
/* ============================= */

.form-row-contratos {
  display: flex;
  gap: 15px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 150px;
}

.form-field label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.form-field input,
.form-field select,
.form-field textarea {
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
  font-family: inherit;
  transition: border-color 0.2s;
  width: 100%;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102,126,234,0.1);
}

.form-field textarea { resize: vertical; min-height: 60px; }

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 8px;
}

/* ============================= */
/* STATUS MESSAGES               */
/* ============================= */

.status-msg {
  margin-top: 15px;
  padding: 12px 15px;
  border-radius: 8px;
  font-size: 14px;
}

/* ============================= */
/* TEXTO VAZIO                   */
/* ============================= */

.texto-vazio {
  text-align: center;
  padding: 40px 20px;
  color: #6b7280;
  font-size: 15px;
}
.texto-vazio .icone {
  font-size: 48px;
  margin-bottom: 15px;
  opacity: 0.5;
}

/* ============================= */
/* LISTA DE PADRÕES              */
/* ============================= */

.lista-tipos { display: flex; flex-direction: column; gap: 12px; }

.tipo-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
  transition: all 0.2s;
}
.tipo-card:hover { box-shadow: 0 4px 10px rgba(0,0,0,0.08); }

.tipo-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  gap: 12px;
  flex-wrap: wrap;
}

.tipo-nome { font-size: 16px; font-weight: 700; color: #111827; }
.tipo-obra-badge {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 10px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  border-radius: 20px;
  letter-spacing: 0.03em;
}
.tipo-meta { font-size: 12px; color: #6b7280; margin-top: 4px; }
.tipo-acoes { display: flex; gap: 6px; flex-shrink: 0; }

.tipo-etapas { padding: 12px 20px; }
.etapa-preview { margin-bottom: 10px; }
.etapa-preview:last-child { margin-bottom: 0; }
.etapa-preview > strong { font-size: 13px; color: #111827; display: block; margin-bottom: 6px; }

.subetapa-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #eff2ff;
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  padding: 3px 10px;
  font-size: 12px;
  color: #3730a3;
  margin: 2px 4px 2px 0;
}
.subetapa-tag em { color: #667eea; font-style: normal; font-weight: 700; }
.subetapa-tag small { color: #9ca3af; font-size: 10px; margin-left: 4px; }

/* ============================= */
/* FORMULÁRIO DE PADRÃO          */
/* ============================= */

.criterios-section {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 20px;
  background: #f9fafb;
  margin-top: 8px;
  margin-bottom: 16px;
}

.criterios-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 15px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.criterios-header h4 { font-size: 15px; font-weight: 700; color: #111827; margin-bottom: 4px; }

.lista-etapas { display: flex; flex-direction: column; gap: 12px; }

.etapa-form-bloco {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}

.etapa-form-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 15px;
  background: #f3f4f6;
  border-bottom: 1px solid #e5e7eb;
  flex-wrap: wrap;
}

.inp-etapa-nome {
  flex: 1;
  min-width: 180px;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
}
.inp-etapa-nome:focus { outline: none; border-color: #667eea; }

.subetapas-container { padding: 12px; display: flex; flex-direction: column; gap: 8px; }

.subetapa-bloco {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 12px 14px;
}

.subetapa-linha-principal {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.inp-sub-nome {
  flex: 1;
  min-width: 160px;
  padding: 8px 11px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
}
.inp-sub-nome:focus { outline: none; border-color: #667eea; }

.inp-peso {
  width: 80px;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  font-family: inherit;
}
.inp-peso:focus { outline: none; border-color: #667eea; }

.subetapa-aplicacao {
  background: #fff;
  border: 1px solid #e0e7ff;
  border-radius: 6px;
  padding: 10px 12px;
}
.subetapa-aplicacao > label {
  font-size: 11px;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 8px;
}

.sel-aplicacao-tipo {
  padding: 5px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}

.checkboxes-tipos-ap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.check-tipo-ap-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f9fafb;
  border: 1px solid #d1d5db;
  border-radius: 20px;
  padding: 5px 12px;
  cursor: pointer;
  font-size: 12px;
  color: #374151;
  font-weight: 500;
  transition: all 0.15s;
  user-select: none;
}
.check-tipo-ap-item:has(input:checked) {
  background: #eff2ff;
  border-color: #667eea;
  color: #3730a3;
  font-weight: 700;
}
.check-tipo-ap-item input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: #667eea;
  cursor: pointer;
}

.soma-pesos {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 13px;
  margin-top: 12px;
  color: #6b7280;
}
.soma-valor { font-weight: 800; font-size: 16px; color: #111827; }
.soma-status { font-size: 13px; font-weight: 600; }

/* ============================= */
/* TIPOS DE APARTAMENTO          */
/* ============================= */

.grid-tipos-ap {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
  margin-top: 10px;
}

.card-tipo-ap {
  background: #fff;
  border: 2px solid #e5e7eb;
  border-top: 5px solid var(--cor-tipo, #667eea);
  border-radius: 10px;
  padding: 20px;
  transition: all 0.2s;
  position: relative;
}
.card-tipo-ap:hover {
  box-shadow: 0 6px 15px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}

.tipo-ap-nome { font-size: 15px; font-weight: 700; color: #111827; }
.tipo-ap-area { font-size: 12px; color: #6b7280; margin-top: 3px; }
.tipo-ap-qtd {
  font-size: 40px;
  font-weight: 800;
  color: var(--cor-tipo, #667eea);
  line-height: 1;
  margin: 10px 0 3px;
}
.tipo-ap-label {
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ============================= */
/* STEP 2.5 — VÍNCULO INSUMOS    */
/* ============================= */

.resumo-vinculo-insumos{
  border:1px solid #e5e7eb;
  border-radius:10px;
  padding:14px 16px;
  background:#f9fafb;
}

.resumo-vinculo-insumos h4{
  margin:0 0 10px 0;
  font-size:13px;
  font-weight:800;
  color:#111827;
  text-transform:uppercase;
  letter-spacing:0.04em;
}

.resumo-vinculo-insumos .linha{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  padding:8px 0;
  border-bottom:1px dashed #e5e7eb;
  font-size:13px;
}

.resumo-vinculo-insumos .linha:last-child{ border-bottom:none; }

.resumo-vinculo-insumos .crit{
  font-weight:700;
  color:#111827;
  min-width:180px;
  flex:1;
}

.resumo-vinculo-insumos .item{
  color:#374151;
  flex:2;
}

.resumo-vinculo-insumos .preco{
  font-weight:800;
  color:#667eea;
  white-space:nowrap;
  min-width:110px;
  text-align:right;
}

.resumo-vinculo-insumos .hint{
  margin-top:10px;
  font-size:11px;
  color:#9ca3af;
}

.tipo-ap-desc { font-size: 12px; color: #6b7280; margin-top: 8px; }

.acoes-tipo-ap {
  display: flex;
  gap: 6px;
  margin-top: 14px;
  justify-content: flex-end;
}
.btn-editar-ap {
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  padding: 5px 12px;
  cursor: pointer;
}
.btn-editar-ap:hover { background: #dbeafe; }
.btn-excluir-ap {
  background: #fef2f2;
  color: #ef4444;
  font-size: 12px;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
}
.btn-excluir-ap:hover { background: #fee2e2; }

/* ============================= */
/* MEDIÇÃO — STEPS               */
/* ============================= */

.med-step { position: relative; }

.step-header {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  margin-bottom: 20px;
}

.step-numero {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(102,126,234,0.35);
}
.step-header h3 { margin: 0 0 4px; font-size: 17px; color: #111827; font-weight: 700; }

.info-contrato-sel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 8px;
  padding: 15px;
  margin-top: 12px;
}
.info-cs-item { font-size: 13px; color: #111827; }
.info-cs-item strong {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  margin-bottom: 2px;
}

.previa-tipo {
  background: #f0f4ff;
  border: 1px solid #c7d2fe;
  border-radius: 8px;
  padding: 14px 18px;
  margin-top: 14px;
  font-size: 13px;
  color: #1f2937;
  line-height: 1.6;
}

/* ============================= */
/* LEGENDA E ACCORDION MEDIÇÃO   */
/* ============================= */

.legenda-tipos-ap {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
  padding: 12px 15px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  align-items: center;
}
.legenda-tipos-ap:empty { display: none; }

.legenda-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: #374151;
  font-weight: 500;
}
.legenda-cor {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.accordion-medicao { display: flex; flex-direction: column; gap: 12px; }

.etapa-accordion {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.etapa-accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: #f5f7fa;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid #e5e7eb;
  transition: background 0.15s;
  gap: 12px;
  flex-wrap: wrap;
}
.etapa-accordion-header:hover { background: #eef0f6; }

.etapa-acc-titulo { font-weight: 700; color: #111827; font-size: 15px; }
.etapa-acc-progresso { font-size: 12px; color: #6b7280; margin-left: 6px; }
.etapa-acc-peso {
  font-size: 12px;
  color: #667eea;
  font-weight: 700;
  background: #eff2ff;
  padding: 3px 10px;
  border-radius: 10px;
}
.etapa-acc-chevron { font-size: 13px; color: #9ca3af; transition: transform 0.2s; flex-shrink: 0; }
.etapa-accordion.aberta .etapa-acc-chevron { transform: rotate(180deg); }

.etapa-accordion-body { display: none; padding: 15px; }
.etapa-accordion.aberta .etapa-accordion-body { display: block; }

/* ============================= */
/* SUBETAPA CARD NA MEDIÇÃO      */
/* ============================= */

.subetapa-med-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 12px;
  overflow: hidden;
  background: #fff;
}
.subetapa-med-card:last-child { margin-bottom: 0; }

.subetapa-med-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 15px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  gap: 10px;
  flex-wrap: wrap;
}

.subetapa-med-nome { font-weight: 600; color: #374151; font-size: 14px; flex: 1; min-width: 120px; }
.subetapa-med-info { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.badge-peso {
  background: #eff2ff;
  color: #3730a3;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 10px;
}
.badge-ap-tipo {
  font-size: 11px;
  color: #6b7280;
  background: #f3f4f6;
  padding: 2px 8px;
  border-radius: 6px;
}
.badge-valor-calculado {
  font-size: 13px;
  font-weight: 800;
  color: #10b981;
  min-width: 100px;
  text-align: right;
}

.subetapa-med-body { padding: 14px 15px; }

/* ============================= */
/* TABELA DE LANÇAMENTO          */
/* ============================= */

.tabela-lancamento { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabela-lancamento th {
  background: #f3f4f6;
  padding: 8px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid #e5e7eb;
}
.tabela-lancamento td { padding: 10px 12px; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
.tabela-lancamento tr:last-child td { border-bottom: none; }
.tabela-lancamento tr:hover td { background: #fafbff; }

.legenda-cor-inline {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
  margin-right: 6px;
  vertical-align: middle;
}

.inp-qtd-medida {
  width: 90px;
  padding: 7px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  font-family: inherit;
  transition: border-color 0.15s;
}
.inp-qtd-medida:focus { outline: none; border-color: #667eea; box-shadow: 0 0 0 2px rgba(102,126,234,0.1); }
.inp-qtd-medida.invalido { border-color: #ef4444; background: #fef2f2; }
.td-qtd-total { color: #6b7280; font-weight: 500; }
.td-perc { font-weight: 700; color: #3730a3; }
.td-valor-ap { font-weight: 700; color: #10b981; }

/* ─── Vista de Prédio (Edificio Lancamento) ─────────────────────── */
.edificio-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Container horizontal das torres */
.edificio-torres-container {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 4px;
}

/* Uma torre completa */
.edificio-torre-secao {
  flex: 1;
  min-width: 220px;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

/* Cabeçalho da torre */
.edificio-torre-secao-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
}
.edificio-torre-secao-nome {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.edificio-torre-secao-acoes {
  display: flex;
  align-items: center;
  gap: 8px;
}
.edificio-torre-secao-prog {
  font-size: 11px;
  opacity: 0.85;
}
.chk-torre-tudo {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  background: rgba(255,255,255,0.2);
  border-radius: 4px;
  padding: 2px 6px;
  transition: background 0.15s;
}
.chk-torre-tudo:hover { background: rgba(255,255,255,0.35); }
.chk-torre-tudo input { width: 13px; height: 13px; cursor: pointer; accent-color: #fff; }

/* Andares dentro de cada torre */
.edificio-torre-andares {
  max-height: 720px;
  overflow-y: auto;
}

.edificio-col-andares {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}


/* Cada andar */
.edificio-andar {
  display: grid;
  grid-template-columns: 62px 1fr auto;
  align-items: center;
  gap: 0;
  border-bottom: 1px solid #f0f1f5;
  transition: background 0.15s;
}
.edificio-andar:last-child { border-bottom: none; }
.edificio-andar:hover { background: #fafbff; }
.edificio-andar--estrutural { opacity: 0.45; }
.edificio-andar--estrutural-base {
  opacity: 0.6;
  background: #f9fafb;
  border-top: 2px solid #d1d5db;
}
.edificio-andar--estrutural-base .edificio-andar-label {
  background: #f3f4f6;
  border-right-color: #d1d5db;
}
.edificio-andar--estrutural-base .edificio-andar-abrev {
  color: #9ca3af;
  font-size: 9px;
  letter-spacing: 0;
}
.edificio-andar--completo   { background: #f0fdf4; }
.edificio-andar--parcial    { background: #fffbeb; }

/* Label esquerdo (número do andar + indicador) */
.edificio-andar-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 6px;
  border-right: 2px solid #e5e7eb;
  background: #f8f9ff;
  height: 100%;
  min-width: 54px;
  width: 54px;
}
.edificio-andar--completo .edificio-andar-label { background: #dcfce7; border-right-color: #86efac; }
.edificio-andar--parcial  .edificio-andar-label { background: #fef9c3; border-right-color: #fde047; }

.edificio-andar-abrev {
  font-size: 11px;
  font-weight: 700;
  color: #374151;
  letter-spacing: -0.3px;
  text-align: center;
  line-height: 1;
}

/* Checkbox do pavimento (substitui indicador circular) */
.chk-andar-label {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 2px;
}
/* Checkbox de pavimento — quadrado, bem visível inclusive no Android */
.chk-andar-pav {
  appearance: none !important;
  -webkit-appearance: none !important;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  border: 2.5px solid #d1d5db;
  background: #fff;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: all 0.15s;
  display: block;
}
.chk-andar-pav:hover { border-color: #667eea; background: #eef2ff; }
.chk-andar-pav:checked {
  background: #22c55e !important;
  border-color: #16a34a !important;
}
.chk-andar-pav:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -52%);
  font-size: 12px;
  color: #fff;
  font-weight: 900;
  line-height: 1;
}
.chk-andar-pav.edificio-andar-indicador--parcial {
  border-color: #f59e0b !important;
  background: #fef3c7 !important;
}
.chk-andar-pav.edificio-andar-indicador--parcial::after {
  content: '~';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -52%);
  font-size: 13px;
  color: #92400e;
  font-weight: 900;
  line-height: 1;
}
.chk-andar-pav.edificio-andar-indicador--completo {
  background: #22c55e !important;
  border-color: #16a34a !important;
}
.chk-andar-pav.edificio-andar-indicador--vazio {
  background: #fff !important;
  border-color: #d1d5db !important;
}

/* Manter por compatibilidade (outros usos do indicador visual) */
.edificio-andar-indicador {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #d1d5db;
  background: #fff;
  flex-shrink: 0;
}
.edificio-andar-indicador--vazio    { background: #fff;    border-color: #d1d5db; }
.edificio-andar-indicador--parcial  { background: #fbbf24; border-color: #f59e0b; }
.edificio-andar-indicador--completo { background: #22c55e; border-color: #16a34a; }


/* Conteúdo central: inputs de tipologias */
.edificio-andar-content {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 5px 10px;
}

/* Cada tipologia dentro do andar — agrupa torre(s) */
.edificio-tip-grupo {
  display: flex;
  align-items: flex-start;
  gap: 3px;
  padding: 2px 0;
}
.edificio-tip-torres {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 6px;
}
/* Bloco de uma torre (label + input/max) */
.edificio-torre-bloco {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.edificio-torre-label {
  font-size: 9px;
  color: #9ca3af;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1;
  white-space: nowrap;
  max-width: 52px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.edificio-torre-input-row {
  display: flex;
  align-items: center;
  gap: 2px;
}
/* Manter compatibilidade com antigos .edificio-tip-input */
.edificio-tip-input {
  display: flex;
  align-items: center;
  gap: 3px;
}
.inp-qtd-pav {
  width: 42px;
  padding: 3px 4px;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  font-size: 12px;
  text-align: center;
  background: #f9fafb;
  color: #111;
  transition: border-color 0.15s, background 0.15s;
}
.inp-qtd-pav:focus {
  outline: none;
  border-color: #667eea;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(102,126,234,0.12);
}
.inp-qtd-pav.invalido { border-color: #ef4444; background: #fef2f2; }
.edificio-tip-max {
  font-size: 10px;
  color: #9ca3af;
  white-space: nowrap;
  cursor: help;
}

/* Resumo direita (progresso e anterior) */
.edificio-andar-resumo {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding: 5px 10px 5px 6px;
  min-width: 58px;
}
.edificio-andar-progresso {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  white-space: nowrap;
}
.edificio-andar-progresso.ok { color: #16a34a; }
.edificio-andar-ant {
  font-size: 10px;
  color: #9ca3af;
  white-space: nowrap;
}

/* Tabela-legenda de tipologias abaixo do prédio */
.edificio-legenda {
  margin-top: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  font-size: 12px;
}
.edificio-legenda-header,
.edificio-legenda-linha {
  display: grid;
  grid-template-columns: 14px 1fr 54px 54px 60px 52px 80px;
  gap: 0 8px;
  align-items: center;
  padding: 6px 10px;
}
.edificio-legenda-header {
  background: #f3f4f6;
  font-weight: 600;
  color: #6b7280;
  font-size: 11px;
  border-bottom: 1px solid #e5e7eb;
}
.edificio-legenda-linha {
  border-bottom: 1px solid #f3f4f6;
  color: #374151;
}
.edificio-legenda-linha:last-child { border-bottom: none; }
.edificio-legenda-linha:hover { background: #fafbff; }
.edificio-legenda-nome {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.edificio-legenda-stat {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #6b7280;
}
#acum-tip-\3a { color: #3730a3; font-weight: 700; }
[id^="acum-tip-"] { color: #3730a3; font-weight: 700; }
[id^="perc-ap-"]  { color: #7c3aed; font-weight: 700; }
[id^="vlr-ap-"]   { color: #059669; font-weight: 700; }



/* Barra mini */
.barra-mini-wrapper { margin-top: 10px; padding: 10px 12px; background: #f9fafb; border-radius: 6px; }
.barra-mini-label { display: flex; justify-content: space-between; font-size: 12px; color: #6b7280; margin-bottom: 5px; }
.barra-mini { height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; }
.barra-mini-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea, #764ba2);
  border-radius: 4px;
  transition: width 0.35s ease;
}

/* ============================= */
/* RESUMO — STEP 4               */
/* ============================= */

.resumo-medicao-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.resumo-med-item {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 15px;
  text-align: center;
}
.resumo-med-item.destaque {
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-color: transparent;
}
.resumo-med-item.destaque .resumo-med-label { color: rgba(255,255,255,0.8); }
.resumo-med-item.destaque .resumo-med-valor { color: white; font-size: 1.35rem; }

.resumo-med-label { display: block; font-size: 11px; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 5px; }
.resumo-med-valor { display: block; font-size: 1.2rem; font-weight: 800; color: #111827; }

/* Barra de progresso total */
.barra-progresso-wrapper {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 20px;
}
.barra-progresso-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #6b7280;
  font-weight: 600;
  margin-bottom: 8px;
}
.barra-progresso-total {
  height: 22px;
  background: #e5e7eb;
  border-radius: 11px;
  overflow: hidden;
  display: flex;
}
.barra-seg { height: 100%; transition: width 0.5s ease; }
.barra-seg.anterior { background: linear-gradient(90deg, #10b981, #059669); }
.barra-seg.atual    { background: linear-gradient(90deg, #667eea, #764ba2); }
.barra-progresso-valores {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: #374151;
  margin-top: 8px;
}

/* ============================= */
/* HISTÓRICO DE MEDIÇÕES         */
/* ============================= */

.historico-medicoes { display: flex; flex-direction: column; gap: 10px; }

.historico-medicao-card {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  transition: box-shadow 0.2s;
}
.historico-medicao-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }

.historico-med-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  flex-wrap: wrap;
  gap: 12px;
}

.hist-med-titulo { font-weight: 700; color: #111827; font-size: 15px; }
.hist-med-data { font-size: 12px; color: #6b7280; margin-top: 2px; }

.hist-med-valores { display: flex; gap: 20px; flex-wrap: wrap; }
.hist-med-valor-item { text-align: center; }
.hist-med-valor-item span:first-child { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: #9ca3af; font-weight: 600; margin-bottom: 2px; }
.hist-med-valor-item span:last-child { font-size: 14px; font-weight: 800; color: #111827; }

.hist-med-acoes { display: flex; gap: 6px; flex-shrink: 0; }

.historico-med-body { padding: 12px 20px; }
.historico-med-criterios { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.crit-hist-item { font-size: 12px; padding: 4px 10px; background: #f3f4f6; border-radius: 6px; color: #374151; }
.crit-hist-item .crit-perc { font-weight: 700; color: #667eea; margin-left: 5px; }

/* ============================= */
/* MODAIS                        */
/* ============================= */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  animation: fadeIn 0.2s forwards;
}

@keyframes fadeIn { to { opacity: 1; } }

.modal-card {
  background: white;
  width: 95%;
  max-width: 650px;
  max-height: 90vh;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
  animation: slideUp 0.3s ease-out;
  margin: 20px;
  border-right: 6px solid var(--primary);
}

.modal-card.modal-lg { max-width: 950px; }

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-header {
  padding: 20px 25px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border-radius: 12px 12px 0 0;
}
.modal-header h3 { margin: 0; font-size: 18px; color: white; }

.btn-fechar-modal {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: white;
  line-height: 1;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s;
}
.btn-fechar-modal:hover { background: rgba(255,255,255,0.2); }

.modal-body { padding: 25px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 20px 25px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #f9fafb;
  border-radius: 0 0 12px 12px;
}

.analise-cabecalho {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 18px;
}
.analise-cab-item { font-size: 13px; color: #374151; }
.analise-cab-item strong { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: #6b7280; margin-bottom: 2px; }

/* ============================= */
/* LOADING                       */
/* ============================= */

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.85);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 15px;
  backdrop-filter: blur(2px);
}
.loading-content { text-align: center; }
.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #e5e7eb;
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-content p { color: #6b7280; font-size: 14px; font-weight: 500; }

/* ============================= */
/* RESPONSIVO                    */
/* ============================= */

@media (max-width: 900px) {
  .secao-contratos { padding: 20px 15px; }
  #contratos-header { padding: 15px; }
  .titulo-modulo { font-size: 22px; }
  .resumo-saldos { grid-template-columns: repeat(2, 1fr); }
  .resumo-medicao-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-tipos-ap { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

@media (max-width: 600px) {
  #submenu-contratos { flex-direction: column; }
  .sub-btn { width: 100%; }
  .form-row-contratos { flex-direction: column; }
  .cabecalho-saldos { flex-direction: column; align-items: flex-start; }
  .acoes-saldos { width: 100%; }
  .inp-filtro { width: 100%; min-width: unset; }
  .modal-card { width: 98%; margin: 10px; max-height: 95vh; }
  .hist-med-valores { width: 100%; justify-content: space-between; }
  .historico-med-header { flex-direction: column; }
}

/* ============================= */
/* TIPOLOGIAS — STATS            */
/* ============================= */

.tipologias-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.tip-stat-card {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  padding: 18px;
  border-radius: 8px;
  text-align: center;
  border: 1px solid #e5e7eb;
  transition: all 0.2s;
}
.tip-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
  border-color: #667eea;
}

.tip-stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: #667eea;
  margin-bottom: 4px;
  line-height: 1;
}

.tip-stat-label {
  font-size: 12px;
  color: #6b7280;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ============================= */
/* TIPOLOGIAS — MODAL FORM       */
/* ============================= */

.tip-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.tip-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tip-full-width { grid-column: 1 / -1; }

.tip-form-group label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.tip-form-group input,
.tip-form-group select,
.tip-form-group textarea {
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: white;
  transition: border-color 0.2s;
  width: 100%;
}
.tip-form-group input:focus,
.tip-form-group select:focus,
.tip-form-group textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102,126,234,0.1);
}
.tip-form-group textarea { resize: vertical; min-height: 60px; }

.tip-selection-display {
  margin-top: 4px;
  padding: 6px 10px;
  background: #f0f9ff;
  border-left: 3px solid #3b82f6;
  border-radius: 4px;
  font-size: 12px;
  color: #1e40af;
  font-weight: 500;
  min-height: 24px;
}

/* ============================= */
/* TIPOLOGIAS — CÁLCULO AUTO     */
/* ============================= */

.tip-calculo {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  padding: 18px 20px;
  border-radius: 10px;
  border: 2px solid #3b82f6;
}

.tip-calculo h4 {
  margin: 0 0 14px 0;
  color: #1e40af;
  font-size: 14px;
  font-weight: 700;
}

.tip-calculo-formula {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.tip-calculo-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 70px;
}

.tip-calculo-total {
  min-width: 140px;
  padding: 6px 12px;
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  border-radius: 8px;
}

.tip-calculo-label {
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.tip-calculo-valor {
  font-size: 1.6rem;
  font-weight: 700;
  color: #1e40af;
}

.tip-calculo-total .tip-calculo-valor { font-size: 1.4rem; color: #1e3a8a; }

.tip-calculo-op {
  font-size: 1.4rem;
  font-weight: 700;
  color: #3b82f6;
}

/* ============================= */
/* TIPOLOGIAS — BTN ICON         */
/* ============================= */

.btn-icon-tip {
  background: transparent;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: all 0.15s;
}
.btn-icon-tip:hover { background: #f3f4f6; transform: scale(1.1); }

@media (max-width: 900px) {
  .tipologias-stats { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  .tipologias-stats { grid-template-columns: 1fr 1fr; }
  .tip-calculo-formula { flex-direction: column; gap: 6px; }
  .tip-calculo-op { transform: rotate(90deg); }
}

/* ============================================================
   CRITÉRIO DE MEDIÇÃO — SUBETAPA FORM
   ============================================================ */

.subetapa-criterio-secao {
  background: #f0f4ff;
  border: 1px solid #c7d2fe;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.criterio-secao-titulo {
  font-size: 11px;
  font-weight: 700;
  color: #4338ca;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 10px;
}

.criterio-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 8px;
}

.criterio-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 160px;
}

.criterio-field-sm {
  flex: 0 0 120px;
  min-width: 100px;
}

.criterio-field label {
  font-size: 11px;
  font-weight: 600;
  color: #4b5563;
  white-space: nowrap;
}

.criterio-field label small {
  font-weight: 400;
  color: #9ca3af;
  margin-left: 4px;
}

.inp-criterio-sel {
  padding: 7px 10px;
  border: 1px solid #c7d2fe;
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  background: #fff;
  cursor: pointer;
}
.inp-criterio-sel:focus { outline: none; border-color: #667eea; box-shadow: 0 0 0 2px rgba(102,126,234,0.12); }

.inp-criterio-num {
  padding: 7px 10px;
  border: 1px solid #c7d2fe;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  width: 100%;
  box-sizing: border-box;
}
.inp-criterio-num:focus { outline: none; border-color: #667eea; box-shadow: 0 0 0 2px rgba(102,126,234,0.12); }

.inp-criterio-txt {
  padding: 7px 10px;
  border: 1px solid #c7d2fe;
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  flex: 1;
  min-width: 140px;
}
.inp-criterio-txt:focus { outline: none; border-color: #667eea; }

.criterio-detalhe-box {
  background: #fff;
  border: 1px solid #e0e7ff;
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 8px;
}

.criterio-detalhe-titulo {
  font-size: 11px;
  font-weight: 700;
  color: #6366f1;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

/* Linhas por APARTAMENTO */
.criterio-apto-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid #f3f4f6;
  flex-wrap: wrap;
}
.criterio-apto-row:last-child { border-bottom: none; }

.criterio-apto-label {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  min-width: 140px;
}

.criterio-apto-total {
  font-size: 11px;
  color: #9ca3af;
  white-space: nowrap;
  min-width: 60px;
  text-align: right;
}

/* Container de torres (um ou mais) */
.criterio-torres-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: flex-start;
}

/* Uma coluna = uma torre */
.criterio-torre-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.criterio-torre-nome {
  font-size: 9px;
  font-weight: 700;
  color: #6366f1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.criterio-apto-inp-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.criterio-apto-inp-wrap .inp-criterio-num,
.criterio-torre-col .inp-criterio-num {
  width: 80px;
}

.criterio-apto-unit {
  font-size: 11px;
  color: #6b7280;
  white-space: nowrap;
}


.criterio-apto-total-calc {
  font-size: 11px;
  font-weight: 700;
  color: #667eea;
  white-space: nowrap;
  min-width: 100px;
  text-align: right;
}

/* ── Restrições de acesso ────────────────────── */
.criterio-restricoes-box {
  border-color: #fde68a;
  background: #fffdf0;
}
.criterio-restricoes-box .criterio-detalhe-titulo {
  color: #d97706;
}
.restricoes-tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.restricao-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1.5px solid #d1d5db;
  background: #f9fafb;
  font-size: 12px;
  color: #6b7280;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s;
}
.restricao-tag input[type="checkbox"] { display: none; }
.restricao-tag:hover {
  border-color: #f59e0b;
  color: #92400e;
  background: #fef3c7;
}
.restricao-tag--ativa {
  border-color: #f59e0b;
  background: #fef3c7;
  color: #92400e;
  font-weight: 600;
}
.restricao-tag--ativa::before { content: '✓ '; }
.restricao-outros-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.restricao-outros-label {
  font-size: 11px;
  color: #9ca3af;
  white-space: nowrap;
}
.inp-restricao-outros {
  flex: 1;
  padding: 4px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 12px;
  color: #374151;
  background: #fff;
}
.inp-restricao-outros:focus {
  outline: none;
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245,158,11,0.15);
}

/* Badge de restrições na view de medição */
.medicao-restricoes-badge {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}
.restricao-badge-item {
  font-size: 11px;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  border-radius: 12px;
  padding: 2px 10px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.restricao-badge-item:hover { background: #fde68a; }
.restricao-badge-item em { font-style: normal; opacity: 0.7; }
.restricao-badge--impede {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
}
.restricao-badge--impede:hover { background: #fca5a5; }

/* Input restrito */
.inp-restrito {
  background: #fff7ed !important;
  border-color: #fb923c !important;
}
.legenda-cor.restrito {
  outline: 2px solid #ef4444;
  outline-offset: 1px;
}

/* ── Modal de configuração de restrição ── */
.modal-restricao-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-restricao-box {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 640px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.modal-restricao-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}
.modal-restricao-header button {
  background: rgba(255,255,255,0.25);
  border: none;
  color: #fff;
  border-radius: 6px;
  padding: 3px 8px;
  cursor: pointer;
  font-size: 14px;
}
.modal-restricao-body {
  padding: 16px 18px;
  max-height: 60vh;
  overflow-y: auto;
}
.modal-restricao-subtitulo {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 10px;
}
.modal-restricao-aptos {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.restricao-modal-apto {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #374151;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  transition: background 0.1s;
}
.restricao-modal-apto:hover { background: #fef3c7; }
.restricao-modal-apto input { accent-color: #f59e0b; }
.modal-restricao-impede {
  background: #fff7ed;
  border: 1.5px solid #fed7aa;
  border-radius: 8px;
  padding: 10px 12px;
}
.restricao-impede-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: #92400e;
  cursor: pointer;
}
.restricao-impede-label input { accent-color: #ef4444; flex-shrink: 0; margin-top: 2px; }
.modal-restricao-nota {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 5px;
  margin-left: 22px;
}
.modal-restricao-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid #f3f4f6;
}

.criterio-lado-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #f3f4f6;
  flex-wrap: wrap;
}
.criterio-lado-row:last-child { border-bottom: none; }

.btn-sm-add {
  margin-top: 10px;
  padding: 6px 14px;
  font-size: 12px;
  border-radius: 6px;
}

.criterio-aviso {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 12px;
  color: #92400e;
  margin-top: 6px;
}

.inp-peso-label {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  white-space: nowrap;
}

/* Badge de critério na lista de padrões */
.subetapa-criterio-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #eff2ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-left: 6px;
  vertical-align: middle;
}

@media (max-width: 600px) {
  .criterio-row { flex-direction: column; }
  .criterio-field-sm { flex: 1 0 auto; }
  .criterio-apto-row { flex-direction: column; align-items: flex-start; }
}

/* ============================================================
   BANNER DE CÓPIA DE CRITÉRIO
   ============================================================ */

.banner-copia-criterio {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1.5px solid #38bdf8;
  border-left: 4px solid #0ea5e9;
  border-radius: 8px;
  padding: 10px 14px;
  margin: 8px 0;
  animation: bannerSlideIn 0.25s ease-out;
  flex-wrap: wrap;
}

@keyframes bannerSlideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.banner-copia-icone {
  font-size: 20px;
  flex-shrink: 0;
}

.banner-copia-texto {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 160px;
}

.banner-copia-texto strong {
  font-size: 12px;
  font-weight: 700;
  color: #0369a1;
}

.banner-copia-texto span {
  font-size: 11px;
  color: #0284c7;
}

.banner-copia-texto em {
  font-style: normal;
  font-weight: 700;
  background: #bae6fd;
  border-radius: 4px;
  padding: 0 4px;
}

.banner-copia-acoes {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.banner-copia-btn-sim {
  padding: 6px 14px;
  background: #0ea5e9;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.banner-copia-btn-sim:hover { background: #0284c7; }

.banner-copia-btn-nao {
  padding: 6px 10px;
  background: transparent;
  color: #64748b;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.banner-copia-btn-nao:hover { background: #f1f5f9; color: #374151; }

/* Flash de sucesso */
.flash-sucesso-criterio {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  border: 1px solid #6ee7b7;
  border-left: 4px solid #10b981;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #065f46;
  margin-bottom: 12px;
  animation: bannerSlideIn 0.2s ease-out, flashFadeOut 2.8s ease forwards;
}

@keyframes flashFadeOut {
  0%   { opacity: 1; }
  70%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ============================================================
   RESUMO DE QUANTIDADES — CARD DE PADRÃO
   ============================================================ */

.tipo-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
  color: #6b7280;
  margin-top: 4px;
}

.tipo-meta-sep {
  color: #d1d5db;
  font-weight: 400;
}

/* Chip de quantidade total no resumo do card */
.resumo-qtd-chip {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

/* Badge de quantidade dentro de cada subetapa-tag */
.subetapa-qtd-badge {
  display: inline-flex;
  align-items: center;
  background: #e0e7ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 700;
  margin-left: 4px;
  white-space: nowrap;
  vertical-align: middle;
}

/* ============================================================
   PAVIMENTOS — CHECKBOXES DE SELEÇÃO
   ============================================================ */

.pav-check-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.pav-grupo {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 10px;
  min-width: 120px;
}

.pav-grupo-titulo {
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.pav-check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  flex-wrap: wrap;
}

.pav-check-apto-badge {
  font-size: 10px;
  color: #6366f1;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 10px;
  padding: 1px 7px;
  white-space: nowrap;
  cursor: help;
  flex-shrink: 0;
}

.pav-check-row--sel {
  background: #eff6ff;
  border-radius: 6px;
  padding: 4px 8px;
  margin: 2px -8px;
}

.pav-check-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 12px;
  color: #374151;
  font-weight: 500;
  user-select: none;
  white-space: nowrap;
}

.pav-check-row--sel .pav-check-label {
  color: #1d4ed8;
  font-weight: 700;
}

.pav-check-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: #3b82f6;
}

.pav-check-qtd {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
}

.pav-check-qtd .inp-criterio-num {
  width: 80px;
  padding: 4px 8px;
  font-size: 12px;
}

.pav-resumo {
  font-size: 12px;
  font-weight: 600;
  color: #16a34a;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  padding: 6px 12px;
  margin-bottom: 8px;
}

.pav-resumo--vazio {
  color: #92400e;
  background: #fffbeb;
  border-color: #fde68a;
}

.btn-pav-sel-todos,
.btn-pav-sel-nenhum {
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid;
  transition: all 0.15s;
}

.btn-pav-sel-todos {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}
.btn-pav-sel-todos:hover { background: #dbeafe; }

.btn-pav-sel-nenhum {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}
.btn-pav-sel-nenhum:hover { background: #fee2e2; }

.btn-pav-add-lado {
  margin-top: 10px;
  padding: 5px 12px;
  font-size: 11px;
  background: transparent;
  color: #6b7280;
  border: 1px dashed #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.btn-pav-add-lado:hover { border-color: #667eea; color: #667eea; background: #f5f3ff; }

/* ── Finais de Apartamentos no modal de tipologia ── */
.finais-container {
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fafafa;
}
.finais-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
  min-height: 28px;
}
.tag-final {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px 3px 10px;
  background: #dbeafe;
  color: #1e40af;
  border: 1.5px solid #93c5fd;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  font-family: monospace;
}
.tag-final button {
  background: none;
  border: none;
  color: #1e40af;
  cursor: pointer;
  font-size: 12px;
  padding: 0 0 0 2px;
  line-height: 1;
  opacity: 0.6;
}
.tag-final button:hover { opacity: 1; color: #dc2626; }
.finais-input-row {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}
.finais-input-row input {
  flex: 1;
  border: 1.5px solid #d1d5db;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
}
.finais-input-row input:focus { outline: none; border-color: #667eea; }
.btn-add-final {
  padding: 6px 14px;
  background: #667eea;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn-add-final:hover { background: #5b72d4; }
.btn-sugestao-final {
  padding: 3px 10px;
  font-size: 11px;
  border: 1.5px solid #d1d5db;
  background: #f9fafb;
  border-radius: 12px;
  cursor: pointer;
  margin-right: 4px;
  color: #374151;
}
.btn-sugestao-final:hover { background: #dbeafe; border-color: #93c5fd; color: #1e40af; }
.btn-sugestao-danger { border-color: #fca5a5; color: #dc2626; }
.btn-sugestao-danger:hover { background: #fee2e2; border-color: #f87171; }

/* ── Resumo único por critério ───────────────────────────── */
#resumoCriteriosCard {
  margin-top: 0;
  border-top: 3px solid #667eea;
}
#resumoCriteriosCard .step-numero {
  background: #10b981;
  font-size: 14px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#resumoCriteriosTabela {
  overflow-x: auto;
}
#resumoCriteriosTabela table {
  min-width: 640px;
}
#resumoCriteriosTabela tbody tr:hover {
  background: #f0f4ff !important;
}

/* ── Toggle de critérios no accordion de medição ───────────── */
.controles-accordion-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f8f9ff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 12px;
}

.btn-toggle-all {
  padding: 5px 14px;
  border: 1.5px solid #667eea;
  border-radius: 20px;
  background: #fff;
  color: #667eea;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-toggle-all:hover {
  background: #667eea;
  color: #fff;
}

.controles-accordion-hint {
  font-size: 11px;
  color: #9ca3af;
  margin-left: 4px;
}

.subetapa-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ede9fe;
  color: #7c3aed;
  font-size: 10px;
  font-weight: 700;
  margin-left: 6px;
  flex-shrink: 0;
  transition: transform 0.2s, background 0.15s;
  pointer-events: none; /* clique vai pro header inteiro */
}

.subetapa-med-header:hover .subetapa-toggle-btn {
  background: #7c3aed;
  color: #fff;
}

/* Animação suave ao recolher */
.subetapa-med-body {
  overflow: hidden;
  transition: max-height 0.25s ease;
}

/* ── Toggle da tabela de tipologias ─────────────────────── */
.edificio-legenda-wrap {
  margin-top: 6px;
}

.btn-toggle-legenda {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border: 1.5px solid #e5e7eb;
  border-radius: 6px 6px 0 0;
  background: #f8f9ff;
  color: #6b7280;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background 0.15s, color 0.15s;
  border-bottom: none;
}
.btn-toggle-legenda:hover {
  background: #ede9fe;
  color: #7c3aed;
  border-color: #c4b5fd;
}
.toggle-legenda-chevron {
  margin-left: auto;
  font-size: 10px;
}

/* Quando a legenda está oculta, o botão fecha as bordas */
.btn-toggle-legenda.fechado {
  border-radius: 6px;
  border-bottom: 1.5px solid #e5e7eb;
}

/* Separador e labels na barra de controles */
.controles-separador {
  color: #d1d5db;
  font-size: 16px;
  margin: 0 2px;
}
.controles-grupo-label {
  font-size: 11px;
  color: #9ca3af;
  font-weight: 600;
  white-space: nowrap;
}
.btn-toggle-tip {
  border-color: #10b981 !important;
  color: #10b981 !important;
}
.btn-toggle-tip:hover {
  background: #10b981 !important;
  color: #fff !important;
}

/* ── Valores de medições anteriores ─────────────────────── */

/* Coluna "Ant." na tabela de tipologias */
/* Valor anterior na coluna Ant. da tabela de tipologias */
.val-anterior {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: #64748b;
  font-size: 11px;
  font-weight: 500;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 1px 7px;
}
.val-anterior::before {
  content: "↩";
  font-size: 10px;
  color: #94a3b8;
}

/* Badge "ant:X" no canto de cada andar no prédio */
.edificio-andar-ant {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  color: #64748b;
  font-style: normal;
  font-weight: 500;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 1px 5px;
  margin-top: 2px;
  white-space: nowrap;
}

/* Input pré-preenchido com valor da medição anterior */
.inp-valor-anterior {
  background: #f0f4ff !important;
  color: #64748b !important;
  border-color: #93c5fd !important;
  border-style: dashed !important;
  font-style: italic;
  box-shadow: none !important;
}
.inp-valor-anterior::placeholder {
  color: #cbd5e1;
}
/* Tooltip visual: mostrar "período anterior" no hover */
.inp-valor-anterior:hover {
  background: #e0e7ff !important;
  border-color: #6366f1 !important;
}
/* Ao focar — limpa o estilo de anterior para edição livre */
.inp-valor-anterior:focus {
  background: #fff !important;
  color: #1e293b !important;
  font-style: normal;
  border-color: #667eea !important;
  border-style: solid !important;
  box-shadow: 0 0 0 2px rgba(102,126,234,0.15) !important;
}

/* ══════════════════════════════════════════════════════════════
   STEP 1 — BUSCA DE CONTRATO REDESENHADA
══════════════════════════════════════════════════════════════ */
.contrato-busca-bar {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.contrato-busca-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 140px;
}
.contrato-busca-field label {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.contrato-busca-field select,
.contrato-busca-field input {
  height: 38px;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 13px;
  color: #374151;
  background: #fff;
  transition: border-color 0.15s;
}
.contrato-busca-field select:focus,
.contrato-busca-field input:focus {
  border-color: #667eea;
  outline: none;
  box-shadow: 0 0 0 3px rgba(102,126,234,0.12);
}
.contrato-search-wrap {
  position: relative;
}
.contrato-search-wrap input {
  width: 100%;
  padding-right: 32px;
  box-sizing: border-box;
}
.contrato-search-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  pointer-events: none;
  opacity: 0.5;
}
.contrato-busca-counter {
  min-width: 80px;
  max-width: 120px;
}
.contrato-contador {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 12px;
  background: #f3f4f6;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #6b7280;
  white-space: nowrap;
}

/* ── Lista filtrada de contratos ── */
.contrato-lista-filtrada {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 320px;
  overflow-y: auto;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  background: #fafbff;
  padding: 6px;
  margin-bottom: 12px;
}
.contrato-lista-filtrada:empty {
  display: none;
}
.contrato-item-linha {
  display: grid;
  grid-template-columns: 130px 1fr auto auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #fff;
  border: 1.5px solid #e5e7eb;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  font-size: 13px;
}
.contrato-item-linha:hover {
  border-color: #667eea;
  background: #f5f3ff;
  box-shadow: 0 2px 8px rgba(102,126,234,0.10);
}
.contrato-item-linha.selecionado {
  border-color: #667eea;
  background: #ede9fe;
}
.contrato-item-num {
  font-weight: 700;
  font-family: monospace;
  font-size: 12px;
  color: #374151;
  background: #f3f4f6;
  padding: 3px 7px;
  border-radius: 5px;
  white-space: nowrap;
}
.contrato-item-forn {
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.contrato-item-obra {
  font-size: 11px;
  color: #6b7280;
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}
.contrato-item-saldo {
  font-weight: 700;
  color: #059669;
  font-size: 12px;
  white-space: nowrap;
}
.contrato-item-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #dbeafe;
  color: #1d4ed8;
  white-space: nowrap;
}
.contrato-item-empty {
  text-align: center;
  padding: 24px;
  color: #9ca3af;
  font-size: 13px;
}

/* ── Chip do contrato selecionado ── */
.contrato-selecionado-bar {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: #ede9fe;
  border: 1.5px solid #c4b5fd;
  border-radius: 10px;
  margin-bottom: 12px;
}
.contrato-sel-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1.5px solid #c4b5fd;
  border-radius: 8px;
  padding: 6px 10px;
  min-width: 220px;
}
.chip-num {
  font-weight: 700;
  font-family: monospace;
  font-size: 13px;
  color: #7c3aed;
}
.chip-forn {
  font-size: 12px;
  color: #374151;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.chip-clear {
  background: none;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  font-size: 14px;
  padding: 0 2px;
  line-height: 1;
  transition: color 0.15s;
}
.chip-clear:hover { color: #ef4444; }
.contrato-selecionado-bar .form-field {
  margin: 0;
}
.contrato-selecionado-bar .form-field label {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  display: block;
  margin-bottom: 4px;
}
.contrato-selecionado-bar .form-field input {
  height: 36px;
  border: 1.5px solid #c4b5fd;
  border-radius: 7px;
  padding: 0 10px;
  font-size: 13px;
  background: #fff;
}

/* ══════════════════════════════════════════════════════════════
   VIEW MODE TOGGLE (Tipologia / Por Final / Compacto)
══════════════════════════════════════════════════════════════ */
.view-mode-toggle {
  display: flex;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  background: #f3f4f6;
}
.view-mode-btn {
  padding: 5px 12px;
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.view-mode-btn + .view-mode-btn {
  border-left: 1.5px solid #e5e7eb;
}
.view-mode-btn.active {
  background: #667eea;
  color: #fff;
}
.view-mode-btn:hover:not(.active) {
  background: #e0e7ff;
  color: #4f46e5;
}

/* ── Modo compacto: andares menores ── */
.edificio-mode-compacto .edificio-andar {
  min-height: 0 !important;
}
.edificio-mode-compacto .inp-qtd-pav {
  width: 30px !important;
  height: 24px !important;
  font-size: 11px !important;
  padding: 0 2px !important;
}
.edificio-mode-compacto .edificio-tip-max {
  font-size: 10px !important;
}
.edificio-mode-compacto .edificio-andar-abrev {
  font-size: 9px !important;
}
.edificio-mode-compacto .edificio-andar-resumo {
  flex-direction: column;
  gap: 1px;
}
.edificio-mode-compacto .edificio-torre-andares {
  max-height: 900px !important;
}

/* ── Modo finais: grid de apartamentos por final ── */
.edificio-mode-finais .edificio-torre-andares {
  max-height: 900px !important;
}
.finais-andar-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-bottom: 1px solid #f1f5f9;
  min-height: 32px;
}
.finais-andar-row:hover { background: #fafbff; }
.finais-andar-row.completo { background: #f0fdf4; }
.finais-andar-row.parcial  { background: #fffbeb; }
.finais-andar-label {
  width: 32px;
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  color: #6b7280;
  text-align: center;
}
.finais-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  flex: 1;
}
.final-ap-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 26px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all 0.12s;
  user-select: none;
  position: relative;
}
.final-ap-chip.livre {
  background: #f3f4f6;
  color: #9ca3af;
  border-color: #e5e7eb;
}
.final-ap-chip.medido {
  background: #d1fae5;
  color: #065f46;
  border-color: #6ee7b7;
}
.final-ap-chip.anterior {
  background: #f1f5f9;
  color: #94a3b8;
  border-color: #e2e8f0;
  font-style: italic;
}
.final-ap-chip.medido.anterior {
  background: #d1fae5;
  color: #065f46;
  border-color: #6ee7b7;
}
.final-ap-chip:hover {
  transform: scale(1.08);
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  z-index: 2;
}
.final-ap-chip[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #fff;
  font-size: 10px;
  padding: 3px 7px;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 100;
  pointer-events: none;
}
.finais-andar-resumo {
  font-size: 10px;
  color: #9ca3af;
  white-space: nowrap;
  margin-left: 4px;
}
.finais-check-all {
  width: 18px;
  height: 18px;
  cursor: pointer;
  flex-shrink: 0;
  accent-color: #667eea;
}


/* ── Modal Restrição: seções Torre + Andar ── */
.restricao-modal-secao {
  margin-bottom: 14px;
}
.restricao-modal-secao-titulo {
  font-size: 12px;
  font-weight: 700;
  color: #92400e;
  background: #fef3c7;
  border-radius: 6px;
  padding: 4px 10px;
  margin-bottom: 8px;
  border-left: 3px solid #f59e0b;
}
.modal-restricao-andares {
  max-height: 200px;
  overflow-y: auto;
  flex-direction: row;
  flex-wrap: wrap;
}
.modal-restricao-andares .restricao-modal-apto {
  flex: 0 0 calc(50% - 4px);
  font-size: 12px;
  padding: 4px 8px;
}
.restricao-torres-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}
.restricao-torre-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1.5px solid #d1d5db;
  background: #f9fafb;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}
.restricao-torre-chip:hover { background: #fef3c7; border-color: #f59e0b; }
.restricao-torre-chip input { accent-color: #f59e0b; }
.restricao-torre-chip:has(input:checked) { background: #fef9c3; border-color: #f59e0b; color: #92400e; }
.restricao-torre-config {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.restricao-torre-config-header {
  font-size: 13px;
  font-weight: 700;
  color: #1e40af;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid #dbeafe;
}
.rconf-bloco {
  margin-bottom: 10px;
}
.rconf-bloco-titulo {
  font-size: 11px;
  font-weight: 700;
  color: #92400e;
  background: #fef3c7;
  border-radius: 5px;
  padding: 3px 8px;
  margin-bottom: 6px;
  border-left: 3px solid #f59e0b;
  display: inline-block;
}
.modal-restricao-andares {
  max-height: 150px;
  overflow-y: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.modal-restricao-andares .restricao-modal-apto {
  flex: 0 0 calc(33.333% - 4px);
  font-size: 12px;
  padding: 4px 8px;
}
.restricao-finais-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.restricao-final-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1.5px solid #e5e7eb;
  background: #f9fafb;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
  min-width: 44px;
  justify-content: center;
}
.restricao-final-chip:hover { background: #fef3c7; border-color: #f59e0b; }
.restricao-final-chip input { accent-color: #f59e0b; }
.restricao-final-chip:has(input:checked) { background: #fef9c3; border-color: #f59e0b; color: #92400e; }
/* Tipologia input restrito */
.edificio-tip-restrito-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.inp-restrito-icone {
  font-size: 14px;
  opacity: 0.7;
}
.btn-liberar-apto {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  border: 1px solid #fca5a5;
  background: #fff1f2;
  color: #dc2626;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.1s;
}
.btn-liberar-apto:hover { background: #fee2e2; }
/* Chip de final restrito */
.final-ap-chip.restrito-final {
  background: #fff1f2 !important;
  border-color: #fca5a5 !important;
  color: #dc2626 !important;
  cursor: pointer;
  font-size: 10px;
  opacity: 0.85;
}
.final-ap-chip.restrito-final:hover { opacity: 1; background: #fee2e2 !important; }
.btn-mini-sel {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  color: #374151;
  cursor: pointer;
}
.btn-mini-sel:hover { background: #e5e7eb; }

/* Botão ＋ Restrição inline */
.btn-add-restricao-inline {
  display:inline-flex;align-items:center;gap:4px;padding:3px 10px;
  border-radius:20px;border:1.5px dashed #6366f1;background:#f5f3ff;
  color:#6366f1;font-size:11px;font-weight:600;cursor:pointer;margin-left:4px;
}
.btn-add-restricao-inline:hover{background:#ede9fe;}

/* Badge extra (adicionado na medição) */
.restricao-badge--extra{background:#fef3c7!important;border-color:#f59e0b!important;color:#92400e!important;}
.btn-remover-restricao-extra{
  display:inline-flex;align-items:center;justify-content:center;
  width:14px;height:14px;border-radius:50%;border:none;
  background:#fca5a5;color:#7f1d1d;font-size:9px;font-weight:700;
  cursor:pointer;margin-left:3px;padding:0;vertical-align:middle;
}
.btn-remover-restricao-extra:hover{background:#f87171;}

/* Input com bloqueio parcial de finais */
.inp-parcial-restricao{border-color:#f59e0b!important;background:#fffbeb!important;}

/* Footer modal "aplicar a todos" */
.restricao-todos-criterios-label{
  display:flex;align-items:flex-start;gap:8px;font-size:12px;color:#374151;
  background:#f0f9ff;border:1px solid #bae6fd;border-radius:8px;padding:8px 12px;cursor:pointer;
}
.restricao-todos-criterios-label input{accent-color:#0284c7;margin-top:2px;flex-shrink:0;}
.restricao-todos-criterios-label:has(input:checked){background:#e0f2fe;border-color:#0284c7;}

/* ============================================================
   MEDIÇÃO POR PAVIMENTO — Tabela de Lançamento
   ============================================================ */

.pav-lancamento-wrapper {
  padding: 0;
}

.pav-lancamento-summary {
  display: flex;
  gap: 24px;
  align-items: center;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: linear-gradient(135deg, #f0f4ff 0%, #f5f0ff 100%);
  border-radius: 10px 10px 0 0;
  border: 1px solid #e8eaf6;
  border-bottom: none;
}

.pav-sum-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pav-sum-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6b7280;
}

.pav-sum-val {
  font-size: 14px;
  font-weight: 700;
  color: #374151;
}

.pav-sum-perc {
  font-size: 18px;
  font-weight: 800;
  color: #667eea;
}

/* Tabela */
.pav-med-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0 0 10px 10px;
  overflow: hidden;
}

.pav-med-header th {
  padding: 10px 12px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
  border-bottom: none;
  white-space: nowrap;
}

.pav-med-header .pav-med-col-pav {
  text-align: left;
  min-width: 120px;
}

.pav-med-row {
  border-bottom: 1px solid #f3f4f6;
  transition: background 0.15s;
}

.pav-med-row:hover { background: #f8faff; }

.pav-med-row--completo { background: #f0fdf4 !important; }
.pav-med-row--completo:hover { background: #ecfdf5 !important; }
.pav-med-row--parcial  { background: #fffbeb !important; }
.pav-med-row--parcial:hover  { background: #fef9e7 !important; }

.pav-med-col-pav {
  padding: 8px 12px;
  font-weight: 700;
  color: #374151;
  white-space: nowrap;
  border-right: 2px solid #e5e7eb;
  background: #f9fafb;
}

.pav-med-abrev {
  display: inline-block;
  background: #667eea;
  color: #fff;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 700;
  margin-right: 6px;
  min-width: 24px;
  text-align: center;
}

.pav-med-pav-full {
  font-size: 11px;
  color: #6b7280;
  font-weight: 400;
}

.pav-med-col-lado {
  text-align: center;
  padding: 8px 10px;
  min-width: 100px;
  color: #fff;
  font-weight: 600;
}

.pav-med-col-qtd {
  text-align: center;
  padding: 8px 12px;
  min-width: 130px;
}

.pav-med-col-total,
.pav-med-col-prev {
  text-align: right;
  padding: 8px 12px;
  color: #6b7280;
  font-size: 12px;
  white-space: nowrap;
}

.pav-med-col-total {
  font-weight: 700;
  color: #374151;
}

.pav-med-col-status {
  padding: 8px 10px;
  text-align: center;
  width: 32px;
}

.pav-med-cell {
  padding: 6px 8px;
  text-align: center;
}

.inp-qtd-pav-lado {
  width: 80px;
  padding: 6px 8px;
  border: 1.5px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  color: #374151;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fff;
}

.inp-qtd-pav-lado:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
}

.inp-qtd-pav-lado:not(:placeholder-shown) {
  border-color: #10b981;
  background: #f0fdf4;
}

/* Indicador de status (bolinha) */
.pav-med-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #d1d5db;
}

.pav-med-dot--ok      { background: #10b981; border-color: #10b981; }
.pav-med-dot--parcial { background: #f59e0b; border-color: #f59e0b; }
.pav-med-dot--vazio   { background: #fff;    border-color: #d1d5db; }

/* Seletor de obras nos saldos */
#filtroObraSaldos {
  min-width: 200px;
}

/* ── Pavimentos Especiais: toggle "Dividir por lados" ── */
.pav-check-row--especial {
  border-left: 3px solid #f59e0b;
  border-radius: 6px;
}
.pav-check-row--especial.pav-check-row--sel {
  border-left: 3px solid #f59e0b;
  background: #fffbeb;
}
.pav-especial-toggle-lados {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 10px;
  padding: 2px 8px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.pav-especial-toggle-lados input[type="checkbox"] {
  width: 12px;
  height: 12px;
  accent-color: #f59e0b;
  cursor: pointer;
}
.pav-especial-lados-config {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  width: 100%;
}
.pav-lado-especial-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 6px;
  padding: 4px 8px;
}
.pav-lado-nome {
  font-size: 11px;
  font-weight: 600;
  color: #92400e;
  white-space: nowrap;
  min-width: 50px;
}

/* ── Coluna de marcar pavimento como executado ── */
.pav-med-col-marcar {
  width: 36px;
  text-align: center;
  padding: 0 4px;
}
.btn-pav-marcar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #d1d5db;
  background: #fff;
  color: #9ca3af;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1;
  padding: 0;
}
.btn-pav-marcar:hover {
  border-color: #10b981;
  color: #10b981;
  background: #f0fdf4;
}
.btn-pav-marcar--ok {
  background: #10b981;
  border-color: #10b981;
  color: #fff;
}
.btn-pav-marcar--ok:hover {
  background: #ef4444;
  border-color: #ef4444;
  color: #fff;
}

/* ── Célula sem lado (especial geral em tabela com lados) ── */
.pav-med-cell--sem-lado {
  text-align: center;
  color: #d1d5db;
  font-size: 12px;
}
.inp-qtd-pav-geral {
  width: 90px;
}

/* ── Badge especial na tabela de medição ── */
.pav-esp-badge {
  display: inline-block;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 10px;
  font-weight: 700;
  margin-right: 4px;
}

/* ── Botão Por Pavimento: cor específica ── */
#btnViewPavimento.active {
  background: #10b981;
  color: #fff;
}

/* ═══════════════════════════════════════════════════════════════
   PAV2 — Layout prático de critério por pavimento
   ═══════════════════════════════════════════════════════════════ */

.pav2-wrapper {
  border: 1.5px solid #c7d2fe;
  border-radius: 10px;
  overflow: hidden;
  margin-top: 10px;
  background: var(--color-background-primary);
}

/* ── TOP BAR: unidade + critério + conversor em linha ── */
.pav2-topbar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 14px;
  background: var(--color-background-secondary);
  border-bottom: 1px solid var(--color-border-tertiary);
  flex-wrap: wrap;
}
.pav2-field {
  flex: 1;
  min-width: 130px;
}
.pav2-resumo-badge {
  font-size: 11px;
  font-weight: 600;
  color: #16a34a;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  padding: 6px 11px;
  white-space: nowrap;
  align-self: flex-end;
  flex-shrink: 0;
}
.pav2-resumo-badge.pav2-resumo-inline--vazio {
  color: #92400e;
  background: #fffbeb;
  border-color: #fde68a;
}

/* ── BULK FILL BAR ── */
.pav2-bulkbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: #eff6ff;
  border-bottom: 1.5px solid #bfdbfe;
  flex-wrap: wrap;
}
.pav2-bulk-label {
  font-size: 11px;
  font-weight: 600;
  color: #1d4ed8;
  white-space: nowrap;
}
.pav2-bulk-inp {
  width: 100px;
  font-size: 12px;
  padding: 5px 8px;
  border: 1px solid #93c5fd;
  border-radius: 6px;
  background: #fff;
  color: #1e3a8a;
  text-align: right;
  font-family: inherit;
}
.pav2-bulk-unit {
  font-size: 11px;
  color: #3b82f6;
  white-space: nowrap;
}
.pav2-bulk-btn {
  padding: 5px 14px;
  background: #1d4ed8;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  white-space: nowrap;
  transition: background .15s;
}
.pav2-bulk-btn:hover { background: #1e40af; }
.pav2-bulk-hint {
  font-size: 10px;
  color: #3b82f6;
}
.pav2-sel-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  color: #1d4ed8;
  white-space: nowrap;
}

/* ── SPLIT: prédio esquerda / lados direita ── */
.pav2-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

/* ── COLUNA ESQUERDA: PRÉDIO ── */
.pav2-building-col {
  border-right: 1px solid var(--color-border-tertiary);
  display: flex;
  flex-direction: column;
}
.pav2-building-scroll {
  overflow-y: auto;
  max-height: 400px;
  scrollbar-width: thin;
  scrollbar-color: #c7d2fe transparent;
}
.pav2-building-scroll::-webkit-scrollbar { width: 4px; }
.pav2-building-scroll::-webkit-scrollbar-thumb { background: #c7d2fe; border-radius: 4px; }

.pav2-grupo-lbl {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 6px 12px 4px;
  background: var(--color-background-secondary);
  border-bottom: 0.5px solid var(--color-border-tertiary);
  border-top: 0.5px solid var(--color-border-tertiary);
}

.pav2-row {
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 0.5px solid var(--color-border-tertiary);
  cursor: pointer;
  transition: background .1s;
  padding: 0 10px 0 0;
  min-height: 34px;
}
.pav2-row:hover { background: var(--color-background-secondary); }
.pav2-row--sel { background: #eff6ff; }
.pav2-row--sel:hover { background: #dbeafe; }
.pav2-row--esp { }
.pav2-row--esp .pav2-label span { font-size: 11px; color: var(--color-text-secondary); }
.pav2-row--esp.pav2-row--sel .pav2-label span { color: #1d4ed8; }

.pav2-label {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-size: 12px;
  color: var(--color-text-primary);
  font-weight: 500;
  user-select: none;
  white-space: nowrap;
  padding: 8px 4px 8px 10px;
  flex: 1;
}
.pav2-row--sel .pav2-label { color: #1d4ed8; }
.pav2-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: #3b82f6;
  flex-shrink: 0;
}

.pav2-badge {
  font-size: 9.5px;
  color: #6366f1;
  background: #eef2ff;
  border: 0.5px solid #c7d2fe;
  border-radius: 8px;
  padding: 1px 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.pav2-qtd-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.pav2-inp-qtd {
  width: 82px;
  font-size: 11px;
  padding: 4px 6px;
  border: 1px solid #93c5fd;
  border-radius: 5px;
  background: #fff;
  color: #1e3a8a;
  text-align: right;
  font-family: inherit;
}
.pav2-inp-qtd:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 2px #bfdbfe; }

.pav2-toggle-lados {
  font-size: 10px;
  color: #6b7280;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}
.pav2-toggle-lados input { width: 12px; height: 12px; }

.pav2-lados-esp {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 4px 0;
}
.pav2-lado-esp-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.pav2-lado-esp-nome {
  font-size: 10px;
  color: #6b7280;
  min-width: 52px;
}

.pav2-shift-hint {
  font-size: 10px;
  color: var(--color-text-secondary);
  text-align: center;
  padding: 5px 10px;
  background: var(--color-background-secondary);
  border-top: 0.5px solid var(--color-border-tertiary);
}

/* ── COLUNA DIREITA: LADOS/SETORES ── */
.pav2-config-col {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pav2-section-lbl {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 4px;
}
.pav2-lados-desc {
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
}
.pav2-lados-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pav2-lado-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 6px;
  border-bottom: 0.5px solid var(--color-border-tertiary);
}
.pav2-lado-nome {
  flex: 1;
}
.pav2-lado-qtd {
  width: 90px;
  text-align: right;
}
.pav2-btn-add-lado {
  width: 100%;
  font-size: 11px;
  padding: 7px;
  background: transparent;
  color: var(--color-text-secondary);
  border: 0.5px dashed var(--color-border-secondary);
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  margin-top: 4px;
  transition: all .15s;
}
.pav2-btn-add-lado:hover { border-color: #6366f1; color: #6366f1; }

/* ── Responsivo ── */
@media (max-width: 860px) {
  .pav2-split { grid-template-columns: 1fr; }
  .pav2-building-col { border-right: none; border-bottom: 1px solid var(--color-border-tertiary); }
  .pav2-building-scroll { max-height: 300px; }
  .pav2-topbar { gap: 8px; }
}
