:root {
  --cor-primaria: #c1272d;
  --cor-secundaria: #2e6b4f;
  --cinza-fundo: #f4f4f5;
  --cinza-borda: #e2e2e4;
  --cinza-texto: #444;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: #222;
  background: #fff;
}
#app { display: flex; min-height: 100vh; }
.oculto { display: none !important; }

/* ---------- TELA DE LOGIN ---------- */
.tela-login {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #fafafa 0%, #eee 100%);
}
.card-login {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.12);
  padding: 40px 36px;
  width: 360px;
}
.card-login h1 {
  font-size: 20px;
  margin: 6px 0 2px;
  color: var(--cor-secundaria);
  letter-spacing: 1px;
}
.card-login p.sub { color: #888; margin: 0 0 24px; font-size: 13px; }
.logo-marca { font-weight: 800; font-size: 22px; color: var(--cor-primaria); letter-spacing: 1px; }
.campo { margin-bottom: 16px; }
.campo label { display: block; font-size: 12px; color: #666; margin-bottom: 5px; font-weight: 600; }
.campo input {
  width: 100%; padding: 11px 12px; border: 1px solid #ccc; border-radius: 6px; font-size: 14px;
}
.campo input:focus { outline: none; border-color: var(--cor-primaria); }
.btn-primario {
  width: 100%; padding: 12px; border: none; border-radius: 6px;
  background: var(--cor-primaria); color: #fff; font-weight: 700; font-size: 14px; cursor: pointer;
  transition: opacity .15s;
}
.btn-primario:hover { opacity: .9; }
.btn-secundario {
  padding: 10px 18px; border-radius: 6px; border: 1px solid var(--cor-primaria);
  background: #fff; color: var(--cor-primaria); font-weight: 700; cursor: pointer; font-size: 13px;
}
.erro-msg { background: #fdecea; color: #b3261e; padding: 10px 12px; border-radius: 6px; font-size: 13px; margin-bottom: 14px; }
.dica-login { margin-top: 18px; font-size: 11px; color: #999; line-height: 1.5; }

/* ---------- LAYOUT PRINCIPAL (SIDEBAR + CONTEUDO) ---------- */
.layout {
  display: flex;
  width: 100%;
  min-height: 100vh;
}
.sidebar {
  width: 260px;
  min-width: 260px;
  border-right: 1px solid var(--cinza-borda);
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  background: #fff;
}
.sidebar .logo-empreendimento { max-width: 160px; max-height: 60px; object-fit: contain; margin-bottom: 14px; display: block; }
.sidebar .marca { font-size: 22px; font-weight: 800; color: var(--cor-primaria); margin-bottom: 22px; }
.sidebar .nome-empreendimento {
  font-family: 'Aptos', 'Aptos Display', 'Segoe UI', Calibri, Arial, sans-serif;
  font-weight: 600;
  color: var(--cor-secundaria);
  font-size: 26px;
  line-height: 1.15;
  margin-bottom: 30px;
}
.info-linha {
  display: flex; align-items: center; gap: 10px; font-size: 13px; color: #333; margin-bottom: 12px;
}
.info-linha .ic { width: 18px; text-align: center; color: #555; }
.sidebar-sep { border: none; border-top: 1px solid var(--cinza-borda); margin: 20px 0; }
.nav-lateral { display: flex; flex-direction: column; gap: 4px; margin-bottom: auto; }
.nav-lateral button {
  display: flex; align-items: center; gap: 10px;
  background: none; border: none; text-align: left; padding: 9px 4px; font-size: 13px; font-weight: 600;
  color: #333; cursor: pointer; border-radius: 6px;
}
.nav-lateral button:hover { background: var(--cinza-fundo); }
.nav-lateral button.botao-sair { color: #b3261e; margin-top: 10px; border-top: 1px solid var(--cinza-borda); padding-top: 14px; border-radius: 0; }
.nav-lateral button.botao-sair:hover { background: #fdecea; }

.totais {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--cinza-borda);
  font-size: 13px;
}
.totais .linha-ambiente { display: flex; justify-content: space-between; color: #555; margin-bottom: 4px; }
.totais .valor-total-label { font-size: 12px; color: #777; margin-top: 10px; }
.totais .valor-total-num { font-size: 22px; font-weight: 800; color: var(--cor-secundaria); }
.totais .parcelamento { font-size: 11px; color: #888; margin-top: 4px; line-height: 1.4; }

.conteudo { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ---------- BARRA DE AMBIENTES ---------- */
.barra-ambientes {
  display: flex; gap: 6px; padding: 16px 20px; overflow-x: auto; border-bottom: 1px solid var(--cinza-borda);
}
.pill-ambiente {
  display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 76px;
  padding: 8px 6px; border-radius: 8px; cursor: pointer; border: none; background: none; color: #555; font-size: 11px;
}
.pill-ambiente .icone-circulo {
  width: 42px; height: 42px; border-radius: 50%; background: #f0f0f0; display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.pill-ambiente.ativo { color: var(--cor-primaria); font-weight: 700; }
.pill-ambiente.ativo .icone-circulo { background: var(--cor-primaria); color: #fff; }

/* ---------- BARRA DE CATEGORIAS ---------- */
.barra-categorias { display: flex; gap: 8px; padding: 12px 20px; flex-wrap: wrap; }
.pill-categoria {
  padding: 8px 16px; border-radius: 20px; border: 1px solid var(--cinza-borda); background: #fafafa;
  font-size: 12px; font-weight: 600; color: #555; cursor: pointer;
}
.pill-categoria.ativo { background: #555; color: #fff; border-color: #555; }

/* ---------- CONFIGURADOR ---------- */
.configurador { display: flex; flex: 1; gap: 0; padding: 0 20px 20px; min-height: 0; }
.lista-opcoes { width: 260px; min-width: 220px; overflow-y: auto; padding-right: 12px; max-height: 640px; }
.opcao-card {
  border: 2px solid var(--cinza-borda); border-radius: 8px; padding: 8px; margin-bottom: 12px; cursor: pointer; position: relative;
}
.opcao-card.selecionada { border-color: var(--cor-primaria); }
.opcao-card .rotulo { font-size: 11px; font-weight: 700; color: #666; margin-bottom: 6px; text-transform: uppercase; }
.opcao-card.selecionada .rotulo { color: var(--cor-primaria); }
.swatch { height: 62px; border-radius: 5px; margin-bottom: 6px; }
.opcao-card .preco { font-size: 12px; font-weight: 700; color: #333; text-align: center; }
.opcao-card .preco.gratis { color: #2e6b4f; }
.opcao-card.bloqueada { opacity: .45; cursor: not-allowed; }
.cadeado-opcao { position: absolute; top: 6px; right: 6px; font-size: 14px; background: #fff; border-radius: 50%; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.aviso-trava { margin: 0 20px 12px; padding: 9px 12px; background: #fdf3e3; color: #8a6116; border-radius: 6px; font-size: 12.5px; }

.galeria-ambiente { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.galeria-item { width: 74px; cursor: pointer; text-align: center; }
.galeria-item img, .galeria-swatch, .galeria-mais {
  width: 74px; height: 56px; border-radius: 6px; object-fit: cover; border: 2px solid transparent;
}
.galeria-mais {
  background: var(--cinza-fundo, #f4f4f6); display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #999; border: 2px dashed #ccc; box-sizing: border-box;
}
.galeria-item.ativa img, .galeria-item.ativa .galeria-swatch, .galeria-item.ativa .galeria-mais { border-color: var(--cor-primaria); }
.galeria-item.galeria-vazia { opacity: .8; }
.galeria-rotulo { display: block; font-size: 10px; color: #777; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.galeria-preco { display: block; font-size: 10.5px; font-weight: 700; color: #333; }
.galeria-preco.gratis { color: #2e6b4f; }

.preview { flex: 1; display: flex; flex-direction: column; min-width: 0; }
/* Altura fixa em vez de "flex:1 + min-height": antes as fotos vinham em
   proporcoes variadas (geralmente mais largas que altas) e cabiam "por
   sorte"; com o recorte quadrado (1:1) das opcoes, uma altura que so cresce
   com o conteudo deixava a area de visualizacao maior que a tela. O clamp()
   limita a altura a uma faixa confortavel (nunca menor que 340px, nunca
   maior que 580px), proporcional a tela, sem depender da proporcao da foto. */
.preview-imagem {
  height: clamp(340px, 52vh, 580px); border-radius: 8px; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 15px; text-align: center; padding: 20px; position: relative;
}
.preview-rodape {
  background: var(--cinza-fundo); border-radius: 0 0 8px 8px; padding: 12px 16px; font-size: 13px;
}
.preview-rodape .titulo { font-weight: 700; margin-bottom: 4px; }
.preview-rodape .obs { font-size: 11px; color: #888; margin-top: 6px; }

.acoes-rodape {
  display: flex; justify-content: flex-end; align-items: center; gap: 10px; padding: 14px 20px;
}
.btn-nav-circular {
  width: 52px; height: 52px; border-radius: 50%; border: none; background: var(--cor-primaria); color: #fff;
  font-size: 20px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.btn-nav-circular.secundario { background: #ccc; }
.btn-nav-circular:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- RESUMO ---------- */
.pagina { padding: 30px 40px; max-width: 900px; margin: 0 auto; width: 100%; }
.pagina h2 { color: var(--cor-secundaria); }
.tabela-ambiente { margin-bottom: 22px; border: 1px solid var(--cinza-borda); border-radius: 8px; overflow: hidden; }
.tabela-ambiente .cabecalho-ambiente {
  background: var(--cinza-fundo); padding: 10px 14px; font-weight: 700; font-size: 13px; display: flex; justify-content: space-between;
}
.tabela-ambiente table { width: 100%; border-collapse: collapse; font-size: 12px; }
.tabela-ambiente th, .tabela-ambiente td { padding: 8px 14px; text-align: left; border-top: 1px solid var(--cinza-borda); }
.tabela-ambiente th { color: #777; font-size: 11px; text-transform: uppercase; }
.total-geral {
  display: flex; justify-content: space-between; align-items: center; padding: 18px 0; font-size: 18px; font-weight: 800;
  border-top: 2px solid #333; margin-top: 10px;
}

/* ---------- FINALIZAR ---------- */
.bloco-finalizar { max-width: 420px; margin: 40px auto; text-align: center; }
.bloco-finalizar select { width: 100%; padding: 10px; border-radius: 6px; border: 1px solid #ccc; font-size: 14px; margin: 8px 0 18px; }
.aviso { font-size: 12px; color: #b3261e; margin: 14px 0; }

.tela-confirmacao { display: flex; align-items: center; justify-content: center; min-height: 100vh; text-align: center; padding: 20px; }
.tela-confirmacao .caixa { max-width: 420px; }
.tela-confirmacao .check { font-size: 46px; color: var(--cor-secundaria); }

@media (max-width: 800px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; }
  .configurador { flex-direction: column; }
  .lista-opcoes { width: 100%; display: flex; overflow-x: auto; max-height: none; }
  .opcao-card { min-width: 150px; }
}
