/* ===== Lotfly — estilos =====
   Direção: minimalista e utilitária. Fundo neutro quente, superfícies brancas com borda de 1px,
   quase nenhuma sombra. A cor de marca (azul-marinho) fica no topo, no menu e na ação principal;
   verde, âmbar e vermelho só aparecem quando dizem alguma coisa (recebido, a vencer, atraso).
   Números financeiros em algarismos tabulares, para alinhar e comparar. */

@font-face {
  font-family: 'Geist';
  src: url('fonts/Geist-Variable.woff2') format('woff2');
  font-weight: 100 900; font-style: normal; font-display: swap;
}

:root {
  /* marca */
  --primary: #0e4c73;
  --primary-dark: #093553;
  --primary-light: #e8eef3;
  --primary-soft: #f2f6f9;
  /* neutros (uma família só, levemente quente) */
  --bg: #f7f7f5;
  --card: #ffffff;
  --surface-2: #fafaf8;
  --text: #23272b;
  --text-strong: #15181b;
  --muted: #6b6a65;
  --border: #e8e7e3;
  --border-strong: #d6d5d0;
  /* semânticas, com contraste AA sobre branco */
  --success: #1d6b3a;
  --success-bg: #edf3ec;
  --success-btn: #1e7a46;
  --warn: #92560a;
  --warn-bg: #fbf3db;
  --danger: #b42318;
  --danger-bg: #fdeceb;
  --info: #1f6c9f;
  --info-bg: #e1f3fe;
  --accent: #a15c07;
  /* situação dos lotes na planta: as mesmas de sempre */
  --st-disponivel: #22c55e;
  --st-reservado: #f59e0b;
  --st-vendido: #ef4444;
  --st-bloqueado: #94a3b8;
  /* forma */
  --radius: 12px;
  --r-md: 8px;
  --r-sm: 6px;
  --h-ctrl: 40px;
  --h-ctrl-sm: 34px;
  --topbar-h: 56px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ring: 0 0 0 3px rgba(14, 76, 115, 0.22);
  /* sombras: só no que flutua sobre a página. Duas camadas, tingidas do texto (não preto puro):
     uma curta que desenha a borda e uma longa e clara que dá a distância. */
  --sombra-flutua: 0 1px 2px rgba(21, 24, 27, 0.05), 0 8px 24px rgba(21, 24, 27, 0.08);
  --sombra-janela: 0 1px 3px rgba(21, 24, 27, 0.08), 0 18px 48px rgba(21, 24, 27, 0.18);
  --sombra-gaveta: 0 -1px 2px rgba(21, 24, 27, 0.05), 0 -10px 32px rgba(21, 24, 27, 0.14);
  /* movimento: saída rápida no começo (responde na hora) e pouso suave */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
body { overscroll-behavior: none; }
body {
  font-family: 'Geist', 'Helvetica Neue', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh; min-height: 100dvh;
  font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; }
button, a, .tab, .chip, .item, .kpi, .alert, [onclick] { touch-action: manipulation; }
a { color: var(--primary); text-underline-offset: 2px; }
h1, h2, h3, h4 { line-height: 1.25; text-wrap: balance; color: var(--text-strong); }
/* Foco do teclado: anel sólido na cor da marca, com um respiro branco, visível sobre cartão e
   sobre o menu escuro. Nos campos continua o anel suave, que acompanha a borda azul. */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; box-shadow: none; border-radius: var(--r-sm); }
.aside :focus-visible, .topbar :focus-visible { outline-color: #fff; }
.aside:focus-visible { outline-color: #fff; outline-offset: -3px; }
/* Dentro de faixa, lista ou barra (que cortam o que passa da borda), o anel vai para dentro. */
.st-item:focus-visible, .lista > .item:focus-visible, .bm-seg:focus-visible, .bm-leg:focus-visible, .busca-res:focus-visible { outline-offset: -2px; }
#modalBox:focus-visible { outline: none; }
/* Linha de tabela não desenha sombra: o foco do teclado vira um contorno por dentro */
tr:focus-visible { box-shadow: none; outline: 2px solid var(--primary); outline-offset: -2px; }
/* A janela recebe o foco ao abrir (para o leitor de tela e o Tab começarem nela): sem anel em
   volta dela inteira, que continua com a própria sombra e cantos */
#modalBox:focus-visible { box-shadow: var(--sombra-gaveta); border-radius: 16px 16px 0 0; }
@media (min-width: 640px) { #modalBox:focus-visible { box-shadow: var(--sombra-janela); border-radius: 14px; } }
/* O topo fixo não cobre o campo ou a linha que recebeu o foco pelo Tab */
html { scroll-padding-top: calc(var(--topbar-h) + var(--safe-top) + 12px); }
/* Pular para o conteúdo: invisível até receber o foco do Tab */
.pular { position: fixed; top: calc(8px + var(--safe-top)); left: 8px; z-index: 10000; background: var(--card); color: var(--primary); padding: 10px 14px; border-radius: var(--r-md); border: 1px solid var(--border-strong); font-weight: 600; font-size: 0.88rem; transform: translateY(-160%); }
.pular:focus-visible { transform: none; }
.num, .val, .value, .price-big, .tbl td, .kpi .sub, .ix-resumo-grid .v { font-variant-numeric: tabular-nums; }

/* ---------- ícones ---------- */
.ico { color: inherit; }
.tab .ico, .btn .ico, .chip .ico, .top-link .ico { font-size: 1.05em; }

/* ---------- screens ---------- */
.screen { display: none; min-height: 100vh; min-height: 100dvh; }
.screen.active { display: block; }

/* ---------- landing ---------- */
.landing {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(32px + var(--safe-top)) 16px calc(40px + var(--safe-bottom));
  background: var(--primary);
  color: white;
}
.landing-logo { width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.18); font-size: 1.7rem; margin-bottom: 14px; }
.landing h1 { font-size: 2.2rem; font-weight: 650; letter-spacing: -0.03em; text-align: center; color: white; }
.landing .sub { color: rgba(255,255,255,0.82); font-size: 0.95rem; margin-top: 6px; text-align: center; max-width: 420px; }
.landing-empreend { margin-top: 28px; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.2); border-radius: var(--radius); padding: 16px 20px; text-align: center; min-width: 280px; max-width: 440px; width: 100%; }
.landing-empreend .nome { font-weight: 600; font-size: 1.05rem; }
.landing-empreend .info { font-size: 0.82rem; color: rgba(255,255,255,0.82); margin-top: 4px; }
.landing-empreend .stats { display: flex; justify-content: center; gap: 16px; margin-top: 12px; font-size: 0.78rem; flex-wrap: wrap; color: rgba(255,255,255,0.85); }
.landing-empreend .stats b { display: block; font-size: 1.15rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.landing-empreend .btn-accent { background: white; color: var(--primary); }
.landing-btns { display: flex; flex-direction: column; gap: 10px; margin-top: 24px; width: 100%; max-width: 440px; }
.landing-btn {
  background: white; color: var(--text-strong); border: 1px solid white; border-radius: var(--radius);
  padding: 16px 18px; font-size: 1rem; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; gap: 14px; text-align: left;
  transition: transform 0.15s ease, background-color 0.15s ease;
}
.landing-btn:active { transform: scale(0.99); }
.landing-btn .ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-light); color: var(--primary); font-size: 1.25rem; flex: none; }
.landing-btn small { display: block; font-weight: 400; color: var(--muted); font-size: 0.8rem; margin-top: 2px; line-height: 1.4; }
.landing-btn.ghost { background: transparent; color: white; border-color: rgba(255,255,255,0.32); }
@media (hover: hover) and (pointer: fine) { .landing-btn.ghost:hover { background: rgba(255,255,255,0.06); } }
.landing-btn.ghost .ic { background: rgba(255,255,255,0.1); color: white; }
.landing-btn.ghost small { color: rgba(255,255,255,0.75); }
.landing-foot { margin-top: 26px; font-size: 0.78rem; color: rgba(255,255,255,0.72); text-align: center; }
.landing-foot a { color: white; }
.landing-warn { margin-top: 14px; background: var(--warn-bg); color: var(--warn); border-radius: var(--r-md); padding: 10px 14px; font-size: 0.82rem; max-width: 440px; width: 100%; }
.sync-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 0.75rem; padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,0.1); margin-top: 12px; }
.sync-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: #b4c3cf; }
.sync-pill.on .dot { background: #4ade80; }
.sync-pill.err .dot { background: #f87171; }

/* ---------- topbar ---------- */
.topbar {
  background: var(--primary);
  color: white; padding: calc(8px + var(--safe-top)) 16px 8px; min-height: calc(var(--topbar-h) + var(--safe-top));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  position: sticky; top: 0; z-index: 100;
  border-bottom: 1px solid rgba(0,0,0,0.12);
}
.topbar .brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.topbar .brand > div { min-width: 0; }
.topbar .brand h1 { font-size: 1rem; font-weight: 600; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.01em; }
.topbar .brand .role { font-size: 0.72rem; color: rgba(255,255,255,0.78); letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .brand > div { flex: 1 1 auto; }
.topbar .right { display: flex; align-items: center; gap: 8px; flex: none; }
.topbar select {
  background: rgba(255,255,255,0.1); color: white; border: 1px solid rgba(255,255,255,0.3);
  border-radius: var(--r-md); padding: 6px 10px; font-size: 0.82rem; max-width: 190px; height: var(--h-ctrl-sm); width: auto;
}
.topbar select option { color: var(--text); }
@media (max-width: 479px) { .topbar select { max-width: 42vw; min-width: 0; text-overflow: ellipsis; } .topbar .right { flex: 0 1 auto; min-width: 0; } }
/* No celular o seletor já diz qual é o empreendimento: o título repetido sai e o seletor
   fica com a largura toda, em vez de três textos espremidos com reticências. */
@media (max-width: 479px) { #screen-corretor .topbar.com-seletor .brand { display: none; } #screen-corretor .topbar.com-seletor .right { flex: 1 1 auto; } #screen-corretor .topbar.com-seletor .lot-select { flex: 1 1 auto; max-width: none; } }
.top-link { color: white; text-decoration: none; font-size: 0.82rem; font-weight: 500; border: 1px solid rgba(255,255,255,0.32); height: var(--h-ctrl-sm); min-width: var(--h-ctrl-sm); padding: 0 12px; border-radius: var(--r-md); white-space: nowrap; background: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
@media (hover: hover) and (pointer: fine) { .top-link:hover { background: rgba(255,255,255,0.1); } }

.tabs {
  display: flex; background: var(--card); border-bottom: 1px solid var(--border);
  position: sticky; top: calc(var(--topbar-h) + var(--safe-top)); z-index: 99; overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 1 0 auto; padding: 12px 12px 10px; text-align: center; font-size: 0.84rem; font-weight: 500;
  color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px;
  transition: color 0.15s;
}
@media (hover: hover) and (pointer: fine) { .tab:hover { color: var(--text); } }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab .tab-badge.neutro { background: rgba(255,255,255,0.18); color: white; }
.tab .tab-badge { display: inline-block; margin-left: 2px; background: var(--danger); color: white; font-size: 0.68rem; font-weight: 600; border-radius: 999px; padding: 1px 6px; min-width: 18px; line-height: 1.35; text-align: center; font-variant-numeric: tabular-nums; }

.view { display: none; padding: 16px; max-width: 1100px; margin: 0 auto; padding-bottom: calc(96px + var(--safe-bottom)); }
.view.active { display: block; }

/* ---------- cards / kpis ---------- */
.card {
  background: var(--card); border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
  border: 1px solid var(--border);
}
.card h2, .card h3 { font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.card h2 .h-actions, .card h3 .h-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card h2 .h-link { font-size: 0.82rem; font-weight: 500; letter-spacing: 0; }
/* Fluxo de caixa projetado (relatorios.js) */
.alert.fluxo-alerta { cursor: default; }
.fluxo-notas { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.fluxo-lista { display: none; }
.fluxo-lista .fl-mes { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.fluxo-lista .fl-mes:last-child { border-bottom: 0; }
.fluxo-lista .fl-saldo { text-align: right; font-variant-numeric: tabular-nums; flex: none; }
@media screen and (max-width: 719px) { .fluxo-tabela { display: none; } .fluxo-lista { display: block; } }
.card p.help { font-size: 0.84rem; color: var(--muted); line-height: 1.55; max-width: 72ch; }
.kpi-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (min-width: 720px) { .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } .kpi-grid.cols3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* Cinco indicadores: no celular o último ocupa a linha inteira; em tela média, 3 + 2; larga, os 5 lado a lado. */
@media (max-width: 719px) { .kpi-grid.cols5 > :last-child { grid-column: 1 / -1; } }
@media (min-width: 720px) { .kpi-grid.cols5 { grid-template-columns: repeat(6, minmax(0, 1fr)); } .kpi-grid.cols5 > * { grid-column: span 2; } .kpi-grid.cols5 > :nth-child(n+4) { grid-column: span 3; } }
@media (min-width: 1180px) { .kpi-grid.cols5 { grid-template-columns: repeat(5, minmax(0, 1fr)); } .kpi-grid.cols5 > *, .kpi-grid.cols5 > :nth-child(n+4) { grid-column: auto; } }
/* Início: a carteira em aberto em destaque; atraso, mês, próximo mês, contas a pagar, vendas e
   saldo previsto ao lado. Celular: 2 por linha; média: 3 por linha; larga: destaque + 3 × 2. */
.kpi-grid.inicio { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpi-grid.inicio > .destaque { grid-column: 1 / -1; }
@media (min-width: 720px) { .kpi-grid.inicio { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1180px) { .kpi-grid.inicio { grid-template-columns: 1.5fr repeat(3, minmax(0, 1fr)); } .kpi-grid.inicio > .destaque { grid-column: 1; grid-row: span 2; display: flex; flex-direction: column; justify-content: center; } .kpi-grid.inicio > .destaque .val { font-size: clamp(0.72rem, 100cqi / (var(--n, 12) * 0.56), 2.6rem); } }
.kpi { background: var(--card); border-radius: var(--radius); padding: 16px 18px; border: 1px solid var(--border); min-width: 0; container-type: inline-size; transition: border-color 0.15s ease, background-color 0.15s ease; }
@media (hover: hover) and (pointer: fine) { .kpi[onclick]:hover { border-color: var(--border-strong); background: var(--surface-2); } }
.kpi .lbl { font-size: 0.8rem; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 7px; }
.kpi .lbl::before { content: ''; width: 8px; height: 8px; border-radius: 2px; background: var(--border-strong); flex: none; }
/* Valor nunca é cortado: a fonte encolhe só quando o número (--n caracteres, ver marcarValores) não cabe no cartão. */
.kpi .val { font-size: clamp(0.72rem, 100cqi / (var(--n, 12) * 0.56), 1.45rem); font-weight: 650; letter-spacing: -0.02em; color: var(--text-strong); margin-top: 6px; white-space: nowrap; line-height: 1.2; }
.kpi .sub { font-size: 0.78rem; color: var(--muted); margin-top: 4px; line-height: 1.45; }
.kpi.c-green .lbl::before { background: var(--success); }
.kpi.c-amber .lbl::before { background: #c27a12; }
.kpi.c-red .lbl::before { background: var(--danger); }
.kpi.c-blue .lbl::before, .kpi.c-primary .lbl::before { background: var(--primary); }
.kpi.c-red .val { color: var(--danger); }
.kpi.c-green .val { color: var(--success); }
/* O número que abre o painel: a carteira inteira em aberto */
.kpi.destaque { background: var(--card); border-color: var(--border-strong); }
.kpi.destaque .val { font-size: clamp(0.72rem, 100cqi / (var(--n, 12) * 0.56), 2rem); letter-spacing: -0.03em; color: var(--primary); }
.kpi.destaque .lbl { color: var(--text); font-weight: 600; }
@media (max-width: 719px) { .kpi .val { font-size: clamp(0.72rem, 100cqi / (var(--n, 12) * 0.56), 1.25rem); } .kpi.destaque .val { font-size: clamp(0.72rem, 100cqi / (var(--n, 12) * 0.56), 1.8rem); } .kpi { padding: 14px; } }

.status-strip { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.status-strip .pill { flex: 1; min-width: 90px; background: var(--card); border-radius: var(--r-md); padding: 10px 12px; border: 1px solid var(--border); display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--muted); }
.status-strip .pill b { font-size: 1.1rem; font-weight: 650; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; display: inline-block; }
.dot.disponivel { background: var(--st-disponivel); }
.dot.reservado { background: var(--st-reservado); }
.dot.vendido { background: var(--st-vendido); }
.dot.bloqueado { background: var(--st-bloqueado); }

/* ---------- alerts ---------- */
.alert .ico { flex: none; opacity: 0.6; }
.alert { background: var(--danger-bg); border: 1px solid #f6d3d0; border-radius: var(--r-md); padding: 11px 14px; margin-bottom: 8px; font-size: 0.86rem; display: flex; justify-content: space-between; align-items: center; gap: 12px; cursor: pointer; color: var(--text); transition: border-color 0.15s ease; }
@media (hover: hover) and (pointer: fine) { .alert:hover { border-color: #eab3ae; } }
.alert b { color: var(--danger); font-weight: 600; }
.alert.warn { background: var(--warn-bg); border-color: #f1e2b3; }
@media (hover: hover) and (pointer: fine) { .alert.warn:hover { border-color: #e2cb85; } }
.alert.warn b { color: var(--warn); }
.alert.info { background: var(--info-bg); border-color: #c7e5f8; }
.alert.info b { color: var(--info); }
.alert.ok { background: var(--success-bg); border-color: #d5e4d3; cursor: default; }
.alert.ok b { color: var(--success); }

/* ---------- lists ---------- */
.item {
  background: var(--card); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 8px;
  border: 1px solid var(--border);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
@media (hover: hover) and (pointer: fine) { .item:hover { border-color: var(--border-strong); background: var(--surface-2); } }
.item .info { flex: 1; min-width: 0; }
.item .title { font-size: 0.95rem; font-weight: 600; color: var(--text-strong); overflow-wrap: anywhere; }
.item .meta { font-size: 0.8rem; color: var(--muted); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; line-height: 1.45; }
.item .side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.item .value { font-size: 1rem; font-weight: 650; white-space: nowrap; color: var(--text-strong); letter-spacing: -0.01em; }
.item .value.small { font-size: 0.86rem; }
.item.atrasado .value { color: var(--danger); }
.item .btns { display: flex; gap: 6px; }
.btn-icon { width: var(--h-ctrl-sm); height: var(--h-ctrl-sm); border-radius: var(--r-md); border: 1px solid var(--border); cursor: pointer; font-size: 1rem; display: inline-flex; align-items: center; justify-content: center; background: var(--card); color: var(--text); flex: none; text-decoration: none; transition: background-color 0.15s ease, border-color 0.15s ease; }
@media (hover: hover) and (pointer: fine) { .btn-icon:hover { background: var(--surface-2); border-color: var(--border-strong); } }
.btn-icon.del { color: var(--danger); }
@media (hover: hover) and (pointer: fine) { .btn-icon.del:hover { background: var(--danger-bg); border-color: #f0c4c0; } }
.btn-icon.ok { color: var(--success); background: var(--success-bg); border-color: #d5e4d3; }
@media (hover: hover) and (pointer: fine) { .btn-icon.ok:hover { border-color: #a9c8a5; } }

.badge { display: inline-block; font-size: 0.6875rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; text-transform: uppercase; letter-spacing: 0.05em; line-height: 1.6; background: #f1f0ec; color: #5f5e5a; }
.badge.disponivel { background: var(--success-bg); color: #346538; }
.badge.reservado { background: var(--warn-bg); color: #956400; }
.badge.vendido { background: var(--danger-bg); color: #9f2f2d; }
.badge.bloqueado { background: #f1f0ec; color: #5f5e5a; }
.badge.pendente { background: var(--warn-bg); color: #956400; }
.badge.parcial { background: #fcebdc; color: #8a4510; }
.badge.aprovada, .badge.pago, .badge.ativa, .badge.quitada, .badge.paga { background: var(--success-bg); color: #346538; }
.badge.atrasado, .badge.recusada, .badge.cancelada, .badge.expirada, .badge.distrato { background: var(--danger-bg); color: #9f2f2d; }
.badge.convertida { background: var(--info-bg); color: var(--info); }
.badge.neutral { background: #f1f0ec; color: #5f5e5a; }
.badge-cat { display: inline-flex; align-items: center; gap: 6px; text-transform: none; letter-spacing: 0; font-size: 0.8rem; font-weight: 500; }
.badge-cat .dot { width: 8px; height: 8px; border-radius: 2px; }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty .ic { width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 14px; display: grid; place-items: center; background: #f1f0ec; color: var(--muted); font-size: 1.5rem; }
.empty p { font-size: 0.88rem; line-height: 1.55; max-width: 46ch; margin: 0 auto; }
.empty p + p { margin-top: 8px; }
.empty .btn { margin-top: 4px; }
/* Carregando: o indicador gira rápido (700 ms por volta: espera parece mais curta) e só
   aparece depois de 250 ms, para que uma resposta rápida não faça a tela piscar. */
.empty.carregando { animation: aparecer 200ms ease-out 250ms both; }
.empty.carregando .ic { background: none; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--primary); animation: girar 700ms linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
/* Botão esperando a resposta: o indicador entra antes do texto e o botão não aceita outro toque */
.btn.ocupado { pointer-events: none; }
.btn.ocupado::before { content: ''; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: girar 700ms linear infinite; flex: none; }

/* ---------- filters ---------- */
.filters { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.filters select, .filters input { flex: 1; min-width: 140px; }
.chips { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.chip { height: var(--h-ctrl-sm); padding: 0 12px; border-radius: var(--r-md); background: var(--card); border: 1px solid var(--border); font-size: 0.84rem; font-weight: 500; color: var(--muted); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease; }
@media (hover: hover) and (pointer: fine) { .chip:hover { color: var(--text); border-color: var(--border-strong); } }
.chip.active { background: var(--primary); color: white; border-color: var(--primary); }
.chip .n { background: #f1f0ec; color: #5f5e5a; border-radius: 999px; padding: 0 7px; margin-left: 2px; font-size: 0.74rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.6; }
.chip.active .n { background: rgba(255,255,255,0.2); color: white; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .btn { flex: none; }

/* ---------- forms ---------- */
select, input, textarea {
  min-height: var(--h-ctrl); padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: var(--r-md); font-size: 0.92rem;
  color: var(--text-strong); background: var(--card); width: 100%; transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
select { background-color: var(--card); color: var(--text-strong); }
textarea { line-height: 1.5; }
input::placeholder, textarea::placeholder { color: #76756f; }   /* 4,6:1 sobre branco */
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; accent-color: var(--primary); }
input[type="color"] { padding: 2px; height: 40px; }
@media (hover: hover) and (pointer: fine) { select:hover, input:hover, textarea:hover { border-color: #c2c1bb; } }
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.fg { margin-bottom: 14px; }
.fg label { display: block; font-size: 0.8rem; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.fg .hint { font-size: 0.76rem; color: var(--muted); margin-top: 4px; }
.fg textarea { resize: vertical; min-height: 72px; }
.frow { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.frow3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 16px 4px; margin-bottom: 14px; background: var(--surface-2); }
.fieldset legend, .fieldset .lg { font-size: 0.82rem; font-weight: 600; color: var(--text-strong); padding: 0; margin-bottom: 12px; display: block; }
.check { display: flex; align-items: center; gap: 10px; font-size: 0.88rem; cursor: pointer; min-height: 32px; }
.check input { width: 18px; height: 18px; }
.fg label.check { display: flex; font-size: 0.88rem; margin-bottom: 2px; }
.check input { flex: none; margin: 0; }
@media (max-width: 520px) { .frow, .frow3 { grid-template-columns: 1fr; } }

.btn {
  height: var(--h-ctrl); padding: 0 16px; border-radius: var(--r-md); border: 1px solid transparent; font-size: 0.88rem; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex: 1; white-space: nowrap; text-decoration: none; line-height: 1;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.ocupado:disabled { opacity: 0.85; cursor: progress; }
.btn-primary { background: var(--primary); color: white; }
@media (hover: hover) and (pointer: fine) { .btn-primary:hover { background: var(--primary-dark); } }
.btn-secondary { background: var(--card); color: var(--text-strong); border-color: var(--border-strong); }
@media (hover: hover) and (pointer: fine) { .btn-secondary:hover { background: var(--surface-2); border-color: #c2c1bb; } }
.btn-danger { background: var(--danger); color: white; }
@media (hover: hover) and (pointer: fine) { .btn-danger:hover { background: #8f1c13; } }
.btn-success { background: var(--success-btn); color: white; }
@media (hover: hover) and (pointer: fine) { .btn-success:hover { background: #17633a; } }
.btn-accent { background: var(--accent); color: white; }
@media (hover: hover) and (pointer: fine) { .btn-accent:hover { background: #864c05; } }
.btn-outline { background: var(--card); border-color: var(--primary); color: var(--primary); }
@media (hover: hover) and (pointer: fine) { .btn-outline:hover { background: var(--primary-soft); } }
.btn-outline-danger { background: var(--card); border-color: #e6aaa4; color: var(--danger); }
@media (hover: hover) and (pointer: fine) { .btn-outline-danger:hover { background: var(--danger-bg); } }
.btn-sm { height: var(--h-ctrl-sm); padding: 0 12px; font-size: 0.82rem; flex: none; gap: 6px; }
.btn-block { width: 100%; }
.btn-wa { background: #12804a; color: white; }
@media (hover: hover) and (pointer: fine) { .btn-wa:hover { background: #0d6a3c; } }
.btn-row { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

/* ---------- modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(21, 24, 27, calc(0.48 * var(--scrim, 1))); z-index: 500; display: none; align-items: flex-end; justify-content: center; padding: 0; }
.modal-overlay.open { display: flex; }
.modal {
  background: var(--card); border-radius: 16px 16px 0 0; width: 100%; max-width: 560px; max-height: 92vh; max-height: 92dvh;
  display: flex; flex-direction: column; box-shadow: var(--sombra-gaveta);
}
.modal.wide { max-width: 860px; }
/* Tela cheia: para escrever contrato num campo de texto que caiba o contrato */
.modal.full { max-width: 1400px; width: 96vw; height: 94vh; height: 94dvh; max-height: 94vh; max-height: 94dvh; }
.modal.full .modal-body { display: flex; flex-direction: column; }
.doc-editor-grid { display: grid; grid-template-columns: 1fr 300px; gap: 14px; flex: 1; min-height: 0; }
.doc-editor-grid > .fg { display: flex; flex-direction: column; min-height: 0; margin: 0; }
.doc-editor-grid .doc-editor { flex: 1; min-height: 300px; resize: none; }
.doc-editor-grid .doc-paleta { overflow-y: auto; border-left: 1px solid var(--border); padding-left: 12px; }
@media (max-width: 900px) { .doc-editor-grid { grid-template-columns: 1fr; } .doc-editor-grid .doc-paleta { border-left: none; padding-left: 0; max-height: 200px; } }
@keyframes janela-entra { from { opacity: 0; transform: translateY(6px) scale(0.98); } }
@keyframes janela-sai { to { opacity: 0; transform: scale(0.98); } }
@keyframes fundo-entra { from { background-color: rgba(21, 24, 27, 0); } }
@keyframes fundo-sai { to { background-color: rgba(21, 24, 27, 0); } }
.modal-head { padding: 16px 20px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-head h2 { font-size: 1.05rem; font-weight: 600; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; min-width: 0; }
.modal-close { background: none; border: 1px solid var(--border); width: 36px; height: 36px; border-radius: var(--r-md); font-size: 1rem; cursor: pointer; color: var(--muted); flex-shrink: 0; display: grid; place-items: center; }
@media (hover: hover) and (pointer: fine) { .modal-close:hover { background: var(--surface-2); color: var(--text); } }
.modal-body { padding: 18px 20px; overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.modal-foot { padding: 12px 20px calc(16px + var(--safe-bottom)); border-top: 1px solid var(--border); display: flex; gap: 8px; flex-wrap: wrap; }
.modal-foot .btn { flex: 1; }
@media (max-width: 639px) { .modal-foot .btn { height: 44px; } .modal-foot .btn-secondary { flex: 0 1 auto; } }
@media (min-width: 640px) {
  .modal-overlay { align-items: center; padding: 24px; }
  /* No computador a janela fica no meio da tela: sombra para baixo, em duas camadas (uma curta
     que marca a borda, uma longa e clara que separa do fundo). Entra de 6 px abaixo e 98% do
     tamanho, nunca do zero; sai mais rápido do que entra. */
  .modal { border-radius: 14px; max-height: 90vh; max-height: 90dvh; box-shadow: var(--sombra-janela); animation: janela-entra 200ms var(--ease-out); }
  .modal-overlay.open { animation: fundo-entra 160ms ease-out; }
  .modal-overlay.saindo { animation: fundo-sai 140ms ease-out forwards; pointer-events: none; }
  .modal-overlay.saindo .modal { animation: janela-sai 140ms ease-out forwards; }
  .modal-foot { padding-bottom: 16px; justify-content: flex-end; }
  .modal-foot .btn { flex: 0 1 auto; min-width: 120px; }
}

/* ---------- detail blocks ---------- */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 16px; font-size: 0.88rem; margin-bottom: 14px; }
.detail-grid .k { color: var(--muted); font-size: 0.76rem; font-weight: 500; }
.detail-grid .v { font-weight: 600; color: var(--text-strong); font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: break-word; }
/* Em 320 px as duas colunas não comportam um valor milionário sem partir o número. */
@media (max-width: 359px) { .detail-grid { grid-template-columns: minmax(0, 1fr); } }
.detail-grid .full { grid-column: 1 / -1; }
.price-big { font-size: 1.9rem; font-weight: 650; letter-spacing: -0.03em; color: var(--primary); line-height: 1.15; }
.price-sub { font-size: 0.82rem; color: var(--muted); }
.sim-result { background: var(--primary-soft); border: 1px solid var(--primary-light); border-radius: var(--r-md); padding: 12px 14px; font-size: 0.88rem; margin-top: 10px; line-height: 1.55; }
.sim-result b { color: var(--primary); font-variant-numeric: tabular-nums; }
/* Novo contrato em passos: no computador, os nomes dos passos; no celular, "Passo 2 de 6" e a barra */
/* fica presa no alto enquanto o passo rola: o comprador tem muitos campos */
.vf-passos { position: sticky; top: -18px; z-index: 2; background: var(--card); margin: -18px -20px 16px; padding: 14px 20px 10px; border-bottom: 1px solid var(--border); }
.vf-passos ol { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; }
.vf-passos li { flex: 1; min-width: 0; }
.vf-passos li button { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; background: none; border: 0; border-radius: var(--r-md); padding: 4px 2px 6px; font: inherit; font-size: 0.76rem; color: var(--muted); cursor: pointer; text-align: center; touch-action: manipulation; }
.vf-passos li button:disabled { cursor: default; color: #8c8b86; }
.vf-passos li button:focus-visible { outline: none; box-shadow: var(--ring); }
.vf-passos .n { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; border: 1.5px solid var(--border-strong); background: var(--card); font-weight: 600; font-size: 0.78rem; font-variant-numeric: tabular-nums; transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease; }
.vf-passos li.atual button { color: var(--text-strong); font-weight: 600; }
.vf-passos li.atual .n { background: var(--primary); border-color: var(--primary); color: #fff; }
.vf-passos li.feito .n { background: var(--primary-light); border-color: var(--primary-light); color: var(--primary); }
@media (hover: hover) and (pointer: fine) { .vf-passos li button:not(:disabled):hover { color: var(--primary); } }
.vf-passos-cel { display: none; font-size: 0.86rem; color: var(--muted); }
.vf-passos-cel b { color: var(--text-strong); }
.vf-barra { height: 4px; background: var(--border); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.vf-barra i { display: block; height: 100%; background: var(--primary); border-radius: 2px; transition: width 0.25s ease; }
@media (max-width: 639px) { .vf-passos ol { display: none; } .vf-passos-cel { display: block; } }
@media (prefers-reduced-motion: reduce) { .vf-barra i { transition: none; } }
.em-passos > .vf-passo:not(.on) { display: none; }
.em-passos:not([data-passo="4"]):not([data-passo="5"]) > #vfResumo { display: none; }
.vf-conf-bloco { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; background: var(--card); }
.vf-conf-bloco > .row-between { margin-bottom: 8px; }
.vf-conf-bloco h3 { font-size: 0.8rem; font-weight: 600; color: var(--muted); margin: 0; }
.vf-conf-bloco .detail-grid { margin-bottom: 0; }
.vf-conf-bloco .alert { margin: 10px 0 0; }
.vf-alterar { background: none; border: 0; border-radius: var(--r-sm); color: var(--primary); font: inherit; font-size: 0.82rem; font-weight: 600; cursor: pointer; padding: 6px 8px; margin: -6px -8px -6px 0; min-height: 32px; touch-action: manipulation; }
.vf-alterar:focus-visible { outline: none; box-shadow: var(--ring); }
@media (hover: hover) and (pointer: fine) { .vf-alterar:hover { text-decoration: underline; } }
.vf-conf-pessoa + .vf-conf-pessoa { margin-top: 8px; }
.vf-conf-total { font-size: 1.05rem; }
.vf-conf-soma { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 8px; font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.vf-conf-soma b { color: var(--primary); }
/* Erros do app (Configurações) */
.erros-lista { display: flex; flex-direction: column; }
.erro-item { padding: 12px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.erro-item:last-child { border-bottom: 0; }
.erro-msg { font-weight: 600; color: var(--text-strong); overflow-wrap: anywhere; min-width: 0; }
.erro-item .row-between { align-items: flex-start; gap: 12px; }
.erro-item details summary { cursor: pointer; color: var(--primary); margin-top: 4px; }
.erro-pilha { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.75rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 8px 10px; margin: 6px 0 0; max-height: 240px; overflow: auto; }
/* Balancete (Relatórios): seções, totais e resultado com peso diferente; a coluna da conta
   fica presa na rolagem lateral quando há muitos meses */
.tbl-balancete td, .tbl-balancete th { white-space: nowrap; }
/* Plano de contas e centros de custo: grupo com as contas embaixo */
.pc-sec { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); margin: 18px 0 6px; }
.pc-grupo { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.pc-gh { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 6px; }
.pc-gh > div { min-width: 0; }
.pc-gh .h-actions { display: flex; gap: 6px; flex-shrink: 0; }
.pc-grupo .item.pc-conta { margin-bottom: 4px; }
.item.pc-auto { cursor: default; }
.item.pc-conta.inativa .title { color: var(--muted); }
.tbl-balancete th:first-child, .tbl-balancete td:first-child { position: sticky; left: 0; background: var(--card); z-index: 1; white-space: normal; min-width: 180px; }
.tbl-balancete th:first-child { background: var(--surface-2); z-index: 2; }
.tbl-balancete .bal-sec td { background: var(--surface-2); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); padding-top: 10px; }
.tbl-balancete .bal-conta td { font-weight: 500; color: var(--text-strong); }
.tbl-balancete .bal-sub td { color: var(--muted); font-size: 0.82rem; }
.tbl-balancete .bal-sub td:first-child { padding-left: 26px; }
.tbl-balancete .bal-tot td { font-weight: 600; color: var(--text-strong); border-top: 1px solid var(--border-strong); }
.tbl-balancete .bal-res td { font-weight: 700; color: var(--text-strong); border-top: 2px solid var(--text-strong); background: var(--surface-2); }
.tbl-balancete .bal-res td.pos { color: var(--success); }
.tbl-balancete .bal-res td.neg { color: var(--danger); }
.bal-notas p + p { margin-top: 6px; }
.progress { background: #ecebe7; border-radius: 999px; height: 6px; overflow: hidden; margin-top: 8px; }
.progress > div { height: 100%; border-radius: 999px; background: var(--success-btn); }
.progress > div.warn { background: #c27a12; }
.progress > div.over { background: var(--danger); }

/* ---------- tables ---------- */
/* No celular a tabela rola para o lado; a sombra na borda mostra que tem mais coluna. */
.table-wrap {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  background:
    linear-gradient(to right, var(--card) 30%, rgba(255,255,255,0)) left center / 32px 100% no-repeat local,
    linear-gradient(to left, var(--card) 30%, rgba(255,255,255,0)) right center / 32px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(21,24,27,0.12), transparent) left center / 10px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(21,24,27,0.12), transparent) right center / 10px 100% no-repeat scroll;
}
table.tbl { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.tbl th, .tbl td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { color: var(--text); }
.tbl th { color: var(--muted); font-weight: 600; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; background: var(--surface-2); position: sticky; top: 0; }
.tbl td.num, .tbl th.num { text-align: right; }
@media (hover: hover) and (pointer: fine) { .tbl tbody tr:hover td { background: var(--surface-2); } }
.tbl tr.clickable { cursor: pointer; }
.tbl tfoot td { font-weight: 650; color: var(--text-strong); border-top: 1px solid var(--border-strong); border-bottom: none; background: var(--surface-2); }
.tbl .btn-icon { width: 32px; height: 32px; }

/* ---------- planta ---------- */
.planta-wrap { position: relative; background: #ecebe7; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); height: 62vh; height: 62svh; min-height: 320px; }
.planta-wrap.tall { height: 70vh; height: 70svh; }
.planta-svg { width: 100%; height: 100%; display: block; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.planta-svg.tool-rect, .planta-svg.tool-poly { cursor: crosshair; }
.planta-svg.grabbing { cursor: grabbing; }
.lote-shape { stroke: #ffffff; stroke-width: 1.5; stroke-linejoin: round; cursor: pointer; transition: fill-opacity 0.15s, fill 400ms ease; }
/* Lote que acabou de trocar de situação: a cor passa da antiga para a nova e um contorno
   escuro marca o lote e se desfaz, para achar qual foi na planta inteira. */
.lote-shape.mudou { animation: lote-mudou 1s ease-out; }
@keyframes lote-mudou { from { stroke: #15181b; stroke-width: 4; } }
.lote-shape.disponivel { fill: var(--st-disponivel); }
.lote-shape.reservado { fill: var(--st-reservado); }
.lote-shape.vendido { fill: var(--st-vendido); }
.lote-shape.bloqueado { fill: var(--st-bloqueado); }
@media (hover: hover) and (pointer: fine) { .lote-shape:hover { fill-opacity: 1 !important; stroke: #15181b; } }
.lote-shape.selected { stroke: #15181b; stroke-width: 3; fill-opacity: 1 !important; }
.lote-shape.dim { fill-opacity: 0.18 !important; }
.lote-label { font-family: 'Geist', system-ui, sans-serif; font-weight: 650; fill: #15181b; pointer-events: none; text-anchor: middle; dominant-baseline: central; paint-order: stroke; stroke: rgba(255,255,255,0.85); stroke-width: 2px; font-variant-numeric: tabular-nums; }
.quadra-block { fill: #ffffff; stroke: var(--border-strong); stroke-width: 1.5; }
.quadra-label { font-family: 'Geist', system-ui, sans-serif; font-weight: 650; fill: #3a3d40; pointer-events: none; }
.draw-shape { fill: rgba(14,76,115,0.2); stroke: var(--primary); stroke-width: 2; stroke-dasharray: 6 4; pointer-events: none; }
.draw-pt { fill: var(--primary); stroke: white; stroke-width: 1.5; pointer-events: none; }
/* Marca da situação sobre a cor (listras, pontos, xadrez): não pega o toque, que é do lote */
.lote-marca { pointer-events: none; }
/* Lote em que o cursor do teclado está: contorno escuro grosso */
.lote-shape.teclado { stroke: #15181b; stroke-width: 4; fill-opacity: 1 !important; }
.planta-wrap:focus-visible { outline: none; box-shadow: var(--ring); }
/* Legenda dentro da planta, no canto de baixo à esquerda */
.planta-legenda { position: absolute; left: 10px; bottom: 10px; right: 64px; z-index: 4; display: flex; flex-wrap: wrap; gap: 4px 12px; background: rgba(255, 255, 255, 0.94); border: 1px solid var(--border); border-radius: var(--r-md); padding: 6px 10px; font-size: 0.74rem; color: var(--text); pointer-events: none; width: max-content; max-width: calc(100% - 74px); }
.planta-legenda span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.amostra { display: inline-block; width: 14px; height: 14px; border-radius: 3px; flex: none; }
.amostra.disponivel { background: var(--st-disponivel); }
.amostra.reservado { background: radial-gradient(circle, rgba(255,255,255,0.8) 1.2px, transparent 1.6px) 0 0 / 5px 5px, var(--st-reservado); }
.amostra.vendido { background: repeating-linear-gradient(-45deg, rgba(255,255,255,0.6) 0 1.5px, transparent 1.5px 4.5px), var(--st-vendido); }
.amostra.bloqueado { background: repeating-linear-gradient(45deg, rgba(255,255,255,0.6) 0 1px, transparent 1px 4px), repeating-linear-gradient(-45deg, rgba(255,255,255,0.6) 0 1px, transparent 1px 4px), var(--st-bloqueado); }
.planta-ctrls { position: absolute; right: 12px; top: 12px; display: flex; flex-direction: column; gap: 6px; z-index: 5; }
.planta-ctrls button { width: 40px; height: 40px; border-radius: var(--r-md); border: 1px solid var(--border-strong); background: rgba(255,255,255,0.96); cursor: pointer; font-size: 1.05rem; color: var(--text-strong); display: grid; place-items: center; }
@media (hover: hover) and (pointer: fine) { .planta-ctrls button:hover { background: white; } }
.planta-hint { position: absolute; left: 12px; bottom: 12px; background: rgba(21,24,27,0.82); color: white; font-size: 0.76rem; padding: 6px 10px; border-radius: var(--r-md); pointer-events: none; z-index: 5; max-width: calc(100% - 76px); }
.planta-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; color: var(--muted); font-size: 0.9rem; padding: 20px; pointer-events: none; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.8rem; color: var(--muted); margin-top: 10px; align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.planta-layout { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 900px) { .planta-layout { grid-template-columns: 2fr 1fr; align-items: start; } }
.lote-picker { max-height: 60vh; max-height: 60svh; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
.lote-picker .row { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 0.86rem; }
@media (hover: hover) and (pointer: fine) { .lote-picker .row:hover { background: var(--surface-2); } }
.lote-picker .row.sel { background: var(--primary-light); font-weight: 600; }
.lote-picker .row .pos { margin-left: auto; font-size: 0.74rem; color: var(--muted); }
.lote-picker .row .pos.ok { color: var(--success); font-weight: 600; }
.tools { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.tools .chip.active { background: var(--primary); border-color: var(--primary); }

/* ---------- misc ---------- */
.fab { position: fixed; bottom: calc(20px + var(--safe-bottom)); right: 20px; width: 56px; height: 56px; border-radius: 16px; background: var(--primary); color: white; border: none; font-size: 1.5rem; cursor: pointer; box-shadow: 0 1px 2px rgba(9, 53, 83, 0.2), 0 6px 18px rgba(9, 53, 83, 0.26); z-index: 200; display: none; align-items: center; justify-content: center; transition: background-color 0.15s ease, transform 0.1s ease; }
@media (hover: hover) and (pointer: fine) { .fab:hover { background: var(--primary-dark); } }
.fab:active { transform: scale(0.96); }
.fab.show { display: flex; }
.toast-container { position: fixed; top: calc(64px + var(--safe-top)); right: 16px; left: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; box-shadow: var(--sombra-flutua); font-size: 0.86rem; max-width: 340px; animation: slideIn 220ms var(--ease-out); pointer-events: none; color: var(--text); }
/* O aviso sai pelo mesmo caminho por onde entrou (para cima), mais rápido. */
.toast.saindo { animation: toast-sai 160ms ease-out forwards; }
@keyframes toast-sai { to { opacity: 0; transform: translateY(-6px); } }
.toast.ok .t .ico { color: var(--success); }
.toast .t { font-weight: 600; color: var(--text-strong); display: flex; align-items: center; gap: 8px; }
.toast .t .ico { color: var(--primary); font-size: 1.1rem; }
.toast .b { margin-top: 3px; padding-left: 26px; color: var(--muted); }
.toast.err .t .ico { color: var(--danger); }
@keyframes slideIn { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }
/* Linha que acabou de mudar de situação (lote reservado, vendido ou liberado; parcela paga):
   fica tingida da cor nova e volta ao normal em pouco mais de um segundo. O selo se acomoda. */
.st-mudou { animation: linha-mudou 1.4s ease-out; }
@keyframes linha-mudou { from { background-color: var(--destaque, var(--primary-soft)); } }
.st-mudou .badge, .st-mudou .pill { animation: selo-mudou 320ms var(--ease-out); }
@keyframes selo-mudou { from { transform: scale(0.88); opacity: 0.4; } }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.tiny { font-size: 0.75rem; }
.right { text-align: right; }
.mt { margin-top: 12px; } .mb { margin-bottom: 12px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.subtabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 16px; }
.grid2 > .card { margin-bottom: 0; }
.grid2 > * { min-width: 0; }
@media (min-width: 820px) { .grid2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
canvas.chart { width: 100%; display: block; }
.legend-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; font-size: 0.8rem; color: var(--muted); }
.legend-list div { display: flex; align-items: center; gap: 8px; }
.legend-list .lv { margin-left: auto; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.act-log { font-size: 0.82rem; }
.act-log div { padding: 8px 0; border-bottom: 1px solid var(--border); display: flex; gap: 10px; }
.act-log .when { color: var(--muted); white-space: nowrap; font-size: 0.76rem; font-variant-numeric: tabular-nums; }
.code-box { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 0.78rem; background: #15181b; color: #e8e7e3; border-radius: var(--r-md); padding: 12px; word-break: break-all; white-space: pre-wrap; }
.steps { font-size: 0.86rem; line-height: 1.6; padding-left: 20px; }
.steps li { margin-bottom: 4px; }
.pin-input { font-size: 1.6rem; letter-spacing: 0.4em; text-align: center; }
.sim-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }

/* ---------- documentos (proposta / contrato) ---------- */
.doc-folha { background: white; border: 1px solid var(--border); border-radius: var(--r-md); padding: 26px 30px; font-family: Georgia, 'Times New Roman', serif; font-size: 0.92rem; line-height: 1.6; color: #111; max-height: 58vh; max-height: 58dvh; overflow: auto; }
.doc-folha:focus { outline: 2px solid var(--primary-light); }
.doc-folha h2 { font-size: 1.05rem; text-align: center; margin: 0 0 14px; text-transform: uppercase; letter-spacing: 0.02em; color: #111; }
.doc-folha h3 { font-size: 0.95rem; margin: 16px 0 6px; color: #111; }
.doc-folha p { margin: 0 0 10px; text-align: justify; }
.doc-folha hr { border: none; border-top: 1px solid #ddd; margin: 18px 0; }
.doc-folha .doc-vazio { color: #b45309; }
.doc-folha table.doc-tab { width: 100%; border-collapse: collapse; margin: 10px 0 14px; font-family: system-ui, sans-serif; font-size: 0.82rem; }
.doc-folha table.doc-tab th, .doc-folha table.doc-tab td { border: 1px solid #ccc; padding: 5px 8px; text-align: left; }
.doc-folha table.doc-tab th { background: #f1f5f9; }
.doc-editor { width: 100%; min-height: 240px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.82rem; line-height: 1.5; resize: vertical; }
.doc-paleta { border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px; background: var(--bg); max-height: 190px; overflow: auto; }
.doc-grupo { margin-bottom: 8px; font-size: 0.76rem; color: var(--muted); }
.doc-grupo b { display: block; margin-bottom: 4px; color: var(--text); font-size: 0.78rem; }
.doc-chip { border: 1px solid var(--border); background: white; color: var(--primary); border-radius: var(--r-sm); padding: 3px 9px; font-size: 0.75rem; font-weight: 500; cursor: pointer; margin: 0 4px 4px 0; font-family: inherit; }
@media (hover: hover) and (pointer: fine) { .doc-chip:hover { background: var(--primary-light); } }

/* ---------- boleto ---------- */
.boleto { background: white; border: 1px solid #333; font-family: Arial, Helvetica, sans-serif; font-size: 0.78rem; color: #000; }
.boleto-topo { display: flex; align-items: center; gap: 12px; border-bottom: 2px solid #000; padding: 6px 10px; }
.boleto-topo .banco { font-size: 1.15rem; font-weight: 800; border-right: 2px solid #000; padding-right: 12px; }
.boleto-topo .linha { font-size: 0.95rem; font-weight: 700; letter-spacing: 0.02em; }
.boleto-tab { width: 100%; border-collapse: collapse; }
.boleto-tab td { border: 1px solid #333; padding: 4px 8px; vertical-align: top; }
.boleto-tab small { display: block; font-size: 0.62rem; color: #555; text-transform: uppercase; letter-spacing: 0.03em; }
.boleto-barras-box { padding: 12px 10px; }
.boleto-barras { display: block; }

#printArea { display: none; }
@media print {
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: block !important; padding: 20px; font-size: 12px; color: #000; }
  #printArea h1 { font-size: 18px; margin-bottom: 4px; }
  #printArea h2 { font-size: 14px; margin: 14px 0 6px; }
  #printArea table { width: 100%; border-collapse: collapse; }
  #printArea th, #printArea td { border: 1px solid #999; padding: 4px 6px; text-align: left; }
  #printArea .num { text-align: right; }
  #printArea .bal-sec td { font-weight: 700; text-transform: uppercase; font-size: 10px; }
  #printArea .bal-sub td:first-child { padding-left: 18px; }
  #printArea .bal-tot td, #printArea .bal-res td { font-weight: 700; }
  #printArea .doc-folha { border: none; padding: 0; font-family: Georgia, 'Times New Roman', serif; font-size: 11.5pt; line-height: 1.55; max-height: none; overflow: visible; }
  #printArea .doc-folha h2 { text-align: center; font-size: 13pt; text-transform: uppercase; }
  #printArea .doc-folha h3 { font-size: 11.5pt; margin: 12px 0 5px; }
  #printArea .doc-folha p { text-align: justify; margin: 0 0 9px; }
  #printArea .doc-folha .doc-vazio { color: #000; }
  #printArea .doc-folha table.doc-tab th { background: #eee; }
  @page { margin: 18mm 16mm; }
  #printArea .boleto { border: 1px solid #000; }
  #printArea .boleto-barras { height: 16mm; }
}

/* ---------- autenticação ---------- */
.auth-card { background: white; color: var(--text); border-radius: var(--radius); padding: 22px 20px; margin-top: 24px; text-align: left; }
.auth-card h2 { font-size: 1.15rem; font-weight: 650; letter-spacing: -0.01em; margin-bottom: 14px; }
.auth-links { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; font-size: 0.86rem; }
.auth-card .item { cursor: pointer; }

/* Bloco recolhível da qualificação: o essencial fica à vista e o resto abre quando precisa */
details.qualif, details.ver-tabela { border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 12px; margin: 4px 0 12px; background: var(--card); }
details.qualif > summary, details.ver-tabela > summary { cursor: pointer; font-size: 0.86rem; font-weight: 600; color: var(--primary); list-style: none; display: flex; align-items: center; gap: 6px; }
details.qualif > summary::-webkit-details-marker, details.ver-tabela > summary::-webkit-details-marker { display: none; }
details.qualif > summary::before, details.ver-tabela > summary::before { content: '+'; display: inline-grid; place-items: center; width: 18px; height: 18px; border: 1px solid var(--border-strong); border-radius: 4px; font-size: 0.8rem; line-height: 1; color: var(--text); }
details.qualif[open] > summary::before, details.ver-tabela[open] > summary::before { content: '−'; }
details.qualif[open] > summary, details.ver-tabela[open] > summary { margin-bottom: 12px; }
.tiny.ok { color: var(--success); }

/* Cada pessoa a mais na venda ganha o seu bloco, separado do anterior */
.pessoa-bloco + .pessoa-bloco { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; }

/* Lançamento de índices: navegação de ano e a coluna de doze meses */
.ix-ano-nav { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 14px; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.ix-tab td { padding: 8px 10px; }
.ix-tab th:last-child, .ix-tab td:last-child { width: 28px; }
.ix-tab tr.ix-futuro td:first-child { color: var(--muted); }
.ix-val { text-align: right; padding: 6px 8px; font-variant-numeric: tabular-nums; }
.ix-resumo-grid { display: flex; flex-wrap: wrap; gap: 0; }
.ix-resumo-grid > div { flex: 1 1 120px; text-align: center; padding: 12px; border-right: 1px solid var(--border); cursor: pointer; }
.ix-resumo-grid > div:last-child { border-right: none; }
.ix-resumo-grid .v { font-size: 1.5rem; font-weight: 650; letter-spacing: -0.02em; color: var(--text-strong); }
.ix-resumo-grid .k { font-size: 0.8rem; color: var(--muted); }

/* ---------- menu lateral da administração ----------
   Tudo escopado em #screen-admin: a tela do corretor segue com as abas em cima, porque
   ela é usada no celular. */
#screen-admin.active { display: grid; grid-template-columns: 240px minmax(0, 1fr); }
#screen-admin .aside { background: var(--primary-dark); color: #d4e2ec; position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; padding: calc(16px + var(--safe-top)) 12px calc(24px + var(--safe-bottom)); }
#screen-admin .aside-nav { display: flex; flex-direction: column; gap: 2px; }
#screen-admin .aside .tab { display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; flex: none; border: none; border-radius: var(--r-md); padding: 0 10px; min-height: 38px; font-size: 0.88rem; font-weight: 450; color: #d4e2ec; }
@media (hover: hover) and (pointer: fine) { #screen-admin .aside .tab:hover { background: rgba(255,255,255,0.07); color: white; } }
#screen-admin .aside .tab.active { background: rgba(255,255,255,0.13); color: white; font-weight: 600; border: none; }
#screen-admin .aside .tab[data-g] { padding-left: 10px; }
#screen-admin .aside-rot { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
#screen-admin .aside-rot .ico { font-size: 1.05rem; opacity: 0.9; }
#screen-admin .aside-grupo { margin: 18px 0 6px; padding: 0 10px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: #8fb0c8; }
#screen-admin .aside-acao { padding: 0 10px; min-height: 38px; display: flex; align-items: center; border-radius: var(--r-md); font-size: 0.88rem; color: #b7d8ee; cursor: pointer; }
@media (hover: hover) and (pointer: fine) { #screen-admin .aside-acao:hover { background: rgba(255,255,255,0.07); color: white; } }
#screen-admin .aside-sep { height: 1px; background: rgba(255,255,255,0.1); margin: 14px 8px; }
#screen-admin .aside .tab-badge { margin: 0; }
#screen-admin .admin-main { min-width: 0; display: block; }
#screen-admin .view { max-width: 1240px; padding: 24px 28px calc(96px + var(--safe-bottom)); }
.aside-burger { display: none; background: none; border: 1px solid rgba(255,255,255,0.32); color: white; border-radius: var(--r-md); width: 38px; height: var(--h-ctrl-sm); font-size: 1.1rem; cursor: pointer; flex: none; }
.aside-scrim { display: none; }
@media (max-width: 900px) {
  #screen-admin.active { display: block; }
  #screen-admin .aside { position: fixed; left: 0; top: 0; bottom: 0; width: 272px; z-index: 300; transform: translateX(-100%); transition: transform 0.2s ease; }
  body.aside-aberto #screen-admin .aside { transform: none; }
  body.aside-aberto .aside-scrim { display: block; position: fixed; inset: 0; background: rgba(21, 24, 27, 0.45); z-index: 250; }
  .aside-burger { display: inline-flex; align-items: center; justify-content: center; }
  #screen-admin .view { padding: 16px 16px calc(96px + var(--safe-bottom)); }
  #screen-admin .aside .tab, #screen-admin .aside-acao { min-height: 44px; }
}
.sync-pendentes:not(:empty) { padding: 16px 16px 0; max-width: 1240px; }
@media (min-width: 901px) { #screen-admin .sync-pendentes:not(:empty) { padding: 20px 28px 0; } }
.chart-tip { display: none; position: absolute; top: 4px; left: 0; z-index: 5; pointer-events: none; background: #fff; border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--sombra-flutua); padding: 10px 12px; font-size: 0.8rem; color: var(--text-strong); min-width: 190px; }
.chart-tip b { display: block; margin-bottom: 4px; }
.chart-tip div { display: flex; align-items: center; gap: 6px; }
.chart-tip div span:last-child { margin-left: auto; font-variant-numeric: tabular-nums; }
.chart-tip .tip-total { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--border); color: #52514e; }
.chart-tip .tip-sub { display: block; padding-left: 14px; margin-bottom: 2px; font-size: 0.72rem; color: #6b6a65; }
/* ===== página do contrato ===== */
.ct-acoes { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.ct-acoes .btn { flex: none; }
/* Topo do contrato: Voltar à esquerda, os menus à direita e a ação principal por último. No
   celular a ação principal desce para uma linha inteira, perto do polegar. */
.ct-topo { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.ct-topo > .btn { flex: none; }
.ct-menus { display: flex; gap: 8px; margin-left: auto; }
@media (max-width: 639px) { .ct-topo > .ct-principal { flex: 1 1 100%; height: var(--h-ctrl); font-size: 0.92rem; } }
/* Menu de ações: o botão abre uma lista ancorada nele (sai do botão, não do meio da tela) */
details.menu { position: relative; }
details.menu > summary { list-style: none; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu > summary .ico { font-size: 0.85em; transition: transform 150ms var(--ease-out); }
details.menu[open] > summary .ico { transform: rotate(180deg); }
details.menu[open] > summary { background: var(--surface-2); border-color: var(--border-strong); }
.menu-lista { position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 230px; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--sombra-flutua); padding: 6px; display: flex; flex-direction: column; transform-origin: top right; animation: menu-abre 140ms var(--ease-out); }
@keyframes menu-abre { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }
/* Abre para o lado em que cabe na tela (ver fecharMenus em core.js) */
details.menu.para-direita .menu-lista { right: auto; left: 0; transform-origin: top left; }
.menu-lista hr { border: 0; border-top: 1px solid var(--border); margin: 6px 4px; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: var(--r-sm); background: none; font: inherit; font-size: 0.88rem; font-weight: 500; color: var(--text); text-align: left; text-decoration: none; cursor: pointer; min-height: 40px; }
.menu-item .ico { color: var(--muted); }
.menu-item.perigo, .menu-item.perigo .ico { color: var(--danger); }
.menu-item:active { background: var(--surface-2); }
@media (hover: hover) and (pointer: fine) { .menu-item:hover { background: var(--surface-2); } .menu-item.perigo:hover { background: var(--danger-bg); } }
@media (prefers-reduced-motion: reduce) { .menu-lista { animation: aparecer 120ms ease-out; } details.menu > summary .ico { transition: none; } }
.ct-cab { padding-bottom: 18px; }
.ct-num { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--muted); }
.ct-num b { white-space: nowrap; }
.ct-num .badge { margin-left: auto; }
.ct-titulo { font-size: 1.4rem; font-weight: 650; letter-spacing: -0.02em; margin: 8px 0 4px; color: var(--text-strong); }
.ct-cab .meta { font-size: 0.86rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 2px 6px; line-height: 1.5; }
.ct-cab .meta > span { min-width: 0; overflow-wrap: anywhere; }
.ct-titulo .muted { font-weight: 500; font-size: 1rem; letter-spacing: 0; }
.ct-kpis { margin: 16px 0 12px; }
/* ===== reserva: a proposta é a decisão ===== */
/* Permissões por pessoa: cada opção diz se segue o padrão da função ou foi ajustada */
.perm-linha { display: flex; align-items: center; gap: 8px; }
.perm-linha > span:first-of-type { flex: 1; }
.perm-tag { font-size: 0.72rem; color: var(--muted); white-space: nowrap; }
.perm-tag.ajustada { color: var(--warn); font-weight: 600; }
/* De quem é a despesa, ao lado da descrição */
.vinc { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; font-size: 0.8rem; font-weight: 500; color: var(--muted); vertical-align: 1px; }
.vinc.empresa { color: var(--primary); font-weight: 600; }
.rs-quem { font-size: 0.92rem; color: var(--text); margin-bottom: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.rs-proposta { border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 4px 16px; margin-bottom: 14px; background: var(--card); }
.rs-linha { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 2px 12px; padding: 10px 0; border-bottom: 1px solid var(--border); align-items: baseline; }
.rs-linha:last-of-type { border-bottom: 0; }
.rs-linha .k { color: var(--muted); font-size: 0.82rem; }
.rs-linha .v { font-weight: 650; font-size: 1.05rem; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.rs-cmp { grid-column: 2; font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.rs-cmp.abaixo { color: var(--warn); font-weight: 600; }
.rs-cmp.acima { color: var(--success); font-weight: 600; }
.rs-obs { font-size: 0.86rem; color: var(--text); padding: 10px 0; border-top: 1px solid var(--border); }
.rs-aviso { display: flex; gap: 8px; align-items: flex-start; margin: 4px -16px 0; padding: 10px 16px; background: var(--warn-bg); color: var(--warn); font-size: 0.84rem; font-weight: 600; border-radius: 0 0 var(--radius) var(--radius); }
.rs-aviso .ico { flex: none; margin-top: 2px; }
.rs-ok { display: flex; gap: 10px; align-items: flex-start; background: var(--success-bg); color: var(--success); border: 1px solid #cfe3cc; border-radius: var(--r-md); padding: 12px 14px; margin-bottom: 14px; font-size: 0.9rem; }
.rs-ok > .ico { flex: none; font-size: 1.15rem; margin-top: 1px; }
.rs-ok-acoes { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.rs-ok-acoes .btn { flex: none; }
.rs-outras { font-size: 0.86rem; margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.rs-outras .sep { color: var(--border-strong); }
/* Ação secundária com cara de link: não compete com o par principal do rodapé */
button.link, a.link { background: none; border: 0; padding: 4px 2px; font: inherit; font-weight: 600; color: var(--primary); cursor: pointer; text-decoration: underline; text-decoration-color: rgba(14, 76, 115, 0.3); text-underline-offset: 3px; min-height: 32px; }
button.link.perigo { color: var(--danger); text-decoration-color: rgba(180, 35, 24, 0.3); }
@media (hover: hover) and (pointer: fine) { button.link:hover, a.link:hover { text-decoration-color: currentColor; } }
/* Em telas de 320px o cartão do contrato não tem largura para dois valores milionários lado a lado. */
@media (max-width: 359px) { .ct-kpis { grid-template-columns: minmax(0, 1fr); } .kpi-grid { gap: 8px; } .kpi { padding: 12px; } }
.ct-parte { padding: 12px 0; border-bottom: 1px solid var(--border); }
.ct-parte:last-child { border-bottom: 0; }
.ct-qualif { font-size: 0.88rem; color: var(--text); margin: 6px 0 2px; line-height: 1.55; }
.ct-acoes-linha { white-space: nowrap; }
.ct-acoes-linha .btn-icon + .btn-icon { margin-left: 4px; }
/* No celular cada parcela vira um bloco: nome e situação em cima, vencimento e valor no
   meio, o que já foi pago e os botões embaixo. Nada fica escondido à direita. */
@media (max-width: 719px) {
  .tbl-parcelas thead { display: none; }
  .tbl-parcelas, .tbl-parcelas tbody, .tbl-parcelas tfoot { display: block; }
  .tbl-parcelas tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
  .tbl-parcelas td { display: block; border: 0; padding: 0; white-space: normal; background: none !important; }
  .tbl-parcelas td:nth-child(1) { grid-area: 1 / 1; font-weight: 600; color: var(--text-strong); }
  .tbl-parcelas td:nth-child(5) { grid-area: 1 / 2; justify-self: end; }
  .tbl-parcelas td:nth-child(2) { grid-area: 2 / 1; color: var(--muted); font-size: 0.82rem; }
  .tbl-parcelas td:nth-child(2)::before { content: 'vence '; }
  .tbl-parcelas td:nth-child(3) { grid-area: 2 / 2; text-align: right; font-weight: 600; color: var(--text-strong); }
  .tbl-parcelas td:nth-child(4) { grid-area: 3 / 1; color: var(--muted); font-size: 0.82rem; text-align: left; }
  .tbl-parcelas tbody td:nth-child(4)::before { content: 'pago '; }
  .tbl-parcelas td:nth-child(6) { grid-area: 3 / 2; justify-self: end; margin-top: 6px; }
  .tbl-parcelas tfoot tr { grid-template-columns: 1fr auto auto; background: var(--surface-2); padding: 12px; border-radius: var(--r-md); border: 0; margin-top: 8px; }
  .tbl-parcelas tfoot td { grid-area: auto !important; }
  .tbl-parcelas tfoot td:empty { display: none; }
  .tbl-parcelas tbody tr:hover td { background: none; }
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.ct-nº { font-size: 0.75rem; font-weight: 600; color: var(--primary); background: var(--primary-light); border-radius: var(--r-sm); padding: 1px 6px; margin-right: 2px; font-variant-numeric: tabular-nums; }
.ct-linha-tempo { display: flex; flex-direction: column; gap: 14px; }
.ct-ev { display: flex; gap: 12px; align-items: flex-start; font-size: 0.88rem; }
.ct-ev-ic { width: 32px; height: 32px; border-radius: var(--r-md); background: #f1f0ec; color: var(--muted); display: grid; place-items: center; flex: none; }

/* ---------- celular ---------- */
@media (max-width: 639px) {
  select, input, textarea { min-height: 44px; }
  .btn { height: 44px; }
  .btn-sm, .chip { height: 40px; }
  .btn-icon { width: 40px; height: 40px; }
  .tbl .btn-icon { width: 36px; height: 36px; }
  .card { padding: 16px; }
  .topbar .top-link { padding: 0 10px; }
}

/* ---------- movimento reduzido ---------- */
@media (prefers-reduced-motion: reduce) {
  #screen-admin .aside { transition: none; }
  .modal { animation: none; }
  .toast { animation: aparecer 150ms ease-out; }
  .toast.saindo { animation: sumir 120ms ease-out forwards; }
  /* o tom da linha e a troca de cor na planta ficam (são cor, não movimento); o selo e o contorno não */
  .st-mudou .badge, .st-mudou .pill, .lote-shape.mudou { animation: none; }
  /* sem giro: o indicador pulsa devagar */
  .spinner, .btn.ocupado::before { animation: pulsar 1.2s ease-in-out infinite alternate; border-right-color: currentColor; }
  .spinner { border-top-color: var(--border-strong); background: var(--primary-light); }
  .btn, .fab, .landing-btn { transition: none; }
  .btn:active:not(:disabled), .fab:active, .landing-btn:active { transform: none; }
}
.legend-list[style*="row"] { flex-wrap: wrap; }

/* ---------- toque (celular e tablet) ----------
   Regras de plataforma: o que separa um site aberto no celular de um app instalado. */

/* Campo com letra menor que 16px faz o iPhone aproximar a tela ao tocar, e ela não volta.
   Vale para todo aparelho de toque, inclusive tablet, onde a tela é larga mas o dedo é o mesmo. */
@media (pointer: coarse) {
  select, input, textarea, .topbar select { font-size: 16px; }
}

/* Segurar o dedo num botão não seleciona o texto dele nem abre o menu de copiar. Texto de
   conteúdo (nomes, valores, endereços) continua selecionável. */
button, .btn, .btn-icon, .chip, .tab, .top-link, .aside-acao, .landing-btn, .fab, .modal-close,
.planta-ctrls button, .aside-burger, summary, label.btn {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}

/* Resposta no toque: o realce do navegador foi desligado, então cada coisa tocável mostra o
   próprio "apertou" no instante em que o dedo encosta (:active), em vez de esperar soltar. */
.item:active, .kpi[onclick]:active, .alert[onclick]:active, .lote-picker .row:active { background: var(--surface-2); border-color: var(--border-strong); }
.chip:active, .btn-icon:active, .modal-close:active, .planta-ctrls button:active { transform: scale(0.96); }
.chip, .btn-icon, .modal-close, .planta-ctrls button { transition: transform 0.1s ease-out, background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease; }
.tab:active { color: var(--text); }
.top-link:active, .aside-burger:active { background: rgba(255,255,255,0.14); }
#screen-admin .aside .tab:active, #screen-admin .aside-acao:active { background: rgba(255,255,255,0.1); }

/* ---------- gaveta (janela no celular) e menu lateral ----------
   O movimento é feito por gestos.js com mola; aqui só a forma e o que o dedo pode fazer. */
@media (max-width: 639px) {
  /* A janela do celular é uma gaveta: alça para puxar, e a mola cuida da entrada */
  .modal { animation: none; will-change: transform; }
  .modal::before { content: ''; flex: none; width: 36px; height: 5px; border-radius: 3px; background: var(--border-strong); margin: 8px auto 0; }
  .modal-head { padding-top: 10px; touch-action: none; cursor: grab; }
  .modal-body { overscroll-behavior: contain; }
}
@media (max-width: 639px) and (prefers-reduced-motion: reduce) {
  .modal { animation: aparecer 0.2s ease-out; will-change: auto; }
}
/* Movimento reduzido no computador: a janela só aparece e some (opacidade), sem deslizar nem encolher */
@media (min-width: 640px) and (prefers-reduced-motion: reduce) {
  .modal-overlay.open, .modal-overlay.saindo { animation: none; }
  .modal { animation: aparecer 120ms ease-out; }
  .modal-overlay.saindo .modal { animation: sumir 120ms ease-out forwards; }
}
@keyframes aparecer { from { opacity: 0; } to { opacity: 1; } }
@keyframes sumir { to { opacity: 0; } }
@keyframes pulsar { from { opacity: 0.35; } to { opacity: 1; } }

/* Teclado aberto: a janela passa a ocupar só a parte visível da tela, então o campo e o botão
   de confirmar ficam acima do teclado. --vv-top e --vv-h vêm do visualViewport (gestos.js). */
@media (max-width: 639px) {
  body.teclado-aberto .modal-overlay { top: var(--vv-top, 0px); bottom: auto; height: var(--vv-h, 100%); }
  body.teclado-aberto .modal { max-height: calc(var(--vv-h, 100dvh) - 12px); }
  body.teclado-aberto .modal-foot { padding-bottom: 12px; }
}

@media (max-width: 900px) {
  /* O menu acompanha o dedo na horizontal; a rolagem vertical continua com o navegador */
  #screen-admin .aside { touch-action: pan-y; overscroll-behavior: contain; }
  body.aside-aberto .aside-scrim { opacity: var(--scrim, 1); }
}

/* Cessão de direitos: no celular os botões (Termo, Desfazer) descem para baixo do texto */
@media (max-width: 640px) {
  .item.ct-cessao { flex-direction: column; align-items: stretch; }
  .item.ct-cessao .side { margin-top: 10px; align-items: flex-start; }
}

/* ---------- título das telas ---------- */
.pg-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 2px 0 14px; flex-wrap: wrap; }
.pg-tit { font-size: 1.35rem; font-weight: 650; letter-spacing: -0.015em; color: var(--text-strong); line-height: 1.2; }
.pg-sub { font-size: 0.84rem; color: var(--muted); margin-top: 2px; }
.pg-acoes { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- faixa de situação: o número é o filtro ---------- */
.st-faixa { display: grid; grid-template-columns: repeat(var(--n, 5), minmax(0, 1fr)); gap: 0; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 10px; }
.st-item { appearance: none; border: 0; border-right: 1px solid var(--border); background: transparent; padding: 12px 14px 11px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 1px; font: inherit; color: var(--text); position: relative; min-height: 44px; }
.st-item:last-child { border-right: 0; }
.st-item .st-n { font-size: 1.35rem; font-weight: 650; color: var(--text-strong); font-variant-numeric: tabular-nums; line-height: 1.15; }
.st-item .st-l { font-size: 0.82rem; font-weight: 600; color: var(--text); }
.st-item .st-v { font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.st-item.active { background: var(--primary-soft); }
.st-item.active::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--primary); }
.st-item.st-atrasado .st-n { color: var(--danger); }
.st-item.st-quitado .st-n { color: var(--success); }
@media (hover: hover) and (pointer: fine) { .st-item:hover { background: var(--surface-2); } .st-item.active:hover { background: var(--primary-soft); } }
@media (max-width: 719px) {
  .st-item { padding: 9px 6px 8px; align-items: center; text-align: center; }
  .st-item .st-n { font-size: 1.15rem; }
  .st-item .st-l { font-size: 0.72rem; }
  .st-item .st-v { display: none; }
  .ct-filtros > * { flex: 1 1 100%; }
}
.ct-resumo { font-size: 0.82rem; color: var(--muted); margin: 0 2px 14px; }
.ct-resumo b { color: var(--text-strong); }
.st-semnum { appearance: none; font: inherit; font-size: 0.8rem; font-weight: 600; color: var(--warn); background: var(--warn-bg); border: 1px solid #f1dfae; border-radius: 999px; padding: 2px 10px; cursor: pointer; }
.st-semnum.active { background: var(--warn); color: white; border-color: var(--warn); }

/* ---------- selos de situação (só quando há o que avisar) ---------- */
.pill { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; line-height: 1.5; }
.pill.atrasado { background: var(--danger-bg); color: #9f2f2d; }
.pill.vence { background: var(--warn-bg); color: #7a4f00; }
.pill.quitado { background: var(--success-bg); color: #2c5a30; }
.pill.distrato { background: #f1f0ec; color: #5f5e5a; }

/* ---------- lista de contratos: uma lista contínua, uma linha por contrato ---------- */
.ct-lista, .lista { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; }
/* Linha de lista (A receber, A pagar, despesas do imóvel): quando vence · o que é · valor e ações */
.item.linha { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 6px 18px; align-items: start; margin: 0; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 13px 16px; }
.item.linha:last-child { border-bottom: 0; }
.item.linha.atrasado { box-shadow: inset 3px 0 0 var(--danger); }
.item.linha .side { gap: 3px; }
.item.linha .side .btns { margin-top: 4px; }
.item.linha .ct-pessoa { font-size: 0.84rem; color: var(--muted); }
@media (max-width: 899px) {
  .item.linha { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "venc side" "id side"; gap: 6px 12px; padding: 12px 14px; }
  .item.linha .ct-venc { grid-area: venc; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
  .item.linha .ct-venc .ct-data .tiny { display: inline; }
  .item.linha .info { grid-area: id; }
  .item.linha .side { grid-area: side; }
}
.item.ct-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 180px 170px; gap: 6px 18px; align-items: start; margin: 0; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 14px 16px; }
.item.ct-row:last-child { border-bottom: 0; }
.item.ct-row.st-atrasado { box-shadow: inset 3px 0 0 var(--danger); }
.item.ct-row.st-distrato .ct-id .title, .item.ct-row.st-distrato .value { color: var(--muted); }
.ct-venc { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.ct-data { font-size: 0.88rem; font-weight: 600; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.ct-data .tiny { font-weight: 500; display: block; }
.ct-row .title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.ct-num { font-weight: 650; color: var(--text-strong); }
.ct-num.sem { font-size: 0.75rem; font-weight: 600; color: var(--warn); background: var(--warn-bg); border-radius: 999px; padding: 1px 8px; align-self: center; }
.ct-imovel { font-weight: 500; color: var(--text); }
.ct-imovel .ico, .ct-pessoa .ico { font-size: 0.85em; color: var(--muted); margin-right: 4px; vertical-align: -1px; }
.ct-pessoa { font-size: 0.88rem; color: var(--text); margin-top: 3px; overflow-wrap: anywhere; }
.ct-row .meta { margin-top: 3px; }
.ct-parc .progress { margin: 5px 0 4px; height: 5px; }
.ct-parc .small b { color: var(--text-strong); }
.ct-valor { align-items: flex-end; text-align: right; gap: 2px; }
.ct-valor .tiny { font-variant-numeric: tabular-nums; }
.ct-atraso { color: var(--danger); font-weight: 600; }
@media (max-width: 899px) {
  .item.ct-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "venc valor" "id id" "parc parc"; gap: 8px 12px; padding: 12px 14px; }
  .ct-venc { grid-area: venc; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
  .ct-data .tiny { display: inline; }
  .ct-id { grid-area: id; }
  .ct-parc { grid-area: parc; display: grid; grid-template-columns: auto minmax(60px, 1fr) auto; align-items: center; gap: 10px; }
  .ct-parc .progress { margin: 0; }
  .ct-valor { grid-area: valor; }
}

/* ---------- busca geral ---------- */
.top-busca { appearance: none; font: inherit; display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; border-radius: var(--r-md); border: 1px solid rgba(255,255,255,0.22); background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.86); cursor: pointer; min-width: 260px; font-size: 0.85rem; }
.top-busca .top-busca-txt { flex: 1; text-align: left; }
.top-busca kbd { font: 600 0.68rem/1 inherit; padding: 3px 5px; border-radius: 4px; border: 1px solid rgba(255,255,255,0.28); color: rgba(255,255,255,0.75); }
@media (hover: hover) and (pointer: fine) { .top-busca:hover { background: rgba(255,255,255,0.14); color: white; } }
@media (max-width: 899px) { .top-busca { min-width: 0; width: 40px; justify-content: center; padding: 0; } .top-busca .top-busca-txt, .top-busca kbd { display: none; } }
.busca-geral { width: 100%; height: 44px; font-size: 1rem; }
.busca-res { margin-top: 10px; max-height: min(60vh, 460px); overflow-y: auto; overscroll-behavior: contain; }
.busca-grupo { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); margin: 10px 4px 4px; }
.busca-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: var(--r-md); cursor: pointer; min-height: 44px; }
.busca-item .ico { color: var(--muted); margin-top: 3px; flex: none; }
.busca-item.sel { background: var(--primary-light); }
.busca-tit { font-size: 0.92rem; font-weight: 600; color: var(--text-strong); overflow-wrap: anywhere; }
.busca-sub { font-size: 0.8rem; color: var(--muted); overflow-wrap: anywhere; }

/* ---------- parcelas do mês numa barra ---------- */
.bm { padding: 16px 18px; }
.bm-cab { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.bm-cab h2 { margin: 0; }
.bm-total { font-size: 0.95rem; font-weight: 650; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.bm-barra { display: flex; gap: 2px; height: 14px; border-radius: 999px; overflow: hidden; background: #ecebe7; }
.bm-seg { appearance: none; border: 0; padding: 0; margin: 0; flex-basis: 0; cursor: pointer; min-width: 4px; }
.bm-seg.rec, .dot.rec { background: #2a78d6; }
.bm-seg.ven, .dot.ven { background: #eda100; }
.bm-seg.atr, .dot.atr { background: #d03b3b; }
@media (hover: hover) and (pointer: fine) { .bm-seg:hover { filter: brightness(0.9); } .bm-leg:hover { background: var(--surface-2); } }
.bm-legenda { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.bm-leg { appearance: none; font: inherit; text-align: left; background: transparent; border: 1px solid transparent; border-radius: var(--r-md); padding: 6px 8px; cursor: pointer; display: grid; grid-template-columns: auto 1fr; column-gap: 7px; align-items: center; color: var(--text); min-height: 44px; }
.bm-leg .dot { grid-row: 1; }
.bm-leg .bm-rot { font-size: 0.8rem; color: var(--muted); }
.bm-leg b { grid-column: 2; font-size: 0.98rem; font-weight: 650; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.bm-leg .bm-n { grid-column: 2; font-size: 0.75rem; color: var(--muted); }
@media (max-width: 719px) { .bm-legenda { grid-template-columns: 1fr; gap: 0; } .bm-leg { grid-template-columns: auto auto 1fr; } .bm-leg b { grid-column: 3; grid-row: 1; text-align: right; } .bm-leg .bm-n { grid-column: 2 / 4; } }

/* ---------- Cobrança: linha do contrato em atraso ---------- */
.cob-acoes { margin-top: 8px; gap: 6px; }
.cob-acoes .btn { flex: none; }
.cob-nunca { color: var(--danger); font-weight: 600; }
.item.linha.cob-linha { cursor: default; }
.item.linha.linha2 { grid-template-columns: minmax(0, 1fr) auto; }
@media (max-width: 899px) { .item.linha.linha2 { grid-template-areas: "id side"; } }
.cli-falta { color: var(--warn); margin-top: 3px; }
.btn-icon.wa { background: #dcfce7; color: #166534; text-decoration: none; border-color: #c4e9cf; }
.item.linha.reserva-linha.st-pendente { box-shadow: inset 3px 0 0 var(--st-reservado); }
.item.linha.reserva-linha.st-expirada { box-shadow: inset 3px 0 0 var(--danger); }
.st-item.st-aguardando .st-n { color: var(--warn); }
.st-item.st-leve .st-n { color: var(--warn); }
/* Faixa: contagem zerada fica neutra, a cor só aparece quando há o que olhar. */
.st-item.st-zero .st-n { color: var(--muted); }
/* Configurações: primeiro o assunto (Empresa, Equipe, Financeiro, Sistema), depois a tela. */
.cfg-grupos { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); overflow: hidden; margin-bottom: 12px; max-width: 640px; }
.cfg-grupo { background: none; border: 0; border-left: 1px solid var(--border); padding: 10px 8px; font: inherit; font-size: 0.9rem; font-weight: 600; color: var(--muted); cursor: pointer; min-height: 44px; }
.cfg-grupo:first-child { border-left: 0; }
.cfg-grupo.active { color: var(--text-strong); background: var(--bg); box-shadow: inset 0 -3px 0 var(--primary); }
.cfg-grupo:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
@media (hover: hover) and (pointer: fine) { .cfg-grupo:not(.active):hover { color: var(--text); } }
/* A pagar: no computador os filtros ficam à vista; no celular, atrás do botão "Filtros". */
.filtros-bloco { display: flex; flex-direction: column; }
.filtros-btn { display: none; }
@media (max-width: 899px) {
  .filtros-linha { order: -1; }
  .filtros-btn { display: inline-flex; flex: none; }
  .filtros-btn[aria-expanded="true"] .ico { transform: rotate(180deg); }
  .filtros-mais:not(.aberto) { display: none; }
}
/* Aviso com botão (Desfazer): aceita clique, mesmo com os outros avisos deixando passar. */
.toast.com-acao { pointer-events: auto; display: grid; grid-template-columns: 1fr auto; column-gap: 12px; align-items: center; }
.toast.com-acao .t, .toast.com-acao .b { grid-column: 1; }
.toast-acao { grid-column: 2; grid-row: 1 / span 2; background: none; border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font: inherit; font-weight: 600; color: var(--primary); cursor: pointer; min-height: 32px; }
.toast-acao:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
/* Corretor: os contadores da planta abrem a lista filtrada; o botão da tabela fica logo abaixo. */
.status-strip button.pill { font: inherit; font-size: 0.8rem; text-align: left; cursor: pointer; min-height: 44px; }
.status-strip button.pill:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { .status-strip button.pill:hover { border-color: var(--primary-light); } }
.c-enviar-tabela { margin-bottom: 12px; min-height: 44px; }
.sim-box .sim-result { margin: 0 0 10px; }
/* Planta: a área do lote some quando ficaria pequena demais para ler (volta ao aproximar). */
svg.area-miuda .lote-area { display: none; }
/* Contrato: o empreendimento numa linha própria embaixo do imóvel, sem o ponto solto. */
.ct-titulo .ct-emp { display: block; font-size: 0.8rem; font-weight: 500; margin-top: 2px; }
/* Pagamento de parcela atrasada: cobrar ou dispensar multa e juros, sem padrão. */
.pg-encargos { border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 12px 12px; margin: 0 0 14px; }
.pg-encargos legend { font-size: 0.82rem; font-weight: 600; color: var(--text-strong); padding: 0 4px; }
.pg-encargos.erro { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.12); }
.pg-opcao { display: flex; gap: 10px; align-items: flex-start; padding: 8px 4px; cursor: pointer; border-radius: var(--r-sm); min-height: 44px; }
.pg-opcao + .pg-opcao { border-top: 1px solid var(--border); }
.pg-opcao input { margin-top: 3px; width: 18px; height: 18px; flex: none; accent-color: var(--primary); }
.pg-opcao > span { display: flex; flex-direction: column; gap: 2px; }
/* Confirmação do app (no lugar da caixinha do navegador): por cima de tudo, até de outra janela. */
.conf-overlay { position: fixed; inset: 0; z-index: 9000; background: rgba(21, 24, 27, 0.5); display: flex; align-items: center; justify-content: center; padding: 16px; animation: aparecer 120ms ease-out; }
.conf-box { background: var(--card); border-radius: 14px; box-shadow: var(--sombra-janela); width: 100%; max-width: 440px; max-height: calc(100dvh - 32px); overflow-y: auto; padding: 20px 20px 16px; }
.conf-box h2 { font-size: 1.05rem; font-weight: 650; color: var(--text-strong); margin: 0 0 8px; }
.conf-texto { margin: 0 0 12px; color: var(--text); font-size: 0.9rem; line-height: 1.5; white-space: pre-line; }
.conf-valores { margin: 0 0 12px; border: 1px solid var(--border); border-radius: var(--r-md); }
.conf-valores > div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 12px; font-size: 0.88rem; }
.conf-valores > div + div { border-top: 1px solid var(--border); }
.conf-valores dt { color: var(--muted); margin: 0; }
.conf-valores dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text-strong); text-align: right; }
.conf-valores .forte { background: var(--surface-2); }
.conf-valores .forte dd { font-size: 0.98rem; }
.conf-itens { margin: 0 0 12px; padding-left: 18px; font-size: 0.86rem; color: var(--text); line-height: 1.5; }
.conf-itens li + li { margin-top: 4px; }
.conf-digitar { margin-bottom: 12px; }
.conf-botoes { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.conf-botoes .btn[disabled] { opacity: 0.45; cursor: not-allowed; }
@media (max-width: 639px) {
  .conf-overlay { align-items: flex-end; padding: 0; }
  .conf-box { border-radius: 16px 16px 0 0; max-height: 90dvh; padding-bottom: calc(16px + var(--safe-bottom)); }
  .conf-botoes { flex-direction: column-reverse; }
  .conf-botoes .btn { width: 100%; min-height: 44px; }
}
/* Botão + flutuante só no celular: no computador cada tela tem a ação no cabeçalho ou na barra
   de filtros, e o botão flutuante cobria a última linha da lista. */
@media (min-width: 900px) { .fab.show { display: none; } }
/* Número zerado não comemora nem alarma: fica na cor do texto ("Vendas R$ 0,00", "Em atraso R$ 0,00"). */
.kpi.zero .val { color: var(--text-strong); }
/* Item simples (Imóveis, Corretores) dentro da lista contínua: linha, não cartão dentro de cartão. */
.lista > .item:not(.linha) { margin: 0; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; }
.lista > .item:last-child { border-bottom: 0; }
/* Segunda linha do resumo: o número do mês, mais discreto que o da carteira. */
.ct-resumo.ct-resumo-sub { font-size: 0.78rem; margin-top: -6px; }

/* Caixa e bancos: saldos por empresa e extrato da conta */
.cx-empresa { margin-bottom: 18px; }
.cx-emp-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 2px 8px; }
.cx-emp-head h3 { font-size: 0.92rem; font-weight: 600; color: var(--text-strong); margin: 0; }
.cx-emp-tot { font-size: 0.92rem; font-weight: 600; color: var(--text-strong); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cx-ico { margin-right: 8px; color: var(--muted); }
.cx-conta.inativa { opacity: 0.6; }
.cx-conta .value, .cx-mov .value { font-variant-numeric: tabular-nums; white-space: nowrap; }
.value.neg, .v.neg, b.neg, .cx-emp-tot.neg, .cx-saldos .v.neg { color: var(--danger); }
.value.pos, .v.pos, .cx-saldos .v.pos { color: var(--success); }
.cx-mov .value.neg { color: var(--text-strong); }
.cx-inicial { background: var(--surface-2); cursor: default; }
.cx-inicial .title { font-weight: 500; color: var(--muted); }
.cx-saldos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.cx-saldos > div { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px 14px; min-width: 0; }
.cx-saldos .k { font-size: 0.76rem; color: var(--muted); font-weight: 500; }
.cx-saldos .v { font-size: 1.12rem; font-weight: 650; color: var(--text-strong); font-variant-numeric: tabular-nums; margin-top: 2px; overflow-wrap: anywhere; }
.cx-pend .btn { flex: none; }
.cx-pend-lista .item.linha select { margin-top: 6px; max-width: 100%; }
@media (max-width: 520px) { .cx-saldos { grid-template-columns: 1fr 1fr; } .cx-saldos > div:first-child { grid-column: 1 / -1; } }

/* Seleção em lote: caixinha em cada linha, "Selecionar todas" no alto e a barra embaixo */
.sel-topo { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 2px 8px; min-height: 28px; }
.sel-todas { display: inline-flex; align-items: center; gap: 8px; font-size: 0.84rem; font-weight: 500; color: var(--text); cursor: pointer; user-select: none; }
.sel-todas input, .sel-chk { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); cursor: pointer; flex: none; }
.item.com-sel { position: relative; padding-left: 46px; }
.item.com-sel > .sel-chk { position: absolute; left: 16px; top: 16px; }
.item.com-sel.sel-on { background: var(--primary-soft); }
.sel-mais { display: flex; justify-content: center; margin: -4px 0 16px; }
.sel-barra { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); width: min(760px, calc(100vw - 32px));
  display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; padding: 10px 12px 10px 16px;
  background: var(--card); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: 0 8px 28px rgba(14, 76, 115, 0.16); }
.sel-barra[hidden] { display: none; }
.sel-conta { font-size: 0.88rem; color: var(--text-strong); white-space: nowrap; }
.sel-acoes { display: flex; flex-wrap: wrap; gap: 6px; }
body.com-selecao .admin-main { padding-bottom: 96px; }
body.com-selecao .fab { display: none !important; }
@media (min-width: 901px) { .sel-barra { left: calc(50% + 120px); width: min(760px, calc(100vw - 292px)); } }
@media (max-width: 520px) { .sel-barra { padding: 10px 12px; } .sel-acoes { width: 100%; } .sel-acoes .btn { flex: 1 1 auto; } .sel-limpar { flex: 0 0 auto !important; } }
@media print { .sel-barra { display: none !important; } }
@media print { #printArea .boleto-pagina { break-after: page; } #printArea .boleto-pagina:last-child { break-after: auto; } }
.rj-previa { margin-top: 12px; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); font-size: 0.86rem; font-variant-numeric: tabular-nums; }
.reaj-resumo .ico { vertical-align: -0.15em; }
.reaj-aviso { flex-wrap: wrap; }

/* Logos do cliente */
.topbar .brand-logo { height: 34px; width: auto; max-width: 96px; object-fit: contain; flex: none; background: #fff; border-radius: 6px; padding: 3px; }
.topbar .brand-logo[hidden] { display: none; }
.emp-cab { display: flex; align-items: center; gap: 14px; margin: 2px 0 14px; min-width: 0; }
.emp-cab .emp-logo { height: 56px; width: auto; max-width: 140px; object-fit: contain; flex: none; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md); padding: 4px; }
.emp-logo-mini { height: 1.7em; width: auto; max-width: 4.6em; object-fit: contain; vertical-align: -0.5em; margin-right: 2px; border-radius: 3px; }
.campo-logo .logo-linha { display: flex; align-items: center; gap: 12px; }
.campo-logo .logo-prev { width: 96px; height: 64px; border: 1px dashed var(--border-strong); border-radius: var(--r-md); display: grid; place-items: center; background: var(--surface-2); color: var(--muted); flex: none; overflow: hidden; }
.campo-logo .logo-prev:not(.vazia) { border-style: solid; background: #fff; }
.campo-logo .logo-prev img { max-width: 100%; max-height: 100%; object-fit: contain; }
.campo-logo .logo-acoes { display: flex; gap: 6px; flex-wrap: wrap; }
.campo-logo label.logo-escolher { cursor: pointer; display: inline-flex; align-items: center; justify-content: center; margin: 0; font-size: inherit; font-weight: 600; }
.doc-folha-wrap { position: relative; }
.doc-folha-wrap .doc-marca-prev { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 55%; max-height: 70%; object-fit: contain; opacity: 0.07; pointer-events: none; z-index: 1; }
.doc-folha .doc-logo, #printArea .doc-logo { margin-bottom: 14px; }
.doc-folha .doc-logo img, #printArea .doc-logo img { max-height: 64px; max-width: 220px; object-fit: contain; }
.print-logo-topo, .print-logo-rodape, .print-marca-dagua { display: none; }
@media print {
  #printArea .print-logo-topo { display: block; margin-bottom: 8px; }
  #printArea .print-logo-topo img { max-height: 56px; max-width: 200px; object-fit: contain; }
  #printArea .print-logo-rodape { display: block; text-align: center; margin-top: 28px; break-inside: avoid; }
  #printArea .print-logo-rodape img { max-height: 40px; max-width: 160px; object-fit: contain; }
  #printArea .print-marca-dagua { display: block; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 60%; max-height: 60%; object-fit: contain; opacity: 0.07; z-index: 0; }
  #printArea .doc-folha { position: relative; z-index: 1; background: transparent; }
}
