/* ═══════════════════════════════════════════════════════════════
   N&C Imóveis — Componentes reaproveitáveis (flat, minimalista).
   Depende dos tokens em /theme/tema.css. Herdado pelo módulo futuro.
   ═══════════════════════════════════════════════════════════════ */

/* ── Logo que troca com o tema (navy no claro, branco no escuro) ── */
.marca { display: inline-flex; align-items: center; }
.marca img { display: block; height: 34px; width: auto; }
.marca .logo-escuro { display: none; }
:root[data-theme='dark'] .marca .logo-claro { display: none; }
:root[data-theme='dark'] .marca .logo-escuro { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .marca .logo-claro { display: none; }
  :root:not([data-theme='light']) .marca .logo-escuro { display: block; }
}

/* ── Botões ── */
.btn {
  font-family: inherit; font-size: .9rem; font-weight: 700; letter-spacing: -0.01em;
  padding: 12px 20px; border-radius: var(--raio-sm); border: 1.5px solid transparent;
  cursor: pointer; transition: var(--trans); user-select: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  line-height: 1;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primario { background: var(--primario); color: var(--primario-texto); }
.btn-primario:hover:not(:disabled) { background: var(--primario-hover); }
.btn-primario:active:not(:disabled) { transform: translateY(1px); }
.btn-secundario { background: var(--surface); color: var(--text); border-color: var(--border-2); }
.btn-secundario:hover:not(:disabled) { background: var(--surface-2); }
.btn-coral { background: var(--acento); color: var(--acento-texto); }
.btn-coral:hover:not(:disabled) { filter: brightness(1.05); }
.btn-fantasma { background: transparent; color: var(--text-2); border-color: transparent; }
.btn-fantasma:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn-perigo { background: var(--erro-bg); color: var(--erro); }
.btn-bloco { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: .82rem; }

/* Botão só ícone (topbar, ações) */
.btn-icone {
  width: 40px; height: 40px; padding: 0; border-radius: var(--raio-sm);
  background: transparent; color: var(--text-2); border: 1.5px solid transparent;
  display: grid; place-items: center; font-size: 1.1rem; cursor: pointer; transition: var(--trans);
}
.btn-icone:hover { background: var(--surface-2); color: var(--text); }

/* ── Card ── */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--raio);
  box-shadow: var(--sombra-sm); padding: 22px; margin-bottom: 16px;
}
.card-central {
  max-width: 420px; margin: 8vh auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--raio-lg);
  box-shadow: var(--sombra); padding: 36px 28px;
}

/* Título de seção — barrinha coral como detalhe */
.secao {
  font-size: .7rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text); margin: 0 0 16px; display: flex; align-items: center; gap: 10px;
}
.secao::before { content: ''; width: 20px; height: 3px; border-radius: 3px; background: var(--detalhe); flex: 0 0 auto; }

/* ── Campos de formulário ── */
.campo { margin-bottom: 16px; }
.campo:last-child { margin-bottom: 0; }
.campo label { display: block; font-size: .8rem; font-weight: 700; color: var(--text); margin-bottom: 7px; }
.campo label .opc { font-weight: 500; color: var(--text-muted); }
.campo input, .campo select, .campo textarea {
  width: 100%; padding: 12px 13px; font-size: 16px; font-family: inherit; font-weight: 500;
  color: var(--text); background: var(--surface); border: 1.5px solid var(--border-2);
  border-radius: var(--raio-sm); transition: var(--trans); -webkit-appearance: none; appearance: none;
}
.campo input::placeholder, .campo textarea::placeholder { color: var(--text-muted); }
.campo select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23006e7e' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; padding-right: 40px;
}
.campo input:focus, .campo select:focus, .campo textarea:focus {
  outline: none; border-color: var(--detalhe); box-shadow: 0 0 0 4px var(--detalhe-suave);
}
.campo textarea { min-height: 84px; resize: vertical; }
.campo .erro { color: var(--erro); font-size: .76rem; font-weight: 600; margin-top: 6px; display: none; }
.campo.invalido input, .campo.invalido select, .campo.invalido textarea { border-color: var(--erro); }
.campo.invalido .erro { display: block; }

.linha { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
@media (min-width: 560px) { .linha.duas { grid-template-columns: 1fr 1fr; } }

/* ── Badge de status (semântico, discreto) ── */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: var(--raio-pill);
  font-size: .72rem; font-weight: 700; white-space: nowrap; letter-spacing: .01em;
  background: var(--surface-2); color: var(--text-2);
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-aguardando { background: var(--st-aguardando-bg); color: var(--st-aguardando); }
.badge-andamento { background: var(--st-andamento-bg); color: var(--st-andamento); }
.badge-ok { background: var(--st-ok-bg); color: var(--st-ok); }
.badge-cancelado { background: var(--st-cancelado-bg); color: var(--st-cancelado); }

/* ── Avisos ── */
.aviso { padding: 12px 14px; border-radius: var(--raio-sm); margin-bottom: 16px; font-size: .85rem; font-weight: 600; border: 1px solid transparent; }
.aviso-info { background: var(--acento-suave); color: var(--text); border-color: transparent; }
.aviso-erro { background: var(--erro-bg); color: var(--erro); }
.aviso-ok { background: var(--st-ok-bg); color: var(--st-ok); }

/* ── Linha de detalhe (chave/valor) ── */
.det { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: .88rem; }
.det:last-child { border-bottom: 0; }
.det .rot { color: var(--text-2); font-weight: 500; }
.det .val { font-weight: 700; text-align: right; }

/* ── Modal / bottom-sheet ── */
.modal-fundo {
  position: fixed; inset: 0; background: rgba(6,45,60,.5); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: none; align-items: flex-end; justify-content: center; z-index: 60; padding: 0;
}
.modal-fundo.aberto { display: flex; animation: nc-fade .2s ease; }
.modal {
  background: var(--surface); width: 100%; max-width: 520px; border: 1px solid var(--border);
  border-radius: var(--raio-lg) var(--raio-lg) 0 0; padding: 22px 22px calc(env(safe-area-inset-bottom) + 22px);
  box-shadow: var(--sombra-fl); animation: nc-subir .28s cubic-bezier(.2,.8,.2,1);
}
@media (min-width: 560px) { .modal-fundo { align-items: center; padding: 20px; } .modal { border-radius: var(--raio-lg); } }
.modal .puxador { width: 40px; height: 4px; border-radius: 4px; background: var(--border-2); margin: -4px auto 16px; }
.modal h3 { margin: 0 0 4px; font-size: 1.15rem; }
.modal .dica { margin: 0 0 16px; font-size: .84rem; color: var(--text-2); }
.modal-acoes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.modal-acoes .btn { width: 100%; }

/* ── Canvas de assinatura ── */
.canvas-assinatura {
  width: 100%; height: 210px; border: 2px dashed var(--border-2); border-radius: var(--raio-sm);
  background: var(--surface-2); touch-action: none; display: block;
}

/* ── Toast ── */
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 20px); transform: translateX(-50%);
  background: var(--marca-azul); color: #fff; padding: 12px 20px; border-radius: var(--raio-sm);
  font-size: .86rem; font-weight: 600; box-shadow: var(--sombra-fl); z-index: 90; max-width: 90vw;
}
.toast.erro { background: var(--erro); color: #fff; }
.toast.ok { background: var(--st-ok); color: #fff; }

/* ── Spinner ── */
.spinner { width: 30px; height: 30px; border: 3px solid var(--surface-3); border-top-color: var(--acento); border-radius: 50%; margin: 0 auto 14px; animation: nc-girar .8s linear infinite; }
.carregando { text-align: center; color: var(--text-muted); padding: 56px 0; font-weight: 600; }

/* ── Tabela ── */
.tabela { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tabela th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.tabela td { padding: 12px; border-bottom: 1px solid var(--border); }
.tabela tr:hover td { background: var(--surface-2); }

/* ── Layout de página do cliente (comprador/vendedor) ── */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.topo-cliente {
  position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--border);
  padding: calc(env(safe-area-inset-top) + 12px) 18px 12px; display: flex; align-items: center; gap: 12px;
}
.topo-cliente .titulo { font-weight: 700; font-size: .95rem; }
.topo-cliente .subtitulo { font-size: .72rem; color: var(--text-2); margin-top: 1px; }
.topo-cliente .espaco { flex: 1; }

.container { width: 100%; max-width: 720px; margin: 0 auto; padding: 12px 16px 32px; flex: 1; }

/* Stepper */
.stepper { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 16px; max-width: 720px; margin: 0 auto; width: 100%; }
.passo { display: flex; align-items: center; gap: 7px; }
.passo .bolha {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-size: .78rem; font-weight: 700; background: var(--surface-2); color: var(--text-muted);
  border: 1.5px solid var(--border-2); transition: var(--trans);
}
.passo .rotulo { font-size: .74rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.passo.ativo .bolha { background: var(--primario); color: var(--primario-texto); border-color: var(--primario); }
.passo.ativo .rotulo { color: var(--text); }
.passo.feito .bolha { background: var(--coral); color: #06222d; border-color: var(--coral); }
.passo-linha { flex: 1; height: 2px; background: var(--border-2); border-radius: 2px; min-width: 12px; max-width: 46px; }
.passo-linha.feito { background: var(--coral); }
@media (max-width: 460px) { .passo .rotulo { display: none; } .passo-linha { max-width: none; } }

/* Preview do contrato */
.preview-wrap { border: 1px solid var(--border); border-radius: var(--raio); overflow: hidden; background: #fff; box-shadow: var(--sombra-sm); margin-bottom: 16px; }
.preview-frame { width: 100%; border: 0; display: block; min-height: 64vh; background: #fff; }

/* Barra de ação fixa (mobile) */
.acao-fixa {
  position: sticky; bottom: 0; z-index: 20; padding: 12px 16px calc(env(safe-area-inset-bottom) + 12px);
  margin: 0 -16px -32px; display: flex; gap: 10px;
  background: linear-gradient(to top, var(--bg) 72%, transparent);
}
.acao-fixa .btn { flex: 1; }
@media (min-width: 720px) { .acao-fixa { position: static; background: none; margin: 0; padding: 0; justify-content: flex-end; } .acao-fixa .btn { flex: 0 0 auto; min-width: 160px; } }

/* Ícone circular de sucesso */
.icone-sucesso { width: 60px; height: 60px; border-radius: 50%; background: var(--coral-suave); color: var(--coral); display: grid; place-items: center; font-size: 28px; margin: 0 auto 16px; }

@keyframes nc-girar { to { transform: rotate(360deg); } }
@keyframes nc-fade { from { opacity: 0; } }
@keyframes nc-subir { from { transform: translateY(24px); opacity: .6; } }
