/* ==========================================================================
   Aluguéis — folha de estilo única
   ========================================================================== */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-soft: #fafbfc;
  --border: #e5e7eb;
  --border-strong: #d5d9df;
  --text: #111827;
  --text-soft: #4b5563;
  --muted: #8b93a1;

  --accent: #2563eb;
  --accent-soft: #eff4ff;
  --accent-dark: #1d4ed8;

  --ok: #047857;
  --ok-soft: #ecfdf5;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 4px 16px rgba(16, 24, 40, .08);
  --shadow-lg: 0 24px 60px rgba(16, 24, 40, .18);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; }
a { color: inherit; }

/* ---------- Layout ------------------------------------------------------ */

.container {
  width: 100%;
  max-width: 1020px;
  margin: 0 auto;
  padding: 0 24px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, .85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 62px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  letter-spacing: -.01em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
}

.brand-mark svg { width: 17px; height: 17px; }

.nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.nav a {
  padding: 7px 14px;
  border-radius: 999px;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s, color .15s;
}

.nav a:hover { background: #eef0f3; color: var(--text); }

.nav a.is-active {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

main { padding: 40px 0 80px; }

/* ---------- Tipografia utilitária -------------------------------------- */

.page-title {
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -.02em;
}

.page-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 22px;
}

.page-head > div:first-child { flex: 1; }

/* ---------- Botões ------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
  /* alguns botões são links de verdade ("Novo contrato", "Abrir o sistema"):
     sem isto eles saem sublinhados */
  text-decoration: none;
  transition: background .15s, border-color .15s, box-shadow .15s;
}

.btn:hover { background: var(--surface-soft); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }

.btn svg { width: 16px; height: 16px; flex: none; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

.btn-ghost { border-color: transparent; background: transparent; color: var(--text-soft); }
.btn-ghost:hover { background: #eef0f3; }

.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: #f3c9c9; }

.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }

/* ---------- Busca (Início) --------------------------------------------- */

.hero {
  padding: 46px 0 30px;
  text-align: center;
}

.hero h1 {
  font-size: 30px;
  font-weight: 680;
  letter-spacing: -.028em;
}

.hero p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
}

.search {
  position: relative;
  max-width: 620px;
  margin: 26px auto 0;
}

.search svg {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 19px;
  height: 19px;
  color: var(--muted);
  pointer-events: none;
}

.search input {
  width: 100%;
  height: 56px;
  padding: 0 52px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  font: inherit;
  font-size: 16px;
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.search input::placeholder { color: var(--muted); }

/* usamos o nosso próprio botão de limpar */
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }

.search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow-md);
}

.search-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: #eef0f3;
  color: var(--text-soft);
  cursor: pointer;
}

.search-clear.is-visible { display: grid; }
.search-clear svg { position: static; transform: none; width: 14px; height: 14px; }

.search-hint {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- Lista de contratos ----------------------------------------- */

.results { max-width: 720px; margin: 0 auto; }
.results .card-list { margin-top: 26px; }

.card-list { display: flex; flex-direction: column; gap: 10px; }

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}

.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }

/* o card inteiro é um link para a página do contrato */
.card-main {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 15px 18px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.card-main:hover { background: var(--surface-soft); }

.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: .02em;
}

.card-title {
  display: block;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vs {
  margin: 0 7px;
  color: var(--muted);
  font-weight: 500;
}

.card-sub {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-meta { display: block; flex: 1; min-width: 0; }

/* vencimento e período, embaixo do endereço */
.card-datas {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 18px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.card-datas strong { color: var(--text-soft); font-weight: 600; }

.card-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
}

.card-value { font-size: 14px; font-weight: 600; }

.chev {
  width: 16px;
  height: 16px;
  color: var(--muted);
  transition: transform .18s;
}

/* a seta avança um pouco no hover — dá a dica de que o card leva a algum lugar */
.card-main:hover .chev { transform: translateX(2px); color: var(--text-soft); }

@media (max-width: 560px) {
  .card-right .card-value { display: none; }
}

/* ---------- Badges ------------------------------------------------------ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-muted { background: #f1f3f5; color: var(--text-soft); }

.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- Barra de filtros (Contratos) -------------------------------- */

.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.toolbar .field-search {
  position: relative;
  flex: 1;
}

.toolbar .field-search svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.toolbar input,
.toolbar select {
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit;
  font-size: 14px;
  color: var(--text);
  outline: none;
}

.toolbar input { width: 100%; padding: 0 14px 0 38px; }
.toolbar select { padding: 0 12px; cursor: pointer; }

.toolbar input:focus,
.toolbar select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- Resumo ------------------------------------------------------ */

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.stat {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.stat-label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.stat-value { margin-top: 3px; font-size: 20px; font-weight: 650; letter-spacing: -.02em; }

@media (max-width: 560px) { .stats { grid-template-columns: 1fr; } }

/* ---------- Estado vazio ------------------------------------------------ */

.empty {
  padding: 52px 24px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
  color: var(--muted);
}

.empty strong { display: block; margin-bottom: 4px; color: var(--text); font-weight: 600; }

/* ---------- Modal ------------------------------------------------------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(17, 24, 39, .45);
  backdrop-filter: blur(2px);
}

.backdrop.is-open { display: flex; }

.modal {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 720px;
  max-height: 88vh;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: pop .16s ease-out;
}

@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(.99); }
  to { opacity: 1; transform: none; }
}

.modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}

.modal-head .avatar { width: 38px; height: 38px; }
.modal-head-text { flex: 1; min-width: 0; }
.modal-head h2 {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -.015em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.modal-head .card-sub { margin-top: 1px; }

.icon-btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.icon-btn:hover { background: #eef0f3; color: var(--text); }
.icon-btn svg { width: 17px; height: 17px; }

/* o × é a única saída da janela: clicar no fundo escuro não fecha mais.
   Por isso ele se anuncia melhor quando o mouse chega perto. */
.modal-fechar:hover { background: var(--danger-soft); color: var(--danger); }

.tabs {
  display: flex;
  gap: 2px;
  padding: 10px 14px 0;
  border-bottom: 1px solid var(--border);
  /* rede de segurança: se um dia não couberem, deslizam em vez de sumir */
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: none;
  padding: 9px 14px 11px;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 550;
  white-space: nowrap;
  cursor: pointer;
}

.tab:hover { color: var(--text); }
.tab.is-active { color: var(--accent-dark); border-bottom-color: var(--accent); }

.modal-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.modal-foot {
  display: flex;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-soft);
}

.modal-foot .spacer { flex: 1; }

/* ---------- Página de um contrato --------------------------------------
   Mesmo conteúdo que a janela tinha, agora com endereço próprio. O corpo
   não tem rolagem interna: quem rola é a página, como o resto do site.
   ------------------------------------------------------------------------ */

.voltar {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 14px;
  padding: 6px 12px 6px 8px;
  border-radius: 999px;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 550;
  text-decoration: none;
  transition: background .15s, color .15s;
}

.voltar:hover { background: #eef0f3; color: var(--text); }
.voltar svg { width: 16px; height: 16px; }

.pagina-contrato {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.pagina-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 22px 18px;
  border-bottom: 1px solid var(--border);
}

.pagina-head .avatar { width: 44px; height: 44px; font-size: 14px; }

.pagina-head-text { flex: 1; min-width: 0; }

.pagina-head h1 {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pagina-head .card-sub { margin-top: 2px; }

.pagina-head-fim {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
}

.pagina-head-fim .card-value { font-size: 16px; }

.pagina-contrato .tabs { padding: 10px 16px 0; }

.pagina-corpo { padding: 22px; }

.pagina-rodape {
  display: flex;
  gap: 8px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface-soft);
}

.pagina-rodape:empty { display: none; }
.pagina-rodape .spacer { flex: 1; }

/* no celular o cabeçalho quebra em duas linhas, para o nome caber inteiro */
@media (max-width: 560px) {
  .pagina-head {
    flex-wrap: wrap;
    padding: 16px 16px 14px;
    gap: 12px;
  }

  .pagina-head h1 { font-size: 17px; white-space: normal; }
  .pagina-head .card-sub { white-space: normal; }

  .pagina-head-fim {
    width: 100%;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid var(--border);
  }

  /* quatro abas em 375px: o espaço interno encolhe para caberem todas */
  .pagina-contrato .tabs { padding: 8px 6px 0; }
  .pagina-contrato .tab { padding: 9px 8px 11px; }
  .pagina-corpo { padding: 18px 16px; }
  .pagina-rodape { padding: 12px 16px; flex-wrap: wrap; }
  .pagina-rodape .btn { flex: 1 1 auto; }
}

/* ---------- Tabelas ----------------------------------------------------- */

.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

table { width: 100%; border-collapse: collapse; font-size: 14px; }

thead th {
  padding: 9px 14px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: .04em;
}

tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-soft); }

td.num, th.num { text-align: right; }
td.center, th.center { text-align: center; }

/*
 * No celular a tabela não cabe: as colunas em pouco mais de 280px
 * cortariam justamente os botões. Cada mês vira um bloco empilhado, com
 * o nome da coluna à esquerda e o conteúdo à direita.
 */
@media (max-width: 560px) {
  .table-wrap {
    border: 0;
    border-radius: 0;
    overflow: visible;
  }

  .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td {
    display: block;
    width: 100%;
  }

  .table-wrap thead { display: none; }

  .table-wrap tbody tr {
    margin-bottom: 10px;
    padding: 4px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
  }

  .table-wrap tbody tr:hover { background: var(--surface); }

  .table-wrap tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 0;
    text-align: right;
  }

  .table-wrap tbody td::before {
    content: attr(data-rotulo);
    flex: none;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
  }

  /* o mês é o título do bloco, não um par rótulo/valor */
  .table-wrap tbody td.mes {
    justify-content: flex-start;
    padding-top: 12px;
    font-size: 15px;
    font-weight: 650;
  }

  .table-wrap tbody td.mes::before { content: none; }

  /*
   * Três etiquetas e o botão não cabem na metade direita da linha: ficariam
   * uma embaixo da outra, numa coluna estreita e alta. Aqui o rótulo sobe e
   * os anexos ficam com a largura inteira do bloco.
   */
  .table-wrap tbody td.celula-anexos {
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
    text-align: left;
  }

  .table-wrap tbody td.celula-anexos .comp-celula { justify-content: flex-start; }

  .table-wrap tbody tr:last-child td { border-bottom: 1px solid var(--border); }
  .table-wrap tbody tr td:last-child { border-bottom: 0; padding-bottom: 12px; }
  .table-wrap tbody td:last-child { justify-content: stretch; }
  .table-wrap tbody td:last-child .pay-toggle { width: 100%; justify-content: center; padding: 8px; }
}

/* ---------- Relatório --------------------------------------------------- */

.report-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.report-stats .stat { padding: 12px 14px; background: var(--surface-soft); }
.report-stats .stat-value { font-size: 17px; }

/* na largura do celular os três resumos não cabem lado a lado */
@media (max-width: 560px) {
  .report-stats { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .report-stats .stat { padding: 10px 12px; }
  .report-stats .stat:last-child { grid-column: 1 / -1; }
}

.pay-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.pay-toggle:hover { background: #eef0f3; }

/* ---------- O valor de um mês, editável na linha -------------------------
   Parece texto, porque na maioria dos meses é só o valor do contrato. O
   sublinhado pontilhado é o convite de "dá para mexer aqui".
   ------------------------------------------------------------------------- */

.valor-celula {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

.valor-mes {
  padding: 2px 4px;
  margin: -2px -4px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline dotted var(--border-strong);
  text-underline-offset: 3px;
  cursor: pointer;
}

.valor-mes:hover {
  background: var(--accent-soft);
  color: var(--accent-dark);
  text-decoration-color: var(--accent);
}

/* mês que não fechou no valor do contrato: o número vem em destaque, e
   embaixo dele a tabela mostra de quanto era */
.valor-mes.is-ajustado { font-weight: 650; text-decoration-color: var(--warn); }

.valor-edicao {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

.valor-edicao input {
  width: 100%;
  min-width: 96px;
  max-width: 130px;
  padding: 5px 8px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  text-align: right;
}

.valor-edicao input:focus { outline: 2px solid var(--accent-soft); outline-offset: 1px; }

.valor-edicao .field-dica { text-align: right; line-height: 1.35; }

/* ---------- Os anexos de um mês (boleto, comprovante, recibo) ------------ */


.comp-celula {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
}

.comp-botao,
.comp-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}

.comp-botao svg,
.comp-link svg { width: 13px; height: 13px; flex: none; }

.comp-botao:hover { background: #eef0f3; }

.comp-link {
  border-color: #bfe0cf;
  background: var(--ok-soft);
  color: var(--ok);
}

.comp-link:hover { border-color: var(--ok); }

/* o verde quer dizer "pago"; o boleto ainda não é pagamento, então vai de azul */
.comp-link.is-boleto {
  border-color: #cddcff;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.comp-link.is-boleto:hover { border-color: var(--accent); }

/* o recibo da administração é dinheiro nosso, não do aluguel: âmbar */
.comp-link.is-recibo {
  border-color: #f0dcb4;
  background: var(--warn-soft);
  color: var(--warn);
}

.comp-link.is-recibo:hover { border-color: var(--warn); }

/* ---------- Menu do botão "Anexar" de um mês -----------------------------
   Fica preso à janela (position: fixed) porque nasce no <body>: dentro da
   tabela, que rola, ele sairia cortado na borda dela.
   ------------------------------------------------------------------------- */

.menu-mes {
  position: fixed;
  z-index: 120;
  width: 268px;
  max-width: calc(100vw - 16px);
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  text-align: left;

  /* mês com muitos arquivos não empurra o menu para fora da tela */
  max-height: calc(100vh - 24px);
  overflow-y: auto;
}

.menu-mes-titulo {
  padding: 6px 8px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.menu-mes-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  width: 100%;
  padding: 8px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.menu-mes-item:hover:not(:disabled) { background: var(--accent-soft); }

/* o menu é servido por <button> e por <a>: os dois têm de ficar iguais */
a.menu-mes-item { text-decoration: none; }

/* o nome do arquivo, quando o mês tem mais de um do mesmo tipo */
.menu-mes-arquivo {
  padding: 8px 8px 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.menu-mes-arquivo:first-of-type { padding-top: 2px; }

.menu-mes-item:disabled { color: var(--muted); cursor: default; }

.menu-mes-item svg { width: 15px; height: 15px; flex: none; margin-top: 2px; }

.menu-mes-texto { display: flex; flex-direction: column; gap: 1px; min-width: 0; }

.menu-mes-nome {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
}

.menu-mes-dica {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.4;
}

/* ---------- Anexos ------------------------------------------------------ */

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 26px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13.5px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone svg { width: 22px; height: 22px; color: var(--accent); }
.dropzone strong { color: var(--text); font-weight: 600; }

.file-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }

/* ---------- Blocos da aba Anexos ----------------------------------------
   Um bloco por tipo, com um separador em cima. É o que faz bater o olho e
   achar o contrato sem varrer a lista inteira.
   ------------------------------------------------------------------------ */

/* a busca separa o "enviar" (acima) do "procurar e ver" (abaixo) */
.busca-anexos {
  margin: 22px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.grupo-anexos { margin-top: 22px; }

.grupo-titulo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* a mesma pilulinha de contagem serve ao menu de anexos do mês */
.grupo-titulo .grupo-conta,
.menu-mes-nome .grupo-conta {
  display: grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 6px;
  border-radius: 999px;
  background: #eef0f3;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
}

.grupo-anexos .file-list { margin-top: 10px; }

/* os boletos, dobrados no fim — abrem só quando precisar apagar um */
.grupo-dobra { margin-top: 22px; }

.grupo-dobra > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  list-style: none;
}

/* a setinha padrão do navegador sai; a nossa gira ao abrir */
.grupo-dobra > summary::-webkit-details-marker { display: none; }

.grupo-dobra > summary::before {
  content: '';
  flex: none;
  width: 0;
  height: 0;
  border-left: 5px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform .15s;
}

.grupo-dobra[open] > summary::before { transform: rotate(90deg); }
.grupo-dobra > summary:hover { border-color: var(--border-strong); color: var(--text); }

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.file-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.file-icon svg { width: 16px; height: 16px; }
.file-meta { flex: 1; min-width: 0; }
.file-name { font-size: 14px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* nome clicável quando o arquivo pode ser visto sem baixar */
a.file-name { display: block; color: inherit; text-decoration: none; }
a.file-name:hover { color: var(--accent-dark); text-decoration: underline; }

/* ver, baixar e excluir andam juntos */
.file-acoes { display: flex; align-items: center; gap: 4px; flex: none; }

/*
 * No celular são três botões disputando espaço com o nome do arquivo, que
 * sobrava em 83px — ilegível. Os botões descem para a linha de baixo,
 * encostados à direita, e o nome fica com a largura inteira.
 */
@media (max-width: 560px) {
  .file-item { flex-wrap: wrap; row-gap: 6px; }
  .file-meta { min-width: calc(100% - 46px); }
  .file-acoes { margin-left: auto; }
}
.file-sub { color: var(--muted); font-size: 12.5px; }

/* ---------- Formulário -------------------------------------------------- */

.form-grid {
  display: grid;
  /* minmax(0,...) e não 1fr: sem isso, um campo largo (um select com texto
     comprido) estica a coluna e joga o formulário para fora da janela */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }

.field label { color: var(--text-soft); font-size: 13px; font-weight: 550; }

/* as linhas de conta livre ficam fora de um .field, mas têm de parecer
   exatamente com os outros campos — entram nas mesmas regras */
.field input,
.field select,
.field textarea,
.encargo-linha input {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.field textarea { height: auto; min-height: 76px; padding: 10px 12px; resize: vertical; }

.field input:focus,
.field select:focus,
.field textarea:focus,
.encargo-linha input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.field input:disabled, .field select:disabled, .field textarea:disabled,
.encargo-linha input:disabled {
  background: var(--surface-soft);
  color: var(--text-soft);
  cursor: default;
}

@media (max-width: 560px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Toast ------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 90;
  transform: translate(-50%, 20px);
  padding: 11px 18px;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}

.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Vista de leitura -------------------------------------------- */

.vista {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  padding: 4px 16px;
}

.vista-linha {
  display: flex;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.vista-linha:last-child { border-bottom: 0; }

.vista-rotulo {
  flex: 0 0 190px;
  color: var(--muted);
}

.vista-valor {
  flex: 1;
  min-width: 0;
  color: var(--text);
  overflow-wrap: anywhere;
}

.vista-valor a { color: var(--accent-dark); text-decoration: none; }
.vista-valor a:hover { text-decoration: underline; }

.vista-nome {
  padding: 12px 0 11px;
  border-bottom: 1px solid var(--border);
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -.01em;
}

.vista-sublinha {
  padding: 13px 0 4px;
  border-top: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 550;
}

.vista-linha + .vista-sublinha { border-top: 0; }

.vista-vazio, .vista-nota {
  padding: 14px 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
}

.vista-nota { padding-top: 11px; border-top: 1px solid var(--border); }

.vista-texto {
  padding: 13px 0;
  font-size: 14px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

@media (max-width: 560px) {
  .vista-linha { flex-direction: column; gap: 3px; }
  .vista-rotulo { flex: none; font-size: 12.5px; }
}

/* lista de contratos dentro da janela da pessoa */
.lista-itens { padding: 10px 0; display: flex; flex-direction: column; gap: 8px; }

.lista-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}

.lista-item:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }

.lista-item-texto { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }

.lista-item-titulo {
  font-size: 14px;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lista-item-fim {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
}

@media (max-width: 560px) {
  .lista-item-fim .card-value { display: none; }
}

/* excluir na tela de leitura: visível, mas sem gritar */
.btn-perigo-suave { color: var(--danger); }

.btn-perigo-suave:hover {
  border-color: #f3c9c9;
  background: var(--danger-soft);
}

/* ---------- Seções do formulário ---------------------------------------- */

.form-secao + .form-secao { margin-top: 26px; }

.form-secao-titulo {
  margin-bottom: 2px;
  color: var(--text);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -.01em;
}

.form-secao-dica {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

/* separa os contatos de emergência do resto da ficha */
.form-sublinha {
  grid-column: 1 / -1;
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 550;
}

/* texto de apoio embaixo de um campo */
.field-dica {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
}

.field-alerta { color: var(--warn); font-weight: 550; }
.field-alerta:empty { display: none; }

/* valor + unidade lado a lado (taxa de administração) */
.campo-duplo { display: flex; gap: 8px; min-width: 0; }
.campo-duplo input { flex: 1 1 auto; min-width: 0; }
.campo-duplo select { flex: 0 1 auto; min-width: 0; width: auto; }

/* no celular a unidade desce para baixo, para o texto não ficar cortado */
@media (max-width: 560px) {
  .campo-duplo { flex-direction: column; }
  .campo-duplo select { width: 100%; }
}

/* ---------- Passos do cadastro de contrato -------------------------------
   A trilha no alto da janela: mostra onde você está, o que já passou e
   quanto falta. Passo vencido é clicável, para voltar e corrigir.
   ------------------------------------------------------------------------- */

.passos {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 22px;
}

.passo {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 6px 11px 6px 7px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 550;
}

.passo[disabled] { cursor: default; }
.passo.is-feito { color: var(--text-soft); cursor: pointer; }
.passo.is-feito:hover { background: #eef0f3; color: var(--text); }

.passo-num {
  display: grid;
  place-items: center;
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #eef0f3;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.passo.is-feito .passo-num { background: var(--ok-soft); color: var(--ok); }

.passo.is-atual { background: var(--accent-soft); color: var(--accent-dark); }
.passo.is-atual .passo-num { background: var(--accent); color: #fff; }

.passo-traco {
  flex: 1 1 auto;
  min-width: 6px;
  height: 1px;
  background: var(--border);
}

/* no celular só o passo atual mostra o nome; os outros ficam só no número */
@media (max-width: 560px) {
  .passo { padding: 6px; }
  .passo:not(.is-atual) .passo-rotulo { display: none; }
}

/* ---------- Aba do seguro incêndio ---------------------------------------
   Os mesmos três quadros do Relatório, e a mesma tabela — só que a linha
   é uma parcela, e não um mês.
   ------------------------------------------------------------------------- */

/* o segundo número de um quadro: "3" grande, "de 12" pequeno ao lado */
.stat-de {
  margin-left: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 550;
}

/* o que foi contratado, numa linha só acima da tabela */
.seguro-ficha {
  margin: -4px 0 14px;
  color: var(--text-soft);
  font-size: 13.5px;
}

/* ---------- Formulário do relatório de cobrança --------------------------
   A tela era quatro campos em branco e um botão discreto de "sugerir
   texto" — quem chegava nela tinha de escrever tudo do zero. Agora o
   texto já vem pronto, e o formulário é só o que ainda pode mudar.
   ------------------------------------------------------------------------- */

.cobranca-explica {
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--text-soft);
  font-size: 13.5px;
  line-height: 1.55;
}

.cobranca-explica strong { color: var(--text); font-weight: 600; }

/* o retorno de mexer nas datas: quanta coisa entra no período escolhido */
.cobranca-conta {
  margin: -4px 0 0;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 550;
}

/* ---- campo que já vem escrito ---------------------------------------- */

.campo-auto-pe { margin-top: 7px; }

.campo-auto-marca {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ok);
  font-size: 12.5px;
  font-weight: 550;
}

.campo-auto-marca svg { width: 14px; height: 14px; flex: none; }

/* ---------- Anotações do contrato ----------------------------------------

   Em cima, a caixa de escrever, com os dois campos lado a lado — os
   mesmos "o que aconteceu" e "o que fizemos" das duas colunas do
   relatório de cobrança. Embaixo, o histórico, do mais recente ao mais
   antigo.
   ------------------------------------------------------------------------- */

.anotacao-nova {
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

/*
 * Os dois campos dividem a linha no computador e empilham no celular.
 * (O bloco todo já foi uma coluna flex com align-items: flex-start, e o
 * formulário encolhia até o tamanho do texto: dois campos estreitos,
 * espremidos à esquerda, com metade da tela vazia ao lado.)
 */
.anotacao-campos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.anotacao-campos .field { min-width: 0; }
.anotacao-nova textarea { min-height: 96px; resize: vertical; }

.anotacao-acoes {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
}

.anotacao-acoes .field-dica { margin: 0; }

@media (max-width: 560px) {
  .anotacao-nova { padding: 14px; }

  /* a explicação sai; o botão fica com a largura toda, do jeito que o
     polegar alcança */
  .anotacao-acoes .field-dica { display: none; }
  .anotacao-acoes .btn { width: 100%; justify-content: center; }
}

/* ---- o histórico ---------------------------------------------------- */

.anotacao-historico { margin-top: 26px; }

.anotacao-lista {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.anotacao {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.anotacao-topo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.anotacao-data {
  flex: 1;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}

/* a lixeira fica sempre visível, discreta — escondê-la até o mouse chegar
   funcionaria mal no celular, onde não existe passar o mouse */
.anotacao .icon-btn { flex: none; width: 28px; height: 28px; }
.anotacao .icon-btn svg { width: 15px; height: 15px; }
.anotacao .icon-btn:hover { background: var(--danger-soft); color: var(--danger); }

/* o relato e a providência lado a lado, como no relatório; sozinho, o
   relato ocupa a linha inteira */
.anotacao-corpo {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px 18px;
}

.anotacao-bloco { min-width: 0; }

/* a providência é a resposta ao relato: fica encostada nele, separada por
   um fio, e não numa caixa à parte */
.anotacao-bloco.is-providencia {
  padding-left: 18px;
  border-left: 1px solid var(--border);
}

@media (max-width: 560px) {
  .anotacao-bloco.is-providencia {
    padding: 10px 0 0;
    border-left: 0;
    border-top: 1px solid var(--border);
  }
}

.anotacao-rotulo {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.anotacao-texto {
  font-size: 14px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

/* ---------- Sugestões de quem já está cadastrado -------------------------
   Aparecem embaixo do campo do nome, no cadastro em passos, para dizer
   "é este" em vez de cadastrar a mesma pessoa duas vezes.
   ------------------------------------------------------------------------- */

.sugestoes { display: flex; flex-direction: column; gap: 6px; }
.sugestoes:empty { display: none; }

.sugestao-titulo {
  padding-top: 2px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 550;
}

.sugestao {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px 8px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.sugestao:hover { border-color: var(--accent); background: var(--accent-soft); }

.sugestao .avatar { width: 28px; height: 28px; border-radius: 9px; font-size: 11px; }

.sugestao-nome {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sugestao-acao {
  flex: none;
  color: var(--accent-dark);
  font-size: 12.5px;
  font-weight: 600;
}

/* já escolhido: o aviso de que o contrato vai se ligar a essa ficha */
.sugestao-ligada {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 8px 8px 12px;
  border: 1px solid #bfe0cf;
  border-radius: var(--radius-sm);
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 13.5px;
  line-height: 1.45;
}

.sugestao-ligada > svg { flex: none; width: 16px; height: 16px; }
.sugestao-ligada > span { flex: 1; }
.sugestao-ligada strong { font-weight: 650; }
.sugestao-ligada .icon-btn { flex: none; width: 28px; height: 28px; color: var(--ok); }
.sugestao-ligada .icon-btn:hover { background: #d6f0e3; }

/* ---------- Endereço com busca de CEP ------------------------------------ */

.endereco { margin-top: 2px; }

/* o campo do CEP e o botão de buscar dividem a mesma linha */
.campo-cep { display: flex; gap: 8px; min-width: 0; }
.campo-cep input { flex: 1 1 auto; min-width: 0; }
.campo-cep .btn { flex: none; }

/* o aviso da busca só ocupa espaço quando tem o que dizer */
[data-aviso-cep]:empty { display: none; }

/* ---------- Contas livres do contrato ------------------------------------
   Uma linha por conta: o nome, quanto é por mês, e o × para tirar.
   ------------------------------------------------------------------------ */

.encargos-extras { margin-top: 2px; }

.encargos-extras .form-secao-dica { margin: 6px 0 12px; }

.encargo-linha {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.encargo-linha input { min-width: 0; }
.encargo-linha input:first-child { flex: 2 1 0; }
.encargo-linha input + input { flex: 1 1 0; }

.encargo-remover { flex: none; }
.encargo-remover:hover { background: var(--danger-soft); color: var(--danger); }

.encargos-extras .btn { margin-top: 2px; }

/* no celular o nome ocupa a linha toda e o valor divide a de baixo com o × */
@media (max-width: 560px) {
  .encargo-linha {
    flex-wrap: wrap;
    row-gap: 6px;
    margin-bottom: 14px;
  }

  .encargo-linha input:first-child { flex: 1 1 100%; }
  .encargo-linha input + input { flex: 1 1 auto; }
}

.aviso-troca {
  padding: 12px 14px;
  border: 1px solid #cddcff;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--text-soft);
  font-size: 13.5px;
  line-height: 1.5;
}

.aviso-troca strong { color: var(--text); }

/* ---------- Entrada (login) --------------------------------------------- */

.auth-body { display: grid; place-items: center; min-height: 100vh; }

.auth { width: 100%; padding: 32px 20px; }

.auth-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
  padding: 30px 28px 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  letter-spacing: -.01em;
}

.auth-title {
  margin-top: 6px;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -.02em;
}

.auth-sub {
  margin-top: -8px;
  color: var(--muted);
  font-size: 14px;
}

.auth-dica {
  margin-top: -6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.auth-erro {
  padding: 10px 13px;
  border: 1px solid #f3c9c9;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 14px;
}

.auth-enviar { width: 100%; height: 42px; margin-top: 4px; }

/* ---------- Sessão no cabeçalho ----------------------------------------- */

.nav-sep {
  align-self: center;
  width: 1px;
  height: 20px;
  margin: 0 6px;
  background: var(--border);
}

.nav-user {
  align-self: center;
  max-width: 130px;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav a.nav-sair { color: var(--muted); }
.nav a.nav-sair:hover { background: var(--danger-soft); color: var(--danger); }

/*
 * No celular o menu não cabe: são cinco destinos mais o "Sair". Em vez de
 * cortar o último item fora da tela, ele desliza para o lado — e a marca
 * encolhe para deixar de sobra o que der.
 */
@media (max-width: 560px) {
  .site-header .container { gap: 10px; padding: 0 14px; }

  .brand { flex: none; font-size: 0; gap: 0; }
  .brand-mark { font-size: 14px; }

  .nav {
    gap: 2px;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex: none; padding: 7px 9px; white-space: nowrap; }
  .nav-user, .nav-sep { display: none; }
}

/* ---------- Calendário de vencimentos ------------------------------------
   Uma linha por aluguel a receber. A barra colorida à esquerda diz de longe
   se já venceu.
   ------------------------------------------------------------------------- */

.venc-grupo { margin-bottom: 26px; }
.venc-grupo .grupo-titulo { margin-bottom: 10px; }

.venc {
  padding: 13px 16px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.venc.is-atraso { border-left-color: var(--danger); }

.venc-topo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.venc-topo .spacer { flex: 1; }
.venc-data { font-size: 13.5px; font-weight: 650; }
.venc-mes { color: var(--muted); font-size: 12.5px; text-transform: capitalize; }
.venc-valor { font-size: 15px; font-weight: 650; }

.venc-quem { display: block; color: inherit; text-decoration: none; }
.venc-quem:hover .venc-nome { color: var(--accent-dark); text-decoration: underline; }
.venc-nome { display: block; font-size: 14.5px; font-weight: 600; }

.venc-acoes {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* o botão do WhatsApp usa a cor dele — é o mais clicado da tela */
.btn-zap {
  border-color: #bfe0cf;
  background: var(--ok-soft);
  color: var(--ok);
  font-weight: 600;
}

.btn-zap:hover { border-color: var(--ok); background: #d6f0e3; }

.venc-pronto {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px;
  color: var(--ok);
  font-size: 13px;
  font-weight: 600;
}

.venc-pronto svg { width: 15px; height: 15px; }
.venc-semzap { color: var(--muted); font-size: 12.5px; font-style: italic; }

@media (max-width: 560px) {
  .venc-topo { gap: 8px; }
  .venc-topo .spacer { flex: 1 1 100%; height: 0; }
  .venc-acoes .btn { flex: 1 1 auto; justify-content: center; }
}

/* ---------- Documento de cobrança ----------------------------------------
   Na tela é uma folha branca; no papel, o documento inteiro. O cabeçalho e
   o rodapé ficam fixos na impressão, e por isso se repetem em toda página.
   ------------------------------------------------------------------------- */

.doc-moldura {
  max-width: 820px;
  margin: 22px auto 0;
  padding: 40px 46px 46px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-md);
  color: #111827;
  font-size: 13px;
  line-height: 1.55;
}

.doc-cabecalho {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid #111827;
}

.doc-empresa { font-size: 14px; font-weight: 700; letter-spacing: .02em; }
.doc-contato { color: #4b5563; font-size: 10.5px; line-height: 1.5; text-align: right; }

.doc-rodape {
  margin-top: 26px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 10px;
  text-align: center;
  letter-spacing: .02em;
}

.doc-titulo {
  margin: 26px 0 4px;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  letter-spacing: .02em;
}

.doc-subtitulo {
  margin-bottom: 22px;
  color: #4b5563;
  font-size: 12px;
  text-align: center;
}

/* identificação: rótulo à esquerda, valor à direita */
.doc-identificacao { width: 100%; border-collapse: collapse; margin-bottom: 26px; }

.doc-identificacao th,
.doc-identificacao td {
  padding: 7px 10px;
  border: 1px solid #d5d9df;
  font-size: 11.5px;
  text-align: left;
  vertical-align: top;
}

.doc-identificacao th {
  width: 28%;
  background: #f3f4f6;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: none;
}

.doc-secao { margin-bottom: 22px; }

.doc-secao h2,
.doc-anexo h2 {
  margin-bottom: 9px;
  padding-bottom: 4px;
  border-bottom: 1px solid #d5d9df;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .03em;
}

.doc-secao p { margin-bottom: 8px; text-align: justify; }

.doc-tabela { width: 100%; border-collapse: collapse; }

.doc-tabela th,
.doc-tabela td {
  padding: 7px 9px;
  border: 1px solid #d5d9df;
  font-size: 11px;
  text-align: left;
  vertical-align: top;
}

.doc-tabela thead th {
  background: #f3f4f6;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: .05em;
}

.doc-tabela tfoot td { background: #f9fafb; font-weight: 700; }
.doc-tabela .doc-data { white-space: nowrap; }
.doc-tabela .doc-valor { text-align: right; white-space: nowrap; }

.doc-nota { margin-top: 8px; color: #4b5563; font-size: 10.5px; line-height: 1.5; text-align: justify; }
.doc-vazio { color: var(--muted); font-style: italic; }

.doc-fecho { margin-top: 34px; }
.doc-fecho p { margin-bottom: 40px; }

.doc-assinatura { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.doc-linha { width: 260px; border-top: 1px solid #111827; }
.doc-assinatura span { font-size: 12px; }
.doc-cargo { color: #4b5563; font-size: 10.5px; }

.doc-anexo { margin-top: 34px; }

.doc-figura { margin: 16px 0 22px; text-align: center; }
.doc-figura img { max-width: 100%; max-height: 460px; border: 1px solid var(--border); }
.doc-figura figcaption { margin-top: 6px; color: #4b5563; font-size: 10.5px; }

/* escolha dos prints, na parte de preparo */
.legendas { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }

.legenda-linha {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.legenda-marca { display: flex; align-items: center; gap: 9px; flex: none; width: 200px; cursor: pointer; }
.legenda-marca img { width: 38px; height: 38px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.legenda-marca .file-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legenda-linha > input { flex: 1; min-width: 0; }

@media (max-width: 560px) {
  .doc-moldura { padding: 22px 18px 26px; }
  .doc-cabecalho { flex-direction: column; gap: 8px; }
  .doc-contato { text-align: left; }
  .legenda-linha { flex-wrap: wrap; }
  .legenda-marca { width: auto; }
  .legenda-linha > input { flex: 1 1 100%; }
}

/* ---------- Impressão --------------------------------------------------- */

@media print {
  body { background: #fff; }

  .site-header, .toast, .tabs, .modal-foot, .pagina-rodape,
  .icon-btn, .pay-toggle, .menu-mes, .no-print { display: none !important; }

  /* com a janela aberta, o papel é só o que está nela — a página que ficou
     atrás não deve sair junto */
  body.modal-aberto main { display: none !important; }

  .backdrop { position: static; display: block !important; padding: 0; background: none; backdrop-filter: none; }
  .modal { max-width: none; max-height: none; box-shadow: none; border-radius: 0; animation: none; }
  .modal-body { overflow: visible; padding: 0; }
  .modal-head { padding: 0 0 14px; }

  /* a página do contrato imprime direto, sem moldura */
  main { padding: 0; }
  .container { max-width: none; padding: 0; }
  .pagina-contrato { border: 0; border-radius: 0; box-shadow: none; }
  .pagina-head { padding: 0 0 14px; }
  .pagina-corpo { padding: 0; }

  tbody tr:hover { background: none; }

  /* no papel o valor é só um número */
  .valor-mes { text-decoration: none; padding: 0; margin: 0; }

  /* ---- o documento de cobrança ---------------------------------------- */

  @page { size: A4; margin: 32mm 15mm 20mm; }

  .doc-moldura {
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    font-size: 10.5pt;
  }

  /* fixos = repetem em todas as páginas, dentro das margens do @page */
  .doc-cabecalho {
    position: fixed;
    top: -26mm;
    left: 0;
    right: 0;
    background: #fff;
  }

  .doc-rodape {
    position: fixed;
    bottom: -13mm;
    left: 0;
    right: 0;
    margin: 0;
    background: #fff;
  }

  .doc-titulo { margin-top: 4px; }

  /* o cabeçalho da tabela se repete quando ela atravessa a página */
  .doc-tabela thead { display: table-header-group; }
  .doc-tabela tr { page-break-inside: avoid; }

  /* nada de título órfão no pé da página, nem print cortado ao meio */
  .doc-secao h2, .doc-anexo h2 { page-break-after: avoid; }
  .doc-figura { page-break-inside: avoid; }
  .doc-fecho, .doc-assinatura { page-break-inside: avoid; }
  .doc-anexo { page-break-before: always; }

  .doc-figura img { max-height: 150mm; }
}
