/* ==========================================================================
   Mel Dog Sitter — folha de estilo única, mobile-first.
   Sem framework: o app é pequeno e assim não há build step.
   ========================================================================== */

:root {
  --bg: #fdf8f3;
  --surface: #ffffff;
  --surface-2: #faf3ec;
  --border: #ecdfd2;
  --ink: #3a2a1f;
  --muted: #8a7565;
  --accent: #c2703d;
  --accent-dark: #a55b2d;
  --accent-soft: #f7e6d8;
  --green: #4a8b5f;
  --green-soft: #e3f1e7;
  --amber: #c9911f;
  --amber-soft: #fbeed2;
  --red: #c25340;
  --red-soft: #fbe3de;
  --blue: #4a6f8b;
  --blue-soft: #e2edf4;
  --wa: #25d366;        /* verde oficial do WhatsApp */
  --wa-dark: #1da851;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(58, 42, 31, .06), 0 6px 18px rgba(58, 42, 31, .06);
  --nav-h: 62px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- Layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 19px; margin: 0; font-weight: 650; flex: 1; }
.topbar .brand { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.topbar .brand span.paw { font-size: 22px; }

.desktop-nav { display: none; }

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--nav-h) + 28px);
}

@media (min-width: 800px) {
  .desktop-nav { display: flex; gap: 4px; }
  .desktop-nav a {
    padding: 7px 13px; border-radius: 999px; color: var(--muted);
    font-size: 14.5px; font-weight: 550; text-decoration: none;
  }
  .desktop-nav a:hover { background: var(--surface-2); color: var(--ink); }
  .desktop-nav a.active { background: var(--accent-soft); color: var(--accent-dark); }
  .bottom-nav { display: none; }
  main { padding-bottom: 48px; }
}

/* ---------- Navegação inferior (celular) ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  display: flex; justify-content: space-around;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 10.5px; color: var(--muted); text-decoration: none; padding: 4px 0;
}
.bottom-nav a .ico { font-size: 20px; line-height: 1; }
.bottom-nav a.active { color: var(--accent); font-weight: 650; }

/* ---------- Cartões ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.card.tight { padding: 12px 14px; }
.card h2, .card h3 { margin: 0 0 12px; font-size: 15px; letter-spacing: .01em; }
.card h2 { font-size: 16.5px; }

.section-title {
  display: flex; align-items: center; justify-content: space-between;
  margin: 22px 0 10px; font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
}
.section-title:first-child { margin-top: 4px; }

.grid { display: grid; gap: 12px; }
@media (min-width: 640px) {
  .grid.cols-2 { grid-template-columns: 1fr 1fr; }
  .grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Métricas ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 13px 14px;
}
.stat .label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; }
.stat .value { font-size: 21px; font-weight: 700; margin-top: 3px; }
.stat .value.small { font-size: 17px; }
.stat.accent { background: var(--accent-soft); border-color: #eed3bd; }
.stat.green { background: var(--green-soft); border-color: #cbe4d2; }
.stat.amber { background: var(--amber-soft); border-color: #f0dfb6; }

/* ---------- Listas ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 11px 13px;
  text-decoration: none; color: inherit;
}
a.row:hover { border-color: var(--accent); text-decoration: none; }
/* Área clicável da linha quando há um botão separado ao lado (ex.: WhatsApp) */
.row-link {
  display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0;
  color: inherit; text-decoration: none;
}
.row-link:hover { text-decoration: none; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 620; font-size: 15.5px; }
.row .sub { font-size: 13px; color: var(--muted); }
.row .right { text-align: right; white-space: nowrap; }
.row .right .big { font-weight: 700; }

.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  object-fit: cover; background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 21px; border: 1px solid var(--border);
}
.avatar.lg { width: 76px; height: 76px; font-size: 34px; }

/* ---------- Etiquetas ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 650; padding: 3px 9px;
  border-radius: 999px; background: var(--surface-2); color: var(--muted);
  white-space: nowrap;
}
.tag.hospedado { background: var(--green-soft); color: var(--green); }
.tag.agendada  { background: var(--blue-soft);  color: var(--blue); }
.tag.finalizada{ background: var(--amber-soft); color: var(--amber); }
.tag.paga      { background: var(--green-soft); color: var(--green); }
.tag.cancelada { background: var(--red-soft);   color: var(--red); }
.tag.ok        { background: var(--green-soft); color: var(--green); }
.tag.alerta    { background: var(--amber-soft); color: var(--amber); }
.tag.vencida   { background: var(--red-soft);   color: var(--red); }
.tag.ausente   { background: var(--surface-2);  color: var(--muted); }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px 17px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--ink); font-size: 15px; font-weight: 620; font-family: inherit;
  cursor: pointer; text-decoration: none; line-height: 1.2;
}
.btn:hover { text-decoration: none; border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
/* Ações de WhatsApp usam o verde da marca — reconhecimento imediato */
.btn.wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn.wa:hover { background: var(--wa-dark); border-color: var(--wa-dark); }
.btn.wa-round { padding: 0; width: 40px; height: 40px; border-radius: 50%; flex: none; }
.ico-wa { display: block; }
a.wa-link { display: inline-flex; align-items: center; gap: 5px; color: var(--wa-dark); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); border-color: #eccfc9; }
.btn.sm { padding: 7px 12px; font-size: 13.5px; }
.btn.block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-row.stack { flex-direction: column; }

.fab {
  position: fixed; right: 16px; bottom: calc(var(--nav-h) + 16px); z-index: 35;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent); color: #fff; border: none;
  font-size: 28px; line-height: 1; box-shadow: 0 6px 20px rgba(194, 112, 61, .42);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.fab:hover { background: var(--accent-dark); text-decoration: none; }
@media (min-width: 800px) { .fab { bottom: 24px; } }

/* ---------- Formulários ---------- */
label { display: block; font-size: 13px; font-weight: 650; color: var(--muted); margin-bottom: 5px; }
input[type=text], input[type=password], input[type=number], input[type=date],
input[type=datetime-local], input[type=tel], input[type=email], input[type=search],
select, textarea {
  width: 100%; padding: 11px 12px; font-size: 16px; font-family: inherit;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { min-height: 78px; resize: vertical; }
.field { margin-bottom: 13px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 400; }
.field-row { display: grid; gap: 12px; }
@media (min-width: 560px) {
  .field-row.two { grid-template-columns: 1fr 1fr; }
  .field-row.three { grid-template-columns: repeat(3, 1fr); }
}
.check { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 500; color: var(--ink); }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

fieldset { border: none; padding: 0; margin: 0 0 6px; }
legend {
  font-size: 12.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); padding: 0; margin-bottom: 10px;
}

/* ---------- Recibo / cobrança ---------- */
.invoice-lines { border-top: 1px dashed var(--border); margin-top: 10px; padding-top: 10px; }
.invoice-line { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 14.5px; }
.invoice-line.total {
  border-top: 2px solid var(--ink); margin-top: 10px; padding-top: 10px;
  font-size: 19px; font-weight: 700;
}
.invoice-line .desc { color: var(--muted); }

pre.msg {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 13px;
  white-space: pre-wrap; word-break: break-word;
  font-family: inherit; font-size: 13.5px; margin: 0; max-height: 340px; overflow: auto;
}
code.pix {
  display: block; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px;
  font-size: 11.5px; word-break: break-all; line-height: 1.4; color: var(--muted);
}
.qr { display: flex; justify-content: center; padding: 8px; }
.qr svg { width: 190px; height: 190px; }

/* ---------- Agenda ---------- */
.cal { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cal th {
  font-size: 11px; text-transform: uppercase; color: var(--muted);
  padding: 6px 0; font-weight: 700; letter-spacing: .05em;
}
.cal td {
  vertical-align: top; height: 74px; padding: 3px;
  border: 1px solid var(--border); background: var(--surface);
}
.cal td.empty { background: transparent; border-color: transparent; }
.cal td.today { background: var(--accent-soft); border-color: var(--accent); }
.cal .daynum { font-size: 11.5px; color: var(--muted); font-weight: 650; }
.cal .pill {
  display: block; font-size: 10px; padding: 2px 5px; border-radius: 5px;
  background: var(--green-soft); color: var(--green); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none;
}
.cal .pill.agendada { background: var(--blue-soft); color: var(--blue); }

/* ---------- Diversos ---------- */
.empty {
  text-align: center; padding: 30px 16px; color: var(--muted);
  border: 1px dashed var(--border); border-radius: var(--radius); background: var(--surface-2);
}
.empty .big { font-size: 34px; display: block; margin-bottom: 6px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-variant-numeric: tabular-nums; }
.divider { height: 1px; background: var(--border); margin: 14px 0; border: none; }
.flash {
  background: var(--green-soft); color: var(--green); border: 1px solid #cbe4d2;
  border-radius: var(--radius-sm); padding: 10px 13px; margin-bottom: 14px; font-weight: 600;
}
.warn { background: var(--amber-soft); color: #8a6410; border-color: #f0dfb6; }
.err  { background: var(--red-soft); color: var(--red); border-color: #eccfc9; }

.info-grid { display: grid; grid-template-columns: 1fr; gap: 9px; }
@media (min-width: 560px) { .info-grid { grid-template-columns: 1fr 1fr; } }
.info-item .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; }
.info-item .v { font-size: 15px; }

/* Alternador entre listas irmãs (Cães / Tutores) */
.segmented {
  display: flex; gap: 4px; padding: 4px; margin-bottom: 14px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
}
.segmented a {
  flex: 1; text-align: center; padding: 9px 8px; border-radius: 999px;
  font-size: 14.5px; font-weight: 620; color: var(--muted); text-decoration: none;
  white-space: nowrap;
}
.segmented a:hover { text-decoration: none; color: var(--ink); }
.segmented a.active {
  background: var(--surface); color: var(--accent-dark);
  box-shadow: 0 1px 3px rgba(58, 42, 31, .10);
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  border-radius: 999px; padding: 5px 12px; font-size: 13px; cursor: pointer; font-family: inherit;
}
.chip:hover { border-color: var(--accent); color: var(--accent-dark); }

.login-wrap { max-width: 340px; margin: 12vh auto; padding: 0 20px; text-align: center; }
.login-wrap .paw { font-size: 54px; }
.login-wrap h1 { font-size: 23px; margin: 8px 0 22px; }

@media print {
  .topbar, .bottom-nav, .fab, .no-print { display: none !important; }
  body { background: #fff; }
  main { padding: 0; max-width: none; }
  .card { box-shadow: none; border-color: #ddd; break-inside: avoid; }
}
