/* 明亮多彩科技风 · PbootCMS 批量发文工具 UI
 * 主色：蓝(primary) + 白(背景) + 黄(高亮/警示) + 绿(成功) + 红(危险)
 * 目标：亲切、鲜活、清晰，不过度暗沉。
 */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #eef3fb;
  --bg-soft: #f6f9fd;
  --card: #ffffff;
  --card-hover: #ffffff;
  --line: #e3e9f2;
  --line-soft: #eef2f8;
  --text: #1f2d3d;
  --text-muted: #6b7a90;
  --primary: #2f6bff;
  --primary-d: #1d4ed8;
  --primary-glow: rgba(47, 107, 255, 0.28);
  --gold: #f5b50a;
  --ok: #16a34a;
  --warn: #f59e0b;
  --no: #ef4444;
  --shadow: 0 6px 22px rgba(31, 45, 61, 0.10);
  --radius: 14px;
}

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 0%, rgba(47, 107, 255, 0.10), transparent 38%),
    radial-gradient(circle at 88% 8%, rgba(16, 185, 129, 0.10), transparent 40%),
    linear-gradient(180deg, #eef3fb 0%, #f6f9fd 60%, #eef3fb 100%);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

/* 顶部彩色科技标题栏 */
.topbar {
  background: linear-gradient(120deg, #1d4ed8 0%, #2f6bff 45%, #22b8cf 100%);
  color: #fff;
  padding: 18px 28px;
  display: flex;
  align-items: baseline;
  gap: 16px;
  box-shadow: 0 6px 24px rgba(31, 77, 216, 0.28);
  position: relative;
  overflow: hidden;
}
.topbar::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -50px;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.18), transparent 70%);
  pointer-events: none;
}
.brand {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #fff;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.15);
}
.brand-sub { color: #eaf2ff; font-size: 13px; font-weight: 500; letter-spacing: 0.3px; }
.admin-link {
  margin-left: auto;
  color: #fff;
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.35);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  align-self: center;
}
.admin-link:hover { background: rgba(255,255,255,0.28); }

/* Tab 导航 */
.tabs {
  display: flex;
  gap: 6px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 0 24px;
  box-shadow: 0 2px 10px rgba(31, 45, 61, 0.05);
}
.tab {
  background: none;
  border: none;
  padding: 14px 20px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted);
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
}
.tab:hover { color: var(--primary); }
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 700;
}

.container { max-width: 1100px; margin: 28px auto; padding: 0 22px 80px; }
.panel { display: none; animation: fadeIn 0.35s ease; }
.panel.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-head .head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
h2 { font-size: 19px; font-weight: 700; color: var(--text); }
h3 { font-size: 15px; margin: 26px 0 12px; color: var(--primary-d); font-weight: 700; }
h3:first-of-type { margin-top: 0; }
.hint { color: var(--text-muted); margin-bottom: 16px; font-size: 13px; line-height: 1.7; }

/* 按钮 */
.btn {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 9px 18px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
}
.btn:hover { border-color: #b9cef2; box-shadow: 0 2px 10px rgba(47, 107, 255, 0.12); transform: translateY(-1px); }
.btn.primary {
  background: linear-gradient(135deg, #2f6bff, #1d4ed8);
  border-color: transparent;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(47, 107, 255, 0.30);
}
.btn.primary:hover { background: linear-gradient(135deg, #3f7bff, #2456e0); box-shadow: 0 6px 22px rgba(47, 107, 255, 0.42); }
.btn.success {
  background: linear-gradient(135deg, #1fb866, #13924e);
  border-color: transparent;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(16, 163, 74, 0.28);
}
.btn.danger { color: var(--no); border-color: #f3c0c0; }
.btn.danger:hover { background: #fdeaea; }
.btn.ok { color: #2b8a3e; border-color: #b2e2bd; }
.btn.ok:hover { background: #eaf7ee; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.actions { display: flex; align-items: center; gap: 14px; margin: 12px 0 18px; flex-wrap: wrap; }
.status-text { color: var(--text-muted); font-size: 13px; }

/* 表单 */
.field { margin: 12px 0; }
.field > label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; font-weight: 500; }
input, textarea, select {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: all 0.2s ease;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.14);
}
input::placeholder, textarea::placeholder { color: #aab4c4; }
textarea { resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.field.inline { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.field.inline > label { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 0; font-size: 14px; color: var(--text); cursor: pointer; }
.field.inline input[type="checkbox"], .field.inline input[type="radio"] { width: auto; margin: 0; accent-color: var(--primary); }

/* ===== 开关式复选框（toggle switch） ===== */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-size: 14px; color: var(--text); line-height: 1.4; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .slider { position: relative; flex: none; width: 44px; height: 24px; background: #cbd5e1; border-radius: 24px; transition: background .2s ease; }
.switch .slider::before { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s ease; }
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(20px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--primary-d); outline-offset: 2px; }
.switch .switch-label { font-weight: 500; }
.switch .switch-hint { font-size: 12px; color: var(--text-muted); }

/* 内容风险命中高亮（查看正文时标记风险词） */
.article-preview mark.risk-hit { background: #ffe0e0; color: #b42318; padding: 0 2px; border-radius: 3px; font-weight: 600; }
.risk-banner { margin: 0 0 12px; padding: 9px 13px; border-radius: 9px; font-size: 13px; line-height: 1.5; }
.risk-banner.high { background: #fde8e8; color: #b42318; border: 1px solid #f5c2c2; }
.risk-banner.mid { background: #fff4e0; color: #b54708; border: 1px solid #f5d9a8; }
.risk-banner.low { background: #e7f6ec; color: #15803d; border: 1px solid #b6e3c6; }

/* 文本域（风控规则的匹配词 / 说明） */
.field textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; font-size: 14px; font-family: inherit; color: var(--text); background: var(--bg, #f7f9fc); resize: vertical; box-sizing: border-box; line-height: 1.5; }
.field textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,107,255,.12); }

/* 档位卡片右上角：档位 key + 删除按钮 */
.card-top .top-actions { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.risk-note { color: var(--no); font-size: 13px; }
.field-hint { display: block; font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.field-hint b { color: var(--text); font-weight: 600; }

/* 卡片 */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(31, 45, 61, 0.14);
  border-color: #c5d8fb;
}
.card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-meta { font-size: 13px; color: var(--text-muted); line-height: 2; word-break: break-all; }
.card-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.badge { font-size: 12px; padding: 3px 10px; border-radius: 20px; font-weight: 700; }
.badge.ok { background: #e7f7ee; color: #13924e; border: 1px solid #bce9cd; }
.badge.warn { background: #fff6e0; color: #b4790a; border: 1px solid #ffe2a0; }
.badge.no { background: #fdecec; color: #d33a3a; border: 1px solid #f6c4c4; }

/* 站点选择 chip */
.chip-row { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 24px;
  cursor: pointer;
  font-size: 13px;
  background: #fff;
  color: var(--text-muted);
  transition: all 0.2s ease;
}
.chip:hover { border-color: #b9cef2; color: var(--text); }
.chip.on { border-color: var(--primary); background: #eaf1ff; color: var(--primary-d); box-shadow: 0 0 12px rgba(47, 107, 255, 0.14); }
.chip[title] { opacity: .85; }

/* 结果列表 */
.result-list { display: flex; flex-direction: column; gap: 12px; }
.result {
  display: flex;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  transition: box-shadow 0.2s ease;
}
.result:hover { box-shadow: 0 4px 18px rgba(31, 45, 61, 0.10); }
.result .chk { padding-top: 3px; }
.result-body { flex: 1; min-width: 0; }
.result-title { font-weight: 700; color: var(--text); }
.result-meta { font-size: 12px; color: var(--text-muted); margin: 4px 0; }
.result.ok { border-left: 3px solid var(--ok); }
.result.bad { border-left: 3px solid var(--no); }
.edit-row { margin: 8px 0; }
.edit-row label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.edit-title, .edit-desc {
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  padding: 7px 11px;
}
.edit-title { font-size: 14px; font-weight: 700; }
.edit-desc { font-size: 13px; }
.edit-actions { margin: 10px 0; display: flex; gap: 10px; flex-wrap: wrap; }
.article-editor { margin: 10px 0 14px; }
.edit-content {
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #2b3543;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  padding: 12px;
  resize: vertical;
}
.pub-summary {
  font-size: 14px;
  padding: 11px 15px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 14px;
  color: var(--text-muted);
}

/* 栏目选择 */
.sort-pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.sort-pick { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.sort-pick label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.sort-pick select { background: #fff; }
.pub-actions { margin-top: 16px; }
.md { font-size: 13px; color: #3a4654; white-space: pre-wrap; margin-top: 6px; }
.err { color: #d33a3a; font-size: 13px; white-space: pre-wrap; word-break: break-word; line-height: 1.6; margin-top: 8px; }
.relogin-banner {
  margin: 16px 0;
  padding: 13px 16px;
  background: #fff6e0;
  border: 1px solid #ffe2a0;
  border-radius: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  color: #b4790a;
}
details summary { cursor: pointer; color: var(--primary); font-size: 13px; font-weight: 600; }

/* 工具栏 */
.result-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 26px 0 12px; flex-wrap: wrap; }
.result-toolbar h3 { margin: 0; }
.toolbar-actions { display: flex; align-items: center; gap: 10px; }

/* 文章预览 */
.article-preview {
  margin-top: 10px;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  max-height: 380px;
  overflow: auto;
  color: #2b3543;
  line-height: 1.85;
}
.article-preview h1, .article-preview h2, .article-preview h3, .article-preview h4 { margin: 16px 0 10px; line-height: 1.4; color: #1f2d3d; }
.article-preview h2 { font-size: 17px; }
.article-preview h3 { font-size: 15px; color: #2f6bff; }
.article-preview p { margin: 10px 0; }
.article-preview ul, .article-preview ol { margin: 10px 0 10px 24px; }
.article-preview li { margin: 5px 0; }
.article-preview img { max-width: 100%; border-radius: 8px; }
.article-preview a { color: #1d4ed8; }
.article-preview code { background: #eef2f8; padding: 2px 7px; border-radius: 5px; font-size: 12.5px; }
.article-preview blockquote { border-left: 3px solid var(--gold); margin: 10px 0; padding-left: 14px; color: #7a6a44; }

/* 日志 */
.log {
  background: #1b2430;
  color: #d7e2ee;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  height: 300px;
  overflow: auto;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.8;
}
.log-line { white-space: pre-wrap; word-break: break-all; }
.empty { color: var(--text-muted); padding: 16px 0; }

/* 表格 */
.tbl {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.tbl th, .tbl td { padding: 11px 13px; text-align: left; border-bottom: 1px solid var(--line); font-size: 13px; }
.tbl th { background: linear-gradient(180deg, #eef4ff, #e4edff); color: #2f4b75; font-weight: 700; }
.tbl tr:last-child td { border-bottom: none; }
/* 站点管理：操作列按钮布局（编辑/删除一行，直接登录后台另起一行，避免拥挤错位） */
.tbl td.ops { vertical-align: middle; }
.tbl td.ops .ops-row { display: flex; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }
.tbl td.ops .btn-login { width: 100%; }
/* 站点管理：无效 / 失活站点标记与行底色 */
.tag { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px; font-weight: 600; line-height: 1.7; vertical-align: middle; }
.tag.warn { background: #fde8e8; color: #c0392b; }
.tag.muted { background: #eef1f5; color: #8593a5; }
.tag.ok { background: #e6f6ec; color: #1f9d55; }
tr.row-invalid td { background: #fff7f7; }
tr.row-stale td { background: #fafbfc; }
/* 站点管理：主列以「实际站点地址」为准（不受别名影响），别名作副标题；地址可点击 */
.sd-addr { color: var(--primary-d); font-weight: 600; text-decoration: none; word-break: break-all; }
.sd-addr:hover { text-decoration: underline; }
.sd-alias { font-size: 12px; color: var(--text-muted); margin-top: 2px; word-break: break-all; }
/* 行内复选框（如「显示离线/未使用站点」） */
.chk-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); cursor: pointer; user-select: none; }
.chk-inline input[type="checkbox"] { width: auto; margin: 0; accent-color: var(--primary); }
.site-stat { padding: 8px 10px; margin-bottom: 10px; background: #f7f9fb; border: 1px solid #e7ecf2; border-radius: 8px; font-size: 13px; color: #2a3340; }
.site-stat b { color: #1f6feb; }
/* 站点管理：使用状态点。绿点=在用站点（曾有过心跳）；灰点=未使用站点（从未心跳） */
.sd-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; box-shadow: 0 0 0 2px rgba(0,0,0,0.04); }
.sd-dot.sd-on { background: #1f9d55; }
.sd-dot.sd-off { background: #8593a5; }

.stats { display: flex; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 7px 14px; font-size: 13px; color: var(--text-muted); }
.stat.success { border-color: #bce9cd; color: #13924e; }
.stat.failed { border-color: #f6c4c4; color: #d33a3a; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(20, 33, 51, 0.45); display: flex; align-items: center; justify-content: center; z-index: 50; backdrop-filter: blur(3px); }
.modal {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  width: 580px;
  max-width: 94vw;
  max-height: 92vh;
  overflow: auto;
  box-shadow: 0 18px 50px rgba(31, 45, 61, 0.28);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; color: var(--text); }
.modal-head .x { border: none; background: none; font-size: 24px; cursor: pointer; color: var(--text-muted); }
.modal-head .x:hover { color: var(--text); }
.modal-body { padding: 20px 22px; }
.modal-body.center { text-align: center; }
.modal-foot { display: flex; justify-content: flex-end; gap: 12px; padding: 16px 22px; border-top: 1px solid var(--line); }
.modal-foot.center { justify-content: center; }
.captcha { max-width: 200px; border: 1px solid var(--line); border-radius: 8px; margin: 12px auto; display: block; }
#captchaInputWrap { max-width: 240px; margin: 14px auto 0; text-align: left; }

/* Toast */
.toast {
  position: fixed; bottom: 32px; left: 50%;
  transform: translateX(-50%) translateY(24px);
  background: #1f2d3d;
  color: #fff;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  opacity: 0;
  pointer-events: none;
  transition: all .25s ease;
  z-index: 100;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { background: linear-gradient(135deg, #1fb866, #13924e); }
.toast.error { background: linear-gradient(135deg, #ff5a5a, #e23a3a); }

/* 图片素材上传 */
.asset-list { display: flex; flex-direction: column; gap: 12px; }
.asset-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
}
.asset-name { flex: 1; min-width: 0; font-size: 13px; word-break: break-all; color: var(--text); }
.asset-status { font-size: 12px; font-weight: 700; }
.asset-status.ok { color: var(--ok); }
.asset-status.no { color: var(--no); }
.asset-item .btn { flex-shrink: 0; }
.asset-item { cursor: pointer; transition: border-color .15s, background .15s; outline: none; }
.qty { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); font-weight: 600; }
.qty select { font-weight: 600; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); }
.qty select:disabled { opacity: .5; }
.asset-item:focus { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(245, 181, 10, 0.18); }
.asset-item.dragover { background: #fff9e6; border-color: var(--gold); border-style: dashed; }

/* 配图预览网格 */
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-top: 10px; }
.asset-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.asset-card.unused { opacity: .5; filter: grayscale(.6); }
.asset-card.img-err { border-color: var(--no); }
.asset-thumb { height: 140px; background: #f1f5fb; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.asset-thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-broken { color: var(--text-muted); font-size: 13px; }
.asset-info { padding: 8px 10px 4px; }
.asset-name { font-size: 13px; font-weight: 600; color: var(--text); word-break: break-all; }
.asset-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.asset-actions { display: flex; gap: 6px; padding: 8px 10px 10px; flex-wrap: wrap; }
.asset-actions .btn { flex: 1 1 auto; }
.asset-err { padding: 0 10px 10px; font-size: 12px; color: var(--no); word-break: break-all; }
.img-summary { margin-top: 8px; font-size: 13px; color: var(--primary-d); font-weight: 600; background: #eaf1ff; border: 1px solid #d3e0ff; border-radius: 8px; padding: 6px 10px; }

/* 会员 / 授权管理 */
.license-card { padding: 18px; }
.license-card .muted { color: var(--text-muted); font-size: 13px; line-height: 1.8; }
.lic-row { font-size: 13px; color: var(--text); line-height: 2; }
.lic-row b { color: var(--text); }
.lic-row code, #licListBody code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #eef2f8; padding: 1px 7px; border-radius: 6px; font-size: 12.5px;
  color: #2b3543; word-break: break-all;
}

/* 滚动条、空状态、响应式 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #e6ecf5; }
::-webkit-scrollbar-thumb { background: #b9c7da; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #93a6bf; }

@media (max-width: 720px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .tabs { overflow-x: auto; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 6px; }
}

/* ===== 授权后台：环境变量提示 ===== */
.env-alert { background: #fff4e5; border-bottom: 1px solid #ffd591; color: #8a4b00; padding: 12px 24px; font-size: 13px; line-height: 1.7; }
.env-alert b { color: #a32d2d; }
.env-alert ul { margin: 6px 0 0 18px; }
.env-ok { background: #eaf6ec; border-bottom: 1px solid #b7e0bf; color: #1d6b2e; padding: 10px 24px; font-size: 13px; }
.env-ok a { color: #1d6b2e; font-weight: 600; }

/* ===== 授权后台：登录卡片 ===== */
.login-card {
  max-width: 380px; margin: 10vh auto 0; background: var(--card);
  border: 1px solid var(--line); border-radius: 16px; padding: 32px;
  box-shadow: var(--shadow);
}
.login-card h1 { font-size: 19px; margin-bottom: 6px; }
.login-card .sub { color: var(--text-muted); font-size: 13px; margin-bottom: 22px; line-height: 1.6; }
.muted { color: var(--text-muted); }
.server-url { font-size: 12px; color: var(--text-muted); }
code.key { font-weight: 600; }

/* ===== 授权后台：栏目卡片 ===== */
.section-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; box-shadow: var(--shadow); margin-bottom: 18px; }
.section-card h2 { font-size: 16px; margin: 0 0 14px; }
.section-card h3 { font-size: 14px; margin: 18px 0 8px; }

/* ===== 授权后台：分栏目外壳（侧边导航 + 主区） ===== */
.admin-shell { display: flex; min-height: 100vh; }
.admin-side {
  width: 224px; flex-shrink: 0;
  background: linear-gradient(180deg, #1d4ed8 0%, #2f6bff 60%, #1f3f8f 100%);
  color: #fff; display: flex; flex-direction: column;
  position: sticky; top: 0; align-self: flex-start; height: 100vh;
  box-shadow: 4px 0 24px rgba(31, 77, 216, 0.18);
}
.side-brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 14px; }
.side-logo { font-size: 26px; }
.side-title { font-size: 17px; font-weight: 800; letter-spacing: .5px; }
.side-sub { font-size: 11px; opacity: .8; margin-top: 2px; }
.side-nav { display: flex; flex-direction: column; padding: 8px 12px; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 10px; cursor: pointer;
  color: rgba(255,255,255,.82); font-size: 14px; font-weight: 500;
  transition: all .18s ease; text-decoration: none;
}
.nav-item .ico { font-size: 16px; width: 20px; text-align: center; }
.nav-item:hover { background: rgba(255,255,255,.12); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.20); color: #fff; font-weight: 700; box-shadow: inset 3px 0 0 #22b8cf; }
.side-foot { padding: 14px; display: flex; flex-direction: column; gap: 8px; border-top: 1px solid rgba(255,255,255,.16); }
.admin-side .btn { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.28); color: #fff; }
.admin-side .btn:hover { background: rgba(255,255,255,.28); }
.block { width: 100%; text-align: center; }

.admin-main { flex: 1; min-width: 0; padding: 26px 30px 60px; }
.admin-main .panel { animation: fadeIn .3s ease; }

/* ===== 授权后台：概览卡片 ===== */
.ov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 18px; }
.ov-card {
  position: relative; overflow: hidden;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 20px 18px 18px; box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}
.ov-card::before {
  content: ""; position: absolute; left: 0; top: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--primary), #22b8cf 60%, var(--gold));
}
.ov-card:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(31, 45, 61, 0.16); }
.ov-card .num {
  font-size: 32px; font-weight: 800; line-height: 1.1;
  background: linear-gradient(120deg, var(--primary-d), var(--primary) 55%, #22b8cf);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.ov-card .lbl { font-size: 14px; color: var(--text-muted); margin-top: 8px; }
.admin-status { display: flex; flex-wrap: wrap; gap: 8px; }

/* 密钥分类统计（首页 · 按会员档位） */
.tier-stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.tier-stat-card {
  position: relative; overflow: hidden;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 16px 16px 14px; box-shadow: var(--shadow);
}
.tier-stat-card::before {
  content: ""; position: absolute; left: 0; top: 0; right: 0; height: 4px;
  background: var(--tc, linear-gradient(90deg, var(--primary), #22b8cf 60%, var(--gold)));
}
.tier-stat-card .ts-name { font-size: 15px; font-weight: 700; }
.tier-stat-card .ts-count { font-size: 30px; font-weight: 800; margin: 6px 0 2px;
  background: linear-gradient(120deg, var(--primary-d), var(--primary) 55%, #22b8cf);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.tier-stat-card .ts-sub { display: flex; gap: 10px; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
.tier-stat-card .ts-sub b { color: var(--text); font-weight: 700; }
.tier-stat-card .ts-sub .rev { color: #e03131; }

/* ===== 授权后台：用量进度条（现代化） ===== */
.usage-bars { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 4px 0 18px; }
@media (max-width: 680px) { .usage-bars { grid-template-columns: 1fr; } }
.usage-bar {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; box-shadow: var(--shadow);
}
.ub-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; font-weight: 600; color: var(--text); }
.ub-head span:last-child { font-size: 13px; font-weight: 800; color: var(--primary-d); }
.ub-track { height: 12px; border-radius: 10px; background: #eef2f8; overflow: hidden; margin: 10px 0 8px; }
.ub-fill { height: 100%; width: 0%; border-radius: 10px; transition: width .5s ease;
  background: linear-gradient(90deg, #2f6bff, #1d4ed8); }
.ub-fill.img { background: linear-gradient(90deg, #22b8cf, #0ea5e9); }
.ub-fill.danger { background: linear-gradient(90deg, #ef4444, #f59e0b); }
.ub-foot { font-size: 12px; color: var(--text-muted); }

/* ===== 发放页：档位默认信息提示 ===== */
.tier-info {
  background: linear-gradient(120deg, #eef4ff, #f3f8ff);
  border: 1px solid #d9e4fb; border-radius: 12px;
  padding: 12px 14px; font-size: 13px; color: var(--text);
}
.tier-info b { color: var(--primary-d); }

/* ===== 授权后台：密钥管理工具栏 ===== */
.lic-toolbar { display: flex; align-items: center; gap: 10px; margin: 6px 0 16px; flex-wrap: wrap; }
.lic-toolbar .filter { width: auto; min-width: 150px; }
.lic-toolbar input.filter { flex: 1; min-width: 200px; max-width: 320px; }
.table-wrap { overflow-x: auto; border-radius: 12px; box-shadow: var(--shadow); }

/* ===== 授权后台：概览图表（紧凑一屏） ===== */
.dash-grid {
  display: grid;
  grid-template-columns: minmax(300px, 2fr) 3fr;
  grid-template-rows: minmax(320px, auto);
  gap: 14px;
  margin-top: 14px;
}
.dash-grid .chart-box {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; box-shadow: var(--shadow); min-width: 0;
  display: flex; flex-direction: column; overflow: hidden;
}
.dash-grid .chart-title {
  font-size: 14px; font-weight: 700; color: var(--primary-d);
  margin: 0 0 10px; letter-spacing: .2px; flex: none;
}
.donut-box { align-items: center; text-align: center; }
#tierDonut { width: 100%; max-width: 240px; max-height: 180px; margin: 0 auto; flex: none; }

/* 档位分布：环形图 + 带占比条/数量的图例行（替代原来的纯色点图例） */
.tier-legend { width: 100%; max-width: 320px; margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.tier-legend .tl-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.tier-legend .tl-row i { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.tier-legend .tl-name { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 88px; }
.tier-legend .tl-bar { flex: 1; height: 8px; border-radius: 4px; background: var(--line, #e8eef6); overflow: hidden; }
.tier-legend .tl-bar span { display: block; height: 100%; border-radius: 4px; }
.tier-legend .tl-val { color: var(--text-muted, #6b7a90); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* 各站点发布量：HTML 条形列表，超高纵向滚动 */
.site-bar-list {
  flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px;
  padding-right: 6px; scrollbar-gutter: stable;
}
.site-bar-list::-webkit-scrollbar { width: 8px; }
.site-bar-list::-webkit-scrollbar-thumb { background: #c9d6ea; border-radius: 4px; }
.site-bar-list::-webkit-scrollbar-thumb:hover { background: #a9bde0; }
.site-bar-list::-webkit-scrollbar-track { background: transparent; }
.sb-row { display: flex; align-items: center; gap: 10px; flex: none; }
.sb-name {
  flex: none; width: 128px; text-align: right;
  font-size: 12px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-track { flex: 1; height: 18px; background: var(--line, #eef3fa); border-radius: 9px; overflow: hidden; }
.sb-fill { height: 100%; border-radius: 9px; background: #2f6bff; min-width: 2px; transition: width .3s ease; }
.sb-num { flex: none; width: 44px; font-size: 12px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.sb-empty { margin: auto; color: var(--text-muted, #6b7a90); font-size: 14px; }

/* 图表标题行：标题 + 「只看在线站点」滑块 */
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex: none; }
.chart-head .chart-title { margin: 0; }
/* 「全部站点 / 仅在线」分段按钮：替代原滑块开关（语义更直观） */
.sb-seg { display: inline-flex; align-items: center; gap: 0; background: rgba(47,107,255,.08); border: 1px solid rgba(47,107,255,.18); border-radius: 9px; padding: 2px; flex: none; }
.sb-seg .seg-btn { border: 0; background: transparent; color: var(--text-muted, #6b7a90); font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 7px; cursor: pointer; transition: background .15s, color .15s, box-shadow .15s; white-space: nowrap; }
.sb-seg .seg-btn:hover { color: var(--text, #1f2d3d); }
.sb-seg .seg-btn.active { background: #2f6bff; color: #fff; box-shadow: 0 1px 4px rgba(47,107,255,.35); }
.sb-note { flex: none; font-size: 12px; color: var(--text-muted, #6b7a90); margin: 0 0 6px; text-align: left; }

#donutLegend, .legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 10px; justify-content: center; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text); font-weight: 500; }
.legend-item i { width: 11px; height: 11px; border-radius: 2px; display: inline-block; }
@media (max-width: 980px) {
  .dash-grid { grid-template-columns: 1fr; grid-template-rows: auto; }
  .dash-grid .chart-box { min-height: 240px; }
}

/* 旧版 chart-row 仅作兼容保留 */
.chart-row { display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 16px; }
.chart-row.overview-split { grid-template-columns: 360px 1fr; align-items: stretch; }
.breakdown-box { display: flex; flex-direction: column; }
@media (max-width: 860px) {
  .chart-row { grid-template-columns: 1fr; }
  .chart-row.overview-split { grid-template-columns: 1fr; }
}

/* ===== 概览：档位 → 密钥明细 ===== */
.tier-breakdown { display: flex; flex-direction: column; gap: 12px; max-height: 520px; overflow-y: auto; padding-right: 6px; }
.tier-card { border: 1px solid var(--line); border-left: 4px solid var(--tc, var(--primary-d)); border-radius: 12px; padding: 14px 16px; background: var(--card); transition: box-shadow .18s, border-color .18s; }
.tier-card:hover { border-color: #c9dafb; box-shadow: 0 6px 22px rgba(31, 77, 216, 0.10); }
.tc-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tc-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--tc, var(--primary-d)); }
.tc-name { font-weight: 700; font-size: 15px; color: var(--text); }
.tc-count { font-size: 13px; font-weight: 700; color: #fff; background: var(--tc, var(--primary-d)); border-radius: 20px; padding: 3px 12px; }
.tc-sub { font-size: 13px; color: var(--text-muted); margin-left: auto; }
.tc-stats { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 10px 0 6px; font-size: 13px; color: var(--text-muted); }
.tc-stats b { color: var(--text); font-weight: 700; }
.tc-empty { font-size: 13px; color: var(--text-muted); padding: 6px 0 2px; }
.kb-list { list-style: none; margin: 10px 0 0; padding: 0; border-top: 1px dashed var(--line); }
.kb-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; transition: background .12s; border-radius: 6px; }
.kb-item:hover { background: #f6f9fd; }
.kb-item:last-child { border-bottom: none; }
.kb-key { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; color: var(--text); background: var(--bg, #f4f6fa); border-radius: 4px; padding: 3px 8px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-meta { display: inline-flex; align-items: center; gap: 10px; color: var(--text-muted); white-space: nowrap; }
.kb-rd { font-size: 13px; }
.kb-q { font-size: 13px; }
.kb-more { list-style: none; font-size: 13px; color: var(--text-muted); padding: 6px 0 2px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.dot.ok { background: #16a34a; }
.dot.no { background: #ef4444; }
.dot.warn { background: #f59e0b; }
.dot.mute { background: #c4ccd8; }

/* ===== 授权后台：密钥列表分页条（每页 10 个） ===== */
.pager { display: flex; align-items: center; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.pager-info { font-size: 13px; color: var(--text-muted); margin-right: 6px; }
.pager .btn.small { min-width: 34px; }

/* ===== 授权后台：图表折叠区（首页精简，避免长页面滚动） ===== */
.chart-details {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 4px 16px 16px;
}
.chart-details > summary { padding: 12px 4px; list-style: none; cursor: pointer; }
.chart-details > summary::-webkit-details-marker { display: none; }
.chart-details > summary::before { content: "▸  "; color: var(--primary); }
.chart-details[open] > summary::before { content: "▾  "; }
.chart-details[open] { padding-top: 0; }

/* 概览更紧凑：缩短卡片间距，首页尽量一屏装下（不上下滚动） */
.ov-grid { margin-bottom: 14px; }
.ov-card { padding: 16px 16px 15px; }
.ov-card .num { font-size: 28px; }
.chart-row.overview-split { grid-template-columns: 320px 1fr; }
.tier-breakdown { max-height: 360px; }
@media (max-width: 860px) {
  .chart-row.overview-split { grid-template-columns: 1fr; }
}

