/* ──────────────────────────────────────────
   Village Box — Design System v2
   Tema claro · Hanken Grotesk (via layout.ts)
   fundo #eceae4 · cartão #fff · texto #1d1d1b
   coral #d9542e · âmbar #f0a92b · verde #2f9d6b
   ────────────────────────────────────────── */

:root {
  --bg:      #eceae4;
  --bg2:     #f5f3ee;
  --card:    #ffffff;
  --bd:      #e7e4dc;
  --t:       #1d1d1b;
  --m:       #6d6d68;
  --d:       #8a8a86;
  --accent:  #d9542e;
  --amber:   #f0a92b;
  --positive:#2f9d6b;
  --danger:  #d9542e;
  --radius:  18px;
  --gap:     16px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Anti-zoom iOS: nenhum input abaixo de 16px */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
textarea, select { font-size: 16px !important; }

body {
  background: var(--bg);
  color: var(--t);
  font-family: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100dvh;
  padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
}

/* ── Bottom navigation bar ── */
.bnav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--bd);
  z-index: 200;
  height: 56px;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bnav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--d);
  padding: 6px 4px 8px;
  transition: color .15s;
  -webkit-tap-highlight-color: transparent;
}
.bnav-item.bnav-ativo { color: var(--accent); }
.bnav-ico { width: 20px; height: 20px; display: block; }
.bnav-lbl {
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}

/* ── Login ── */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: var(--gap);
}
.login-card { max-width: 360px; width: 100%; text-align: center; }
.logo { font-size: 2.5rem; margin-bottom: 8px; }
.login-card h1 { font-size: 1.5rem; margin-bottom: 4px; }
.subtitle { color: var(--m); font-size: .85rem; margin-bottom: 24px; }

/* ── App shell ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  border-bottom: 1px solid var(--bd);
  padding: 12px var(--gap);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-title { font-weight: 700; font-size: 1rem; }
.app-wrap { min-height: 100dvh; }
.container {
  max-width: 600px; margin: 0 auto;
  padding: var(--gap);
  display: flex; flex-direction: column; gap: var(--gap);
}

/* ── Cards ── */
.card {
  background: var(--card);
  border: 1px solid var(--bd);
  border-radius: var(--radius);
  padding: var(--gap);
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.card h2 { font-size: 1.05rem; margin-bottom: 6px; }
.card-placeholder { text-align: center; padding: 24px 16px; }
.placeholder-icon { font-size: 1.8rem; margin-bottom: 6px; }
.placeholder-label { font-weight: 600; font-size: .9rem; }
.placeholder-sub { color: var(--m); font-size: .78rem; margin-top: 2px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }

/* ── Nav cards (dashboard legacy) ── */
a.card-nav {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 6px; text-decoration: none; color: var(--t);
  padding: 20px 12px;
  transition: border-color .15s, background .15s;
}
a.card-nav:hover { background: var(--bg2); border-color: var(--accent); }
.card-nav-icon { font-size: 1.8rem; }
.card-nav-label { font-weight: 600; font-size: .9rem; }

/* ── List ── */
.list-card {
  background: var(--card);
  border: 1px solid var(--bd);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.list-item {
  display: flex; flex-direction: column; gap: 2px;
  padding: 14px var(--gap);
  border-bottom: 1px solid var(--bd);
  text-decoration: none; color: var(--t);
  transition: background .12s;
}
.list-item:last-child { border-bottom: none; }
.list-item:active { background: var(--bg2); }
.list-item-main { font-weight: 500; font-size: .95rem; }
.list-item-sub  { font-size: .78rem; color: var(--m); }
.empty-state { padding: 32px var(--gap); text-align: center; color: var(--m); font-size: .88rem; }

/* ── Forms ── */
.form-section-label {
  font-size: .72rem; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--m); margin-bottom: 12px;
}
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; text-align: left; }
.field:last-child { margin-bottom: 0; }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }
label { font-size: .82rem; color: var(--m); font-weight: 500; }
input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="number"],
select,
textarea {
  background: var(--card);
  border: 1px solid var(--bd);
  border-radius: 8px;
  color: var(--t);
  font-family: inherit;
  padding: 10px 12px;
  width: 100%;
  outline: none;
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 72px; }

/* ── Buttons ── */
.btn-primary {
  background: var(--accent);
  border: none; border-radius: 8px;
  color: #fff; cursor: pointer;
  font-size: .95rem; font-family: inherit; font-weight: 600;
  padding: 11px 20px; transition: opacity .15s;
}
.btn-primary:hover { opacity: .85; }
.btn-full { width: 100%; }
.btn-ghost {
  background: none;
  border: 1px solid var(--bd); border-radius: 8px;
  color: var(--m); cursor: pointer;
  font-size: .82rem; font-family: inherit;
  padding: 6px 12px; text-decoration: none;
  display: inline-block;
  transition: color .15s, border-color .15s;
}
.btn-ghost:hover { color: var(--t); border-color: var(--m); }
.btn-sm { font-size: .82rem; padding: 6px 12px; }
.btn-danger {
  background: var(--danger);
  border: none; border-radius: 8px;
  color: #fff; cursor: pointer;
  font-size: .95rem; font-family: inherit; font-weight: 600;
  padding: 11px 20px; transition: opacity .15s;
}
.btn-danger:hover { opacity: .85; }
.btn-secondary {
  background: var(--bg2);
  border: 1px solid var(--bd); border-radius: 8px;
  color: var(--t); cursor: pointer;
  font-size: .95rem; font-family: inherit; font-weight: 600;
  padding: 11px 20px; transition: opacity .15s;
}
.btn-secondary:hover { opacity: .85; }

/* ── List footer / toggle ── */
.list-footer { border-top: 1px solid var(--bd); padding: 10px var(--gap); text-align: center; }
.list-toggle { color: var(--m); font-size: .82rem; text-decoration: none; }
.list-toggle:hover { color: var(--t); }

/* ── Status banners ── */
.banner-inativo {
  background: rgba(217,84,46,.06);
  border: 1px solid rgba(217,84,46,.3);
  border-radius: var(--radius);
  color: var(--danger);
  font-size: .78rem; font-weight: 700;
  letter-spacing: .07em; padding: 8px var(--gap);
  text-align: center; text-transform: uppercase;
}
.banner-aviso {
  background: rgba(240,169,43,.08);
  border: 1px solid rgba(240,169,43,.35);
  border-radius: var(--radius);
  color: #7a5200;
  font-size: .82rem; padding: 10px var(--gap);
  margin-bottom: var(--gap);
}

/* ── Badges ── */
.badge {
  display: inline-block; border-radius: 4px;
  font-size: .7rem; font-weight: 700;
  letter-spacing: .04em; padding: 2px 7px; text-transform: uppercase;
}
.badge-disponivel { background: rgba(47,157,107,.10); color: #1a6b43; }
.badge-alugada    { background: rgba(217,84,46,.08);  color: #b33d1e; }
.badge-manutencao { background: rgba(240,169,43,.10); color: #8a5c00; }
.badge-reservada  { background: rgba(147,112,219,.10);color: #5b38a8; }
.badge-ativo      { background: rgba(47,157,107,.10); color: #1a6b43; }
.badge-suspenso   { background: rgba(240,169,43,.10); color: #8a5c00; }
.badge-encerrado  { background: rgba(138,138,134,.10);color: var(--d); }

/* ── Encargo row ── */
.encargo-bloco { border-top: 1px solid var(--bd); padding-top: 12px; margin-top: 12px; }
.encargo-bloco:first-child { border-top: none; padding-top: 0; margin-top: 0; }

/* ── Chips (filtro) ── */
.chip-group { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 14px; border-radius: 20px;
  border: 1px solid var(--bd);
  background: var(--card); color: var(--m);
  font-size: .8rem; font-weight: 600; font-family: inherit;
  text-decoration: none; cursor: pointer;
  transition: all .15s; white-space: nowrap;
}
.chip:hover { color: var(--t); border-color: var(--m); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.active-agua { background: rgba(79,142,247,.10); border-color: rgba(79,142,247,.5); color: #1a4fa0; }
.chip.active-luz  { background: rgba(240,169,43,.10);  border-color: rgba(240,169,43,.5); color: #8a5c00; }

/* ── Medidor row ── */
.med-row {
  display: flex; align-items: center; gap: 0;
  padding: 12px var(--gap); border-bottom: 1px solid var(--bd);
}
.med-row:last-child { border-bottom: none; }
.med-row-main {
  display: flex; align-items: center; gap: 12px;
  flex: 1; min-width: 0; text-decoration: none; color: var(--t);
}
.med-row-main:active { opacity: .7; }
.med-icon {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
}
.med-icon-agua { background: rgba(79,142,247,.10); color: #1a4fa0; }
.med-icon-luz  { background: rgba(240,169,43,.10);  color: #8a5c00; }
.med-icon-gas  { background: rgba(224,112,48,.10);  color: #8a3a00; }
.med-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.med-tipo { font-weight: 600; font-size: .95rem; }
.med-sub  { font-size: .75rem; color: var(--m); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-leitura {
  flex-shrink: 0; margin-left: 10px;
  background: var(--accent); border-radius: 7px;
  color: #fff; font-size: .75rem; font-weight: 700;
  padding: 6px 11px; text-decoration: none;
  white-space: nowrap; transition: opacity .15s;
}
.btn-leitura:hover { opacity: .85; }

/* ── Grupo de loft ── */
.med-loft-group { display: flex; flex-direction: column; gap: 6px; }
.med-loft-title {
  font-size: .72rem; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase;
  color: var(--m); padding: 0 2px;
}

/* ── Misc ── */
.muted { color: var(--m); font-size: .88rem; }
.error-msg { color: var(--danger); font-size: .84rem; margin-bottom: 4px; }

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


/* ══════════════════════════════════════════
   DASHBOARD — Nova home (Fase 1)
   ══════════════════════════════════════════ */

.db-wrap {
  max-width: 600px;
  margin: 0 auto;
  padding-bottom: 40px;
}

/* ── Cabeçalho ── */
.db-header {
  padding: 22px 20px 18px;
}
.db-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}
.db-seal {
  display: flex;
  align-items: center;
  gap: 5px;
}
.db-sq {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 2px;
}
.db-sq-coral { background: #d9542e; }
.db-sq-gray  { background: #8a8a86; }
.db-sq-amber { background: #f0a92b; }
.db-seal-nome {
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .15em;
  color: var(--t);
  margin-left: 4px;
}
.db-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}
.db-date {
  font-size: .78rem;
  color: var(--m);
}
.db-sair {
  background: none; border: none;
  color: var(--d); font-size: .7rem;
  font-family: inherit; cursor: pointer;
  padding: 0; transition: color .15s;
}
.db-sair:hover { color: var(--t); }
.db-resumo-lbl {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--t);
}

/* ── 3 métricas ── */
.db-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 0 20px 16px;
}
.db-metric {
  background: var(--card);
  border: 1px solid var(--bd);
  border-radius: 14px;
  padding: 13px 11px 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  display: flex; flex-direction: column; gap: 5px;
}
.db-metric-lbl {
  font-size: .57rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--m);
  line-height: 1.25;
}
.db-metric-val {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--t);
  line-height: 1.1;
}
.db-metric-val.positivo { color: var(--positive); }
.db-metric-val.danger   { color: var(--accent); }
@media (max-width: 420px) {
  .db-metric-val { font-size: .9rem; }
}
@media (max-width: 360px) {
  .db-metric-val { font-size: .78rem; }
  .db-metric { padding: 10px 9px 10px; }
  .db-metric-lbl { font-size: .52rem; }
}

/* ── Cards de seção ── */
.db-section {
  padding: 0 20px 12px;
}
.db-card {
  background: var(--card);
  border: 1px solid var(--bd);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.db-card-head {
  padding: 13px 16px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--m);
  border-bottom: 1px solid var(--bd);
}

/* ── Pra fazer ── */
.db-pf-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--bd);
  text-decoration: none; color: var(--t);
  transition: background .12s;
}
.db-pf-row:last-child { border-bottom: none; }
.db-pf-row:active { background: var(--bg2); }
.db-pf-ico  { font-size: .92rem; flex-shrink: 0; width: 20px; text-align: center; }
.db-pf-txt  { flex: 1; font-size: .88rem; font-weight: 500; }
.db-pf-chev { color: var(--d); font-size: .78rem; }

/* ── Atrasados ── */
.db-atr-row {
  display: flex; align-items: center;
  justify-content: space-between;
  gap: 12px; padding: 13px 16px;
  border-bottom: 1px solid var(--bd);
}
.db-atr-row:last-child { border-bottom: none; }
.db-atr-info { flex: 1; min-width: 0; }
.db-atr-nome { font-weight: 600; font-size: .88rem; }
.db-atr-sub  { font-size: .73rem; color: var(--m); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-atr-vals { text-align: right; flex-shrink: 0; }
.db-atr-valor { font-weight: 700; font-size: .9rem; }
.db-atr-dias  { font-size: .7rem; color: var(--accent); margin-top: 2px; font-weight: 600; }

/* ── Lucro ── */
.db-luc-row {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-bottom: 1px solid var(--bd);
}
.db-luc-row:last-child { border-bottom: none; }
.db-luc-nome { font-size: .88rem; }
.db-luc-val  { font-weight: 700; font-size: .9rem; color: var(--positive); }
.db-luc-val.negativo { color: var(--accent); }

/* ── Empty states ── */
.db-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--d);
  font-size: .82rem;
}
