:root {
  --bg: #f7f8fa;
  --card: #ffffff;
  --text: #1b1f24;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #111827;
  --accent-soft: #f3f4f6;
  --brand: #2563eb;
  --brand-soft: #eff6ff;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --radius: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.55;
}
a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; }

/* ---------- 通用组件 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--text);
  border-radius: 8px; padding: 7px 14px; font-size: 13.5px; cursor: pointer;
  transition: all .15s;
}
.btn:hover { border-color: #c9ced6; background: var(--accent-soft); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { background: #000; }
.btn.brand { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 600; }
.btn.danger { color: var(--bad); border-color: #fecaca; }
.btn.danger:hover { background: #fef2f2; }
.btn.small { padding: 4px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

input, select, textarea {
  font-family: inherit; font-size: 13.5px; color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff;
  outline: none; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
label { font-size: 12.5px; color: var(--muted); display: block; margin-bottom: 5px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px;
}
.grid { display: grid; gap: 16px; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.tag {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px;
  background: var(--accent-soft); color: var(--muted);
}
.tag.ok { background: #dcfce7; color: var(--ok); }
.tag.warn { background: #fef3c7; color: var(--warn); }
.tag.bad { background: #fee2e2; color: var(--bad); }
.tag.brand { background: var(--brand-soft); color: var(--brand); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); font-size: 13px; }
th { color: var(--muted); font-weight: 500; font-size: 12.5px; white-space: nowrap; }
td.wrap { word-break: break-all; }

/* toast */
#toast {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: #fff; padding: 9px 18px; border-radius: 8px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 999;
  max-width: 80vw;
}
#toast.show { opacity: .95; }
#toast.err { background: var(--bad); }

/* ---------- 门户首页 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 32px; background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.topbar .logo { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.topbar nav { display: flex; gap: 20px; align-items: center; font-size: 13.5px; }
.topbar nav a { color: var(--text); }
.topbar nav a:hover { color: var(--brand); }

.hero { text-align: center; padding: 72px 24px 48px; }
.hero h1 { font-size: 34px; letter-spacing: .5px; }
.hero p { color: var(--muted); margin-top: 12px; font-size: 15px; }
.hero .actions { margin-top: 26px; display: flex; gap: 12px; justify-content: center; }

.section { max-width: 1080px; margin: 0 auto; padding: 36px 24px; }
.section h2 { font-size: 20px; margin-bottom: 6px; }
.section .sub { color: var(--muted); margin-bottom: 22px; }
.plugin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.plugin-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; transition: box-shadow .15s, transform .15s;
}
.plugin-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.07); transform: translateY(-2px); }
.plugin-card .head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.plugin-card .icon { font-size: 22px; }
.plugin-card h3 { font-size: 15.5px; }
.plugin-card p { color: var(--muted); font-size: 13px; min-height: 38px; }
.plugin-card .meta { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.feature { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.feature b { display: block; margin-bottom: 6px; }
.feature span { color: var(--muted); font-size: 13px; }

footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 24px; text-align: center; color: var(--muted); font-size: 12.5px; }

/* ---------- 登录/注册 ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 380px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 32px; }
.auth-card h1 { font-size: 20px; margin-bottom: 4px; }
.auth-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.auth-card .field { margin-bottom: 14px; }
.auth-card .foot { margin-top: 16px; font-size: 13px; text-align: center; }

/* ---------- 会员中心 / 后台：侧栏布局 ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 210px; background: #fff; border-right: 1px solid var(--line);
  padding: 16px 10px; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .logo { padding: 6px 12px 14px; font-weight: 700; font-size: 15px; display: flex; gap: 8px; align-items: center; }
.sidebar .group { font-size: 11.5px; color: var(--muted); padding: 12px 12px 4px; }
.sidebar a.item {
  display: flex; align-items: center; gap: 9px; padding: 8px 12px; border-radius: 8px;
  color: var(--text); font-size: 13.5px; margin: 1px 0;
}
.sidebar a.item:hover { background: var(--accent-soft); }
.sidebar a.item.on { background: var(--accent-soft); color: var(--brand); font-weight: 600; }
.sidebar .subitem { padding-left: 30px; }

.main { flex: 1; padding: 24px 32px; max-width: 1200px; }
.main h1 { font-size: 21px; margin-bottom: 2px; }
.main .page-sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.main .head-row { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.stat .label { color: var(--muted); font-size: 12.5px; }
.stat .value { font-size: 24px; font-weight: 700; margin-top: 4px; }
.stat .extra { font-size: 12px; margin-top: 4px; }
.stat .extra.down { color: var(--ok); }

.banner {
  display: flex; align-items: center; justify-content: space-between;
  background: #fffbeb; border: 1px solid #fde68a; color: #92400e;
  border-radius: 10px; padding: 12px 16px; margin-bottom: 18px; font-size: 13px;
}

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } .sidebar { display: none; } }

.form-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.form-row > div { flex: 1; min-width: 140px; }

.kv { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; }
.kv .k { color: var(--muted); }

.code-box {
  background: #0f172a; color: #e2e8f0; border-radius: 8px; padding: 12px 14px;
  font-family: ui-monospace, Consolas, monospace; font-size: 12px; overflow-x: auto; white-space: pre;
}

.empty { text-align: center; color: var(--muted); padding: 40px 0; }

.pager { margin-top: 10px; color: var(--muted); font-size: 12px; }
