:root {
  --bg: #0d1117;
  --bg-2: #131a23;
  --panel: #161d27;
  --panel-2: #1c2532;
  --line: #232d3b;
  --txt: #e6edf3;
  --txt-2: #8b98a9;
  --txt-3: #5c6a7d;
  --brand: #3b82f6;
  --brand-2: #2563eb;
  --ok: #22c55e;
  --warn: #f59e0b;
  --err: #ef4444;
  --gold: #f0b429;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
               "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 0%, #1a2740 0%, var(--bg) 60%);
  padding: 24px;
}
.login-box {
  width: 100%; max-width: 400px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 16px; padding: 40px 36px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.login-box h1 { font-size: 24px; margin-bottom: 6px; letter-spacing: .5px; }
.login-box .sub { color: var(--txt-2); font-size: 13px; margin-bottom: 28px; }
.login-tabs { display: flex; gap: 8px; margin-bottom: 24px; }
.login-tabs button {
  flex: 1; padding: 9px; background: transparent; color: var(--txt-2);
  border: 1px solid var(--line); border-radius: 8px; font-size: 13px;
}
.login-tabs button.on { background: var(--brand-2); color: #fff; border-color: var(--brand-2); }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; color: var(--txt-2); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 10px 12px; background: var(--bg-2);
  border: 1px solid var(--line); border-radius: 8px; color: var(--txt);
  font-size: 14px; font-family: inherit; outline: none;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.field textarea { min-height: 90px; resize: vertical; line-height: 1.6; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; background: var(--brand-2); color: #fff; border: none;
  border-radius: 8px; font-size: 14px; font-weight: 500; transition: .15s;
}
.btn:hover { background: var(--brand); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--txt-2); }
.btn.ghost:hover { background: var(--panel-2); color: var(--txt); }
.btn.danger { background: var(--err); }
.btn.sm { padding: 6px 12px; font-size: 12px; border-radius: 6px; }
.btn.gold { background: linear-gradient(135deg,#f0b429,#e08c00); color:#1a1200; }

.hint { font-size: 12px; color: var(--txt-3); margin-top: 14px; text-align: center; }
.err-msg {
  background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3);
  color: #fca5a5; padding: 10px 12px; border-radius: 8px; font-size: 13px;
  margin-bottom: 16px; display: none;
}

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

.sidebar {
  width: 216px; flex-shrink: 0; background: var(--bg-2);
  border-right: 1px solid var(--line); display: flex; flex-direction: column;
  position: fixed; top: 0; bottom: 0; left: 0; overflow-y: auto;
}
.logo {
  padding: 20px 18px; font-size: 16px; font-weight: 700; letter-spacing: .5px;
  border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 9px;
}
.logo .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--brand);
  box-shadow: 0 0 10px var(--brand);
}
.nav { padding: 12px 10px; flex: 1; }
.nav-group { margin-bottom: 18px; }
.nav-group .t {
  font-size: 11px; color: var(--txt-3); padding: 0 8px 8px;
  text-transform: uppercase; letter-spacing: 1px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: 8px; color: var(--txt-2); cursor: pointer; font-size: 13.5px;
  margin-bottom: 2px; transition: .12s;
}
.nav-item:hover { background: var(--panel-2); color: var(--txt); }
.nav-item.on { background: rgba(59,130,246,.15); color: #93c5fd; font-weight: 500; }
.nav-item .ic { width: 18px; text-align: center; font-size: 15px; opacity: .9; }
.nav-item .badge {
  margin-left: auto; font-size: 10px; background: var(--gold); color: #1a1200;
  padding: 1px 6px; border-radius: 8px; font-weight: 600;
}

.main { flex: 1; margin-left: 216px; display: flex; flex-direction: column; }

.topbar {
  height: 58px; background: var(--bg-2); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; padding: 0 24px; gap: 20px;
  position: sticky; top: 0; z-index: 20;
}
.wallet { display: flex; gap: 22px; align-items: center; }
.wallet .w { display: flex; flex-direction: column; line-height: 1.3; }
.wallet .w .k { font-size: 11px; color: var(--txt-3); }
.wallet .w .v { font-size: 16px; font-weight: 700; letter-spacing: .3px; }
.wallet .w .v.gold { color: var(--gold); }
.wallet .w .v.blue { color: #60a5fa; }
.topbar .spacer { flex: 1; }
.user-chip {
  display: flex; align-items: center; gap: 8px; padding: 5px 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px;
  font-size: 13px; cursor: pointer;
}
.role-tag {
  font-size: 10px; padding: 1px 7px; border-radius: 8px; background: var(--panel-2);
  color: var(--txt-2); border: 1px solid var(--line);
}

.content { padding: 24px; flex: 1; }
.page-head { margin-bottom: 22px; }
.page-head h2 { font-size: 20px; margin-bottom: 4px; }
.page-head .desc { color: var(--txt-2); font-size: 13px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; margin-bottom: 18px;
}
.card h3 {
  font-size: 15px; margin-bottom: 14px; display: flex; align-items: center;
  gap: 8px; justify-content: space-between;
}
.card h3 .sub { font-size: 12px; color: var(--txt-3); font-weight: 400; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .sidebar { width: 64px; }
  .sidebar .nav-item span.lb, .sidebar .nav-group .t, .logo span { display: none; }
  .main { margin-left: 64px; }
}

.stat {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px;
}
.stat .k { font-size: 12px; color: var(--txt-2); margin-bottom: 6px; }
.stat .v { font-size: 26px; font-weight: 700; letter-spacing: .5px; }
.stat .v.gold { color: var(--gold); }
.stat .v.blue { color: #60a5fa; }
.stat .v.green { color: var(--ok); }
.stat .d { font-size: 11px; color: var(--txt-3); margin-top: 4px; }

/* ---------- 表格 ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; padding: 10px 12px; color: var(--txt-2); font-weight: 500;
  font-size: 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.tbl td {
  padding: 11px 12px; border-bottom: 1px solid rgba(35,45,59,.6);
  vertical-align: top;
}
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover { background: rgba(28,37,50,.5); }

.tag {
  display: inline-block; padding: 2px 9px; border-radius: 10px;
  font-size: 11px; font-weight: 500; white-space: nowrap;
}
.tag.ok { background: rgba(34,197,94,.15); color: #4ade80; }
.tag.warn { background: rgba(245,158,11,.15); color: #fbbf24; }
.tag.err { background: rgba(239,68,68,.15); color: #f87171; }
.tag.info { background: rgba(59,130,246,.15); color: #93c5fd; }
.tag.gray { background: var(--panel-2); color: var(--txt-2); }

/* ---------- 表单行 ---------- */
.form-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.form-row .field { flex: 1; min-width: 160px; margin-bottom: 0; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }

.checkbox-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px;
}
.check-item {
  display: flex; align-items: center; gap: 9px; padding: 10px 12px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px;
  cursor: pointer; font-size: 13px; transition: .12s;
}
.check-item:hover { border-color: var(--brand); }
.check-item.on { border-color: var(--brand); background: rgba(59,130,246,.12); }
.check-item .nm { flex: 1; }
.check-item .px { font-size: 11px; color: var(--gold); }
.check-item input { accent-color: var(--brand); }

/* ---------- 诊断结果 ---------- */
.score-hero {
  display: flex; align-items: center; gap: 28px; padding: 24px 28px;
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  border-radius: var(--radius); margin-bottom: 18px;
}
.score-hero .big { font-size: 52px; font-weight: 800; line-height: 1; }
.score-hero .g { font-size: 26px; font-weight: 700; }
.score-hero .meta { color: #dbeafe; font-size: 13px; margin-top: 6px; }

.metric-row { display: flex; flex-direction: column; gap: 12px; }
.metric {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 14px 16px;
}
.metric .hd { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.metric .hd .nm { font-weight: 600; font-size: 14px; }
.metric .hd .sc { margin-left: auto; font-weight: 700; font-size: 15px; }
.bar { height: 6px; background: var(--panel-2); border-radius: 4px; overflow: hidden; margin-bottom: 10px; }
.bar i { display: block; height: 100%; border-radius: 4px; transition: width .5s; }
.metric .fd { font-size: 12.5px; color: var(--txt-2); margin-bottom: 6px; }
.metric .sg {
  font-size: 12.5px; color: #a5d6a7; background: rgba(34,197,94,.08);
  padding: 8px 10px; border-radius: 6px; border-left: 3px solid var(--ok);
}

/* ---------- 文章预览 ---------- */
.article-view {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 22px 26px; max-height: 560px; overflow-y: auto;
  font-size: 14px; line-height: 1.85;
}
.article-view h1 { font-size: 20px; margin-bottom: 14px; }
.article-view h2 { font-size: 16px; margin: 20px 0 8px; color: #93c5fd; }
.article-view p { margin-bottom: 10px; }
.article-view table { width:100%; border-collapse: collapse; margin: 10px 0; font-size: 13px; }
.article-view th, .article-view td { border: 1px solid var(--line); padding: 7px 10px; }
.article-view th { background: var(--panel-2); }

.empty {
  text-align: center; padding: 48px 20px; color: var(--txt-3); font-size: 13px;
}
.empty .ic { font-size: 36px; margin-bottom: 12px; opacity: .5; }

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 100;
  display: none; align-items: center; justify-content: center; padding: 24px;
}
.modal.on { display: flex; }
.modal-box {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 26px; width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto;
}
.modal-box h3 { font-size: 17px; margin-bottom: 16px; }

.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--panel-2); border: 1px solid var(--line); color: var(--txt);
  padding: 11px 20px; border-radius: 8px; font-size: 13px; z-index: 200;
  opacity: 0; transition: .25s; pointer-events: none;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: rgba(239,68,68,.5); color: #fca5a5; }
.toast.ok { border-color: rgba(34,197,94,.5); color: #86efac; }

.pkg {
  border: 1px solid var(--line); border-radius: 10px; padding: 16px;
  background: var(--bg-2); cursor: pointer; transition: .15s; text-align: center;
}
.pkg:hover { border-color: var(--gold); transform: translateY(-2px); }
.pkg.on { border-color: var(--gold); background: rgba(240,180,41,.1); }
.pkg .amt { font-size: 22px; font-weight: 700; color: var(--gold); }
.pkg .get { font-size: 12px; color: var(--txt-2); margin-top: 4px; }
.pkg .bonus { font-size: 11px; color: var(--ok); margin-top: 2px; }

.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 12px; }
.muted { color: var(--txt-3); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
