:root {
  --cor-primaria: #4a8cff;
  --cor-primaria-escura: #2f6fe0;
}
* { box-sizing: border-box; }
body {
  font-family: Arial, Helvetica, sans-serif;
  margin: 0;
  background: #f4f5f7;
  color: #1f2430;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #1f2430;
  color: #fff;
  padding: 16px 24px;
}
.topbar .logo { height: 56px; }
.topbar h1 { margin: 0; font-size: 18px; }
.topbar p { margin: 2px 0 0; font-size: 12px; color: #b8bcc8; }

.tabs {
  display: flex;
  background: #2c3140;
  padding: 0 24px;
}
.tab-btn {
  background: none;
  border: none;
  color: #cfd2dc;
  padding: 14px 18px;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 3px solid transparent;
}
.tab-btn.active {
  color: #fff;
  border-bottom-color: var(--cor-primaria);
}
.tab-btn-oculta { display: none; }

.secao-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.secao-header h2 { margin: 0; }
.link-voltar {
  background: none;
  border: none;
  color: var(--cor-primaria-escura);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  margin-bottom: 16px;
  text-decoration: underline;
}

main { max-width: 960px; margin: 24px auto; padding: 0 16px 84px; }

.tab-content { display: none; background: #fff; padding: 24px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.tab-content.active { display: block; }

h2 { margin-top: 0; }

.inline-add { display: flex; gap: 6px; }
.inline-add select { flex: 1; }
.inline-add button {
  background: var(--cor-primaria);
  color: #fff;
  width: 36px;
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}
.inline-add button:hover { background: var(--cor-primaria-escura); }

.inline-add-box { display: flex; gap: 6px; margin-top: 6px; }
.inline-add-box input { flex: 1; }
.inline-add-box.hidden { display: none; }
.hidden { display: none; }

button.small { padding: 6px 12px; font-size: 13px; }
button.primary.small { background: var(--cor-primaria); color: #fff; }
button.small:not(.primary) { background: #e2e4ea; }

.selecao-bar { display: flex; gap: 8px; margin-bottom: 12px; }
.linha-selecionada { background: #eaf1ff; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; }
.field { display: flex; flex-direction: column; margin-bottom: 12px; }
.field label { font-size: 12px; font-weight: bold; color: #555; margin-bottom: 4px; text-transform: uppercase; }
input, select, textarea {
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
}

table { width: 100%; border-collapse: collapse; margin: 16px 0; }
th, td { border: 1px solid #e2e4ea; padding: 8px; font-size: 13px; text-align: left; }
th { background: #f0f1f5; }

button { border: none; border-radius: 4px; cursor: pointer; }
button.primary {
  background: var(--cor-primaria);
  color: #fff;
  padding: 10px 18px;
  font-size: 14px;
  margin-top: 12px;
}
button.primary:hover { background: var(--cor-primaria-escura); }

#btn-add-item {
  background: #e2e4ea;
  padding: 8px 14px;
  font-size: 13px;
}

.total-line { font-size: 18px; font-weight: bold; text-align: right; margin: 16px 0; }

.resumo-total {
  text-align: right;
  font-size: 13px;
  color: #666;
  margin-top: 12px;
}
.resumo-total div { margin-bottom: 2px; }
.resumo-total .resumo-desconto { color: #d9534f; }
.resumo-total .resumo-juros { color: #b8860b; }

.icon-btn {
  background: none;
  color: #d9534f;
  font-size: 13px;
  padding: 4px 8px;
}

.link-btn {
  background: none;
  color: var(--cor-primaria-escura);
  font-size: 13px;
  padding: 4px 8px;
  text-decoration: underline;
}

.status-aberta { color: #b8860b; font-weight: bold; }
.status-recebida { color: #2e8b57; font-weight: bold; }
.status-cancelada { color: #d9534f; font-weight: bold; text-decoration: line-through; }

.hint { color: #666; font-size: 13px; margin-top: -8px; margin-bottom: 16px; }

.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: bold;
}
.status-pill.status-pendente { background: #fff3cd; color: #8a6500; }
.status-pill.status-atendida { background: #d4edda; color: #1e7e34; }
.status-pill.status-cancelada { background: #f1f1f3; color: #888; text-decoration: line-through; }

.prioridade-urgente { color: #d9534f; font-weight: bold; }
.prioridade-normal { color: #555; }

.filter-bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-chip {
  background: #eef0f4;
  color: #444;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  border: 1px solid transparent;
}
.filter-chip:hover { background: #e2e4ea; }
.filter-chip.active {
  background: #2c3140;
  color: #fff;
}
.filter-chip .count {
  display: inline-block;
  margin-left: 4px;
  font-weight: bold;
  opacity: 0.8;
}

.search-box { width: 100%; margin-bottom: 12px; }

.historico-row td {
  background: #f8f9fb;
  padding: 10px 16px;
  font-size: 12px;
}
.historico-row ul { margin: 0; padding-left: 18px; }
.historico-row li { margin-bottom: 2px; }

.fin-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 20px 0;
}
.fin-card {
  background: #f8f9fb;
  border: 1px solid #e2e4ea;
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fin-card-label { font-size: 12px; color: #666; text-transform: uppercase; font-weight: bold; }
.fin-card-valor { font-size: 22px; font-weight: bold; color: #1f2430; }
.fin-card-valor.negativo { color: #d9534f; }
.fin-card-valor.positivo { color: #2e8b57; }

.tabs-sub { display: flex; gap: 8px; margin: 20px 0 12px; flex-wrap: wrap; }

.grid-unidades {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin: 16px 0;
}
.unidade-card {
  border: 2px solid #999;
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}
.unidade-card .num { font-weight: bold; font-size: 14px; }
.unidade-card select { width: 100%; margin-top: 6px; font-size: 12px; padding: 4px; }
.unidade-card textarea { width: 100%; margin-top: 6px; font-size: 12px; padding: 4px; resize: vertical; }

/* Fase da obra: fundo sólido e colorido, bem destacado */
.unidade-card.fase-em_construcao { background: #fff3cd; border-color: #e6a400; }
.unidade-card.fase-concluida { background: #dbe9ff; border-color: #2f6fe0; }
.unidade-card.fase-entregue { background: #d7f5e3; border-color: #1f9d55; }

/* Pendência sempre domina visualmente, mesmo por cima da cor de fase */
.unidade-card.tem-pendencia { border-color: #d9534f; box-shadow: 0 0 0 2px #d9534f inset; }

.unidade-topo { display: flex; justify-content: space-between; align-items: center; gap: 4px; }
.badge-vendida {
  background: #7b2ff7;
  color: #fff;
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 999px;
}
.unidade-card.eh-vendida { box-shadow: 0 0 0 2px #7b2ff7 inset; }
.unidade-card.eh-vendida.tem-pendencia { box-shadow: 0 0 0 2px #7b2ff7 inset, 0 0 0 4px #d9534f inset; }

.check-vendida { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: bold; margin-top: 6px; cursor: pointer; }

.select-fase { font-weight: bold; }

.evolucao-linha { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.evolucao-linha input { width: 55px; padding: 3px; font-size: 12px; }
.evolucao-linha span { font-size: 11px; color: #555; }

.barra-evolucao { height: 6px; background: rgba(0,0,0,0.12); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.barra-evolucao-preenchida { height: 100%; background: #1f9d55; }

.aviso-pendencia { display: block; margin-top: 6px; font-size: 12px; font-weight: bold; color: #a4262c; }

.lista-simples { margin: 0; padding-left: 20px; }
.lista-simples li { margin-bottom: 6px; }

.vg-view h3 { margin-top: 28px; }

td.negativo, span.negativo { color: #d9534f; }
td.positivo, span.positivo { color: #2e8b57; }

.classe-abc {
  display: inline-block;
  width: 22px;
  height: 22px;
  line-height: 22px;
  text-align: center;
  border-radius: 50%;
  font-weight: bold;
  font-size: 12px;
  color: #fff;
}
.classe-abc.classe-a { background: #d9534f; }
.classe-abc.classe-b { background: #e6a400; }
.classe-abc.classe-c { background: #6c8bd9; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 22, 30, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: #fff;
  border-radius: 8px;
  padding: 24px;
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}

.rodape-iceng {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 500;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  background: #f4f5f7;
  border-top: 1px solid #e2e4ea;
  opacity: 0.6;
}
.rodape-iceng:hover { opacity: 1; }
.rodape-iceng-logo { height: 20px; width: auto; }
.rodape-iceng p {
  margin: 0;
  font-size: 11px;
  color: #666;
  letter-spacing: 0.2px;
}
