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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: #1f2937;
  background-color: #f3f4f6;
}

a {
  color: #6ABF4B;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* Navbar */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: #1e293b;
  color: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  position: relative;
  z-index: 100;
}
.navbar-admin {
  background: #312e81;
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 1.125rem;
  font-weight: 600;
}
.navbar-brand-logo {
  height: 32px;
  max-width: 160px;
  flex-shrink: 0;
  object-fit: contain;
}
.navbar-logo {
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.625rem;
}
.navbar-logo:hover {
  text-decoration: none;
  opacity: 0.9;
}
.navbar-logo-divider {
  font-weight: 300;
  opacity: 0.4;
  font-size: 1.25rem;
}
.navbar-logo-app {
  font-weight: 600;
}
.navbar-logo-brand {
  display: none;
}
.navbar-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.nav-link {
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.875rem;
}
.nav-link:hover {
  color: #fff;
  text-decoration: none;
}
.nav-user {
  color: #94a3b8;
  font-size: 0.8125rem;
}
.btn-link {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  padding: 0;
}

/* =============================================
   SIDEBAR & APP LAYOUT
   ============================================= */
.app-layout {
  display: flex;
  min-height: calc(100vh - 49px); /* viewport minus navbar height */
}

/* Sidebar */
.sidebar {
  display: flex;
  flex-direction: column;
  background: #1e293b;
  border-right: 1px solid #334155;
  transition: width 0.2s ease;
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar--expanded {
  width: 220px;
}
html.sb-collapsed .sidebar--expanded {
  width: 56px;
}
.sidebar--collapsed {
  width: 56px;
}

/* Toggle button */
.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.75rem;
  background: none;
  border: none;
  border-bottom: 1px solid #334155;
  cursor: pointer;
  color: #94a3b8;
  transition: color 0.15s, background 0.15s;
}
.sidebar-toggle:hover {
  color: #fff;
  background: #334155;
}
.sidebar-toggle-icon {
  flex-shrink: 0;
}

/* Navigation links */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0;
  flex: 1;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
  overflow: hidden;
  border-left: 3px solid transparent;
}
.sidebar-link:hover {
  color: #fff;
  background: #334155;
  text-decoration: none;
}
.sidebar-link--active {
  color: #6ABF4B;
  background: rgba(106, 191, 75, 0.08);
  border-left-color: #6ABF4B;
}
.sidebar-link--active:hover {
  color: #6ABF4B;
  background: rgba(106, 191, 75, 0.12);
}

/* Icon sizing */
.sidebar-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}
.sidebar-icon-wrapper {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

/* Unread badge on icon */
.sidebar-badge {
  position: absolute;
  top: -4px;
  right: -6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 0.5625rem;
  font-weight: 700;
  line-height: 1;
}

/* Labels (hidden when collapsed) */
.sidebar-label {
  transition: opacity 0.2s ease;
  overflow: hidden;
}
.sidebar--collapsed .sidebar-label {
  opacity: 0;
  width: 0;
}
.sidebar--expanded .sidebar-label {
  opacity: 1;
}

/* Collapsed state - center icons */
.sidebar--collapsed .sidebar-link {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
  border-left-width: 0;
  gap: 0;
}
.sidebar--collapsed .sidebar-toggle {
  padding-left: 0;
  padding-right: 0;
}

/* Bottom section (Admin link) */
.sidebar-bottom {
  border-top: 1px solid #334155;
  padding: 0.5rem 0;
  margin-top: auto;
}

/* Tooltip on collapsed sidebar */
.sidebar--collapsed .sidebar-link {
  position: relative;
}
.sidebar--collapsed .sidebar-link::after {
  content: attr(title);
  display: none;
}
.sidebar--collapsed .sidebar-link:hover .sidebar-label {
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  opacity: 1;
  width: auto;
  background: #1e293b;
  color: #fff;
  padding: 0.375rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  margin-left: 8px;
  z-index: 200;
  pointer-events: none;
}

/* Main content area */
.app-main {
  flex: 1;
  min-width: 0;
  overflow-x: hidden;
}

/* Container */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
}

/* Flash Messages */
.flash {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}
.flash-notice {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}
.flash-alert {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background 0.15s;
}
.btn:hover {
  text-decoration: none;
}
.btn-primary {
  background: #6ABF4B;
  color: #fff;
}
.btn-primary:hover {
  background: #5AA637;
}
.btn-secondary {
  background: #e5e7eb;
  color: #374151;
}
.btn-secondary:hover {
  background: #d1d5db;
}
.btn-danger {
  background: #dc2626;
  color: #fff;
}
.btn-danger:hover {
  background: #b91c1c;
}
.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

/* Page Header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.page-header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Data Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.data-table thead {
  background: #f8fafc;
}
.data-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid #e2e8f0;
}
.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.875rem;
}
.data-table tbody tr:hover {
  background: #f8fafc;
}
.table-wrapper {
  overflow-x: auto;
}

/* Change indicators */
.change-positive {
  color: #059669;
}
.change-negative {
  color: #dc2626;
}
.change-neutral {
  color: #6b7280;
}

/* Outlier indicator for anomalous data weeks */
.outlier-row {
  background: #fffbeb;
}
.outlier-flag {
  color: #d97706;
  font-size: 1rem;
  text-align: center;
  cursor: help;
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}
.status-pending {
  background: #fef3c7;
  color: #92400e;
}
.status-mapping {
  background: #e0e7ff;
  color: #3730a3;
}
.status-processing {
  background: #dbeafe;
  color: #1e40af;
}
.status-completed {
  background: #d1fae5;
  color: #065f46;
}
.status-failed {
  background: #fee2e2;
  color: #991b1b;
}
.status-cancelled {
  background: #fef3c7;
  color: #92400e;
}
.role-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}
.role-admin {
  background: #ede9fe;
  color: #5b21b6;
}
.role-user {
  background: #e0e7ff;
  color: #3730a3;
}

/* Become User button */
.btn-become {
  background: #7c3aed;
  color: #fff;
}
.btn-become:hover {
  background: #6d28d9;
}

/* Become User modal */
.become-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.become-modal {
  background: #fff;
  border-radius: 12px;
  padding: 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}
.become-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.become-modal-header h3 {
  margin: 0;
  font-size: 1.125rem;
  color: #1e293b;
}
.become-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #94a3b8;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}
.become-modal-close:hover {
  color: #475569;
}
.become-modal-desc {
  font-size: 0.875rem;
  color: #475569;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}
.become-modal-field {
  margin-bottom: 1.25rem;
}
.become-modal-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  margin-bottom: 0.375rem;
}
.become-modal-input {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 2px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.875rem;
  box-sizing: border-box;
}
.become-modal-input:focus {
  outline: none;
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}
.become-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Impersonation banner */
.impersonation-banner {
  background: #7c3aed;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  z-index: 100;
}
.impersonation-return-btn {
  background: #fff;
  color: #7c3aed;
  font-weight: 600;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.impersonation-return-btn:hover {
  background: #ede9fe;
}

/* Cards */
.chart-card, .data-table-card, .form-card, .import-details {
  background: #fff;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin-bottom: 1.5rem;
}
.chart-card.compact {
  padding: 0.75rem 1rem;
  margin-bottom: 0;
}
.chart-card h3, .data-table-card h3 {
  margin-bottom: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #374151;
}
.chart-wrapper {
  position: relative;
  height: 260px;
}

/* Timeline Selector */
.timeline-selector {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
}
.timeline-btn {
  padding: 0.375rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #64748b;
  background: #f1f5f9;
  text-decoration: none;
  transition: all 0.15s;
}
.timeline-btn:hover {
  background: #e2e8f0;
  color: #334155;
  text-decoration: none;
}
.timeline-btn.active {
  background: #6ABF4B;
  color: #fff;
}

/* Market Report Cards */
.market-reports {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  align-items: flex-start;
}
.market-report-card {
  background: #fff;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  flex: 1 1 0;
  min-width: 0;
  max-width: 380px;
}
.report-header {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  min-height: 2.5rem;
}
.report-geo-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 0.2rem;
}
.report-geo-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
  line-height: 1.3;
}
/* Classification badges row */
.report-badges {
  display: flex;
  gap: 0.375rem;
  margin-bottom: 0.625rem;
  flex-wrap: wrap;
}
.report-badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.1875rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}
.report-market-sellers {
  background: #fef2f2;
  color: #dc2626;
}
.report-market-balanced {
  background: #fffbeb;
  color: #d97706;
}
.report-market-buyers {
  background: #f0fdf4;
  color: #16a34a;
}
.report-market-na {
  background: #f8fafc;
  color: #94a3b8;
}
.report-distress-low {
  background: #fef2f2;
  color: #dc2626;
}
.report-distress-moderate {
  background: #fffbeb;
  color: #d97706;
}
.report-distress-high {
  background: #f0fdf4;
  color: #16a34a;
}
.report-investor-low {
  background: #f0fdf4;
  color: #16a34a;
}
.report-investor-moderate {
  background: #fffbeb;
  color: #d97706;
}
.report-investor-high {
  background: #eff6ff;
  color: #2563eb;
}

/* Hero stat: prominent median price */
.report-hero {
  display: flex;
  align-items: baseline;
  gap: 0.375rem;
  margin-bottom: 0.125rem;
}
.report-hero-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.2;
}
.report-hero-label {
  font-size: 0.625rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

/* P25-P75 price range bar */
.report-price-range {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.6875rem;
  font-weight: 500;
  color: #475569;
  margin-bottom: 0.125rem;
}
.report-range-bar {
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, #cbd5e1, #94a3b8, #cbd5e1);
  border-radius: 1px;
}
.report-range-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.5625rem;
  color: #94a3b8;
  margin-bottom: 0.625rem;
}

/* Secondary hero (rent) - slightly smaller than sale price hero */
.report-hero-secondary {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid #f1f5f9;
}
.report-hero-secondary .report-hero-value {
  font-size: 1.1rem;
}

/* Rent range bar — teal accent to distinguish from sale price */
.report-range-bar-rent {
  background: linear-gradient(90deg, #99f6e4, #2dd4bf, #99f6e4);
}

/* Gross Rent Yield row */
.report-yield-row {
  margin-top: 0.375rem;
  padding: 0.375rem 0.5rem;
  background: #f0fdf4;
  border-radius: 6px;
  margin-bottom: 0.5rem;
}
.report-yield-label {
  font-size: 0.5625rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
  display: block;
}
.report-yield-values {
  display: flex;
  justify-content: space-between;
  gap: 0.25rem;
}
.report-yield-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #16a34a;
  line-height: 1.2;
}
.report-yield-item small {
  font-size: 0.5625rem;
  font-weight: 400;
  color: #94a3b8;
  text-transform: uppercase;
}
.report-yield-primary {
  font-size: 0.9375rem;
  font-weight: 700;
}

/* Compact stat grid */
.report-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.375rem;
  padding-top: 0.5rem;
  border-top: 1px solid #f1f5f9;
  margin-bottom: 0.25rem;
}
.report-grid-item {
  display: flex;
  flex-direction: column;
  gap: 0.0625rem;
}
.report-grid-value {
  font-size: 0.75rem;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
}
.report-grid-label {
  font-size: 0.5625rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

/* Trend indicators */
.trend-indicator {
  font-size: 0.6875rem;
  font-weight: 600;
  margin-left: 0.25rem;
  white-space: nowrap;
}
.trend-up {
  color: #16a34a;
}
.trend-down {
  color: #dc2626;
}
.trend-neutral {
  color: #6b7280;
}

.report-as-of {
  font-size: 0.625rem;
  color: #94a3b8;
  margin: 0.5rem 0 0;
  text-align: right;
}
/* Child geographies (MSA → Cities, City → Zips) */
.report-children {
  margin-top: 0.75rem;
  border-top: 1px solid #e2e8f0;
  padding-top: 0.5rem;
}
.report-children-toggle {
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  padding: 0.25rem 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}
.report-children-toggle::-webkit-details-marker {
  display: none;
}
.report-children-toggle::before {
  content: "\25B6";
  font-size: 0.5rem;
  transition: transform 0.15s;
}
details[open] > .report-children-toggle::before {
  transform: rotate(90deg);
}
.report-children-sort {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.375rem;
  padding-bottom: 0.25rem;
}
.report-sort-label {
  font-size: 0.5625rem;
  color: #94a3b8;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.03em;
  margin-right: 0.125rem;
}
.report-sort-btn {
  font-size: 0.625rem;
  font-weight: 600;
  padding: 0.125rem 0.375rem;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  background: #fff;
  color: #64748b;
  cursor: pointer;
  transition: all 0.1s;
}
.report-sort-btn:hover {
  border-color: #cbd5e1;
  color: #334155;
}
.report-sort-btn.active {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #1e293b;
}
.report-children-list {
  max-height: 200px;
  overflow-y: auto;
  margin-top: 0.375rem;
}
.report-child-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0;
  border-bottom: 1px solid #f1f5f9;
  gap: 0.375rem;
}
.report-child-row:last-child {
  border-bottom: none;
}
.report-child-name {
  font-size: 0.6875rem;
  color: #334155;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.report-child-pop {
  color: #94a3b8;
  font-size: 0.625rem;
  margin-left: 0.25rem;
  white-space: nowrap;
}
.report-child-actions {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-shrink: 0;
}
.report-child-badge {
  font-size: 0.5625rem;
  font-weight: 700;
  padding: 0.125rem 0.375rem;
  border-radius: 999px;
  flex-shrink: 0;
  text-align: center;
  min-width: 1.5rem;
}
.report-child-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border: 1px solid #cbd5e1;
  border-radius: 50%;
  background: #fff;
  color: #64748b;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: all 0.15s;
  flex-shrink: 0;
}
.report-child-add:hover {
  background: #6ABF4B;
  border-color: #6ABF4B;
  color: #fff;
}
.report-child-added {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  color: #059669;
  font-size: 0.6875rem;
  flex-shrink: 0;
}
@media (max-width: 768px) {
  .market-reports {
    flex-direction: column;
  }
  .market-report-card {
    max-width: 100%;
  }
  .report-header {
    min-height: auto;
  }
}

/* Charts Grid */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
@media (max-width: 768px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
  .chart-wrapper {
    height: 220px;
  }
}

/* Dashboard */
.dashboard-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

/* Centered search hero (no data state) */
.search-hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 200px);
}
.search-hero-title {
  font-size: 2rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 1.5rem;
  text-align: center;
}
.search-hero-subtitle {
  font-size: 0.9rem;
  color: #6b7280;
  margin-top: 0.75rem;
  text-align: center;
}
.search-box-centered {
  max-width: 500px;
  width: 100%;
}
.search-box-centered .search-input-wrapper {
  display: flex;
}
.search-box-centered input {
  font-size: 1rem;
  padding: 0.75rem 1rem;
}
.search-box-centered .search-btn {
  font-size: 1rem !important;
  padding: 0.75rem 1.25rem !important;
}

/* Selected Geographies */
.selected-geographies {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  width: 100%;
}
.geo-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  align-items: center;
  min-width: 0;
  flex: 1;
}
.geo-actions {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-shrink: 0;
  white-space: nowrap;
}
.geo-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.8125rem;
  background: #f8fafc;
  border: 2px solid;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.2s, background 0.2s;
  max-width: 220px;
}
.geo-chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.geo-chip:hover {
  background: #f1f5f9;
}
.geo-chip-inactive {
  opacity: 0.35;
  background: #f3f4f6;
}
.geo-chip-inactive:hover {
  opacity: 0.5;
}
.geo-chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.geo-chip-remove {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  color: #94a3b8;
  padding: 0 0.125rem;
}
.geo-chip-remove:hover {
  color: #dc2626;
}
.geo-chip-clear {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  color: #94a3b8;
  padding: 0.25rem 0.375rem;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.geo-chip-clear:hover {
  color: #dc2626;
  background: #fef2f2;
}
.geo-chip-limit {
  font-size: 0.75rem;
  color: #94a3b8;
  font-style: italic;
}
/* Max geography toast notification */
.max-geo-notice {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(1rem);
  background: #1e293b;
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.625rem 1.25rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 9999;
  pointer-events: none;
}
.max-geo-notice.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.table-geo-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.375rem;
}
.already-selected {
  opacity: 0.5;
}
.already-badge {
  margin-left: auto;
  font-size: 0.6875rem;
  color: #94a3b8;
}

/* Search */
.search-section {
  margin-bottom: 0;
}
.search-box {
  position: relative;
  min-width: 280px;
  max-width: 420px;
}
.search-box label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  margin-bottom: 0.125rem;
  color: #374151;
}
.search-input-wrapper {
  display: flex;
  gap: 0;
}
.search-box input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 2px solid #d1d5db;
  border-radius: 8px 0 0 8px;
  font-size: 0.8125rem;
  transition: border-color 0.15s;
}
.search-box input:focus {
  outline: none;
  border-color: #6ABF4B;
  box-shadow: 0 0 0 3px rgba(106, 191, 75, 0.15);
  z-index: 1;
}
.search-btn {
  border-radius: 0 8px 8px 0 !important;
  padding: 0.5rem 1rem !important;
  font-size: 0.8125rem !important;
  white-space: nowrap;
  border: 2px solid #6ABF4B;
  margin-left: -2px;
}
.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 50;
  max-height: 400px;
  overflow-y: auto;
  margin-top: 2px;
}
.search-group-header {
  padding: 0.375rem 0.875rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
}
.search-result-item {
  padding: 0.625rem 0.875rem;
  cursor: pointer;
  font-size: 0.875rem;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.search-result-item:hover,
.search-result-item.highlighted {
  background: #f0fdf0;
}
.search-result-item:last-child {
  border-bottom: none;
}
.geo-type-badge {
  display: inline-block;
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: #e0e7ff;
  color: #3730a3;
  flex-shrink: 0;
  min-width: 2.25rem;
  text-align: center;
}
.geo-type-msa {
  background: #ede9fe;
  color: #5b21b6;
}
.geo-type-city {
  background: #dbeafe;
  color: #1e40af;
}
.geo-type-county {
  background: #fef3c7;
  color: #92400e;
}
.geo-type-zip {
  background: #d1fae5;
  color: #065f46;
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}
.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
  color: #374151;
}
.form-control {
  width: 100%;
  max-width: 400px;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.875rem;
}
.form-control:focus {
  outline: none;
  border-color: #6ABF4B;
  box-shadow: 0 0 0 2px rgba(106, 191, 75, 0.15);
}
.form-hint {
  display: block;
  margin-top: 0.25rem;
  color: #6b7280;
  font-size: 0.75rem;
}
.form-actions {
  margin-top: 1.5rem;
  display: flex;
  gap: 0.75rem;
}
.form-errors {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: #991b1b;
}
.form-errors ul {
  margin: 0.5rem 0 0 1.25rem;
}

/* CSV Instructions */
.csv-instructions {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}
.csv-instructions h3 {
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}
.csv-instructions p {
  font-size: 0.8125rem;
  color: #374151;
  margin-bottom: 0.25rem;
}
.csv-instructions code {
  display: block;
  background: #fff;
  padding: 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  margin: 0.5rem 0;
  overflow-x: auto;
}

/* Import Details */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.detail-item {
  display: flex;
  flex-direction: column;
}
.detail-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

/* Progress Bar */
.progress-section {
  margin-bottom: 1.5rem;
}
.progress-section h3 {
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}
.progress-bar-container {
  height: 0.5rem;
  background: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}
.progress-bar {
  height: 100%;
  background: #6ABF4B;
  border-radius: 9999px;
  transition: width 0.3s;
}
.progress-section p {
  font-size: 0.8125rem;
  color: #6b7280;
}

/* Error Log */
.error-section h3 {
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}
.error-log {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  padding: 0.75rem;
  font-size: 0.75rem;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
}
.refresh-hint {
  font-size: 0.8125rem;
  color: #6b7280;
  font-style: italic;
  margin-top: 1rem;
}

/* Import Monitor */
.import-monitor {
  margin-top: 1.5rem;
}
.import-monitor h3 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}
.progress-bar-lg {
  height: 1rem;
  margin-bottom: 1rem;
}
.progress-bar-animated {
  background: linear-gradient(90deg, #6ABF4B 0%, #4ade80 50%, #6ABF4B 100%);
  background-size: 200% 100%;
  animation: progress-shimmer 1.5s ease-in-out infinite;
}
@keyframes progress-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.import-monitor-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  margin-bottom: 0.75rem;
}
.monitor-stat {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}
.monitor-stat-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}
.monitor-stat-value {
  font-size: 0.875rem;
  font-weight: 500;
  color: #1e293b;
}

/* Rebuild Status Card (index page) */
.rebuild-status-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}
.rebuild-status-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.rebuild-status-header h3 {
  font-size: 0.875rem;
  font-weight: 600;
  margin: 0;
}
.rebuild-status-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2rem;
  margin-bottom: 0.75rem;
}
.rebuild-status-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
}

/* Upload Progress */
.upload-progress-section {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.upload-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.upload-progress-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
}
.upload-progress-details {
  font-size: 0.8125rem;
  color: #64748b;
}
.upload-file-meta {
  display: block;
  font-size: 0.8125rem;
  color: #475569;
  font-weight: 500;
  margin-top: 0.375rem;
}
.upload-status {
  font-size: 0.875rem;
  margin-bottom: 1rem;
  min-height: 1.25rem;
}
.upload-status-active {
  color: #0369a1;
  font-weight: 500;
}
.upload-status-success {
  color: #15803d;
  font-weight: 500;
}
.upload-status-error {
  color: #dc2626;
  font-weight: 500;
}

/* Active Import Banner */
.import-active-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1.25rem;
  background: linear-gradient(90deg, #ecfdf5 0%, #f0fdfa 100%);
  border-bottom: 2px solid #6ABF4B;
  font-size: 0.8125rem;
}
.import-active-banner-icon {
  font-size: 1.125rem;
  animation: spin-slow 3s linear infinite;
}
@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.import-active-banner-text {
  flex: 1;
  color: #334155;
}
.import-active-banner-link {
  flex-shrink: 0;
  font-weight: 600;
  color: #15803d;
  text-decoration: none;
  padding: 0.25rem 0.75rem;
  border: 1px solid #86efac;
  border-radius: 6px;
  background: #fff;
  transition: background 0.15s;
}
.import-active-banner-link:hover {
  background: #dcfce7;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #6b7280;
}

/* Admin Page */
.admin-page h1 {
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}
.user-actions {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  white-space: nowrap;
}
.user-actions form {
  display: inline;
  margin: 0;
  padding: 0;
}

/* Column Mapping */
.mapping-subtitle {
  margin-bottom: 1.5rem;
  color: #374151;
  font-size: 0.875rem;
}
.mapping-section-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #374151;
  margin: 1.25rem 0 0.75rem;
  padding-bottom: 0.375rem;
  border-bottom: 1px solid #e2e8f0;
}
.mapping-grid {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}
.mapping-row {
  display: grid;
  grid-template-columns: 200px 1fr auto;
  align-items: center;
  gap: 0.75rem;
}
@media (max-width: 640px) {
  .mapping-row {
    grid-template-columns: 1fr;
  }
}
.mapping-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
}
.mapping-select {
  max-width: 100% !important;
}
.mapping-match {
  font-size: 0.6875rem;
  color: #059669;
  font-weight: 500;
  white-space: nowrap;
}
.required-star {
  color: #dc2626;
}
.mapping-preview {
  margin-top: 1.5rem;
}

/* Devise forms styling */
.devise-form {
  max-width: 400px;
  margin: 3rem auto;
  background: #fff;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.devise-form h2 {
  margin-bottom: 1.5rem;
  font-size: 1.25rem;
  text-align: center;
}

/* Market Finder */
.mf-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1rem;
}
.mf-header-left {
  flex: 1;
  min-width: 0;
}
.market-finder h1 {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}
.mf-subtitle {
  color: #6b7280;
  font-size: 0.875rem;
  margin-bottom: 0;
}
.mf-header-search {
  flex-shrink: 0;
}
.mf-search-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  margin-bottom: 0.25rem;
}
@media (max-width: 768px) {
  .mf-header {
    flex-direction: column;
    align-items: stretch;
  }
  .mf-header-search .search-box {
    max-width: 100%;
  }
}
.mf-form {
  background: #fff;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin-bottom: 1.5rem;
}
.mf-controls {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.mf-top-row {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #e5e7eb;
}
.mf-top-row .mf-section-scope {
  padding-top: 0;
  padding-right: 1.25rem;
  border-right: 1px solid #e5e7eb;
}
.mf-top-row .mf-section-rankby {
  padding-top: 0;
  padding-left: 1.25rem;
  flex: 1;
  min-width: 0;
}
.mf-section {
  padding: 0.625rem 0;
}
.mf-section-label {
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  margin-bottom: 0.5rem;
}
.mf-controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
}
/* Highlight the active movement dropdown */
.mf-movement-select.active {
  border-color: #6ABF4B;
  background: #f0fdf0;
}
.mf-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex-shrink: 1;
  min-width: 0;
}
.mf-field label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
}
.mf-select {
  padding: 0.5rem 0.75rem;
  border: 2px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.8125rem;
  background: #fff;
  cursor: pointer;
  min-width: 100px;
  width: 100%;
}
.mf-select:focus {
  outline: none;
  border-color: #6ABF4B;
  box-shadow: 0 0 0 3px rgba(106, 191, 75, 0.15);
}
.mf-input {
  padding: 0.5rem 0.75rem;
  border: 2px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.8125rem;
  background: #fff;
  min-width: 80px;
  width: 100%;
}
.mf-input:focus {
  outline: none;
  border-color: #6ABF4B;
  box-shadow: 0 0 0 3px rgba(106, 191, 75, 0.15);
}
.mf-input::-webkit-outer-spin-button,
.mf-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.mf-input[type=number] {
  -moz-appearance: textfield;
}
.mf-population {
  color: #64748b;
  font-size: 0.8125rem;
  white-space: nowrap;
}
.mf-separator {
  align-self: flex-end;
  padding-bottom: 0.45rem;
  font-size: 0.6875rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.mf-field-submit {
  margin-left: auto;
}
.mf-btn {
  padding: 0.5rem 1.5rem !important;
  font-size: 0.875rem !important;
  white-space: nowrap;
}
/* Market Finder Alert Banner */
.mf-alerts-banner {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border-left: 3px solid #6ABF4B;
  margin-bottom: 1rem;
  overflow: hidden;
}
.mf-alerts-banner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 1rem;
  background: #fafff8;
  border-bottom: 1px solid #ecfccb;
}
.mf-alerts-banner-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #166534;
}
.mf-alerts-banner-count {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
}
.mf-alerts-banner-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.mf-alerts-dismiss-btn {
  background: none;
  border: none;
  font-size: 0.75rem;
  color: #6b7280;
  cursor: pointer;
  padding: 0;
}
.mf-alerts-dismiss-btn:hover {
  color: #374151;
  text-decoration: underline;
}
.mf-alerts-view-all {
  font-size: 0.75rem;
  font-weight: 600;
  color: #6ABF4B;
  text-decoration: none;
}
.mf-alerts-view-all:hover {
  text-decoration: underline;
}
.mf-alerts-banner-list {
  padding: 0;
}
.mf-alerts-banner-item {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid #f1f5f9;
}
.mf-alerts-banner-item:last-child {
  border-bottom: none;
}
.mf-alerts-banner-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.125rem;
}
.mf-alerts-banner-alert-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: #1f2937;
}
.mf-alerts-banner-time {
  font-size: 0.625rem;
  color: #94a3b8;
}
.mf-alerts-banner-summary {
  font-size: 0.75rem;
  color: #6b7280;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mf-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: #6b7280;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.mf-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.mf-results-header h2 {
  font-size: 1rem;
  font-weight: 600;
  color: #1f2937;
}
.mf-results-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.mf-selection-count {
  font-size: 0.75rem;
  color: #6ABF4B;
  font-weight: 600;
  white-space: nowrap;
}
.mf-table {
  table-layout: fixed;
}
.mf-table .mf-check {
  width: 2rem;
  text-align: center;
  padding: 0.375rem 0.25rem;
}
.mf-table th,
.mf-table td {
  padding: 0.4rem 0.35rem;
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mf-checkbox {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
  accent-color: #6ABF4B;
}
.mf-checkbox:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}
.mf-table .mf-rank {
  width: 2rem;
  text-align: center;
  font-weight: 700;
  color: #6ABF4B;
}
.mf-table .mf-market {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
}
.report-map-it-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: auto;
  padding: 0.3rem 0.65rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: #fff;
  background: #6ABF4B;
  border-radius: 4px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s;
}
.report-map-it-btn:hover {
  background: #58a63d;
  color: #fff;
}
.report-map-it-btn svg {
  flex-shrink: 0;
}
.mf-type-badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}
.mf-type-sellers { background: #fef2f2; color: #dc2626; }
.mf-type-balanced { background: #fffbeb; color: #d97706; }
.mf-type-buyers { background: #f0fdf4; color: #16a34a; }
.mf-type-na { background: #f8fafc; color: #94a3b8; }
.mf-distress-low { background: #fef2f2; color: #dc2626; }
.mf-distress-moderate { background: #fffbeb; color: #d97706; }
.mf-distress-high { background: #f0fdf4; color: #16a34a; }
.mf-investor-low { background: #f0fdf4; color: #16a34a; }
.mf-investor-moderate { background: #fffbeb; color: #d97706; }
.mf-investor-high { background: #eff6ff; color: #2563eb; }
.mf-confidence-badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}
.mf-confidence-high { background: #f0fdf4; color: #16a34a; }
.mf-confidence-moderate { background: #eff6ff; color: #2563eb; }
.mf-confidence-low { background: #fefce8; color: #ca8a04; }
/* Non-conforming row: metric direction doesn't match Rank By selection */
.mf-row-nonconforming {
  background: #fffbeb;
}
.mf-nonconforming-flag {
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.8125rem;
  color: #d97706;
  cursor: help;
  vertical-align: middle;
}
@media (max-width: 768px) {
  .mf-top-row {
    flex-direction: column;
  }
  .mf-top-row .mf-section-scope {
    padding-right: 0;
    border-right: none;
    padding-bottom: 0.625rem;
    border-bottom: 1px solid #e5e7eb;
  }
  .mf-top-row .mf-section-rankby {
    padding-left: 0;
  }
  .mf-controls-row {
    flex-direction: column;
  }
  .mf-separator {
    display: none;
  }
  .mf-field-submit {
    margin-left: 0;
    width: 100%;
  }
  .mf-btn {
    width: 100%;
  }
  .mf-select {
    min-width: unset;
    width: 100%;
  }
  .mf-input {
    min-width: unset;
    max-width: unset;
    width: 100%;
  }
}

/* Population Summary */
.pop-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.pop-summary-card {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #fff;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.pop-summary-count {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f2937;
}
.pop-summary-label {
  font-size: 0.8125rem;
  color: #6b7280;
  margin-right: 0.5rem;
}

/* Population matching */
.match-summary {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.match-stat {
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
}
.match-stat-good { background: #d1fae5; color: #065f46; }
.match-stat-warn { background: #fef3c7; color: #92400e; }
.match-stat-info { background: #e0e7ff; color: #3730a3; }

.match-badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.match-exact { background: #d1fae5; color: #065f46; }
.match-normalized { background: #dbeafe; color: #1e40af; }
.match-fuzzy { background: #fef3c7; color: #92400e; }
.match-none { background: #fee2e2; color: #991b1b; }

.match-row-exact td { background: #f0fdf4; }
.match-row-normalized td { background: #eff6ff; }
.match-row-fuzzy td { background: #fffbeb; }
.match-row-none td { background: #fef2f2; }

.match-confirmed {
  font-size: 0.8125rem;
  color: #065f46;
  font-weight: 500;
}
.match-asis {
  font-size: 0.8125rem;
  color: #6b7280;
}
.match-select {
  font-size: 0.8125rem;
  padding: 0.25rem 0.5rem;
  min-width: 200px;
  max-width: 100%;
}

/* Population filter tabs */
.pop-filter-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 2px solid #e5e7eb;
}
.pop-filter-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #6b7280;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}
.pop-filter-tab:hover {
  color: #1f2937;
  text-decoration: none;
}
.pop-filter-tab.active {
  color: #6ABF4B;
  border-bottom-color: #6ABF4B;
}
.pop-filter-count {
  font-size: 0.75rem;
  background: #e5e7eb;
  color: #374151;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
}
.pop-filter-tab.active .pop-filter-count {
  background: #dcfce7;
  color: #166534;
}

/* Application Settings */
.settings-form {
  max-width: 600px;
}
.settings-section {
  background: #fff;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin-bottom: 1.5rem;
}
.settings-section h2 {
  font-size: 1.125rem;
  margin-bottom: 0.5rem;
}
.settings-hint {
  font-size: 0.8125rem;
  color: #6b7280;
  margin-bottom: 1rem;
}
.logo-preview {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  margin-bottom: 1rem;
}
.logo-preview-image {
  flex-shrink: 0;
  background: #1e293b;
  padding: 0.5rem;
  border-radius: 6px;
}
.logo-preview-image img {
  height: 40px;
  max-width: 180px;
  object-fit: contain;
  display: block;
}
.logo-filename {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #374151;
}
.logo-filesize {
  font-size: 0.75rem;
  color: #6b7280;
}
.logo-remove {
  margin-left: auto;
  font-size: 0.8125rem;
  color: #dc2626;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.375rem;
}
.form-control-file {
  font-size: 0.875rem;
}
.form-actions {
  padding-top: 0.5rem;
}

/* My Markets */
.my-markets {
}
.my-markets-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.my-markets-header h1 {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}
.my-markets-subtitle {
  color: #6b7280;
  font-size: 0.875rem;
}
.my-markets-btn-icon {
  font-weight: 700;
  font-size: 1.05em;
  margin-right: 0.125rem;
}
.my-markets-summary {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.my-markets-stat {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #fff;
  padding: 0.625rem 1rem;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.my-markets-stat-number {
  font-size: 1.25rem;
  font-weight: 700;
  color: #6ABF4B;
}
.my-markets-stat-label {
  font-size: 0.8125rem;
  color: #6b7280;
}
.my-markets-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.saved-search-card {
  background: #fff;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: box-shadow 0.15s, transform 0.15s;
  border-left: 3px solid #e2e8f0;
}
.saved-search-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transform: translateY(-1px);
  border-left-color: #6ABF4B;
}
.saved-search-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #f0fdf0;
  color: #6ABF4B;
  flex-shrink: 0;
  margin-top: 0.125rem;
}
.saved-search-main {
  flex: 1;
  min-width: 0;
}
.saved-search-name {
  font-size: 1.0625rem;
  font-weight: 600;
  color: #1f2937;
  text-decoration: none;
  display: inline-block;
}
.saved-search-name:hover {
  color: #6ABF4B;
  text-decoration: none;
}
.saved-search-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.375rem;
  font-size: 0.75rem;
  color: #94a3b8;
}
.saved-search-meta::before {
  display: none;
}
.saved-search-count {
  font-weight: 600;
  color: #6ABF4B;
  background: #f0fdf0;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.6875rem;
}
.saved-search-geos {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 0.625rem;
}
.saved-search-geo-tag {
  display: inline-block;
  font-size: 0.6875rem;
  padding: 0.2rem 0.625rem;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-weight: 500;
  transition: background 0.15s;
}
.saved-search-geo-msa {
  background: #ede9fe;
  color: #5b21b6;
}
.saved-search-geo-city {
  background: #dbeafe;
  color: #1e40af;
}
.saved-search-geo-county {
  background: #fef3c7;
  color: #92400e;
}
.saved-search-geo-zip {
  background: #d1fae5;
  color: #065f46;
}
.saved-search-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  padding-top: 0.25rem;
}
.saved-search-delete {
  background: none;
  border: 1px solid #e2e8f0;
  color: #94a3b8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.saved-search-delete:hover {
  color: #dc2626;
  border-color: #fca5a5;
  background: #fef2f2;
}
.saved-search-unavailable {
  color: #94a3b8;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  cursor: default;
  font-size: 0.75rem;
}
/* Empty State */
.my-markets-empty {
  text-align: center;
  padding: 4rem 2rem;
  color: #6b7280;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.my-markets-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f0fdf0 0%, #dcfce7 100%);
  color: #6ABF4B;
  margin-bottom: 1.5rem;
}
.my-markets-empty-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 0.5rem;
}
.my-markets-empty-desc {
  font-size: 0.9375rem;
  color: #6b7280;
  max-width: 420px;
  margin: 0 auto 1.75rem;
  line-height: 1.6;
}
.my-markets-empty-cta {
  padding: 0.625rem 1.5rem;
  font-size: 0.9375rem;
}
.my-markets-empty p {
  margin-bottom: 0.5rem;
}

/* Save Search Inline Form */
.save-search-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}
.save-search-form {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}
.save-search-input {
  padding: 0.25rem 0.5rem;
  border: 2px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.75rem;
  width: 180px;
  transition: border-color 0.15s;
}
.save-search-input:focus {
  outline: none;
  border-color: #6ABF4B;
  box-shadow: 0 0 0 3px rgba(106, 191, 75, 0.15);
}
.save-search-feedback {
  font-size: 0.75rem;
  font-weight: 600;
  color: #059669;
}
@media (max-width: 768px) {
  .my-markets-header {
    flex-direction: column;
    gap: 0.75rem;
  }
  .my-markets-summary {
    flex-direction: column;
    gap: 0.5rem;
  }
  .saved-search-card {
    flex-direction: column;
    padding: 1rem;
  }
  .saved-search-icon {
    display: none;
  }
  .saved-search-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .save-search-inline {
    flex-wrap: wrap;
  }
  .my-markets-empty {
    padding: 3rem 1.5rem;
  }
}

/* =============================================
   ALERTS
   ============================================= */

/* Alerts Page */
.alerts-page {
}
.alerts-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.alerts-header h1 {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}
.alerts-subtitle {
  color: #6b7280;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.alerts-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.alerts-btn-icon {
  font-weight: 700;
  font-size: 1.05em;
  margin-right: 0.125rem;
}
.alerts-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  margin-left: 0.375rem;
}

/* Alerts Summary */
.alerts-summary {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.alerts-stat {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #fff;
  padding: 0.625rem 1rem;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.alerts-stat-number {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f2937;
}
.alerts-stat-active {
  color: #6ABF4B;
}
.alerts-stat-label {
  font-size: 0.8125rem;
  color: #6b7280;
}

/* Alert Card */
.alerts-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.alert-card {
  background: #fff;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: box-shadow 0.15s, transform 0.15s;
  border-left: 3px solid #6ABF4B;
}
.alert-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transform: translateY(-1px);
}
.alert-card-disabled {
  border-left-color: #d1d5db;
  opacity: 0.7;
}
.alert-card-disabled:hover {
  opacity: 0.85;
}
.alert-card-status {
  flex-shrink: 0;
  padding-top: 0.125rem;
}
.alert-card-main {
  flex: 1;
  min-width: 0;
}
.alert-card-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.alert-card-name {
  font-size: 1.0625rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0;
}
.alert-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.625rem;
  font-size: 0.75rem;
  color: #94a3b8;
}
.alert-meta-unread {
  color: #dc2626;
  font-weight: 600;
  background: #fef2f2;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.6875rem;
}
.alert-meta-item {
}
.alert-card-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  padding-top: 0.25rem;
}
.alert-delete-btn {
  background: none;
  border: 1px solid #e2e8f0;
  color: #94a3b8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.alert-delete-btn:hover {
  color: #dc2626;
  border-color: #fca5a5;
  background: #fef2f2;
}

/* Toggle Switch */
.alert-toggle-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.alert-toggle {
  display: inline-flex;
  align-items: center;
  width: 2.5rem;
  height: 1.375rem;
  border-radius: 999px;
  padding: 0.125rem;
  transition: background 0.2s;
  position: relative;
}
.alert-toggle-on {
  background: #6ABF4B;
}
.alert-toggle-off {
  background: #d1d5db;
}
.alert-toggle-knob {
  display: block;
  width: 1.125rem;
  height: 1.125rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: transform 0.2s;
}
.alert-toggle-on .alert-toggle-knob {
  transform: translateX(1.125rem);
}

/* Logic Badge */
.alert-logic-badge {
  display: inline-block;
  font-size: 0.625rem;
  font-weight: 700;
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.alert-logic-all {
  background: #dbeafe;
  color: #1e40af;
}
.alert-logic-any {
  background: #fef3c7;
  color: #92400e;
}

/* Condition Pills (in card preview) */
.alert-conditions-preview {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem;
}
.alert-condition-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.75rem;
}
.condition-type-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.375rem;
  height: 1.375rem;
  border-radius: 4px;
  font-size: 0.6875rem;
  font-weight: 700;
  flex-shrink: 0;
}
.condition-type-price_change {
  background: #dcfce7;
  color: #166534;
}
.condition-type-inventory_change {
  background: #dbeafe;
  color: #1e40af;
}
.condition-pill-text {
  color: #374151;
}
.condition-pill-scope {
  color: #94a3b8;
  font-size: 0.6875rem;
}
.condition-connector {
  font-size: 0.625rem;
  font-weight: 700;
  color: #6b7280;
  padding: 0.125rem 0.375rem;
  background: #f3f4f6;
  border-radius: 4px;
}

/* Alert Status Text */
.alert-status-text {
  font-size: 0.8125rem;
  color: #6b7280;
}

/* Empty State */
.alerts-empty {
  text-align: center;
  padding: 4rem 2rem;
  color: #6b7280;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.alerts-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f0fdf0 0%, #dcfce7 100%);
  color: #6ABF4B;
  margin-bottom: 1.5rem;
}
.alerts-empty-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 0.5rem;
}
.alerts-empty-desc {
  font-size: 0.9375rem;
  color: #6b7280;
  max-width: 420px;
  margin: 0 auto 1.75rem;
  line-height: 1.6;
}
.alerts-empty-cta {
  padding: 0.625rem 1.5rem;
  font-size: 0.9375rem;
}

/* =============================================
   ALERT BUILDER (New/Edit Form)
   ============================================= */
.alert-builder {
  max-width: 720px;
}
.alert-form {
}

/* Builder Sections */
.alert-builder-section {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin-bottom: 1rem;
}
.alert-builder-step {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem 0;
}
.alert-step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: #6ABF4B;
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 700;
  flex-shrink: 0;
}
.alert-step-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1f2937;
}
.alert-builder-content {
  padding: 0.75rem 1.25rem 1.25rem;
}

/* Name Input */
.alert-name-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.9375rem;
  transition: border-color 0.15s;
}
.alert-name-input:focus {
  outline: none;
  border-color: #6ABF4B;
  box-shadow: 0 0 0 3px rgba(106, 191, 75, 0.15);
}

/* Logic Selector */
.alert-logic-selector {
  display: flex;
  gap: 0.75rem;
}
.alert-logic-option {
  flex: 1;
  cursor: pointer;
}
.alert-logic-option input[type="radio"] {
  display: none;
}
.alert-logic-option-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  transition: all 0.15s;
}
.alert-logic-option input[type="radio"]:checked + .alert-logic-option-card {
  border-color: #6ABF4B;
  background: #f0fdf0;
}
.alert-logic-option:hover .alert-logic-option-card {
  border-color: #6ABF4B;
}
.alert-logic-option-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  background: #e2e8f0;
  color: #475569;
  flex-shrink: 0;
}
.alert-logic-option input[type="radio"]:checked + .alert-logic-option-card .alert-logic-option-badge {
  background: #6ABF4B;
  color: #fff;
}
.alert-logic-option-text {
  font-size: 0.8125rem;
  color: #374151;
}

/* Conditions List */
.alert-conditions-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

/* Condition Card */
.alert-condition-card {
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  overflow: visible;
  transition: border-color 0.15s;
}
.condition-card-header {
  border-radius: 6px 6px 0 0;
}
.alert-condition-card:hover {
  border-color: #cbd5e1;
}
.condition-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 1rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}
.condition-card-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
}
.condition-remove-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  padding: 0.25rem;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  transition: all 0.15s;
}
.condition-remove-btn:hover {
  color: #dc2626;
  background: #fef2f2;
}
.condition-card-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Condition Rows */
.condition-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.condition-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  min-width: 5rem;
  flex-shrink: 0;
}
.condition-field {
  flex: 1;
  min-width: 0;
}
.condition-field-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.condition-select {
  padding: 0.4375rem 0.75rem;
  border: 2px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.8125rem;
  background: #fff;
  cursor: pointer;
  max-width: 100%;
}
.condition-select:focus {
  outline: none;
  border-color: #6ABF4B;
  box-shadow: 0 0 0 3px rgba(106, 191, 75, 0.15);
}
.condition-threshold-wrapper {
  display: inline-flex;
  align-items: center;
  position: relative;
}
.condition-threshold-prefix {
  position: absolute;
  left: 0.625rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #64748b;
  pointer-events: none;
}
.condition-threshold-input {
  padding: 0.4375rem 0.75rem;
  border: 2px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.8125rem;
  width: 8rem;
}
.condition-threshold-prefix + .condition-threshold-input,
.condition-threshold-wrapper:has(.condition-threshold-prefix) .condition-threshold-input {
  padding-left: 1.5rem;
}
.condition-threshold-input:focus {
  outline: none;
  border-color: #6ABF4B;
  box-shadow: 0 0 0 3px rgba(106, 191, 75, 0.15);
}
.condition-threshold-input::-webkit-outer-spin-button,
.condition-threshold-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.condition-threshold-input[type=number] {
  -moz-appearance: textfield;
}
.condition-weeks-input {
  padding: 0.4375rem 0.75rem;
  border: 2px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.8125rem;
  width: 4.5rem;
  text-align: center;
}
.condition-weeks-input:focus {
  outline: none;
  border-color: #6ABF4B;
  box-shadow: 0 0 0 3px rgba(106, 191, 75, 0.15);
}
.condition-weeks-input::-webkit-outer-spin-button,
.condition-weeks-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.condition-weeks-input[type=number] {
  -moz-appearance: textfield;
}
.condition-weeks-suffix {
  font-size: 0.8125rem;
  color: #6b7280;
}
.condition-geo-select {
  min-width: 10rem;
}
.condition-geo-specific {
  flex: 1;
  min-width: 0;
}

/* Threshold suffix (% label) */
.condition-threshold-suffix-label {
  position: absolute;
  left: 0.625rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #64748b;
  pointer-events: none;
}
.condition-threshold-suffix-label + .condition-threshold-input,
.condition-threshold-wrapper:has(.condition-threshold-suffix-label) .condition-threshold-input {
  padding-left: 1.75rem;
}

/* Geography Search in Conditions */
.condition-geo-search-wrapper {
  position: relative;
  width: 100%;
  min-width: 14rem;
}
.condition-geo-search-input {
  width: 100%;
}
.condition-geo-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  max-height: 240px;
  overflow-y: auto;
  z-index: 50;
  margin-top: 0.25rem;
}
.condition-geo-result-header {
  padding: 0.375rem 0.75rem;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  background: #f8fafc;
  border-bottom: 1px solid #f1f5f9;
}
.condition-geo-result-item {
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  color: #374151;
  cursor: pointer;
  transition: background 0.1s;
}
.condition-geo-result-item:hover,
.condition-geo-result-item.highlighted {
  background: #f0fdf0;
  color: #166534;
}
.condition-geo-no-results {
  color: #94a3b8;
  cursor: default;
  font-style: italic;
}
.condition-geo-no-results:hover {
  background: transparent;
  color: #94a3b8;
}

/* Selected geo chip */
.condition-geo-selected {
  display: flex;
  align-items: center;
}
.condition-geo-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.5rem 0.375rem 0.75rem;
  background: #f0fdf0;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  font-size: 0.8125rem;
  color: #166534;
}
.condition-geo-chip-name {
  font-weight: 500;
}
.condition-geo-chip-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: #6b7280;
  font-size: 1.125rem;
  line-height: 1;
  padding: 0 0.125rem;
  border-radius: 3px;
  transition: all 0.15s;
}
.condition-geo-chip-remove:hover {
  color: #dc2626;
  background: #fef2f2;
}

/* Geography Scope Selector */
.condition-geo-scope-selector {
  margin-top: 0.625rem;
  padding: 0.75rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}
.condition-geo-scope-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  margin-bottom: 0.5rem;
}
.condition-geo-scope-options {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}
.condition-geo-scope-option {
  cursor: pointer;
}
.condition-geo-scope-option input[type="radio"] {
  display: none;
}
.condition-geo-scope-option-card {
  display: block;
  padding: 0.5rem 0.75rem;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  font-size: 0.8125rem;
  color: #374151;
  transition: all 0.15s;
}
.condition-geo-scope-option input[type="radio"]:checked + .condition-geo-scope-option-card {
  border-color: #6ABF4B;
  background: #f0fdf0;
  color: #166534;
}
.condition-geo-scope-option-card:hover {
  border-color: #cbd5e1;
}
.condition-geo-scope-option input[type="radio"]:checked + .condition-geo-scope-option-card:hover {
  border-color: #6ABF4B;
}
.condition-geo-scope-option-text {
  font-weight: 500;
}

/* Add Condition Button */
.alert-add-condition {
  width: 100%;
  padding: 0.625rem;
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  font-size: 0.8125rem;
  color: #6b7280;
  transition: all 0.15s;
  background: #fff;
}
.alert-add-condition:hover {
  border-color: #6ABF4B;
  color: #6ABF4B;
  background: #f0fdf0;
}

/* Submit Actions */
.alert-builder-actions {
  display: flex;
  gap: 0.75rem;
  padding-top: 0.25rem;
}
.alert-submit-btn {
  padding: 0.625rem 2rem !important;
  font-size: 0.9375rem !important;
}

/* =============================================
   ALERT DETAIL (Show Page)
   ============================================= */
.alert-detail-section {
  margin-bottom: 1.5rem;
}
.alert-detail-heading {
  font-size: 1rem;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.alert-detail-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.375rem;
  height: 1.375rem;
  padding: 0 0.375rem;
  border-radius: 999px;
  background: #e5e7eb;
  color: #374151;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Condition Detail Cards */
.alert-conditions-detail {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}
.alert-condition-detail-card {
  background: #fff;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  width: 100%;
  max-width: 600px;
}
.condition-detail-type {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.condition-detail-type-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
}
.condition-detail-desc {
  font-size: 0.9375rem;
  font-weight: 500;
  color: #1f2937;
  margin-bottom: 0.25rem;
}
.condition-detail-scope {
  font-size: 0.8125rem;
  color: #6b7280;
}
.condition-detail-connector {
  display: flex;
  justify-content: center;
  padding: 0.125rem 0;
}

/* Notification Cards */
.alert-notifications-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.alert-notification-card {
  background: #fff;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border-left: 3px solid #e2e8f0;
}
.alert-notification-unread {
  border-left-color: #6ABF4B;
  background: #fafff8;
}
.notification-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.375rem;
}
.notification-alert-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #1f2937;
}
.notification-time {
  font-size: 0.6875rem;
  color: #94a3b8;
  margin-bottom: 0.25rem;
}
.notification-summary {
  font-size: 0.8125rem;
  color: #374151;
  line-height: 1.5;
}
.notification-details-toggle {
  margin-top: 0.5rem;
}
.notification-details-label {
  font-size: 0.75rem;
  color: #6ABF4B;
  cursor: pointer;
  font-weight: 500;
}
.notification-details-label:hover {
  text-decoration: underline;
}
.notification-details-body {
  margin-top: 0.5rem;
  padding: 0.75rem;
  background: #f8fafc;
  border-radius: 6px;
}
.notification-detail-group {
  margin-bottom: 0.5rem;
}
.notification-detail-group:last-child {
  margin-bottom: 0;
}
.notification-detail-condition {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 0.375rem;
}
.notification-market-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.25rem 0;
  font-size: 0.8125rem;
}
.notification-market-name {
  color: #374151;
}
.notification-market-change {
  font-weight: 600;
  font-size: 0.75rem;
}

/* No notifications */
.alert-no-notifications {
  background: #fff;
  border-radius: 8px;
  padding: 2rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  text-align: center;
  color: #6b7280;
  font-size: 0.875rem;
}

/* =============================================
   NOTIFICATION DRAWER (Slide-out Panel)
   ============================================= */

/* Navbar bell button */
.navbar-bell {
  position: relative;
  background: none;
  border: none;
  color: #cbd5e1;
  cursor: pointer;
  padding: 0.375rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  transition: all 0.15s;
}
.navbar-bell:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}
.navbar-bell-badge {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transform: translate(25%, -25%);
}

/* Overlay */
.notif-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 199;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}
.notif-drawer-overlay--visible {
  opacity: 1;
  visibility: visible;
}

/* Drawer panel */
.notif-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 420px;
  max-width: 100vw;
  background: #f8fafc;
  z-index: 200;
  box-shadow: -4px 0 24px rgba(0,0,0,0.15);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}
.notif-drawer--open {
  transform: translateX(0);
}
.notif-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.25rem 0;
}
.notif-drawer-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f2937;
  margin: 0;
}
.notif-drawer-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.notif-drawer-mark-read {
  background: none;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.75rem;
  color: #6b7280;
  padding: 0.3rem 0.625rem;
  cursor: pointer;
  transition: all 0.15s;
}
.notif-drawer-mark-read:hover {
  border-color: #6ABF4B;
  color: #166534;
  background: #f0fdf0;
}
.notif-drawer-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  transition: all 0.15s;
}
.notif-drawer-close:hover {
  color: #1f2937;
  background: #f1f5f9;
}
.notif-drawer-subtitle {
  font-size: 0.8125rem;
  color: #64748b;
  margin: 0.25rem 0 0;
  padding: 0 1.25rem 1rem;
  border-bottom: 1px solid #e2e8f0;
}

/* Scrollable body */
.notif-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.notif-drawer-loading {
  text-align: center;
  padding: 2rem;
  color: #94a3b8;
  font-size: 0.875rem;
}
.notif-drawer-error {
  text-align: center;
  padding: 2rem;
  color: #dc2626;
  font-size: 0.875rem;
}

/* Empty state */
.notif-drawer-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: #94a3b8;
}
.notif-drawer-empty svg {
  margin-bottom: 0.75rem;
}
.notif-drawer-empty p {
  font-weight: 600;
  font-size: 1rem;
  color: #64748b;
  margin: 0 0 0.25rem;
}
.notif-drawer-empty span {
  font-size: 0.8125rem;
}

/* Footer */
.notif-drawer-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid #e2e8f0;
  text-align: center;
}

/* Notification cards inside drawer */
.notif-card {
  background: #fff;
  border-radius: 8px;
  padding: 0.875rem 1rem;
  border-left: 3px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.notif-card--unread {
  border-left-color: #6ABF4B;
  background: #fafff8;
}
.notif-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}
.notif-card-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #1f2937;
}
.notif-card-time {
  font-size: 0.6875rem;
  color: #94a3b8;
  white-space: nowrap;
}
.notif-card-summary {
  font-size: 0.8125rem;
  color: #374151;
  line-height: 1.5;
}

/* Expandable details inside drawer cards */
.notif-details-toggle {
  margin-top: 0.5rem;
}
.notif-details-label {
  font-size: 0.75rem;
  color: #6ABF4B;
  cursor: pointer;
  font-weight: 500;
}
.notif-details-label:hover {
  text-decoration: underline;
}
.notif-details-body {
  margin-top: 0.5rem;
  padding: 0.625rem;
  background: #f8fafc;
  border-radius: 6px;
}
.notif-detail-group {
  margin-bottom: 0.5rem;
}
.notif-detail-group:last-child {
  margin-bottom: 0;
}
.notif-detail-condition {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  margin: 0 0 0.25rem;
}
.notif-market-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.1875rem 0;
  font-size: 0.8125rem;
}
.notif-market-name {
  color: #374151;
}
.notif-market-change {
  font-weight: 600;
  font-size: 0.75rem;
}

/* Responsive - Sidebar */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 49px;
    left: 0;
    bottom: 0;
    z-index: 90;
    box-shadow: 2px 0 12px rgba(0,0,0,0.15);
  }
  .sidebar--collapsed {
    width: 0;
    border-right: none;
  }
  .sidebar--collapsed .sidebar-toggle {
    display: none;
  }
  .sidebar--collapsed .sidebar-nav,
  .sidebar--collapsed .sidebar-bottom {
    display: none;
  }
  .app-main {
    width: 100%;
  }
  /* Show a hamburger in the navbar on mobile when sidebar is collapsed */
  .navbar {
    position: sticky;
    top: 0;
  }
}

/* Responsive - Alerts */
@media (max-width: 768px) {
  .alerts-header {
    flex-direction: column;
    gap: 0.75rem;
  }
  .alerts-summary {
    flex-direction: column;
    gap: 0.5rem;
  }
  .alert-card {
    flex-direction: column;
    padding: 1rem;
  }
  .alert-card-status {
    order: -1;
  }
  .alert-card-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .alert-logic-selector {
    flex-direction: column;
  }
  .condition-row {
    flex-direction: column;
    align-items: stretch;
  }
  .condition-label {
    min-width: unset;
  }
  .alert-builder-actions {
    flex-direction: column;
  }
  .alert-submit-btn {
    width: 100%;
  }
  .alerts-empty {
    padding: 3rem 1.5rem;
  }
}

/* =============================================
   PORTFOLIO - Coming Soon
   ============================================= */
/* ── Portfolio Page ─────────────────────────────────────── */
.portfolio-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.portfolio-header-left { flex: 1; min-width: 0; }
.portfolio-page h1 {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}
.portfolio-subtitle {
  color: #6b7280;
  font-size: 0.875rem;
  margin: 0;
}
.portfolio-status-badge {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #6ABF4B;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  white-space: nowrap;
}
.portfolio-body {
  background: #fff;
  border-radius: 8px;
  padding: 2rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.portfolio-graphic {
  margin-bottom: 1.5rem;
}
.portfolio-graphic svg {
  opacity: 0.9;
}
.portfolio-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  width: 100%;
  margin-bottom: 1.5rem;
}
.portfolio-feature {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  background: #f8fafc;
  border-radius: 8px;
  border-top: 3px solid #6ABF4B;
}
.portfolio-feature svg {
  flex-shrink: 0;
  margin-top: 0.125rem;
}
.portfolio-feature strong {
  display: block;
  font-size: 0.875rem;
  color: #1f2937;
  margin-bottom: 0.25rem;
}
.portfolio-feature p {
  font-size: 0.8125rem;
  color: #6b7280;
  margin: 0;
  line-height: 1.5;
}
.portfolio-note {
  font-size: 0.8125rem;
  color: #94a3b8;
  margin: 0;
}
@media (max-width: 768px) {
  .portfolio-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .portfolio-body {
    padding: 1.5rem 1rem;
  }
  .portfolio-features {
    grid-template-columns: 1fr;
  }
  .portfolio-graphic svg {
    width: 150px;
    height: 150px;
  }
}

/* =============================================
   HEAT MAP
   ============================================= */
.map-page {
}
.map-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.map-header h1 {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}
.map-subtitle {
  color: #6b7280;
  font-size: 0.875rem;
}
.map-controls {
  margin-bottom: 1rem;
}
.map-controls-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  flex-wrap: wrap;
}
.map-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.map-field label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.map-field-search {
  min-width: 280px;
  max-width: 420px;
}
.map-field-search .search-box {
  max-width: 100%;
}
.map-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  margin-top: 0.25rem;
}
.map-search-result-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  color: #374151;
  cursor: pointer;
  transition: background 0.1s;
}
.map-search-result-item:hover {
  background: #f0fdf0;
  color: #166534;
}
.map-search-result-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
}
.map-search-badge-msa {
  background: #ede9fe;
  color: #5b21b6;
}
.map-search-badge-city {
  background: #dbeafe;
  color: #1e40af;
}
.map-search-no-results {
  padding: 1rem;
  text-align: center;
  color: #94a3b8;
  font-size: 0.8125rem;
  font-style: italic;
}

/* Map container */
.map-body {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border: 1px solid #e2e8f0;
  background: #fff;
}
.map-container {
  height: 560px;
  width: 100%;
  z-index: 1;
}
/* Glow effect on heat markers */
.heat-marker {
  filter: drop-shadow(0 0 6px currentColor) drop-shadow(0 0 2px currentColor);
  transition: filter 0.2s;
}
.heat-marker:hover {
  filter: drop-shadow(0 0 10px currentColor) drop-shadow(0 0 20px currentColor);
}

/* Loading overlay */
.map-loading {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 500;
}
.map-loading p {
  color: #64748b;
  font-size: 0.875rem;
  margin-top: 0.75rem;
}
.map-loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #e2e8f0;
  border-top-color: #6ABF4B;
  border-radius: 50%;
  animation: map-spin 0.8s linear infinite;
}
@keyframes map-spin {
  to { transform: rotate(360deg); }
}
/* Progress bar for geocoding */
.map-loading-progress {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-top: 0.75rem;
  width: 220px;
}
.map-loading-progress-track {
  flex: 1;
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}
.map-loading-progress-fill {
  height: 100%;
  width: 0%;
  background: #6ABF4B;
  border-radius: 4px;
  transition: width 0.3s ease;
}
.map-loading-progress-pct {
  font-size: 0.8125rem;
  font-weight: 700;
  color: #334155;
  min-width: 2.5rem;
  text-align: right;
}

/* Empty state overlay */
.map-empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.9);
  z-index: 400;
}
.map-empty-state p {
  color: #64748b;
  font-size: 0.9375rem;
  margin-top: 1rem;
  max-width: 360px;
  text-align: center;
  line-height: 1.5;
}

/* Legend */
.map-legend {
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(6px);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  padding: 0.5rem 1rem;
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}
.map-legend-label {
  font-size: 0.6875rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.map-legend-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.map-legend-gradient {
  width: 180px;
  height: 12px;
  border-radius: 6px;
}
.map-legend-gradient-price {
  background: linear-gradient(to right, #dc2626, #fb7143, #fef0b9, #4ade80, #059669);
}
.map-legend-gradient-inventory {
  background: linear-gradient(to right, #dc2626, #fb7143, #fef0b9, #38bdf8, #2563eb);
}
.map-legend-value {
  font-size: 0.6875rem;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
}

/* Info panel */
.map-info-panel {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(6px);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  padding: 0.75rem 1rem;
  z-index: 500;
  max-width: 280px;
}
.map-info-panel-body {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.map-info-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 3.5rem;
}
/* Clickable toggle stats */
.map-info-toggle {
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  border: 2px solid transparent;
  transition: opacity 0.15s, border-color 0.15s;
  user-select: none;
}
.map-info-toggle:not(.active) {
  opacity: 0.35;
}
.map-info-toggle:hover {
  opacity: 1;
  border-color: #e2e8f0;
}
.map-info-toggle.active {
  opacity: 1;
  border-color: #cbd5e1;
  background: rgba(241, 245, 249, 0.6);
}
.map-info-number {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f2937;
}
.map-info-rising {
  color: #10aa3c;
}
.map-info-dropping {
  color: #e61e32;
}
.map-info-label {
  font-size: 0.625rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.map-info-divider {
  width: 1px;
  background: #e2e8f0;
  align-self: stretch;
}

/* Popup styles */
.map-popup {
  min-width: 200px;
}
.map-popup-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 0.375rem;
}
.map-popup-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.125rem 0;
  font-size: 0.75rem;
}
.map-popup-label {
  color: #6b7280;
}
.map-popup-value {
  font-weight: 600;
  color: #1f2937;
}
.map-popup-positive {
  color: #10aa3c;
}
.map-popup-negative {
  color: #e61e32;
}
.map-popup-market-badge {
  display: inline-block;
  font-size: 0.625rem;
  font-weight: 700;
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  margin-bottom: 0.375rem;
}
.map-popup-market-sellers {
  background: #fef2f2;
  color: #991b1b;
}
.map-popup-market-balanced {
  background: #fef3c7;
  color: #92400e;
}
.map-popup-market-buyers {
  background: #dbeafe;
  color: #1e40af;
}

/* Geocode banner */
.map-geocode-banner {
  background: #fef3c7;
  color: #92400e;
  font-size: 0.8125rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid #fde68a;
  text-align: center;
}
.map-geocode-banner code {
  background: rgba(0,0,0,0.08);
  padding: 0.1rem 0.375rem;
  border-radius: 3px;
  font-size: 0.75rem;
}

/* Responsive */
@media (max-width: 768px) {
  .map-controls-row {
    flex-direction: column;
  }
  .map-field-search {
    min-width: unset;
  }
  .map-container {
    height: 400px;
  }
  .map-info-panel {
    position: relative;
    top: auto;
    right: auto;
    max-width: 100%;
    border-radius: 0 0 10px 10px;
    box-shadow: none;
    border-top: 1px solid #e2e8f0;
  }
  .map-legend {
    bottom: 0.5rem;
  }
}
