/* QQBot Studio 运营中心 —— 管理后台样式
   深色 + 卡片 + 侧边栏，零外部依赖（无字体/图标库，用 emoji 与内联 SVG） */

:root {
  --bg: #0b1020;
  --bg-soft: #111a2e;
  --card: #16213a;
  --card-hover: #1c2947;
  --line: #24314f;
  --text: #e6ecff;
  --text-dim: #93a3c4;
  --text-mute: #64748b;
  --primary: #5b8cff;
  --primary-dim: #33518f;
  --success: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 14px;
  --shadow: 0 8px 28px rgba(0, 0, 0, .32);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: radial-gradient(1200px 600px at 10% -10%, #16224a 0%, var(--bg) 55%) fixed;
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea {
  background: #0e1729;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91, 140, 255, .16);
}
textarea { resize: vertical; min-height: 90px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: .2px; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }

/* ── 登录页 ── */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: linear-gradient(180deg, rgba(22,33,58,.96), rgba(14,23,41,.96));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 34px 30px;
  box-shadow: var(--shadow);
}
.login-card .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 19px;
  font-weight: 700;
}
.login-card .brand .logo {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, #5b8cff, #22d3ee);
  display: grid; place-items: center; font-size: 19px;
}
.login-card .sub { color: var(--text-mute); font-size: 12.5px; margin-bottom: 24px; }
.login-card .field { margin-bottom: 14px; }

/* ── 布局 ── */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar {
  background: rgba(11,16,32,.86);
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 16px; font-weight: 700; }
.sidebar .brand .logo {
  width: 32px; height: 32px; border-radius: 10px;
  background: linear-gradient(135deg, #5b8cff, #22d3ee);
  display: grid; place-items: center; font-size: 16px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--text-dim); cursor: pointer; user-select: none;
  border: 1px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.nav-item:hover { background: var(--card); color: var(--text); }
.nav-item.active { background: linear-gradient(90deg, rgba(91,140,255,.18), rgba(91,140,255,.04)); color: #fff; border-color: var(--primary-dim); }
.nav-item .ico { width: 18px; text-align: center; }
.sidebar .foot { margin-top: auto; font-size: 11.5px; color: var(--text-mute); padding: 10px 8px; }

.main { padding: 22px 26px 60px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.topbar h1 { font-size: 20px; }
.topbar .actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ── 组件 ── */
.card {
  background: linear-gradient(180deg, var(--card), var(--bg-soft));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-title h3 { font-size: 15px; }
.card-title .hint { font-size: 12px; color: var(--text-mute); }

.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.c4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.stat {
  background: linear-gradient(160deg, rgba(30,44,74,.9), rgba(16,25,44,.9));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.stat .k { font-size: 12px; color: var(--text-dim); margin-bottom: 8px; }
.stat .v { font-size: 26px; font-weight: 700; letter-spacing: .5px; }
.stat .v.sm { font-size: 20px; }
.stat .t { font-size: 11.5px; color: var(--text-mute); margin-top: 6px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  transition: transform .08s, background .15s, border-color .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--card-hover); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg, #4f7ff0, #5b8cff); border-color: transparent; color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.4); color: #fca5a5; }
.btn.danger:hover { background: rgba(239,68,68,.2); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: 11.5px;
  background: rgba(147,163,196,.12); color: var(--text-dim); border: 1px solid var(--line);
}
.badge.ok { background: rgba(34,197,94,.14); color: #86efac; border-color: rgba(34,197,94,.35); }
.badge.warn { background: rgba(245,158,11,.14); color: #fcd34d; border-color: rgba(245,158,11,.35); }
.badge.bad { background: rgba(239,68,68,.14); color: #fca5a5; border-color: rgba(239,68,68,.35); }
.badge.key { font-family: ui-monospace, monospace; font-size: 11px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; font-weight: 600; color: var(--text-dim);
  font-size: 12px; padding: 10px 10px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td { padding: 11px 10px; border-bottom: 1px solid rgba(36,49,79,.55); vertical-align: middle; }
tbody tr:hover { background: rgba(28,41,71,.5); }
.table-wrap { overflow-x: auto; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--text-mute); }
.dim { color: var(--text-dim); }
.small { font-size: 12px; }
.truncate { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.msg { padding: 10px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; display: none; }
.msg.show { display: block; }
.msg.ok { background: rgba(34,197,94,.12); border: 1px solid rgba(34,197,94,.35); color: #86efac; }
.msg.err { background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.35); color: #fca5a5; }

.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 14px; font-size: 12.5px; color: var(--text-dim); }

.empty { text-align: center; padding: 40px 10px; color: var(--text-mute); }
.empty .big { font-size: 30px; margin-bottom: 10px; opacity: .8; }

canvas { width: 100%; height: 190px; display: block; }

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch .track {
  width: 38px; height: 22px; border-radius: 999px; background: #24314f;
  position: relative; transition: background .18s;
}
.switch .track::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%; background: #94a3b8;
  transition: transform .18s, background .18s;
}
.switch input:checked + .track { background: rgba(91,140,255,.55); }
.switch input:checked + .track::after { transform: translateX(16px); background: #fff; }

.modal-mask {
  position: fixed; inset: 0; background: rgba(4,8,18,.7);
  display: none; place-items: center; padding: 20px; z-index: 50;
  backdrop-filter: blur(3px);
}
.modal-mask.show { display: grid; }
.modal {
  width: 100%; max-width: 560px; background: var(--card);
  border: 1px solid var(--line); border-radius: 18px; padding: 22px;
  box-shadow: var(--shadow); max-height: 86vh; overflow: auto;
}
.modal h3 { margin-bottom: 14px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  padding: 9px 14px; cursor: pointer; color: var(--text-dim);
  border-bottom: 2px solid transparent; font-size: 13.5px;
}
.tab.active { color: #fff; border-bottom-color: var(--primary); }

.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 14px; font-size: 13px; }
.kv .k { color: var(--text-dim); }
.kv .v { word-break: break-all; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
  .sidebar .brand { width: 100%; }
  .sidebar .foot { display: none; }
  .main { padding: 16px; }
}
