/* ==========================================================================
   页面级样式：看板 / 激活码 / 批次 / 项目 / 设备 / 接口文档 / 设置 / 登录
   ========================================================================== */

/* ============================ 数据看板 ============================ */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1240px) { .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .stat-grid { grid-template-columns: minmax(0, 1fr); } }

.stat {
  position: relative;
  padding: 17px 18px 15px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat::after {
  content: "";
  position: absolute; right: -30px; top: -40px;
  width: 130px; height: 130px; border-radius: 99px;
  background: var(--stat-glow, var(--brand-grad-soft));
  opacity: .9;
  pointer-events: none;
}
.stat-top { display: flex; align-items: center; gap: 10px; position: relative; }
.stat-ico {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--stat-ico-bg, var(--brand-soft));
  color: var(--stat-ico-fg, var(--brand-600));
}
.stat-ico svg { width: 19px; height: 19px; }
.stat-label { font-size: 12.5px; font-weight: 600; color: var(--text-3); }
.stat-val {
  position: relative;
  font-size: 28px; font-weight: 800;
  letter-spacing: -1.1px;
  margin-top: 11px;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.stat-val small { font-size: 14px; font-weight: 700; color: var(--text-3); margin-left: 3px; letter-spacing: 0; }
.stat-foot { position: relative; display: flex; align-items: center; gap: 7px; margin-top: 9px; }
.stat-trend {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11.5px; font-weight: 700;
  padding: 2px 6px; border-radius: 6px;
}
.stat-trend.up { color: var(--ok); background: var(--ok-soft); }
.stat-trend.down { color: var(--danger); background: var(--danger-soft); }
.stat-trend.flat { color: var(--text-3); background: var(--surface-3); }
.stat-trend svg { width: 12px; height: 12px; }
.stat-hint { font-size: 11.5px; color: var(--text-4); }
.stat-spark { position: absolute; right: 16px; bottom: 14px; opacity: .85; }

/* 图表容器 */
.chart-hd { display: flex; align-items: flex-start; gap: 14px; padding: 17px 18px 6px; }
.chart-bd { padding: 6px 10px 14px; }
.chart-legend { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); font-weight: 500; }
.legend-swatch { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }

.chart-svg { width: 100%; display: block; overflow: visible; }
.chart-grid line { stroke: var(--border-2); stroke-width: 1; }
.chart-axis text { font-size: 10.5px; fill: var(--text-4); font-family: var(--font); }
.chart-point { cursor: pointer; transition: r .12s var(--ease); }
.chart-point:hover { r: 6; }

/* 排行列表 */
.rank-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px;
  transition: background var(--dur) var(--ease);
}
.rank-row:hover { background: var(--surface-hover); }
.rank-no {
  width: 22px; height: 22px; border-radius: 7px;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 800;
  background: var(--surface-3); color: var(--text-3);
  flex-shrink: 0;
}
.rank-no.top1 { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #fff; }
.rank-no.top2 { background: linear-gradient(135deg, #cbd5e1, #94a3b8); color: #fff; }
.rank-no.top3 { background: linear-gradient(135deg, #fdba74, #fb923c); color: #fff; }

/* 活动流 */
.feed { padding: 6px 0; }
.feed-item {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 9px 18px;
  transition: background var(--dur) var(--ease);
}
.feed-item:hover { background: var(--surface-hover); }
.feed-ico {
  width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.feed-ico svg { width: 15px; height: 15px; }
.feed-text { font-size: 12.5px; line-height: 1.5; color: var(--text-2); }
.feed-text b { color: var(--text); font-weight: 600; }
.feed-time { font-size: 11px; color: var(--text-4); margin-top: 1px; }

/* 系统状态 */
.sys-row { display: flex; align-items: center; gap: 12px; padding: 11px 18px; }
.sys-row + .sys-row { border-top: 1px solid var(--border-2); }

/* 看板栅格 */
.dash-r1 { display: grid; grid-template-columns: minmax(0, 2.05fr) minmax(0, 1fr); gap: 18px; margin-top: 18px; }
.dash-r2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); gap: 18px; margin-top: 18px; }
.dash-r3 { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; margin-top: 18px; }
@media (max-width: 1240px) {
  .dash-r1, .dash-r2, .dash-r3 { grid-template-columns: minmax(0, 1fr); }
}

/* 登录页/看板通用滚动条美化 */
.scroll-y { overflow-y: auto; }

/* ============================ 卡密管理 ============================ */
.card-key-cell { display: flex; align-items: center; gap: 8px; }
.key-text {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: -.2px;
  color: var(--text);
  background: linear-gradient(180deg, transparent 62%, color-mix(in srgb, var(--brand) 16%, transparent) 0);
  padding: 0 1px;
  border-radius: 2px;
}
.key-text.masked { letter-spacing: 1.5px; color: var(--text-3); }

.prod-cell { display: flex; align-items: center; gap: 9px; min-width: 0; }
.prod-ico {
  width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 800;
  color: #fff; flex-shrink: 0;
}

/* 生成卡密预览 */
.gen-preview {
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface-3);
  border: 1px dashed var(--border-strong);
  max-height: 172px;
  overflow-y: auto;
}
.gen-preview code {
  display: block;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.95;
  color: var(--text-2);
  letter-spacing: .2px;
}
.gen-preview code span { color: var(--brand-600); font-weight: 600; }

/* 步骤条 */
.steps { display: flex; align-items: center; gap: 0; margin-bottom: 20px; }
.step { display: flex; align-items: center; gap: 8px; }
.step-no {
  width: 24px; height: 24px; border-radius: 99px;
  display: grid; place-items: center;
  font-size: 11.5px; font-weight: 700;
  background: var(--surface-3); color: var(--text-3);
  flex-shrink: 0;
  transition: all var(--dur) var(--ease);
}
.step.on .step-no { background: var(--brand); color: #fff; box-shadow: 0 0 0 4px var(--brand-soft); }
.step.done .step-no { background: var(--ok); color: #fff; }
.step-label { font-size: 12.5px; font-weight: 600; color: var(--text-3); }
.step.on .step-label { color: var(--text); }
.step-line { width: 34px; height: 1.5px; background: var(--border); margin: 0 10px; }

/* ============================ 批次 ============================ */
.batch-card { padding: 17px 18px; }
.batch-hd { display: flex; align-items: flex-start; gap: 12px; }
.batch-code {
  font-family: var(--font-mono);
  font-size: 12px; font-weight: 700;
  padding: 4px 9px; border-radius: 7px;
  background: var(--brand-soft); color: var(--brand-600);
  border: 1px solid color-mix(in srgb, var(--brand) 18%, transparent);
}
.batch-stat { display: flex; align-items: baseline; gap: 5px; }
.batch-stat .n { font-size: 21px; font-weight: 800; letter-spacing: -.7px; }
.batch-stat .u { font-size: 11.5px; color: var(--text-3); font-weight: 600; }

/* ============================ 项目卡 ============================ */
.pcard { padding: 18px; display: flex; flex-direction: column; gap: 13px; }
.pcard-hd { display: flex; align-items: flex-start; gap: 12px; }
.pcard-ico {
  width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center;
  font-size: 19px; font-weight: 800; color: #fff;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.pcard-name { font-size: 14.5px; font-weight: 700; letter-spacing: -.2px; }
.pcard-meta { font-size: 11.5px; color: var(--text-3); margin-top: 3px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.pcard-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pcard-metric { text-align: center; padding: 9px 4px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border-2); }
.pcard-metric .v { font-size: 15.5px; font-weight: 800; letter-spacing: -.4px; }
.pcard-metric .l { font-size: 10.5px; color: var(--text-3); margin-top: 1px; font-weight: 600; }
.pcard-ft { display: flex; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border-2); }

/* ============================ 设备页头图 ============================ */
.agent-hero {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: linear-gradient(120deg, #1b1f3b 0%, #2a2160 45%, #3b2a7a 100%);
  color: #fff;
  box-shadow: var(--shadow);
  position: relative;
}
.agent-hero::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(500px 240px at 88% 0%, rgba(6, 182, 212, .3), transparent 65%),
              radial-gradient(400px 220px at 0% 100%, rgba(168, 85, 247, .3), transparent 65%);
  pointer-events: none;
}
.agent-hero > div { padding: 20px 22px; position: relative; }
.agent-hero > div + div { border-left: 1px solid rgba(255, 255, 255, .1); }
.agent-hero .ah-label { font-size: 11.5px; color: rgba(255, 255, 255, .6); font-weight: 600; }
.agent-hero .ah-val { font-size: 25px; font-weight: 800; letter-spacing: -.9px; margin-top: 5px; }
.agent-hero .ah-sub { font-size: 11.5px; color: rgba(255, 255, 255, .5); margin-top: 3px; }
@media (max-width: 1000px) {
  .agent-hero { grid-template-columns: 1fr 1fr; }
  .agent-hero > div:nth-child(3) { border-left: 0; }
  .agent-hero > div:nth-child(n+3) { border-top: 1px solid rgba(255, 255, 255, .1); }
}

/* 等级徽章 */
.lv {
  display: inline-flex; align-items: center; gap: 4px;
  height: 21px; padding: 0 8px;
  border-radius: 6px;
  font-size: 11px; font-weight: 700;
}
.lv-1 { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #fff; }
.lv-2 { background: linear-gradient(135deg, #a78bfa, #8b5cf6); color: #fff; }
.lv-3 { background: linear-gradient(135deg, #60a5fa, #3b82f6); color: #fff; }
.lv-4 { background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); }

/* ============================ 接口文档 ============================ */
.docs { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 1000px) { .docs { grid-template-columns: minmax(0, 1fr); } .docs-nav { display: none; } }
.docs-nav {
  position: sticky; top: 0;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.docs-nav .dn-title { font-size: 10.5px; font-weight: 700; letter-spacing: 1.2px; color: var(--text-4); text-transform: uppercase; padding: 8px 9px 5px; }
.docs-nav a {
  display: flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 9px;
  border-radius: 8px;
  font-size: 12.5px; color: var(--text-2); font-weight: 500;
  transition: all var(--dur) var(--ease);
}
.docs-nav a:hover { background: var(--surface-3); color: var(--text); }
.docs-nav a.on { background: var(--brand-soft); color: var(--brand-600); font-weight: 600; }

.method {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 52px; height: 21px; padding: 0 8px;
  border-radius: 6px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .5px;
  font-family: var(--font-mono);
}
.m-get { background: var(--info-soft); color: var(--info); }
.m-post { background: var(--ok-soft); color: var(--ok); }
.m-put { background: var(--warn-soft); color: var(--warn); }
.m-del { background: var(--danger-soft); color: var(--danger); }

.endpoint {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 13px;
  word-break: break-all;
}
.doc-sec { scroll-margin-top: 20px; }

.api-key-box {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 15px;
  border-radius: var(--radius);
  background: linear-gradient(120deg, #141a30, #1c2444);
  border: 1px solid rgba(255, 255, 255, .08);
}
.api-key-box .k {
  font-family: var(--font-mono); font-size: 13px;
  color: #8ef0d0; letter-spacing: .4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 参数表 */
.param-table td { font-size: 12.5px; }
.param-table .p-name { font-family: var(--font-mono); color: var(--brand-600); font-weight: 600; }
.param-table .p-req { color: var(--danger); font-weight: 700; }

/* ============================ 设置页 ============================ */
.settings { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 900px) { .settings { grid-template-columns: minmax(0, 1fr); } .settings-nav { display: none; } }
.settings-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; }
.settings-nav button {
  display: flex; align-items: center; gap: 10px;
  height: 38px; padding: 0 12px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; color: var(--text-2);
  text-align: left;
  transition: all var(--dur) var(--ease);
}
.settings-nav button:hover { background: var(--surface-3); color: var(--text); }
.settings-nav button.on { background: var(--brand-soft); color: var(--brand-600); font-weight: 600; }
.settings-nav button svg { width: 16px; height: 16px; opacity: .85; }

.form-row {
  display: grid; grid-template-columns: 190px minmax(0, 1fr);
  gap: 18px;
  padding: 18px 0;
  align-items: start;
}
.form-row + .form-row { border-top: 1px solid var(--border-2); }
@media (max-width: 720px) { .form-row { grid-template-columns: minmax(0, 1fr); gap: 9px; } }
.form-row-label { font-size: 13px; font-weight: 600; }
.form-row-hint { font-size: 11.5px; color: var(--text-3); margin-top: 3px; line-height: 1.55; font-weight: 400; }
.form-row-body { max-width: 520px; }

/* ============================ 登录页 ============================ */
.login-page {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  height: 100vh;
  overflow: hidden;
}
@media (max-width: 900px) { .login-page { grid-template-columns: minmax(0, 1fr); } .login-visual { display: none; } }

.login-visual {
  position: relative;
  background: linear-gradient(150deg, #0b1020 0%, #171c3d 45%, #2d1b58 100%);
  overflow: hidden;
  display: flex; flex-direction: column;
  padding: 44px;
  color: #fff;
}
.login-visual::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(600px 300px at 80% 10%, rgba(99, 102, 241, .45), transparent 65%),
              radial-gradient(500px 320px at 10% 90%, rgba(6, 182, 212, .3), transparent 65%);
}
.login-visual > * { position: relative; }
.lv-grid {
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(70% 60% at 50% 40%, #000, transparent);
}
.login-headline { font-size: 34px; font-weight: 800; letter-spacing: -1px; line-height: 1.25; margin-top: auto; }
.login-headline em {
  font-style: normal;
  background: linear-gradient(90deg, #818cf8, #22d3ee);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.login-sub { font-size: 13.5px; color: rgba(255, 255, 255, .62); margin-top: 14px; line-height: 1.75; max-width: 420px; }
.login-feats { display: flex; flex-direction: column; gap: 12px; margin-top: 32px; }
.login-feat { display: flex; align-items: center; gap: 11px; font-size: 13px; color: rgba(255, 255, 255, .8); }
.login-feat .fi {
  width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .12);
  flex-shrink: 0;
}
.login-feat .fi svg { width: 15px; height: 15px; }
.login-stats { display: flex; gap: 32px; margin-top: 40px; padding-top: 22px; border-top: 1px solid rgba(255, 255, 255, .1); }
.login-stat .v { font-size: 22px; font-weight: 800; letter-spacing: -.6px; }
.login-stat .l { font-size: 11.5px; color: rgba(255, 255, 255, .5); margin-top: 2px; }

.login-form-wrap {
  display: flex; align-items: center; justify-content: center;
  padding: 32px;
  background: var(--surface);
}
.login-box { width: 100%; max-width: 372px; }
.login-title { font-size: 24px; font-weight: 800; letter-spacing: -.6px; }
.login-desc { font-size: 13px; color: var(--text-3); margin-top: 7px; }
.login-tabs { display: flex; gap: 4px; padding: 4px; border-radius: 11px; background: var(--surface-3); margin: 22px 0 20px; }
.login-tabs button {
  flex: 1; height: 34px; border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--text-3);
  transition: all var(--dur) var(--ease);
}
.login-tabs button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }
.login-oauth { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.login-foot { font-size: 12px; color: var(--text-3); text-align: center; margin-top: 24px; }
.captcha-row { display: grid; grid-template-columns: 1fr 108px; gap: 10px; }
.captcha-img {
  height: 38px; border-radius: var(--radius-sm);
  background: linear-gradient(115deg, #eef0ff, #e2f8fc);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-size: 17px; font-weight: 800; letter-spacing: 5px;
  color: var(--brand-600);
  cursor: pointer;
  user-select: none;
  font-style: italic;
  text-decoration: line-through wavy rgba(79, 70, 229, .3);
}
[data-theme="dark"] .captcha-img { background: linear-gradient(115deg, #1a2140, #14283a); }
