* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #2f6bff;
  --primary-dark: #1e54d8;
  --bg: #f0f2f5;
  --card: #ffffff;
  --text: #2b2f36;
  --text-2: #8a919c;
  --border: #e3e7ee;
  --green: #22b573;
  --red: #e5484d;
  --radius: 10px;
}
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 14px; outline: none; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #c6ccd6; border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

.btn {
  border: none; border-radius: 6px; padding: 8px 16px; font-size: 14px;
  background: var(--primary); color: #fff; transition: .15s;
}
.btn:hover { background: var(--primary-dark); }
.btn.ghost { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn.ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn.danger { background: var(--red); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.input, .textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px;
  background: #fff; transition: border-color .15s;
}
.input:focus, .textarea:focus { border-color: var(--primary); }
.textarea { resize: vertical; min-height: 80px; }

.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(16,24,40,.06);
}

.avatar {
  width: 38px; height: 38px; border-radius: 50%; object-fit: cover;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; font-size: 16px; flex: none; background: #8aa4d8;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #2f6bff 0%, #6f5bff 100%);
}
.login-box {
  width: 360px; background: #fff; border-radius: 14px; padding: 36px 32px;
  box-shadow: 0 12px 40px rgba(0,0,0,.18);
}
.login-box h1 { font-size: 22px; text-align: center; margin-bottom: 6px; }
.login-box .sub { text-align: center; color: var(--text-2); margin-bottom: 26px; font-size: 13px; }
.login-box .input { margin-bottom: 14px; }
.login-box .btn { width: 100%; padding: 11px; font-size: 15px; }
.login-err { color: var(--red); font-size: 13px; margin-bottom: 10px; min-height: 18px; text-align: center; }
.captcha-row { display: flex; gap: 10px; margin-bottom: 14px; }
.captcha-row .input { flex: 1; margin-bottom: 0; }
.captcha-img { height: 38px; width: 120px; border-radius: 6px; cursor: pointer; border: 1px solid var(--border); background: #f4f6fa; flex: none; }
.captcha-refresh { border: none; background: none; font-size: 18px; cursor: pointer; color: var(--text-2); padding: 0 4px; }
.captcha-refresh:hover { color: var(--primary); }

/* ---------- 布局 ---------- */
.layout { display: flex; height: 100vh; }
.sidebar {
  width: 210px; background: #1c2433; color: #cbd2dd; flex: none;
  display: flex; flex-direction: column; padding-top: 18px;
}
.sidebar .logo { padding: 0 20px 20px; font-size: 17px; font-weight: 700; color: #fff; }
.sidebar .logo span { color: var(--primary); }
.nav-item {
  padding: 12px 20px; cursor: pointer; display: flex; align-items: center; gap: 10px;
  color: #b6bfcc; border-left: 3px solid transparent;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,.04); }
.nav-item.active { color: #fff; background: rgba(47,107,255,.18); border-left-color: var(--primary); }
.sidebar .user { margin-top: auto; padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.08); font-size: 13px; color: #8b94a3; }
.sidebar .user button { background: none; border: none; color: #8b94a3; cursor: pointer; font-size: 13px; }
.sidebar .user button:hover { color: #fff; }

.main { flex: 1; overflow: auto; padding: 24px 28px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-head h2 { font-size: 20px; }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; padding: 12px 14px; font-size: 13px; color: var(--text-2);
  font-weight: 500; border-bottom: 1px solid var(--border); background: #fafbfc;
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:hover td { background: #f8faff; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 12px; }
.badge.on { background: rgba(34,181,115,.12); color: var(--green); }
.badge.off { background: rgba(138,145,156,.12); color: var(--text-2); }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,20,30,.45); z-index: 50;
  display: flex; align-items: center; justify-content: center;
}
.modal {
  width: 440px; max-width: 92vw; background: #fff; border-radius: 12px; padding: 24px;
}
.modal h3 { font-size: 17px; margin-bottom: 18px; }
.modal .field { margin-bottom: 14px; }
.modal .field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.modal .btns { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.form-row { display: flex; gap: 10px; align-items: center; }
.form-row .input { flex: 1; }

/* ---------- 状态徽章/标签 ---------- */
.code-box {
  background: #0f1729; color: #9fe8c8; padding: 6px 8px; border-radius: 6px;
  font-family: Consolas, monospace; font-size: 12px; word-break: break-all; user-select: all;
}

/* 聊天消息头像 */
.msg .msg-avatar {
  width: 34px; height: 34px; border-radius: 50%; overflow: hidden; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; font-size: 15px; background: #8aa4d8;
}
.msg .msg-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.chat-body.drop-hover { outline: 2px dashed var(--primary); outline-offset: -4px; }
