:root {
  --navy-900: #0f2f50;
  --navy-800: #123a62;
  --navy-700: #195693;
  --navy-500: #5090d0;
  --navy-100: #eaf0f6;
  --navy-50: #f4f7fb;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --text: #16243a;
  --muted: #5d6b80;
  --line: #dfe5ee;
  --yellow: #fff7c2;
  --yellow-line: #e8d76a;
  --yellow-focus: #fff1a0;
  --green: #127a4a;
  --green-bg: #e7f6ee;
  --red: #b42318;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 36, 64, .06), 0 4px 16px rgba(16, 36, 64, .05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
}
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* Topo */
.topo {
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
  color: #fff;
  padding: 0 16px 72px;
}
.barra {
  max-width: 1200px; margin: 0 auto; height: 64px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.marca {
  color: #fff; text-decoration: none; font-weight: 800; font-size: 14px;
  letter-spacing: .08em; text-transform: uppercase;
}
.barra-direita { display: flex; align-items: center; margin-left: auto; }
.btn-barra {
  color: #fff; text-decoration: none; font-weight: 700; font-size: 14px;
  padding: 8px 18px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .45);
}
.btn-barra:hover { background: rgba(255, 255, 255, .12); border-color: #fff; }

.perfil { position: relative; display: flex; align-items: center; gap: 12px; }
.acesso-ate { font-size: 12px; color: #b9d2ee; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .6);
  background: var(--navy-500); color: #fff; font-weight: 800; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0;
}
.avatar:hover, .avatar[aria-expanded="true"] { border-color: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, .2); }
.avatar-grande { width: 44px; height: 44px; font-size: 16px; cursor: default; border-color: var(--navy-100); flex: none; }
.menu-perfil {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 20; width: 280px;
  background: var(--surface); color: var(--text); border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(15, 47, 80, .25); padding: 16px;
}
.menu-topo { display: flex; gap: 12px; align-items: center; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.menu-topo strong { display: block; }
.menu-topo span { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.menu-dados { margin: 0; padding: 12px 0; border-bottom: 1px solid var(--line); display: grid; gap: 6px; font-size: 14px; }
.menu-dados div { display: flex; justify-content: space-between; gap: 10px; }
.menu-dados dt { color: var(--muted); }
.menu-dados dd { margin: 0; font-weight: 700; }
.menu-link {
  display: block; width: 100%; text-align: left; padding: 10px 4px 0; background: none; border: 0;
  color: var(--navy-700); font-weight: 600; text-decoration: none; cursor: pointer; font-size: 14px;
}
.menu-link:hover { text-decoration: underline; }
.menu-sair { color: var(--muted); }

.aviso-plano {
  display: inline-block; margin: 16px 0 0; padding: 8px 14px; border-radius: 10px;
  background: rgba(255, 255, 255, .12); color: #fff; font-size: 14px;
}
.aviso-plano a { color: #fff; font-weight: 700; }
.topo-inner { max-width: 1200px; margin: 0 auto; }
.eyebrow { margin: 0 0 6px; text-transform: uppercase; letter-spacing: .12em; font-size: 12px; font-weight: 700; color: #a9c8ea; }
.topo h1 { margin: 0; font-size: clamp(24px, 4vw, 36px); line-height: 1.15; font-weight: 800; letter-spacing: -.01em; }
.titulo { display: flex; align-items: center; gap: 14px; }
.logo { width: clamp(40px, 6vw, 52px); height: clamp(40px, 6vw, 52px); flex: none; }
.sub { margin: 10px 0 0; max-width: 620px; color: #d3e3f5; }
/* Layout */
.layout {
  max-width: 1200px;
  margin: -48px auto 48px;
  padding: 0 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
}
.coluna { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
#planilha { display: flex; flex-direction: column; gap: 20px; scroll-margin-top: 16px; }

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  min-width: 0;
}
.card-head { margin-bottom: 14px; }
.card-head h2 { margin: 0; font-size: 18px; font-weight: 800; color: var(--navy-800); }
.card-head p { margin: 6px 0 0; color: var(--muted); }
.card h3 { margin: 22px 0 10px; font-size: 14px; font-weight: 700; color: var(--navy-700); }

.legenda { margin: 0; color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.amostra { width: 18px; height: 14px; border-radius: 4px; background: var(--yellow); border: 1px solid var(--yellow-line); }

/* Tabelas */
.tabela-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.tabela { width: 100%; border-collapse: collapse; min-width: 520px; }
.tabela.tabela-compacta { min-width: 0; }
.tabela.tabela-compacta th { white-space: normal; }
#tbody-cub td { font-size: 14px; }
.tabela th, .tabela td { padding: 8px 10px; text-align: right; white-space: nowrap; }
.tabela th:first-child, .tabela td:first-child { text-align: left; }
.tabela thead th {
  font-size: 12px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--line);
}
.tabela tbody tr + tr td, .tabela tbody tr + tr th { border-top: 1px solid var(--navy-50); }
.tabela tbody th { font-weight: 600; }
.tabela tfoot th, .tabela tfoot td {
  background: var(--navy-100); font-weight: 800; color: var(--navy-800);
}
.tabela tfoot th:first-child { border-radius: 8px 0 0 8px; }
.tabela tfoot td:last-child { border-radius: 0 8px 8px 0; }
.tabela .faixa { color: var(--muted); font-size: 13px; }
.tabela tr.ativo th, .tabela tr.ativo td:first-of-type { color: var(--navy-700); }
.tabela tr.ativo { background: var(--navy-50); }
.nota-tabela { margin: 12px 0 0; font-size: 13px; color: var(--muted); }

/* Campos */
.campo {
  width: 100%;
  min-width: 84px;
  text-align: right;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--yellow-line);
  background: var(--yellow);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.campo:hover { border-color: #d6c24a; }
.campo:focus { outline: none; background: var(--yellow-focus); border-color: var(--navy-500); box-shadow: 0 0 0 3px rgba(80, 144, 208, .25); }
.campo-neutro { background: #fff; border-color: var(--line); }
.campo::placeholder { color: #9a8a3a; opacity: 1; }
.campo-pct .campo-faixa { width: 108px; padding-left: 6px; padding-right: 6px; }
.tabela-compacta .campo { min-width: 64px; }
.tabela-compacta th, .tabela-compacta td { padding-left: 6px; padding-right: 6px; }
.campo-neutro:focus { background: #fff; }
select.campo { text-align: left; cursor: pointer; }
.campo.preenchido-ia { animation: brilho 1.4s ease-out; }
@keyframes brilho { from { box-shadow: 0 0 0 4px rgba(80, 144, 208, .55); } to { box-shadow: 0 0 0 0 rgba(80, 144, 208, 0); } }

.linha-padrao { display: grid; grid-template-columns: 200px 1fr 1fr; gap: 14px; align-items: end; }
.linha-padrao label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; color: var(--muted); }
.mini { background: var(--navy-50); border-radius: 10px; padding: 10px 14px; display: flex; flex-direction: column; }
.mini span { font-size: 12px; color: var(--muted); }
.mini strong { font-size: 18px; color: var(--navy-800); }
.mini.destaque { background: var(--navy-800); }
.mini.destaque span { color: #b9d2ee; }
.mini.destaque strong { color: #fff; }

/* Estimativa final */
.lista-final { display: flex; flex-direction: column; }
.item-final {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 11px 4px; border-bottom: 1px solid var(--navy-50);
}
.item-final span small { color: var(--muted); font-weight: 500; }
.item-final strong { font-size: 16px; }
.item-final input { max-width: 180px; }
.item-final.total { background: var(--navy-100); border-radius: 10px; padding: 12px 14px; margin-top: 8px; border: 0; }
.item-final.total span { font-weight: 700; color: var(--navy-800); }
.item-final.total strong { font-size: 18px; color: var(--navy-800); }
.item-final.ganho { background: var(--green-bg); }
.item-final.ganho span, .item-final.ganho strong { color: var(--green); }
.campo-pct { display: inline-flex; align-items: center; gap: 6px; }
.campo-pct input { width: 80px; }

.rodape-acoes { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

/* Botões */
.btn-primario {
  border: 0; border-radius: 10px; padding: 12px 22px; cursor: pointer;
  background: var(--navy-700); color: #fff; font-weight: 700;
  transition: background .15s;
}
.btn-primario:hover { background: var(--navy-800); }
.btn-primario:disabled { background: #8aa6c4; cursor: progress; }
.btn-secundario {
  border: 1px solid var(--line); background: var(--surface); border-radius: 10px;
  padding: 9px 16px; cursor: pointer; font-weight: 600; color: var(--muted);
}
.btn-secundario:hover { color: var(--navy-800); border-color: var(--navy-500); }

/* Painel IA */
.painel-ia { border: 2px solid var(--navy-500); }
.card-head-ia { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.card-head-ia h2 { display: flex; align-items: center; gap: 8px; }
.card-head-ia h2 svg { color: var(--navy-500); }
.card-head-ia #btn-manual { flex: none; white-space: nowrap; }
.local-acao { display: flex; align-items: flex-end; }
.card-head-acao { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.calc-acao { display: flex; align-items: center; gap: 10px; }
.calc-dica { font-size: 12px; color: var(--muted); }
#calc-status { margin: -4px 0 14px; }
.cub-status {margin: -4px 0 0; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.cub-status.carregando::before { content: ""; flex: none; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--navy-500); border-right-color: transparent; animation: gira .8s linear infinite; }
.cub-status.pronto { color: var(--green); }
.cub-status.erro { color: var(--red); }
.grade-ia { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grade-ia label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); min-width: 0; }
.grade-ia input, .grade-ia select, .grade-ia textarea {
  width: 100%; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--text); font-weight: 500;
}
.grade-ia textarea { resize: vertical; }
.grade-ia :is(input, select, textarea):focus { outline: none; border-color: var(--navy-500); box-shadow: 0 0 0 3px rgba(80, 144, 208, .25); }
.span-2 { grid-column: span 2; }
.span-full { grid-column: 1 / -1; }
.opcional { font-weight: 500; color: #8a96a8; }
.acoes-ia { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.dica { font-size: 13px; color: var(--muted); }
.aviso { background: #fff4e5; border: 1px solid #f5c98b; color: #7a4b00; border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; font-size: 14px; }

.log { list-style: none; margin: 16px 0 0; padding: 14px 16px; background: var(--navy-50); border-radius: 10px; font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.log li { display: flex; gap: 10px; align-items: flex-start; color: var(--muted); overflow-wrap: anywhere; }
.log li::before { content: "✓"; color: var(--green); font-weight: 800; flex: none; }
.log li.atual { color: var(--navy-800); font-weight: 600; }
.log li.atual::before { content: ""; width: 12px; height: 12px; margin-top: 4px; border-radius: 50%; border: 2px solid var(--navy-500); border-right-color: transparent; animation: gira .8s linear infinite; }
.log li.erro { color: var(--red); font-weight: 600; }
.log li.erro::before { content: "!"; color: var(--red); }
@keyframes gira { to { transform: rotate(360deg); } }

.ia-bloqueado {
  background: var(--navy-50); border-radius: 10px; padding: 16px 18px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 12px;
}
.ia-bloqueado p { margin: 0; }
.ia-creditos { font-size: 12px; color: var(--muted); margin-top: -4px; }
.oferta { background: #fff8e6; border: 1px solid #f2d49b; border-radius: 10px; padding: 16px 18px; margin-bottom: 14px; }
.oferta p { margin: 0 0 12px; }
.oferta-botoes { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-primario, .btn-secundario { text-decoration: none; display: inline-block; }

/* Valores bloqueados na versão grátis */
.borrado {
  filter: blur(6px); user-select: none; pointer-events: none;
}
.resumo .borrado { filter: blur(8px); }

/* Seções bloqueadas: títulos e nomes dos itens visíveis, valores e campos borrados */
.secao-bloqueada td,
.secao-bloqueada .item-final > :not(:first-child) {
  filter: blur(6px); user-select: none;
}
.secao-bloqueada .campo { background: var(--navy-100); border-color: var(--line); }

.aviso-valor {
  margin: 12px 0 0; padding: 10px 14px; border-radius: 10px; font-size: 13px;
  background: #fff8e6; border: 1px solid #f2d49b; color: #6b4a00;
}
.aviso-valor::before { content: "⚠ "; font-weight: 700; }

.banner-premium {
  background: var(--navy-800); color: #fff; border-radius: var(--radius); padding: 18px 22px;
  display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow);
}
.banner-premium svg { flex: none; color: #7ee2ad; }
.banner-premium p { margin: 0; flex: 1; font-size: 14px; color: #d3e3f5; }
.banner-premium p strong { color: #fff; display: block; font-size: 15px; margin-bottom: 2px; }
.banner-premium .btn-cta { flex: none; white-space: nowrap; }

.cta-premium {
  margin-top: 16px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .12);
  display: flex; flex-direction: column; gap: 10px; text-align: center;
}
.cta-premium p { margin: 0; font-size: 14px; color: #d3e3f5; }
.btn-cta {
  display: block; padding: 12px 16px; border-radius: 10px; text-decoration: none;
  background: #7ee2ad; color: #0d3b26; font-weight: 800;
}
.btn-cta:hover { background: #9aeac0; }
.cta-entrar { color: #b9d2ee; font-size: 13px; font-weight: 600; }
.resumo-aviso {
  grid-column: 1 / -1; margin: 16px 0 0; padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, .12); font-size: 12px; line-height: 1.45; color: #8fb0d4;
}
.cta-vitalicio { color: #8fb0d4; font-size: 12px; margin-top: -4px; }
.tabela tr.linha-alvenaria th, .tabela tr.linha-alvenaria td { color: var(--muted); font-style: italic; }

.notas { border-left: 4px solid var(--navy-500); }
.notas dl { margin: 0; display: grid; gap: 6px; }
.notas dt { font-weight: 700; font-size: 13px; color: var(--navy-700); margin-top: 6px; }
.notas dd { margin: 0; white-space: pre-line; }

/* Resumo */
.resumo { position: sticky; top: 16px; }
.resumo-inner {
  background: var(--navy-800); color: #fff; border-radius: var(--radius);
  padding: 22px; box-shadow: 0 8px 28px rgba(15, 47, 80, .25);
}
.resumo h2 { margin: 0 0 14px; font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: #a9c8ea; }
.kpi { padding: 14px 0; border-top: 1px solid rgba(255, 255, 255, .12); display: flex; flex-direction: column; }
.kpi span { font-size: 13px; color: #c7dbf1; }
.kpi strong { font-size: 26px; font-weight: 800; letter-spacing: -.01em; line-height: 1.2; }
.kpi small { color: #8fb0d4; font-size: 12px; }
.kpi-ganho strong { color: #7ee2ad; }
.kpi-ganho.negativo strong { color: #ff9b8f; }
.resumo-detalhe { margin-top: 6px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .12); display: grid; gap: 6px; font-size: 13px; }
.resumo-detalhe div { display: flex; justify-content: space-between; gap: 10px; }
.resumo-detalhe span { color: #a9c8ea; }

/* Páginas de conta */
.topo-curto { padding-bottom: 64px; }
.auth { max-width: 460px; margin: -40px auto 48px; padding: 0 16px; display: flex; flex-direction: column; gap: 20px; }
.auth-larga { max-width: 640px; }
.form-auth { display: flex; flex-direction: column; gap: 14px; }
.form-auth label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.form-auth input {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--text); font-weight: 500;
}
.form-auth input:disabled { background: var(--navy-50); color: var(--muted); }
.form-auth input:focus { outline: none; border-color: var(--navy-500); box-shadow: 0 0 0 3px rgba(80, 144, 208, .25); }
.form-auth button { align-self: flex-start; }
.form-erro { margin: 0; color: var(--red); font-size: 14px; font-weight: 600; }
.form-ok { margin: 0; color: var(--green); font-size: 14px; font-weight: 600; }
.auth-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 18px; font-size: 14px; }
.auth-links a { color: var(--navy-700); font-weight: 600; }
.auth-nota { margin: 12px 0 0; font-size: 13px; color: var(--muted); font-weight: 500; }
.conta-resumo { display: flex; align-items: center; gap: 16px; }
.conta-resumo h2 { margin: 0; font-size: 20px; color: var(--navy-800); }
.conta-resumo p { margin: 2px 0 0; color: var(--muted); overflow-wrap: anywhere; }
.avatar-xl { width: 64px; height: 64px; font-size: 22px; cursor: default; flex: none; border-color: var(--navy-100); }
.conta-numeros { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.conta-numeros small { color: var(--muted); font-size: 12px; }
.conta-ofertas { margin-top: 16px; }
#btn-sair-conta { align-self: flex-start; }

/* Página de pagamento */
.resumo-compra {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--navy-50); border-radius: 10px; padding: 14px 16px; margin-bottom: 18px;
}
.resumo-compra span { font-weight: 600; }
.resumo-compra strong { font-size: 20px; color: var(--navy-800); }
.abas-pagamento { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--navy-50); padding: 5px; border-radius: 10px; margin-bottom: 16px; }
.abas-pagamento button { border: 0; background: transparent; padding: 10px; border-radius: 8px; font-weight: 700; color: var(--muted); cursor: pointer; }
.abas-pagamento button[aria-selected="true"] { background: var(--navy-800); color: #fff; }
.pix-gerado { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 8px; }
.pix-gerado img { width: 220px; height: 220px; border-radius: 10px; border: 1px solid var(--line); }
.pix-copia { width: 100%; display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.pix-copia textarea { width: 100%; padding: 10px; border-radius: 8px; border: 1px solid var(--line); font-size: 12px; resize: none; word-break: break-all; }
#painel-pix > .btn-primario { margin-top: 4px; }
.pagamento-ok .btn-primario { align-self: flex-start; }

/* Responsivo */
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .resumo { position: static; order: -1; }
  .resumo-inner { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 18px; }
  .resumo h2, .resumo-detalhe { grid-column: 1 / -1; }
  .kpi strong { font-size: 21px; }
}
@media (max-width: 640px) {
  .topo { padding: 0 16px 64px; }
  .acesso-ate { display: none; }
  .marca { font-size: 12px; }
  .card { padding: 18px 16px; }
  .grade-ia { grid-template-columns: 1fr 1fr; }
  .span-2 { grid-column: 1 / -1; }
  .linha-padrao { grid-template-columns: 1fr; }
  .resumo-inner { grid-template-columns: 1fr; }
  .card-head-ia { flex-direction: column; gap: 12px; }
  .banner-premium { flex-direction: column; align-items: flex-start; }
  .item-final { flex-wrap: wrap; }
}
