/* ==========================================================================
   公众号文章管理系统 - 设计系统
   零外部依赖，可直接被 Nginx/Apache 静态托管，离线环境亦可用。
   ========================================================================== */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #101828;
  --text-2: #475467;
  --muted: #98a2b3;
  --primary: #2f6bff;
  --primary-dark: #1d4ed8;
  --primary-soft: #eef3ff;
  --success: #079455;
  --success-soft: #ecfdf3;
  --warning: #dc6803;
  --warning-soft: #fffaeb;
  --danger: #d92d20;
  --danger-soft: #fef3f2;
  --sidebar-bg: #10203a;
  --sidebar-text: #b9c5d8;
  --sidebar-active: #ffffff;
  --radius: 10px;
  --radius-sm: 8px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 4px 12px rgba(16, 24, 40, .07);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

h1, h2, h3, h4, h5 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }

code, pre { font-family: var(--mono); font-size: 12.5px; }
pre {
  background: #0d1117;
  color: #e6edf3;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  line-height: 1.6;
}

/* ---------- 布局 ---------- */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 232px;
  flex: 0 0 232px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-admin { background: #1a1330; }

.sidebar-brand {
  padding: 20px 20px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.sidebar-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2f6bff, #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  flex: 0 0 32px;
}

.sidebar-brand-text { color: #fff; font-weight: 600; font-size: 14px; line-height: 1.3; }
.sidebar-brand-sub { font-size: 11px; color: var(--sidebar-text); font-weight: 400; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
}

.nav-group-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #6b7d99;
  padding: 12px 10px 6px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 13.5px;
  transition: background .15s, color .15s;
  margin-bottom: 2px;
}

.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; font-weight: 500; }
.nav-item .icon { width: 16px; text-align: center; opacity: .9; flex: 0 0 16px; }

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid rgba(255, 255, 255, .08);
  font-size: 12px;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-title { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.content {
  padding: 24px;
  flex: 1;
  max-width: 1400px;
  width: 100%;
}

.content-narrow { max-width: 900px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.card-title { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }
.card-body-flush { padding: 0; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); }

/* ---------- 统计卡 ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}

.stat-label { font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; }
.stat-value { font-size: 24px; font-weight: 650; letter-spacing: -.02em; }
.stat-value small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.stat-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 15px;
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  line-height: 1.4;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  text-decoration: none;
}

.btn:hover { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }

.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b42318; border-color: #b42318; color: #fff; }

.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }

.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 6px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }
.btn-block { width: 100%; }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- 表单 ---------- */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}
.form-label .req { color: var(--danger); margin-left: 2px; }
.form-hint { font-size: 12px; color: var(--muted); margin-top: 5px; line-height: 1.5; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 5px; }

.input, .select, .textarea {
  display: block;
  width: 100%;
  padding: 8px 12px;
  font-size: 13.5px;
  font-family: inherit;
  line-height: 1.5;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 107, 255, .12);
}

.input::placeholder, .textarea::placeholder { color: var(--muted); }
.input.is-error, .textarea.is-error { border-color: var(--danger); }
.textarea { resize: vertical; min-height: 90px; }
.select { appearance: none; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23667085' d='M6 8.5 1.5 4h9z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.table th {
  text-align: left;
  padding: 11px 16px;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text-2);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }

.cell-main { font-weight: 500; color: var(--text); }
.cell-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.product-cell { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.product-thumb {
  width: 44px; height: 44px; border-radius: 6px; object-fit: cover;
  border: 1px solid var(--border); flex: 0 0 44px; background: var(--bg);
}

.money { font-variant-numeric: tabular-nums; font-weight: 600; }
.money-positive { color: var(--success); }
.money-muted { color: var(--muted); font-weight: 400; }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 20px;
  white-space: nowrap;
  background: #f2f4f7;
  color: var(--text-2);
}
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--primary-soft); color: var(--primary); }
.badge-muted { background: #f2f4f7; color: var(--text-2); }

/* ---------- 提示条 ---------- */
.alert {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 16px;
  border: 1px solid transparent;
  align-items: flex-start;
}
.alert-success { background: var(--success-soft); color: #05603a; border-color: #abefc6; }
.alert-error { background: var(--danger-soft); color: #912018; border-color: #fecdca; }
.alert-warning { background: var(--warning-soft); color: #93370d; border-color: #fedf89; }
.alert-info { background: var(--primary-soft); color: #1d4ed8; border-color: #c7d7fe; }
.alert-icon { flex: 0 0 auto; font-weight: 700; }
.alert-close { margin-left: auto; cursor: pointer; opacity: .5; background: none; border: none; font-size: 16px; line-height: 1; color: inherit; }
.alert-close:hover { opacity: 1; }

/* ---------- 空状态 ---------- */
.empty {
  text-align: center;
  padding: 56px 24px;
  color: var(--muted);
}
.empty-icon { font-size: 32px; margin-bottom: 10px; opacity: .5; }
.empty-title { font-size: 15px; color: var(--text); font-weight: 500; margin-bottom: 6px; }
.empty-desc { font-size: 13px; margin-bottom: 18px; }

/* ---------- 分页 ---------- */
.pagination {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  padding: 16px;
  flex-wrap: wrap;
}
.page-link {
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-2);
  background: var(--surface);
}
.page-link:hover { border-color: var(--primary); color: var(--primary); }
.page-link.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-link.disabled { opacity: .4; pointer-events: none; }
.page-info { font-size: 12.5px; color: var(--muted); margin-left: 8px; }

/* ---------- 筛选栏 ---------- */
.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.filters .input, .filters .select { width: auto; min-width: 160px; }
.filters .input-search { min-width: 220px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; flex-wrap: wrap; }
.tab {
  padding: 9px 14px;
  font-size: 13.5px;
  color: var(--text-2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }

/* ---------- 认证页 ---------- */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 460px;
}
.auth-aside {
  background: linear-gradient(150deg, #10203a 0%, #1c3b6e 55%, #2f6bff 100%);
  color: #fff;
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.auth-aside h2 { font-size: 30px; line-height: 1.3; margin-bottom: 16px; color: #fff; }
.auth-aside p { color: rgba(255, 255, 255, .75); font-size: 15px; line-height: 1.8; }
.auth-points { list-style: none; padding: 0; margin: 32px 0 0; }
.auth-points li {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 14px; color: rgba(255, 255, 255, .85); margin-bottom: 14px;
}
.auth-points .dot {
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(255, 255, 255, .16); flex: 0 0 20px;
  display: flex; align-items: center; justify-content: center; font-size: 11px;
}
.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--surface);
}
.auth-form { width: 100%; max-width: 340px; }
.auth-form h1 { font-size: 24px; margin-bottom: 6px; }
.auth-form .sub { color: var(--text-2); font-size: 13.5px; margin-bottom: 28px; }
.auth-footer { margin-top: 20px; font-size: 13px; color: var(--text-2); text-align: center; }

/* ---------- 编辑器 ---------- */
.editor-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 18px;
  align-items: start;
}

.editor-toolbar {
  display: flex;
  gap: 2px;
  padding: 8px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  flex-wrap: wrap;
  position: sticky;
  top: 60px;
  z-index: 10;
  border-radius: var(--radius) var(--radius) 0 0;
}

.tool-btn {
  min-width: 32px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-2);
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tool-btn:hover { background: var(--surface); border-color: var(--border); color: var(--text); }
.tool-divider { width: 1px; background: var(--border); margin: 4px 6px; }

.editor-surface {
  min-height: 480px;
  padding: 24px;
  outline: none;
  font-size: 15px;
  line-height: 1.8;
  color: #222;
  background: #fff;
}
.editor-surface:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
}
.editor-surface img { max-width: 100%; height: auto; }
.editor-source {
  width: 100%;
  min-height: 480px;
  border: none;
  padding: 20px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  resize: vertical;
  outline: none;
}

.product-panel { position: sticky; top: 76px; }

.product-item {
  display: flex;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  background: var(--surface);
}
.product-item:hover { border-color: var(--primary); background: var(--primary-soft); }
.product-item img { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; flex: 0 0 48px; }
.product-item-body { min-width: 0; flex: 1; }
.product-item-title {
  font-size: 12.5px; line-height: 1.4; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; margin-bottom: 4px;
}
.product-item-meta { font-size: 11.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.product-item-price { color: var(--danger); font-weight: 600; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, .5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-mask.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-body { padding: 20px; overflow-y: auto; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--muted); line-height: 1; padding: 0 4px; }
.modal-close:hover { color: var(--text); }

/* ---------- 会员卡 ---------- */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

.plan {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  background: var(--surface);
  position: relative;
  transition: border-color .2s, box-shadow .2s;
}
.plan:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.plan.featured { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.plan-badge {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  background: var(--primary); color: #fff; font-size: 11px; padding: 2px 10px;
  border-radius: 10px; white-space: nowrap;
}
.plan-name { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.plan-duration { font-size: 12.5px; color: var(--muted); margin-bottom: 16px; }
.plan-price { font-size: 30px; font-weight: 700; letter-spacing: -.02em; color: var(--text); }
.plan-price small { font-size: 14px; font-weight: 500; color: var(--text-2); }
.plan-original { font-size: 13px; color: var(--muted); text-decoration: line-through; margin-left: 6px; }
.plan-features { list-style: none; padding: 0; margin: 18px 0 22px; }
.plan-features li {
  font-size: 13px; color: var(--text-2); padding: 5px 0 5px 20px; position: relative;
}
.plan-features li::before {
  content: "✓"; position: absolute; left: 0; color: var(--success); font-weight: 700;
}

/* ---------- 会员计费周期切换 ---------- */
.cycle-switch { display: flex; justify-content: center; margin-bottom: 22px; }
.cycle-switch-inner {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
}
.cycle-switch button {
  border: none; background: transparent; cursor: pointer;
  padding: 7px 18px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; color: var(--text-2); font-family: inherit;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .15s, color .15s, box-shadow .15s;
}
.cycle-switch button:hover { color: var(--text); }
.cycle-switch button.active {
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm);
}
.cycle-switch .save {
  font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 999px;
  background: var(--success-soft); color: var(--success);
}

.plan-tagline { font-size: 12.5px; color: var(--muted); margin-bottom: 16px; min-height: 20px; }
.plan-price-note { font-size: 12.5px; color: var(--text-2); margin-top: 6px; }
.plan-price-note strong { color: var(--success); }
.plan-points {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 12px; padding: 5px 10px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary-dark);
  font-size: 12.5px; font-weight: 600;
}
.plan.is-current { border-color: var(--success); }
.plan-current-tag {
  position: absolute; top: 14px; right: 14px;
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: var(--success-soft); color: var(--success);
}

/* ---------- 代码块 / Token ---------- */
.token-box {
  display: flex;
  gap: 8px;
  align-items: center;
  background: #0d1117;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: #7ee787;
  word-break: break-all;
}
.token-box .copy {
  margin-left: auto; background: rgba(255,255,255,.1); border: none; color: #fff;
  padding: 4px 10px; border-radius: 5px; cursor: pointer; font-size: 12px; flex: 0 0 auto;
}
.token-box .copy:hover { background: rgba(255,255,255,.2); }

.kv { display: grid; grid-template-columns: 130px 1fr; gap: 10px 16px; font-size: 13.5px; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; color: var(--text); word-break: break-all; }

/* ---------- 工具类 ---------- */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0 !important; } .mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 12.5px; }
.text-xs { font-size: 11.5px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.fw-600 { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }
.nowrap { white-space: nowrap; }
.divider { height: 1px; background: var(--border); margin: 20px 0; }
.mono { font-family: var(--mono); font-size: 12.5px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .editor-layout { grid-template-columns: 1fr; }
  .product-panel { position: static; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform .22s;
  }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .form-row, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .table { font-size: 12.5px; }
  .table th, .table td { padding: 10px 12px; }
  .mobile-menu-btn { display: inline-flex !important; }
  .kv { grid-template-columns: 100px 1fr; }
  /* 窄屏顶栏：标题可省略号收缩，按钮组收紧，避免把标题挤成竖排 */
  .topbar { gap: 10px; padding: 0 12px; }
  .topbar > .flex-center { min-width: 0; flex: 0 1 auto; }
  .topbar-actions { flex: 0 0 auto; gap: 6px; }
  /* 「返回首页」在手机上让位——首页也能从侧边栏回到工作台再进 */
  .topbar-actions > a[href="/"] { display: none; }
}

.mobile-menu-btn { display: none; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text); padding: 4px 8px; }

.sidebar-mask {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, .45);
  z-index: 55;
}
.sidebar-mask.open { display: block; }

/* 打印/预览 */
.preview-body { font-size: 15px; line-height: 1.8; color: #222; }
.preview-body img { max-width: 100%; }

/* ==========================================================================
   点数与计费
   ========================================================================== */

/* ---------- 页头 ---------- */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.page-title { font-size: 20px; font-weight: 650; letter-spacing: -.02em; margin: 0; }
.page-desc { font-size: 13px; color: var(--text-2); margin-top: 4px; }

/* ---------- 筛选条 ---------- */
.filter-bar { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.filter-item { min-width: 150px; }
.filter-item .form-label { margin-bottom: 4px; font-size: 12px; }

/* ---------- 信息明细（收银台等） ---------- */
.info-list { display: flex; flex-direction: column; }
.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13.5px;
}
.info-row:last-child { border-bottom: 0; }
.info-row > span:first-child { color: var(--text-2); flex: 0 0 auto; }
.info-row > span:last-child, .info-row > strong { text-align: right; word-break: break-all; }

/* ---------- 充值套餐卡片 ---------- */
.pack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}
.pack {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 20px 18px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.pack:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.pack-featured { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.pack-badge {
  position: absolute;
  top: -9px;
  right: 14px;
  padding: 2px 9px;
  font-size: 11.5px;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  border-radius: 999px;
  letter-spacing: .02em;
}
.pack-name { font-size: 13.5px; color: var(--text-2); font-weight: 500; }
.pack-points {
  margin-top: 10px;
  font-size: 32px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.02em;
  color: var(--text);
}
.pack-points span { font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.pack-bonus { margin-top: 4px; font-size: 12.5px; color: var(--success); min-height: 19px; }
.pack-price { margin-top: 14px; font-size: 20px; font-weight: 650; color: var(--text); display: flex; align-items: baseline; gap: 8px; }
.pack-unit { margin: 2px 0 14px; font-size: 12px; color: var(--muted); }
.pack .select { margin-bottom: 10px; }

/* ---------- 复制行 ---------- */
.copy-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: left;
}
.copy-row code { flex: 1; font-family: var(--mono); color: var(--text-2); }

/* ---------- 加载态 ---------- */
.spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  vertical-align: -1px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 超小按钮 ---------- */
.btn-xs { padding: 3px 8px; font-size: 12px; border-radius: 6px; }

/* ---------- 复选行 ---------- */
.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13.5px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.check-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ==========================================================================
   公众号接入方式选择
   ========================================================================== */

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.choice {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 22px 22px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}

.choice:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  text-decoration: none;
}

.choice-badge {
  position: absolute;
  top: -9px;
  right: 16px;
  padding: 2px 9px;
  font-size: 11.5px;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  border-radius: 999px;
  letter-spacing: .02em;
}

.choice-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: var(--primary);
  margin-bottom: 14px;
}

.choice-title { font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
.choice-desc { margin-top: 8px; font-size: 13px; line-height: 1.75; color: var(--text-2); }

.choice-list {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.9;
}
.choice-list li::before {
  content: '·';
  margin-right: 8px;
  color: var(--primary);
  font-weight: 700;
}

.choice-go {
  margin-top: 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
}

/* 类型选择（服务号 / 订阅号） */
.type-row { display: flex; gap: 10px; flex-wrap: wrap; }
.type-option { flex: 1 1 180px; }
.type-option input { position: absolute; opacity: 0; pointer-events: none; }
.type-option span {
  display: block;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13.5px;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.type-option span small { display: block; font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.type-option input:checked + span {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--text);
  font-weight: 600;
}

/* 检测结果 */
.verify-result {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 13px;
  line-height: 1.7;
  display: none;
}
.verify-result.is-ok { display: block; border-color: var(--success); background: var(--success-soft); }
.verify-result.is-fail { display: block; border-color: var(--danger); background: var(--danger-soft); }
.verify-result strong { display: block; margin-bottom: 2px; }
.verify-result em { font-style: normal; color: var(--text-2); }

/* ==========================================================================
   多号选择列表（分发 / 定时推送）
   ========================================================================== */
.pick-list {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}
.pick-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-size: 13.5px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.pick-item + .pick-item { border-top: 1px solid var(--border); }
.pick-item:hover { background: var(--surface-2); }
.pick-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
  flex: none;
}
.pick-name { font-weight: 550; }
.pick-meta { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.pick-empty { padding: 14px 12px; font-size: 13px; color: var(--muted); }

/* 定时任务结果里的逐号状态行 */
.result-line {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text-2);
}

/* ============================================================
   站内信
   ============================================================ */

/* 顶栏铃铛未读角标 */
.topbar-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.bell-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--danger, #e5484d);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--surface, #fff);
}

/* 消息列表 */
.notice-list { display: flex; flex-direction: column; }
.notice-item {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.notice-item:last-child { border-bottom: 0; }
.notice-item.is-unread { background: rgba(59, 130, 246, .045); }
.notice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
}
.notice-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary, #3b82f6);
  flex: none;
}
.notice-title { font-size: 14.5px; }
.notice-body {
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-word;
}
.notice-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

/* 后台接收对象分区 */
.audience-panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  background: var(--surface-2, rgba(0, 0, 0, .015));
}
.audience-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.audience-tab {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface, #fff);
  font-size: 13px;
  cursor: pointer;
  color: var(--text-2);
}
.audience-tab.is-active {
  border-color: var(--primary, #3b82f6);
  color: var(--primary, #3b82f6);
  font-weight: 600;
  background: rgba(59, 130, 246, .07);
}
.audience-pane[hidden] { display: none; }
.tier-check-list { display: flex; flex-wrap: wrap; gap: 10px; }
.tier-check-list label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}
.tier-check-list input[type="checkbox"] { accent-color: var(--primary); }
.pick-search { display: flex; gap: 8px; margin-bottom: 10px; }
.pick-hint { font-size: 12px; color: var(--muted); margin-top: 8px; }

/* ============================================================
   公众号消息中心
   ============================================================ */

/* 侧栏导航未读数 */
.nav-item .nav-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger, #e5484d);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

/* 会话列表 */
.conv-list { display: flex; flex-direction: column; }
.conv-item {
  display: flex;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.conv-item:last-child { border-bottom: 0; }
.conv-item:hover { background: var(--surface-2, rgba(0, 0, 0, .018)); }
.conv-avatar {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface-3, #eef1f5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-2);
  overflow: hidden;
}
.conv-avatar img { width: 100%; height: 100%; object-fit: cover; }
.conv-main { flex: 1; min-width: 0; }
.conv-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.conv-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conv-time { font-size: 12px; color: var(--muted); flex: none; }
.conv-preview {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conv-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.conv-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--primary, #3b82f6);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

/* 聊天窗口 */
.chat-shell {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 200px);
  min-height: 480px;
  background: var(--surface-2, #f7f9fc);
}
.chat-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.chat-row { display: flex; gap: 9px; align-items: flex-start; }
.chat-row.out { flex-direction: row-reverse; }
.chat-avatar {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #dfe5ee;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #55657d;
  overflow: hidden;
}
.chat-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-body { max-width: 68%; }
.chat-bubble {
  padding: 9px 13px;
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 1.65;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text-1);
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-row.out .chat-bubble {
  background: var(--primary, #3b82f6);
  border-color: transparent;
  color: #fff;
}
.chat-bubble.is-event {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}
.chat-bubble.is-failed {
  background: rgba(229, 72, 77, .08);
  border-color: rgba(229, 72, 77, .35);
  color: var(--danger, #e5484d);
}
.chat-bubble img.chat-img {
  display: block;
  max-width: 220px;
  border-radius: 8px;
}
.chat-time {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
  display: flex;
  gap: 6px;
  align-items: center;
}
.chat-row.out .chat-time { justify-content: flex-end; }
.chat-composer {
  border-top: 1px solid var(--border);
  background: #fff;
  padding: 12px 16px;
}
.chat-composer textarea {
  width: 100%;
  min-height: 74px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 13.5px;
  font-family: inherit;
  line-height: 1.6;
}
.chat-composer textarea:focus {
  outline: none;
  border-color: var(--primary, #3b82f6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .12);
}
.chat-composer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.chat-window-warn {
  font-size: 12.5px;
  padding: 9px 13px;
  border-radius: 8px;
  background: rgba(245, 158, 11, .1);
  border: 1px solid rgba(245, 158, 11, .3);
  color: #92620b;
}

/* 回调配置 */
.cfg-block {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: var(--surface-2, rgba(0, 0, 0, .014));
}
.cfg-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.cfg-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 9px 11px;
  word-break: break-all;
  color: var(--text-1);
}
.cfg-steps {
  counter-reset: step;
  padding-left: 0;
  list-style: none;
  margin: 0;
}
.cfg-steps li {
  counter-increment: step;
  position: relative;
  padding-left: 30px;
  margin-bottom: 12px;
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--text-2);
}
.cfg-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary, #3b82f6);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}
.warn-box {
  border: 1px solid rgba(229, 72, 77, .3);
  background: rgba(229, 72, 77, .06);
  border-radius: 10px;
  padding: 13px 16px;
  font-size: 13.5px;
  line-height: 1.75;
  color: #a5262a;
  margin-bottom: 18px;
}
.warn-box strong { color: #7d1b1e; }

/* 规则卡片 */
.rule-list { display: flex; flex-direction: column; gap: 10px; }
.rule-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 16px;
  background: #fff;
}
.rule-item.is-off { opacity: .55; }
.rule-head {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-bottom: 7px;
}
.rule-body {
  font-size: 13px;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.7;
}
.rule-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.tab-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.tab-bar a {
  padding: 7px 14px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 13px;
  color: var(--text-2);
}
.tab-bar a.is-active {
  border-color: var(--primary, #3b82f6);
  color: var(--primary, #3b82f6);
  font-weight: 600;
  background: rgba(59, 130, 246, .07);
}
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stat-cell {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 15px;
  background: #fff;
}
.stat-cell .k { font-size: 12px; color: var(--muted); }
.stat-cell .v { font-size: 21px; font-weight: 700; color: var(--text-1); margin-top: 4px; }

@media (max-width: 720px) {
  .chat-body { max-width: 82%; }
  .chat-shell { height: calc(100vh - 240px); min-height: 380px; }
}

/* 小号输入控件（列表筛选栏用） */
.input-sm {
  height: 32px;
  padding: 5px 10px;
  font-size: 13px;
}
select.input-sm { padding-right: 26px; }

/* 侧栏二级入口缩进，区别于一级导航 */
.nav-sub .nav-item { padding-left: 22px; font-size: 13px; }

@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
}

/* ---------- 推广位（PID） ---------- */
.inline-form { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.action-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; }

.pid-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}

.pid-card { margin-bottom: 0; }

.pid-value {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  word-break: break-all;
  color: var(--text);
}

.pid-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.pid-empty { text-align: center; padding: 24px 8px; }
.pid-empty-text { font-size: 14px; color: var(--text-2); margin-bottom: 4px; }

@media (max-width: 640px) {
  .pid-grid { grid-template-columns: 1fr; }
  .action-row { justify-content: flex-start; }
}

/* ==========================================================================
   公众号扫码授权
   ========================================================================== */

/* 状态提示：等待 / 成功 / 失败三态，同一位置替换文字，避免布局跳动 */
.auth-state {
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 13px;
  line-height: 1.7;
}
.auth-state strong { display: block; margin-bottom: 2px; }
.auth-state span { color: var(--text-2); }
.auth-state.is-ok { border-color: var(--success); background: var(--success-soft); }
.auth-state.is-ok strong { color: var(--success); }
.auth-state.is-fail { border-color: var(--danger); background: var(--danger-soft); }
.auth-state.is-fail strong { color: var(--danger); }

/* 回调地址：等宽 + 可换行，长 state 不会把卡片撑破 */
.auth-url {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.auth-url-text {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text);
  word-break: break-all;
}

/* 演练模式说明 */
.auth-mock-note {
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--warning);
  background: var(--warning-soft);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text-2);
}

/* 扫码完成后的独立结果页 */
.result-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}
.result-card {
  width: 100%;
  max-width: 380px;
  padding: 32px 28px;
  text-align: center;
}
.result-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: #fff;
}
.result-icon.is-ok { background: var(--success); }
.result-icon.is-fail { background: var(--danger); }
.result-title { font-size: 18px; margin-bottom: 8px; }
.result-desc { font-size: 13.5px; color: var(--text-2); line-height: 1.7; margin: 0 0 6px; }
.result-hint { font-size: 12.5px; color: var(--muted); margin: 0; }

/* ==========================================================================
   新手引导：工作台进度卡 + /guide 教程页
   ========================================================================== */

/* 通用进度条 */
.progress {
  height: 6px;
  border-radius: 99px;
  background: var(--border);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--primary), #5b8bff);
  transition: width .3s ease;
}

/* ---------- 工作台进度卡 ---------- */
.guide-banner {
  padding: 16px 18px;
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.guide-banner-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.guide-banner-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
}
.guide-banner-count {
  padding: 1px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-soft);
}
.guide-banner-desc {
  margin-top: 4px;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text-2);
}
.guide-banner-desc strong { color: var(--text); }

/* 五步小圆点：一行排不下会自动换行，不横向溢出 */
.guide-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}
.guide-dot {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 5px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface-2);
  font-size: 12px;
  color: var(--muted);
}
.guide-dot-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-2);
  flex: 0 0 auto;
}
.guide-dot-label { white-space: nowrap; }
.guide-dot.is-done {
  border-color: #abefc6;
  background: var(--success-soft);
  color: var(--success);
}
.guide-dot.is-done .guide-dot-no {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}
.guide-dot.is-next {
  border-color: #c7d7fe;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}
.guide-dot.is-next .guide-dot-no {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}
.guide-banner-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

/* 全部完成后的收起态 */
.guide-banner.is-done {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-color: #abefc6;
  background: var(--success-soft);
}
.guide-banner-text strong {
  display: block;
  font-size: 14px;
  color: #05603a;
}
.guide-banner-text span {
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text-2);
}

/* ---------- 教程页：总进度 ---------- */
.guide-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 22px;
  margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.guide-hero-main { min-width: 0; }
.guide-hero-title {
  margin-bottom: 5px;
  font-size: 16px;
  font-weight: 600;
}
.guide-hero-desc {
  font-size: 13px;
  line-height: 1.75;
  color: var(--text-2);
}
.guide-hero-side {
  flex: 0 0 auto;
  text-align: right;
}
.guide-hero-num {
  font-size: 30px;
  font-weight: 650;
  line-height: 1;
  color: var(--primary);
  letter-spacing: -.02em;
}
.guide-hero-num span {
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
}
.guide-hero-label {
  margin-top: 5px;
  font-size: 11.5px;
  color: var(--muted);
}

/* ---------- 教程页：竖向步进器 ---------- */
.guide-steps {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.guide-step {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
/* 连接线：穿过圆点正中间，最后一步不画 */
.guide-step:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 16px;
  top: 36px;
  bottom: -16px;
  width: 2px;
  background: var(--border);
}
.guide-marker {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  flex: 0 0 auto;
}
.guide-step.is-done .guide-marker {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}
.guide-step.is-next .guide-marker {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.guide-panel {
  min-width: 0;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.guide-step.is-done .guide-panel {
  background: var(--surface-2);
}
.guide-step.is-next .guide-panel {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.guide-step-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}
.guide-step-no {
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--primary-soft);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--primary);
  letter-spacing: .04em;
}
.guide-step-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.guide-step-goal {
  margin: 0 0 12px;
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--text-2);
}
.guide-done-hint {
  display: inline-block;
  margin-bottom: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--success-soft);
  font-size: 12.5px;
  color: var(--success);
}
.guide-wait-hint {
  display: inline-block;
  margin-bottom: 4px;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--warning-soft);
  font-size: 12.5px;
  color: #93370d;
}
.guide-block { margin-top: 14px; }
.guide-block-title {
  margin-bottom: 7px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .06em;
}
.guide-list {
  margin: 0;
  padding-left: 20px;
  font-size: 13.5px;
  line-height: 1.85;
  color: var(--text-2);
}
.guide-list li { margin-bottom: 5px; }
.guide-list li::marker { color: var(--muted); }
.guide-list strong,
.guide-notes strong { color: var(--text); }
.guide-notes {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-2);
}
.guide-notes li { margin-bottom: 6px; }
.guide-list code,
.guide-notes code,
.guide-faq code {
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
}
.guide-alt {
  margin: 10px 0 0;
  padding: 9px 12px;
  border-left: 2px solid var(--border-strong);
  border-radius: 0 6px 6px 0;
  background: var(--surface-2);
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--text-2);
}
.guide-alt a { color: var(--primary); }

/* ---------- 教程页：术语与 FAQ ---------- */
.guide-glossary {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 12px 20px;
  margin: 0;
  font-size: 13px;
}
.guide-glossary dt {
  font-weight: 600;
  color: var(--text);
}
.guide-glossary dd {
  margin: 0;
  line-height: 1.8;
  color: var(--text-2);
}
.guide-faq {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.guide-faq:first-of-type { padding-top: 0; }
.guide-faq:last-of-type { padding-bottom: 0; border-bottom: none; }
.guide-faq summary {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  list-style: none;
}
.guide-faq summary::-webkit-details-marker { display: none; }
.guide-faq summary::before {
  content: '+';
  flex: 0 0 auto;
  width: 14px;
  font-family: var(--mono);
  color: var(--muted);
}
.guide-faq[open] summary::before { content: '−'; }
.guide-faq[open] summary { margin-bottom: 2px; }
.guide-faq p {
  margin: 6px 0 0 22px;
  font-size: 13px;
  line-height: 1.85;
  color: var(--text-2);
}
.guide-foot {
  margin-top: 16px;
  padding: 12px 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--text-2);
}

/* 窄屏：步进器与术语表改为单列，避免挤压 */
@media (max-width: 640px) {
  .guide-hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .guide-hero-side {
    display: flex;
    align-items: baseline;
    gap: 8px;
    text-align: left;
  }
  .guide-hero-label { margin-top: 0; }
  .guide-banner.is-done {
    flex-direction: column;
    align-items: flex-start;
  }
  .guide-glossary {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px 0;
  }
  .guide-glossary dd { margin-bottom: 10px; }
  .guide-panel { padding: 16px; }
}

/* ---------- 服务器配置页：字段对照 / 自检 ---------- */
.cfg-table td { vertical-align: middle; }
.cfg-field {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}
.cfg-copy {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.cfg-text {
  flex: 1 1 180px;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 10px;
  word-break: break-all;
  color: var(--text);
}
.selfcheck {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.selfcheck-hint {
  font-size: 12.5px;
  color: var(--muted);
}
.selfcheck-result {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.7;
}
.selfcheck-result.is-ok {
  background: var(--success-soft);
  border-color: rgba(7, 148, 85, .28);
  color: #05603a;
}
.selfcheck-result.is-bad {
  background: var(--danger-soft);
  border-color: rgba(217, 45, 32, .26);
  color: #912018;
}
.selfcheck-title { font-weight: 700; margin-bottom: 3px; }
.selfcheck-detail { opacity: .9; }
.cfg-details {
  margin-top: 16px;
  border-top: 1px dashed var(--border);
  padding-top: 12px;
}
.cfg-details summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
.faq-list {
  font-size: 13.5px;
  line-height: 1.9;
  color: var(--text-2);
  padding-left: 18px;
  margin: 0;
}
.faq-mini p {
  font-size: 13.5px;
  line-height: 1.85;
  color: var(--text-2);
  margin: 0 0 10px;
}
.faq-mini p:last-child { margin-bottom: 0; }

/* 竖向单选列表：三项以上时比并排更好读，说明文字有空间 */
.type-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.type-col .type-option {
  flex: 1 1 auto;
  width: 100%;
}

/* 栅格子项默认 min-width:auto 会被长 URL / Token 撑开，窄屏下整页横溢 */
.grid-2 > *, .grid-3 > * { min-width: 0; }

@media (max-width: 640px) {
  /* 字段对照表在手机上改为上下堆叠，避免长串值把页面撑宽 */
  .cfg-table thead { display: none; }
  .cfg-table,
  .cfg-table tbody,
  .cfg-table tr,
  .cfg-table td {
    display: block;
    width: 100%;
  }
  .cfg-table tr {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
  }
  .cfg-table tr:last-child { border-bottom: none; }
  .cfg-table td {
    border: none;
    padding: 0 0 6px;
  }
  .cfg-table td:last-child { padding-bottom: 0; }
  .cfg-copy {
    flex-direction: column;
    align-items: stretch;
  }
  .cfg-copy .btn { align-self: flex-start; }
  .cfg-text { flex: 1 1 auto; }
}

/* ---------- 后台设置：开关 / LOGO 上传 / 页脚 ---------- */
.switch-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px dashed var(--border);
  cursor: pointer;
}
.switch-row:first-of-type { padding-top: 6px; }
.switch-row:last-of-type { border-bottom: none; padding-bottom: 4px; }
.switch-text strong {
  display: block;
  font-size: 13.5px;
  color: var(--text);
  margin-bottom: 4px;
}
.switch-text small {
  display: block;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--muted);
}
.switch { position: relative; flex: 0 0 auto; margin-top: 2px; }
.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.switch-track {
  position: relative;
  display: block;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: var(--border-strong);
  transition: background .18s ease;
}
.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .25);
  transition: transform .18s ease;
}
.switch input:checked + .switch-track { background: var(--primary); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(20px); }
.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--primary-soft);
  outline-offset: 2px;
}

.logo-field {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.logo-preview {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
/* font-size:0 —— 图片挂了时浏览器会画 alt 文本，64px 的框装不下会撑开布局。
   宽度写死而不是 width:100%：万一外层被别处的样式撑开，图片也不会跟着变巨幅。 */
.logo-preview img {
  display: block;
  width: 64px;
  height: 64px;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  font-size: 0;
}
.logo-placeholder {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-2);
}
.logo-actions {
  flex: 1 1 220px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.input-file { font-size: 12.5px; padding: 7px 9px; }
.check-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-2);
}

/* 站点页脚：品牌 + 备案号 */
.site-footer {
  margin-top: 32px;
  padding: 18px 4px 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  font-size: 12.5px;
  color: var(--muted);
}
.site-footer a {
  color: var(--muted);
  text-decoration: none;
}
.site-footer a:hover { color: var(--primary); }

/* 有 LOGO 时用图片替换文字图标；深色侧边栏上加白底，避免深色图标看不见。
   尺寸由外层 32px 方块兜住，这里再封一个上限：上传的图哪怕 1024×1024，
   也只是等比缩进方块里，不会把侧边栏顶开。 */
.sidebar-logo-img {
  background: #fff !important;
  padding: 2px;
  overflow: hidden;
}
.sidebar-logo-img img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  display: block;
}

.auth-legal {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 14px;
  font-size: 12px;
  color: var(--muted);
}
.auth-legal a { color: var(--muted); text-decoration: none; }
.auth-legal a:hover { color: var(--primary); }

/* ---------- 数据库升级页 ---------- */
.upd-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.upd-hero-main { flex: 1 1 280px; min-width: 0; }
.upd-hero-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}
.upd-hero-title b { color: var(--primary); font-size: 21px; margin: 0 1px; }
.upd-hero-title.is-ok { color: var(--success); }
.upd-hero-desc {
  margin: 7px 0 0;
  font-size: 13px;
  line-height: 1.75;
  color: var(--muted);
}
.upd-hero-action { flex: 0 0 auto; }
.upd-hero-action .btn { min-width: 124px; }

.upd-note {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-2);
}
.upd-note strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
}
.upd-note ul { margin: 4px 0 0; padding-left: 18px; }
.upd-note li { margin-bottom: 5px; }
.upd-note li:last-child { margin-bottom: 0; }

.kv-list { display: flex; flex-direction: column; }
.kv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
}
.kv-row:last-child { border-bottom: none; padding-bottom: 0; }
.kv-key { flex: 0 0 auto; color: var(--muted); }
.kv-val { color: var(--text); font-weight: 500; text-align: right; }

.upd-fallback {
  font-size: 13px;
  line-height: 1.85;
  color: var(--text-2);
}
.upd-fallback p { margin: 0 0 13px; }
.upd-fallback p:last-child { margin-bottom: 0; }
.upd-fallback b { color: var(--text); }

.upd-name { font-weight: 500; color: var(--text); }
.upd-ver {
  font-size: 11px;
  color: var(--muted);
  word-break: break-all;
  line-height: 1.5;
}
.card-sub { font-size: 12px; color: var(--muted); }

@media (max-width: 640px) {
  .upd-hero-action,
  .upd-hero-action .btn { width: 100%; }
  .upd-hero-action .btn { min-width: 0; }

  /* 四列表格压到 500px 会变成一字一行的竖排，给个保底宽度让它横向滚动 */
  .upd-table { min-width: 620px; }
}

/* ---------- 步骤说明（MCP 配置教程等） ---------- */
.steps { counter-reset: step; }
.step {
  position: relative;
  padding-left: 34px;
  padding-bottom: 22px;
}
.step:last-child { padding-bottom: 0; }
.step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: -1px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* 竖线把各步骤串起来，视觉上是一条流程而不是四条并列说明 */
.step:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 10.5px;
  top: 26px;
  bottom: 2px;
  width: 1px;
  background: var(--border);
}
.step-title { font-size: 13.5px; font-weight: 600; margin-bottom: 5px; }
.step-body { font-size: 13px; color: var(--text-2); line-height: 1.75; }
.step-body pre { margin: 8px 0 0; }
.step-body code {
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 4px;
}

/* 表格行内并排多个操作按钮 */
.row-actions { display: inline-flex; align-items: center; gap: 2px; }

@media (max-width: 640px) {
  .step { padding-left: 28px; }
}

/* MCP 令牌表列多（名称/前缀/状态/两个时间/操作），窄屏压到 300px 会把名称折成逐字换行，
   给个下限让它整表在卡片内横向滚动，比每列挤成竖排词好读 */
@media (max-width: 900px) {
  .mcp-token-table { min-width: 720px; }
}

/* 工具参考表：分组标题行（文章 / 推送 / 账号与商品） */
.table-group {
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: .02em;
}
.table-group:hover { background: var(--surface-2); }

/* 三列都带说明文字，窄屏压太狠会逐字折行，给个下限走卡片内横向滚动 */
@media (max-width: 900px) {
  .mcp-tool-table { min-width: 640px; }
}

/* 已授权应用表：五个列表头 + 「能做什么」是整句权限名，
   窄屏不给下限会被压成一字一行，同样改成卡片内横向滚动 */
@media (max-width: 900px) {
  .mcp-grant-table { min-width: 680px; }
}

/* ---------- 首页快捷操作 ---------- */
.quick-section { margin-bottom: 20px; }
.quick-head { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 10px; }
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.quick-card {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.quick-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.quick-icon {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.quick-card:hover .quick-icon { background: var(--primary-soft); color: var(--primary); }
.quick-text { min-width: 0; }
.quick-title { display: block; font-size: 13.5px; font-weight: 600; line-height: 1.5; }
.quick-desc { display: block; font-size: 12px; color: var(--text-2); line-height: 1.55; margin-top: 2px; }

@media (max-width: 1080px) { .quick-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .quick-grid { grid-template-columns: 1fr; } }

/* ---------- MCP：脱敏令牌与底部行动条 ---------- */
.token-box .link-btn {
  flex: 0 0 auto;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, .65);
  padding: 4px 6px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
}
.token-box .link-btn:hover { color: #fff; background: rgba(255, 255, 255, .1); }

/* 「连接后能做什么」底部行动条 */
.cta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 18px;
  background: var(--success-soft);
  border: 1px solid #d1fadf;
  border-radius: var(--radius);
}
.cta-bar-title { font-size: 13.5px; font-weight: 600; color: #05603a; }
.cta-bar-desc { font-size: 12.5px; color: #067647; margin-top: 3px; line-height: 1.6; }
.cta-bar .btn { background: #fff; border-color: #a6f4c5; color: #05603a; }
.cta-bar .btn:hover { background: #f6fef9; }

/* 锚点跳转时别被吸顶栏盖住（#token-card / #tools 都是卡内跳转目标） */
#token-card, #tools { scroll-margin-top: 76px; }

/* ==========================================================================
   连接器授权页（/oauth/authorize）
   独立于后台布局：只有一张卡，用户此刻只需要判断「给不给权限」。
   ========================================================================== */
.consent-body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 480px at 50% -10%, #e8efff 0%, rgba(232, 239, 255, 0) 62%),
    var(--bg);
  display: flex;
  flex-direction: column;
}

.consent-shell {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 56px 20px 24px;
}

.consent-card {
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 36px 34px 26px;
}

.consent-connect {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}

.consent-app {
  width: 54px;
  height: 54px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -.02em;
  user-select: none;
}

.consent-app-site {
  background: linear-gradient(140deg, #3b7bff, #1d4ed8);
  color: #fff;
  box-shadow: 0 6px 16px rgba(47, 107, 255, .28);
}

.consent-app-client {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
}

.consent-link {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 0 2px;
}

.consent-link span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--border-strong);
}

.consent-title {
  font-size: 21px;
  text-align: center;
  letter-spacing: -.015em;
  margin-bottom: 8px;
}

.consent-sub {
  text-align: center;
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.7;
  margin-bottom: 20px;
}

.consent-account {
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}

.consent-scopes {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
}

.consent-scopes li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
}

.consent-scopes li:last-child { border-bottom: 0; }

.consent-tick {
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--success-soft);
  color: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
}

.consent-scope-label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.55;
}

.consent-scope-desc {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
  margin-top: 1px;
}

.consent-note {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.75;
}

.consent-note p { margin: 0; }
.consent-note p + p { margin-top: 4px; }
.consent-note strong { color: var(--text); font-weight: 600; }

.consent-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.consent-btn {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: all .15s;
}

.consent-btn:hover { background: var(--surface-2); color: var(--text); }
.consent-btn:active { transform: translateY(1px); }

.consent-btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

.consent-btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }

.consent-switch {
  text-align: center;
  margin-top: 10px;
}

/* 裸 .link-btn 只给 /oauth 系列页面用（后台里它是 .token-box 的子元素） */
.consent-switch .link-btn {
  background: none;
  border: 0;
  padding: 2px 4px;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--primary);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.consent-switch .link-btn:hover { color: var(--primary-dark); }

.consent-meta {
  margin: 18px 0 0;
  font-size: 11.5px;
  color: var(--muted);
  text-align: center;
  line-height: 1.7;
}

.consent-meta code { font-size: 11px; }

.consent-footer {
  display: flex;
  justify-content: center;
  gap: 14px;
  padding: 4px 20px 28px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}

.consent-card-error { text-align: left; }

.consent-error-icon {
  width: 46px;
  height: 46px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--danger-soft);
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 560px) {
  .consent-shell { padding: 28px 14px 16px; }
  .consent-card { padding: 26px 20px 20px; border-radius: var(--radius); }
  .consent-actions { flex-direction: column; }
  .consent-btn { width: 100%; }
  .consent-title { font-size: 19px; }
}

/* ==========================================================================
   连接器「一键连接」卡片 & 已授权应用
   ========================================================================== */
.connector-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.connector-icon {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: linear-gradient(140deg, #3b7bff, #1d4ed8);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(47, 107, 255, .22);
}

.connector-head-text { min-width: 0; }
.connector-head-title { font-size: 15px; font-weight: 600; }
.connector-head-desc { font-size: 12.5px; color: var(--text-2); line-height: 1.65; margin-top: 2px; }

.connector-address {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text);
  word-break: break-all;
}

.connector-address span { flex: 1; min-width: 0; }

.connector-address .copy {
  flex: 0 0 auto;
  padding: 5px 11px;
  font-family: var(--font);
  font-size: 12.5px;
  color: #fff;
  background: var(--primary);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.connector-address .copy:hover { background: var(--primary-dark); }

.grant-app {
  display: flex;
  align-items: center;
  gap: 9px;
}

.grant-avatar {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex: 0 0 auto;
}

.grant-name { font-weight: 500; }
.grant-scopes { font-size: 11.5px; color: var(--muted); margin-top: 1px; }

/* ==========================================================================
   创作中心 · 贴图写作（/create/sticker）
   左图右文：左边图片墙要能一眼看出顺序，右边表单只做输入，不放任何表格。
   ========================================================================== */
.sticker-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
}

.sticker-media {
  padding: 18px 20px 20px;
  border-right: 1px solid var(--border);
  min-width: 0;
}

.sticker-media-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.sticker-media-title { font-size: 13.5px; font-weight: 600; }

.sticker-drop {
  position: relative;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 12px;
  min-height: 336px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  outline: none;
}

.sticker-drop:hover,
.sticker-drop:focus-visible,
.sticker-drop.is-over {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.sticker-drop-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 310px;
  padding: 0 32px;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
  pointer-events: none;
}

.sticker-drop-empty p { margin: 0; }

.sticker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
  gap: 10px;
}

.sticker-grid.is-single { grid-template-columns: minmax(0, 240px); }

.sticker-thumb {
  position: relative;
  margin: 0;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #fff;
  cursor: grab;
}

.sticker-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sticker-thumb.is-dragging { opacity: .4; }
.sticker-thumb.is-over { outline: 2px solid var(--primary); outline-offset: -2px; }

.sticker-thumb-remove {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: rgba(16, 24, 40, .62);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sticker-thumb-remove:hover { background: var(--danger); }

.sticker-thumb-cover {
  position: absolute;
  left: 5px;
  bottom: 5px;
  padding: 1px 7px;
  border-radius: 99px;
  background: rgba(47, 107, 255, .92);
  color: #fff;
  font-size: 10.5px;
  letter-spacing: .02em;
}

.sticker-media-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.sticker-upload-hint { margin-left: auto; color: var(--primary); }

.sticker-form { padding: 18px 20px 20px; }
.sticker-form .form-group:last-of-type { margin-bottom: 14px; }

.sticker-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.sticker-actions-main { margin-left: auto; display: flex; gap: 8px; }

.sticker-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.pill-tabs { display: flex; gap: 4px; flex-wrap: wrap; }

.pill-tab {
  padding: 5px 12px;
  border-radius: 99px;
  border: 1px solid transparent;
  font-size: 12.5px;
  color: var(--text-2);
}

.pill-tab:hover { background: var(--surface-2); color: var(--text); }

.pill-tab.is-active {
  background: var(--primary-soft);
  border-color: rgba(47, 107, 255, .3);
  color: var(--primary-dark);
  font-weight: 600;
}

.sticker-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}

.sticker-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}

.sticker-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }

.sticker-card-cover { position: relative; aspect-ratio: 4 / 3; background: var(--surface-2); }
.sticker-card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

.sticker-card-cover-empty {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
}

.sticker-card-count {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 1px 7px;
  border-radius: 99px;
  background: rgba(16, 24, 40, .6);
  color: #fff;
  font-size: 10.5px;
}

.sticker-card-body { padding: 10px 12px 12px; }

.sticker-card-title {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.5;
  min-height: 40px;
}

.sticker-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--muted);
}

.sticker-card-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.sticker-card-actions .link-btn {
  background: none;
  border: 0;
  padding: 0;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--primary);
  cursor: pointer;
}

.sticker-card-actions .link-btn:hover { color: var(--primary-dark); text-decoration: underline; text-underline-offset: 3px; }
.sticker-card-actions .link-btn.text-danger { color: var(--danger); }

/* 预览弹窗：尽量贴近公众号里的图片消息排版 */
.sticker-preview-modal { max-width: 520px; }
.sticker-preview-modal .modal-body { padding: 0; background: var(--surface-2); }

.wx-preview {
  background: #fff;
  padding: 22px 22px 26px;
}

.wx-preview-title {
  font-size: 20px;
  line-height: 1.45;
  letter-spacing: -.01em;
  word-break: break-word;
}

.wx-preview-meta {
  margin: 8px 0 14px;
  font-size: 12px;
  color: var(--muted);
}

.wx-preview-images img {
  width: 100%;
  display: block;
  border-radius: 6px;
  margin-bottom: 8px;
}

.wx-preview-desc {
  margin-top: 4px;
  font-size: 14.5px;
  line-height: 1.85;
  color: var(--text-2);
  white-space: pre-wrap;
}

@media (max-width: 1000px) {
  .sticker-layout { grid-template-columns: minmax(0, 1fr); }
  .sticker-media { border-right: 0; border-bottom: 1px solid var(--border); }
}

@media (max-width: 560px) {
  .sticker-media, .sticker-form { padding: 14px; }
  .sticker-grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
  .sticker-drop, .sticker-drop-empty { min-height: 240px; }
  .sticker-actions-main { margin-left: 0; width: 100%; }
  .sticker-actions-main .btn { flex: 1 1 0; }
}

/* ==========================================================================
   10W+ 爆文推荐（/hot）
   行式列表而不是卡片墙：标题与摘要是阅读主体，封面只做分类色块，
   避免用「像不像爆款」的配图干扰判断。
   ========================================================================== */
.hot-search { display: flex; gap: 10px; }
.hot-search .input { flex: 1 1 auto; }
.hot-search .btn { flex: 0 0 auto; }

.pill-count {
  display: inline-block;
  margin-left: 5px;
  padding: 0 5px;
  border-radius: 99px;
  background: rgba(16, 24, 40, .06);
  font-size: 10.5px;
  font-weight: 500;
  color: var(--muted);
}

.pill-tab.is-active .pill-count { background: rgba(47, 107, 255, .14); color: var(--primary-dark); }

.hot-list { padding: 4px 0; }

.hot-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.hot-item:last-child { border-bottom: 0; }
.hot-item:hover { background: var(--surface-2); }

.hot-cover {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
  color: #fff;
}

.hot-cover.c1 { background: linear-gradient(140deg, #4f7dff, #2f5be0); }
.hot-cover.c2 { background: linear-gradient(140deg, #16a394, #0f8276); }
.hot-cover.c3 { background: linear-gradient(140deg, #f08b3a, #d96a17); }
.hot-cover.c4 { background: linear-gradient(140deg, #8b6ce0, #6b47c8); }
.hot-cover.c5 { background: linear-gradient(140deg, #e0668a, #c44066); }

.hot-main { flex: 1 1 auto; min-width: 0; }

.hot-title {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 4px;
}

.hot-excerpt {
  margin: 0 0 8px;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--text-2);
}

.hot-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--muted);
}

.hot-source { color: var(--primary); }

.hot-cat {
  padding: 1px 7px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.hot-side {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.hot-read {
  font-size: 11.5px;
  color: var(--success);
  background: var(--success-soft);
  border-radius: 99px;
  padding: 1px 9px;
}

.hot-actions { display: flex; gap: 8px; }

.hot-modal { max-width: 640px; }
.hot-modal .modal-body { padding: 22px 24px 28px; }
.hot-modal-tools { display: flex; align-items: center; gap: 8px; }

.hot-modal-title {
  font-size: 19px;
  line-height: 1.5;
  margin-bottom: 6px;
  letter-spacing: -.01em;
}

.hot-modal-meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.hot-modal-body {
  font-size: 14.5px;
  line-height: 1.9;
  color: var(--text-2);
}

.hot-modal-body p { margin: 0 0 14px; }
.hot-modal-body p:last-child { margin-bottom: 0; }

@media (max-width: 760px) {
  .hot-item { flex-wrap: wrap; padding: 14px; }
  .hot-cover { width: 48px; height: 48px; font-size: 11.5px; }
  .hot-side { flex-direction: row; align-items: center; width: 100%; justify-content: space-between; }
  .hot-actions { flex: 1 1 auto; justify-content: flex-end; }
  .hot-search { flex-wrap: wrap; }
}

/* ==========================================================================
   图文预览（编辑器弹窗）
   ========================================================================== */
.wx-modal { max-width: 560px; }
.wx-modal .modal-body { padding: 0; background: var(--surface-2); }

.wx-article {
  background: #fff;
  padding: 26px 24px 30px;
}

.wx-article-title {
  font-size: 22px;
  line-height: 1.42;
  letter-spacing: -.01em;
  word-break: break-word;
}

.wx-article-meta {
  margin: 10px 0 18px;
  font-size: 12.5px;
  color: var(--muted);
}

.wx-article-body {
  font-size: 15px;
  line-height: 1.85;
  color: #222;
  word-break: break-word;
}

.wx-article-body p { margin: 0 0 16px; }
.wx-article-body h2 { font-size: 18px; margin: 24px 0 12px; }
.wx-article-body h3 { font-size: 16px; margin: 20px 0 10px; }
.wx-article-body img { max-width: 100%; height: auto; border-radius: 4px; }
.wx-article-body blockquote {
  margin: 16px 0;
  padding: 10px 14px;
  border-left: 3px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 14px;
}
.wx-article-body ul, .wx-article-body ol { padding-left: 22px; margin: 0 0 16px; }

/* ==========================================================================
   调用记录（/mcp/logs）
   七个数字并排，用分隔线而不是卡片阴影——这里是仪表盘不是营销页。
   ========================================================================== */
.call-stats {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.call-stat {
  padding: 16px 14px;
  border-right: 1px solid var(--border);
  text-align: center;
}

.call-stat:last-child { border-right: 0; }

.call-stat-value {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.call-stat-value.is-danger { color: var(--danger); }
.call-stat-unit { font-size: 11.5px; font-weight: 500; color: var(--muted); margin-left: 2px; }

.call-stat-label {
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--muted);
}

.mcp-log-table .cell-main { font-size: 13px; }
.mcp-log-table .cell-sub { font-size: 11px; color: var(--muted); }
.mcp-log-table .mono { font-family: var(--mono); }

@media (max-width: 980px) {
  .call-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .call-stat:nth-child(4n) { border-right: 0; }
  .call-stat:nth-child(n+5) { border-top: 1px solid var(--border); }
}

@media (max-width: 560px) {
  .call-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .call-stat:nth-child(2n) { border-right: 0; }
  .call-stat:nth-child(n+3) { border-top: 1px solid var(--border); }
}

/* ==========================================================================
   额度与账单（/billing）
   上面两张卡：左「我还有多少」，右「怎么算的」；下面才是充值。
   ========================================================================== */
.billing-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 16px;
}

.billing-balance-label { font-size: 12.5px; color: var(--muted); }

.billing-balance-value {
  margin-top: 2px;
  font-size: 40px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}

.billing-balance-value span {
  margin-left: 6px;
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
}

.billing-balance-sub { margin-top: 6px; font-size: 13px; color: var(--text-2); }

.billing-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.billing-facts dt { font-size: 11.5px; color: var(--muted); }
.billing-facts dd { margin: 3px 0 0; font-size: 13px; font-weight: 600; }

.billing-warn {
  margin-top: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--warning-soft);
  color: #b45309;
  font-size: 12px;
}

.billing-rules-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.billing-rules-title { font-size: 14px; font-weight: 600; }

.billing-rule-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.billing-rule-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.65;
}

.billing-rule-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.billing-rule-list strong { color: var(--text); }

.billing-rule-tag {
  flex: 0 0 auto;
  min-width: 40px;
  text-align: center;
  padding: 1px 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
}

.billing-rule-tag.is-charge { background: var(--danger-soft); color: var(--danger); }
.billing-rule-tag.is-free { background: var(--success-soft); color: var(--success); }
.billing-rule-tag.is-refund { background: var(--primary-soft); color: var(--primary-dark); }
.billing-rule-tag.is-note { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }

/* 套餐：整张卡可点，选中态用描边而不是阴影，避免和 hover 混淆 */
.recharge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.recharge-pack {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  text-align: center;
}

.recharge-pack:hover { border-color: var(--border-strong); }

.recharge-pack input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.recharge-pack:has(input:checked),
.recharge-pack.is-featured {
  border-color: var(--primary);
}

.recharge-pack:has(input:checked) { background: rgba(47, 107, 255, .04); }

.recharge-pack.is-featured::after {
  content: '';
  position: absolute;
  inset: -1.5px;
  border-radius: var(--radius);
  border: 1.5px solid var(--primary);
  pointer-events: none;
}

.recharge-pack-badge {
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  padding: 1px 9px;
  border-radius: 99px;
  background: var(--primary);
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}

.recharge-pack-points {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.recharge-pack-points em {
  margin-left: 2px;
  font-style: normal;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.recharge-pack-price { font-size: 13.5px; font-weight: 600; color: var(--primary-dark); }
.recharge-pack-hint { font-size: 11px; color: var(--muted); line-height: 1.5; }

.recharge-pay {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.recharge-selected { font-size: 13px; color: var(--text-2); }
.recharge-selected strong { color: var(--text); }

.pay-methods { display: flex; gap: 8px; margin-left: auto; }

.pay-method {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  cursor: pointer;
  background: var(--surface);
}

.pay-method input { position: absolute; opacity: 0; pointer-events: none; }

.pay-method-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  display: inline-block;
  position: relative;
}

.pay-method:has(input:checked) { border-color: var(--primary); color: var(--primary-dark); font-weight: 600; }
.pay-method:has(input:checked) .pay-method-dot { border-color: var(--primary); }
.pay-method:has(input:checked) .pay-method-dot::after {
  content: '';
  position: absolute;
  inset: 2.5px;
  border-radius: 50%;
  background: var(--primary);
}

.pay-method.is-disabled { opacity: .5; cursor: not-allowed; }

@media (max-width: 900px) {
  .billing-top { grid-template-columns: minmax(0, 1fr); }
  .billing-balance-value { font-size: 34px; }
}

@media (max-width: 620px) {
  .billing-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .recharge-pay { align-items: stretch; }
  .pay-methods { margin-left: 0; }
  #rechargeSubmit { width: 100%; }
}

/* 兜底：不支持 :has() 的浏览器靠 JS 打上的类名 */
.recharge-pack.is-checked { border-color: var(--primary); background: rgba(47, 107, 255, .04); }

/* hidden 属性要能压过 display:flex/grid —— 组件类里显式写了 display 的元素
   单靠 UA 的 [hidden]{display:none} 是压不住的（贴图的空态和图片墙就踩过） */
[hidden] { display: none !important; }

/* 选中态要一眼看出来：描边 + 淡蓝底 + 轻微光圈 */
.recharge-pack.is-checked,
.recharge-pack:has(input:checked) {
  border-color: var(--primary);
  background: rgba(47, 107, 255, .06);
  box-shadow: 0 0 0 3px rgba(47, 107, 255, .10);
}

/* ==========================================================================
   阅读统计 /accounts/stats
   四指标一条、CSS 柱状图、两列分布、文章榜
   ========================================================================== */

.rs-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-left: auto;
  flex: 0 0 auto;
}
/* 左半边允许压缩：描述较长时宁可换行，也不要把右侧筛选挤到下一行 */
.rs-head-text { min-width: 0; flex: 1 1 320px; }
.rs-toolbar form { margin: 0; }
.rs-toolbar .filters .select { min-width: 132px; }

/* 四指标：一条白底，格间竖线分隔（对齐微信后台的观感） */
.rs-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  overflow: hidden;
}
.rs-stat {
  padding: 18px 20px;
  border-right: 1px solid var(--border);
  min-width: 0;
}
.rs-stat:last-child { border-right: 0; }
.rs-stat-value {
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -.02em;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rs-stat-value.is-muted { color: var(--muted); font-size: 22px; }
/* 「主要来源」是文字不是数字，字号降一档才不会比旁边三个数字更抢眼 */
.rs-stat-value.is-text { font-size: 19px; font-weight: 600; }
.rs-stat-label { font-size: 12.5px; color: var(--text-2); margin-top: 6px; }

/* 趋势图：纯 CSS 柱状图（flex 列 + 高度百分比），不随容器宽度变形 */
.rs-chart-head {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 6px;
}
.rs-chart-peak { font-size: 12px; color: var(--muted); }

.rs-bars {
  display: flex;
  align-items: flex-end;
  height: 200px;
}
.rs-bar-col {
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.rs-bar-track {
  flex: 1 1 auto;
  display: flex;
  align-items: flex-end;
  border-bottom: 1px solid var(--border);
}
.rs-bar {
  width: calc(100% - 4px);
  /* 7 天窗口下每根柱子会被拉得很宽，看着像色块；限个最大宽度更像图表 */
  max-width: 56px;
  margin: 0 auto;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, var(--primary), #7aa2ff);
  transition: filter .15s ease;
}
.rs-bar-col:hover .rs-bar { filter: brightness(.9); }
.rs-bar-x {
  height: 20px;
  line-height: 20px;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  /* 90 天窗口下每列只有 10px 宽，标签必须允许溢出，否则会被裁成「05」 */
  overflow: visible;
  position: relative;
}

/* 空态：保留一条基线，避免整块区域塌成一片空白 */
.rs-bars-empty { padding-top: 40px; }
.rs-bars-baseline { height: 1px; background: var(--border); margin-bottom: 8px; }

/* 分布条 */
.rs-bar-row + .rs-bar-row { margin-top: 14px; }
.rs-bar-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.rs-bar-name {
  font-size: 13px;
  color: var(--text-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rs-bar-value {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}
.rs-bar-value small {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  margin-left: 4px;
}
.progress-bar.is-muted { background: var(--border-strong); }

.rs-empty {
  padding: 26px 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.9;
}

.rs-article-link { color: var(--text-1); }
.rs-article-link:hover { color: var(--primary); text-decoration: underline; }

@media (max-width: 900px) {
  .rs-article-table { min-width: 600px; }
  .rs-stats { grid-template-columns: repeat(2, 1fr); }
  .rs-stat:nth-child(2) { border-right: 0; }
  .rs-stat:nth-child(1),
  .rs-stat:nth-child(2) { border-bottom: 1px solid var(--border); }
}

@media (max-width: 640px) {
  .rs-toolbar { justify-content: flex-start; }
  .rs-toolbar .filters .select { min-width: 118px; }
  .rs-stat { padding: 14px 16px; }
  .rs-stat-value { font-size: 22px; }
  .rs-bars { height: 160px; }
  .rs-bar-x { font-size: 10px; }
}

/* 联盟管理：测试连接的结果常驻在卡片里（带排查步骤，toast 撑不住这么长的文案） */
.aff-test {
  margin: 0 20px 16px;
}
.aff-test .alert {
  align-items: flex-start;
  line-height: 1.7;
}
.aff-test .alert-icon {
  margin-top: 1px;
}
/* 分步诊断是一行一步的结论，按换行原样展示 */
.aff-test .text-sm {
  white-space: pre-line;
  word-break: break-word;
}

@media (max-width: 640px) {
  .aff-test { margin: 0 14px 14px; }
}

/* ---------------------------------------------------------------
   商品库「添加商品」弹窗
   先查询、再确认入库：查回来的商品要让人一眼看清券后价与自己的分成，
   否则用户只能凭标题猜这个链接值不值得加。
   --------------------------------------------------------------- */
.modal-add-product { max-width: 600px; }

.product-add-preview {
  display: flex;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.product-add-thumb {
  flex: 0 0 86px;
  width: 86px;
  height: 86px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--surface);
}

.product-add-info { flex: 1; min-width: 0; }

.product-add-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-add-shop { margin-top: 4px; font-size: 12px; color: var(--muted); }

.product-add-price {
  margin-top: 10px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.product-add-price .now { font-size: 18px; font-weight: 700; color: var(--danger); }
.product-add-price .was { font-size: 12px; color: var(--muted); text-decoration: line-through; }

.product-add-commission { margin-top: 8px; font-size: 13px; color: var(--text-2); }
.product-add-commission strong { font-size: 15px; color: var(--success); }
.product-add-note { margin-top: 3px; font-size: 12px; color: var(--muted); }

.product-add-exists { margin-top: 12px; }

@media (max-width: 640px) {
  .product-add-preview { flex-direction: column; }
  .product-add-thumb { width: 100%; height: 150px; flex-basis: auto; }
}
