/* Property Leads — minimal CSS, mobile-friendly */
:root {
  --bg: #f5f5f7;
  --fg: #1d1d1f;
  --muted: #86868b;
  --accent: #0071e3;
  --accent-dark: #005bbf;
  --border: #d2d2d7;
  --row-new-bg: #fff7e0;
  --card-bg: #ffffff;
  --danger: #c0392b;
  --status-new: #0071e3;
  --status-contacted: #ff9500;
  --status-in_negotiation: #af52de;
  --status-exclusive_signed: #34c759;
  --status-discarded: #8e8e93;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  font-size: 14px;
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Top bar */
.topbar {
  display: flex; align-items: center; gap: 24px;
  background: white; padding: 10px 20px;
  border-bottom: 1px solid var(--border);
}
.topbar .brand { font-weight: 700; font-size: 18px; color: var(--fg); }
.topbar nav { display: flex; gap: 16px; flex: 1; }
.topbar nav a { color: var(--fg); font-weight: 500; }
.topbar .user { display: flex; align-items: center; gap: 12px; color: var(--muted); }

main { padding: 20px; max-width: 1400px; margin: 0 auto; }

/* Login */
.login-wrap {
  min-height: 80vh; display: flex; align-items: center; justify-content: center;
}
.login-card {
  background: var(--card-bg); padding: 32px; border-radius: 12px;
  width: 360px; max-width: 100%; box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  display: flex; flex-direction: column; gap: 12px;
}
.login-card h1 { margin: 0; font-size: 22px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.login-card input {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px;
}
.login-card input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.alert {
  background: #fff1f0; color: var(--danger); padding: 10px 12px;
  border-radius: 6px; font-size: 13px;
}

/* Layout listado */
.layout { display: grid; grid-template-columns: 240px 1fr; gap: 20px; }
@media (max-width: 768px) { .layout { grid-template-columns: 1fr; } }

.filters {
  background: var(--card-bg); padding: 16px; border-radius: 10px;
  height: max-content; position: sticky; top: 20px;
}
.filters h3 { margin: 0 0 12px; font-size: 14px; }
.filters fieldset {
  border: none; padding: 0; margin: 0 0 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.filters legend {
  font-size: 12px; color: var(--muted); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.filters .check { display: flex; gap: 6px; align-items: center; font-size: 13px; }
.filters .row { display: flex; gap: 6px; }
.filters .row input { flex: 1; min-width: 0; }
.filters input[type="number"], .filters input[type="search"] {
  padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px;
}
.filters .search { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; font-size: 12px; color: var(--muted); }
.filters button { margin-top: 8px; }

/* Results */
.results-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px;
}
.results-header h2 { margin: 0; font-size: 18px; }

.leads-table {
  width: 100%; border-collapse: collapse;
  background: var(--card-bg); border-radius: 10px; overflow: hidden;
  font-size: 13px;
}
.leads-table th, .leads-table td {
  padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border);
}
.leads-table th {
  background: #fafafc; font-weight: 600; font-size: 12px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.4px;
}
.leads-table tbody tr:hover { background: #fafafc; }
.leads-table tbody tr.row-new { background: var(--row-new-bg); }
.leads-table tbody tr.row-new:hover { background: #fff0c0; }
.leads-table .price { font-weight: 600; color: var(--accent); white-space: nowrap; }

/* Status pills */
.status {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; color: white;
  text-transform: uppercase; letter-spacing: 0.4px;
}
.status-new { background: var(--status-new); }
.status-contacted { background: var(--status-contacted); }
.status-in_negotiation { background: var(--status-in_negotiation); }
.status-exclusive_signed { background: var(--status-exclusive_signed); }
.status-discarded { background: var(--status-discarded); }

/* Pager */
.pager {
  display: flex; gap: 16px; justify-content: center; align-items: center;
  margin-top: 16px; padding: 12px;
}

/* Detail */
.detail { display: flex; flex-direction: column; gap: 16px; }
.detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: 20px; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }

.card {
  background: var(--card-bg); padding: 20px; border-radius: 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.card h1 { margin: 0 0 8px; font-size: 22px; }
.card h3 { margin: 16px 0 8px; font-size: 14px; }
.detail .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--fg); }
.detail .price-big { font-size: 32px; font-weight: 700; color: var(--accent); margin: 12px 0; }
.detail .kv { display: flex; flex-direction: column; gap: 4px; font-size: 13px; margin-bottom: 12px; }
.detail .description { white-space: pre-wrap; font-size: 13px; line-height: 1.6; }
.notes { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 12px; }
.notes .note-meta { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.notes .note-text { font-size: 13px; white-space: pre-wrap; }

/* Buttons */
.btn-primary, .btn-secondary, .btn-link {
  display: inline-block; font: inherit; text-decoration: none; cursor: pointer;
  border: 1px solid transparent; border-radius: 6px; padding: 8px 14px;
  font-size: 13px; transition: background 0.15s;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary { background: white; color: var(--accent); border-color: var(--accent); }
.btn-secondary:hover { background: var(--accent); color: white; }
.btn-link { background: transparent; color: var(--accent); padding: 4px 8px; }

.muted { color: var(--muted); font-size: 13px; }

/* Status widget on detail page */
.status-widget { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.status-widget select {
  padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px;
}

/* Note form */
.note-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.note-form textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px;
  font: inherit; font-size: 13px; resize: vertical;
}
.note-form textarea:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.note-form button { align-self: flex-start; }
