/* ===========================================================
   旅行小管家 · 移动端优先样式
   设计：暖沙底色 + 深青主色，卡片圆角，信息密度适中
   =========================================================== */

:root {
  --bg: #f5f2ec;
  --bg-grad: radial-gradient(1200px 600px at 50% -200px, #e8f3f0 0%, rgba(232, 243, 240, 0) 60%), #f5f2ec;
  --surface: #ffffff;
  --surface-2: #fbf9f5;
  --surface-3: #f2eee7;
  --ink: #1c1917;
  --ink-2: #4b4642;
  --ink-3: #857e76;
  --line: #e6e0d6;
  --line-strong: #d6cec1;
  --brand: #0f766e;
  --brand-ink: #0b5d57;
  --brand-soft: #e4f2ef;
  --brand-soft-2: #d3ebe7;
  --accent: #b45309;
  --accent-soft: #fdf0e4;
  --danger: #b91c1c;
  --danger-soft: #fdeaea;
  --ok: #15803d;
  --shadow-sm: 0 1px 2px rgba(28, 25, 23, 0.05);
  --shadow: 0 2px 6px rgba(28, 25, 23, 0.06), 0 12px 32px -18px rgba(28, 25, 23, 0.28);
  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --header-h: 60px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14120f;
    --bg-grad: radial-gradient(1200px 600px at 50% -200px, #123230 0%, rgba(18, 50, 48, 0) 60%), #14120f;
    --surface: #1f1c19;
    --surface-2: #262220;
    --surface-3: #2e2a26;
    --ink: #f5f1ea;
    --ink-2: #cfc7bd;
    --ink-3: #9c948a;
    --line: #332e29;
    --line-strong: #443d36;
    --brand: #2dd4bf;
    --brand-ink: #5eead4;
    --brand-soft: #123b38;
    --brand-soft-2: #17504b;
    --accent: #fbbf24;
    --accent-soft: #3a2c12;
    --danger: #f87171;
    --danger-soft: #3f1d1d;
    --ok: #4ade80;
    --shadow: 0 2px 6px rgba(0, 0, 0, 0.4), 0 12px 32px -18px rgba(0, 0, 0, 0.8);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

/* 兜底：保证任何带 hidden 的元素都不显示（防止组件 display 覆盖 UA 规则） */
[hidden] { display: none !important; }

body {
  margin: 0;
  overflow-x: hidden;
  font-family: var(--font);
  background: var(--bg-grad);
  background-attachment: fixed;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.35; }
p { margin: 0; }

#app {
  max-width: 760px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------------- 顶栏 ---------------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(var(--safe-top) + 8px) 16px 8px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: 0;
  padding: 4px 2px;
  text-align: left;
  border-radius: 12px;
}
.brand:active { background: var(--surface-3); }
.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font-size: 19px;
  background: var(--brand-soft);
  border-radius: 11px;
  box-shadow: inset 0 0 0 1px var(--brand-soft-2);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: 0.2px; }
.brand-sub { font-size: 11px; color: var(--ink-3); margin-top: 2px; }

.header-actions { display: flex; align-items: center; gap: 6px; }

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  display: grid;
  place-items: center;
  font-size: 17px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, background 0.12s ease;
}
.icon-btn:active { transform: scale(0.94); background: var(--surface-3); }

/* ---------------- 视图 ---------------- */
main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.view { flex: 1; display: flex; flex-direction: column; padding: 14px 16px calc(24px + var(--safe-bottom)); }
.view[hidden] { display: none !important; }

/* ---------------- 聊天气泡 ---------------- */
.chat-stream {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 6px 2px 16px;
  min-height: 40vh;
}

.msg {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  animation: msg-in 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.msg-avatar {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 16px;
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--brand-soft-2);
}
.msg-bubble {
  max-width: min(86%, 460px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px 16px 16px 16px;
  padding: 10px 13px;
  box-shadow: var(--shadow-sm);
  white-space: normal;
  word-break: break-word;
}
.msg-bubble strong { color: var(--brand-ink); font-weight: 650; }
.msg-bubble .muted { color: var(--ink-3); font-size: 13px; }
.msg-user { justify-content: flex-end; }
.msg-user .msg-bubble {
  background: var(--brand);
  color: #fff;
  border-color: transparent;
  border-radius: 16px 4px 16px 16px;
}
@media (prefers-color-scheme: dark) {
  .msg-user .msg-bubble { background: var(--brand-soft-2); color: var(--ink); }
}
.msg-user .msg-avatar { order: 2; background: var(--surface-3); }

.typing { display: inline-flex; gap: 4px; align-items: center; height: 18px; }
.typing i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink-3);
  animation: bounce 1.2s infinite;
}
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* 操作卡片 */
.action-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  animation: msg-in 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.action-card + .action-card { margin-top: 0; }
.action-title { font-weight: 650; font-size: 14px; margin-bottom: 10px; color: var(--ink); }
.action-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 8px; }

.chip-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 13.5px;
  color: var(--ink-2);
  transition: all 0.14s ease;
  line-height: 1.3;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.chip:hover { border-color: var(--brand); color: var(--brand-ink); }
.chip:active { transform: scale(0.96); }
.chip .chip-hint { font-size: 11px; color: var(--ink-3); }
.chip.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.chip.is-active .chip-hint { color: rgba(255, 255, 255, 0.8); }
@media (prefers-color-scheme: dark) {
  .chip.is-active { color: #062a27; }
  .chip.is-active .chip-hint { color: rgba(6, 42, 39, 0.7); }
}

/* 输入 / 选择 */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field-label { font-size: 12.5px; color: var(--ink-3); font-weight: 550; }
.field-hint { font-size: 11.5px; color: var(--ink-3); line-height: 1.45; }
.field input, .field select, .field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14.5px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.field-row { display: flex; gap: 10px; }
.field-half { flex: 1; }
input[type="date"] { min-height: 42px; }

/* 按钮 */
.btn {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 14.5px;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--ink);
  transition: transform 0.12s ease, filter 0.12s ease, background 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
}
.btn:active { transform: scale(0.975); }
.btn:disabled { opacity: 0.55; pointer-events: none; }
.btn-primary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 92%, white), var(--brand));
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset, 0 6px 16px -8px rgba(15, 118, 110, 0.7);
}
@media (prefers-color-scheme: dark) {
  .btn-primary { color: #062a27; }
}
.btn-ghost {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink-2);
}
.btn-ghost:hover { border-color: var(--brand); color: var(--brand-ink); }
.btn-danger-ghost {
  background: transparent;
  border-color: color-mix(in srgb, var(--danger) 40%, var(--line));
  color: var(--danger);
}
.btn-block { width: 100%; margin-top: 10px; }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: 13px; border-radius: 10px; }

/* 底部操作区 */
.wizard-dock {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  padding: 10px 0 calc(6px + var(--safe-bottom));
  background: linear-gradient(to top, var(--bg) 60%, color-mix(in srgb, var(--bg) 0%, transparent));
}
.wizard-dock .action-card { box-shadow: var(--shadow); }

/* ---------------- 生成中 ---------------- */
.gen-panel {
  margin: 8px 0 16px;
  padding: 22px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.gen-title { font-weight: 700; font-size: 16px; }
.gen-status { color: var(--ink-2); font-size: 13.5px; min-height: 20px; }
.gen-hint { color: var(--ink-3); font-size: 12px; }
.gen-bar {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
  margin: 6px 0 2px;
}
.gen-bar i {
  display: block;
  height: 100%;
  width: 5%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), #2dd4bf);
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.gen-orbit {
  position: relative;
  width: 54px;
  height: 54px;
  margin-bottom: 4px;
}
.gen-orbit span {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--brand);
  animation: spin 1.4s linear infinite;
}
.gen-orbit span:nth-child(2) { inset: 7px; border-top-color: color-mix(in srgb, var(--brand) 55%, transparent); animation-duration: 1.1s; animation-direction: reverse; }
.gen-orbit span:nth-child(3) { inset: 14px; border-top-color: color-mix(in srgb, var(--brand) 30%, transparent); animation-duration: 0.9s; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- 行程内容 ---------------- */
#plan-content { display: flex; flex-direction: column; gap: 14px; }

.plan-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  padding: 18px;
  color: #fff;
  background: linear-gradient(135deg, #0f5f5a 0%, #0f766e 45%, #0e7490 100%);
  box-shadow: var(--shadow);
}
.plan-hero::after {
  content: "";
  position: absolute;
  right: -60px;
  top: -70px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
}
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: relative; z-index: 1; }
.hero-kicker { font-size: 11.5px; letter-spacing: 1.2px; text-transform: uppercase; opacity: 0.78; }
.hero-title { font-size: 24px; font-weight: 750; margin-top: 2px; letter-spacing: 0.3px; }
.hero-title small { font-size: 14px; font-weight: 500; opacity: 0.85; margin-left: 6px; }
.hero-line { margin-top: 6px; font-size: 13px; opacity: 0.92; position: relative; z-index: 1; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; position: relative; z-index: 1; }
.hero-pill {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  backdrop-filter: blur(4px);
}
.hero-actions { display: flex; gap: 8px; margin-top: 14px; position: relative; z-index: 1; }
.hero-actions .btn {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  min-height: 36px;
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 10px;
  backdrop-filter: blur(4px);
}
.hero-actions .btn:hover { background: rgba(255, 255, 255, 0.28); }

.section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px;
  box-shadow: var(--shadow-sm);
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.section-title { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 7px; }
.section-note { font-size: 11.5px; color: var(--ink-3); }

/* 天气 */
.weather-scroll { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.weather-scroll::-webkit-scrollbar { display: none; }
.weather-card {
  flex: 0 0 auto;
  width: 78px;
  padding: 10px 6px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.weather-card.is-bad { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); background: var(--accent-soft); }
.weather-day { font-size: 11.5px; color: var(--ink-3); }
.weather-icon { font-size: 21px; line-height: 1.3; }
.weather-temp { font-size: 12.5px; font-weight: 650; }
.weather-rain { font-size: 10.5px; color: var(--ink-3); }
.weather-tip { margin-top: 10px; font-size: 12.5px; color: var(--ink-2); background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }

/* 到达交通 */
.arrival-list { display: flex; flex-direction: column; gap: 9px; }
.arrival-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: var(--surface-2);
}
.arrival-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.arrival-mode { font-weight: 700; font-size: 14.5px; display: flex; align-items: center; gap: 6px; white-space: nowrap; flex: 0 0 auto; }
.arrival-price { font-weight: 700; color: var(--brand-ink); font-size: 13.5px; white-space: normal; text-align: right; flex: 1 1 auto; line-height: 1.4; }
.arrival-route { font-size: 12.5px; color: var(--ink-2); margin-top: 4px; }
.arrival-duration { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.arrival-detail { display: flex; flex-direction: column; gap: 3px; margin-top: 7px; font-size: 12px; color: var(--ink-2); }
.arrival-pro { color: var(--ink-2); }
.arrival-con { color: var(--ink-3); }
.arrival-hint { margin-top: 8px; font-size: 12px; color: var(--ink-3); background: var(--surface); border-radius: 8px; padding: 6px 8px; }

/* 每日行程 */
.day-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.day-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  background: none;
  border: 0;
  text-align: left;
}
.day-badge {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  display: grid;
  place-items: center;
  font-weight: 750;
  font-size: 15px;
  line-height: 1;
  flex-direction: column;
}
.day-badge small { font-size: 9.5px; font-weight: 600; opacity: 0.8; margin-top: 1px; }
.day-titles { flex: 1; min-width: 0; }
.day-theme { font-weight: 680; font-size: 14.5px; }
.day-sub { font-size: 12px; color: var(--ink-3); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-chevron { color: var(--ink-3); font-size: 12px; transition: transform 0.2s ease; }
.day-card.is-open .day-chevron { transform: rotate(180deg); }
.day-body { padding: 0 14px 14px; display: none; }
.day-card.is-open .day-body { display: block; }
.day-weather {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--ink-2);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 3px 9px;
  margin-bottom: 10px;
}

.timeline { position: relative; padding-left: 18px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(to bottom, var(--brand-soft-2), var(--line));
  border-radius: 2px;
}
.tl-item { position: relative; padding: 0 0 14px 0; }
.tl-item:last-child { padding-bottom: 2px; }
.tl-item::before {
  content: "";
  position: absolute;
  left: -17px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surface);
  border: 2.5px solid var(--brand);
}
.tl-item[data-type="food"]::before { border-color: var(--accent); }
.tl-item[data-type="transport"]::before { border-color: var(--ink-3); }
.tl-time { font-size: 11.5px; color: var(--brand-ink); font-weight: 650; letter-spacing: 0.4px; }
.tl-title { font-weight: 640; font-size: 14.5px; margin-top: 1px; }
.tl-meta { display: flex; flex-wrap: wrap; gap: 4px 8px; margin-top: 4px; font-size: 11.5px; color: var(--ink-3); }
.tl-meta span { display: inline-flex; align-items: center; gap: 3px; }
.tl-note {
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-2);
  background: var(--surface-2);
  border-radius: 8px;
  padding: 6px 9px;
  border-left: 2px solid var(--brand-soft-2);
}
.tl-note.warn { border-left-color: var(--accent); background: var(--accent-soft); }
.tl-tip { margin-top: 4px; font-size: 12px; color: var(--ink-3); }
.tl-tip::before { content: "💡 "; }

.meal-row, .hotel-row {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 9px 0;
  border-top: 1px dashed var(--line);
  font-size: 13px;
}
.meal-row:first-child, .hotel-row:first-child { border-top: 0; }
.meal-label {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 650;
  color: var(--brand-ink);
  background: var(--brand-soft);
  border-radius: 6px;
  padding: 1px 6px;
  margin-top: 2px;
}
.meal-main { flex: 1; min-width: 0; }
.meal-name { font-weight: 600; }
.meal-meta { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.day-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-3);
}
.day-budget { font-weight: 650; color: var(--ink-2); }

/* 推荐卡片 */
.card-grid { display: grid; grid-template-columns: 1fr; gap: 9px; }
@media (min-width: 560px) { .card-grid { grid-template-columns: 1fr 1fr; } }
.poi-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 12px;
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.poi-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.poi-name { font-weight: 650; font-size: 14px; }
.poi-price { font-size: 12.5px; color: var(--brand-ink); font-weight: 650; white-space: nowrap; }
.poi-sub { font-size: 12px; color: var(--ink-3); }
.poi-why { font-size: 12.5px; color: var(--ink-2); }
.poi-tip { font-size: 12px; color: var(--ink-3); }
.poi-tip::before { content: "💡 "; }

/* 预算 */
.budget-total {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 2px 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}
.budget-big { font-size: 26px; font-weight: 780; letter-spacing: -0.5px; }
.budget-big small { font-size: 12px; font-weight: 500; color: var(--ink-3); margin-left: 4px; }
.budget-side { text-align: right; font-size: 12px; color: var(--ink-3); line-height: 1.5; }
.budget-side b { color: var(--ink); font-size: 14px; }
.budget-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.budget-icon { width: 22px; text-align: center; }
.budget-name { flex: 0 0 66px; font-size: 13px; color: var(--ink-2); }
.budget-track { flex: 1; height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.budget-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), #2dd4bf);
  transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.budget-value { flex: 0 0 auto; font-size: 12.5px; font-weight: 650; min-width: 68px; text-align: right; }
.budget-value small { color: var(--ink-3); font-weight: 500; }
.budget-note { margin-top: 10px; font-size: 12px; color: var(--ink-3); }

/* 清单 */
.list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.list li { position: relative; padding-left: 18px; font-size: 13px; color: var(--ink-2); }
.list li::before { content: "✓"; position: absolute; left: 0; color: var(--brand); font-weight: 700; }
.list.warn li::before { content: "!"; color: var(--accent); font-weight: 800; width: 14px; }
.list.tips li::before { content: "·"; color: var(--ink-3); font-size: 20px; line-height: 1; top: -2px; }

.source-line {
  font-size: 11px;
  color: var(--ink-3);
  text-align: center;
  padding: 2px 0 8px;
  line-height: 1.6;
}
.source-line .badge {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 7px;
  margin: 0 2px;
  background: var(--surface);
}

/* ---------------- 追问 ---------------- */
.chat-dock { margin-top: 8px; }
.followup-panel {
  margin-top: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.followup-history {
  max-height: 300px;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.followup-history:empty { display: none; }
.composer {
  display: flex;
  gap: 8px;
  padding: 9px;
  align-items: flex-end;
}
.composer textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface-2);
  padding: 9px 11px;
  font-size: 14px;
  max-height: 120px;
  min-height: 42px;
  outline: none;
}
.composer textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.composer .btn { flex: 0 0 auto; min-width: 64px; }

/* ---------------- 错误 ---------------- */
.error-panel {
  margin: 10px 0;
  padding: 18px;
  background: var(--danger-soft);
  border: 1px solid color-mix(in srgb, var(--danger) 25%, var(--line));
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.error-panel h2 { font-size: 16px; color: var(--danger); }
.error-panel p { font-size: 13px; color: var(--ink-2); white-space: pre-wrap; }
.error-actions { display: flex; gap: 8px; margin-top: 6px; }

/* ---------------- 设置 ---------------- */
.settings { display: flex; flex-direction: column; gap: 12px; padding-bottom: 10px; }
.view-title { font-size: 22px; font-weight: 750; }
.view-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px;
  box-shadow: var(--shadow-sm);
}
.card-title { font-size: 14.5px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.card-note { font-size: 12px; color: var(--ink-3); margin: 8px 0; line-height: 1.55; }
.row-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.test-result { font-size: 12.5px; }
.test-result.ok { color: var(--ok); }
.test-result.err { color: var(--danger); }

/* ---------------- 提示 ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + var(--safe-bottom));
  transform: translate(-50%, 20px);
  background: color-mix(in srgb, var(--ink) 92%, transparent);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 90;
  max-width: min(88vw, 420px);
  text-align: center;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* 离线提示条 */
.offline-bar {
  background: var(--accent-soft);
  color: var(--ink-2);
  font-size: 12.5px;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line));
}

/* ---------------- 家庭密码登录 ---------------- */
.view-login { justify-content: center; padding-top: calc(6vh + var(--safe-top)); }
.login-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0 28px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px 22px 20px;
  box-shadow: var(--shadow);
  text-align: center;
}
.login-card.shake { animation: login-shake 0.38s; }
@keyframes login-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}
.login-mark {
  width: 66px;
  height: 66px;
  margin: 0 auto 14px;
  border-radius: 21px;
  display: grid;
  place-items: center;
  font-size: 32px;
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--brand-soft-2);
}
.login-title { font-size: 24px; font-weight: 760; letter-spacing: 0.6px; }
.login-sub { font-size: 13px; color: var(--ink-3); margin: 7px 0 20px; }
.login-field { text-align: left; margin-bottom: 8px; }
.login-field input { height: 48px; font-size: 16px; letter-spacing: 1px; }
.login-card .btn-block { margin-top: 12px; }
.login-error {
  margin-top: 12px;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  text-align: left;
}
.login-note {
  margin-top: 16px;
  font-size: 11.5px;
  color: var(--ink-3);
  line-height: 1.6;
  text-align: left;
}
.login-foot {
  margin-top: 8px;
  font-size: 11px;
  color: var(--ink-3);
  text-align: center;
}
code {
  background: var(--surface-3);
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 12px;
  word-break: break-all;
}

/* 桌面端微调 */
@media (min-width: 760px) {
  body { font-size: 15.5px; }
  .view { padding: 18px 24px calc(32px + var(--safe-bottom)); }
  .app-header { padding-left: 24px; padding-right: 24px; }
  .msg-bubble { max-width: 560px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
