/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand: #1a56db;
  --brand-dark: #1341b0;
  --brand-light: #e8f0fe;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--gray-900);
  background: var(--gray-50);
  line-height: 1.6;
}

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

/* ── Layout ── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}
.narrow-container {
  max-width: 560px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ── Navbar ── */
.navbar {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.nav-brand { font-size: 1.15rem; font-weight: 700; color: var(--gray-900); }
.nav-links { display: flex; gap: 1.5rem; }
.nav-links a { color: var(--gray-700); font-size: .9rem; font-weight: 500; }
.nav-links a:hover { color: var(--brand); text-decoration: none; }

footer {
  text-align: center;
  padding: 2rem;
  color: var(--gray-500);
  font-size: .85rem;
  border-top: 1px solid var(--gray-200);
  margin-top: 3rem;
}

/* ── Alerts ── */
.alert {
  padding: .85rem 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  font-size: .9rem;
  font-weight: 500;
}
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.alert-danger  { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.alert-info    { background: #e0f2fe; color: #0369a1; border: 1px solid #7dd3fc; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1.1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background .15s, border-color .15s, opacity .15s;
  text-decoration: none;
}
.btn:hover { text-decoration: none; opacity: .88; }
.btn-primary  { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-secondary{ background: #fff; color: var(--gray-700); border-color: var(--gray-300); }
.btn-danger   { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-lg  { padding: .7rem 1.5rem; font-size: 1rem; }
.btn-sm  { padding: .3rem .75rem; font-size: .8rem; }
.btn-full{ width: 100%; justify-content: center; }

/* ── Hero / Search ── */
.hero {
  text-align: center;
  padding: 3.5rem 1.5rem 2.5rem;
  background: linear-gradient(135deg, #1a56db 0%, #2563eb 100%);
  color: #fff;
  border-radius: var(--radius);
  margin-bottom: 2.5rem;
}
.hero h1 { font-size: 2rem; font-weight: 800; margin-bottom: .5rem; }
.hero p  { font-size: 1.05rem; opacity: .9; margin-bottom: 1.5rem; }
.search-form {
  display: flex;
  gap: .75rem;
  max-width: 560px;
  margin: 0 auto;
}
.search-form input {
  flex: 1;
  padding: .65rem 1rem;
  border-radius: var(--radius);
  border: none;
  font-size: 1rem;
}
.search-form input:focus { outline: 2px solid rgba(255,255,255,.6); }

.section-title { font-size: 1.25rem; font-weight: 700; margin-bottom: 1.25rem; color: var(--gray-700); }

/* ── Property Grid ── */
.property-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}
.property-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: box-shadow .2s;
}
.property-card:hover { box-shadow: var(--shadow-md); }
.property-card-body { padding: 1.25rem; flex: 1; }
.property-card-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--gray-100); }

.property-price { font-size: 1.4rem; font-weight: 800; color: var(--brand); }
.property-address { font-size: 1rem; font-weight: 600; margin: .25rem 0; }
.property-location { color: var(--gray-500); font-size: .875rem; }
.property-meta { display: flex; gap: .75rem; flex-wrap: wrap; margin: .75rem 0; font-size: .8rem; color: var(--gray-600); }
.deadline { font-size: .8rem; color: var(--warning); font-weight: 600; margin-top: .5rem; }
.offer-count { font-size: .8rem; color: var(--gray-500); margin-top: .25rem; }

/* ── Property Detail ── */
.breadcrumb { margin-bottom: 1.5rem; }
.breadcrumb a { color: var(--gray-500); font-size: .875rem; }
.property-detail { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow); }
.property-detail-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.property-detail-header h1 { font-size: 1.6rem; font-weight: 800; }
.property-location-lg { color: var(--gray-500); font-size: 1rem; margin-top: .25rem; }
.price-badge { font-size: 1.6rem; font-weight: 800; color: var(--brand); white-space: nowrap; }
.property-detail-meta { display: flex; gap: 1.5rem; flex-wrap: wrap; padding: 1.25rem 0; border-top: 1px solid var(--gray-100); border-bottom: 1px solid var(--gray-100); margin-bottom: 1.5rem; }
.meta-item { display: flex; flex-direction: column; }
.meta-label { font-size: .75rem; color: var(--gray-500); text-transform: uppercase; letter-spacing: .05em; }
.meta-val { font-size: 1rem; font-weight: 700; }
.property-description { margin: 1.5rem 0; }
.property-description h2 { font-size: 1.05rem; font-weight: 700; margin-bottom: .5rem; }
.deadline-banner { background: #fef3c7; color: #92400e; padding: .75rem 1.25rem; border-radius: var(--radius); margin: 1.5rem 0; font-size: .9rem; }
.cta-box { background: var(--brand-light); border: 1px solid #bfdbfe; border-radius: var(--radius); padding: 1.75rem; text-align: center; margin-top: 2rem; }
.cta-box h2 { margin-bottom: .5rem; }
.cta-box p { color: var(--gray-600); margin-bottom: 1.25rem; font-size: .9rem; }

/* ── Forms ── */
.page-title { font-size: 1.75rem; font-weight: 800; margin-bottom: .25rem; }
.page-subtitle { color: var(--gray-600); margin-bottom: 2rem; }

.offer-form, .simple-form, .admin-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.form-section {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}
.form-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--brand);
  border-bottom: 1px solid var(--gray-100);
  padding-bottom: .6rem;
  margin-bottom: 1.25rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-size: .8rem;
}
.section-note { font-size: .8rem; color: var(--gray-500); margin-bottom: 1rem; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
.form-col-2 { grid-column: span 2; }
.form-col-3 { grid-column: span 3; }

.form-group { display: flex; flex-direction: column; gap: .35rem; }
.form-group label { font-size: .85rem; font-weight: 600; color: var(--gray-700); }
.req { color: var(--danger); }

input[type="text"], input[type="email"], input[type="tel"], input[type="number"],
input[type="date"], input[type="datetime-local"], input[type="password"],
select, textarea {
  padding: .55rem .85rem;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: .9rem;
  color: var(--gray-900);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(26,86,219,.12);
}
textarea { resize: vertical; font-family: inherit; }

.input-prefix { display: flex; align-items: center; }
.input-prefix span {
  background: var(--gray-100);
  border: 1.5px solid var(--gray-300);
  border-right: none;
  padding: .55rem .75rem;
  border-radius: var(--radius) 0 0 var(--radius);
  font-size: .9rem;
  color: var(--gray-500);
  font-weight: 600;
}
.input-prefix input {
  border-radius: 0 var(--radius) var(--radius) 0;
  flex: 1;
}

input[type="file"] {
  padding: .4rem .6rem;
  font-size: .85rem;
  background: var(--gray-50);
  cursor: pointer;
}

.checkbox-label { display: flex; align-items: center; gap: .5rem; font-size: .9rem; font-weight: 600; cursor: pointer; }
.checkbox-label input[type="checkbox"] { width: auto; }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  padding: 1.25rem 0;
}

/* ── Confirmation ── */
.confirmation-box {
  max-width: 560px;
  margin: 3rem auto;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 2.5rem;
  text-align: center;
  box-shadow: var(--shadow-md);
}
.confirmation-icon { font-size: 3rem; margin-bottom: 1rem; }
.confirmation-box h1 { font-size: 1.75rem; font-weight: 800; margin-bottom: .5rem; }
.confirmation-box p { color: var(--gray-600); margin-bottom: 1.5rem; }
.confirmation-detail {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1.5rem 0;
  text-align: left;
}
.conf-row { display: flex; justify-content: space-between; align-items: center; padding: .4rem 0; border-bottom: 1px solid var(--gray-100); font-size: .875rem; }
.conf-row:last-child { border-bottom: none; }
.conf-note { font-size: .85rem; color: var(--gray-600); margin: 1rem 0; }
.conf-actions { display: flex; gap: 1rem; justify-content: center; margin-top: 1.5rem; }

.saved-file-note {
  font-size: .8rem;
  color: var(--success);
  margin-bottom: .35rem;
}

/* ── Offer Review ── */
.review-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1.5rem;
  align-items: start;
}
.review-sections { display: flex; flex-direction: column; gap: 1.25rem; }
.review-sidebar { position: sticky; top: 1.5rem; }

.review-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
}
.review-card h2 {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--brand);
  margin-bottom: .85rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--gray-100);
}
.review-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.review-table th { color: var(--gray-500); font-weight: 600; padding: .4rem .5rem .4rem 0; width: 42%; vertical-align: top; }
.review-table td { padding: .4rem 0; border-bottom: 1px solid var(--gray-100); }
.review-table tr:last-child td { border-bottom: none; }
.review-highlight { font-weight: 800; font-size: 1.05rem; color: var(--brand); }

.review-confirm-card {
  background: #fff;
  border: 2px solid var(--brand);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}
.review-confirm-card h2 { font-size: 1rem; font-weight: 800; margin-bottom: .5rem; }
.review-confirm-card p { font-size: .875rem; color: var(--gray-600); margin-bottom: 1.25rem; }

.review-summary {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  margin-bottom: 1.25rem;
}
.review-sum-row {
  display: flex;
  justify-content: space-between;
  font-size: .85rem;
  padding: .3rem 0;
  border-bottom: 1px solid var(--gray-100);
}
.review-sum-row:last-child { border-bottom: none; }
.review-sum-row span { color: var(--gray-500); }

@media (max-width: 768px) {
  .review-grid { grid-template-columns: 1fr; }
  .review-sidebar { position: static; }
}

/* ── Lookup Divider ── */
.lookup-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
  color: var(--gray-400);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.lookup-divider::before,
.lookup-divider::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--gray-200);
}

/* ── My Offer / Track ── */
.track-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1.5rem;
  align-items: start;
}
.track-sidebar { position: sticky; top: 1.5rem; }
.track-empty {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--gray-400);
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

@media (max-width: 768px) {
  .track-layout { grid-template-columns: 1fr; }
  .track-sidebar { position: static; }
}


.simple-form {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
  gap: 1rem;
}
.offer-status-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}
.offer-status-card h2 { margin-bottom: .25rem; }
.status-row { display: flex; align-items: center; gap: 1rem; margin: 1rem 0; }
.submitted-date { font-size: .85rem; color: var(--gray-500); }
.offer-summary-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.offer-summary-table th, .offer-summary-table td { padding: .45rem .75rem; text-align: left; border-bottom: 1px solid var(--gray-100); font-size: .875rem; }
.offer-summary-table th { color: var(--gray-500); font-weight: 600; width: 40%; }

/* ── Status Badges ── */
.status-badge {
  display: inline-block;
  padding: .2rem .65rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.status-lg { font-size: .9rem; padding: .35rem 1rem; }
.status-pending   { background: #fef3c7; color: #92400e; }
.status-accepted  { background: #dcfce7; color: #15803d; }
.status-backup    { background: #ede9fe; color: #6d28d9; }
.status-rejected  { background: #fee2e2; color: #b91c1c; }
.status-countered { background: #e0f2fe; color: #0369a1; }
.status-withdrawn { background: var(--gray-100); color: var(--gray-500); }
.status-active      { background: #dcfce7; color: #15803d; }
.status-contingent  { background: #fef3c7; color: #92400e; }
.status-sold        { background: var(--gray-100); color: var(--gray-500); }

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--gray-500);
}
.empty-state p { font-size: 1rem; margin-bottom: 1rem; }

/* ── Login ── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
}
.login-box {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-md);
}
.login-box h1 { font-size: 1.5rem; font-weight: 800; margin-bottom: .25rem; }
.login-subtitle { color: var(--gray-500); margin-bottom: 1.5rem; }
.login-box .form-group { margin-bottom: 1rem; display: flex; flex-direction: column; gap: .35rem; }
.login-box label { font-size: .85rem; font-weight: 600; }

/* ── Admin Layout ── */
.admin-body { background: var(--gray-100); }
.admin-layout { display: flex; min-height: 100vh; }

.admin-sidebar {
  width: 220px;
  background: var(--gray-900);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
}
.sidebar-brand {
  padding: 1.5rem 1.25rem;
  font-size: 1rem;
  font-weight: 800;
  border-bottom: 1px solid rgba(255,255,255,.1);
  line-height: 1.4;
}
.sidebar-brand small { font-size: .75rem; font-weight: 400; opacity: .6; }
.sidebar-nav { flex: 1; padding: 1rem 0; }
.sidebar-nav a {
  display: block;
  padding: .65rem 1.25rem;
  color: rgba(255,255,255,.75);
  font-size: .875rem;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
  background: rgba(255,255,255,.1);
  color: #fff;
  text-decoration: none;
}
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.1);
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.sidebar-footer a { color: rgba(255,255,255,.55); font-size: .8rem; }
.sidebar-footer a:hover { color: #fff; text-decoration: none; }

.admin-main {
  margin-left: 220px;
  flex: 1;
  padding: 2rem;
  min-height: 100vh;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.admin-header h1 { font-size: 1.5rem; font-weight: 800; }

/* ── Stat Cards ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
}
.stat-highlight { border-left: 4px solid var(--brand); }
.stat-value { font-size: 2rem; font-weight: 800; color: var(--gray-900); }
.stat-highlight .stat-value { color: var(--brand); }
.stat-label { font-size: .8rem; color: var(--gray-500); text-transform: uppercase; letter-spacing: .05em; margin-top: .25rem; }

/* ── Admin Tables ── */
.admin-section { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.section-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.5rem; border-bottom: 1px solid var(--gray-100); }
.section-header h2 { font-size: 1rem; font-weight: 700; }

.admin-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.admin-table th {
  background: var(--gray-50);
  color: var(--gray-500);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: .65rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
}
.admin-table td { padding: .75rem 1rem; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.admin-table tbody tr:hover { background: var(--gray-50); }
.admin-table tbody tr:last-child td { border-bottom: none; }
.row-pending { background: #fffbeb !important; }
.action-cell { white-space: nowrap; display: flex; gap: .5rem; }

/* ── Filter Bar ── */
.filter-bar {
  display: flex;
  gap: .75rem;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.filter-bar select { width: auto; padding: .45rem .75rem; font-size: .85rem; }

/* ── Admin Form ── */
.admin-form .form-section { margin-bottom: 1.25rem; }

/* ── Offer Detail ── */
.offer-detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: 1.5rem; align-items: start; }
.offer-detail-main { display: flex; flex-direction: column; gap: 1.25rem; }
.offer-detail-sidebar { display: flex; flex-direction: column; gap: 1.25rem; position: sticky; top: 1.5rem; }

.detail-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
}
.detail-card h2 { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-500); margin-bottom: .85rem; }
.detail-address { font-size: 1.1rem; font-weight: 700; margin-bottom: .25rem; }

.detail-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.detail-table th { color: var(--gray-500); font-weight: 600; padding: .4rem .5rem .4rem 0; width: 45%; vertical-align: top; }
.detail-table td { padding: .4rem 0; border-bottom: 1px solid var(--gray-100); }
.detail-table tr:last-child td { border-bottom: none; }
.highlight-val { font-weight: 700; font-size: 1rem; }

.status-card .current-status { margin: .75rem 0; }
.text-muted { color: var(--gray-500); font-size: .85rem; }
.text-green { color: var(--success); font-weight: 700; }
.text-red   { color: var(--danger); font-weight: 700; }

.doc-list { list-style: none; display: flex; flex-direction: column; gap: .5rem; }
.doc-list li { display: flex; align-items: center; gap: .75rem; font-size: .875rem; }
.doc-list a { color: var(--brand); }
.doc-type-badge {
  background: var(--gray-100);
  color: var(--gray-600);
  padding: .15rem .5rem;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 600;
}

/* ── Offer History ── */
.history-list { display: flex; flex-direction: column; gap: 0; }
.history-entry {
  padding: .75rem 0;
  border-bottom: 1px solid var(--gray-100);
}
.history-entry:last-child { border-bottom: none; }
.history-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: .25rem;
}
.history-date { font-size: .75rem; color: var(--gray-400); }
.history-notes {
  font-size: .8rem;
  color: var(--gray-600);
  background: var(--gray-50);
  border-left: 3px solid var(--gray-300);
  padding: .4rem .65rem;
  border-radius: 0 4px 4px 0;
  margin-top: .35rem;
  white-space: pre-wrap;
}

/* ── Email Templates ── */
.trigger-badge {
  display: inline-block;
  background: var(--gray-100);
  color: var(--gray-600);
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  padding: .2rem .65rem;
  font-size: .75rem;
  font-weight: 600;
}

.tpl-edit-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.5rem;
  align-items: start;
}

.tpl-variables { position: sticky; top: 1.5rem; }

.var-row {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  padding: .45rem .5rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background .12s;
  border-bottom: 1px solid var(--gray-100);
}
.var-row:last-of-type { border-bottom: none; }
.var-row:hover { background: var(--brand-light); }
.var-code { font-size: .75rem; color: var(--brand); font-weight: 600; }
.var-desc { font-size: .72rem; color: var(--gray-500); }

.copy-toast {
  margin-top: .5rem;
  background: var(--success);
  color: #fff;
  text-align: center;
  padding: .3rem;
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 700;
}

/* ── Offer Ranking ── */
.rank-banner {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background: var(--brand-light);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  font-size: .875rem;
}
.rank-banner-icon { font-size: 1.5rem; line-height: 1; }

.rank-cards { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 2rem; }

.rank-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.rank-card-top {
  border: 2px solid var(--success);
  box-shadow: 0 0 0 3px rgba(22,163,74,.1), var(--shadow-md);
}

.rank-card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .85rem 1.25rem;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}
.rank-card-top .rank-card-header { background: #f0fdf4; border-bottom-color: #bbf7d0; }
.rank-position { font-size: 1.5rem; line-height: 1; width: 2rem; text-align: center; }
.rank-card-id { flex: 1; display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: .9rem; flex-wrap: wrap; }

.backup-badge {
  display: inline-block;
  background: #f3e8ff;
  color: #7e22ce;
  border: 1px solid #d8b4fe;
  font-size: .7rem;
  font-weight: 700;
  padding: .2rem .6rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.recommended-badge {
  background: var(--success);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  padding: .2rem .6rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.rank-score-circle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 800;
  flex-shrink: 0;
  border: 3px solid;
}
.score-high  { color: var(--success); border-color: var(--success); background: #f0fdf4; }
.score-mid   { color: var(--warning); border-color: var(--warning); background: #fffbeb; }
.score-low   { color: var(--danger);  border-color: var(--danger);  background: #fef2f2; }

.rank-card-body {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 1.25rem;
  padding: 1.25rem;
}
.rank-key-facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: .75rem;
}
.rank-fact { display: flex; flex-direction: column; gap: .15rem; }
.rank-fact-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-500); font-weight: 600; }
.rank-fact-val { font-size: .95rem; font-weight: 700; color: var(--gray-900); }
.rank-net { color: var(--success) !important; }

.rank-score-breakdown {
  border-left: 1px solid var(--gray-200);
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
.score-factor { display: flex; align-items: center; gap: .5rem; font-size: .78rem; }
.score-factor-name { width: 110px; color: var(--gray-600); flex-shrink: 0; }
.score-factor-bar-wrap { flex: 1; background: var(--gray-100); border-radius: 999px; height: 6px; overflow: hidden; }
.score-factor-bar { height: 6px; background: var(--brand); border-radius: 999px; min-width: 4px; }
.score-factor-bar.bar-negative { background: var(--danger); }
.score-factor-pts { width: 28px; text-align: right; font-weight: 700; color: var(--gray-700); flex-shrink: 0; }

.rank-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1.25rem;
  border-top: 1px solid var(--gray-100);
  background: var(--gray-50);
  font-size: .85rem;
  color: var(--gray-600);
  gap: 1rem;
  flex-wrap: wrap;
}

.section-divider {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray-500);
  margin: 1.5rem 0 .75rem;
  border-bottom: 1px solid var(--gray-200);
  padding-bottom: .5rem;
}

/* ── Property Photos ── */
.property-card-photo {
  width: 100%;
  height: 200px;
  overflow: hidden;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--gray-100);
}
.property-card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .3s;
}
.property-card:hover .property-card-photo img { transform: scale(1.03); }

.photo-gallery { margin-bottom: 1.5rem; }
.photo-gallery-main {
  width: 100%;
  height: 400px;
  background: var(--gray-100);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: .5rem;
}
.photo-gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity .2s;
}
.photo-gallery-thumbs {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}
.photo-gallery-thumbs img {
  width: 80px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  cursor: pointer;
  border: 2px solid transparent;
  opacity: .7;
  transition: opacity .15s, border-color .15s;
}
.photo-gallery-thumbs img:hover { opacity: 1; }
.photo-gallery-thumbs img.active-thumb { border-color: var(--brand); opacity: 1; }

/* Admin photo grid */
.photo-grid {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}
.photo-thumb {
  position: relative;
  width: 140px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--gray-100);
}
.photo-thumb.photo-primary { border-color: var(--brand); }
.photo-thumb img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  display: block;
}
.primary-badge {
  position: absolute;
  top: .35rem;
  left: .35rem;
  background: var(--brand);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  padding: .15rem .45rem;
  border-radius: 999px;
  text-transform: uppercase;
}
.photo-actions {
  display: flex;
  gap: .35rem;
  padding: .4rem;
  background: rgba(0,0,0,.03);
  border-top: 1px solid var(--gray-200);
  flex-wrap: wrap;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .form-col-2, .form-col-3 { grid-column: span 1; }
  .property-detail-header { flex-direction: column; }
  .offer-detail-grid { grid-template-columns: 1fr; }
  .offer-detail-sidebar { position: static; }
  .admin-sidebar { width: 180px; }
  .admin-main { margin-left: 180px; padding: 1rem; }
  .search-form { flex-direction: column; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 540px) {
  .admin-layout { flex-direction: column; }
  .admin-sidebar { width: 100%; position: relative; }
  .admin-main { margin-left: 0; }
}
