/* ==========================================================================
   鸽子网络验证 · 设计系统 v2
   石墨黑 + 琥珀金 / 双主题 / 克制动效
   ========================================================================== */

/* ---------- 1. 设计变量 ---------- */
:root {
  color-scheme: dark;

  --bg:         #08090c;
  --bg-soft:    #0b0d11;
  --panel:      #0e1015;
  --panel-2:    #12141a;
  --panel-3:    #171a21;

  --line:       #1c1f26;
  --line-2:     #272b34;
  --line-3:     #343944;

  --text:       #e9e6e0;
  --text-2:     #9d9a92;
  --text-3:     #6b6860;

  --gold:       #d6b071;
  --gold-2:     #efd39a;
  --gold-3:     #b8904e;
  --gold-soft:  rgba(214, 176, 113, .12);
  --gold-line:  rgba(214, 176, 113, .28);
  --gold-hi:    #f7dfae;
  --gold-glow:  rgba(214, 176, 113, .08);
  /* 强调色块上的文字色：深色主题取深墨，浅色主题取白 */
  --on-accent:  #1b1508;

  --ok:         #63c08f;
  --ok-soft:    rgba(99, 192, 143, .12);
  --err:        #e0695d;
  --err-soft:   rgba(224, 105, 93, .12);
  --warn:       #dda45a;
  --warn-soft:  rgba(221, 164, 90, .12);
  --info:       #7aa2e8;
  --info-soft:  rgba(122, 162, 232, .12);

  --r-xs: 6px;
  --r-sm: 9px;
  --r:    13px;
  --r-lg: 18px;
  --r-full: 999px;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .55);
  --shadow-2: 0 18px 44px -16px rgba(0, 0, 0, .9);
  --shadow-3: 0 32px 80px -24px rgba(0, 0, 0, .95);

  --font-sans: "Segoe UI Variable Text", "Segoe UI", "PingFang SC",
               "HarmonyOS Sans SC", "Microsoft YaHei UI", system-ui, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", "PingFang SC",
                  "Microsoft YaHei UI", system-ui, sans-serif;
  --font-mono: "Cascadia Code", "JetBrains Mono", "SFMono-Regular", Consolas,
               "Liberation Mono", monospace;

  --sidebar-w: 250px;
  --ease: cubic-bezier(.22, .68, .26, 1);

  /* 旧变量别名：视图内联样式里仍在引用 */
  --border: var(--line-2);
  --border-strong: var(--line-3);
  --primary: var(--gold);
  --muted: var(--text-2);
  --panel-solid: var(--panel);
}

[data-theme="light"] {
  color-scheme: light;

  --bg:         #f6f5f2;
  --bg-soft:    #efece7;
  --panel:      #ffffff;
  --panel-2:    #fbfaf8;
  --panel-3:    #f3f1ed;

  --line:       #e4e0d9;
  --line-2:     #d7d2c9;
  --line-3:     #c3bdb2;

  --text:       #191a1d;
  --text-2:     #5f5c56;
  --text-3:     #8b877f;

  --gold:       #9a7428;
  --gold-2:     #7a5a1c;
  --gold-3:     #b8904e;
  --gold-soft:  rgba(154, 116, 40, .10);
  --gold-line:  rgba(154, 116, 40, .26);
  --gold-hi:    #b8904e;
  --gold-glow:  rgba(154, 116, 40, .07);
  --on-accent:  #fff;

  --ok:         #2f8f5f;
  --ok-soft:    rgba(47, 143, 95, .10);
  --err:        #c2453a;
  --err-soft:   rgba(194, 69, 58, .10);
  --warn:       #a3701c;
  --warn-soft:  rgba(163, 112, 28, .10);
  --info:       #3a6bbd;
  --info-soft:  rgba(58, 107, 189, .10);

  --shadow-1: 0 1px 2px rgba(24, 22, 18, .07);
  --shadow-2: 0 16px 40px -18px rgba(24, 22, 18, .28);
  --shadow-3: 0 30px 70px -26px rgba(24, 22, 18, .34);
}

/* ---------- 2. 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(920px 620px at 10% -12%, var(--gold-glow), transparent 72%),
    radial-gradient(760px 520px at 102% -6%, rgba(122, 162, 232, .055), transparent 70%);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

[data-theme="light"] body {
  background-image:
    radial-gradient(920px 620px at 10% -12%, var(--gold-glow), transparent 72%),
    radial-gradient(760px 520px at 102% -6%, rgba(58, 107, 189, .05), transparent 70%);
}

a { color: var(--gold); text-decoration: none; transition: color .16s var(--ease); }
a:hover { color: var(--gold-2); }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 640; letter-spacing: -.018em; margin: 0; line-height: 1.25; }
p { margin: 0; }

img { max-width: 100%; }

::selection { background: var(--gold-soft); color: var(--gold-2); }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: var(--r-full); border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--line-3); }

/* ---------- 3. 布局骨架 ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px 14px 16px;
  background: linear-gradient(180deg, var(--bg-soft), var(--bg) 60%);
  border-right: 1px solid var(--line);
  z-index: 20;
}

.brand { padding: 2px 8px 20px; }

.brand .bn {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 15.5px;
  font-weight: 640;
  letter-spacing: -.02em;
  color: var(--text);
}

.brand .blogo {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 10px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #000;
  border: 1px solid var(--line-2);
}

.brand .blogo img { width: 100%; height: 100%; object-fit: contain; display: block; }

.brand small {
  display: block;
  margin: 7px 0 0 44px;
  font-size: 10.5px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--text-3);
}

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }

.group-title {
  margin: 16px 0 6px;
  padding: 0 10px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-3);
}

.nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  transition: background .15s var(--ease), color .15s var(--ease);
}

.nav a .ic {
  display: grid;
  place-items: center;
  width: 18px;
  font-size: 13px;
  opacity: .72;
  transition: opacity .15s var(--ease);
}

.nav a .ic svg { width: 15px; height: 15px; display: block; }

.nav a:hover { background: rgba(255, 255, 255, .035); color: var(--text); }
[data-theme="light"] .nav a:hover { background: rgba(0, 0, 0, .035); }
.nav a:hover .ic { opacity: 1; }

.nav a.active {
  color: var(--gold-2);
  background: linear-gradient(90deg, var(--gold-soft), transparent 85%);
}

.nav a.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 2px;
  height: 17px;
  border-radius: var(--r-full);
  background: var(--gold);
  transform: translateY(-50%);
}

.nav a.active .ic { opacity: 1; }

.sidebar-foot {
  margin-top: 12px;
  padding: 12px 10px 4px;
  border-top: 1px solid var(--line);
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 32px;
  background: rgba(8, 9, 12, .82);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}

[data-theme="light"] .topbar { background: rgba(246, 245, 242, .82); }

.page-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 640;
  letter-spacing: -.02em;
}

.spacer { flex: 1; }

.user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
}

.content {
  flex: 1;
  padding: 28px 32px 56px;
  max-width: 1240px;
  width: 100%;
  animation: rise .45s var(--ease) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.content > * { animation: rise .5s var(--ease) both; }
.content > *:nth-child(1) { animation-delay: .02s; }
.content > *:nth-child(2) { animation-delay: .06s; }
.content > *:nth-child(3) { animation-delay: .10s; }
.content > *:nth-child(4) { animation-delay: .14s; }
.content > *:nth-child(5) { animation-delay: .18s; }
.content > *:nth-child(n+6) { animation-delay: .22s; }

/* ---------- 4. 头像 / 主题按钮 ---------- */
.avatar {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: var(--r-full);
  background: linear-gradient(150deg, var(--panel-3), var(--panel));
  border: 1px solid var(--line-2);
  font-size: 12.5px;
  font-weight: 650;
  color: var(--gold-2);
  text-transform: uppercase;
}

.theme-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-2);
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}

.theme-btn:hover { color: var(--text); border-color: var(--line-3); background: var(--panel-2); }

.theme-btn svg { display: block; }

/* ---------- 5. 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 550;
  line-height: 1.2;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s var(--ease), border-color .15s var(--ease),
              color .15s var(--ease), transform .12s var(--ease), box-shadow .15s var(--ease);
}

.btn:hover { background: var(--panel-3); border-color: var(--line-3); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }

/* 表单控件禁用态（如缺少数据库列时的额度口径下拉） */
.input:disabled,
.form-row input:disabled,
.form-row select:disabled,
select:disabled {
  opacity: .55;
  cursor: not-allowed;
  background: var(--bg-soft);
}

.btn-primary {
  color: var(--on-accent);
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  border-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), var(--shadow-1);
  font-weight: 620;
}

.btn-primary:hover {
  color: var(--on-accent);
  background: linear-gradient(180deg, var(--gold-hi), var(--gold));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 4px 16px -4px var(--gold-line);
}

.btn-danger {
  color: var(--err);
  background: var(--err-soft);
  border-color: rgba(224, 105, 93, .3);
}

/* 浅色主题下金色加深为棕金，文字必须改用白色，否则棕底黑字不可读 */
[data-theme="light"] .btn-primary {
  color: var(--on-accent);
  background: linear-gradient(180deg, var(--gold), var(--gold-2));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), var(--shadow-1);
}

[data-theme="light"] .btn-primary:hover {
  color: var(--on-accent);
  background: linear-gradient(180deg, var(--gold-3), var(--gold));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .26), 0 4px 16px -6px rgba(24, 22, 18, .5);
}

.btn-danger:hover { color: #fff; background: var(--err); border-color: var(--err); }

.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: var(--r-xs); }
.btn-block { width: 100%; }

.ghost { background: transparent; }

/* ---------- 6. 表单 ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.form-row { display: flex; flex-direction: column; gap: 7px; }

.form-row > label, .label {
  font-size: 12.5px;
  font-weight: 560;
  color: var(--text-2);
}

.input,
.form-row input:not([type=checkbox]):not([type=radio]),
.form-row select,
.form-row textarea {
  width: 100%;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease);
}

.input::placeholder,
.form-row input::placeholder,
.form-row textarea::placeholder { color: var(--text-3); }

.input:hover,
.form-row input:hover,
.form-row select:hover,
.form-row textarea:hover { border-color: var(--line-3); }

.input:focus,
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  outline: none;
  background: var(--panel);
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}

select.input, .form-row select {
  appearance: none;
  padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%),
                    linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 17px) 51%, calc(100% - 12px) 51%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

textarea.input, .form-row textarea { min-height: 92px; resize: vertical; line-height: 1.6; }

input[type=checkbox], input[type=radio] {
  accent-color: var(--gold);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* ---------- 7. 卡片 ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-1);
}

.card + .card { margin-top: 18px; }

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}

.card-head h3, .card-head .card-title {
  font-size: 14.5px;
  font-weight: 620;
  letter-spacing: -.01em;
}

.card-body { padding: 18px; }

/* ---------- 8. 统计 ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat {
  position: relative;
  padding: 16px 18px;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-1);
  transition: border-color .18s var(--ease), transform .18s var(--ease);
}

.stat::after {
  content: "";
  position: absolute;
  inset: 0 0 auto auto;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle at 100% 0, var(--gold-soft), transparent 70%);
  pointer-events: none;
}

.stat:hover { border-color: var(--line-2); transform: translateY(-1px); }

.stat .label {
  display: block;
  font-size: 11.5px;
  font-weight: 560;
  letter-spacing: .04em;
  color: var(--text-3);
  text-transform: uppercase;
}

.stat .value {
  display: block;
  margin-top: 6px;
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 620;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* ---------- 9. 表格 ---------- */
.table-wrap {
  overflow-x: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-1);
}

.table-wrap table, table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.table-wrap thead th, table.table thead th {
  padding: 10px 12px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-3);
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.table-wrap tbody td, table.table tbody td {
  padding: 10px 12px;
  color: var(--text-2);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  /* 禁止单元格换行：否则长卡密/时间戳会把整列撑成多行，列宽全部塌陷 */
  white-space: nowrap;
}

/* 需要正常换行的长文本列（备注、消息、应用名）显式标记 */
.table-wrap td.cell-wrap, table.table td.cell-wrap {
  white-space: normal;
  min-width: 200px;
  max-width: 340px;
  line-height: 1.55;
}

/* 表格内的长串不按字符断行，交给容器横向滚动 */
.table-wrap td .code-chip, table.table td .code-chip,
.table-wrap td .mono, table.table td .mono { word-break: keep-all; }

/* 操作列贴着右侧，按钮组不参与压缩 */
.table-wrap td.cell-actions, table.table td.cell-actions { white-space: nowrap; text-align: right; }
.table-wrap td.cell-actions form + form, table.table td.cell-actions form + form { margin-left: 6px; }

.table-wrap tbody tr:last-child td, table.table tbody tr:last-child td { border-bottom: 0; }

.table-wrap tbody tr { transition: background .13s var(--ease); }
.table-wrap tbody tr:hover { background: rgba(255, 255, 255, .022); }
[data-theme="light"] .table-wrap tbody tr:hover { background: rgba(0, 0, 0, .02); }

.table-wrap tbody td strong, .table-wrap tbody td b { color: var(--text); font-weight: 580; }

.table-wrap td .btn { padding: 5px 9px; font-size: 12px; }

.table-wrap td form { display: inline; }

/* 列多时表格横向滚动，操作列固定在右侧始终可见 */
.table-wrap thead th:last-child,
.table-wrap tbody td:last-child {
  position: sticky;
  right: 0;
  z-index: 1;
  background: var(--panel);
  box-shadow: -12px 0 14px -12px rgba(0, 0, 0, .65);
}

.table-wrap thead th:last-child {
  z-index: 2;
  background: var(--panel-2);
}

.table-wrap tbody tr:hover td:last-child { background: var(--panel-2); }

[data-theme="light"] .table-wrap thead th:last-child { background: var(--panel-3); }
[data-theme="light"] .table-wrap thead th:last-child,
[data-theme="light"] .table-wrap tbody td:last-child { box-shadow: -12px 0 14px -12px rgba(24, 22, 18, .22); }
[data-theme="light"] .table-wrap tbody tr:hover td:last-child { background: var(--bg-soft); }

@media (max-width: 560px) {
  .table-wrap thead th:last-child,
  .table-wrap tbody td:last-child { position: static; box-shadow: none; }
}

/* ---------- 10. 徽章 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  font-size: 11.5px;
  font-weight: 560;
  line-height: 1.5;
  border-radius: var(--r-full);
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: .9;
}

.badge-green, .badge-ok   { color: var(--ok);   background: var(--ok-soft);   border-color: rgba(99, 192, 143, .24); }
.badge-red, .badge-err    { color: var(--err);  background: var(--err-soft);  border-color: rgba(224, 105, 93, .24); }
.badge-orange, .badge-warn{ color: var(--warn); background: var(--warn-soft); border-color: rgba(221, 164, 90, .24); }
.badge-blue, .badge-info  { color: var(--info); background: var(--info-soft); border-color: rgba(122, 162, 232, .24); }
.badge-gray, .badge-secondary { color: var(--text-3); background: var(--panel-2); border-color: var(--line-2); }

.badge-inline { padding: 1px 7px; font-size: 11px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px 5px 10px;
  font-size: 12px;
  font-weight: 540;
  color: var(--text-2);
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-full);
}

.dot, .dotp {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-soft);
}

.dotp { animation: pulse 2.4s var(--ease) infinite; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--ok-soft); }
  50%      { box-shadow: 0 0 0 6px transparent; }
}

/* ---------- 11. 提示条 ---------- */
.alert {
  padding: 11px 14px;
  margin-bottom: 16px;
  font-size: 13.5px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--text-2);
  animation: rise .35s var(--ease) both;
}

.alert-error   { color: var(--err);  background: var(--err-soft);  border-color: rgba(224, 105, 93, .28); }
.alert-success { color: var(--ok);   background: var(--ok-soft);   border-color: rgba(99, 192, 143, .28); }
.alert-info    { color: var(--info); background: var(--info-soft); border-color: rgba(122, 162, 232, .26); }

/* ---------- 12. 模态 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 5, 8, .72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-mask.open { display: flex; animation: fadeIn .18s var(--ease); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  animation: pop .22s var(--ease);
}

@keyframes pop {
  from { opacity: 0; transform: translateY(12px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

.modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  font-size: 15px;
  font-weight: 620;
  letter-spacing: -.01em;
  border-bottom: 1px solid var(--line);
}

.modal-body { padding: 20px; overflow-y: auto; }

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

/* ---------- 13. Toast ---------- */
#toast-box {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 16px;
  font-size: 13.5px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-2);
  animation: toastIn .28s var(--ease);
  pointer-events: auto;
}

.toast .ti {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  font-size: 11px;
  border-radius: 50%;
  color: var(--ok);
  background: var(--ok-soft);
}

.toast.err .ti { color: var(--err); background: var(--err-soft); }

.toast.hide { animation: toastOut .24s var(--ease) forwards; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(24px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateX(24px) scale(.97); }
}

/* ---------- 14. 工具类 ---------- */
.flex { display: flex; align-items: center; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
/* 网格内的卡片不需要相邻间距，否则会破坏等高对齐 */
.grid-2 > .card + .card, .grid-3 > .card + .card { margin-top: 0; }
.text-muted { color: var(--text-2); }
.mono { font-family: var(--font-mono); font-size: .94em; }
.mb-0 { margin-bottom: 0 !important; }
.hidden { display: none !important; }
.inline { display: inline; }

.empty {
  padding: 44px 20px;
  text-align: center;
  font-size: 13.5px;
  color: var(--text-3);
}

.code, .code-chip {
  display: inline-block;
  padding: 2px 7px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text);
  background: var(--panel-3);
  border: 1px solid var(--line-2);
  border-radius: var(--r-xs);
  word-break: break-all;
}

.code-chip { cursor: pointer; transition: border-color .15s var(--ease), color .15s var(--ease); }
.code-chip:hover { border-color: var(--gold-line); color: var(--gold-2); }

.pager {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  font-size: 13px;
  color: var(--text-2);
}

.pager a, .pager span {
  padding: 6px 11px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line-2);
  background: var(--panel);
  color: var(--text-2);
}

.pager a:hover { border-color: var(--gold-line); color: var(--gold-2); }
.pager .cur, .pager span.cur { color: var(--gold-2); border-color: var(--gold-line); background: var(--gold-soft); }

/* ---------- 15. 站点外壳 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 9, 12, .8);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
}

[data-theme="light"] .site-header { background: rgba(246, 245, 242, .82); }

.site-header .inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 26px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 15.5px;
  font-weight: 640;
  letter-spacing: -.02em;
  color: var(--text);
}

.logo .dot {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #000;
  border: 1px solid var(--line-2);
  box-shadow: none;
  animation: none;
}

.logo .dot img { width: 100%; height: 100%; object-fit: contain; display: block; }

.site-header nav { display: flex; gap: 22px; flex: 1; }

.site-header nav a {
  font-size: 13.5px;
  font-weight: 520;
  color: var(--text-2);
  transition: color .15s var(--ease);
}

.site-header nav a:hover { color: var(--text); }

.site-header .actions { display: flex; align-items: center; gap: 10px; }

.site-footer {
  margin-top: 52px;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
}

.site-footer .inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 28px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text-3);
}

/* ---------- 16. 首页 ---------- */
.hero2 {
  max-width: 1180px;
  margin: 0 auto;
  padding: 68px 28px 44px;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 56px;
  align-items: center;
}

.hero2 h1 {
  margin: 18px 0 0;
  font-size: clamp(36px, 4.6vw, 58px);
  font-weight: 660;
  letter-spacing: -.035em;
  line-height: 1.08;
}

.grad {
  background: linear-gradient(100deg, var(--gold-2), var(--gold) 45%, var(--gold-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lead {
  margin-top: 20px;
  max-width: 30em;
  font-size: 15px;
  line-height: 1.75;
  color: var(--text-2);
}

.cta { display: flex; gap: 12px; margin-top: 30px; flex-wrap: wrap; }

.codewin {
  overflow: hidden;
  background: #07080b;
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
}

.codewin .bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 11px 14px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}

.codewin .bar i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--line-3);
}

.codewin .bar i:first-child { background: #d9604f; }
.codewin .bar i:nth-child(2) { background: #d8a545; }
.codewin .bar i:nth-child(3) { background: #57ad74; }

.codewin .bar span {
  margin-left: 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-3);
}

.codewin pre {
  margin: 0;
  padding: 20px 22px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12.8px;
  line-height: 1.85;
  color: #cfd6e4;
}

.codewin .c { color: #6b7688; font-style: italic; }
.codewin .k { color: var(--gold-2); }
.codewin .s { color: #8fce9b; }
.codewin .f { color: #86a9e8; }
.codewin .n { color: #d59279; }

.section {
  max-width: 1180px;
  margin: 0 auto;
  padding: 52px 28px;
}

.section-head { margin-bottom: 34px; max-width: 42em; }

.section-head h2 {
  font-size: clamp(24px, 2.6vw, 32px);
  font-weight: 640;
  letter-spacing: -.028em;
}

.section-head p {
  margin-top: 10px;
  font-size: 14.5px;
  color: var(--text-2);
}

.cards3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 16px;
}

.fcard {
  position: relative;
  padding: 24px 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  transition: border-color .2s var(--ease), transform .2s var(--ease), background .2s var(--ease);
}

.fcard::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(150deg, var(--gold-line), transparent 45%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity .22s var(--ease);
  pointer-events: none;
}

.fcard:hover { transform: translateY(-2px); background: var(--panel-2); }
.fcard:hover::before { opacity: 1; }

.fcard .ic {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 14px;
  border-radius: 11px;
  background: var(--gold-soft);
  border: 1px solid var(--gold-line);
  color: var(--gold);
}

.fcard .ic svg { width: 20px; height: 20px; display: block; }

.fcard h3 { font-size: 15px; font-weight: 620; }

.fcard p {
  margin-top: 8px;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text-2);
}

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  counter-reset: step;
}

.step {
  position: relative;
  padding: 22px 20px 22px 54px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  counter-increment: step;
}

.step::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 18px;
  top: 22px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--gold);
  padding: 3px 7px;
  border-radius: var(--r-xs);
  background: var(--gold-soft);
  border: 1px solid var(--gold-line);
}

.step h4 { font-size: 14.5px; font-weight: 620; }

.step p { margin-top: 7px; font-size: 13.5px; color: var(--text-2); }

.cta-band {
  max-width: 1180px;
  margin: 20px auto 0;
  padding: 0 28px;
}

.cta-band .inner {
  position: relative;
  overflow: hidden;
  padding: 46px 40px;
  text-align: center;
  border: 1px solid var(--gold-line);
  border-radius: var(--r-lg);
  background:
    radial-gradient(600px 260px at 50% 0, var(--gold-soft), transparent 70%),
    var(--panel);
}

.cta-band h2 { font-size: clamp(21px, 2.4vw, 28px); font-weight: 640; letter-spacing: -.025em; }

.cta-band p { margin: 10px 0 24px; font-size: 14px; color: var(--text-2); }

/* ---------- 17. 登录 / 注册 ---------- */
.auth-wrap {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 20px;
  background:
    radial-gradient(720px 520px at 50% 6%, var(--gold-soft), transparent 68%),
    radial-gradient(560px 420px at 82% 92%, rgba(122, 162, 232, .06), transparent 70%);
}

[data-theme="light"] .auth-wrap {
  background:
    radial-gradient(720px 520px at 50% 6%, var(--gold-soft), transparent 68%);
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 392px;
  padding: 34px 32px 28px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3), inset 0 1px 0 rgba(255, 255, 255, .045);
  animation: rise .5s var(--ease) both;
}

[data-theme="light"] .auth-card { box-shadow: var(--shadow-3), inset 0 1px 0 rgba(255, 255, 255, .8); }

.auth-card .logo { flex-direction: column; gap: 14px; text-align: center; margin-bottom: 26px; }

.auth-card .logo .mk {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 16px;
  background: #000;
  border: 1px solid var(--line-2);
  box-shadow: 0 8px 24px -12px rgba(0, 0, 0, .9);
}

.auth-card .logo .mk img { width: 100%; height: 100%; object-fit: contain; display: block; }

.auth-card .logo h1 { font-size: 19px; font-weight: 640; letter-spacing: -.02em; }

.auth-card .logo p { margin-top: 5px; font-size: 13px; color: var(--text-3); }

.auth-card form { display: flex; flex-direction: column; gap: 15px; }

.auth-card .btn-block { margin-top: 6px; padding: 11px 16px; font-size: 14px; }

/* 仅限登录/注册卡片右上角的验证码刷新按钮。
   之前在 .code-chip 内部也复用了 .cp（复制图标），
   全局绝对定位会让图标飞到页面右上角，因此收紧作用域。 */
.auth-card .cp {
  position: absolute;
  top: 20px;
  right: 20px;
}

/* 卡密/密钥后面的复制小图标 */
.code-chip .cp {
  display: inline-flex;
  align-items: center;
  vertical-align: -1px;
  margin-left: 4px;
  opacity: .5;
  transition: opacity .15s var(--ease);
}

.code-chip .cp svg { display: block; }

.code-chip:hover .cp { opacity: 1; }

/* ---------- 18. 文档页 ---------- */
.doc-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 48px 28px 80px;
}

.doc-anchor { scroll-margin-top: 90px; padding-top: 12px; }

.doc-wrap h2 {
  margin: 40px 0 14px;
  font-size: 21px;
  font-weight: 640;
  letter-spacing: -.022em;
  scroll-margin-top: 96px;
}

.doc-wrap h3 { margin: 26px 0 10px; font-size: 15.5px; font-weight: 620; }

.doc-wrap p { margin: 10px 0; font-size: 14px; color: var(--text-2); line-height: 1.8; }

.doc-wrap table {
  width: 100%;
  margin: 14px 0;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
}

.doc-wrap thead th {
  text-align: left;
  padding: 9px 12px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--text-3);
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.doc-wrap tbody td {
  padding: 9px 12px;
  color: var(--text-2);
  line-height: 1.65;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

.doc-wrap tbody tr:last-child td { border-bottom: 0; }

.doc-wrap tbody td:first-child:not([colspan]) {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12.5px;
  white-space: nowrap;
}

.doc-wrap ul { margin: 10px 0; padding-left: 20px; color: var(--text-2); font-size: 14px; }
.doc-wrap li { margin: 5px 0; }

.doc-wrap .cp code { font-size: 13px; }

.method-get, .method-post {
  display: inline-block;
  padding: 2px 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  border-radius: var(--r-xs);
  letter-spacing: .04em;
}

.method-get  { color: var(--info); background: var(--info-soft); border: 1px solid rgba(122, 162, 232, .26); }
.method-post { color: var(--ok);   background: var(--ok-soft);   border: 1px solid rgba(99, 192, 143, .26); }

/* 移动端抽屉：桌面端这两个按钮完全不出现 */
.menu-btn,
.drawer-close {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text-2);
  cursor: pointer;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.menu-btn svg,
.drawer-close svg { width: 18px; height: 18px; display: block; }
.menu-btn:active,
.drawer-close:active { background: var(--panel-3); color: var(--text); }
.drawer-close {
  position: absolute;
  top: 0;
  right: 0;
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

.drawer-mask {
  position: fixed;
  inset: 0;
  z-index: 205;
  background: rgba(4, 5, 8, .62);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity .24s var(--ease);
}
.drawer-mask[hidden] { display: none; }
body.drawer-open .drawer-mask { opacity: 1; }
body.drawer-open { overflow: hidden; }

/* ---------- 19. 响应式 ---------- */
@media (max-width: 1080px) {
  .hero2 { grid-template-columns: 1fr; gap: 40px; padding-top: 60px; }
  .codewin { order: 2; }
}

@media (max-width: 980px) {
  .layout { display: block; }

  /* 侧栏改成从左侧滑出的抽屉，导航竖排、保留分组标题 */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(268px, 82vw);
    height: 100%;
    flex: none;
    padding: 16px 12px 12px;
    border-right: 1px solid var(--line-2);
    border-bottom: 0;
    background: var(--bg-soft);
    transform: translateX(-100%);
    transition: transform .26s var(--ease);
    z-index: 210;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
  }

  body.drawer-open .sidebar {
    transform: translateX(0);
    box-shadow: 28px 0 56px -28px rgba(0, 0, 0, .85);
  }

  .brand { position: relative; padding: 0 0 14px; }
  .brand small { display: block; }
  .drawer-close { display: inline-flex; }

  .nav {
    flex-direction: column;
    gap: 2px;
    overflow: visible;
    padding-bottom: 0;
  }

  .nav .group-title { display: block; }

  .nav a { padding: 10px 11px; font-size: 13.5px; }

  .nav a.active::before { display: block; }

  .sidebar-foot { display: block; margin-top: auto; padding-top: 14px; }

  .topbar { padding: 10px 14px; gap: 8px; }
  .menu-btn { display: inline-flex; }
  .content { padding: 16px 14px 44px; }

  .grid-2, .grid-3 { grid-template-columns: 1fr; }

  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .site-header .inner { padding: 12px 18px; gap: 14px; }
  .site-header nav { display: none; }

  .hero2 { padding: 48px 20px 40px; }
  .section { padding: 44px 20px; }
  .cta-band { padding: 0 20px; }
  .cta-band .inner { padding: 34px 22px; }

  .table-wrap { border-radius: var(--r-sm); }
  .table-wrap thead th, .table-wrap tbody td { padding: 10px 11px; }
}

@media (max-width: 560px) {
  /* 统计卡在手机上保持两列，否则七张卡要滚三屏 */
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  /* 奇数张时最后一张占满整行，不留半格空洞 */
  .stats > .stat:last-child:nth-child(odd) { grid-column: span 2; }
  .stat { padding: 13px 13px 12px; }
  .stat .value { font-size: 22px; }
  .stat .label { font-size: 12px; }

  .content { padding: 14px 12px 40px; }
  .auth-card { padding: 26px 20px 22px; }
  .topbar .user span.uname { display: none; }
  #toast-box { left: 14px; right: 14px; bottom: 14px; }
  .toast { justify-content: center; }

  /* 顶栏收紧，按钮保持拇指够得着的尺寸 */
  .topbar { padding: 9px 12px; gap: 6px; }
  .page-title { font-size: 15px; }
  .topbar .theme-btn { width: 34px; height: 34px; }

  /* 卡片头：标题和按钮挤不下时自动折行 */
  .card-head { flex-wrap: wrap; gap: 8px; }
  .card-head h3 { font-size: 15px; }

  /* 筛选表单一行一个，内联的 min-width 一律放开 */
  .card-body .form-row { min-width: 100% !important; }

  /* 筛选区那个孤零零的提交按钮，撑满整行反而更好点 */
  form.card-body > .btn:only-of-type { width: 100%; justify-content: center; }

  /* 表格：缩紧间距，横向滚动照旧 */
  .table-wrap { position: relative; }
  /* 列多的表在手机上一定会横滚，给一句提示，别让人以为内容丢了 */
  .table-wrap::before {
    content: '左右滑动查看全部列 →';
    position: sticky;
    left: 0;
    z-index: 3;
    display: block;
    width: max-content;
    padding: 5px 0 7px 10px;
    font-size: 11px;
    color: var(--text-3);
    background: var(--panel);
  }
  .table-wrap thead th { padding: 8px 9px; font-size: 11px; }
  .table-wrap tbody td { padding: 9px; font-size: 13px; }
  .table-wrap td.cell-code { min-width: 148px; }
  .table-wrap td.cell-cardno { min-width: 112px; }

  /* 批量栏：竖排，按钮撑满整行 */
  .batch-bar { flex-direction: column; align-items: stretch; gap: 10px; }
  .batch-actions { margin-left: 0; width: 100%; }
  .batch-actions .btn { flex: 1 1 auto; justify-content: center; }
  .batch-actions .input { width: 100% !important; }

  /* 弹窗改成从底部升起的面板，键盘弹出也不会顶掉内容 */
  .modal-mask { padding: 0; align-items: flex-end; }
  .modal {
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
  }
  .modal-body { max-height: 66vh; overflow-y: auto; }
  .modal-foot { padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }

  /* 触摸目标不小于 42px */
  .input,
  .form-row input:not([type=checkbox]):not([type=radio]),
  .form-row select { min-height: 42px; }
  .btn-sm { padding: 7px 11px; }

  /* 代理行的额度控件在窄屏独占一行 */
  .agent-ops { justify-content: flex-start; }
  .agents-quota { flex-wrap: wrap; }
  .agents-quota .input { width: 100% !important; }

  /* 额度胶囊铺满 */
  .quota-strip { gap: 8px; }
  .quota-chip { flex: 1 1 100%; justify-content: space-between; }

  /* 分页器更紧凑 */
  .pager { gap: 4px; }
  .pager a, .pager span { min-width: 32px; height: 32px; line-height: 30px; font-size: 12.5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* ---------- 20. 强调色方案 ---------- */
/* 深色主题：高饱和亮色；:not([data-theme="light"]) 防止污染浅色主题 */
html:not([data-theme="light"])[data-accent="ice"] {
  --gold: #6cc3d6; --gold-2: #a6e2ee; --gold-3: #3f8899; --gold-hi: #bdeef8;
  --gold-soft: rgba(108, 195, 214, .12); --gold-line: rgba(108, 195, 214, .28);
  --gold-glow: rgba(108, 195, 214, .075);
}

html:not([data-theme="light"])[data-accent="violet"] {
  --gold: #a99bf5; --gold-2: #c9c0ff; --gold-3: #6e5cc0; --gold-hi: #d8d2ff;
  --gold-soft: rgba(169, 155, 245, .12); --gold-line: rgba(169, 155, 245, .28);
  --gold-glow: rgba(169, 155, 245, .075);
}

html:not([data-theme="light"])[data-accent="emerald"] {
  --gold: #63c99a; --gold-2: #9ce3bf; --gold-3: #3d9670; --gold-hi: #b6efd3;
  --gold-soft: rgba(99, 201, 154, .12); --gold-line: rgba(99, 201, 154, .28);
  --gold-glow: rgba(99, 201, 154, .075);
}

html:not([data-theme="light"])[data-accent="crimson"] {
  --gold: #e07c70; --gold-2: #f0a79e; --gold-3: #b2544a; --gold-hi: #f7bdb6;
  --gold-soft: rgba(224, 124, 112, .12); --gold-line: rgba(224, 124, 112, .28);
  --gold-glow: rgba(224, 124, 112, .075);
}

/* 浅色主题：同色相压深，保证白底上的可读性 */
html[data-theme="light"][data-accent="ice"] {
  --gold: #1d6d80; --gold-2: #14505f; --gold-3: #3f8899; --gold-hi: #0f3f4b;
  --gold-soft: rgba(29, 109, 128, .10); --gold-line: rgba(29, 109, 128, .26);
  --gold-glow: rgba(29, 109, 128, .07);
}

html[data-theme="light"][data-accent="violet"] {
  --gold: #5b48b5; --gold-2: #443290; --gold-3: #8a78d8; --gold-hi: #332269;
  --gold-soft: rgba(91, 72, 181, .10); --gold-line: rgba(91, 72, 181, .26);
  --gold-glow: rgba(91, 72, 181, .07);
}

html[data-theme="light"][data-accent="emerald"] {
  --gold: #1f7a55; --gold-2: #155c3f; --gold-3: #4aa87c; --gold-hi: #0f4530;
  --gold-soft: rgba(31, 122, 85, .10); --gold-line: rgba(31, 122, 85, .26);
  --gold-glow: rgba(31, 122, 85, .07);
}

html[data-theme="light"][data-accent="crimson"] {
  --gold: #a8362e; --gold-2: #8a2620; --gold-3: #c4695f; --gold-hi: #6e1c17;
  --gold-soft: rgba(168, 54, 46, .10); --gold-line: rgba(168, 54, 46, .26);
  --gold-glow: rgba(168, 54, 46, .07);
}

/* ---------- 21. 配色面板 ---------- */
.accent-wrap { position: relative; display: inline-flex; }

.accent-pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 70;
  display: none;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  box-shadow: var(--shadow-2);
}

.accent-pop.open { display: flex; animation: pop .18s var(--ease); }

.accent-pop button {
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  background: var(--sw);
  border: 1px solid rgba(255, 255, 255, .18);
  transition: transform .15s var(--ease), box-shadow .15s var(--ease);
}

[data-theme="light"] .accent-pop button { border-color: rgba(0, 0, 0, .14); }

.accent-pop button[data-accent-opt="gold"]    { --sw: #d6b071; }
.accent-pop button[data-accent-opt="ice"]     { --sw: #6cc3d6; }
.accent-pop button[data-accent-opt="violet"]  { --sw: #a99bf5; }
.accent-pop button[data-accent-opt="emerald"] { --sw: #63c99a; }
.accent-pop button[data-accent-opt="crimson"] { --sw: #e07c70; }

[data-theme="light"] .accent-pop button[data-accent-opt="gold"]    { --sw: #9a7428; }
[data-theme="light"] .accent-pop button[data-accent-opt="ice"]     { --sw: #1d6d80; }
[data-theme="light"] .accent-pop button[data-accent-opt="violet"]  { --sw: #5b48b5; }
[data-theme="light"] .accent-pop button[data-accent-opt="emerald"] { --sw: #1f7a55; }
[data-theme="light"] .accent-pop button[data-accent-opt="crimson"] { --sw: #a8362e; }

.accent-pop button:hover { transform: scale(1.14); }

.accent-pop button[aria-pressed="true"] {
  box-shadow: 0 0 0 2px var(--panel-2), 0 0 0 4px var(--sw);
}

/* 窄屏下侧栏与顶栏会叠，面板贴右边缘 */
@media (max-width: 560px) {
  .accent-pop { right: -6px; }
}

/* 22. 卡密查询页 */
.qhead { text-align: center; margin-bottom: 28px; }

.qhead h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(26px, 3.2vw, 34px);
  letter-spacing: -.02em;
}

.qhead p {
  margin: 10px 0 0;
  color: var(--text-2);
  font-size: 14.5px;
}

.qbox { max-width: 560px; margin: 0 auto; }

/* .form-row 自身只有内部 gap，没有下外边距，靠容器统一拉开 */
.qform { display: flex; flex-direction: column; gap: 16px; }

.qcap { display: flex; align-items: center; gap: 10px; }

.qcap input { flex: 1; min-width: 0; }

.qcap img {
  flex: none;
  height: 52px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: #0d1424;
  cursor: pointer;
}

.qhint {
  margin: 0;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-3);
}

.qhint b { color: var(--gold); font-weight: 700; }

.qresult { margin-top: 18px; }

/* 卡片头默认只有 gap，查询结果的徽章推到右端 */
.qresult .card-head .badge { margin-left: auto; }

.qres .qrow {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.qres .qrow:last-child { border-bottom: 0; padding-bottom: 2px; }

.qres .qrow > span { flex: none; color: var(--text-2); }

.qres .qrow > b { font-weight: 600; text-align: right; word-break: break-all; }

.qres .qrow > b.mono { font-family: var(--font-mono); font-size: 13px; }

@media (max-width: 560px) {
  .qres .qrow { font-size: 13.5px; gap: 14px; }
  .qhint { font-size: 12px; }
}

/* 23. 批量操作条 */
.batch-bar {
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.batch-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}

/* 描边版危险按钮：和实心「批量删除」并排时区分开，避免手滑点到 */
.btn-danger-o {
  color: var(--err);
  background: transparent;
  border-color: rgba(224, 105, 93, .45);
}
.btn-danger-o:hover {
  color: var(--err);
  background: rgba(224, 105, 93, .12);
  border-color: var(--err);
}

/* 额度那组小控件，允许换行，五六个按钮挤一行会撑爆操作列 */
.agents-quota {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  vertical-align: middle;
}
.agents-quota .input {
  width: 64px;
  padding: 4px 6px;
  font-size: 12px;
}

/* 备注列限宽，太长就省略，别把表格撑开 */
.table-wrap td.note-cell {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 代理行的操作区：按钮多，允许换行，别把表格撑出屏幕 */
.agent-ops {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}
.agent-ops form { margin: 0; }

/* 代理在卡密页看自己的额度 */
.quota-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  padding-top: 12px;
  padding-bottom: 12px;
}
.quota-label {
  font-size: 12px;
  color: var(--text-3);
  letter-spacing: .04em;
}
.quota-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 12.5px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text-2);
}
.quota-chip b {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.quota-chip em {
  font-style: normal;
  font-size: 11.5px;
  color: var(--text-3);
}
.quota-chip em.ok { color: var(--ok); }
.quota-chip.is-full {
  border-color: rgba(221, 164, 90, .45);
  background: rgba(221, 164, 90, .1);
}
.quota-chip.is-full em { color: var(--warn); }
.quota-chip .quota-note {
  padding-left: 6px;
  border-left: 1px solid var(--line-3);
  color: var(--info);
}

/* 列变多以后，右侧操作列不再吸附：吸附会永久遮住最后几列内容，
   而勾选列吸附在左侧没有这个副作用，留着方便批量操作。 */
.table-wrap thead th:last-child,
.table-wrap tbody td:last-child {
  position: static;
  box-shadow: none;
}

.table-wrap thead th:first-child,
.table-wrap tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--panel);
  padding-left: 10px;
  padding-right: 4px;
  box-shadow: 10px 0 12px -10px rgba(0, 0, 0, .55);
}

.table-wrap thead th:first-child {
  z-index: 2;
  background: var(--panel-2);
}

.table-wrap tbody tr:hover td:first-child { background: var(--panel-2); }

[data-theme="light"] .table-wrap tbody td:first-child { background: var(--panel); }
[data-theme="light"] .table-wrap thead th:first-child { background: var(--panel-2); }
[data-theme="light"] .table-wrap tbody tr:hover td:first-child { background: var(--panel-2); }
[data-theme="light"] .table-wrap tbody td:first-child { box-shadow: 10px 0 12px -10px rgba(0, 0, 0, .12); }

.table-wrap input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--gold);
  cursor: pointer;
  vertical-align: -2px;
}

/* 设备码、卡密这类不折行的长串，给足最小宽度，避免被压成省略号 */
.table-wrap td.cell-code { min-width: 172px; }
.table-wrap td.cell-cardno { min-width: 128px; }

/* 列多时横向滚动是常态，把滚动条做得显眼一点，别让人以为列没了 */
.table-wrap[data-scroll-x] { position: relative; }

.table-wrap::-webkit-scrollbar { height: 10px; }
.table-wrap::-webkit-scrollbar-track { background: var(--bg-soft); }
.table-wrap::-webkit-scrollbar-thumb {
  background: var(--line-3);
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.table-wrap::-webkit-scrollbar-thumb:hover { background: var(--gold-3); background-clip: padding-box; }

/* Firefox 走标准属性，Chrome/Edge 留给上面的 ::-webkit-scrollbar，
   否则新版 Chrome 认 scrollbar-width 会把滚动条压成 8px 几乎看不见 */
@supports not selector(::-webkit-scrollbar) {
  .table-wrap { scrollbar-width: thin; scrollbar-color: var(--line-3) var(--bg-soft); }
}

@media (max-width: 760px) {
  .batch-bar { gap: 10px; }
  .batch-actions { margin-left: 0; width: 100%; }
}

/* ---------- 分片上传进度 ---------- */
.upload-progress { flex-basis: 100%; margin-top: 2px; }
.upload-bar {
  height: 6px;
  border-radius: 99px;
  overflow: hidden;
  background: var(--panel-3);
  border: 1px solid var(--line);
}
.upload-bar > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--gold-3), var(--gold-2));
  transition: width .18s ease;
}
.upload-text { margin-top: 6px; font-size: 12px; }

/* ---------- 代理权限：勾选项与表单尾部按钮 ---------- */
.perm-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
}

.perm-check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  line-height: 1.45;
}

.perm-check input[type=checkbox] {
  flex: none;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--gold-2);
  cursor: pointer;
}

.perm-check span { display: block; }

.perm-check small {
  display: block;
  font-size: 11.5px;
  font-weight: 400;
  line-height: 1.4;
  margin-top: 1px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 4px;
}

@media (max-width: 560px) {
  .perm-checks { flex-direction: column; gap: 10px; }
  .form-actions .btn { flex: 1 1 auto; justify-content: center; }
}
