:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --ink: #2c2c2a;
  --muted: #888780;
  --line: #ece8e1;
  --brand: #d85a30;
  --brand-soft: #faece7;
  --bot: #f3f1ec;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--brand); color: #fff; font-weight: 600;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.title { font-weight: 600; font-size: 16px; }
.subtitle { font-size: 12px; color: var(--muted); }
.top-right { display: flex; align-items: center; gap: 10px; }
.status {
  font-size: 12px; padding: 4px 10px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand);
}
.settings-btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  font-size: 12px; padding: 5px 12px; border-radius: 999px; cursor: pointer;
}
.settings-btn:hover { border-color: var(--brand); color: var(--brand); }

.team {
  display: flex; gap: 10px; padding: 14px 20px; overflow-x: auto;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.member {
  flex: 0 0 auto; min-width: 120px; text-align: center;
  padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg);
}
.member.lead { border-color: var(--brand); background: var(--brand-soft); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; margin: 0 auto 6px;
  background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600;
}
.member:not(.lead) .avatar { background: #b4b2a9; }
.m-name { font-size: 13px; font-weight: 600; }
.m-role { font-size: 11px; color: var(--muted); margin-top: 2px; }

.chat { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.msg {
  max-width: 78%; padding: 12px 14px; border-radius: 14px; line-height: 1.65;
  white-space: pre-wrap; word-break: break-word; font-size: 14px;
}
.msg.user { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: var(--bot); border-bottom-left-radius: 4px; }
.msg.bot.demo { border: 1px dashed var(--brand); }

.composer {
  display: flex; gap: 10px; padding: 14px 20px; background: var(--surface);
  border-top: 1px solid var(--line);
}
#input {
  flex: 1; resize: none; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font: inherit; font-size: 14px; background: var(--bg); color: var(--ink);
}
#input:focus { outline: none; border-color: var(--brand); }
#send {
  border: none; background: var(--brand); color: #fff; font-size: 14px; font-weight: 600;
  padding: 0 22px; border-radius: 10px; cursor: pointer;
}
#send:hover { opacity: 0.92; }

.search-toggle {
  flex: 0 0 auto; align-self: stretch; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); font-size: 18px; line-height: 1;
  padding: 0 12px; border-radius: 10px; cursor: pointer;
}
.search-toggle:hover { border-color: var(--brand); }
.search-toggle.active { background: var(--brand); color: #fff; border-color: var(--brand); }

.msg.note {
  align-self: center; max-width: 90%; text-align: center;
  font-size: 12px; color: var(--brand); background: var(--brand-soft);
  border-radius: 999px; padding: 5px 14px; white-space: normal;
}

.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.35); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal.hidden { display: none; }
.modal-box { background: var(--surface); width: min(440px, 92vw); border-radius: 14px; padding: 22px; box-shadow: 0 10px 40px rgba(0,0,0,0.18); }
.modal-box h3 { margin: 0 0 14px; font-size: 16px; }
.modal-box label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 4px; }
.modal-box input { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 14px; }
.modal-box input:focus { outline: none; border-color: var(--brand); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.modal-actions button { border: none; padding: 8px 16px; border-radius: 8px; font-size: 14px; cursor: pointer; }
#cfgSave { background: var(--brand); color: #fff; font-weight: 600; }
#cfgClose { background: var(--bot); color: var(--ink); }
.modal-box .hint { font-size: 11px; color: var(--muted); margin: 14px 0 0; line-height: 1.6; }
.modal-box h4 { margin: 18px 0 0; font-size: 14px; }
.modal-box .sep { border: none; border-top: 1px solid var(--line); margin: 16px 0 4px; }
.modal-box label.row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); margin: 10px 0; }
.modal-box label.row input { width: auto; }
.modal-box select { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 14px; background: var(--surface); }
.modal-box select:focus { outline: none; border-color: var(--brand); }
