.admin-body { background: var(--cream); min-height: 100vh; }

/* ---- Login ---- */
.admin-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.admin-login[hidden] { display: none; }
.admin-login-card {
  background: var(--white);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  border: 1px solid #ece6da;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.admin-login-hint { color: #666; font-size: 14px; margin-bottom: 6px; }
.admin-error { color: #b3392c; font-size: 13.5px; min-height: 18px; }

/* ---- Topbar ---- */
.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 40px;
  background: var(--white);
  border-bottom: 1px solid #ece6da;
}
.admin-topbar-actions { display: flex; gap: 12px; }
.admin-topbar-actions .btn { padding: 11px 20px; font-size: 12px; }

/* ---- Tabs ---- */
.admin-tabs {
  display: flex;
  gap: 8px;
  padding: 0 40px;
  background: var(--white);
  border-bottom: 1px solid #ece6da;
}
.admin-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 16px 6px;
  margin-right: 22px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .5px;
  color: #888;
  cursor: pointer;
}
.admin-tab.active { color: var(--green); border-bottom-color: var(--green); }

.admin-content { padding: 56px 40px; }
.admin-content[hidden] { display: none; }
.admin-content-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

/* ---- Property list ---- */
.admin-property-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}
.admin-property-card {
  background: var(--white);
  border: 1px solid #ece6da;
  display: flex;
  flex-direction: column;
}
.admin-property-thumb {
  aspect-ratio: 16/10;
  overflow: hidden;
  background: var(--cream);
}
.admin-property-thumb img { width: 100%; height: 100%; object-fit: cover; }
.admin-property-body { padding: 20px 22px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.admin-property-tag {
  align-self: flex-start;
  font-size: 11px; font-weight: 700; letter-spacing: 1px;
  color: var(--green); background: var(--warm);
  padding: 3px 10px;
}
.admin-property-body h3 { font-size: 19px; font-family: var(--font-heading); color: var(--ink); font-weight: 500; }
.admin-property-body .loc { font-size: 13px; color: #888; }
.admin-property-body .price { font-family: var(--font-heading); font-size: 18px; color: var(--green); margin-top: 4px; }
.admin-property-actions { display: flex; gap: 10px; padding: 16px 22px; border-top: 1px solid #f0ece2; }
.admin-property-actions button {
  flex: 1;
  font-size: 12px; font-weight: 600; letter-spacing: .5px;
  padding: 10px; border: 1px solid #ddd; background: var(--white); cursor: pointer;
  transition: all .2s ease;
}
.admin-property-actions .edit-btn:hover { border-color: var(--green); color: var(--green); }
.admin-property-actions .delete-btn:hover { border-color: #b3392c; color: #b3392c; }
.admin-featured-badge { font-size: 11px; color: var(--stone); }

/* ---- Analytics ---- */
.analytics-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}
.analytics-stat {
  background: var(--white);
  border: 1px solid #ece6da;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.analytics-stat-value { font-family: var(--font-heading); font-size: 36px; color: var(--green); line-height: 1; }
.analytics-stat-label { font-size: 12px; font-weight: 600; letter-spacing: .5px; color: #888; }

.analytics-card {
  background: var(--white);
  border: 1px solid #ece6da;
  padding: 26px 28px;
  margin-bottom: 20px;
}
.analytics-card h3 {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 19px;
  color: var(--green);
  margin: 0 0 20px;
}

.analytics-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 140px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.analytics-bar-col {
  flex: 1 0 16px;
  min-width: 16px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}
.analytics-bar {
  width: 100%;
  min-height: 2px;
  background: var(--green);
  opacity: .85;
}
.analytics-bar-col:hover .analytics-bar { opacity: 1; background: var(--green-light); }
.analytics-bar-label {
  display: none;
  font-size: 9px;
  color: var(--stone);
}
.analytics-bar-col:nth-child(5n+1) .analytics-bar-label { display: block; }

.analytics-table { width: 100%; border-collapse: collapse; }
.analytics-table td { padding: 10px 0; border-bottom: 1px solid #f0ece2; font-size: 14px; color: #444; }
.analytics-table tr:last-child td { border-bottom: none; }
.analytics-table-count { text-align: right; font-weight: 700; color: var(--green); width: 60px; }

@media (max-width: 700px) {
  .analytics-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ---- CRM / Leads ---- */
.admin-lead-list { display: flex; flex-direction: column; gap: 20px; }
.admin-lead-card {
  background: var(--white);
  border: 1px solid #ece6da;
  display: grid;
  grid-template-columns: 1.3fr 1fr;
}
.admin-lead-main { padding: 24px 26px; border-right: 1px solid #f0ece2; }
.admin-lead-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.admin-lead-head h3 { font-size: 19px; font-family: var(--font-heading); color: var(--ink); font-weight: 500; }
.admin-lead-date { font-size: 12px; color: var(--stone); white-space: nowrap; }
.admin-lead-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.admin-lead-meta span { font-size: 13px; color: #666; }
.admin-lead-topic {
  font-size: 11px; font-weight: 700; letter-spacing: .5px;
  color: var(--green); background: var(--warm);
  padding: 3px 10px;
}
.admin-lead-message { font-size: 14px; color: #444; line-height: 1.6; white-space: pre-wrap; }
.admin-lead-notes { padding: 24px 26px; display: flex; flex-direction: column; gap: 10px; background: var(--cream); }
.admin-lead-notes label { font-size: 12px; font-weight: 700; letter-spacing: 1px; color: #555; }
.admin-lead-notes textarea {
  flex: 1; min-height: 100px; resize: vertical;
  border: 1px solid #ddd; padding: 12px 14px; font: inherit; font-size: 13.5px;
}
.admin-lead-notes-actions { display: flex; align-items: center; gap: 14px; }
.admin-lead-save { padding: 10px 18px; font-size: 12px; }
.admin-lead-save-status { font-size: 12.5px; color: var(--green); }
.admin-lead-delete {
  align-self: flex-start;
  margin-top: auto;
  background: none; border: none;
  font-size: 12px; font-weight: 600; letter-spacing: .5px;
  color: #b3392c; cursor: pointer; padding: 0;
}
.admin-lead-delete:hover { text-decoration: underline; }

@media (max-width: 700px) {
  .admin-lead-card { grid-template-columns: 1fr; }
  .admin-lead-main { border-right: none; border-bottom: 1px solid #f0ece2; }
}

.price-input-group { display: flex; }
.price-input-group .price-input-prefix {
  display: flex; align-items: center;
  padding: 0 14px;
  border: 1px solid #ddd; border-right: none;
  background: var(--cream);
  font-weight: 700; font-size: 13px; color: var(--green);
  white-space: nowrap;
}
.price-input-group input { flex: 1; border-left: none; min-width: 0; }

/* ---- Modal ---- */
.admin-modal {
  position: fixed; inset: 0;
  background: rgba(10,10,10,.5);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  z-index: 2000;
}
.admin-modal[hidden] { display: none; }
.admin-modal-card {
  background: var(--white);
  width: 100%; max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 40px;
}
.admin-modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.admin-modal-close { background: none; border: none; font-size: 28px; line-height: 1; cursor: pointer; color: #999; }
.admin-checkbox-field label { display: flex; align-items: center; gap: 10px; font-size: 14px; color: #444; font-weight: 400; letter-spacing: 0; }

.admin-image-hint { font-size: 12.5px; color: #888; margin: 8px 0 4px; }
.admin-upload-progress { font-size: 13px; color: var(--green); min-height: 18px; }

.admin-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
.admin-image-grid:empty { display: none; }
.admin-image-thumb {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid #e5e0d8;
}
.admin-image-thumb img { width: 100%; height: 100%; object-fit: cover; }
.admin-image-remove {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(10,10,10,.7);
  color: var(--white);
  border: none;
  font-size: 14px; line-height: 1;
  cursor: pointer;
}
.admin-image-thumb.is-new::after {
  content: "Nueva";
  position: absolute; bottom: 0; left: 0; right: 0;
  background: var(--green);
  color: var(--white);
  font-size: 10px; text-align: center;
  padding: 2px 0;
}

/* ---- Design & Content form ---- */
.admin-success { color: var(--green); font-size: 13.5px; min-height: 18px; }

.design-panel {
  background: var(--white);
  border: 1px solid #ece6da;
  padding: 32px;
  margin-bottom: 24px;
}
.design-panel-title {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 22px;
  color: var(--green);
  margin-bottom: 22px;
}
.design-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}
.design-grid--colors { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.design-grid .field { display: flex; flex-direction: column; gap: 8px; }
.design-grid .field.full { grid-column: 1 / -1; }
.design-grid .field label {
  font-size: 12px; font-weight: 700; letter-spacing: 1px; color: #555;
}
.design-grid .field input, .design-grid .field textarea {
  border: 1px solid #ddd; padding: 12px 14px; font: inherit; font-size: 14px;
}
.design-grid .field textarea { min-height: 90px; resize: vertical; }

.lang-field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.lang-field { position: relative; }
.lang-field .lang-tag {
  position: absolute; top: -8px; left: 10px;
  background: var(--white);
  padding: 0 6px;
  font-size: 10px; font-weight: 700; letter-spacing: 1px; color: var(--stone);
}
.lang-field input, .lang-field textarea {
  width: 100%; border: 1px solid #ddd; padding: 12px 14px; font: inherit; font-size: 14px;
}
.lang-field textarea { min-height: 90px; resize: vertical; }

.design-grid--images { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.image-field { display: flex; flex-direction: column; gap: 10px; }
.image-field label { font-size: 12px; font-weight: 700; letter-spacing: .5px; color: #555; }
.image-field-preview {
  aspect-ratio: 16/10;
  background: var(--cream);
  border: 1px solid #e5e0d8;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.image-field-preview--dark { background: var(--green); }
.image-field-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.image-field input[type="file"] { font-size: 12px; }

.color-field { display: flex; flex-direction: column; gap: 8px; }
.color-field label { font-size: 12px; font-weight: 700; letter-spacing: .5px; color: #555; }
.color-input-row { display: flex; align-items: center; gap: 10px; }
.color-input-row input[type="color"] {
  width: 42px; height: 38px; border: 1px solid #ddd; padding: 2px; cursor: pointer;
}
.color-input-row input[type="text"] {
  flex: 1; border: 1px solid #ddd; padding: 10px 12px; font: inherit; font-size: 13px;
}

.size-field { display: flex; flex-direction: column; gap: 10px; }
.size-field label { font-size: 13px; font-weight: 600; color: #444; }
.size-field input[type="range"] { width: 100%; }

.design-actions { display: flex; justify-content: flex-end; gap: 14px; margin-top: 8px; }
.design-actions .btn { padding: 13px 26px; }

@media (max-width: 700px) {
  .admin-topbar, .admin-content, .admin-tabs { padding-left: 20px; padding-right: 20px; }
  .admin-modal-card { padding: 28px 22px; }
  .design-grid, .lang-field-pair { grid-template-columns: 1fr; }

  .admin-topbar {
    flex-wrap: wrap;
    gap: 14px;
  }
  .admin-topbar .logo { font-size: 17px !important; }
  .admin-topbar-actions { width: 100%; }
  .admin-topbar-actions .btn { flex: 1; text-align: center; }
}
