/* Controle de Aluguéis — visual "Clean & Moderno" (Opção A) */

* { box-sizing: border-box; }

:root {
  --accent: #3454D1;
  --accent-dark: #24399B;
  --accent-bg: #EEF1FC;
  --bg: #FAFAF8;
  --card: #FFFFFF;
  --border: #ECEBE7;
  --border-soft: #F1F0EC;
  --text: #1C1D21;
  --text-muted: #8A8880;
  --text-faint: #A6A49B;
  --green: #1E8E4C;
  --green-bg: #E9F7EF;
  --amber: #B7791F;
  --amber-bg: #FFF4E0;
  --red: #C7402C;
  --red-bg: #FCE9E9;
}

body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

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

.num { font-variant-numeric: tabular-nums; }

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

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  display: flex;
  flex-direction: column;
  width: 264px;
  flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 28px 8px;
}

.sidebar-brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent);
  flex-shrink: 0;
}

.sidebar-brand-name {
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.2;
}

.sidebar-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  text-transform: uppercase;
  padding: 0 12px;
  margin-bottom: 8px;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 9px;
  color: #4A4842;
  font-weight: 500;
}
.sidebar-link svg { stroke: #68665C; flex-shrink: 0; }
.sidebar-link:hover { background: #F5F4F1; color: #1C1D21; }
.sidebar-link.active { background: var(--accent-bg); color: var(--accent-dark); font-weight: 600; }
.sidebar-link.active svg { stroke: var(--accent); }

.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: 14px; }
.sidebar-divider { height: 1px; background: var(--border); }

.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.sidebar-user-avatar {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 12.5px; font-weight: 700; flex-shrink: 0;
}
.sidebar-user-name { font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11.5px; color: var(--text-faint); }
.sidebar-icons { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.sidebar-logout { display: flex; align-items: center; }
.sidebar-logout svg { stroke: var(--text-faint); }
.sidebar-logout:hover svg { stroke: var(--red); }

.main { flex: 1; padding: 36px 44px; min-width: 0; }

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 30px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-eyebrow { font-size: 12.5px; font-weight: 600; color: var(--text-faint); margin-bottom: 4px; }
.page-title { font-size: 25px; font-weight: 800; letter-spacing: -0.015em; color: var(--text); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: 9px;
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(52,84,209,0.25); }
.btn-primary:hover { background: var(--accent-dark); color: #fff; }
.btn-outline { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: #F5F4F1; color: var(--text); }
.btn-danger-outline { background: #fff; color: var(--red); border: 1px solid #F0C6BE; }
.btn-danger-outline:hover { background: var(--red-bg); color: var(--red); }
.btn-success-outline { background: #fff; color: var(--green); border: 1px solid #BFE3CC; }
.btn-success-outline:hover { background: var(--green-bg); color: var(--green); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-link-muted { background: none; border: none; color: var(--text-muted); font-size: 13.5px; font-weight: 600; cursor: pointer; text-decoration: none; padding: 9px 6px; }
.btn-link-muted:hover { color: var(--text); }

/* ---------- Cards / stats ---------- */

.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-bottom: 32px; }
@media (max-width: 900px) { .stat-grid { grid-template-columns: 1fr; } }

.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 20px; }
.stat-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.stat-icon { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; }
.stat-value { font-size: 26px; font-weight: 800; letter-spacing: -0.01em; color: var(--text); }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

.badge { font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 6px; }
.badge-green { color: var(--green); background: var(--green-bg); }
.badge-amber { color: var(--amber); background: var(--amber-bg); }
.badge-red { color: var(--red); background: var(--red-bg); }
.badge-gray { color: var(--text-muted); background: #F1F0EC; }

/* ---------- Panel / table ---------- */

.panel { background: var(--card); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.panel-title { font-size: 15px; font-weight: 700; color: var(--text); }

table.data-table { width: 100%; border-collapse: collapse; }
table.data-table th {
  font-size: 11.5px; font-weight: 700; color: var(--text-faint); text-transform: uppercase;
  letter-spacing: 0.04em; text-align: left; padding: 10px 22px; background: #FBFAF8;
  border-bottom: 1px solid var(--border);
}
table.data-table th.num, table.data-table td.num { text-align: right; }
table.data-table td { padding: 14px 22px; border-top: 1px solid var(--border-soft); font-size: 13.5px; vertical-align: middle; }
table.data-table tbody tr:hover { background: #FBFAF9; }
table.data-table td.actions { text-align: right; white-space: nowrap; }

/* Campos de valor/data dentro de linhas de tabela (ex: lançamento em lote de
   aluguéis): tamanho fixo mínimo pra não ficarem espremidos pelo layout da
   tabela e cortarem o número. A tabela já tem overflow-x:auto no wrapper,
   então ela cresce/rola em vez de espremer os campos. */
table.data-table td input.form-control[type="number"] { min-width: 108px; width: 108px; }
table.data-table td input.form-control[type="date"] { min-width: 152px; width: 152px; }

/* ---------- Campo de valor com prefixo "R$" (ex: lançamento em lote de
   aluguéis) -- mais largo que o input puro de cima pra sempre mostrar o
   valor inteiro com as duas casas decimais, sem cortar número. O prefixo é
   só visual (span ao lado), o input continua sendo um <input type="number">
   normal por baixo, então o valor que vai pro servidor não muda. */
.valor-field {
  display: flex; align-items: stretch; border: 1px solid var(--border); border-radius: 9px;
  overflow: hidden; width: 148px; background: #fff;
}
.valor-field .prefixo {
  display: flex; align-items: center; justify-content: center; padding: 0 8px; flex-shrink: 0;
  background: #F3F2EE; color: var(--text-faint); font-size: 12px; font-weight: 700; border-right: 1px solid var(--border);
}
.valor-field input {
  border: none; outline: none; padding: 9px 10px; font-size: 13.5px; font-family: inherit;
  text-align: right; width: 100%; min-width: 0; color: var(--text); font-variant-numeric: tabular-nums; background: transparent;
}
.valor-field input:focus { box-shadow: inset 0 0 0 2px var(--accent-bg); }
.valor-field input:disabled { background: #FAFAF9; color: var(--text-faint); }
/* Variante "boleto": campos cujo valor já veio calculado automaticamente do
   PDF importado (condomínio a cobrar do inquilino, total do boleto) -- um
   azul clarinho só pra diferenciar visualmente de um campo preenchido à mão. */
.valor-field.boleto { border-color: #C9D3F5; }
.valor-field.boleto .prefixo { background: var(--accent-bg); color: var(--accent-dark); }

/* Cabeçalho em dois níveis (grupo de colunas + coluna) -- usado na tela de
   lançamento em lote de aluguéis pra separar visualmente "a cobrar do
   inquilino" de "boleto do condomínio pago à administradora". */
table.data-table thead tr.grupo th {
  background: #F3F2EE; font-size: 10.5px; font-weight: 800; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.05em; text-align: center; padding: 8px 10px; border-bottom: 1px solid var(--border);
}

.tag-importado { font-size: 10.5px; color: var(--accent); font-weight: 700; margin-top: 5px; text-align: right; }

/* Bloco "Fechamento" + "Dias proporcionais" lado a lado, visualmente preso
   ao campo de boleto a que pertencem (em vez de dois campos empilhados
   soltos, que ficavam espremidos e confundiam com os outros campos da linha). */
.boleto-extra {
  margin-top: 10px; padding: 10px; background: #F8F9FD; border: 1px dashed #C9D3F5; border-radius: 9px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; width: 232px;
}
.boleto-extra .campo { display: flex; flex-direction: column; gap: 4px; }
.boleto-extra label {
  font-size: 10px; font-weight: 800; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.03em;
}
.boleto-extra input { padding: 6px 7px; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; font-family: inherit; width: 100%; }

.itens-nota { font-size: 11px; color: var(--text-faint); margin-top: 8px; max-width: 232px; line-height: 1.5; }

.entity-cell { display: flex; align-items: center; gap: 11px; }
.entity-avatar {
  width: 38px; height: 38px; border-radius: 9px; background: var(--accent-bg);
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; color: var(--accent);
  flex-shrink: 0;
}
.entity-name { font-size: 13.5px; font-weight: 700; color: var(--text); }
.entity-sub { font-size: 12px; color: var(--text-faint); }

.empty-state { padding: 32px 22px; text-align: center; color: var(--text-faint); font-size: 13.5px; }

/* ---------- Cards grid (empreendimentos) ---------- */

.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 1100px) { .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .card-grid { grid-template-columns: 1fr; } }

.entity-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; }
.entity-card h3 { font-size: 15.5px; font-weight: 700; margin: 0 0 4px 0; color: var(--text); }
.entity-card .addr { font-size: 12.5px; color: var(--text-faint); margin-bottom: 8px; }
.entity-card .desc { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; flex: 1; }
.entity-card .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Forms ---------- */

.form-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 28px; max-width: 560px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.form-control {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px;
  font-family: inherit; font-size: 13.5px; color: var(--text); background: #fff;
}
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
textarea.form-control { resize: vertical; }
.form-hint { font-size: 12.5px; color: var(--text-faint); margin-top: 10px; }
.form-actions { display: flex; align-items: center; gap: 14px; margin-top: 22px; }

.perm-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.perm-table th { text-align: left; font-size: 12px; font-weight: 700; color: var(--text-faint); padding: 8px 4px; border-bottom: 1px solid var(--border); }
.perm-table td { padding: 10px 4px; border-bottom: 1px solid var(--border-soft); font-size: 13.5px; }
.perm-table input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent); }

/* ---------- Alerts ---------- */

.alert { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-radius: 10px; font-size: 13.5px; font-weight: 600; margin-bottom: 16px; }
.alert-success { background: var(--green-bg); color: var(--green); }
.alert-danger { background: var(--red-bg); color: var(--red); }
.alert-warning { background: var(--amber-bg); color: var(--amber); }
.alert-close { background: none; border: none; font-size: 15px; line-height: 1; cursor: pointer; color: inherit; opacity: 0.6; }
.alert-close:hover { opacity: 1; }

/* ---------- Tabs (detalhe do empreendimento) ---------- */

.tabs-nav { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 26px; }
.tab-link {
  padding: 11px 4px; margin-right: 22px; font-size: 13.5px; font-weight: 700; color: var(--text-faint);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab-link:hover { color: var(--text); }
.tab-link.active { color: var(--accent-dark); border-bottom-color: var(--accent); }

.text-receber { color: var(--accent-dark); font-weight: 700; }
.text-pagar { color: var(--red); font-weight: 700; }

/* ---------- Login ---------- */

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 36px 32px; width: 360px; }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 24px; }
.login-brand-mark { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; background: var(--accent); }
.login-brand-name { font-size: 16px; font-weight: 800; color: var(--text); }
