/* 赵阳老师 Agent V0.1 · 红色主题 · 发布版界面
   设计基准：主流桌面 Agent（侧栏 / 顶栏 / 居中对话流 / 悬浮输入区）
   红色只作品牌强调，不铺陈大面积色块；界面不出现任何原则说明文字。*/

:root {
  --red: #C9382F;
  --red-deep: #AC2C24;
  --red-soft: #FBEFEE;
  --red-softer: #FEF9F8;
  --red-line: #F0D9D6;
  --red-ring: rgba(201, 56, 47, .12);

  --bg: #FFFFFF;
  --canvas: #FFFFFF;
  --sidebar: #F8F8F9;
  --hover: #F0F0F1;

  --ink: #1F2023;
  --ink-2: #494B50;
  --ink-3: #86888E;
  --ink-4: #AEB0B5;
  --line: #EBEBED;
  --line-2: #E3E3E6;

  --shadow-sm: 0 1px 2px rgba(24, 24, 28, .035);
  --shadow-md: 0 2px 6px rgba(24, 24, 28, .045), 0 12px 32px rgba(24, 24, 28, .055);
  --sidebar-w: 260px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --serif: "Noto Serif CJK SC", "Source Han Serif SC", "Songti SC", "SimSun", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, textarea { font: inherit; }
button { cursor: pointer; }
::selection { background: rgba(201, 56, 47, .15); }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* ---------- 骨架 ---------- */
.app { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--canvas); }
.scrim { display: none; }

/* ---------- 侧栏 ---------- */
.sidebar {
  width: var(--sidebar-w); flex: none;
  display: flex; flex-direction: column;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  z-index: 30;
  margin-left: 0;
  transition: margin-left .26s cubic-bezier(.22, .8, .3, 1);
}
.app.sb-collapsed .sidebar { margin-left: calc(-1 * var(--sidebar-w)); }

.sb-head { display: flex; align-items: center; gap: 4px; padding: 16px 12px 12px 14px; }
.logo { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.logo-mark {
  width: 32px; height: 32px; flex: none;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--red);
  color: #fff; font-family: var(--serif); font-size: 18px; line-height: 1;
  box-shadow: 0 2px 8px rgba(201, 56, 47, .2);
}
.logo-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.logo-text strong { font-size: 13.5px; font-weight: 650; letter-spacing: .02em; white-space: nowrap; }
.logo-text span { font-size: 10.5px; color: var(--ink-3); letter-spacing: .06em; white-space: nowrap; }
.sb-head .sb-close { display: none; }
.sb-collapse { color: var(--ink-4); }

.icon-btn {
  width: 32px; height: 32px; flex: none;
  display: grid; place-items: center;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--ink-3);
  transition: background .16s, color .16s, transform .16s;
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn:active { transform: scale(.94); }
.icon-btn .icon { width: 17px; height: 17px; }

.sb-actions { padding: 6px 12px 12px; }
.btn-new {
  width: 100%; height: 38px;
  display: flex; align-items: center; gap: 9px;
  padding: 0 11px;
  border: 1px solid var(--line-2); border-radius: 10px;
  background: #fff; color: var(--ink-2);
  font-size: 12.8px; font-weight: 550;
  box-shadow: var(--shadow-sm);
  transition: border-color .18s, background .18s, color .18s, transform .18s, box-shadow .18s;
}
.btn-new .icon { width: 16px; height: 16px; stroke-width: 2; color: var(--red); }
.btn-new span { flex: 1; text-align: left; }
.btn-new kbd {
  font: 10px var(--sans); color: var(--ink-4);
  border: 1px solid var(--line-2); border-radius: 5px;
  padding: 2px 5px; background: var(--sidebar);
  letter-spacing: .02em;
}
.btn-new:hover { border-color: #E9BDB8; background: var(--red-softer); color: var(--red-deep); box-shadow: 0 3px 10px rgba(201, 56, 47, .07); }
.btn-new:active { transform: translateY(1px); }

.sb-list { flex: 1; overflow-y: auto; padding: 0 10px 12px; scrollbar-width: thin; scrollbar-color: #DCDCDF transparent; }
.sb-list::-webkit-scrollbar { width: 5px; }
.sb-list::-webkit-scrollbar-thumb { background: #DCDCDF; border-radius: 3px; }
.sb-list::-webkit-scrollbar-thumb:hover { background: #C8C9CC; }
.group-label { font-size: 10.5px; color: var(--ink-4); letter-spacing: .06em; padding: 14px 10px 6px; font-weight: 550; }
.conv-item {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 6px 0 11px;
  border-radius: 8px; margin-bottom: 1px;
  color: var(--ink-2); font-size: 12.8px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.conv-item::before {
  content: ""; position: absolute; left: 0; top: 9px; bottom: 9px;
  width: 3px; border-radius: 0 3px 3px 0;
  background: var(--red); opacity: 0; transition: opacity .15s;
}
.conv-item:hover { background: var(--hover); }
.conv-item.active { background: var(--red-soft); color: var(--red-deep); font-weight: 600; }
.conv-item.active::before { opacity: 1; }
.conv-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-del {
  width: 22px; height: 22px; flex: none;
  display: grid; place-items: center;
  border: 0; border-radius: 6px; background: transparent;
  color: var(--ink-4); opacity: 0;
  transition: opacity .15s, background .15s, color .15s;
}
.conv-del .icon { width: 14px; height: 14px; }
.conv-item:hover .conv-del, .conv-item.active .conv-del { opacity: 1; }
.conv-del:hover { background: #F6DDDA; color: var(--red); }
.empty-list { text-align: center; color: var(--ink-4); font-size: 11.5px; padding: 30px 8px; }

.sb-foot { border-top: 1px solid var(--line); padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); }
.sb-id { display: flex; align-items: center; gap: 10px; padding: 5px 4px; border-radius: 9px; transition: background .16s; }
.sb-id:hover { background: var(--hover); }
.avatar-sm { width: 30px; height: 30px; font-size: 14px; border-radius: 8px; }
.sb-id-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.sb-id-text strong { font-size: 12px; font-weight: 600; }
.sb-id-text span { font-size: 10.5px; color: var(--ink-4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-status { width: 6px; height: 6px; border-radius: 50%; background: #41B27A; flex: none; margin-right: 3px; }

/* ---------- 顶栏 ---------- */
.topbar {
  height: 54px; flex: none;
  display: flex; align-items: center; gap: 8px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .9);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
}
.menu-btn { display: none; }
.app.sb-collapsed .menu-btn { display: grid; }
.topbar-title {
  flex: 1; min-width: 0;
  font-size: 13px; font-weight: 550; color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar-right { display: flex; align-items: center; gap: 6px; }
.topbar-tag {
  font-size: 10.5px; color: var(--ink-4); letter-spacing: .08em;
  padding: 3px 7px; border: 1px solid var(--line); border-radius: 6px;
  user-select: none;
}

/* ---------- 对话流 ---------- */
.thread { flex: 1; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #DCDCDF transparent; }
.thread::-webkit-scrollbar { width: 7px; }
.thread::-webkit-scrollbar-thumb { background: #DEDEE0; border-radius: 4px; }
.thread::-webkit-scrollbar-thumb:hover { background: #C9CACC; }
.thread-inner { max-width: 760px; margin: 0 auto; padding: 32px 28px 24px; }
.thread.empty { display: flex; align-items: center; justify-content: center; }
.thread.empty .thread-inner { width: 100%; padding-top: 0; padding-bottom: 0; }

.welcome { padding: 0 0 8px; text-align: center; animation: fadeUp .45s ease both; }
.welcome-mark {
  width: 54px; height: 54px; margin: 0 auto 22px;
  display: grid; place-items: center;
  border-radius: 16px;
  background: var(--red);
  color: #fff; font-family: var(--serif); font-size: 28px; line-height: 1;
  box-shadow: 0 8px 24px rgba(201, 56, 47, .2);
}
.welcome h1 {
  margin: 0 0 9px;
  font-family: var(--serif); font-size: 30px; font-weight: 600;
  letter-spacing: .12em; text-indent: .12em;
  color: var(--red);
}
.welcome-sub { margin: 0 0 40px; font-size: 11.5px; color: var(--ink-4); letter-spacing: .24em; text-indent: .24em; }
.prompts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 600px; margin: 0 auto; }
.prompt-card {
  display: flex; align-items: center; gap: 11px;
  min-height: 56px; padding: 11px 13px;
  border: 1px solid var(--line-2); border-radius: 12px;
  background: #fff; color: var(--ink-2); text-align: left;
  font-size: 12.8px; line-height: 1.5;
  transition: border-color .18s, box-shadow .18s, transform .18s, color .18s;
}
.prompt-card .pc-icon { width: 18px; height: 18px; color: var(--ink-4); transition: color .18s; }
.prompt-card .pc-text { flex: 1; }
.prompt-card .pc-arrow { width: 15px; height: 15px; color: var(--ink-4); opacity: 0; transform: translateX(-4px); transition: opacity .18s, transform .18s, color .18s; }
.prompt-card:hover { border-color: #E9BDB8; box-shadow: 0 5px 16px rgba(201, 56, 47, .08); transform: translateY(-2px); color: var(--ink); }
.prompt-card:hover .pc-icon, .prompt-card:hover .pc-arrow { color: var(--red); }
.prompt-card:hover .pc-arrow { opacity: 1; transform: translateX(0); }
.prompt-card:active { transform: translateY(0); }

.msg { display: flex; gap: 13px; margin-bottom: 30px; animation: fadeUp .32s ease both; }
.avatar {
  width: 30px; height: 30px; flex: none;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--red);
  color: #fff; font-family: var(--serif); font-size: 15px; line-height: 1;
  box-shadow: 0 2px 7px rgba(201, 56, 47, .16);
}
.msg-body { flex: 1; min-width: 0; padding-top: 2px; }
.msg-name { font-size: 11.5px; font-weight: 600; color: var(--ink-3); margin-bottom: 7px; letter-spacing: .02em; }
.msg-text { font-size: 15px; line-height: 1.85; color: var(--ink); white-space: pre-wrap; word-break: break-word; }
/* 结论 + 执行步骤：全程 textContent 渲染，不注入 HTML */
.answer-line { line-height: 1.85; }
.step-row { display: flex; align-items: flex-start; gap: 10px; margin-top: 7px; }
.answer-line + .step-row { margin-top: 12px; }
.step-num {
  flex: 0 0 20px; height: 20px; margin-top: 3px;
  display: grid; place-items: center;
  border-radius: 6px; background: var(--red-soft); color: var(--red);
  font-size: 11px; font-weight: 700; line-height: 1;
}
.step-text { flex: 1; min-width: 0; line-height: 1.85; }
.msg-tools { display: flex; gap: 2px; margin-top: 9px; opacity: 0; transition: opacity .18s; }
.msg:hover .msg-tools, .msg-tools:focus-within { opacity: 1; }
.tool-btn {
  display: inline-flex; align-items: center; gap: 5px;
  height: 26px; padding: 0 7px;
  border: 0; border-radius: 6px; background: transparent;
  color: var(--ink-4); font-size: 11px;
  transition: background .16s, color .16s;
}
.tool-btn .icon { width: 13px; height: 13px; }
.tool-btn:hover { background: var(--hover); color: var(--red); }
.msg-me { justify-content: flex-end; }
.bubble {
  max-width: 78%; padding: 11px 15px;
  border-radius: 16px;
  background: #F4F4F5;
  font-size: 14.5px; line-height: 1.75; color: var(--ink-2);
  white-space: pre-wrap; word-break: break-word;
}
.typing { display: inline-flex; align-items: center; gap: 5px; height: 22px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--red); opacity: .45; animation: bounce 1.25s ease-in-out infinite; }
.typing i:nth-child(2) { animation-delay: .16s; }
.typing i:nth-child(3) { animation-delay: .32s; }

/* ---------- 输入区 ---------- */
.composer-wrap { flex: none; width: 100%; max-width: 792px; margin: 0 auto; padding: 8px 28px calc(14px + env(safe-area-inset-bottom)); }
.composer {
  border: 1px solid var(--line-2); border-radius: 20px;
  background: #fff; padding: 14px 12px 10px 18px;
  box-shadow: var(--shadow-md);
  transition: border-color .2s, box-shadow .2s;
}
.composer:focus-within { border-color: #E3B4AF; box-shadow: 0 0 0 3px var(--red-ring), var(--shadow-md); }
.composer textarea {
  display: block; width: 100%; min-height: 26px; max-height: 160px;
  border: 0; outline: none; resize: none; padding: 0;
  background: transparent; color: var(--ink);
  font-size: 14.5px; line-height: 1.75;
  overflow-y: auto;
}
.composer textarea::placeholder { color: var(--ink-4); }
.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.hint { font-size: 10.5px; color: var(--ink-4); user-select: none; }
.send {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: var(--red); color: #fff;
  box-shadow: 0 2px 8px rgba(201, 56, 47, .22);
  transition: background .18s, transform .18s, box-shadow .18s, opacity .18s;
}
.send .icon { width: 17px; height: 17px; stroke-width: 2.1; }
.send:hover:not(:disabled) { background: var(--red-deep); transform: translateY(-1px); box-shadow: 0 5px 13px rgba(201, 56, 47, .28); }
.send:active:not(:disabled) { transform: translateY(0) scale(.95); }
.send:disabled { background: #E1E1E4; box-shadow: none; opacity: .8; cursor: default; }
.disclaimer { margin: 10px 0 0; text-align: center; font-size: 10.5px; color: var(--ink-4); letter-spacing: .02em; }

.toast {
  position: fixed; left: 50%; bottom: 108px; z-index: 60;
  transform: translate(-50%, 8px);
  padding: 8px 15px; border-radius: 9px;
  background: rgba(31, 32, 35, .94); color: #fff; font-size: 12px;
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-5px); opacity: 1; } }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .sidebar {
    position: fixed; inset: 0 auto 0 0;
    margin-left: 0 !important;
    transform: translateX(-100%);
    transition: transform .26s cubic-bezier(.22, .8, .3, 1);
    box-shadow: none;
  }
  .sidebar.open { transform: none; box-shadow: 8px 0 30px rgba(24, 24, 28, .1); }
  .sb-head .sb-close, .menu-btn { display: grid; }
  .sb-collapse { display: none; }
  .scrim { position: fixed; inset: 0; z-index: 25; background: rgba(20, 20, 24, .34); opacity: 0; pointer-events: none; transition: opacity .24s; }
  .scrim.show { display: block; opacity: 1; pointer-events: auto; }
  .topbar { padding: 0 14px; }
  .thread-inner { padding: 24px 20px 20px; }
  .composer-wrap { padding: 8px 20px calc(12px + env(safe-area-inset-bottom)); }
}
@media (max-width: 600px) {
  .topbar-tag { display: none; }
  .thread-inner { padding: 18px 15px 16px; }
  .composer-wrap { padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); }
  .prompt-card { min-height: 52px; padding: 10px 12px; font-size: 12px; }
  .prompts { grid-template-columns: 1fr; gap: 8px; }
  .welcome h1 { font-size: 27px; }
  .welcome-sub { margin-bottom: 28px; }
  .welcome-mark { width: 48px; height: 48px; font-size: 25px; margin-bottom: 18px; }
  .hint { display: none; }
  .composer-bar { justify-content: flex-end; }
  .bubble { max-width: 86%; }
  .msg-text { font-size: 14.5px; }
  .msg-tools { opacity: 1; }
  .toast { bottom: 96px; }
}
/* ---------- 真人咨询 ---------- */
.btn-human {
  height: 28px; padding: 0 10px;
  border: 1px solid var(--line-2); border-radius: 7px;
  background: transparent; color: var(--ink-2);
  font-size: 11.5px; font-weight: 550; white-space: nowrap;
  transition: border-color .16s, background .16s, color .16s;
}
.btn-human:hover { border-color: #E9BDB8; background: var(--red-softer); color: var(--red-deep); }
.tool-btn.handoff { color: var(--red); }

.modal { position: fixed; inset: 0; z-index: 80; display: none; }
.modal.open { display: block; }
.modal-mask { position: absolute; inset: 0; background: rgba(20, 20, 24, .42); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.modal-card {
  position: relative;
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px); overflow-y: auto;
  margin: min(11vh, 90px) auto 0;
  padding: 26px 26px 24px;
  border: 1px solid var(--line); border-radius: 18px;
  background: #fff;
  box-shadow: 0 18px 60px rgba(24, 24, 28, .18);
}
.modal.open .modal-card { animation: fadeUp .24s ease both; }
.modal-x { position: absolute; top: 14px; right: 14px; color: var(--ink-4); }
.modal-kicker { font-size: 10.5px; font-weight: 650; letter-spacing: .14em; color: var(--red); margin-bottom: 10px; }
.modal-head h2 { margin: 0 0 7px; font-size: 19px; font-weight: 650; letter-spacing: .01em; }
.modal-head p { margin: 0 0 22px; font-size: 12.5px; color: var(--ink-3); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 11.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px;
  border: 1px solid var(--line-2); border-radius: 9px;
  background: #fff; color: var(--ink);
  font: 13px var(--sans); outline: none;
  transition: border-color .16s, box-shadow .16s;
}
.field textarea { resize: vertical; min-height: 72px; line-height: 1.6; }
.field input::placeholder, .field textarea::placeholder { color: var(--ink-4); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: #E3B4AF; box-shadow: 0 0 0 3px var(--red-ring); }
.modal-note { margin: 2px 0 16px; font-size: 10.5px; color: var(--ink-4); }
.modal-submit {
  display: block; width: 100%; height: 40px;
  border: 0; border-radius: 10px;
  background: var(--red); color: #fff;
  font-size: 13.5px; font-weight: 600;
  transition: background .16s, transform .16s, opacity .16s;
}
.modal-submit:hover:not(:disabled) { background: var(--red-deep); }
.modal-submit:active:not(:disabled) { transform: translateY(1px); }
.modal-submit:disabled { background: #E1E1E4; color: var(--ink-3); cursor: default; }
#leadForm[hidden], .modal-done[hidden] { display: none; }
.modal-done { text-align: center; padding: 26px 0 8px; }
.done-mark { width: 44px; height: 44px; margin: 0 auto 16px; display: grid; place-items: center; border-radius: 50%; background: var(--red-soft); color: var(--red); font-size: 22px; }
.modal-done h3 { margin: 0 0 6px; font-size: 18px; font-weight: 650; }
.modal-done p { margin: 0 0 24px; font-size: 12.5px; color: var(--ink-3); }
.modal-done .modal-submit { max-width: 160px; margin: 0 auto; }

@media (max-width: 600px) {
  .btn-human { height: 26px; padding: 0 8px; font-size: 11px; }
  .modal-card { margin-top: 6vh; padding: 22px 18px 20px; }
  .modal-head h2 { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
