:root {
  --navy-1: #0A1628;
  --navy-2: #162544;
  --gold: #C9A96E;
  --gold-soft: #e7d4ab;
  --steel: #8B9DC3;
  --ink: #1f2a3d;
  --muted: #6b7689;
  --line: #e6e9f0;
  --bg: #f5f7fb;
  --card: #ffffff;
  --ok: #2f9e6b;
  --warn: #c98a2b;
  --danger: #c0492f;
  --shadow: 0 8px 30px rgba(16, 30, 54, 0.08);
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
}
h1, h2, h3, h4 { margin: 0; font-weight: 700; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 26px;
  background: linear-gradient(120deg, var(--navy-1), var(--navy-2));
  color: #fff; box-shadow: var(--shadow);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, var(--gold), #b08d4f);
  display: grid; place-items: center; color: var(--navy-1);
  font-weight: 800; font-size: 18px; box-shadow: 0 4px 12px rgba(201,169,110,.4);
}
.brand .title { font-size: 18px; letter-spacing: .5px; }
.brand .sub { font-size: 12px; color: var(--steel); font-weight: 400; }
.topbar .right { display: flex; align-items: center; gap: 14px; }
.user-chip {
  display: flex; align-items: center; gap: 8px; font-size: 13px;
  background: rgba(255,255,255,.08); padding: 6px 12px; border-radius: 999px;
}
.user-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.btn {
  border: none; cursor: pointer; border-radius: 10px; padding: 9px 16px;
  font-family: inherit; font-size: 13px; font-weight: 600; transition: .15s;
}
.btn-gold { background: linear-gradient(135deg, var(--gold), #b8915a); color: var(--navy-1); }
.btn-gold:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.3); }
.btn-ghost:hover { background: rgba(255,255,255,.1); }
.btn-line { background: #fff; color: var(--navy-2); border: 1px solid var(--line); }
.btn-line:hover { border-color: var(--gold); color: var(--gold); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- 布局 ---------- */
.layout { display: grid; grid-template-columns: 380px 1fr; gap: 18px; padding: 18px 26px; align-items: start; }
@media (max-width: 980px) { .layout { grid-template-columns: 1fr; } }

.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px;
}
.panel h3 { font-size: 15px; color: var(--navy-2); margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.panel .hint { color: var(--muted); font-size: 12px; margin-bottom: 14px; }

.upload-item {
  border: 1.5px dashed var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px;
  transition: .15s; background: #fbfcfe;
}
.upload-item.done { border-color: var(--gold); background: #fdfaf2; }
.upload-item .name { font-weight: 600; font-size: 13px; color: var(--ink); }
.upload-item .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.upload-item .file-input { display: none; }
.upload-icon { color: var(--steel); font-size: 20px; }
.row { display: flex; gap: 10px; align-items: center; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; font-weight: 600; }
.field input, .field select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px;
  font-family: inherit; font-size: 13px; background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus { outline: none; border-color: var(--gold); }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 16px; }
.tab {
  padding: 8px 14px; border-radius: 9px; cursor: pointer; font-size: 13px; font-weight: 600;
  color: var(--muted); background: #f3f5f9; border: 1px solid transparent;
}
.tab.active { background: var(--navy-2); color: #fff; }
.tab:hover:not(.active) { color: var(--navy-2); }

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.page-head h2 { font-size: 17px; color: var(--navy-1); }
.badges { display: flex; gap: 8px; flex-wrap: wrap; }
.badge { font-size: 11px; padding: 3px 10px; border-radius: 999px; background: #eef2f8; color: var(--navy-2); font-weight: 600; }
.badge.gold { background: #f7efdd; color: #8a6a2b; }

/* ---------- 概览卡 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
@media (max-width: 760px){ .stat-grid { grid-template-columns: repeat(2,1fr);} }
.stat {
  background: linear-gradient(135deg, #fff, #f7f9fc); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px;
}
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 20px; font-weight: 800; color: var(--navy-1); margin-top: 4px; }
.stat .v.gold { color: #9a7b34; }

/* ---------- 表格 ---------- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  background: var(--navy-2); color: #fff; text-align: right; padding: 9px 12px;
  font-weight: 600; position: sticky; top: 0;
}
table.tbl th:first-child, table.tbl td:first-child { text-align: left; }
table.tbl td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: right; }
table.tbl tr:nth-child(even) td { background: #fafbfd; }
table.tbl tr.total td { font-weight: 800; background: #f3f0e6; color: var(--navy-1); }
table.tbl tr.section td { background: #eef2f8; font-weight: 700; color: var(--navy-2); text-align: left; }
.num { font-variant-numeric: tabular-nums; }
.neg { color: var(--danger); }
.pos { color: var(--ok); }

.scroll { max-height: 560px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.note { background: #fbf7ec; border: 1px solid #ecdcb8; color: #7a5f23; border-radius: 10px; padding: 12px 14px; font-size: 12.5px; margin-bottom: 14px; }
.note b { color: #5f4a17; }

/* ---------- 登录遮罩 ---------- */
.overlay {
  position: fixed; inset: 0; background: linear-gradient(135deg, rgba(10,22,40,.96), rgba(22,37,68,.96));
  display: grid; place-items: center; z-index: 50; padding: 20px;
}
.auth-card {
  width: 400px; max-width: 100%; background: #fff; border-radius: 18px; padding: 30px;
  box-shadow: 0 30px 80px rgba(0,0,0,.4);
}
.auth-card .logo {
  width: 52px; height: 52px; border-radius: 13px; margin: 0 auto 14px;
  background: linear-gradient(135deg, var(--gold), #b08d4f); display: grid; place-items: center;
  color: var(--navy-1); font-weight: 800; font-size: 24px;
}
.auth-card h2 { text-align: center; color: var(--navy-1); font-size: 20px; }
.auth-card .tag { text-align: center; color: var(--muted); font-size: 12.5px; margin: 6px 0 20px; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.auth-tabs .tab { flex: 1; text-align: center; background: #eef2f8; }
.auth-tabs .tab.active { background: var(--navy-2); color: #fff; }
.auth-card .err { color: var(--danger); font-size: 12.5px; min-height: 18px; margin-top: 8px; text-align: center; }
.auth-card .ok { color: var(--ok); }
.sep { text-align: center; color: var(--muted); font-size: 12px; margin: 14px 0; }

.empty {
  text-align: center; color: var(--muted); padding: 60px 20px;
}
.empty .big { font-size: 40px; opacity: .3; }

.hidden { display: none !important; }
.actions-row { display: flex; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 历史列表 */
.history-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px;
}
.history-item .p { font-weight: 600; }
.history-item .m { font-size: 12px; color: var(--muted); }

/* ---------- 套餐徽标 ---------- */
.plan-badge {
  font-size: 12px; font-weight: 700; padding: 5px 12px; border-radius: 999px;
}
.plan-badge.trial { background: #f3f0e6; color: #8a6a2b; }
.plan-badge.paid { background: #e7f4ec; color: #2f7d4f; }

/* ---------- 弹窗 ---------- */
.modal-card {
  background: #fff; border-radius: 18px; padding: 28px;
  box-shadow: 0 30px 80px rgba(0,0,0,.4); max-width: 100%;
}
.modal-card h2 { text-align: center; color: var(--navy-1); font-size: 19px; margin-bottom: 4px; }
.modal-card .hint { text-align: center; color: var(--muted); font-size: 12.5px; margin-bottom: 18px; }
.modal-card .row { display: flex; gap: 10px; }

/* ---------- 套餐选择卡 ---------- */
.plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.plan-card {
  border: 1.5px solid var(--line); border-radius: 14px; padding: 18px; text-align: center;
  background: #fbfcfe;
}
.plan-card.current { border-color: var(--gold); background: #fdfaf2; }
.plan-card .pn { font-weight: 800; font-size: 15px; color: var(--navy-1); }
.plan-card .pp { font-size: 26px; font-weight: 800; color: #9a7b34; margin: 8px 0; }
.plan-card .pp span { font-size: 13px; font-weight: 500; color: var(--muted); }
.plan-card .pd { font-size: 12px; color: var(--muted); margin-bottom: 12px; min-height: 32px; }
.plan-card .btn { width: 100%; }

/* ---------- 管理员面板 ---------- */
#adminPanel { min-height: 100vh; background: var(--bg); }
#adminPanel .layout { display: block; }
#adminPanel .panel { margin-bottom: 18px; }
#adminPanel .stat-grid { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 760px){ #adminPanel .stat-grid { grid-template-columns: repeat(2,1fr);} .plan-grid { grid-template-columns: 1fr; } }
