:root {
  --bg: #0e0f13;
  --panel: #17181f;
  --panel-2: #1f2129;
  --border: #2a2d38;
  --text: #e6e7ea;
  --dim: #9aa0ad;
  --accent: #4ea1ff;
  --accent-2: #38d39f;
  --danger: #ff5d5d;
  --warn: #ffb454;
  --radius: 10px;
  --shadow: 0 6px 24px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* 顶栏 */
.nav { border-bottom: 1px solid var(--border); background: rgba(20,21,27,.9); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 10; }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
/* 后台 / 控制台顶栏：与左侧栏对齐，不居中 */
.nav-wide { max-width: none; padding: 0 24px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.brand .dot { width: 14px; height: 14px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.nav-links a { margin-left: 18px; color: var(--dim); font-size: 14px; }
.nav-links a:hover { color: var(--text); text-decoration: none; }
.btn {
  display: inline-block; padding: 9px 18px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
  cursor: pointer; font-size: 14px; transition: .15s;
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: linear-gradient(135deg, var(--accent), #3b86e0); border: none; color: #fff; font-weight: 600; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-sm { padding: 5px 12px; font-size: 13px; }

/* 英雄区 */
.hero { padding: 70px 0 40px; text-align: center; }
.hero h1 { font-size: 40px; margin: 0 0 14px; background: linear-gradient(135deg,#fff,#9fc6ff); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero p { color: var(--dim); font-size: 17px; max-width: 640px; margin: 0 auto 26px; }
.hero-btns .btn { margin: 0 8px; }

/* 特性卡片 */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; padding: 30px 0 50px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 8px; font-size: 17px; }
.card p { margin: 0; color: var(--dim); font-size: 14px; }
.card .ico { font-size: 26px; margin-bottom: 8px; }

/* 通用表单/面板 */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); max-width: 420px; margin: 40px auto; }
.panel.wide { max-width: 860px; }
.panel h2 { margin: 0 0 6px; font-size: 22px; }
.panel .sub { color: var(--dim); font-size: 13px; margin: 0 0 20px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--dim); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text); font-size: 14px; outline: none;
}
.field input:focus, .field select:focus { border-color: var(--accent); }
.row-between { display: flex; justify-content: space-between; align-items: center; }
.tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.tab { padding: 8px 16px; border-radius: 8px; cursor: pointer; color: var(--dim); border: 1px solid var(--border); }
.tab.active { color: #fff; background: var(--panel-2); border-color: var(--accent); }

/* 仪表盘 */
.credits-big { font-size: 46px; font-weight: 700; color: var(--accent-2); }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 20px 0; }
.stat { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 14px; transition: .16s; }
.stat:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0,0,0,.35); }
.stat .n { font-size: 22px; font-weight: 700; }
.stat .l { font-size: 12px; color: var(--dim); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); }
th { color: var(--dim); font-weight: 600; }
.data-table tbody tr { transition: .12s; }
.data-table tbody tr:hover { background: var(--panel-2); }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 13px; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: var(--panel-2); border: 1px solid var(--border); color: var(--dim); }
.pill.ok { color: var(--accent-2); border-color: var(--accent-2); }
.pill.bad { color: var(--danger); border-color: var(--danger); }
.pill.warn { color: var(--warn); border-color: var(--warn); }
/* 用户列表「在线」状态圆点：绿=在线，红=离线 */
.status-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; }
.status-dot.online { background: #27c08a; box-shadow: 0 0 0 3px rgba(39,192,138,.18); }
.status-dot.offline { background: #e0556b; }

/* 用户管理：内部分页子标签 */
.sub-pane { display: none; }
.sub-pane.active { display: block; }
#tab-users .tabs { margin: 4px 0 18px; }
.toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); background: var(--panel-2); border: 1px solid var(--border); padding: 12px 20px; border-radius: 8px; box-shadow: var(--shadow); opacity: 0; transition: .25s; z-index: 50; }
.toast.show { opacity: 1; }
.toast.err { border-color: var(--danger); color: var(--danger); }
.section-title { font-size: 15px; color: var(--dim); margin: 26px 0 10px; text-transform: uppercase; letter-spacing: 1px; }
.section-title:not(.section-title-inline) { border-left: 3px solid var(--accent); padding-left: 10px; }
.rel-total { margin-top: 10px; font-size: 13px; color: var(--dim); }
.rel-total b { color: var(--accent); font-size: 15px; }
.muted { color: var(--dim); font-size: 13px; }
.footer { border-top: 1px solid var(--border); color: var(--dim); font-size: 13px; text-align: center; padding: 30px 0; margin-top: 40px; }

/* ============ 管理后台：左右结构 ============ */
.admin-layout { display: flex; min-height: calc(100vh - 60px - 91px); }
.admin-side {
  width: 220px; flex: 0 0 220px; border-right: 1px solid var(--border);
  background: var(--panel); padding: 22px 14px; display: flex; flex-direction: column;
}
.side-title { font-weight: 700; font-size: 16px; padding: 0 8px 14px; color: var(--text); }
.side-nav { display: flex; flex-direction: column; gap: 6px; }
.side-item {
  display: block; padding: 11px 14px; border-radius: 8px; cursor: pointer;
  color: var(--dim); font-size: 14px; border-left: 3px solid transparent; user-select: none;
}
.side-item:hover { background: var(--panel-2); color: var(--text); }
.side-item.active { background: var(--panel-2); color: var(--text); border-left-color: var(--accent); font-weight: 600; }
.side-item { position: relative; }
/* 左侧导航未处理事项红点：账号注销（待审批）/ 用户反馈（未读） */
.nav-dot {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box;
  border-radius: 9px; background: #e53935; color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px rgba(229,57,53,.22); pointer-events: none;
}
.nav-dot[hidden] { display: none; }
.side-foot { margin-top: auto; padding: 12px 8px 0; font-size: 12px; line-height: 1.5; border-top: 1px solid var(--border); }
.admin-content { flex: 1; padding: 26px 28px; min-width: 0; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }
.admin-content h2 { margin: 0 0 6px; font-size: 22px; }
.admin-content .sub { color: var(--dim); font-size: 13px; margin: 0 0 18px; }

/* ============ 用户控制台：左右结构（与后台同构） ============ */
.dash-layout { display: flex; min-height: calc(100vh - 60px - 91px); }
.dash-side {
  width: 220px; flex: 0 0 220px; border-right: 1px solid var(--border);
  background: var(--panel); padding: 22px 14px; display: flex; flex-direction: column;
}
.dash-content { flex: 1; padding: 26px 28px; min-width: 0; }
.dash-content h2 { margin: 0 0 6px; font-size: 22px; }
.dash-content .sub { color: var(--dim); font-size: 13px; margin: 0 0 18px; }

@media (max-width: 760px) {
  .admin-layout, .dash-layout { flex-direction: column; }
  .admin-side, .dash-side { width: 100%; flex: none; border-right: none; border-bottom: 1px solid var(--border); flex-direction: row; align-items: center; gap: 10px; padding: 12px; }
  .side-title { display: none; }
  .side-nav { flex-direction: row; gap: 6px; }
  .side-item { border-left: none; border-bottom: 3px solid transparent; }
  .side-item.active { border-left: none; border-bottom-color: var(--accent); }
  .side-foot { display: none; }
  .admin-content, .dash-content { padding: 18px 14px; }
}

.download-card { display:flex; gap:16px; align-items:center; justify-content:space-between; background: var(--panel-2); border:1px solid var(--border); border-radius:8px; padding:16px; }
code.box { display:block; background:#0a0b0e; border:1px solid var(--border); border-radius:6px; padding:10px; white-space:pre-wrap; word-break:break-all; }

/* 弹窗（创建密钥等） */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; z-index: 100; backdrop-filter: blur(3px); }
.modal-box { position: relative; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; width: 420px; max-width: 92vw; box-shadow: var(--shadow); }
.modal-box h3 { margin: 0 0 8px; font-size: 20px; padding-right: 34px; } /* 给右上角 × 留位 */
.modal-close { position: absolute; top: 10px; right: 12px; width: 30px; height: 30px; border: none; background: transparent; color: var(--dim); font-size: 24px; line-height: 1; cursor: pointer; border-radius: 6px; z-index: 2; }
.modal-close:hover { background: var(--panel-2); color: var(--text); }
.modal-box .field { margin: 16px 0; }
.kv { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.pos { color: var(--accent-2); font-weight: 600; }
.neg { color: var(--danger); }

/* 用户详情：卡片式头部 + Key 卡片 */
.ud-head { display: flex; align-items: center; gap: 16px; padding: 6px 0 18px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.ud-avatar {
  width: 54px; height: 54px; flex: 0 0 54px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.ud-head-main { flex: 1; min-width: 0; }
.ud-name { margin: 0 0 8px; font-size: 18px; padding-right: 30px; }
.ud-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ud-credits { text-align: right; padding-left: 16px; }
.ud-credits-n { font-size: 34px; font-weight: 800; color: var(--accent-2); line-height: 1.1; }
.ud-credits-l { font-size: 12px; color: var(--dim); }
.ud-key-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 4px; }
.ud-key {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel-2);
}
.ud-key.bad { opacity: .72; }
.ud-key { transition: .15s; }
.ud-key:hover { border-color: var(--accent); }
.ud-key-info { min-width: 0; }
.ud-key-name { font-weight: 600; font-size: 14px; }
.ud-key-prefix { margin-top: 2px; color: var(--dim); word-break: break-all; }
.ud-key-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

/* 详情弹窗内：API Key / 积分流水 分页切换标签 */
.ud-tabs { display: flex; gap: 8px; margin: 16px 0 10px; }
.ud-tab { padding: 8px 16px; border-radius: 8px; cursor: pointer; color: var(--dim); border: 1px solid var(--border); font-size: 14px; }
.ud-tab.active { color: #fff; background: var(--panel-2); border-color: var(--accent); }
.ud-tab-panel { display: none; }
.ud-tab-panel.active { display: block; }

@media (max-width: 760px){ .features{grid-template-columns:1fr;} .stat-grid{grid-template-columns:repeat(2,1fr);} }

/* ============ 版本发布表单 ============ */
.rel-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); padding: 16px 18px; margin-top: 6px; max-width: 720px; }
.rel-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.rel-form .field { display: flex; flex-direction: column; gap: 6px; }
.rel-form .field label { font-size: 13px; color: var(--dim); }
.rel-form .rel-check { justify-content: flex-start; align-items: center; }
.rel-form .rel-check label { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
.rel-form textarea, .rel-form input[type=text], .rel-form input.mono {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); padding: 9px 11px; font-size: 14px; font-family: inherit; resize: vertical;
}
.rel-form textarea:focus, .rel-form input:focus { outline: none; border-color: var(--accent); }
.rel-form input[type=file] { font-size: 13px; color: var(--dim); }
.rel-form .row-between { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rel-bar { grid-column: 1 / -1; height: 8px; background: var(--panel-2); border-radius: 6px; overflow: hidden; border: 1px solid var(--border); }
.rel-bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .2s; }
@media (max-width: 760px){ .rel-form { grid-template-columns: 1fr; } }

/* ============ 控制台表格分页条 ============ */
.pager { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; color: var(--dim); }
.pager-info { color: var(--dim); }
.pager-size { display: flex; align-items: center; gap: 6px; }
.pager-size select { background: var(--panel-2); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 5px 8px; font-size: 13px; font-family: inherit; cursor: pointer; }
.pager .btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ============ 下载按钮「有新版本」红点 ============ */
.btn-dl { position: relative; }
.btn-dl .newdot {
  position: absolute; top: -4px; right: -4px;
  width: 11px; height: 11px; border-radius: 50%;
  background: #ff4d4f; border: 2px solid #fff;
  box-shadow: 0 0 0 0 rgba(255, 77, 79, .7);
  animation: newdot-pulse 1.6s infinite;
}
.btn-dl .newdot[hidden] { display: none; }
.btn-dl.has-new { animation: btn-new-breathe 1.6s ease-in-out infinite; }
@keyframes newdot-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 77, 79, .7); }
  70%  { box-shadow: 0 0 0 8px rgba(255, 77, 79, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 77, 79, 0); }
}
@keyframes btn-new-breathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 77, 79, 0); }
  50%      { box-shadow: 0 0 14px 2px rgba(255, 77, 79, .35); }
}

/* ============ 积分流水：年月日筛选栏（用户详情弹窗 + 控制台流水页共用） ============ */
.ud-filter { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; }
.ud-filter select {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 7px 10px; font-size: 13px; font-family: inherit; cursor: pointer;
}
.ud-filter select:focus { outline: none; border-color: var(--accent); }
.ud-filter .ud-filter-label { font-size: 13px; color: var(--dim); }
.ud-filter .ud-filter-info { font-size: 13px; color: var(--dim); }
.section-title-inline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-title-inline label { text-transform: none; letter-spacing: 0; }
.section-title-inline input[type=checkbox] { vertical-align: middle; margin-right: 4px; cursor: pointer; }
/* Key 很多时不再把弹窗撑长：限高 + 内部滚动 */
.ud-key-scroll { max-height: 232px; overflow-y: auto; padding-right: 4px; }
.ud-key-scroll::-webkit-scrollbar { width: 8px; }
.ud-key-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }

/* 用户详情弹窗：API Key / 积分流水 分页切换标签 */
.ud-tabs { display: flex; gap: 8px; margin: 16px 0 12px; border-bottom: 1px solid var(--border); }
.ud-tab {
  appearance: none; background: transparent; border: none; cursor: pointer;
  padding: 8px 4px 10px; font-size: 14px; color: var(--dim);
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s, border-color .15s;
}
.ud-tab:hover { color: var(--text); }
.ud-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.ud-tab-panel { display: none; }
.ud-tab-panel.active { display: block; }

/* 版本号变化时的高亮闪烁（云同步自动刷新用） */
.flash { animation: ver-flash 1.2s ease-out 1; border-radius: 4px; }
@keyframes ver-flash {
  0%   { background: rgba(78, 161, 255, .35); }
  100% { background: transparent; }
}

/* ============ 图形验证码（登录 / 注册） ============ */
.captcha-row { display: flex; align-items: center; gap: 10px; }
.captcha-row input { flex: 1; min-width: 0; }
.captcha-img {
  display: inline-flex; align-items: center; justify-content: center;
  width: 132px; height: 44px; flex: 0 0 132px; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--border); background: #11131a; cursor: pointer; user-select: none;
}
.captcha-img svg { display: block; width: 132px; height: 44px; }
.captcha-img:hover { border-color: var(--accent); }
