@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Playfair+Display:wght@400;500&display=swap');

:root {
  --gold: #C8A96E;
  --gold-light: #E8D5AA;
  --red: #CF3A2F;
  --dark: #1A1A1A;
  --mid: #555;
  --light: #999;
  --bg: #F8F6F2;
  --white: #FFFFFF;
  --border: #E0DBD3;
  --found: #2D7D4E;
  --found-bg: #EBF5EF;
  --missing-bg: #FDF3F2;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--dark);
  line-height: 1.6;
  min-height: 100vh;
}

/* HEADER */
header {
  background: var(--dark);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 2px solid var(--gold);
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.logo {
  font-family: 'Playfair Display', serif;
  color: var(--white);
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 0.02em;
  line-height: 1.2;
}
.logo span { color: var(--gold); }
.logo small {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: var(--light);
  font-weight: 300;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 2px;
}
.header-actions { display: flex; gap: 10px; align-items: center; }
.btn-primary {
  background: var(--gold);
  color: var(--dark);
  border: none;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.04em;
  transition: background 0.2s;
  border-radius: 2px;
}
.btn-primary:hover { background: var(--gold-light); }
.btn-secondary {
  background: transparent;
  color: var(--light);
  border: 1px solid #444;
  padding: 10px 20px;
  font-size: 13px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  border-radius: 2px;
  transition: all 0.2s;
}
.btn-secondary:hover { border-color: var(--gold); color: var(--gold); }

/* HERO */
.hero {
  background: var(--dark);
  padding: 64px 24px 56px;
  text-align: center;
}
.hero-flag {
  font-size: 36px;
  margin-bottom: 16px;
}
.hero h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(28px, 5vw, 52px);
  color: var(--white);
  font-weight: 400;
  line-height: 1.2;
  max-width: 700px;
  margin: 0 auto 16px;
}
.hero h1 em { color: var(--gold); font-style: normal; }
.hero p {
  color: var(--light);
  font-size: 16px;
  max-width: 520px;
  margin: 0 auto 32px;
  line-height: 1.7;
}
.stats-bar {
  display: flex;
  gap: 40px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid #333;
}
.stat { text-align: center; }
.stat-num {
  font-size: 32px;
  font-weight: 300;
  color: var(--white);
  line-height: 1;
  font-family: 'Playfair Display', serif;
}
.stat-num.found { color: #4CAF7D; }
.stat-label {
  font-size: 11px;
  color: var(--light);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 4px;
}

/* FILTERS */
.filters-bar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  max-width: 100%;
}
.filters-inner {
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.filter-hint {
  flex: 1 1 100%;
  margin: 0;
  font-size: 12px;
  color: var(--muted, #666);
  line-height: 1.4;
}
.search-input {
  flex: 1;
  min-width: 200px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  border-radius: 2px;
  outline: none;
}
.search-input:focus { border-color: var(--gold); }
.filter-select {
  padding: 10px 14px;
  border: 1px solid var(--border);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  cursor: pointer;
  border-radius: 2px;
  outline: none;
}
.filter-select:focus { border-color: var(--gold); }

/* MAIN GRID */
.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 24px;
}
.section-title {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 400;
  color: var(--dark);
}
.count-badge {
  font-size: 13px;
  color: var(--light);
  font-weight: 400;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* CARD */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
  cursor: pointer;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.08); }
.card.found { border-color: #B8DFC9; }

.card-photo {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--light);
  font-size: 48px;
}
.card-photo img { width: 100%; height: 100%; object-fit: cover; }

.card-body { padding: 16px; }
.card-status {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 2px;
  margin-bottom: 10px;
}
.status-missing { background: var(--missing-bg); color: var(--red); }
.status-found { background: var(--found-bg); color: var(--found); }

.card-name {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 400;
  color: var(--dark);
  line-height: 1.2;
  margin-bottom: 6px;
}
.card-meta {
  font-size: 12px;
  color: var(--light);
  margin-bottom: 8px;
  line-height: 1.6;
}
.card-location {
  font-size: 13px;
  color: var(--mid);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 12px;
}
.card-footer {
  border-top: 1px solid var(--border);
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card-date { font-size: 11px; color: var(--light); }
.btn-info {
  font-size: 11px;
  padding: 5px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  border-radius: 2px;
  color: var(--mid);
  transition: all 0.15s;
}
.btn-info:hover { border-color: var(--gold); color: var(--dark); }

.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--light);
  grid-column: 1/-1;
}
.empty-state h3 { font-family: 'Playfair Display', serif; font-size: 22px; color: var(--mid); margin-bottom: 8px; font-weight: 400; }

/* MODALS */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--white);
  width: 100%;
  max-width: 640px;
  border-radius: 4px;
  margin: auto;
  overflow: hidden;
}
.modal-header {
  background: var(--dark);
  padding: 24px 28px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid var(--gold);
}
.modal-title {
  font-family: 'Playfair Display', serif;
  color: var(--white);
  font-size: 20px;
  font-weight: 400;
  line-height: 1.2;
}
.modal-subtitle { font-size: 12px; color: var(--light); margin-top: 4px; }
.modal-close {
  background: none;
  border: none;
  color: var(--light);
  font-size: 22px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}
.modal-close:hover { color: var(--white); }
.modal-body { padding: 28px; }

/* FORM */
.form-section {
  margin-bottom: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}
.form-section:last-of-type { border-bottom: none; }
.form-section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--light);
  margin-bottom: 16px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row.single { grid-template-columns: 1fr; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 13px; color: var(--mid); font-weight: 500; }
.form-label .req { color: var(--red); margin-left: 2px; }
.form-input, .form-select, .form-textarea {
  padding: 10px 12px;
  border: 1px solid var(--border);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  border-radius: 2px;
  outline: none;
  transition: border-color 0.15s;
  color: var(--dark);
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--gold); background: var(--white); }
.form-textarea { resize: vertical; min-height: 80px; }

.photo-upload {
  border: 2px dashed var(--border);
  border-radius: 4px;
  padding: 32px;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--bg);
}
.photo-upload:hover { border-color: var(--gold); background: var(--white); }
.photo-upload input { display: none; }
.photo-upload-icon { font-size: 32px; margin-bottom: 8px; }
.photo-upload-text { font-size: 13px; color: var(--mid); }
.photo-upload-hint { font-size: 11px; color: var(--light); margin-top: 4px; }
.photo-preview { width: 100%; max-height: 320px; object-fit: contain; border-radius: 4px; background: var(--bg); border: 1px solid var(--border); }

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}
.btn-submit {
  background: var(--gold);
  color: var(--dark);
  border: none;
  padding: 12px 28px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  border-radius: 2px;
  transition: background 0.2s;
}
.btn-submit:hover { background: var(--gold-light); }
.btn-submit:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-cancel {
  background: transparent;
  color: var(--mid);
  border: 1px solid var(--border);
  padding: 12px 20px;
  font-size: 14px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  border-radius: 2px;
}
.btn-cancel:hover { border-color: var(--mid); }

.dup-warning {
  margin-top: 8px;
  padding: 16px;
  border: 1px solid #e8c4a0;
  border-radius: 4px;
  background: #fff8f0;
}
.dup-warning.hidden { display: none; }
.dup-warning-title {
  font-size: 14px;
  font-weight: 600;
  color: #9a5b00;
  margin-bottom: 6px;
}
.dup-warning-text {
  font-size: 13px;
  color: var(--mid);
  margin: 0 0 14px;
  line-height: 1.45;
}
.dup-matches-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
  max-height: 240px;
  overflow-y: auto;
}
.dup-match {
  display: flex;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--white);
}
.dup-match-photo {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 24px;
}
.dup-match-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.dup-match-body { flex: 1; min-width: 0; }
.dup-match-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--dark);
}
.dup-match-meta {
  font-size: 12px;
  color: var(--mid);
  margin-top: 4px;
  line-height: 1.4;
}
.dup-match-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.dup-reason {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: #fde8d8;
  color: #9a5b00;
}
.dup-match-actions { flex-shrink: 0; align-self: center; }
.dup-match-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--gold);
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  padding: 0;
  white-space: nowrap;
}
.dup-match-link:hover { text-decoration: underline; }
.dup-confirm {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--dark);
  cursor: pointer;
  line-height: 1.4;
}
.dup-confirm input { margin-top: 3px; flex-shrink: 0; }

.found-intro {
  font-size: 14px;
  color: #666;
  line-height: 1.6;
  margin-bottom: 16px;
}
.found-dup-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  cursor: pointer;
}
.found-dup-item:last-child { border-bottom: none; }
.found-dup-item input { margin-top: 4px; flex-shrink: 0; }
.found-dup-item-body { flex: 1; min-width: 0; }
.found-dup-item-name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--dark);
}
.found-dup-item-meta {
  display: block;
  font-size: 12px;
  color: var(--light);
  margin-top: 2px;
}
.btn-found-submit {
  background: var(--found);
}

/* DETAIL MODAL */
.detail-photo {
  width: 100%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  color: var(--light);
  overflow: hidden;
}
.detail-photo img { width: 100%; height: auto; max-height: 500px; object-fit: contain; }
.detail-body { padding: 28px; }
.detail-name {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 400;
  margin-bottom: 6px;
}
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 20px 0;
}
.detail-field {}
.detail-field-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--light); margin-bottom: 3px; }
.detail-field-value { font-size: 14px; color: var(--dark); }
.detail-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--light);
  margin: 24px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.contact-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px;
  font-size: 13px;
  color: var(--mid);
  line-height: 1.8;
}
.contact-box strong { color: var(--dark); display: block; margin-bottom: 2px; }
.contact-info { margin-top: 6px; line-height: 1.7; }
.contact-quick-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.btn-contact {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  border-radius: 2px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-whatsapp {
  background: #25D366;
  color: var(--white);
  border: none;
}
.btn-whatsapp:hover { opacity: 0.9; }
.btn-email {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold);
}
.btn-email:hover { background: var(--gold); color: var(--dark); }
.detail-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  flex-wrap: wrap;
}
.btn-found {
  background: var(--found);
  color: var(--white);
  border: none;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  border-radius: 2px;
  transition: opacity 0.2s;
}
.btn-found:hover { opacity: 0.85; }
.btn-aviso {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold);
  padding: 10px 20px;
  font-size: 13px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  border-radius: 2px;
  transition: all 0.2s;
}
.btn-aviso:hover { background: var(--gold); color: var(--dark); }

/* AVISOS */
.aviso-item {
  background: var(--bg);
  border-radius: 4px;
  padding: 12px 14px;
  margin-bottom: 8px;
  font-size: 13px;
  border-left: 3px solid var(--gold);
}
.aviso-meta { font-size: 11px; color: var(--light); margin-top: 4px; }

/* TOAST */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--dark);
  color: var(--white);
  padding: 14px 20px;
  border-radius: 4px;
  font-size: 14px;
  z-index: 9999;
  border-left: 4px solid var(--gold);
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.3s;
  max-width: 320px;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { border-left-color: var(--found); }
.toast.error { border-left-color: var(--red); }

#pagination { margin-top: 32px; }
.pag-inner { display: flex; align-items: center; justify-content: center; gap: 16px; }
.pag-btn { background: var(--white); border: 1px solid var(--border); padding: 10px 20px; font-size: 14px; cursor: pointer; font-family: 'Inter', sans-serif; border-radius: 2px; color: var(--mid); transition: all 0.15s; }
.pag-btn:hover { border-color: var(--gold); color: var(--dark); }
.pag-info { font-size: 13px; color: var(--light); }

/* LOADING */
.loading {
  text-align: center;
  padding: 60px;
  color: var(--light);
  font-size: 14px;
  grid-column: 1/-1;
}

/* AVISO FORM */
.aviso-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); display: none; }
.aviso-form.open { display: block; }

/* FOOTER */
footer {
  background: var(--dark);
  color: var(--light);
  text-align: center;
  padding: 32px 24px;
  font-size: 12px;
  line-height: 1.8;
  border-top: 1px solid #333;
}
footer strong { color: var(--gold); }

@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .stats-bar { gap: 24px; }
  .hero { padding: 40px 20px 32px; }
}

.tabs-bar {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 16px 24px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
}
.tab {
  background: transparent;
  border: 1px solid var(--border);
  padding: 10px 18px;
  font-size: 13px;
  cursor: pointer;
  border-radius: 2px;
  font-family: 'Inter', sans-serif;
}
.tab.active {
  background: var(--dark);
  color: var(--white);
  border-color: var(--dark);
}
.hidden { display: none !important; }
.btn-sos {
  background: var(--red);
  color: white;
  border: none;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 2px;
}
.stat-num.sos { color: #ff6b6b; }
.status-sos { background: #FDF3F2; color: var(--red); }
.sos-card.sos-active { border: 2px solid var(--red); }
.edificio-card.sev-grave { border-left: 4px solid var(--red); }
.edificio-card.sev-moderado { border-left: 4px solid var(--gold); }
.updated-at { margin-top: 16px; font-size: 12px; color: var(--light); }
.btn-sos-submit { background: var(--red) !important; color: white !important; }
