/* ========================================================
   上海多地点通勤选址系统 · 标准响应式设计系统 (Design System)
   支持 Desktop (大屏三栏) / Tablet (自适应) / Mobile (沉浸式三视图 TabBar)
   ======================================================== */

:root {
  /* Brand & Theme Colors */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --primary-border: #bfdbfe;
  --primary-dark: #1e40af;

  --accent: #0f172a;
  --accent-soft: #f8fafc;

  /* Surfaces & Backgrounds */
  --bg-page: #f1f5f9;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --surface-card: #ffffff;
  --surface-glass: rgba(255, 255, 255, 0.92);

  /* Lines & Borders */
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --border-hover: #cbd5e1;

  /* Text Colors */
  --text-main: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --text-tertiary: #94a3b8;

  /* Status Colors */
  --success: #10b981;
  --success-soft: #ecfdf5;
  --success-border: #a7f3d0;

  --warning: #f59e0b;
  --warning-soft: #fffbeb;
  --warning-border: #fde68a;

  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --danger-border: #fecaca;

  /* Medals */
  --gold: #d97706;
  --gold-bg: #fef3c7;
  --gold-border: #fde68a;

  --silver: #475569;
  --silver-bg: #f1f5f9;
  --silver-border: #cbd5e1;

  --bronze: #b45309;
  --bronze-bg: #ffedd5;
  --bronze-border: #fed7aa;

  /* Spacing, Radius & Elevation */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-pill: 9999px;

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 28px -4px rgba(15, 23, 42, 0.12), 0 4px 12px -2px rgba(15, 23, 42, 0.05);
  --shadow-xl: 0 20px 40px -6px rgba(15, 23, 42, 0.18);

  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --topbar-height: 58px;
  --mobile-nav-height: 60px;
}

/* Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg-page);
  color: var(--text-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* App Shell (Desktop Full Height Layout) */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  background: var(--bg-page);
}

/* Topbar */
.topbar {
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #1e293b, #0f172a);
  color: #38bdf8;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.2);
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-title strong {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.version-tag {
  font-size: 10px;
  font-weight: 800;
  padding: 1px 5px;
  background: #0f172a;
  color: #38bdf8;
  border-radius: var(--radius-xs);
  letter-spacing: 0.05em;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}
.status-badge.demo {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid var(--border);
}
.status-badge.demo:hover {
  background: #e2e8f0;
}
.status-badge.live {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

/* Workspace (Desktop 3-Column Grid) */
.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 360px 1fr 370px;
  gap: 14px;
  padding: 14px 18px 16px;
  min-height: 0;
  overflow: hidden;
}

.panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Sidebar & Results Panel Scrollable Area */
.sidebar, .results {
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
.sidebar::-webkit-scrollbar, .results::-webkit-scrollbar {
  width: 6px;
}
.sidebar::-webkit-scrollbar-thumb, .results::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

.sidebar {
  padding: 18px 18px 24px;
  gap: 16px;
}

.section-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.section-block + .section-block {
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.section-title-row h2 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}
.section-title-row p {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.4;
}

.count-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: #f1f5f9;
  color: var(--text-muted);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

/* Search Box */
.search-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}
.search-box label {
  font-size: 11px;
  font-weight: 600;
  color: #475569;
}
.search-row {
  display: flex;
  gap: 8px;
}
.search-input-wrap {
  flex: 1;
  position: relative;
}
.search-input-wrap input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--text-main);
  outline: none;
  transition: var(--transition);
}
.search-input-wrap input:focus {
  background: white;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  max-height: 240px;
  overflow-y: auto;
  z-index: 80;
  display: none;
}
.search-results.show { display: block; }
.search-item {
  width: 100%;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: var(--transition);
}
.search-item:hover { background: #f1f5f9; }
.search-item strong { font-size: 12px; color: var(--text-main); }
.search-item span { font-size: 11px; color: var(--text-muted); }
.search-empty { padding: 14px; text-align: center; color: var(--text-muted); font-size: 12px; }

/* Buttons */
.btn {
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  white-space: nowrap;
  padding: 0 14px;
}
.btn.compact { height: 40px; padding: 0 14px; }
.btn.primary {
  background: var(--primary);
  color: white;
}
.btn.primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}
.btn.secondary {
  background: #f8fafc;
  color: #334155;
  border-color: var(--border);
}
.btn.secondary:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}
.btn.secondary.primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.btn.ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
  height: 34px;
  padding: 0 10px;
}
.btn.ghost:hover {
  background: #f8fafc;
  color: var(--text-main);
  border-color: #cbd5e1;
}

.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* Place Cards List */
.place-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.place-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: var(--transition);
}
.place-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
}

.place-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.place-dot-index {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-xs);
  background: var(--primary);
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.place-main {
  flex: 1;
  min-width: 0;
}
.place-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.place-address {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.remove-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 0;
  background: #f1f5f9;
  color: #94a3b8;
  font-size: 16px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: var(--transition);
}
.remove-btn:hover {
  background: #fee2e2;
  color: #ef4444;
}

.place-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 6px;
  border-top: 1px dashed var(--border-light);
}
.weight-label { font-size: 11px; color: var(--text-muted); }
.weight-control {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 4px;
}
.weight-control button {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 0;
  background: white;
  color: var(--text-main);
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.weight-control button:hover { background: #eff6ff; color: var(--primary); }
.weight-number { font-size: 11px; font-weight: 700; color: var(--text-main); min-width: 32px; text-align: center; }

/* Form Fields */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.field span {
  font-size: 11px;
  font-weight: 600;
  color: #475569;
}
.field select, .field input {
  height: 38px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--text-main);
  outline: none;
  font-size: 12px;
  transition: var(--transition);
}
.field select:focus, .field input:focus {
  background: white;
  border-color: var(--primary);
}

.analyze {
  width: 100%;
  margin-top: 6px;
  padding: 12px 16px;
  min-height: 52px;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  color: white;
  border-radius: var(--radius);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: left;
}
.analyze:hover {
  background: linear-gradient(135deg, #0f172a, #020617);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.35);
}
.analyze-inner { display: flex; flex-direction: column; }
.analyze-title { font-size: 13px; font-weight: 800; letter-spacing: 0.02em; }
.analyze-sub { font-size: 11px; color: #94a3b8; margin-top: 2px; font-weight: 400; }
.analyze:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }

.hint-box {
  padding: 8px 10px;
  background: #f8fafc;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  color: #64748b;
  font-size: 11px;
  line-height: 1.4;
}

/* Map Area (Center Canvas) */
.map-area {
  position: relative;
  min-height: 0;
}
.map-canvas, #map, .demo-map {
  width: 100%;
  height: 100%;
}
.map-canvas {
  background: #e2e8f0;
  position: relative;
}

.demo-map {
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at 45% 45%, #f8fafc 0%, #e2e8f0 100%);
}
.demo-map-grid {
  position: absolute;
  inset: 0;
  opacity: 0.45;
  background-image:
    linear-gradient(rgba(100, 116, 139, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(100, 116, 139, 0.12) 1px, transparent 1px);
  background-size: 40px 40px;
}
.demo-map-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.demo-river { filter: drop-shadow(0 2px 6px rgba(180, 210, 240, 0.4)); }

.demo-label {
  position: absolute;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  opacity: 0.65;
  pointer-events: none;
  user-select: none;
}
.label-puxi { left: 32%; top: 48%; }
.label-pudong { left: 68%; top: 44%; }
.label-hongqiao { left: 16%; top: 52%; }
.label-wujiaochang { left: 60%; top: 22%; }
.label-xujiahui { left: 36%; top: 62%; }

.demo-lines-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}
.demo-markers { position: absolute; inset: 0; z-index: 6; }
.demo-marker {
  position: absolute;
  transform: translate(-50%, -100%);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.demo-marker:hover { transform: translate(-50%, -108%) scale(1.1); z-index: 20; }
.demo-marker.active { transform: translate(-50%, -108%) scale(1.15); z-index: 30; }

.demo-marker .pin {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: var(--primary);
  color: white;
  border: 2px solid white;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
  font-weight: 700;
}
.demo-marker .pin span {
  transform: rotate(45deg);
  font-size: 11px;
}
.demo-marker.candidate .pin {
  background: #0f172a;
  width: 32px;
  height: 32px;
  color: #38bdf8;
}
.demo-marker.candidate.rank-1 .pin {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.5);
}
.demo-marker.candidate.active .pin {
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.4), 0 6px 20px rgba(0, 0, 0, 0.3);
}

.demo-marker .marker-label {
  margin-top: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.95);
  color: #1e293b;
  border: 1px solid #cbd5e1;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.demo-map-note {
  position: absolute;
  left: 14px;
  bottom: 14px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(203, 213, 225, 0.8);
  color: #475569;
  font-size: 11px;
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  pointer-events: none;
}
.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7);
  animation: pulse-ring 1.8s infinite cubic-bezier(0.66, 0, 0, 1);
}
@keyframes pulse-ring { to { box-shadow: 0 0 0 8px rgba(37, 99, 235, 0); } }

/* Map Toolbar */
.map-toolbar {
  position: absolute;
  z-index: 10;
  top: 14px;
  left: 14px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.map-tool {
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.94);
  height: 34px;
  padding: 0 11px;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.map-tool:hover {
  background: #ffffff;
  color: var(--primary);
  border-color: var(--primary-border);
  box-shadow: var(--shadow-md);
}
.map-tool.active {
  background: #eff6ff;
  color: var(--primary);
  border-color: var(--primary-border);
}

.pick-notice {
  position: absolute;
  z-index: 20;
  left: 50%;
  top: 16px;
  transform: translateX(-50%);
  animation: float-down 0.25s ease-out;
}
.pick-notice-content {
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  color: white;
  background: #0f172a;
  box-shadow: var(--shadow-lg);
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}
@keyframes float-down {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* Results Panel */
.results { padding: 18px 18px 24px; }
.results-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.results-head h2 { font-size: 14px; font-weight: 700; color: var(--text-main); }
.results-head p { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.icon-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: white;
  color: #64748b;
  cursor: pointer;
  transition: var(--transition);
}
.icon-btn:hover { color: var(--text-main); border-color: #cbd5e1; background: #f8fafc; }

.empty-results {
  padding: 70px 20px 30px;
  text-align: center;
  color: var(--text-muted);
}
.empty-results .empty-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: #f1f5f9;
  color: #94a3b8;
}
.empty-results strong { display: block; color: #334155; font-size: 14px; margin-bottom: 4px; }
.empty-results p { font-size: 12px; line-height: 1.5; max-width: 250px; margin: 0 auto; }

.summary-cards {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.summary-card {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  border: 1px solid var(--border);
}
.summary-card span { display: block; color: var(--text-muted); font-size: 10px; font-weight: 500; }
.summary-card strong { display: block; margin-top: 2px; font-size: 14px; font-weight: 800; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.result-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.result-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: #ffffff;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
}
.result-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.08);
  transform: translateY(-1px);
}
.result-card.active {
  border-color: var(--primary);
  background: #f8faff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2), var(--shadow-sm);
}

.result-rank { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rank-left { display: flex; align-items: center; gap: 8px; min-width: 0; }

.rank-medal {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  font-weight: 800;
  font-size: 11px;
  flex: 0 0 auto;
}
.rank-medal.rank-1 { background: var(--gold-bg); color: var(--gold); border: 1px solid var(--gold-border); }
.rank-medal.rank-2 { background: var(--silver-bg); color: var(--silver); border: 1px solid var(--silver-border); }
.rank-medal.rank-3 { background: var(--bronze-bg); color: var(--bronze); border: 1px solid var(--bronze-border); }
.rank-medal.rank-other { background: #f1f5f9; color: #64748b; border: 1px solid var(--border); }

.result-name { font-size: 13px; font-weight: 700; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.result-score {
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.result-score.score-high { background: var(--success-soft); color: #065f46; border: 1px solid var(--success-border); }
.result-score.score-good { background: var(--primary-soft); color: var(--primary); border: 1px solid var(--primary-border); }
.result-score.score-mid { background: var(--warning-soft); color: #92400e; border: 1px solid var(--warning-border); }
.result-score.score-low { background: #f1f5f9; color: #475569; border: 1px solid var(--border); }

.rent-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  color: #0d9488;
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  padding: 3px 8px;
  border-radius: 6px;
  margin-top: 6px;
}
.rent-badge.over-budget { color: #b91c1c; background: #fef2f2; border-color: #fecaca; }

.result-metrics {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}
.metric {
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: #f8fafc;
}
.metric span { display: block; color: var(--text-muted); font-size: 10px; font-weight: 500; }
.metric strong { display: block; margin-top: 2px; font-size: 12px; font-weight: 700; color: #1e293b; }

.result-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-light);
}
.rent-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #2563eb;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 3px 8px;
  border-radius: 6px;
  transition: var(--transition);
}
.rent-link-btn:hover { background: #dbeafe; color: #1d4ed8; }

.detail-btn {
  border: 0;
  border-radius: 6px;
  background: #f1f5f9;
  color: #334155;
  height: 28px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}
.detail-btn:hover { background: #e2e8f0; color: var(--text-main); }

/* Dialogs */
.settings-dialog {
  border: 0;
  padding: 0;
  border-radius: var(--radius-lg);
  width: min(520px, calc(100vw - 32px));
  box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.3);
  margin: auto;
}
.settings-dialog::backdrop {
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
}
.dialog-card {
  padding: 22px;
  background: white;
  border-radius: var(--radius-lg);
}
.dialog-card.wide {
  width: 760px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}
.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.dialog-head h2 { margin: 0; font-size: 16px; font-weight: 700; color: #0f172a; }
.dialog-head p { margin: 4px 0 0; color: var(--text-muted); font-size: 12px; line-height: 1.4; }

.security-note {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: #fffbeb;
  border: 1px solid #fde68a;
}
.security-note strong { font-size: 12px; color: #92400e; display: block; }
.security-note p { margin: 4px 0 0; color: #a16207; font-size: 11px; line-height: 1.4; }

.settings-dialog .field { margin-bottom: 12px; }
.check-row {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: #475569;
  cursor: pointer;
  user-select: none;
}
.check-row input { width: 16px; height: 16px; margin: 0; cursor: pointer; }
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

/* Detail Modal Sections */
.detail-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.detail-summary .summary-card { padding: 10px; background: #f8fafc; }

.detail-rent-section {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 14px 0;
}
.detail-rent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.detail-rent-title {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 6px;
}
.detail-rent-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.rent-card-item {
  background: white;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  text-align: center;
}
.rent-card-item .rent-type-name { font-size: 11px; color: #64748b; font-weight: 500; display: block; }
.rent-card-item .rent-type-price { font-size: 13px; font-weight: 800; color: #0f766e; margin-top: 3px; display: block; }

.detail-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  margin: 16px 0 8px;
}

.commute-chart { display: grid; gap: 8px; margin-bottom: 16px; }
.chart-row { display: grid; grid-template-columns: 100px 1fr 60px; gap: 10px; align-items: center; }
.chart-label { font-size: 12px; font-weight: 600; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-track { width: 100%; height: 10px; background: #f1f5f9; border-radius: var(--radius-pill); overflow: hidden; }
.chart-bar { height: 100%; border-radius: var(--radius-pill); }
.chart-bar.fast { background: linear-gradient(90deg, #10b981, #34d399); }
.chart-bar.medium { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.chart-bar.slow { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.chart-bar.long { background: linear-gradient(90deg, #ef4444, #f87171); }
.chart-value { font-size: 12px; font-weight: 700; color: #0f172a; text-align: right; }

.detail-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.detail-table th, .detail-table td { padding: 8px 10px; border-bottom: 1px solid var(--border-light); text-align: left; }
.detail-table th { color: var(--text-muted); font-weight: 600; background: #f8fafc; }
.fallback-tag { display: inline-block; margin-left: 6px; padding: 2px 6px; border-radius: 4px; background: #fef3c7; color: #92400e; font-size: 10px; font-weight: 600; }

/* Toast */
.toast {
  position: fixed;
  z-index: 1000;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  background: #0f172a;
  color: white;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.28);
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Animation Utils */
.loading-line { position: relative; overflow: hidden; }
.loading-line::after {
  content: "";
  position: absolute;
  left: -40%;
  top: 0;
  bottom: 0;
  width: 35%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
  animation: shimmer 1.2s linear infinite;
}
@keyframes shimmer { to { left: 115%; } }
.hidden { display: none !important; }

/* ========================================================
   移动端原生导航栏 (Mobile Tab Bar)
   ======================================================== */
.mobile-tab-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  z-index: 90;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.04);
}

.mobile-tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 100%;
  border: 0;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  position: relative;
  transition: var(--transition);
}
.mobile-tab-btn span {
  font-size: 11px;
  font-weight: 600;
}
.mobile-tab-btn.active {
  color: var(--primary);
}
.mobile-tab-btn.active svg {
  transform: translateY(-1px);
}
.tab-badge {
  position: absolute;
  top: 6px;
  right: calc(50% - 18px);
  background: var(--primary);
  color: white;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: var(--radius-pill);
  border: 2px solid white;
}

/* ========================================================
   响应式适配 (Responsive Media Queries)
   ======================================================== */

/* 平板中屏 (768px ~ 1180px) */
@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 310px 1fr 320px;
    padding: 10px;
    gap: 10px;
  }
  .form-grid { grid-template-columns: 1fr; }
}

/* 移动端小屏 (< 768px) */
@media (max-width: 768px) {
  html, body {
    overflow: auto;
  }

  .app-shell {
    height: 100dvh;
    padding-bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));
  }

  .topbar {
    padding: 0 14px;
    height: 52px;
    min-height: 52px;
  }
  .brand-title strong { font-size: 14px; }
  .brand-subtitle { display: none; }
  .status-badge { font-size: 10px; padding: 3px 8px; }

  /* 移动端主视口采用单视图切换模式 */
  .workspace {
    display: block;
    padding: 0;
    margin: 0;
    height: 100%;
    position: relative;
    overflow: hidden;
  }

  .view-panel {
    display: none !important;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    border: 0;
    box-shadow: none;
  }

  /* 激活的视图显示 */
  .app-shell[data-active-view="places"] #sidebarPanel {
    display: flex !important;
    overflow-y: auto;
    padding: 16px 14px 30px;
  }

  .app-shell[data-active-view="map"] #mapPanel {
    display: flex !important;
  }

  .app-shell[data-active-view="results"] #resultsPanel {
    display: flex !important;
    overflow-y: auto;
    padding: 16px 14px 30px;
  }

  /* 显示底部导航栏 */
  .mobile-tab-bar {
    display: grid;
  }

  .form-grid {
    grid-template-columns: 1fr 1fr;
  }

  .quick-actions {
    grid-template-columns: 1fr 1fr;
  }

  .map-toolbar {
    top: 10px;
    left: 10px;
    right: 10px;
    gap: 4px;
  }
  .map-tool {
    height: 32px;
    padding: 0 8px;
    font-size: 11px;
  }

  .demo-map-note {
    left: 10px;
    bottom: 10px;
    font-size: 10px;
    padding: 4px 8px;
  }

  .detail-summary {
    grid-template-columns: 1fr 1fr;
  }
  .detail-rent-grid {
    grid-template-columns: 1fr;
  }
  .chart-row {
    grid-template-columns: 80px 1fr 50px;
  }

  .dialog-card {
    padding: 16px;
  }
  .dialog-card.wide {
    width: 100vw;
    max-width: 100vw;
    height: calc(100vh - 60px);
    max-height: calc(100vh - 60px);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
  }
}
