/* ==========================================================
   在线客服系统 · 商户端 / 平台后台 / 登录注册 通用样式
   ========================================================== */

:root {
  --brand: #2f6fed;
  --brand-dark: #1f56c6;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1e2532;
  --muted: #6b7688;
  --line: #e3e8f2;
  --ok: #16a34a;
  --err: #dc2626;
  --warn: #d97706;
  --radius: 12px;
  --shadow: 0 6px 28px rgba(24, 39, 75, .08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .6em; font-weight: 600; }
code { background: #eef2fa; padding: 1px 6px; border-radius: 5px; font-size: 12px; }

/* ---------- 登录 / 注册 ---------- */

.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background:
    radial-gradient(1200px 600px at 12% -10%, #dbe6ff 0%, transparent 60%),
    radial-gradient(900px 500px at 110% 110%, #e6dcff 0%, transparent 55%),
    var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 32px 30px;
}
.auth-card--wide { max-width: 620px; }

.auth-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.auth-logo {
  width: 46px; height: 46px; border-radius: 13px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), #7c5cff);
  color: #fff; font-weight: 700; font-size: 20px;
}
.auth-brand h1 { font-size: 19px; margin: 0; }
.auth-sub { margin: 2px 0 0; color: var(--muted); font-size: 12px; }

.auth-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

.auth-foot { margin-top: 20px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- 表单 ---------- */

.form-title {
  font-size: 13px;
  text-transform: none;
  color: var(--muted);
  margin: 22px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--line);
}

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcff;
  font: inherit;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, .12);
}
.field textarea { min-height: 90px; resize: vertical; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }

/* 蜜罐字段：正常人看不见，机器人会填 */
.trap {
  position: absolute !important;
  left: -9999px !important;
  top: -9999px !important;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.btn:hover { border-color: #c9d4e8; background: #f7f9ff; text-decoration: none; }
.btn-primary {
  background: linear-gradient(135deg, var(--brand), #5b7cff);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 16px rgba(47, 111, 237, .25);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--brand-dark), #4a6cf0); }
.btn-danger { color: var(--err); border-color: #f6c9c9; background: #fff6f6; }
.btn-sm { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; margin-top: 8px; }

/* ---------- 提示 ---------- */

.alert {
  padding: 11px 14px;
  border-radius: 10px;
  margin-bottom: 14px;
  font-size: 13px;
}
.alert-ok   { background: #e9f9ef; color: #14713a; border: 1px solid #c7eed6; }
.alert-err  { background: #fdf0f0; color: #a01d1d; border: 1px solid #f6cdcd; }
.alert-warn { background: #fff8e8; color: #8a5a00; border: 1px solid #f6e3b4; }
.muted { color: var(--muted); }

/* ---------- 后台框架 ---------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 224px;
  flex: 0 0 224px;
  background: #101728;
  color: #cfd8ea;
  padding: 20px 14px;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 8px 18px;
  font-weight: 600;
  color: #fff;
}
.sidebar .brand .dot {
  width: 28px; height: 28px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), #7c5cff);
  display: grid; place-items: center; font-size: 13px;
}
.sidebar .nav-group { font-size: 11px; color: #5b6a86; padding: 14px 8px 6px; letter-spacing: .08em; }
.sidebar a.nav {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-radius: 9px;
  color: #cfd8ea; font-size: 13.5px;
  margin-bottom: 2px;
}
.sidebar a.nav:hover { background: #1a2438; text-decoration: none; }
.sidebar a.nav.active { background: #1e2b45; color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 58px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px;
}
.topbar h2 { font-size: 15px; margin: 0; }
.topbar .who { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 12px; }

.content { padding: 22px; }

/* ---------- 卡片 / 统计 ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
}
.card-title { font-size: 14px; margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px;
}
.stat .label { font-size: 12px; color: var(--muted); }
.stat .value { font-size: 26px; font-weight: 650; margin-top: 4px; letter-spacing: -.02em; }
.stat .value.warn { color: var(--warn); }
.stat .value.err { color: var(--err); }

/* ---------- 表格 ---------- */

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.table th { color: var(--muted); font-weight: 500; font-size: 12.5px; background: #fafbff; }
.table tr:last-child td { border-bottom: none; }
.table td.actions { text-align: right; white-space: nowrap; }

.badge {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 12px; background: #eef2fa; color: var(--muted);
}
.badge-ok { background: #e9f9ef; color: #14713a; }
.badge-err { background: #fdf0f0; color: #a01d1d; }
.badge-warn { background: #fff8e8; color: #8a5a00; }

/* ---------- 代码框 ---------- */

.codebox {
  background: #0f1626; color: #c9d6ee;
  border-radius: 10px; padding: 14px 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px; line-height: 1.7;
  overflow-x: auto; white-space: pre;
}

/* ---------- 会话列表 / 聊天 ---------- */

.split { display: grid; grid-template-columns: 320px 1fr; gap: 18px; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

.conv-list { max-height: 620px; overflow-y: auto; }
.conv-item {
  display: block; padding: 12px 14px; border-radius: 10px;
  border: 1px solid transparent; margin-bottom: 6px;
}
.conv-item:hover { background: #f7f9ff; text-decoration: none; }
.conv-item.active { background: #eef3ff; border-color: #cddcff; }
.conv-item .title { font-size: 13.5px; font-weight: 550; display: flex; justify-content: space-between; }
.conv-item .snippet { font-size: 12.5px; color: var(--muted); margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.msg-scroll { height: 460px; overflow-y: auto; padding: 8px 4px; }
.msg { display: flex; margin-bottom: 12px; }
.msg .bubble {
  max-width: 72%; padding: 9px 13px; border-radius: 12px;
  background: #f2f5fb; font-size: 13.5px; white-space: pre-wrap; word-break: break-word;
}
.msg.mine { justify-content: flex-end; }
.msg.mine .bubble { background: linear-gradient(135deg, var(--brand), #5b7cff); color: #fff; }
.msg .meta { font-size: 11px; color: var(--muted); margin-top: 4px; }

.reply-bar { display: flex; gap: 10px; margin-top: 12px; }
.reply-bar textarea {
  flex: 1; min-height: 52px; max-height: 140px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  font: inherit; resize: vertical;
}

.empty { text-align: center; color: var(--muted); padding: 60px 20px; }
.empty .big { font-size: 34px; margin-bottom: 8px; opacity: .35; }
