/* ============ 群管平台 全局样式 ============ */
:root {
  --bg: #0f1420;
  --bg-soft: #151c2c;
  --panel: #1a2235;
  --panel-2: #202a42;
  --border: #2a3652;
  --text: #e6ebf5;
  --text-dim: #93a1bd;
  --primary: #2f81f7;
  --primary-2: #1f6feb;
  --accent: #22c3a6;
  --danger: #f85149;
  --warn: #d29922;
  --ok: #3fb950;
  --radius: 10px;
  --shadow: 0 8px 24px rgba(0,0,0,.35);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea {
  font-family: inherit; font-size: 13px; color: var(--text);
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 12px; width: 100%; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
textarea { resize: vertical; min-height: 70px; }

/* 按钮 */
.button {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 16px; font-size: 13px; transition: all .15s;
}
.button:hover { border-color: var(--primary); color: #fff; }
.button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.button.primary:hover { background: var(--primary-2); }
.button.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.button.danger:hover { background: var(--danger); color: #fff; }
.button.ghost { background: transparent; }
.button.small { padding: 5px 10px; font-size: 12px; }
.button.block { width: 100%; justify-content: center; }
.button:disabled { opacity: .5; cursor: not-allowed; }

/* 徽章 */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 11px; background: var(--panel-2); border: 1px solid var(--border);
}
.badge.ok { color: var(--ok); border-color: rgba(63,185,80,.4); background: rgba(63,185,80,.1); }
.badge.off { color: var(--text-dim); }
.badge.warn { color: var(--warn); border-color: rgba(210,153,34,.4); background: rgba(210,153,34,.1); }
.badge.danger { color: var(--danger); border-color: rgba(248,81,73,.4); background: rgba(248,81,73,.1); }

/* 面板 */
.panel {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 16px; box-shadow: var(--shadow);
}
.panel-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.panel-title { font-size: 15px; font-weight: 600; }
.panel-body { padding: 16px 18px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; color: var(--text-dim); }
.field .hint { color: var(--text-dim); font-size: 11px; }

/* 认证页 */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1000px 500px at 20% 10%, #1b2b4d 0%, var(--bg) 55%);
  padding: 20px;
}
.auth-card {
  width: 380px; max-width: 100%;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; padding: 28px; box-shadow: var(--shadow);
}
.auth-brand { text-align: center; margin-bottom: 20px; }
.auth-brand .mark { width: 52px; height: 52px; margin: 0 auto 10px; border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center; color: #fff; }
.auth-brand strong { display: block; font-size: 20px; }
.auth-brand span { color: var(--text-dim); font-size: 12px; }
.tabs { display: flex; background: var(--bg-soft); border-radius: 9px; padding: 4px; margin-bottom: 18px; }
.tab { flex: 1; background: transparent; border: none; color: var(--text-dim); padding: 8px; border-radius: 7px; }
.tab.active { background: var(--panel-2); color: var(--text); }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-error { color: var(--danger); font-size: 12px; margin-top: 10px; min-height: 18px; }

/* 应用布局 */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex-shrink: 0; background: var(--bg-soft);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 10px; padding: 18px;
  border-bottom: 1px solid var(--border);
}
.brand .mark { width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center; color: #fff; }
.brand strong { display: block; font-size: 15px; }
.brand span { font-size: 11px; color: var(--text-dim); }
.nav { padding: 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 13px;
  background: transparent; border: none; border-radius: 9px;
  color: var(--text-dim); font-size: 13px; text-align: left; transition: all .15s;
}
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.active { background: var(--panel); color: #fff; box-shadow: inset 2px 0 0 var(--primary); }
.sidebar-footer { padding: 14px; border-top: 1px solid var(--border); }

.content { flex: 1; padding: 24px 28px; min-width: 0; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h2 { font-size: 20px; }
.page-head p { color: var(--text-dim); font-size: 13px; flex: 1; min-width: 200px; }
.page-head .button { margin-left: auto; }

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.stat-card .num { font-size: 28px; font-weight: 700; margin: 4px 0 2px; }
.stat-card .label { color: var(--text-dim); font-size: 12px; }

/* 卡片列表 */
.card-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
.card .card-title { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card .card-meta { color: var(--text-dim); font-size: 12px; margin: 8px 0; word-break: break-all; }
.card .card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.empty {
  text-align: center; color: var(--text-dim); padding: 60px 20px;
  border: 1px dashed var(--border); border-radius: var(--radius); margin: 16px 0;
}

/* 选择条 */
.selector-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.selector-bar select { width: auto; min-width: 180px; }

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--text-dim); font-weight: 500; font-size: 12px; }
tr:hover td { background: rgba(255,255,255,.02); }
.table-wrap { overflow-x: auto; }

/* 日志 */
.log-toolbar { display: flex; gap: 8px; margin-bottom: 12px; }
.log-list {
  background: #0b0f18; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; height: calc(100vh - 240px); overflow-y: auto;
  font-family: "Cascadia Code", Consolas, monospace; font-size: 12px;
}
.log-line { display: flex; gap: 10px; padding: 3px 6px; border-radius: 4px; }
.log-line:hover { background: rgba(255,255,255,.03); }
.log-line .t { color: #4c5a78; flex-shrink: 0; }
.log-line .tag { flex-shrink: 0; width: 60px; }
.log-line.kind-message .tag { color: var(--primary); }
.log-line.kind-notice .tag { color: var(--warn); }
.log-line.kind-api .tag { color: var(--accent); }
.log-line.kind-system .tag { color: var(--ok); }
.log-line.kind-request .tag { color: #b57bff; }
.log-line .c { color: var(--text-dim); word-break: break-all; }
.log-line.kind-message .c { color: var(--text); }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-dim); }
.check input { width: auto; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  width: 560px; max-width: 100%; max-height: 85vh; overflow-y: auto; box-shadow: var(--shadow);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 15px; }
.modal-body { padding: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 0 20px 20px; }
.modal .field { margin-bottom: 12px; }
.icon-btn { background: transparent; border: none; color: var(--text-dim); padding: 4px; border-radius: 6px; }
.icon-btn:hover { color: #fff; background: var(--panel-2); }

/* 开关 */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; background: var(--panel-2); border-radius: 22px; transition: .2s;
  border: 1px solid var(--border);
}
.switch .slider:before {
  content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 2px;
  background: var(--text-dim); border-radius: 50%; transition: .2s;
}
.switch input:checked + .slider { background: var(--primary); border-color: var(--primary); }
.switch input:checked + .slider:before { transform: translateX(18px); background: #fff; }

/* 配置行 */
.config-section { margin-bottom: 22px; }
.config-section h4 { font-size: 13px; color: var(--text-dim); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.config-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; flex-wrap: wrap; }
.config-row label { color: var(--text-dim); font-size: 12px; min-width: 130px; }
.config-row input, .config-row select { width: auto; flex: 1; min-width: 160px; }

.steps { padding-left: 20px; color: var(--text-dim); }
.steps li { margin-bottom: 6px; }

/* Toast */
#toastRoot { position: fixed; top: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow); font-size: 13px;
  animation: slideIn .2s ease;
}
.toast.error { border-color: var(--danger); color: var(--danger); }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* 代码块 */
.code {
  background: #0b0f18; border: 1px solid var(--border); border-radius: 8px;
  padding: 12px; font-family: Consolas, monospace; font-size: 12px;
  white-space: pre-wrap; word-break: break-all; max-height: 260px; overflow-y: auto;
}
.copy-btn { margin-top: 8px; }

/* 扫码登录弹窗 */
.qr-box { text-align: center; }
.qr-hint { margin-bottom: 12px; color: var(--text-dim, #9aa4b2); font-size: 13px; }
.qr-hint span { color: var(--ok, #22c55e); }
.qr-img {
  width: 220px; height: 220px; margin: 0 auto 12px;
  border: 1px solid var(--border); border-radius: 12px;
  background: #fff; display: flex; align-items: center; justify-content: center;
  overflow: hidden; padding: 10px;
}
.qr-img img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.qr-placeholder { color: #8a94a6; font-size: 13px; padding: 0 20px; line-height: 1.8; }
.qr-success { color: #22c55e; font-size: 16px; font-weight: 600; }
.qr-tip { color: #8a94a6; font-size: 12px; margin-top: 4px; }
