/*
  配色走 EHS（环境·健康·安全）行业语言，不是 AI SaaS 那套蓝紫渐变。

  - 主色取"安全绿"深色调：安全行业里绿色代表安全状态、急救与通行（ANSI Z535 / GB 2893）
  - 强调色取"警示琥珀"：只用在需要引起注意的地方，不做装饰
  - 中性色带一点绿灰，避免纯冷灰的塑料感
  - 全站不用多色渐变 —— 那是"AI 味"最重的来源
*/
:root {
  --primary: #0f6b56;          /* 安全绿（深） */
  --primary-dark: #0a5343;
  --primary-light: #16856b;
  --primary-soft: #e8f2ef;
  --accent: #c2740a;           /* 警示琥珀 */
  --accent-soft: #fdf3e3;

  --ink: #16211e;              /* 侧栏等深色块 */
  --ink-2: #1e2c28;
  --bg: #f4f6f5;
  --card-bg: #ffffff;
  --text: #1c2522;
  --muted: #6b7874;
  --border: #dfe5e2;
  --danger: #c0392f;
  --warning: #c2740a;
  --success: #0f6b56;

  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(22, 33, 30, .05);
  --shadow-md: 0 4px 16px rgba(22, 33, 30, .07);
  --shadow-lg: 0 16px 44px rgba(22, 33, 30, .11);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
               "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ---------------- 登录/注册等页面的外框 ---------------- */

.center-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  position: relative;
  overflow: hidden;
  background: var(--bg);
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 44px 44px;
}

/* 页面顶部的品牌区，由 auth.js 自动插入 */
.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}
.auth-brand img { width: 34px; height: 34px; border-radius: 10px; box-shadow: var(--shadow-md); }
.auth-brand-text { font-size: 17px; font-weight: 700; letter-spacing: .3px; }
.auth-brand-text small {
  display: block;
  font-size: 11.5px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 1.5px;
  margin-top: 1px;
}

.auth-footer {
  margin-top: 22px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  line-height: 1.9;
}
.auth-footer a { color: var(--muted); text-decoration: none; }
.auth-footer a:hover { color: var(--primary); }

.card {
  width: 100%;
  max-width: 400px;
  background: var(--card-bg);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  padding: 34px 30px;
  border: 1px solid rgba(255, 255, 255, .8);
  position: relative;
}

.card h1 {
  font-size: 21px;
  margin: 0 0 5px;
  letter-spacing: .2px;
}

.card .sub {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 24px;
  line-height: 1.6;
}

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  background: #fbfcfb;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.field input::placeholder { color: #aab5b1; }
.field input:hover { border-color: #c3cfca; }
.field input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(15, 107, 86, .12);
}

.sms-row { display: flex; gap: 8px; }
.sms-row input { flex: 1; }
.sms-row button {
  white-space: nowrap;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--primary);
  background: #fff;
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
.sms-row button:hover:not(:disabled) { background: var(--primary-soft); }
.sms-row button:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  width: 100%;
  padding: 12.5px;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
  box-shadow: 0 4px 14px rgba(15, 107, 86, .28);
  transition: transform .12s, box-shadow .15s, opacity .15s;
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 7px 20px rgba(15, 107, 86, .34);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }

.links { margin-top: 18px; text-align: center; font-size: 13px; color: var(--muted); }
.links a { color: var(--primary); text-decoration: none; cursor: pointer; }

.error-msg {
  background: #fdeceb;
  color: var(--danger);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
}
.error-msg.show { display: block; }

.tip-msg {
  background: var(--primary-soft);
  color: var(--primary-dark);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
}
.tip-msg.show { display: block; }

/* ---------------- 密码框小眼睛 ---------------- */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 42px; }
.pw-eye {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  border-radius: 6px;
}
.pw-eye:hover { color: var(--primary); background: #eef3f1; }

/* ---------------- 确认弹窗 ---------------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(22, 33, 30, .5);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
  animation: modal-fade .15s ease-out;
}
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 24px 24px 20px;
  width: 100%;
  max-width: 380px;
  animation: modal-pop .18s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes modal-pop {
  from { opacity: 0; transform: translateY(10px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.modal-msg { font-size: 13.5px; color: var(--muted); line-height: 1.7; }
.modal-actions { display: flex; gap: 10px; margin-top: 22px; }
.modal-btn {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  transition: background .12s, border-color .12s;
}
.modal-btn.cancel:hover { background: #f2f5f4; border-color: #c3cfca; }
.modal-btn.primary {
  border: none;
  background: var(--primary);
  color: #fff;
}
.modal-btn.danger { border: none; background: var(--danger); color: #fff; }
.modal-btn.danger:hover { background: #a52f27; }
.modal-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------------- 首次设置：步骤条 ---------------- */
.steps {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
}
.step {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}
.step-no {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #dfe5e2;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
}
.step.active { color: var(--primary); font-weight: 600; }
.step.active .step-no { background: var(--primary); color: #fff; }
.step.done .step-no { background: var(--success); color: #fff; }
.step-line { flex: 1; height: 1px; background: var(--border); }

.privacy-note {
  background: #f1f6f4;
  border: 1px solid #d9e6e1;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 18px;
  font-size: 12.5px;
  line-height: 1.7;
  color: #485652;
}
.privacy-note .privacy-title { font-weight: 600; color: var(--text); margin-bottom: 4px; }
.privacy-note ul { margin: 0; padding-left: 18px; }
.privacy-note code {
  background: #dfeae6;
  padding: 0 4px;
  border-radius: 3px;
  font-size: 11.5px;
}

.consent {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 16px;
  cursor: pointer;
}
.consent input { margin: 2px 0 0; width: 15px; height: 15px; flex-shrink: 0; cursor: pointer; }

.consent a { color: var(--primary); text-decoration: none; }
.consent a:hover { text-decoration: underline; }

/* ---------------- 协议页 ---------------- */
.doc-wrap { max-width: 780px; margin: 0 auto; padding: 24px 24px 80px; }
.doc-head { margin-bottom: 18px; }

/* 正式文书的抬头：机构徽标 + 机构名 + 文书名 */
.doc-titleblock {
  text-align: center;
  padding: 30px 24px 26px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
}
.doc-seal { width: 40px; height: 40px; margin-bottom: 12px; }
.doc-org {
  font-size: 13.5px;
  color: var(--text);
  letter-spacing: 2px;
  margin-bottom: 14px;
}
.doc-titleblock h1 {
  font-size: 25px;
  margin: 0;
  letter-spacing: 4px;
  font-weight: 600;
  padding-bottom: 18px;
  position: relative;
}
.doc-titleblock h1::after {
  content: "";
  position: absolute;
  left: 50%; bottom: 0;
  transform: translateX(-50%);
  width: 52px; height: 3px;
  background: var(--primary);
  border-radius: 2px;
}

/* 附则：版本、生效日期这些放文末，符合正式文书的写法 */
.doc-appendix {
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow: hidden;
  margin: 12px 0 14px;
  font-size: 13px;
}
.appendix-row {
  display: flex;
  border-bottom: 1px solid var(--border);
}
.appendix-row:last-child { border-bottom: none; }
.appendix-row span {
  width: 110px;
  flex-shrink: 0;
  padding: 10px 14px;
  background: #f6f8f7;
  color: var(--muted);
  border-right: 1px solid var(--border);
}
.appendix-row b { padding: 10px 14px; font-weight: 500; }
.doc-note { font-size: 12.5px; color: var(--muted); line-height: 1.8; }
.doc-body {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 32px 40px 36px;
  font-size: 14.5px;
  line-height: 1.95;
}
.doc-body h2 {
  font-size: 15.5px;
  margin: 30px 0 10px;
  padding-left: 11px;
  border-left: 3px solid var(--primary);
  line-height: 1.4;
}
.doc-body h2:first-child { margin-top: 0; }
.doc-body ul { padding-left: 20px; margin: 10px 0; }
.doc-body li { margin-bottom: 6px; }
.doc-body p { margin: 10px 0; }
.doc-body a { color: var(--primary); }
.doc-body code {
  background: #ebf0ee;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12.5px;
}
.doc-highlight {
  background: var(--primary-soft);
  border-left: 3px solid var(--primary);
  border-radius: 0 8px 8px 0;
  padding: 12px 16px;
  margin: 16px 0;
  font-size: 13.5px;
  line-height: 1.8;
}
.doc-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13px;
}
.doc-table th, .doc-table td {
  border: 1px solid var(--border);
  padding: 9px 12px;
  text-align: left;
  vertical-align: top;
}
.doc-table th { background: #f3f7f5; color: var(--text); font-weight: 600; }
.tag-sensitive {
  display: inline-block;
  background: #fdeceb;
  color: var(--danger);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  margin-top: 3px;
}

/* ---------------- 个人中心 ---------------- */
.profile-wrap { max-width: 620px; margin: 0 auto; padding: 32px 24px 64px; }
.profile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.profile-head h1 { font-size: 22px; margin: 0; }
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--primary);
  text-decoration: none;
}
.back-link:hover { color: var(--primary-dark); }

/* 顶部概览条 */
.profile-hero {
  display: flex;
  align-items: center;
  gap: 15px;
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 12px;
}
.hero-avatar {
  width: 52px; height: 52px;
  border-radius: 14px;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 600;
  flex-shrink: 0;
}
.hero-main { flex: 1; min-width: 0; }
.hero-name { font-size: 17px; font-weight: 600; margin-bottom: 3px; }
.hero-sub { font-size: 13px; color: #a6b3ae; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* 统计条 */
.stat-row { display: flex; gap: 12px; margin-bottom: 18px; }
.stat {
  flex: 1;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-align: center;
}
.stat-num { font-size: 21px; font-weight: 600; color: var(--primary); line-height: 1.3; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 2px; }

.verified-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #fff;
  background: var(--primary);
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  white-space: nowrap;
}
.verified-badge::before { content: "✓"; font-size: 11px; }
.unverified-badge {
  color: #a6b3ae;
  background: rgba(255, 255, 255, .1);
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 12px;
  font-family: inherit;
  white-space: nowrap;
}

/* 卡片里的说明块 */
.note-box {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 14px;
  padding: 11px 13px;
  background: var(--primary-soft);
  border-radius: 9px;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--primary-dark);
}
.note-box svg { flex-shrink: 0; margin-top: 2px; }

.card-lead { font-size: 13px; color: var(--muted); margin: 0 0 12px; line-height: 1.7; }
.rights-list { margin: 0 0 16px; padding-left: 18px; font-size: 13px; line-height: 1.9; color: var(--text); }
.rights-list strong { font-weight: 600; }

.doc-link-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.doc-link-row a {
  font-size: 12.5px;
  color: var(--primary);
  text-decoration: none;
  border: 1px solid var(--border);
  padding: 7px 13px;
  border-radius: 8px;
  transition: border-color .12s, background .12s;
}
.doc-link-row a:hover { border-color: var(--primary); background: var(--primary-soft); }
.contact-line { font-size: 12.5px; color: var(--muted); }

/* ---------------- 后台配置页 ---------------- */
.admin-wrap { max-width: 720px; margin: 0 auto; padding: 32px 24px 64px; }
.admin-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}
.admin-head h1 { font-size: 22px; margin: 0 0 4px; }
.admin-head .sub { color: var(--muted); font-size: 13px; }
.admin-head code {
  background: #e6ecea;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}
.logout-link { color: var(--muted); font-size: 13px; cursor: pointer; text-decoration: none; }
.logout-link:hover { color: var(--danger); }

.admin-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(20, 24, 40, 0.06);
  padding: 24px;
  margin-bottom: 18px;
}
.admin-card h2 {
  font-size: 15px;
  margin: 0 0 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.admin-card .hint { font-size: 12px; color: var(--muted); margin-top: 5px; line-height: 1.5; }
.badge {
  display: inline-block;
  background: #e6ecea;
  color: var(--muted);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 4px;
}

.warn-card {
  background: var(--accent-soft);
  border: 1px solid #edd9b4;
  box-shadow: none;
  font-size: 13px;
  line-height: 1.6;
  padding: 14px 18px;
}
.warn-card code { background: #f2e3c6; padding: 1px 5px; border-radius: 4px; font-size: 12px; }

.ro-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid #eef2f0;
  font-size: 13px;
}
.ro-row:last-of-type { border-bottom: none; }
.ro-label { color: var(--muted); flex-shrink: 0; }
.ro-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  word-break: break-all;
  text-align: right;
}
.ro-value.empty { color: var(--danger); font-family: inherit; }

.test-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
}
.test-row input {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  width: 160px;
}
.test-row input:focus { border-color: var(--primary); }
.btn-ghost {
  padding: 8px 14px;
  border: 1px solid var(--primary);
  border-radius: 8px;
  background: #fff;
  color: var(--primary);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-ghost:hover { background: var(--primary-soft); }
.btn-ghost:disabled { opacity: .5; cursor: not-allowed; }
.test-result { font-size: 12.5px; color: var(--muted); flex: 1 1 100%; line-height: 1.5; }
.test-result.ok { color: var(--primary-dark); }
.test-result.fail { color: var(--danger); }

.admin-actions { position: sticky; bottom: 0; padding: 12px 0; background: var(--bg); }
.admin-actions .btn-primary { max-width: 200px; }

/* 标签页：配置 / 注册用户 */
.admin-tabs { display: flex; gap: 4px; margin-bottom: 16px; }
.admin-tab {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
}
.admin-tab:hover { border-color: var(--primary); color: var(--primary); }
.admin-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

/* 注册用户列表 */
.user-toolbar { display: flex; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.user-toolbar input {
  flex: 1 1 180px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
}
.user-toolbar input:focus { border-color: var(--primary); }

.user-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.user-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.user-table td {
  padding: 11px 8px;
  border-bottom: 1px solid #eef2f0;
  vertical-align: middle;
}
.user-table tr:last-child td { border-bottom: none; }
.user-table th.num, .user-table td.num { text-align: right; }
.user-table .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  white-space: nowrap;
}
.user-table .dim { color: var(--muted); }

/* 个人中心里那两个徽章是给深色/大号场景做的，表格里换成轻一点的写法 */
.user-table .verified-badge,
.user-table .unverified-badge {
  padding: 2px 8px;
  font-size: 11.5px;
  font-weight: 500;
  border-radius: 4px;
}
.user-table .verified-badge { background: var(--primary-soft); color: var(--primary-dark); }
.user-table .verified-badge::before { content: none; }
.user-table .unverified-badge { background: #eef2f0; color: var(--muted); }

.user-empty { padding: 28px 0; text-align: center; color: var(--muted); font-size: 13px; }
.user-pager {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
  font-size: 12.5px;
}
.user-pager .dim { color: var(--muted); }

@media (max-width: 640px) {
  /* 窄屏放不下六列，注册时间和消息数先让位 */
  .user-table th:nth-child(4), .user-table td:nth-child(4),
  .user-table th:nth-child(6), .user-table td:nth-child(6) { display: none; }
}

/* ---------------- 聊天页 ---------------- */
.chat-layout { height: 100vh; display: flex; }

.sidebar {
  width: 252px;
  background: var(--ink);
  color: #d3ddd9;
  display: flex;
  flex-direction: column;
  padding: 16px 12px 12px;
  flex-shrink: 0;
}
.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 14.5px;
  color: #fff;
  padding: 6px 8px 14px;
}
.brand-logo { width: 24px; height: 24px; border-radius: 7px; flex-shrink: 0; }

.sidebar .new-chat {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 18px;
  padding: 10px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 4px 14px rgba(15, 107, 86, .3);
  transition: transform .12s, box-shadow .15s;
}
.sidebar .new-chat:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(15, 107, 86, .4); }

.conv-section-title {
  font-size: 11px;
  color: #6d7d78;
  letter-spacing: .8px;
  padding: 0 10px 8px;
  text-transform: uppercase;
}

.conv-list { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.conv-list::-webkit-scrollbar { width: 5px; }
.conv-list::-webkit-scrollbar-thumb { background: #31423c; border-radius: 3px; }

.conv-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 10px;
  border-radius: 9px;
  font-size: 13px;
  cursor: pointer;
  margin-bottom: 3px;
  transition: background .12s;
}
.conv-item:hover { background: #25352f; color: #fff; }
.conv-item.active { background: #2c3f39; color: #fff; }
.conv-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-del {
  flex-shrink: 0;
  width: 22px; height: 22px;
  display: none;
  align-items: center; justify-content: center;
  border: none; background: none;
  color: #8c9a95; cursor: pointer; padding: 0;
  border-radius: 5px;
}
.conv-item:hover .conv-del { display: flex; }
.conv-del:hover { color: #f08a80; background: #384a44; }

.sidebar .user-info {
  border-top: 1px solid #2a3a35;
  padding-top: 12px;
  margin-top: 10px;
}
.user-row { display: flex; align-items: center; gap: 9px; padding: 2px 8px 12px; }
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 600;
  flex-shrink: 0;
}
.user-phone { font-size: 12.5px; color: #a6b3ae; }

/* 两个操作各占一行、有独立的点击区域和间距，避免挨太近误点 */
.user-actions { display: flex; flex-direction: column; gap: 4px; }
.user-action {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 9px;
  font-size: 12.5px;
  color: #98a6a1;
  text-decoration: none;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.user-action svg { flex-shrink: 0; opacity: .85; }
.user-action:hover { background: #25352f; color: #fff; }
.user-action.danger:hover { background: rgba(229, 72, 77, .14); color: #f08a80; }

/* ---- 主区 ---- */
.chat-main { flex: 1; display: flex; flex-direction: column; background: #fff; min-width: 0; }

.chat-topbar {
  height: 54px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 24px;
  background: rgba(255, 255, 255, .85);
  backdrop-filter: blur(8px);
}
.chat-topbar-title { font-size: 14.5px; font-weight: 600; }
.chat-topbar-tag {
  font-size: 11.5px;
  color: var(--muted);
  background: #eef2f0;
  padding: 3px 9px;
  border-radius: 20px;
}

.chat-messages { flex: 1; overflow-y: auto; padding: 28px 8%; }
.chat-messages::-webkit-scrollbar { width: 8px; }
.chat-messages::-webkit-scrollbar-thumb { background: #d8e0dd; border-radius: 4px; }
.chat-messages::-webkit-scrollbar-thumb:hover { background: #c3cfca; }

/* ---- 空状态 ---- */
.welcome {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
}
.welcome-logo {
  width: 56px; height: 56px;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 16px;
}
.welcome h2 { font-size: 20px; margin: 0 0 8px; }
.welcome p { color: var(--muted); font-size: 13.5px; max-width: 420px; margin: 0 0 22px; line-height: 1.7; }
.suggestions { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; }
.suggestion {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 9px 15px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .15s, background .15s, transform .12s;
}
.suggestion:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
  transform: translateY(-1px);
}

/* ---- 消息 ---- */
.msg { margin-bottom: 20px; display: flex; align-items: flex-start; gap: 10px; }
.msg.user { justify-content: flex-end; }
.avatar {
  width: 30px; height: 30px;
  border-radius: 9px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  overflow: hidden;
}
.msg.assistant .avatar { background: var(--primary-soft); }
.msg.assistant .avatar img { width: 100%; height: 100%; display: block; }
.msg.user .avatar { background: #e6ecea; color: #6d7d78; }

.msg .bubble {
  max-width: 72%;
  padding: 11px 15px;
  border-radius: 14px;
  font-size: 14.5px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg.user .bubble {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 3px 12px rgba(15, 107, 86, .22);
}
.msg.assistant .bubble {
  background: #f2f5f4;
  color: var(--text);
  border: 1px solid #e7edea;
  border-bottom-left-radius: 4px;
}

/* ---- 等待回复的三点动画 ---- */
.bubble.typing-bubble { display: flex; align-items: center; gap: 10px; }
.typing { display: inline-flex; gap: 4px; align-items: center; }
.typing i {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--primary);
  opacity: .35;
  animation: typing-blink 1.3s infinite ease-in-out;
}
.typing i:nth-child(2) { animation-delay: .18s; }
.typing i:nth-child(3) { animation-delay: .36s; }
@keyframes typing-blink {
  0%, 70%, 100% { opacity: .28; transform: translateY(0); }
  35%           { opacity: 1;   transform: translateY(-3px); }
}
.typing-text { font-size: 13px; color: var(--muted); }

.bubble.error-bubble { background: #fdeceb; border-color: #f7d5d4; color: #a3272b; }
.bubble.error-bubble details { margin-top: 8px; }
.bubble.error-bubble summary { cursor: pointer; font-size: 12px; color: #b5595c; outline: none; }
.bubble.error-bubble .error-raw {
  margin-top: 6px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, .7);
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  line-height: 1.5;
  color: #7d4144;
  word-break: break-all;
  white-space: pre-wrap;
}

/* ---- 输入区 ---- */
.chat-input-wrap { flex-shrink: 0; padding: 0 8% 14px; background: #fff; }
.chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 8px 8px 8px 14px;
  background: #fbfcfb;
  transition: border-color .15s, box-shadow .15s;
}
.chat-input-area:focus-within {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(15, 107, 86, .1);
}
.chat-input-area textarea {
  flex: 1;
  resize: none;
  border: none;
  background: transparent;
  padding: 8px 0;
  font-size: 14.5px;
  line-height: 1.6;
  font-family: inherit;
  outline: none;
  max-height: 160px;
  overflow-y: auto;
}
.chat-input-area textarea:disabled { color: var(--muted); }
.chat-input-area button {
  width: 38px; height: 38px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: none;
  border-radius: 11px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  padding: 0;
  transition: opacity .15s, transform .12s;
}
.chat-input-area button:hover:not(:disabled) { transform: translateY(-1px); }
.chat-input-area button:disabled { opacity: .55; cursor: not-allowed; }

/* 发送中：图标换成转圈 */
.chat-input-area button .spinner { display: none; }
.chat-input-area button.loading .icon-send { display: none; }
.chat-input-area button.loading .spinner {
  display: block;
  width: 15px; height: 15px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.chat-disclaimer {
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 9px;
}
/* 备案号链接跟免责声明同色，不要做成显眼的蓝链接 */
.chat-disclaimer a { color: inherit; text-decoration: none; }
.chat-disclaimer a:hover { color: var(--primary); }

@media (max-width: 900px) {
  .chat-messages, .chat-input-wrap { padding-left: 20px; padding-right: 20px; }
  .sidebar { width: 200px; }
  .msg .bubble { max-width: 85%; }
}
