:root {
  --bg: #f4f6fb;
  --bg-2: #eef1f8;
  --card: #ffffff;
  --ink: #1a2233;
  --ink-2: #5b6474;
  --ink-3: #929bac;
  --line: #e6eaf2;
  --primary: #2f6bff;
  --primary-2: #5b8cff;
  --primary-soft: #eaf0ff;
  --teal: #12b5a5;
  --amber: #f5a623;
  --rose: #f05d5d;
  --ok: #17b26a;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow: 0 8px 30px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 20px 60px rgba(16, 24, 40, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
    "Segoe UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

[hidden] { display: none !important; }

/* ---------- 通用按钮 ---------- */
.btn {
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  transition: transform 0.08s ease, box-shadow 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 4px 14px rgba(47, 107, 255, 0.28);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(47, 107, 255, 0.36); }
.btn-primary:disabled { opacity: 0.6; cursor: default; }
.btn-ghost { color: var(--ink-2); background: transparent; }
.btn-ghost:hover { background: var(--bg-2); }
.btn-block { width: 100%; padding: 12px; font-size: 15px; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 28px;
  height: 60px; padding: 0 24px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.brand em { font-style: normal; color: var(--ink-3); font-weight: 500; font-size: 13px; }
.brand-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 10px;
  color: #fff; font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--teal));
  box-shadow: 0 4px 12px rgba(47, 107, 255, 0.3);
}
.brand-mark.big { width: 56px; height: 56px; border-radius: 16px; font-size: 26px; }
.nav { display: flex; gap: 6px; flex: 1; }
.nav button {
  border: none; background: transparent; cursor: pointer;
  font-family: inherit; font-size: 14px; font-weight: 600;
  color: var(--ink-2); padding: 8px 14px; border-radius: 8px;
  transition: all 0.15s ease;
}
.nav button:hover { color: var(--ink); background: var(--bg-2); }
.nav button.active { color: var(--primary); background: var(--primary-soft); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 12px; border-radius: 999px;
  background: var(--bg-2); font-size: 13px; color: var(--ink-2);
}
.user-chip .role-tag {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary);
}
.admin-entry { font-size: 13px; color: var(--ink-3); }
.admin-entry:hover { color: var(--ink); background: var(--bg-2); }

/* ---------- 浮层 / 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; place-items: center;
  padding: 20px 16px;
  background: rgba(16, 24, 40, 0.42);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-close {
  position: absolute; top: 14px; right: 16px;
  width: 32px; height: 32px; border: none; border-radius: 50%;
  background: var(--bg-2); color: var(--ink-2); cursor: pointer;
  font-size: 20px; line-height: 1; transition: all 0.15s;
}
.modal-close:hover { background: var(--line); color: var(--ink); }

/* ---------- 管理员登录浮层 ---------- */
.auth-card {
  position: relative;
  width: 100%; max-width: 400px;
  background: var(--card); border-radius: 24px;
  padding: 36px 32px; box-shadow: var(--shadow-lg);
}
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-brand h1 { margin: 14px 0 6px; font-size: 26px; }
.auth-brand em { font-style: normal; color: var(--ink-3); font-weight: 500; font-size: 14px; }
.auth-brand p { margin: 0; color: var(--ink-3); font-size: 14px; }
.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; font-weight: 500; }
.field input {
  width: 100%; padding: 11px 14px; font-size: 15px; font-family: inherit;
  border: 1px solid var(--line); border-radius: 12px; color: var(--ink);
  outline: none; transition: border 0.15s, box-shadow 0.15s;
}
.field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.auth-msg { min-height: 20px; font-size: 13px; color: var(--rose); margin-bottom: 8px; }

/* ---------- 工作区 ---------- */
.workspace {
  display: flex; height: calc(100vh - 60px);
}
.map-pane { flex: 1; position: relative; min-width: 0; }
.map-pane #map { width: 100%; height: 100%; }

/* ---------- 天地图覆盖物（DivIcon） ---------- */
.tdt-div-icon { background: transparent; border: 0; }
.tdt-icon-wrap {
  width: 100%; height: 100%;
  display: flex; align-items: flex-end; justify-content: center;
}
.tdt-price-pill {
  display: inline-block; background: var(--primary); color: #fff;
  padding: 3px 8px; border-radius: 8px; font-size: 12px; font-weight: 600;
  white-space: nowrap; box-shadow: 0 2px 6px rgba(15, 35, 80, 0.25);
}
.tdt-walk-pill {
  display: inline-block; background: #f59e0b; color: #fff;
  padding: 2px 7px; border-radius: 10px; font-size: 11px; font-weight: 600;
  white-space: nowrap; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}
.tdt-start-dot {
  width: 14px; height: 14px; background: #22c55e;
  border: 3px solid #fff; border-radius: 50%;
  box-shadow: 0 0 0 2px #22c55e;
}
.tdt-pick-dot {
  width: 14px; height: 14px; background: var(--primary);
  border: 3px solid #fff; border-radius: 50%;
  box-shadow: 0 0 0 2px var(--primary);
}
.tdt-iw { padding: 4px 2px; max-width: 260px; }
.tdt-iw-sub { color: var(--ink-2); margin-top: 2px; }
.map-hint {
  position: absolute; left: 16px; top: 16px; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(8px);
  font-size: 13px; color: var(--ink-2); box-shadow: var(--shadow);
}
.map-hint .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); animation: pulse 1.6s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(47, 107, 255, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(47, 107, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(47, 107, 255, 0); }
}

/* 聊天面板 */
.side-pane {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  background: var(--card); border-left: 1px solid var(--line);
}
.mode-tabs {
  display: flex; gap: 6px; padding: 12px 16px 0;
  border-bottom: 1px solid var(--line);
}
.mode-tab {
  border: none; background: transparent; cursor: pointer;
  font-family: inherit; font-size: 14px; font-weight: 600;
  color: var(--ink-2); padding: 9px 16px; border-radius: 10px 10px 0 0;
  position: relative; transition: all 0.15s ease;
}
.mode-tab:hover { color: var(--ink); background: var(--bg-2); }
.mode-tab.active { color: var(--primary); }
.mode-tab.active::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px;
  height: 2px; border-radius: 2px; background: var(--primary);
}
.chat-pane {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
}
.chat-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.agent-avatar {
  display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: 12px; color: #fff; font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--teal));
}
.chat-head strong { display: block; font-size: 15px; }
.chat-head small { color: var(--ink-3); font-size: 12px; }
.chat-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.msg { display: flex; }
.msg.user { justify-content: flex-end; }
.bubble {
  max-width: 82%; padding: 12px 16px; border-radius: 16px;
  font-size: 14.5px; line-height: 1.65; white-space: pre-wrap; word-break: break-word;
}
.msg.bot .bubble { background: var(--bg-2); color: var(--ink); border-top-left-radius: 4px; }
.msg.user .bubble { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; border-top-right-radius: 4px; }
.draft-hint {
  margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line);
  font-size: 12px; color: var(--ink-3);
}

/* Markdown 渲染后的气泡排版（分块淡入，保留对话的节奏感） */
.bubble.md { white-space: normal; }
.bubble.md .md-body > * {
  margin: 0 0 8px;
  animation: mdIn .34s cubic-bezier(.22,.61,.36,1) both;
}
.bubble.md .md-body > *:last-child { margin-bottom: 0; }
.bubble.md h1, .bubble.md h2, .bubble.md h3 {
  margin: 12px 0 6px; font-weight: 800; line-height: 1.4;
}
.bubble.md .md-body > h1:first-child,
.bubble.md .md-body > h2:first-child,
.bubble.md .md-body > h3:first-child { margin-top: 0; }
.bubble.md h1 { font-size: 17px; }
.bubble.md h2 { font-size: 16px; }
.bubble.md h3 { font-size: 15px; }
.bubble.md ul, .bubble.md ol { padding-left: 20px; }
.bubble.md li { margin: 3px 0; }
.bubble.md li::marker { color: var(--primary); }
.bubble.md strong { font-weight: 700; }
.bubble.md code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px; padding: 1px 5px; border-radius: 5px;
  background: var(--primary-soft); color: var(--primary);
}
.bubble.md pre {
  margin: 8px 0; padding: 10px 12px; border-radius: 10px;
  background: #0f172a; color: #e2e8f0; overflow-x: auto;
  white-space: pre; font-size: 12.5px; line-height: 1.55;
}
.bubble.md pre code { background: none; color: inherit; padding: 0; font-size: inherit; }
.bubble.md blockquote {
  margin: 8px 0; padding: 2px 0 2px 10px;
  border-left: 3px solid var(--primary); color: var(--ink-2);
}
.bubble.md a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.bubble.md hr { border: none; border-top: 1px dashed var(--line); margin: 10px 0; }
@keyframes mdIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .bubble.md .md-body > * { animation: none; }
}

/* 等待答复时的「正在思考」气泡 */
.typing { display: flex; align-items: center; gap: 10px; }
.typing-text { font-size: 13.5px; color: var(--ink-3); }
.typing-dots { display: inline-flex; align-items: center; gap: 4px; }
.typing-dots i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--primary); opacity: 0.35;
  animation: typing 1.2s infinite ease-in-out;
}
.typing-dots i:nth-child(2) { animation-delay: 0.15s; }
.typing-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.35; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* 快捷选项：比示例 chip 更突出，鼓励直接点击 */
.chip.quick {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}
.chip.quick:hover { background: var(--primary); color: #fff; }

/* 首屏结构化引导：停车类型分步选择 */
.chips .starter { flex: 1 1 100%; }
.starter {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, var(--bg-2));
  border-radius: 14px; padding: 14px;
}
.starter-step {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700; color: var(--ink);
  margin-bottom: 12px;
}
.starter-step .step-no {
  display: grid; place-items: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--primary); color: #fff;
  font-size: 12px; font-weight: 700;
}
.starter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.starter-grid .chip {
  justify-content: center; text-align: center;
  background: #fff; color: var(--ink);
  border-color: var(--line); font-weight: 600;
}
.starter-grid .chip:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.starter-hint { margin-top: 10px; font-size: 12px; color: var(--ink-3); }

@media (prefers-reduced-motion: reduce) {
  .typing-dots i { animation: none; opacity: 0.6; }
  .map-hint .dot { animation: none; }
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: #fff; cursor: pointer;
  padding: 7px 12px; border-radius: 999px; font-size: 13px; color: var(--ink-2);
  transition: all 0.15s;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }

/* 结果卡片 */
.hit-card {
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; box-shadow: var(--shadow-sm);
}
.hit-card .hit-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.hit-card .hit-name { font-weight: 600; font-size: 14.5px; }
.hit-card .hit-price { color: var(--primary); font-weight: 700; white-space: nowrap; }
.hit-card .hit-addr { color: var(--ink-3); font-size: 12.5px; margin-top: 4px; }
.hit-card .hit-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.hit-tag { font-size: 11.5px; padding: 3px 9px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); }
.hit-tag.dist { background: #ecfdf5; color: var(--ok); }
.hit-tag.source { background: #f1f5f9; color: #64748b; }
.hit-tag.free { background: #fef9c3; color: #a16207; }
.hit-card .hit-actions { display: flex; justify-content: flex-end; margin-top: 12px; }
.hit-card .hit-buy { padding: 7px 18px; }

/* 购买二维码弹窗 */
.buy-card {
  position: relative;
  width: 100%; max-width: 360px;
  background: var(--card); border-radius: 24px;
  padding: 28px 28px 24px; box-shadow: var(--shadow-lg);
  text-align: center;
}
.buy-head { display: flex; align-items: center; gap: 12px; text-align: left; margin-bottom: 18px; }
.buy-head h2 { margin: 0; font-size: 19px; }
.buy-sub { margin: 3px 0 0; color: var(--ink-3); font-size: 13px; }
.buy-qr {
  width: 220px; height: 220px; margin: 0 auto;
  border: 1px solid var(--line); border-radius: 16px;
  overflow: hidden; background: #fff;
}
.buy-qr img { width: 100%; height: 100%; object-fit: cover; display: block; }
.buy-tip { margin: 14px 0 0; color: var(--ink-2); font-size: 13.5px; }

.chat-input {
  display: flex; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--line);
}
.chat-input input {
  flex: 1; padding: 12px 16px; font-size: 14.5px; font-family: inherit;
  border: 1px solid var(--line); border-radius: 12px; outline: none; color: var(--ink);
  transition: border 0.15s, box-shadow 0.15s;
}
.chat-input input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* ---------- 自助筛选 ---------- */
.filter-pane {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column; overflow: hidden;
}
.filter-form {
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 14px;
}
.filter-fields { display: flex; flex-direction: column; gap: 10px; }
.filter-fields .field { margin-bottom: 0; }
.filter-fields input[type="number"] {
  width: 100%; padding: 8px 12px; font-size: 14px; font-family: inherit;
  border: 1px solid var(--line); border-radius: 10px; color: var(--ink);
  outline: none; transition: border 0.15s, box-shadow 0.15s;
}
.filter-fields input[type="number"]:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* 三行筛选布局：每行两列，全场跨行用 field-full */
.filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.filter-row .field-full { grid-column: 1 / -1; }
.input-suffix { display: flex; align-items: center; gap: 8px; }
.input-suffix input { flex: 1; min-width: 0; }
.input-suffix .suffix { margin: 0; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.price-inputs { display: flex; align-items: center; gap: 8px; }
.price-inputs input { flex: 1; min-width: 0; }
.price-inputs .dash { margin: 0; color: var(--ink-3); }
/* 停车场景 + 价格区间合并为一行 */
.combo-field { display: flex; align-items: center; gap: 14px; }
.combo-field .combo-sec { display: flex; flex-direction: column; gap: 8px; }
.combo-field .combo-sec:first-child { flex: 1; min-width: 0; }
.combo-field .price-sec { flex-shrink: 0; width: 200px; }
.combo-field .combo-title { font-size: 13px; color: var(--ink-2); }
.combo-field .price-inputs input { flex: 1; min-width: 0; }
.filter-meta { padding: 10px 20px 0; font-size: 12.5px; color: var(--ink-3); }
.filter-list {
  flex: 1; overflow-y: auto; padding: 16px 20px 20px;
  display: flex; flex-direction: column; gap: 12px;
}
.filter-empty { text-align: center; color: var(--ink-3); font-size: 14px; padding: 48px 12px; }
/* 分页 */
.filter-pager {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 20px; border-top: 1px solid var(--line);
}
.filter-pager:empty { display: none; }
.page-btn {
  padding: 6px 14px; font-size: 13px; font-family: inherit; cursor: pointer;
  color: var(--ink-2); background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 8px; transition: all 0.15s;
}
.page-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.page-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.page-info { font-size: 12.5px; color: var(--ink-3); }

/* 场景按钮组 */
.scenario-group { display: flex; flex-wrap: wrap; gap: 8px; }
.scenario-chip {
  padding: 7px 14px; font-size: 13.5px; font-family: inherit; cursor: pointer;
  color: var(--ink-2); background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 999px; transition: all 0.15s;
}
.scenario-chip:hover { border-color: var(--primary); color: var(--primary); }
.scenario-chip.active {
  color: #fff; background: var(--primary); border-color: var(--primary);
}

/* 字段标题 + 当前值 */
.field .field-head { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.field-val { font-style: normal; font-size: 12.5px; color: var(--primary); font-weight: 600; }

/* 位置输入与候选列表 */
.loc-row { display: flex; gap: 8px; margin-top: 8px; }
.loc-row .loc-input { flex: 1; min-width: 0; padding: 7px 12px; font-size: 13.5px; }
.loc-row .btn { flex-shrink: 0; }
.loc-candidates {
  margin-top: 8px; display: flex; flex-direction: column; gap: 6px;
  max-height: 180px; overflow-y: auto;
}
.loc-cand {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 8px 12px; text-align: left; cursor: pointer;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
  font-family: inherit; transition: border-color 0.15s, background 0.15s;
}
.loc-cand:hover { border-color: var(--primary); background: #fff; }
.loc-cand-name { font-size: 13.5px; color: var(--ink); font-weight: 600; }
.loc-cand-addr { font-size: 12px; color: var(--ink-3); }

/* ---------- 管理端 ---------- */
.workspace.admin { display: block; padding: 24px 32px; overflow-y: auto; height: calc(100vh - 60px); }
.admin-grid { max-width: 1200px; margin: 0 auto; display: grid; gap: 20px; }
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 22px 24px;
  border: 1px solid var(--line);
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-head h2 { margin: 0; font-size: 17px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat {
  background: linear-gradient(135deg, var(--primary-soft), #fff);
  border-radius: 14px; padding: 18px 20px; border: 1px solid var(--line);
}
.stat .num { font-size: 30px; font-weight: 800; color: var(--primary); }
.stat .label { font-size: 13px; color: var(--ink-2); margin-top: 2px; }

.source-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.source-item {
  border: 1px solid var(--line); border-radius: 12px; padding: 14px;
  cursor: pointer; transition: all 0.15s;
}
.source-item:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.source-item .s-name { font-weight: 600; font-size: 14px; }
.source-item .s-id { font-size: 12px; color: var(--ink-3); }
.source-item .s-count { font-size: 13px; color: var(--ink-2); margin-top: 6px; }
.source-item.running { border-color: var(--primary); animation: glow 1.2s infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 4px var(--primary-soft); } }

.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); }
.table th { color: var(--ink-3); font-weight: 600; font-size: 12.5px; }
.table tr:last-child td { border-bottom: none; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.ok { background: #ecfdf5; color: var(--ok); }
.badge.fail { background: #fef2f2; color: var(--rose); }
.badge.run { background: var(--primary-soft); color: var(--primary); }

.muted { color: var(--ink-3); font-size: 13.5px; margin: 0 0 16px; }
.cred-form { display: flex; flex-direction: column; gap: 12px; max-width: 720px; }
.select {
  padding: 11px 14px; font-size: 14px; font-family: inherit;
  border: 1px solid var(--line); border-radius: 12px; color: var(--ink); outline: none; background: #fff;
}
.cred-form textarea {
  padding: 12px 14px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px;
  border: 1px solid var(--line); border-radius: 12px; resize: vertical; outline: none; color: var(--ink);
  line-height: 1.5;
}
.cred-form textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.cred-form .btn { align-self: flex-start; }
.cred-keys { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.cred-key { font-size: 12.5px; padding: 5px 12px; border-radius: 999px; background: var(--bg-2); color: var(--ink-2); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 12px 22px; border-radius: 12px;
  font-size: 14px; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none;
  transition: all 0.25s ease; z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .chat-pane { flex: 1; }
}

/* 手机端：整体按移动 App 标准打磨（含安全区、动态视口、键盘避让） */
@media (max-width: 720px) {
  /* 顶栏收纳：只留 logo、导航与管理员入口，缩小触控间距 */
  .topbar { gap: 6px; padding: 0 12px; height: 56px; }
  .brand { gap: 0; }
  .brand-name { display: none; }
  .nav { gap: 2px; }
  .nav button { padding: 7px 9px; font-size: 13px; }
  .admin-entry { font-size: 12px; padding: 8px 10px; }
  #logout-btn { font-size: 12px; padding: 8px 10px; }

  /* 工作区：上下布局；dvh 规避 iOS 地址栏，聊天区用 flex 自动避让键盘 */
  .workspace {
    flex-direction: column;
    height: calc(100vh - 56px);
    height: calc(100dvh - 56px);
  }
  .map-pane { height: 42vh; height: 42dvh; flex: none; }
  .side-pane { width: 100%; flex: 1; height: auto; min-height: 0; overflow-y: auto; }
  /* 移动端：筛选区 + 列表作为整体在侧栏内纵向滚动，列表按内容自然展开，
     避免桌面式「列表内部滚动」在窄屏下被表单挤压到 0 高度、导致搜索后看不到结果。 */
  .filter-pane { flex: none; min-height: 0; overflow: visible; }
  .filter-list { flex: none; overflow: visible; }

  /* 聊天区收窄内边距、放大气泡占比 */
  .chat-head { padding: 14px 16px; }
  .chat-body { padding: 16px; }
  .bubble { max-width: 88%; }
  .chat-input {
    padding: 12px 14px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }

  /* 结果卡片与首屏引导收紧 */
  .hit-card { padding: 12px 14px; }
  .starter-grid { gap: 6px; }

  /* 弹窗适配窄屏 */
  .modal-mask { padding: 16px; }
  .auth-card { padding: 28px 22px; }
  .buy-card { padding: 24px 20px 20px; }

  /* 顶栏右侧登录后收窄：移动端隐藏昵称芯片，仅保留退出 */
  .user-chip { display: none; }

  /* 管理端单列 */
  .stats { grid-template-columns: 1fr; }
  .workspace.admin {
    padding: 16px;
    height: calc(100vh - 56px);
    height: calc(100dvh - 56px);
  }

  /* Toast 避开底部安全区 */
  .toast { bottom: calc(24px + env(safe-area-inset-bottom)); }
}

/* 超窄屏（小屏手机）：引导网格仍保持两列、气泡更宽 */
@media (max-width: 380px) {
  .bubble { max-width: 94%; }
  .starter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav button { padding: 7px 7px; }
  .admin-entry, #logout-btn { padding: 8px 8px; }
}