/* Lead Offers — paste-import + AI valuation + offer text page */

:root {
  --primary: #2563eb;
  --primary-light: #eff6ff;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --success-light: #f0fdf4;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --info: #0891b2;
  --info-light: #ecfeff;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --border: #e2e8f0;
  --border-subtle: #f1f5f9;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 25px -3px rgba(0,0,0,.08), 0 4px 6px -2px rgba(0,0,0,.04);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --transition: 0.2s ease;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 14px;
}

/* ── Navigation (matches market-explorer.css) ─────────────────────────────── */
.top-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: var(--shadow-sm);
}
.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 2rem;
}
.nav-logo { flex-shrink: 0; }
.nav-links { display: flex; gap: 0.25rem; flex: 1; flex-wrap: wrap; }
.nav-link {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  font-size: 0.875rem;
  white-space: nowrap;
}
.nav-link:hover { color: var(--primary); background: var(--primary-light); }
.nav-link.active { color: var(--primary); background: var(--primary-light); font-weight: 600; }
.nav-actions { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.4rem 0.875rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  font-family: inherit;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--surface); border: 1px solid var(--border); color: var(--text-muted); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #b45309; }
.btn-sm { padding: 0.3rem 0.625rem; font-size: 0.75rem; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ── Page wrapper ──────────────────────────────────────────────────────────── */
.lo-page-wrapper {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* ── Top bar ───────────────────────────────────────────────────────────────── */
.lo-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}
.lo-title { font-size: 1.375rem; font-weight: 700; }
.lo-subtitle { color: var(--text-muted); font-size: 0.875rem; margin-top: 0.25rem; }

.lo-controls-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.lo-slider-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.lo-slider-group label { font-size: 0.8125rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.lo-slider-group input[type="range"] { width: 140px; }
.lo-slider-value { font-size: 0.8125rem; font-weight: 700; color: var(--primary); min-width: 2.5rem; }

.lo-quota-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}
.lo-quota-badge {
  font-size: 0.8125rem;
  color: var(--text-muted);
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.75rem;
}
.lo-quota-badge.lo-quota-low { color: var(--warning); background: var(--warning-light); font-weight: 600; }
.lo-quota-badge.lo-quota-trial { color: var(--info); background: var(--info-light); font-weight: 600; }

/* ── Batch strip ───────────────────────────────────────────────────────────── */
.lo-batch-strip {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin-bottom: 1.25rem;
}
.lo-batch-strip-empty {
  color: var(--text-light);
  font-size: 0.8125rem;
  padding: 0.75rem;
}
.lo-batch-card {
  flex: 0 0 auto;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  box-shadow: var(--shadow-sm);
}
.lo-batch-card-title {
  font-weight: 600;
  font-size: 0.8125rem;
  margin-bottom: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lo-batch-card-meta { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.4rem; }
.lo-batch-progress-track {
  height: 6px;
  border-radius: 3px;
  background: var(--border-subtle);
  overflow: hidden;
  margin-bottom: 0.4rem;
}
.lo-batch-progress-fill { height: 100%; background: var(--primary); transition: width var(--transition); }
.lo-batch-status {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
}
.lo-batch-status.status-preview { background: var(--info-light); color: var(--info); }
.lo-batch-status.status-processing { background: var(--warning-light); color: var(--warning); }
.lo-batch-status.status-complete { background: var(--success-light); color: var(--success); }
.lo-batch-status.status-partial { background: var(--warning-light); color: var(--warning); }
.lo-batch-status.status-error { background: var(--danger-light); color: var(--danger); }
.lo-batch-resume-btn { margin-top: 0.4rem; width: 100%; justify-content: center; }

/* ── Preview area ──────────────────────────────────────────────────────────── */
.lo-preview-area {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.lo-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.lo-preview-header h3 { font-size: 1rem; font-weight: 700; }
.lo-preview-quota-line { font-size: 0.8125rem; color: var(--text-muted); }

.lo-preview-table-wrap { overflow-x: auto; }
.lo-preview-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.lo-preview-table th {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 2px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}
.lo-preview-table td {
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}
.lo-preview-table td[contenteditable="true"] {
  min-width: 90px;
  border-radius: var(--radius-sm);
  cursor: text;
}
.lo-preview-table td[contenteditable="true"]:focus {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
  background: var(--primary-light);
}
.lo-dup-badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 700;
  background: var(--warning-light);
  color: var(--warning);
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  margin-left: 0.35rem;
  white-space: nowrap;
}
.lo-optout-badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 700;
  background: var(--danger-light);
  color: var(--danger);
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  margin-left: 0.35rem;
  white-space: nowrap;
}

.lo-unparsed-section { margin-top: 1rem; }
.lo-unparsed-section h4 { font-size: 0.875rem; margin-bottom: 0.5rem; }
.lo-unparsed-block { margin-bottom: 0.5rem; }
.lo-unparsed-block textarea {
  width: 100%;
  min-height: 60px;
  font-family: inherit;
  font-size: 0.8125rem;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  resize: vertical;
}

.lo-preview-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1rem;
}

/* ── Leads table (Task 11) ─────────────────────────────────────────────────── */
.lo-leads-table-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  min-height: 120px;
  box-shadow: var(--shadow-sm);
}
.lo-leads-table-placeholder { color: var(--text-light); font-size: 0.875rem; padding: 0.5rem 0; }

.lo-filters-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}
.lo-filter-ready {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}
.lo-filter-select {
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
}
.lo-export-area {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-left: auto;
}
.lo-export-marksent {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.lo-leads-table-wrap { overflow-x: auto; }
.lo-leads-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.lo-leads-table th {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 2px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}
.lo-leads-table td {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}
.lo-address-cell {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lo-leads-table-count {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 0.75rem;
}

.lo-chip {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  white-space: nowrap;
  text-transform: capitalize;
}
.lo-chip-land { background: var(--success-light); color: var(--success); }
.lo-chip-house { background: var(--primary-light); color: var(--primary); }
.lo-chip-unknown { background: var(--border-subtle); color: var(--text-muted); }
.lo-chip-conf-high { background: var(--success-light); color: var(--success); margin-left: 0.35rem; }
.lo-chip-conf-medium { background: var(--warning-light); color: var(--warning); margin-left: 0.35rem; }
.lo-chip-conf-low { background: var(--danger-light); color: var(--danger); margin-left: 0.35rem; }
.lo-chip-recommend { background: var(--warning-light); color: var(--warning); margin-left: 0.35rem; border: 1px solid var(--warning); }
.lo-analysis-status-label { color: var(--text-light); font-style: italic; }

/* AI deep-analysis "recommended" button highlight (tier-1 flagged the value unreliable). */
.lo-deep-recommended { box-shadow: 0 0 0 2px var(--warning-light); }

/* Completed AI land appraisal panel (expanded row). */
.lo-ai-appraisal { border-left: 3px solid var(--primary); padding-left: 0.6rem; }
.lo-ai-value { font-size: 1.05rem; font-weight: 700; color: var(--text); }
.lo-ai-range { font-size: 0.8125rem; font-weight: 500; color: var(--text-muted); }
.lo-ai-reasoning { margin-top: 0.3rem; font-size: 0.8125rem; color: var(--text); }
.lo-ai-gaps { margin-top: 0.3rem; font-size: 0.75rem; color: var(--text-muted); }
.lo-ai-comps { margin-top: 0.4rem; font-size: 0.75rem; color: var(--text-muted); }
.lo-ai-comps-label { font-weight: 600; }
.lo-ai-comps ul { margin: 0.2rem 0 0; padding-left: 1.1rem; }
.lo-ai-comps li { margin-bottom: 0.1rem; }
.lo-ai-note { font-style: italic; color: var(--text-light); }

.lo-offer-input {
  width: 110px;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-family: inherit;
}
.lo-offer-input:focus { outline: 2px solid var(--primary); outline-offset: -1px; }

.lo-status-select {
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-family: inherit;
  background: var(--surface);
}

.lo-actions-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.lo-copy-done { background: var(--success-light) !important; color: var(--success) !important; }

.lo-expand-row td { background: var(--bg); border-bottom: 2px solid var(--border); }
.lo-expand-content {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 0.5rem 0.25rem;
}
.lo-expand-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}
.lo-expand-notes {
  font-size: 0.8125rem;
  white-space: pre-wrap;
  max-width: 640px;
}
.lo-offer-textarea {
  width: 100%;
  max-width: 640px;
  font-family: inherit;
  font-size: 0.8125rem;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  resize: vertical;
}
.lo-expand-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.lo-inline-input-row { display: flex; gap: 0.5rem; align-items: center; }
.lo-inline-input-row input[type="number"] {
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-family: inherit;
  width: 160px;
}

/* ── Paste modal ───────────────────────────────────────────────────────────── */
.lo-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.lo-modal.show { display: flex; }
.lo-modal-content {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
}
.lo-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.lo-modal-header h2 { font-size: 1.125rem; font-weight: 700; }
.lo-modal-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}
.lo-modal-close:hover { color: var(--text); }
.lo-modal-body { padding: 1.25rem; }
.lo-form-group { margin-bottom: 1rem; }
.lo-form-group label { display: block; font-size: 0.8125rem; font-weight: 600; margin-bottom: 0.35rem; color: var(--text-muted); }
.lo-form-group input[type="text"],
.lo-form-group input[type="file"],
.lo-form-group textarea {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-family: inherit;
}
.lo-form-group textarea { resize: vertical; }
.lo-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
}
.lo-error-text { color: var(--danger); font-size: 0.8125rem; margin-top: 0.5rem; }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .lo-page-wrapper { padding: 1rem; }
  .nav-links { display: none; }
  .lo-quota-area { margin-left: 0; }
  .lo-export-area { margin-left: 0; }
}
