:root {
  --bg: #f4f6fc;
  --panel: #fff;
  --text: #232944;
  --muted: #8790ad;
  --line: #e8ebf5;
  --brand: #6d7cff;
  --brand-dark: #5564e8;
  --brand-soft: #eef0ff;
  --danger: #e05b6b;
  --danger-soft: #fff0f2;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; color: var(--text); background: var(--bg); font-size: 14px; }
button, input { font: inherit; }
button { cursor: pointer; }

.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex: none; background: #fff; border-right: 1px solid var(--line);
  padding: 22px 16px; display: flex; flex-direction: column;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 22px; border-bottom: 1px solid var(--line); }
.side-logo {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  background: linear-gradient(135deg, #7c8bff, #5868ea); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 19px;
}
.side-brand strong { display: block; font-size: 15px; }
.side-brand span { display: block; font-size: 10px; color: var(--muted); margin-top: 2px; letter-spacing: .4px; }
.sidebar nav { padding-top: 16px; display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a {
  text-decoration: none; color: #616a88; padding: 10px 12px; border-radius: 10px; font-size: 13px;
}
.sidebar nav a:hover { background: #f6f7ff; }
.sidebar nav a.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.side-bottom { margin-top: auto; border-top: 1px solid var(--line); padding: 16px 8px 0; }
.side-bottom span { display: block; font-size: 11px; color: var(--muted); }
.side-bottom strong { display: block; margin-top: 4px; font-size: 13px; }

.main { flex: 1; min-width: 0; padding: 26px 30px 40px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.topbar h1 { margin: 0; font-size: 22px; }
.topbar p { margin: 5px 0 0; font-size: 12px; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.live-dot { font-size: 12px; color: #4d9d7d; background: #eaf8f1; padding: 7px 11px; border-radius: 999px; }
.live-dot i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #35c48a; margin-right: 5px; }
.live-dot.offline { color: #d05b5b; background: #fff0f0; }
.live-dot.offline i { background: #e05b5b; }
.ghost-btn { border: 1px solid var(--line); background: #fff; color: #5b6380; padding: 8px 14px; border-radius: 9px; font-size: 12px; }
.ghost-btn:hover { background: #f7f8ff; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 18px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; display: flex; align-items: baseline; gap: 7px; }
.stat-card span { font-size: 12px; color: var(--muted); margin-right: auto; }
.stat-card strong { font-size: 26px; color: var(--brand-dark); }
.stat-card em { font-style: normal; font-size: 12px; color: var(--muted); }

.grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; align-items: start; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.panel-head { padding: 15px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; font-size: 15px; }
.panel-head h2 small { font-size: 11px; font-weight: 400; color: var(--muted); margin-left: 5px; }
.tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tools input { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 12px; width: 150px; outline: 0; background: #fafbff; }
.tools input:focus { border-color: #b9c2ff; }
.danger-btn { border: 1px solid #f3c9cf; background: var(--danger-soft); color: var(--danger); border-radius: 8px; padding: 7px 10px; font-size: 12px; }
.danger-btn.solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.danger-btn:hover { opacity: .86; }

.table-wrap { overflow-x: auto; min-height: 320px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid #f1f3fa; font-size: 12px; vertical-align: top; }
th { color: var(--muted); font-weight: 500; background: #fafbff; position: sticky; top: 0; }
td.msg-content { color: #404866; line-height: 1.55; word-break: break-word; max-width: 380px; }
td .row-del { border: 0; background: transparent; color: var(--danger); font-size: 12px; padding: 0; }
td .row-del:hover { text-decoration: underline; }
.check-col { width: 34px; }
.empty-row { text-align: center; color: var(--muted); padding: 60px 0; font-size: 13px; display: none; }
tr.filtered { display: none; }

.side-panels { display: flex; flex-direction: column; gap: 18px; }
.small-panel .panel-head { padding: 14px 16px; }
.online-list { padding: 12px 16px 16px; display: flex; flex-wrap: wrap; gap: 7px; }
.online-chip { display: flex; align-items: center; gap: 6px; background: #f3f5ff; color: #4b5580; border-radius: 999px; padding: 6px 10px; font-size: 12px; }
.online-chip i { width: 6px; height: 6px; border-radius: 50%; background: #35c48a; }
.online-chip small { color: #9aa2bd; font-size: 10px; }
.muted { color: var(--muted); font-size: 12px; }
.password-form { padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 7px; }
.password-form label { font-size: 11px; color: var(--muted); }
.password-form input { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 12px; outline: 0; background: #fafbff; }
.password-form input:focus { border-color: #b9c2ff; }
.primary-btn { border: 0; border-radius: 8px; padding: 9px; margin-top: 4px; background: linear-gradient(135deg, #7382ff, #5868ea); color: #fff; font-size: 12px; font-weight: 600; }

.toast { position: fixed; right: 26px; bottom: 26px; background: #2d3455; color: #fff; padding: 10px 16px; border-radius: 9px; font-size: 13px; opacity: 0; transform: translateY(12px); transition: .25s; z-index: 50; pointer-events: none; }
.toast.show { opacity: 1; transform: translateY(0); }

/* 登录页 */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #f2f5ff, #e5eaff); }
.login-card { width: min(390px, calc(100% - 32px)); background: #fff; border-radius: 20px; padding: 36px 34px 28px; box-shadow: 0 20px 60px rgba(60,72,140,.14); text-align: center; }
.login-logo { width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 17px; background: linear-gradient(135deg, #7c8bff, #5868ea); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 26px; }
.login-card h1 { margin: 0; font-size: 21px; }
.login-card p { margin: 6px 0 24px; font-size: 12px; color: var(--muted); }
.login-card form { text-align: left; }
.login-card label { display: block; font-size: 12px; color: #5b6380; margin: 0 0 7px; }
.login-card input[type=text], .login-card input[type=password] { width: 100%; border: 1px solid #dfe4f5; border-radius: 10px; padding: 11px 12px; font-size: 14px; outline: 0; background: #fafbff; margin-bottom: 16px; }
.login-card input:focus { border-color: #b9c2ff; box-shadow: 0 0 0 3px rgba(109,124,255,.1); }
.login-submit { width: 100%; border: 0; border-radius: 10px; padding: 12px; background: linear-gradient(135deg, #7382ff, #5868ea); color: #fff; font-size: 14px; font-weight: 600; }
.login-submit:hover { opacity: .92; }
.login-error { background: var(--danger-soft); color: var(--danger); border-radius: 9px; padding: 9px 11px; font-size: 12px; margin-bottom: 16px; text-align: left; }
.login-foot { margin-top: 20px; text-align: center; font-size: 12px; }
.login-foot a { color: var(--brand-dark); text-decoration: none; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { padding: 18px 14px; }
  .grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .stat-card { padding: 13px; flex-wrap: wrap; }
  .stat-card span { width: 100%; }
}
