/* =========================================================
   出行小助手 · 设计系统
   ========================================================= */
:root {
  --bg: #f4f6fb;
  --bg-soft: #eef2f9;
  --surface: #ffffff;
  --surface-2: #f7f9fd;
  --surface-3: #eef3fb;
  --border: #e2e8f3;
  --border-strong: #cfd9ea;
  --text: #101a2d;
  --text-2: #4a5a75;
  --text-3: #7d8ba3;
  --brand: #0b63f2;
  --brand-2: #3f8cff;
  --brand-soft: #e8f1ff;
  --brand-ink: #0646b5;
  --green: #12a150;
  --green-soft: #e6f7ee;
  --amber: #d97b06;
  --amber-soft: #fff5e5;
  --red: #d94848;
  --red-soft: #fdecec;
  --violet: #7a5af8;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --shadow-xs: 0 1px 2px rgba(16, 26, 45, .05);
  --shadow-sm: 0 2px 8px rgba(16, 26, 45, .06);
  --shadow: 0 10px 30px -12px rgba(16, 26, 45, .18);
  --shadow-lg: 0 30px 70px -30px rgba(11, 42, 96, .35);
  --sidebar-w: 306px;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
body.app-loading .app-shell { opacity: 0; }
.app-shell { opacity: 1; transition: opacity .35s var(--ease); }

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: var(--mono); }
::selection { background: rgba(11, 99, 242, .18); }

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { width: 20px; height: 20px; display: block; fill: none; }

/* 滚动条 */
.sidebar-scroll, .chat-scroll, .modal-body, .attach-strip {
  scrollbar-width: thin;
  scrollbar-color: #c7d3e6 transparent;
}
.sidebar-scroll::-webkit-scrollbar, .chat-scroll::-webkit-scrollbar,
.modal-body::-webkit-scrollbar, .attach-strip::-webkit-scrollbar { width: 8px; height: 8px; }
.sidebar-scroll::-webkit-scrollbar-thumb, .chat-scroll::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb, .attach-strip::-webkit-scrollbar-thumb {
  background: #c7d3e6; border-radius: 99px; border: 2px solid transparent; background-clip: padding-box;
}
.sidebar-scroll::-webkit-scrollbar-thumb:hover, .chat-scroll::-webkit-scrollbar-thumb:hover { background: #aebdd4; background-clip: padding-box; }

/* ========================= 布局 ========================= */
.app-shell { display: flex; height: 100dvh; width: 100%; position: relative; }

/* ========================= 侧边栏 ========================= */
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  height: 100%;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 30;
  transition: margin-left .32s var(--ease), transform .32s var(--ease);
}
.sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 16px 14px;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 13px; flex: 0 0 40px;
  background: linear-gradient(145deg, var(--brand-2), var(--brand) 55%, #0546c4);
  color: #fff; display: grid; place-items: center;
  box-shadow: 0 6px 16px -6px rgba(11, 99, 242, .7), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text strong { font-size: 15.5px; letter-spacing: .2px; }
.brand-text span { font-size: 11.5px; color: var(--text-3); letter-spacing: .4px; }
.sidebar-close { display: none; }

.sidebar-scroll { flex: 1; overflow-y: auto; padding: 4px 14px 18px; }
.side-block { padding: 14px 0 6px; }
.side-block + .side-block { border-top: 1px solid var(--border); }
.side-title {
  margin: 0 0 10px; font-size: 11.5px; font-weight: 600; letter-spacing: 1.1px;
  text-transform: uppercase; color: var(--text-3);
}
.quick-list { display: flex; flex-direction: column; gap: 3px; }
.quick-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 13.5px; text-align: left;
  transition: background .16s, color .16s, transform .16s;
}
.quick-item svg { width: 17px; height: 17px; color: var(--text-3); transition: color .16s; flex: 0 0 auto; }
.quick-item:hover { background: var(--brand-soft); color: var(--brand-ink); transform: translateX(1px); }
.quick-item:hover svg { color: var(--brand); }
.quick-item:active { transform: scale(.99); }

.status-list { display: flex; flex-direction: column; gap: 9px; margin-bottom: 12px; }
.status-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong);
  box-shadow: 0 0 0 3px rgba(207, 217, 234, .25); flex: 0 0 auto;
  transition: background .2s, box-shadow .2s;
}
.dot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(18, 161, 80, .14); }
.dot.warn { background: var(--amber); box-shadow: 0 0 0 3px rgba(217, 123, 6, .14); }
.status-label { color: var(--text-2); flex: 1; }
.status-value { color: var(--text-3); font-size: 11.5px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-action {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px; border-radius: var(--radius-sm);
  background: var(--brand); color: #fff; font-size: 13px; font-weight: 500;
  box-shadow: 0 6px 16px -8px rgba(11, 99, 242, .8);
  transition: filter .16s, transform .1s;
}
.side-action svg { width: 16px; height: 16px; }
.side-action:hover { filter: brightness(1.06); }
.side-action:active { transform: scale(.985); }
.side-tip p { margin: 0; font-size: 12px; line-height: 1.75; color: var(--text-3); }
.side-tip code { background: var(--surface-3); padding: 1px 5px; border-radius: 5px; font-size: 11px; }
.sidebar-foot {
  padding: 12px 16px 16px; border-top: 1px solid var(--border);
  font-size: 11px; color: var(--text-3); letter-spacing: .3px;
}
.sidebar-mask { display: none; }

/* ========================= 主区 ========================= */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100%; position: relative; }
.topbar {
  height: 62px; flex: 0 0 62px;
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
  background: rgba(255, 255, 255, .72);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
  z-index: 20;
}
.topbar-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; }
.topbar-title h1 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: .2px; white-space: nowrap; }
.chips { display: flex; align-items: center; gap: 6px; overflow: hidden; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  height: 23px; padding: 0 8px; border-radius: 99px;
  background: var(--surface-3); color: var(--text-2);
  font-size: 11px; font-weight: 500; letter-spacing: .2px; white-space: nowrap;
}
.chip svg { width: 12px; height: 12px; }
.chip-model { background: linear-gradient(135deg, #e8f1ff, #eef0ff); color: var(--brand-ink); }
.chip.off { opacity: .45; text-decoration: line-through; }
.chip.on { background: var(--green-soft); color: #0a7c3e; }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  color: var(--text-2); transition: background .16s, color .16s, transform .1s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 19px; height: 19px; }
.only-mobile { display: none; }

/* ========================= 欢迎页 ========================= */
.chat-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; scroll-behavior: smooth; position: relative; }
.chat-inner { max-width: 880px; margin: 0 auto; padding: 0 24px 28px; min-height: 100%; display: flex; flex-direction: column; }
.welcome { position: relative; padding: 56px 0 12px; text-align: center; }
.welcome-glow {
  position: absolute; top: -120px; left: 50%; transform: translateX(-50%);
  width: 640px; height: 380px; pointer-events: none;
  background: radial-gradient(closest-side, rgba(11, 99, 242, .13), rgba(122, 90, 248, .07) 55%, transparent 75%);
  filter: blur(8px);
}
.welcome-badge {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px 5px 8px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-xs); font-size: 11.5px; color: var(--text-2); letter-spacing: .3px;
}
.welcome-badge svg { width: 14px; height: 14px; color: var(--brand); }
.welcome h2 {
  position: relative; margin: 18px 0 10px; font-size: 33px; line-height: 1.28;
  letter-spacing: -.6px; font-weight: 650;
}
.welcome h2 em {
  font-style: normal;
  background: linear-gradient(100deg, var(--brand) 10%, var(--violet) 60%, #12a1c8);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.welcome-sub { position: relative; margin: 0 auto; max-width: 520px; color: var(--text-3); font-size: 13.5px; }
.welcome-grid {
  position: relative; margin-top: 30px;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; text-align: left;
}
.welcome-card {
  display: flex; flex-direction: column; gap: 2px;
  padding: 15px 16px 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  transition: transform .2s var(--ease), box-shadow .2s, border-color .2s;
}
.welcome-card:hover {
  transform: translateY(-2px); box-shadow: var(--shadow);
  border-color: #c8dbfb;
}
.welcome-card .wc-icon {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); margin-bottom: 8px;
}
.welcome-card .wc-icon svg { width: 17px; height: 17px; }
.welcome-card strong { font-size: 13.5px; font-weight: 600; }
.welcome-card span { font-size: 12px; color: var(--text-3); }
.welcome-card:nth-child(2) .wc-icon { background: #eef0ff; color: #5b46e0; }
.welcome-card:nth-child(3) .wc-icon { background: #e6f7ee; color: #0a8a45; }
.welcome-card:nth-child(4) .wc-icon { background: #fff3e4; color: var(--amber); }

/* ========================= 消息 ========================= */
.messages { display: flex; flex-direction: column; gap: 22px; padding-bottom: 8px; }
.msg { display: flex; gap: 11px; animation: msg-in .34s var(--ease) both; }
@keyframes msg-in { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
.msg-avatar {
  width: 32px; height: 32px; flex: 0 0 32px; border-radius: 10px;
  display: grid; place-items: center; margin-top: 2px;
  background: linear-gradient(145deg, var(--brand-2), var(--brand) 60%, #0546c4);
  color: #fff; box-shadow: 0 5px 14px -7px rgba(11, 99, 242, .8);
}
.msg-avatar svg { width: 17px; height: 17px; }
.msg-body { min-width: 0; flex: 1; max-width: 100%; }
.msg-user { flex-direction: row-reverse; }
.msg-user .msg-body { display: flex; flex-direction: column; align-items: flex-end; }
.msg-user .bubble {
  background: linear-gradient(145deg, #1a76ff, var(--brand) 70%, #0550d0);
  color: #fff; border-radius: var(--radius-lg) var(--radius-lg) 6px var(--radius-lg);
  padding: 10px 15px; max-width: min(640px, 88%);
  box-shadow: 0 8px 22px -14px rgba(11, 99, 242, .9);
  font-size: 14.5px; word-break: break-word; white-space: pre-wrap;
}
.msg-user .bubble-img-strip { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-bottom: 7px; max-width: min(640px, 88%); }
.msg-user .bubble-img-strip img {
  width: 104px; height: 104px; object-fit: cover; border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .3); cursor: zoom-in;
}
.msg-ai .bubble { padding: 2px 0 0; font-size: 14.8px; color: var(--text); max-width: 100%; overflow-wrap: break-word; }
.msg-ai .bubble:empty { display: none; }
.msg-meta { display: flex; align-items: center; gap: 10px; margin-top: 7px; font-size: 11px; color: var(--text-3); }
.msg-user .msg-meta { justify-content: flex-end; }
.msg-actions { display: flex; gap: 2px; margin-top: 6px; opacity: 0; transition: opacity .18s; }
.msg:hover .msg-actions, .msg-actions.show { opacity: 1; }
.mini-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 7px; border-radius: 7px; font-size: 11.5px; color: var(--text-3);
  transition: background .15s, color .15s;
}
.mini-btn svg { width: 13px; height: 13px; }
.mini-btn:hover { background: var(--surface-3); color: var(--text); }
.mini-btn.danger:hover { background: var(--red-soft); color: var(--red); }

/* 打字指示 */
.typing { display: inline-flex; align-items: center; gap: 4px; height: 22px; }
.typing i {
  width: 6px; height: 6px; border-radius: 50%; background: #a9b8d0; display: block;
  animation: bounce 1.2s infinite var(--ease);
}
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .55; } 30% { transform: translateY(-5px); opacity: 1; } }

/* 错误条 */
.err-box {
  margin-top: 8px; padding: 9px 12px; border-radius: var(--radius-sm);
  background: var(--red-soft); border: 1px solid #f7cccc; color: #a52c2c;
  font-size: 12.5px; line-height: 1.65;
}
.err-box code { background: rgba(255, 255, 255, .7); padding: 1px 5px; border-radius: 4px; font-size: 11px; }

/* 工具调用轨迹 */
.trace { margin: 10px 0 2px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); overflow: hidden; }
.trace-head { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 11px; font-size: 12px; color: var(--text-2); }
.trace-head .spin {
  width: 13px; height: 13px; border-radius: 50%; flex: 0 0 auto;
  border: 2px solid #c6d7f5; border-top-color: var(--brand); animation: spin .8s linear infinite;
}
.trace.done .trace-head .spin { border: 0; width: 15px; height: 15px; animation: none; background: var(--green-soft); color: var(--green); display: grid; place-items: center; }
.trace.done .trace-head .spin::after { content: ""; width: 7px; height: 4px; border-left: 1.8px solid currentColor; border-bottom: 1.8px solid currentColor; transform: rotate(-45deg) translateY(-1px); }
@keyframes spin { to { transform: rotate(360deg); } }
.trace-head strong { font-weight: 550; color: var(--text); }
.trace-head .caret { margin-left: auto; color: var(--text-3); transition: transform .2s; }
.trace.open .trace-head .caret { transform: rotate(180deg); }
.trace-steps { display: none; border-top: 1px dashed var(--border); padding: 6px 10px 8px; }
.trace.open .trace-steps { display: block; }
.trace-step { display: flex; gap: 7px; align-items: baseline; padding: 3px 0; font-size: 11.8px; color: var(--text-3); }
.trace-step b { color: var(--text-2); font-weight: 550; font-family: var(--mono); font-size: 11px; }
.trace-step .ok { color: var(--green); }
.trace-step .fail { color: var(--red); }

/* ========================= Markdown ========================= */
.md > *:first-child { margin-top: 0; }
.md > *:last-child { margin-bottom: 0; }
.md p { margin: 0 0 10px; }
.md h1, .md h2, .md h3, .md h4 { margin: 18px 0 8px; line-height: 1.4; font-weight: 650; letter-spacing: -.2px; }
.md h1 { font-size: 21px; }
.md h2 { font-size: 18.5px; }
.md h3 { font-size: 16px; }
.md h4 { font-size: 14.5px; }
.md ul, .md ol { margin: 8px 0 12px; padding-left: 22px; }
.md li { margin: 3px 0; }
.md li::marker { color: var(--brand); }
.md strong { font-weight: 650; }
.md em { color: var(--text-2); }
.md a { border-bottom: 1px solid rgba(11, 99, 242, .3); }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.md blockquote {
  margin: 10px 0; padding: 8px 14px; border-left: 3px solid var(--brand-2);
  background: var(--surface-2); border-radius: 0 8px 8px 0; color: var(--text-2);
}
.md code:not(pre code) {
  background: var(--surface-3); border: 1px solid var(--border);
  padding: 1px 5px; border-radius: 5px; font-size: 12.6px; color: #0b4aa8;
}
.md pre {
  margin: 12px 0; padding: 13px 15px; border-radius: var(--radius);
  background: #10192b; color: #dbe6f7; overflow-x: auto; font-size: 12.6px; line-height: 1.7;
  box-shadow: var(--shadow-sm);
}
.md pre code { font-size: inherit; }
.md table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 13px; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.md th { background: var(--surface-2); font-weight: 600; }
.md img { max-width: 100%; border-radius: 10px; }

/* ========================= 结构化卡片 ========================= */
.cards { display: flex; flex-direction: column; gap: 10px; margin: 12px 0 4px; }
.card {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); overflow: hidden; box-shadow: var(--shadow-xs);
}
.card-head {
  display: flex; align-items: center; gap: 8px; padding: 10px 13px;
  border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.card-head svg { width: 15px; height: 15px; color: var(--brand); flex: 0 0 auto; }
.card-head strong { font-size: 12.8px; font-weight: 600; }
.card-head .sub { margin-left: auto; font-size: 11px; color: var(--text-3); font-weight: 400; }
.card-body { padding: 11px 13px; }

/* 地图卡片 */
.map-card { position: relative; background: var(--surface-3); }
.map-card img { display: block; width: 100%; height: auto; max-height: 320px; object-fit: cover; cursor: zoom-in; }
.map-card .map-overlay {
  position: absolute; left: 10px; top: 10px; z-index: 2;
  display: flex; align-items: center; gap: 6px; padding: 5px 10px;
  border-radius: 99px; background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(6px); box-shadow: var(--shadow-sm);
  font-size: 11.5px; color: var(--text-2); font-weight: 500;
}
.map-card .map-overlay svg { width: 13px; height: 13px; color: var(--brand); }
.map-card .map-foot {
  display: flex; align-items: center; gap: 8px; padding: 7px 11px;
  font-size: 11px; color: var(--text-3); border-top: 1px solid var(--border);
}
.map-card .map-foot a { margin-left: auto; display: inline-flex; align-items: center; gap: 3px; }
.map-card .map-foot a svg { width: 12px; height: 12px; }

/* POI 列表 */
.poi { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--border); cursor: pointer; transition: background .15s; }
.poi:last-child { border-bottom: 0; }
.poi:hover .poi-name { color: var(--brand); }
.poi-idx {
  width: 20px; height: 20px; flex: 0 0 20px; border-radius: 6px;
  background: var(--brand-soft); color: var(--brand);
  font-size: 11px; font-weight: 650; display: grid; place-items: center; margin-top: 2px;
}
.poi-main { min-width: 0; flex: 1; }
.poi-name { font-size: 13.2px; font-weight: 550; margin-bottom: 2px; transition: color .15s; }
.poi-meta { font-size: 11.5px; color: var(--text-3); display: flex; flex-wrap: wrap; gap: 4px 9px; }
.poi-meta .star { color: #e0910c; }
.poi-meta .tagline { color: var(--text-2); }
.poi-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: 0 0 auto; }
.poi-link { font-size: 11px; color: var(--brand); white-space: nowrap; padding: 2px 6px; border-radius: 5px; background: var(--brand-soft); }
.poi-link:hover { background: #d9e9ff; text-decoration: none; }

/* 路线 */
.route-line { display: flex; gap: 10px; margin-bottom: 11px; }
.route-nodes { display: flex; flex-direction: column; align-items: center; padding-top: 5px; }
.route-nodes .n { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--brand); background: #fff; }
.route-nodes .n.end { border-color: var(--red); }
.route-nodes .bar { width: 2px; flex: 1; min-height: 20px; background: repeating-linear-gradient(to bottom, var(--border-strong) 0 3px, transparent 3px 6px); margin: 2px 0; }
.route-texts { display: flex; flex-direction: column; justify-content: space-between; gap: 12px; font-size: 12.5px; min-width: 0; }
.route-texts div { color: var(--text); }
.route-texts span { display: block; font-size: 11px; color: var(--text-3); margin-top: 1px; }
.route-summary { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.route-stat { flex: 1 1 auto; min-width: 78px; padding: 7px 10px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); }
.route-stat span { display: block; font-size: 10.5px; color: var(--text-3); }
.route-stat b { font-size: 14px; font-weight: 650; letter-spacing: -.2px; }
.route-steps { font-size: 12px; color: var(--text-2); max-height: 168px; overflow-y: auto; padding-left: 18px; margin: 0; }
.route-steps li { margin: 5px 0; padding-left: 2px; }
.route-steps li::marker { color: var(--brand-2); font-size: 11px; }
.tmc { display: inline-block; padding: 0 4px; border-radius: 4px; font-size: 10px; background: var(--amber-soft); color: var(--amber); }

/* 天气 */
.weather-now { display: flex; align-items: center; gap: 14px; padding-bottom: 10px; border-bottom: 1px dashed var(--border); }
.weather-temp { font-size: 34px; font-weight: 300; letter-spacing: -1.5px; line-height: 1; }
.weather-temp sup { font-size: 15px; font-weight: 400; vertical-align: super; color: var(--text-2); }
.weather-info { flex: 1; min-width: 0; }
.weather-info strong { display: block; font-size: 13.5px; }
.weather-info span { font-size: 11.5px; color: var(--text-3); }
.weather-forecast { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; padding-bottom: 2px; }
.wf-item { flex: 1 0 66px; text-align: center; padding: 8px 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; }
.wf-item span { display: block; font-size: 10.5px; color: var(--text-3); }
.wf-item b { display: block; font-size: 12px; margin: 3px 0; font-weight: 550; }
.wf-item em { font-style: normal; font-size: 10.5px; color: var(--text-2); }

/* IP 卡片 */
.ip-row { display: flex; align-items: center; gap: 10px; }
.ip-pin { width: 38px; height: 38px; border-radius: 11px; flex: 0 0 38px; display: grid; place-items: center; background: var(--green-soft); color: var(--green); }
.ip-pin svg { width: 19px; height: 19px; }
.ip-main strong { font-size: 14px; display: block; }
.ip-main span { font-size: 11.5px; color: var(--text-3); }

/* ========================= 输入区 ========================= */
.composer-wrap {
  flex: 0 0 auto; padding: 6px 24px 14px; max-width: 928px; width: 100%; margin: 0 auto;
  background: linear-gradient(to top, var(--bg) 45%, rgba(244, 246, 251, 0));
}
.composer {
  border: 1px solid var(--border-strong); border-radius: var(--radius-xl);
  background: var(--surface); box-shadow: var(--shadow);
  transition: border-color .2s, box-shadow .2s; overflow: hidden;
}
.composer.focus { border-color: #a9c8f8; box-shadow: 0 0 0 4px rgba(11, 99, 242, .08), var(--shadow); }
.composer.dragover { border-color: var(--brand); background: #f6faff; }
.composer-main { display: flex; align-items: flex-end; gap: 6px; padding: 8px 9px 8px 16px; }
#input {
  flex: 1; min-height: 40px; max-height: 168px; padding: 9px 0;
  border: 0; outline: 0; resize: none; background: transparent;
  font-size: 14.8px; line-height: 1.55; color: var(--text);
}
#input::placeholder { color: #9aa8bf; }
.composer-side { display: flex; align-items: center; gap: 2px; padding-bottom: 3px; }
.tool-btn {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  color: var(--text-3); transition: background .15s, color .15s, transform .1s;
}
.tool-btn svg { width: 19px; height: 19px; }
.tool-btn:hover { background: var(--surface-3); color: var(--brand); }
.tool-btn:active { transform: scale(.92); }
.tool-btn.recording { background: var(--red-soft); color: var(--red); animation: pulse-rec 1.6s infinite; }
@keyframes pulse-rec { 50% { box-shadow: 0 0 0 5px rgba(217, 72, 72, .12); } }
.send-btn {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: var(--brand); color: #fff; margin-left: 2px;
  box-shadow: 0 6px 16px -8px rgba(11, 99, 242, .9);
  transition: opacity .16s, transform .1s, filter .16s;
}
.send-btn svg { width: 19px; height: 19px; }
.send-btn:disabled { opacity: .32; box-shadow: none; cursor: not-allowed; }
.send-btn:not(:disabled):hover { filter: brightness(1.08); }
.send-btn:not(:disabled):active { transform: scale(.94); }
.send-btn.busy { background: #1c2a42; }
.send-btn.busy svg { display: none; }
.send-btn.busy::after {
  content: ""; width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .3); border-top-color: #fff; animation: spin .8s linear infinite;
}
.composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 6px 0; font-size: 11px; color: var(--text-3); }
.foot-right { display: flex; align-items: center; gap: 14px; }
.switch-inline { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; user-select: none; }
.switch-inline input { appearance: none; width: 26px; height: 15px; border-radius: 99px; background: #d3ddec; position: relative; cursor: pointer; transition: background .2s; flex: 0 0 auto; }
.switch-inline input::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 11px; height: 11px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .2s var(--ease);
}
.switch-inline input:checked { background: var(--brand); }
.switch-inline input:checked::after { transform: translateX(11px); }

/* 附件条 */
.attach-strip { display: none; gap: 9px; padding: 11px 13px 3px; overflow-x: auto; }
.attach-strip.has { display: flex; }
.attach-item {
  position: relative; width: 62px; height: 62px; flex: 0 0 62px;
  border-radius: 11px; overflow: hidden; border: 1px solid var(--border);
  background: var(--surface-2); animation: msg-in .24s var(--ease) both;
}
.attach-item img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.attach-item button {
  position: absolute; top: 2px; right: 2px; width: 18px; height: 18px;
  border-radius: 50%; background: rgba(16, 25, 43, .72); color: #fff;
  display: grid; place-items: center; backdrop-filter: blur(4px);
}
.attach-item button svg { width: 11px; height: 11px; }
.attach-item .tag {
  position: absolute; left: 0; bottom: 0; right: 0; padding: 1px 4px;
  font-size: 9px; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, .62)); text-align: center;
}

/* 录音条 */
.recording-bar { display: none; align-items: center; gap: 9px; padding: 10px 14px; border-top: 1px solid var(--border); background: #fff7f7; }
.recording-bar.on { display: flex; animation: msg-in .2s var(--ease); }
.rec-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); animation: pulse-rec 1.2s infinite; flex: 0 0 auto; }
.rec-text { font-size: 12.5px; color: #a52c2c; font-weight: 500; }
.rec-time { font-size: 11.5px; color: #a52c2c; font-variant-numeric: tabular-nums; }
.rec-wave { flex: 1; display: flex; align-items: center; gap: 2px; height: 20px; overflow: hidden; }
.rec-wave i { width: 2px; border-radius: 2px; background: #f0a5a5; height: 4px; transition: height .08s linear; }
.rec-cancel, .rec-done { padding: 5px 11px; border-radius: 8px; font-size: 12px; font-weight: 500; }
.rec-cancel { color: var(--text-2); background: var(--surface-3); }
.rec-cancel:hover { background: #e3eaf6; }
.rec-done { color: #fff; background: var(--brand); }
.rec-done:hover { filter: brightness(1.06); }
.rec-done:disabled { opacity: .6; cursor: progress; }

/* ========================= 设置抽屉 ========================= */
.modal { position: fixed; inset: 0; z-index: 100; display: none; }
.modal.open { display: block; }
.modal-mask { position: absolute; inset: 0; background: rgba(9, 18, 34, .38); backdrop-filter: blur(3px); animation: fade-in .2s; }
@keyframes fade-in { from { opacity: 0; } }
.modal-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(560px, 96vw);
  background: var(--surface); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: slide-in .3s var(--ease);
}
@keyframes slide-in { from { transform: translateX(36px); opacity: .6; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 17px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 16.5px; font-weight: 600; }
.modal-body { flex: 1; overflow-y: auto; padding: 6px 20px 20px; }
.modal-foot { display: flex; align-items: center; justify-content: space-between; padding: 13px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }
.modal-foot-right { display: flex; gap: 8px; }
.cfg-group { padding: 16px 0; border-bottom: 1px solid var(--border); }
.cfg-group:last-child { border-bottom: 0; }
.cfg-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.cfg-head h3 { margin: 0; font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.cfg-head a { margin-left: auto; font-size: 11.5px; }
.cfg-dot { width: 8px; height: 8px; border-radius: 3px; display: inline-block; }
.cfg-dot.ds { background: var(--brand); }
.cfg-dot.amap { background: var(--green); }
.cfg-dot.asr { background: var(--amber); }
.cfg-dot.sys { background: var(--violet); }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 11px; min-width: 0; flex: 1; }
.field > span { font-size: 11.5px; color: var(--text-2); font-weight: 500; }
.field input, .field select, .field textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--border-strong);
  border-radius: 9px; background: var(--surface); font-size: 13px; outline: 0;
  transition: border-color .16s, box-shadow .16s;
}
.field textarea { resize: vertical; line-height: 1.6; font-size: 12.5px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(11, 99, 242, .1); }
.field input::placeholder, .field textarea::placeholder { color: #a6b3c7; }
.field-row { display: flex; gap: 10px; }
.cfg-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.cfg-hint { margin: 8px 0 0; font-size: 11.2px; line-height: 1.65; color: var(--text-3); }
.ghost-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 12px; border-radius: 9px; border: 1px solid var(--border-strong);
  background: var(--surface); font-size: 12.5px; color: var(--text-2);
  transition: background .15s, border-color .15s, color .15s;
}
.ghost-btn svg { width: 14px; height: 14px; }
.ghost-btn:hover { background: var(--surface-2); border-color: #b9c9e0; color: var(--text); }
.primary-btn { padding: 7px 16px; border-radius: 9px; background: var(--brand); color: #fff; font-size: 12.5px; font-weight: 500; box-shadow: 0 6px 14px -8px rgba(11, 99, 242, .8); }
.primary-btn:hover { filter: brightness(1.07); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0 3px; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.switch-row input { appearance: none; width: 34px; height: 19px; border-radius: 99px; background: #d3ddec; position: relative; transition: background .2s; cursor: pointer; flex: 0 0 auto; }
.switch-row input::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .2s var(--ease);
}
.switch-row input:checked { background: var(--brand); }
.switch-row input:checked::after { transform: translateX(15px); }

/* ========================= 图片查看器 ========================= */
.lightbox {
  position: fixed; inset: 0; z-index: 200; display: none;
  background: rgba(6, 12, 24, .9); backdrop-filter: blur(6px);
  align-items: center; justify-content: center; padding: 44px 24px;
}
.lightbox.open { display: flex; animation: fade-in .18s; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 12px; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); object-fit: contain; }
.lightbox-close { position: absolute; top: 16px; right: 16px; color: #fff; background: rgba(255, 255, 255, .12); }
.lightbox-close:hover { background: rgba(255, 255, 255, .22); color: #fff; }

/* ========================= Toast ========================= */
.toast-stack { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 8px; max-width: min(420px, 90vw);
  padding: 9px 14px; border-radius: 11px; background: #14213a; color: #eef3ff;
  font-size: 12.5px; box-shadow: 0 16px 40px -14px rgba(0, 0, 0, .5);
  animation: toast-in .26s var(--ease);
}
.toast.err { background: #8d2626; }
.toast.ok { background: #0d6b3c; }
.toast svg { width: 15px; height: 15px; flex: 0 0 auto; }
.toast.out { animation: toast-out .22s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px) scale(.98); } }

/* ========================= 响应式 ========================= */
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; margin-left: calc(var(--sidebar-w) * -1); box-shadow: var(--shadow-lg); }
  .sidebar.open { margin-left: 0; }
  .sidebar-close { display: grid; }
  .sidebar-mask.show { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(9, 18, 34, .35); backdrop-filter: blur(2px); animation: fade-in .2s; }
  .only-mobile { display: grid; }
  .chat-inner { padding: 0 16px 22px; }
  .composer-wrap { padding: 6px 14px 12px; }
  .welcome { padding-top: 34px; }
  .welcome h2 { font-size: 26px; }
  .topbar { padding: 0 12px; }
  .topbar-title h1 { font-size: 15px; }
}
@media (max-width: 640px) {
  .welcome-grid { grid-template-columns: 1fr; gap: 9px; }
  .welcome { padding-top: 24px; }
  .welcome h2 { font-size: 23px; letter-spacing: -.4px; }
  .welcome-sub { font-size: 12.5px; }
  .chips .chip:not(.chip-model) { display: none; }
  .composer-foot #composerHint { display: none; }
  .footer-right, .foot-right { width: 100%; justify-content: flex-end; }
  .msg-avatar { display: none; }
  .msg-user .bubble { max-width: 94%; }
  .field-row { flex-direction: column; gap: 0; }
  .modal-panel { width: 100%; }
  .welcome-card { padding: 12px 14px; }
  .welcome-card span { font-size: 11.5px; }
  .route-stat { min-width: 70px; }
  .toast-stack { bottom: 16px; }
}

/* ========================= 深色模式 ========================= */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --bg-soft: #101a2c;
    --surface: #121c2e;
    --surface-2: #16223a;
    --surface-3: #1b2944;
    --border: #223148;
    --border-strong: #2d3f5c;
    --text: #e9eefb;
    --text-2: #a6b6d0;
    --text-3: #7587a3;
    --brand: #4d8dff;
    --brand-2: #6ea4ff;
    --brand-soft: #172a4c;
    --brand-ink: #a9c9ff;
    --green: #2ec573;
    --green-soft: #123324;
    --amber: #e5a33c;
    --amber-soft: #33260f;
    --red: #f06a6a;
    --red-soft: #331a1d;
    --violet: #9a86ff;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, .3);
    --shadow: 0 12px 30px -14px rgba(0, 0, 0, .6);
    --shadow-lg: 0 30px 70px -30px rgba(0, 0, 0, .8);
  }
  body { background: var(--bg); }
  .topbar { background: rgba(18, 28, 46, .72); }
  .composer-wrap { background: linear-gradient(to top, var(--bg) 45%, rgba(11, 18, 32, 0)); }
  .welcome-glow { background: radial-gradient(closest-side, rgba(77, 141, 255, .16), rgba(154, 134, 255, .08) 55%, transparent 75%); }
  .welcome-card:hover { border-color: #31507d; }
  .msg-user .bubble { background: linear-gradient(145deg, #2f7dff, #1b5fe0 70%, #1648b0); }
  .msg-user .bubble { box-shadow: 0 8px 22px -14px rgba(0, 0, 0, .9); }
  .recording-bar { background: #2a161a; }
  .rec-text, .rec-time { color: #f19a9a; }
  .rec-cancel { background: var(--surface-3); }
  .md pre { background: #0a1120; border: 1px solid var(--border); }
  .md code:not(pre code) { color: #9ec6ff; }
  .toast { background: #1d2c46; }
  .modal-mask { background: rgba(0, 0, 0, .55); }
  .sidebar-mask.show { background: rgba(0, 0, 0, .5); }
  .lightbox { background: rgba(0, 0, 0, .94); }
  #input::placeholder { color: #607191; }
  .switch-inline input, .switch-row input { background: #33445f; }
  .map-card .map-overlay { background: rgba(18, 28, 46, .9); color: var(--text-2); }
  .attach-item button { background: rgba(0, 0, 0, .6); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .chat-scroll { scroll-behavior: auto; }
}

