:root {
  --accent: #3b6fe0;
  --danger: #d9534f;
  --bg: #f2f4f8;
  --panel: #ffffff;
  --head-bg: #eef1f6;
  --line: #dde3ec;
  --text: #1f2430;
  --muted: #7a8396;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}
.btn:hover { background: var(--head-bg); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 6px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #2f5cc4; }

.app-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.app-brand { font-size: 17px; font-weight: 700; }
.app-user { display: flex; align-items: center; gap: 12px; }
.user-info { font-size: 14px; color: var(--muted); }

.admin-link {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
}
.admin-link:hover { background: var(--head-bg); }

.admin-body {
  display: flex;
  height: calc(100% - 53px);
  padding: 16px 20px;
  gap: 16px;
}

/* 左侧用户列表 */
.user-list {
  flex: 0 0 280px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}
.user-list h2 { font-size: 15px; }
.user-list-items { overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.user-item {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.user-item:hover { background: var(--head-bg); }
.user-item.active { border-color: var(--accent); background: #edf2ff; }
.user-item-name { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.user-item-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.badge {
  display: inline-block;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  background: #fff3cd;
  color: #8a6d1b;
}

/* 右侧详情 */
.detail { flex: 1; overflow-y: auto; }
.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--muted);
  font-size: 14px;
}
.empty.small { height: auto; padding: 24px 0; justify-content: flex-start; color: var(--muted); }

.user-detail {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.user-detail h2 { font-size: 17px; }

.info-grid {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 6px 12px;
}
.info-grid dt { color: var(--muted); font-size: 13px; }
.info-grid dd { font-size: 13px; word-break: break-all; }

.detail-tabs { border-bottom: 1px solid var(--line); padding-bottom: 8px; display: flex; gap: 8px; }
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.chat-pane { display: flex; flex-direction: column; }
.chat-messages { display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; }
.msg.user { justify-content: flex-end; }
.msg.bot { justify-content: flex-start; }
.msg-content {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
  line-height: 1.6;
}
.msg.user .msg-content { background: var(--accent); color: #fff; border-bottom-right-radius: 3px; }
.msg.bot .msg-content { background: var(--head-bg); color: var(--text); border-bottom-left-radius: 3px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%) translateY(20px);
  background: #32343a;
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 999;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); }