:root {
  --brand: #1791fc;
  --brand-dark: #0f7ad9;
  --ok: #0a8f4c;
  --bad: #e0483a;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #e6ebf2;
  --canvas: #f6f8fb;
  --surface: #ffffff;
  --shadow-1: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-2: 0 10px 30px -12px rgba(15, 23, 42, .18);
  --shadow-3: 0 24px 60px -20px rgba(15, 23, 42, .28);
  --r-lg: 18px;
  --r-md: 14px;
  --r-sm: 10px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, p { margin: 0; }
button { font: inherit; }

.app {
  display: flex;
  height: 100dvh;
  min-height: 100dvh;
}

/* ───────── 地图 ───────── */
.map-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  z-index: 1;
  background: #e8eef6;
}
#map { position: absolute; inset: 0; }

.brand-card {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 10px;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 16px;
  box-shadow: var(--shadow-2);
  max-width: calc(100% - 40px);
}
.brand-card .logo {
  width: 40px; height: 40px; flex: none;
  border-radius: 12px;
  display: grid; place-items: center;
  color: #fff; font-size: 18px; font-weight: 700;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  box-shadow: 0 6px 16px -4px color-mix(in srgb, var(--brand) 55%, transparent);
}
.brand-text h1 { font-size: 16px; line-height: 1.25; letter-spacing: .2px; }
.brand-text p { margin-top: 2px; font-size: 12px; color: var(--muted); }
.intro-btn {
  margin-left: 4px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.intro-btn:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); color: var(--brand); }

.locate {
  position: absolute;
  right: 18px;
  bottom: 96px;
  z-index: 500;
  width: 46px; height: 46px;
  display: grid; place-items: center;
  background: #fff;
  color: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-2);
  cursor: pointer;
  transition: transform .15s, color .15s;
}
.locate:hover { color: var(--brand); transform: translateY(-2px); }

.legend {
  position: absolute;
  left: 20px;
  bottom: 26px;
  z-index: 500;
  display: flex;
  gap: 14px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 12px;
  color: var(--ink-2);
  box-shadow: var(--shadow-1);
}
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 10px; border-radius: 3px; display: inline-block; }

/* ───────── 面板 ───────── */
.panel {
  width: 420px;
  flex: none;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  box-shadow: -6px 0 32px rgba(15, 23, 42, .05);
  z-index: 2;
}
.panel-head { padding: 26px 22px 14px; border-bottom: 1px solid var(--line); }
.panel-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.panel-title-row h2 { font-size: 19px; letter-spacing: .2px; }
.pill {
  font-size: 12px;
  color: var(--muted);
  background: #f1f5f9;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.pill.ok { color: var(--ok); background: #eafaf1; }
.panel-tip { margin-top: 8px; font-size: 13px; color: var(--muted); line-height: 1.6; }

.city-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.city-tab {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
}
.city-tab:hover { border-color: #cbd5e1; }
.city-tab.active {
  background: color-mix(in srgb, var(--brand) 10%, #fff);
  border-color: color-mix(in srgb, var(--brand) 45%, #fff);
  color: var(--brand);
  font-weight: 600;
}

.list { flex: 1; overflow-y: auto; padding: 14px 18px 20px; }
.list::-webkit-scrollbar { width: 6px; }
.list::-webkit-scrollbar-thumb { background: #d7e0ea; border-radius: 6px; }

.card {
  position: relative;
  padding: 16px;
  margin-bottom: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.card::before {
  content: "";
  position: absolute; left: 0; top: 14px; bottom: 14px;
  width: 3px; border-radius: 0 3px 3px 0;
  background: var(--brand);
  opacity: 0;
  transition: opacity .18s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: #d6e0ec; }
.card.active {
  border-color: color-mix(in srgb, var(--brand) 50%, #fff);
  background: color-mix(in srgb, var(--brand) 4%, #fff);
  box-shadow: 0 8px 22px -10px color-mix(in srgb, var(--brand) 45%, transparent);
}
.card.active::before { opacity: 1; }

.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card-name { font-size: 15px; font-weight: 650; letter-spacing: .2px; }
.dist {
  flex: none;
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--brand) 10%, #fff);
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}
.card-meta { margin-top: 6px; font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag {
  font-size: 11.5px;
  color: var(--ink-2);
  background: #f4f7fb;
  border: 1px solid #eef2f7;
  padding: 3px 8px;
  border-radius: 6px;
}
.card-cta {
  margin-top: 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.card-cta svg { transition: transform .15s; }
.card:hover .card-cta svg { transform: translateX(2px); }

.empty { padding: 40px 10px; text-align: center; color: var(--faint); font-size: 13px; }

.panel-foot { padding: 12px 20px 16px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--faint); line-height: 1.6; }

/* ───────── 弹窗 ───────── */
.modal, .sheet {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-mask { position: absolute; inset: 0; background: rgba(15, 23, 42, .45); backdrop-filter: blur(3px); }

.modal-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  max-height: 90dvh;
  overflow-y: auto;
  background: #fff;
  border-radius: 22px;
  padding: 24px;
  box-shadow: var(--shadow-3);
  animation: pop .22s ease-out;
}
@keyframes pop { from { transform: translateY(14px) scale(.97); opacity: 0; } }

.modal-x {
  position: absolute;
  top: 14px; right: 14px;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: #f1f5f9; color: var(--muted);
  cursor: pointer;
}
.modal-x:hover { background: #e8eef6; color: var(--ink); }
.modal-x.static { position: static; }

.station-chip {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--brand) 7%, #fff);
  border: 1px solid color-mix(in srgb, var(--brand) 18%, #fff);
}
.chip-icon { color: var(--brand); margin-top: 1px; }
.chip-name { font-weight: 650; font-size: 14px; }
.chip-desc { margin-top: 2px; font-size: 12px; color: var(--muted); }

#formTitle { margin-top: 18px; font-size: 18px; }
.form-sub { margin-top: 4px; font-size: 13px; color: var(--muted); }

.field { display: block; margin-top: 14px; }
.field span { display: block; margin-bottom: 6px; font-size: 13px; color: var(--ink-2); font-weight: 500; }
.field input {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  color: var(--ink);
  background: #f8fafc;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.field input:focus {
  background: #fff;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent);
}
.field input.invalid { border-color: var(--bad); }

.form-err { min-height: 18px; margin-top: 8px; font-size: 12.5px; color: var(--bad); }

.submit {
  width: 100%;
  margin-top: 6px;
  padding: 13px;
  border: 0;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
  transition: background .15s, transform .15s;
}
.submit:hover { background: var(--brand-dark); }
.submit:disabled { opacity: .7; cursor: default; }
.submit.ghost { background: #f1f5f9; color: var(--ink-2); }
.submit.ghost:hover { background: #e8eef6; }

.consent { margin-top: 12px; font-size: 11.5px; color: var(--faint); text-align: center; line-height: 1.6; }

.done { padding: 10px 4px 4px; text-align: center; }
.tick {
  width: 62px; height: 62px; margin: 0 auto 14px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: #eafaf1; color: var(--ok);
}
.done h3 { font-size: 18px; }
.done p { margin: 8px 0 18px; font-size: 13px; color: var(--muted); line-height: 1.7; }

/* ───────── 公司介绍 ───────── */
.sheet-card {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 86dvh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 22px;
  box-shadow: var(--shadow-3);
  animation: pop .22s ease-out;
}
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 22px 12px;
  border-bottom: 1px solid var(--line);
}
.sheet-head h3 { font-size: 17px; }
.sheet-body { padding: 20px 22px 26px; overflow-y: auto; }
.sheet-body p { font-size: 14px; line-height: 1.85; color: var(--ink-2); }
.sheet-body h4 { margin: 18px 0 8px; font-size: 14px; color: var(--ink); }
.sheet-body ul { margin: 8px 0 0; padding-left: 20px; }
.sheet-body li { font-size: 13.5px; line-height: 1.9; color: var(--ink-2); }
.stats { display: flex; gap: 12px; margin: 16px 0 4px; }
.stat {
  flex: 1;
  padding: 12px;
  text-align: center;
  background: var(--canvas);
  border-radius: 12px;
}
.stat b { display: block; font-size: 20px; color: var(--brand); font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }
.notice {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff8e8;
  border: 1px solid #fde9c4;
  color: #8a5a00;
  font-size: 13px;
  line-height: 1.7;
}
.hr { height: 1px; background: var(--line); margin: 18px 0; }

/* ───────── 提示 ───────── */
.toast {
  position: fixed;
  top: 22px; left: 50%;
  transform: translate(-50%, -12px);
  z-index: 3000;
  padding: 10px 18px;
  border-radius: 12px;
  background: rgba(15, 23, 42, .92);
  color: #fff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Leaflet 微调 */
.leaflet-container { font: inherit; background: #e8eef6; }
.leaflet-control-attribution {
  background: rgba(255, 255, 255, .8) !important;
  font-size: 10px !important;
  padding: 0 6px !important;
  border-radius: 6px 0 0 0;
}
.leaflet-control-zoom a { border-radius: 8px !important; }
.station-pin {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  background: var(--brand);
  color: #fff;
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 6px 16px -4px rgba(15, 23, 42, .45);
  font-size: 13px; font-weight: 700;
}
.station-pin span { transform: rotate(45deg); }
.station-pin.is-active { background: var(--brand-dark); box-shadow: 0 0 0 6px color-mix(in srgb, var(--brand) 22%, transparent); }

/* ───────── 移动端 ───────── */
@media (max-width: 900px) {
  .app { flex-direction: column; height: auto; min-height: 100dvh; }
  .map-wrap { height: 46dvh; min-height: 300px; flex: none; }
  .panel { width: 100%; box-shadow: none; border-radius: 20px 20px 0 0; margin-top: -18px; position: relative; }
  .panel-head { padding: 18px 16px 12px; }
  .list { padding: 12px 12px 8px; }
  .panel-foot { padding: 10px 16px 18px; }
  .brand-card { top: 12px; left: 12px; padding: 8px; }
  .brand-card .logo { width: 34px; height: 34px; font-size: 15px; }
  .brand-text h1 { font-size: 14px; }
  .brand-text p { font-size: 11px; }
  .intro-btn { padding: 5px 9px; font-size: 11px; }
  .legend { left: 12px; bottom: 28px; font-size: 11px; padding: 6px 10px; gap: 10px; }
  .locate { right: 12px; bottom: 92px; width: 42px; height: 42px; }
  .modal, .sheet { align-items: flex-end; padding: 0; }
  .modal-card, .sheet-card {
    max-width: 100%;
    border-radius: 22px 22px 0 0;
    max-height: 92dvh;
    animation: slideUp .24s ease-out;
  }
  .modal-card { padding: 22px 18px 26px; }
  .sheet-card { max-height: 88dvh; }
}
@keyframes slideUp { from { transform: translateY(40px); opacity: .6; } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
