@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #0284c7;
  --primary-dark: #0369a1;
  --accent: #10b981;
  --accent-dark: #059669;
  --danger: #e11d48;
  --danger-dark: #be123c;
  --border: #e2e8f0;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 28px -10px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 24px 60px -24px rgba(15, 23, 42, 0.22);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(1200px 500px at 100% -10%, rgba(2, 132, 199, 0.06), transparent 60%),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: rgba(2, 132, 199, 0.18); color: var(--text); }
h1, h2, h3, h4 { letter-spacing: -0.02em; color: #0f172a; }
a { color: var(--primary); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(2, 132, 199, 0.35);
  outline-offset: 2px;
}

.container { max-width: 1060px; margin: 0 auto; padding: 24px 16px 48px; }

header.top {
  background: linear-gradient(90deg, #0f172a 0%, #16304a 55%, #0f766e 130%);
  color: #fff;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
header.top .brand {
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}
header.top .brand a { color: #fff; text-decoration: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #fff;
  border: 1px solid rgba(2, 132, 199, 0.4);
  border-radius: 11px;
  padding: 11px 18px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 700;
  font-family: inherit;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.28);
  transition: transform 0.12s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(2, 132, 199, 0.34);
}
.btn:active { transform: translateY(0); }

.btn.secondary {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #cbd5e1;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}
.btn.secondary:hover { background: #f1f5f9; box-shadow: 0 3px 8px rgba(15, 23, 42, 0.08); }

.btn.danger {
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
  color: #fff;
  border-color: rgba(225, 29, 72, 0.4);
  box-shadow: 0 2px 8px rgba(225, 29, 72, 0.28);
}

.btn.whatsapp {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.28);
}

.btn.sm { padding: 7px 12px; font-size: 12.5px; border-radius: 9px; }
.btn.block { width: 100%; }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.card h2, .card h3 {
  margin-bottom: 12px;
  letter-spacing: -0.3px;
  color: #0f172a;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin: 12px 0 5px;
  color: #334155;
}
input, select, textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: #f8fafc;
  color: #0f172a;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
input[type="checkbox"] { width: auto; margin-right: 7px; transform: scale(1.2); accent-color: var(--primary); }
input:focus, select:focus, textarea:focus {
  outline: none;
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.15);
}

.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 190px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }

.pet-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  background: #fff;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.pet-card:hover {
  transform: translateY(-3px);
  border-color: #bae6fd;
  box-shadow: 0 16px 34px -12px rgba(2, 132, 199, 0.22);
}
.pet-card.lost { border: 2px solid var(--danger); background: #fff1f2; }

.pet-avatar {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 12px;
  border: 3px solid #bae6fd;
  background: #f1f5f9;
  display: block;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.14);
}
.pet-avatar-placeholder {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  margin: 0 auto 12px;
  background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
  color: #0284c7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  border: 3px solid #7dd3fc;
}

.photo-uploader {
  border: 2px dashed #94a3b8;
  border-radius: 14px;
  padding: 16px;
  text-align: center;
  background: #f8fafc;
  margin-top: 6px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.photo-uploader:hover { border-color: var(--primary); background: #f0f9ff; }
.photo-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }
.photo-preview {
  width: 140px;
  height: 140px;
  object-fit: cover;
  border-radius: 14px;
  border: 3px solid var(--primary);
  margin: 10px auto 4px;
  display: block;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.pet-card .qr { display: flex; justify-content: center; margin: 14px 0; }
.pet-card .qr img, .pet-card .qr canvas {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  background: #fff;
}

.small { font-size: 12.5px; color: var(--muted); word-break: break-word; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.badge.blue { background: #e0f2fe; color: #0369a1; }
.badge.green { background: #d1fae5; color: #065f46; }
.badge.orange { background: #fef3c7; color: #b45309; }
.badge.red { background: #ffe4e6; color: #be123c; }
.badge.purple { background: #f3e8ff; color: #6b21a8; }

.alert-lost {
  background: linear-gradient(135deg, #e11d48 0%, #9f1239 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 18px;
  box-shadow: 0 8px 24px rgba(225, 29, 72, 0.28);
}
.alert-lost h3 { margin-bottom: 4px; font-size: 19px; color: #fff; }

.muted { color: var(--muted); }
.error { color: var(--danger); font-size: 13px; margin-top: 6px; font-weight: 600; }
.success { color: #059669; font-size: 13px; margin-top: 6px; font-weight: 700; }
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { background: #f8fafc; font-weight: 700; color: #334155; }
tbody tr { transition: background 0.12s ease; }
tbody tr:hover { background: #f8fafc; }

#map { height: 300px; border-radius: 12px; margin-top: 12px; border: 1px solid var(--border); }

.tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.tabs button {
  flex: 1;
  min-width: 140px;
  padding: 11px 14px;
  border: 1.5px solid #cbd5e1;
  background: #fff;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  font-family: inherit;
  color: #334155;
  transition: all 0.15s ease;
}
.tabs button:hover { border-color: var(--primary); color: var(--primary); }
.tabs button.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.28);
}

.hidden { display: none !important; }

.chat { border: 1px solid var(--border); border-radius: var(--radius); background: #fff; overflow: hidden; box-shadow: var(--shadow); }
.chat .messages { height: 420px; overflow-y: auto; padding: 18px; background: #f1f5f9; }
.msg { max-width: 80%; margin-bottom: 10px; padding: 11px 14px; border-radius: 14px; white-space: pre-wrap; font-size: 14px; }
.msg.bot { background: #fff; border: 1px solid var(--border); }
.msg.user { background: #dcfce7; color: #064e3b; margin-left: auto; font-weight: 500; }
.chat .inputrow { display: flex; border-top: 1px solid var(--border); }
.chat .inputrow input { border: none; border-radius: 0; flex: 1; background: #fff; }
.chat .inputrow button { border-radius: 0; }

.detail-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.kpi-card {
  text-align: center;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fafc, #ffffff);
}
.kpi-card .num { font-size: 28px; font-weight: 800; color: var(--primary); }

@media print {
  header.top, .no-print { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}
