/* ==================================================================
   小邦后台 · ERP 管理台
   ------------------------------------------------------------------
   布局照主流管理后台（Element Plus / Ant Design）来：
     左：整列深色菜单（品牌在最上面）
     右：白色页头（面包屑 + 当前用户）+ 浅灰工作区 + 一张张白卡片
   信息密度优先：13px 正文、等宽数字纵向对齐。
   主色只有一种蓝（--primary），状态色（成功 / 警告 / 危险）只出现在标签
   和按钮上，不用来大面积铺底。
   ================================================================== */

:root {
  /* ---- 主色（Element Plus 蓝） ---- */
  --primary: #409eff;
  --primary-hover: #66b1ff;
  --primary-active: #3a8ee6;
  --primary-tint: #ecf5ff;
  --primary-tint-2: #f4f9ff;

  /* ---- 导航 ---- */
  --nav: #1f2d3d;
  --nav-hover: #182530;
  --nav-active: #263445;
  --nav-text: #bfcbd9;
  --nav-text-strong: #409eff;
  --nav-label: #6c7a89;
  --nav-line: #17222e;

  /* ---- 工作区 ---- */
  --page: #f5f7fa;
  --card: #ffffff;
  --line: #ebeef5;
  --line-2: #dcdfe6;
  --head-bg: #fafafa;

  /* ---- 文字 ---- */
  --t1: #303133;
  --t2: #606266;
  --t3: #909399;

  /* ---- 状态 ---- */
  --ok: #67c23a;
  --ok-bg: #f0f9eb;
  --ok-line: #c2e7b0;
  --warn: #e6a23c;
  --warn-bg: #fdf6ec;
  --warn-line: #f5dab1;
  --danger: #f56c6c;
  --danger-bg: #fef0f0;
  --danger-line: #fbc4c4;

  --r: 4px;
  --r-lg: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .04);

  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
          "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--t1);
  font: 13px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

/* ==================================================================
   骨架：左侧整列菜单 + 右侧工作区
   ================================================================== */

.shell {
  display: flex;
  min-height: 100vh;
}

/* ---- 左侧菜单 ---- */
.sidebar {
  display: flex;
  flex-direction: column;
  flex: none;
  width: 210px;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  background: var(--nav);
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #35485d; border-radius: 3px; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  height: 56px;
  padding: 0 18px;
  color: #fff;
  border-bottom: 1px solid var(--nav-line);
}
.brand:hover { color: #fff; }

.logo {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  flex: none;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.brand-name { font-size: 14px; font-weight: 600; letter-spacing: .01em; }
.brand-sub { font-size: 11px; color: #8492a6; }

.side-nav { flex: 1; padding: 8px 0 16px; }

.side-label {
  padding: 16px 20px 6px;
  color: var(--nav-label);
  font-size: 11px;
  letter-spacing: .12em;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 20px;
  color: var(--nav-text);
  font-size: 13.5px;
  border-left: 3px solid transparent;
  transition: background .12s ease, color .12s ease;
}
.side-link svg { flex: none; opacity: .9; }
.side-link:hover { background: var(--nav-hover); color: #fff; }
.side-link.on {
  background: var(--nav-active);
  color: var(--nav-text-strong);
  border-left-color: var(--primary);
  font-weight: 500;
}
.side-link.on svg { opacity: 1; }

.side-foot {
  flex: none;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--nav-line);
  color: #5d6b7a;
  font-size: 11.5px;
  line-height: 1.75;
}

/* ---- 右侧工作区 ---- */
.workspace {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  flex: none;
  height: 56px;
  padding: 0 24px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.topbar-spacer { flex: 1; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--primary-tint);
  color: var(--primary);
  font-size: 12px;
  white-space: nowrap;
}
.chip i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.chip.muted { background: #f4f4f5; color: var(--t3); }

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 14px;
  border-left: 1px solid var(--line);
  color: var(--t2);
  font-size: 13px;
}
.avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-tint);
  color: var(--primary);
  font-size: 12.5px;
  font-weight: 600;
}

.main {
  flex: 1;
  min-width: 0;
  padding: 20px 24px 44px;
}
.content { max-width: 1560px; margin: 0 auto; }

/* 未登录（登录页 / 错误页）：不套壳，独占一屏 */
.main.page-bare { padding: 0; }

.crumb {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--t3);
  font-size: 13px;
  min-width: 0;
}
.crumb a { color: var(--t3); }
.crumb a:hover { color: var(--primary); }
.crumb span { color: #c0c4cc; }

.page-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}
.page-head > div:first-child { min-width: 0; }
.page-head-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: .01em;
  line-height: 1.4;
}
.page-desc {
  margin: 5px 0 0;
  color: var(--t3);
  font-size: 12.5px;
}
.page-desc b { color: var(--t2); font-weight: 600; }

/* ==================================================================
   卡片
   ================================================================== */

.card {
  margin-bottom: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  min-height: 48px;
  border-bottom: 1px solid var(--line);
}
.card-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .01em;
}
.card-head .card-tools { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* 标题旁的计数 / 版本号 */
.count {
  display: inline-block;
  margin-left: 6px;
  padding: 0 7px;
  border-radius: 999px;
  background: #f4f4f5;
  color: var(--t3);
  font-size: 11.5px;
  font-weight: 400;
  line-height: 19px;
  vertical-align: 1px;
}

.card-body { padding: 16px; }
.card-body > :first-child { margin-top: 0; }
.card-body > :last-child { margin-bottom: 0; }

/* 卡片里再分节（长表单） */
.section {
  margin: 0 0 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--head-bg);
}
.section-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}
.section-head .hint { margin-left: auto; text-align: right; }
.section-body { padding: 16px; }
.section-body > :first-child { margin-top: 0; }
.section-body > :last-child { margin-bottom: 0; }

/* h2 在卡片外时（少数页脚区块） */
h2 {
  margin: 24px 0 10px;
  font-size: 15px;
  font-weight: 600;
}
h3 {
  margin: 18px 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--t2);
}

/* ==================================================================
   提示 / 回执
   ================================================================== */

.note {
  margin: 0 0 12px;
  padding: 9px 12px;
  border: 1px solid #d9ecff;
  border-radius: var(--r);
  background: var(--primary-tint-2);
  color: var(--t2);
  font-size: 12.5px;
  line-height: 1.65;
}
.note b { color: var(--t1); }
.note code {
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
  font-family: var(--mono);
  font-size: 11.5px;
}

.hint { color: var(--t3); font-size: 12px; font-weight: 400; }
.panel-actions { margin-top: 14px; }

.ok, .error {
  margin: 0 0 16px;
  padding: 9px 12px;
  border: 1px solid var(--ok-line);
  border-radius: var(--r);
  background: var(--ok-bg);
  color: #529b2e;
  font-size: 12.5px;
}
.error { border-color: var(--danger-line); background: var(--danger-bg); color: var(--danger); }
.note .ok, .note .error { margin: 0; padding: 0; border: 0; background: none; font-size: inherit; }
.note .error { color: var(--danger); font-weight: 600; }

.empty {
  padding: 44px 16px;
  text-align: center;
  color: var(--t3);
  font-size: 13px;
}
.empty b { display: block; margin-bottom: 4px; color: var(--t2); font-weight: 500; }

/* ==================================================================
   表格
   ================================================================== */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

th, td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  /* ★ overflow-wrap: anywhere —— 操作记录的 payload、订单外部单号这类长串里没有空格，
     默认的 normal 会让整张表按最长那一格撑开，把页面撑出横向滚动条。
     用 anywhere 而不是 break-all：只在确实放不下时才断，短值不受影响。 */
  overflow-wrap: anywhere;
  vertical-align: middle;
}

thead th {
  background: var(--head-bg);
  color: var(--t2);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}

tbody tr:hover td { background: #f5f7fa; }
tbody tr:last-child td { border-bottom: 0; }

td.num, th.num { text-align: right; }

/* 用量：一根细条 + 数字 */
.meter {
  display: inline-block;
  width: 48px;
  height: 4px;
  margin-right: 8px;
  border-radius: 2px;
  background: #ebeef5;
  vertical-align: middle;
  overflow: hidden;
}
.meter i { display: block; height: 100%; background: var(--primary); }

/* ==================================================================
   标签
   ================================================================== */

.tag {
  display: inline-block;
  padding: 0 8px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: #f4f4f5;
  color: var(--t2);
  font-size: 11.5px;
  line-height: 20px;
  white-space: nowrap;
}
.tag.ok { border-color: var(--ok-line); background: var(--ok-bg); color: #529b2e; }
.tag.warn { border-color: var(--warn-line); background: var(--warn-bg); color: #b88230; }
.tag.bad { border-color: var(--danger-line); background: var(--danger-bg); color: var(--danger); }

/* ==================================================================
   工具条（查询条件）
   ================================================================== */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
}
.toolbar .field { min-width: 180px; }
.toolbar .field.grow { flex: 1; }
.toolbar-actions { display: flex; gap: 8px; margin-left: auto; }

/* ==================================================================
   表单
   ================================================================== */

form { margin: 0; }

.field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.field.grow { flex: 1; min-width: 220px; }

.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  align-items: flex-start;
}
.field-row .field { flex: 1; min-width: 140px; }
.field-row .field.grow { flex: 100%; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 20px;
}
.form-grid .span-2 { grid-column: 1 / -1; }

label {
  display: block;
  margin-bottom: 6px;
  color: var(--t2);
  font-size: 12.5px;
  font-weight: 500;
}
label .hint { font-weight: 400; }

input[type=text], input[type=password], input[type=number], select {
  width: 100%;
  height: 32px;
  padding: 0 11px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: #fff;
  color: var(--t1);
  font: inherit;
  font-size: 13px;
  min-width: 0;
  transition: border-color .12s ease, box-shadow .12s ease;
}
input::placeholder, textarea::placeholder { color: #c0c4cc; }
input:hover, select:hover, textarea:hover { border-color: #c0c4cc; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-tint);
}

select { cursor: pointer; }

input.narrow { width: 110px; }

textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: #fff;
  color: var(--t1);
  font: inherit;
  font-size: 12.5px;
  line-height: 1.65;
  resize: vertical;
  transition: border-color .12s ease, box-shadow .12s ease;
}

/* 表单里字段之间的固定间距（工具条用自己的 gap） */
.card-body > .field, .section-body > .field, .form-grid > .field { margin-bottom: 14px; }
.form-grid > .field { margin-bottom: 0; }

/* ==================================================================
   按钮
   ================================================================== */

.btn, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 15px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: #fff;
  color: var(--t1);
  font: inherit;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.btn:hover, button:hover {
  background: var(--primary-tint);
  border-color: #c6e2ff;
  color: var(--primary);
}

button.primary, .btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 500;
}
button.primary:hover, .btn.primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
}

button.ghost { background: #fff; color: var(--t2); border-color: var(--line-2); }
button.ghost:hover { background: var(--primary-tint); border-color: #c6e2ff; color: var(--primary); }

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

button.small, .btn.small { height: 26px; padding: 0 10px; font-size: 12px; }

button:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

/* ==================================================================
   折叠块：技能 meta / 模板组
   ------------------------------------------------------------------
   ★ 提示词页和技能页的主卡片已经换成 `.sk-item`（卡片网格），这里只剩
     嵌在卡片里的二级折叠块 —— `details.group`。
   ================================================================== */

details.group { border-bottom: 1px solid var(--line); }
details.group:last-of-type { border-bottom: 0; }

details.group > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  list-style: none;
  cursor: pointer;
  user-select: none;
  border-radius: var(--r);
}
details.group > summary::-webkit-details-marker { display: none; }

/* 展开箭头 */
details.group > summary::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  margin-right: 2px;
  border-right: 1.5px solid var(--t3);
  border-bottom: 1.5px solid var(--t3);
  transform: rotate(-45deg);
  transition: transform .12s ease;
}
details.group[open] > summary::before {
  transform: rotate(45deg);
}

details.group > summary:hover { background: #f5f7fa; }
details.group > summary strong { font-weight: 600; color: var(--t1); }
details.group > summary > * { min-width: 0; }

/* 模板组：缩进 + 左侧细线，表示从属关系 */
details.group[open] { padding: 0 0 10px 12px; border-left: 2px solid var(--line); }

/* 技能 meta 区：嵌在技能卡里面，再缩一层，别和正文抢视觉重量 */
details.group.meta { border-top: 1px dashed var(--line); border-bottom: 0; margin-top: 4px; }

/* 勾选框单独一行：和 input[type=text] 的满宽规则分开，否则框会被拉满一行 */
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  font-weight: 400;
  cursor: pointer;
}
.check-row input[type=checkbox] {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}
.field.narrow { flex: 0 1 130px; min-width: 96px; }

/* ==================================================================
   保存条：长表单钉在底边
   ================================================================== */

.save-bar {
  position: sticky;
  bottom: 0;
  z-index: 10;
  margin: 16px 0 0;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, .05);
}
.save-bar .field-row { align-items: flex-end; }
.save-bar .note { margin-bottom: 10px; }

/* ==================================================================
   等宽：ID、时间、金额、payload
   ★ 放在输入框规则之后 —— `input[type=text]` 的选择器权重比 `.mono` 高，
     写在前面会被 input 的 font 覆盖掉。
   ================================================================== */

.mono, input.mono, select.mono, textarea.mono {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}
textarea.mono { font-size: 12px; line-height: 1.7; }
td.mono { color: var(--t2); }

/* 重置密码后展示一次明文密码 */
.password-reveal {
  display: inline-block;
  margin: 4px 0 10px;
  padding: 8px 14px;
  border: 1px dashed var(--danger-line);
  border-radius: var(--r);
  background: #fff;
  font-family: var(--mono);
  font-size: 20px;
  letter-spacing: .08em;
  color: var(--danger);
}

/* 需要一眼钉住的那一块 */
.card.alert {
  border-color: var(--danger-line);
  background: var(--danger-bg);
}
.card.alert .card-head { border-bottom-color: var(--danger-line); background: transparent; }

/* ==================================================================
   用户列表（/admin/users）
   ------------------------------------------------------------------
   ★ 全部规则都挂在 `.users-page` 下：这一页是单独重设计过的，样式不外溢到
     其它后台页面。共用变量（--primary / --line / --t1…）仍然来自 :root。
   ================================================================== */

/* ---- 概览卡 ---- */
.u-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.u-stat {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}
/* 有封禁账号时，这一张换个边框色，扫一眼就能注意到 */
.u-stat.is-warn { border-color: var(--warn-line); }

.u-stat-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  flex: none;
}
.u-stat-icon.is-blue { background: var(--primary-tint); color: var(--primary); }
.u-stat-icon.is-green { background: var(--ok-bg); color: #529b2e; }
.u-stat-icon.is-violet { background: #f0edfd; color: #6b4fd8; }
.u-stat-icon.is-red { background: var(--danger-bg); color: var(--danger); }
.u-stat-icon.is-gray { background: #f4f4f5; color: var(--t3); }
.u-stat-icon.is-amber { background: var(--warn-bg); color: #b88230; }

.u-stat-body { min-width: 0; }
.u-stat-label { color: var(--t3); font-size: 12px; }
.u-stat-value {
  margin-top: 2px;
  color: var(--t1);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -.01em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.u-stat-foot { margin-top: 3px; color: var(--t3); font-size: 11.5px; }
.u-stat-foot b { color: var(--t2); font-weight: 600; }

/* ---- 工具条：搜索 + 状态分段 ---- */
.u-card { overflow: hidden; }

.u-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.u-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 280px;
  max-width: 520px;
}

/* 输入框 + 图标 + 清除按钮放一个相对定位的壳里：
   图标和 × 都相对这个壳定位，不会跑到「查询」按钮上去 */
.u-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}
.u-search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  color: var(--t3);
  pointer-events: none;
}
.u-search input[type=text] {
  /* ★ flex:1 + min-width:0 —— 全局规则给了 `width:100%`，在 flex 行里会把
     后面的「查询」按钮挤出容器（按钮跑到视野外）。这里改用 flex 分配宽度。 */
  flex: 1;
  width: auto;
  min-width: 0;
  height: 34px;
  padding-left: 33px;
  padding-right: 30px;
}
.u-search input[type=text]:focus { background: #fff; }

/* 视觉隐藏：搜索框要有可读的 label，但画面上不需要第二行字 */
.u-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.u-search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f0f2f5;
  color: var(--t2);
  font-size: 13px;
  line-height: 1;
}
.u-search-clear:hover { background: #e4e7ed; color: var(--t1); }
.u-search-btn { height: 34px; padding: 0 18px; flex: none; }

.u-seg {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f7f8fa;
}
.u-seg a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 11px;
  border-radius: 5px;
  color: var(--t2);
  font-size: 12.5px;
  white-space: nowrap;
}
.u-seg a:hover { color: var(--t1); background: #fff; }
.u-seg a.on {
  background: #fff;
  color: var(--primary);
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
}
.u-seg-num {
  padding: 0 5px;
  border-radius: 999px;
  background: #ebeef5;
  color: var(--t3);
  font-size: 11px;
  line-height: 16px;
  font-variant-numeric: tabular-nums;
}
.u-seg a.on .u-seg-num { background: var(--primary-tint); color: var(--primary); }

.u-result-line {
  padding: 10px 16px 0;
  color: var(--t3);
  font-size: 12px;
}
.u-result-line b { color: var(--t2); font-weight: 600; }

/* ---- 表格 ---- */
.u-table-wrap { padding: 4px 0; }

table.u-table { font-size: 13px; }
table.u-table thead th {
  padding: 10px 16px;
  background: var(--head-bg);
  border-bottom: 1px solid var(--line);
  color: var(--t2);
  font-size: 12.5px;
  font-weight: 600;
}

/* 列宽：只钉「不该被挤」的几列，用户列吃掉剩下的宽度。
   ★ 不写 table-layout:fixed —— 用户名/邮箱长度差很大，固定布局反而会让
     长名字压到旁边几列上。
   ★ 全部加 .users-page 前缀：这组 nth-child 是给用户列表那 6 列算的，
     不加前缀会连订单 / 卡密几张表一起套（它们的第 3、5 列完全不是
     一回事），那边的时间列就被挤成 57px 宽了。 */
/* 列宽按「用户 / 联系方式 / 状态 / 套餐到期 / 剩余积分 / 注册时间 / 操作」排。
   ★ 联系方式单独成列之后，用户列只放名字和「未设用户名」这类小标签，右边不再
     空掉一大片；手机上整表 720px 横向滑，信息密度也比原来三行挤一格高。 */
.users-page table.u-table th:nth-child(2) { width: 210px; }  /* 联系方式 */
.users-page table.u-table th:nth-child(3) { width: 96px; }   /* 状态 */
.users-page table.u-table th:nth-child(4) { width: 190px; }  /* 套餐 / 到期 */
.users-page table.u-table th:nth-child(5) { width: 104px; }  /* 剩余积分（+ 待发） */
.users-page table.u-table th:nth-child(6) { width: 150px; }  /* 注册时间 */
/* 行尾两件事：送积分 + 详情 */
.users-page table.u-table th:nth-child(7) { width: 152px; }

table.u-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
table.u-table tbody tr:last-child td { border-bottom: 0; }
table.u-table tbody tr:hover td { background: #f5f7fa; }
/* 封禁行整行压暗一点，扫列表时能一眼分出来 */
table.u-table tbody tr.is-banned td { background: #fffafa; }
table.u-table tbody tr.is-banned:hover td { background: #fef6f6; }

.u-th-act { width: 64px; }
/* ★ 不给 td 加 display:flex —— 那会把单元格踢出表格布局，整行错位。
   行尾要并排放两个动作时，用里面这层 inline-flex。 */
.u-cell-act { text-align: right; }
.u-cell-act-row {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}
.u-cell-time .mono { color: var(--t2); font-size: 12px; }

/* 联系方式列：手机号一行、邮箱一行，都是等宽字。邮箱过长时省略而不是把列撑开 */
.u-cell-contact .mono { color: var(--t2); font-size: 12px; }
.u-cell-contact > div + div { margin-top: 2px; }
.u-cell-email {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 用户单元格：头像 + 名字（+ 未设用户名/未设密码 的小标签） */
.u-user {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--t1);
  min-width: 0;
}
.u-user:hover { color: var(--primary); }
.u-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex: none;
  background: var(--primary-tint);
  color: var(--primary);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
}
.u-avatar.is-banned { background: var(--danger-bg); color: var(--danger); }

.u-user-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.u-user-name {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
}
.u-id {
  color: var(--t3);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
}
.u-user-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  color: var(--t3);
  font-size: 11.5px;
}
.u-user-meta .mono { color: var(--t3); font-size: 11.5px; }

/* 极小号提示标签：未设用户名 / 未设密码 */
.u-tag-mini {
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fafafa;
  color: var(--t3);
  font-size: 10.5px;
  line-height: 15px;
}
.u-tag-mini.is-warn { border-color: var(--warn-line); background: var(--warn-bg); color: #b88230; }

/* 状态徽章：一个圆点 + 文字，比原来的方块 tag 轻 */
.u-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11.5px;
  line-height: 20px;
  white-space: nowrap;
}
.u-badge i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.u-badge.is-ok { background: var(--ok-bg); color: #529b2e; }
.u-badge.is-bad { background: var(--danger-bg); color: var(--danger); }
.u-badge.is-warn { background: var(--warn-bg); color: #b88230; }
.u-badge.is-neutral { background: #f4f4f5; color: var(--t2); }
.u-badge.is-plain { padding: 0; background: none; line-height: 18px; }

/* 套餐单元格 */
.u-plan { display: flex; align-items: center; gap: 7px; }
.u-plan-name { color: var(--t1); font-size: 12.5px; font-weight: 500; }
.u-plan-sub { margin-top: 3px; color: var(--t3); font-size: 11.5px; }

.u-credits {
  display: inline-block;
  padding: 0 7px;
  border-radius: 4px;
  background: var(--primary-tint);
  color: var(--primary);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* 剩余积分：主数字，等宽对齐；余额见底时压成灰色，不要让「0」看着像好事 */
.u-balance {
  color: var(--t1);
  font-size: 13.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.u-balance.is-zero { color: var(--t3); font-weight: 500; }
/* 待发那行小字：提示「刚发的那笔还没到账」，不抢余额的位置 */
.u-balance-sub {
  margin-top: 2px;
  color: var(--warn);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

/* 账本没答上来时，列表结果行末尾那半句解释 */
.u-result-warn { color: var(--warn); }

.u-none { color: var(--t3); }

/* 行尾「详情」 */
.u-open {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--t3);
  font-size: 12px;
  white-space: nowrap;
}
.u-open svg { transition: transform .12s ease; }
.u-open:hover { color: var(--primary); }
.u-open:hover svg { transform: translateX(2px); }

/* ---- 空状态 ---- */
.u-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 56px 20px 60px;
  text-align: center;
}
.u-empty-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 6px;
  border-radius: 50%;
  background: #f5f7fa;
  color: var(--t3);
}
.u-empty b { color: var(--t2); font-size: 13.5px; font-weight: 600; }
.u-empty span { color: var(--t3); font-size: 12.5px; }
.u-empty .btn { margin-top: 10px; }

/* ==================================================================
   用户详情（/admin/users/{id}）
   ------------------------------------------------------------------
   左栏读数据、右栏做操作。操作全部收进右栏窄卡，左栏只剩四张读的表，
   扫视顺序固定。
   ================================================================== */

/* 抬头：头像 + 名字 + 状态，和列表页那一列同一套长相 */
.ud-identity { display: flex; align-items: center; gap: 14px; min-width: 0; }
.ud-identity-text { min-width: 0; }
.ud-identity h1 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 19px;
}
.ud-identity .page-desc {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 6px;
  margin-top: 5px;
}
.ud-sep { color: #c9ced6; }

/* 头像放大一号：详情页它是这页唯一的主体标识 */
.u-avatar.is-lg {
  width: 46px;
  height: 46px;
  font-size: 18px;
  border-radius: 10px;
}
.u-avatar.is-lg svg { width: 22px; height: 22px; }

/* ---- 概览：4 张，别按列表页的 5 列铺 ---- */
.ud-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* 套餐名是文字不是数字，24px 太大；左对齐保持和标签同一基线 */
.u-stat-value.is-text { font-size: 17px; font-weight: 600; line-height: 1.5; margin-top: 1px; }

/* ---- 两栏骨架 ---- */
.ud-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 348px;
  gap: 16px;
  align-items: start;
}
.ud-main { min-width: 0; }
.ud-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ud-side .card { margin-bottom: 0; }

/* ---- 账号档案：井字格，不再是右对齐的键值表 ---- */
.ud-profile-body { padding: 4px 16px 16px; }
.ud-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 0;
}
.ud-fact {
  min-width: 0;
  padding: 12px 14px 12px 0;
  border-bottom: 1px solid var(--line);
}
/* 每行最后一格不画右边距留下的空格感 */
.ud-fact:nth-last-child(-n+3) { border-bottom: 0; }
.ud-fact dt {
  margin-bottom: 4px;
  color: var(--t3);
  font-size: 11.5px;
  letter-spacing: .02em;
}
.ud-fact dd {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--t1);
  font-size: 13px;
  overflow-wrap: anywhere;
}

/* ---- 左栏表格：沿用列表页 u-table，只调一下密度 ---- */
/* ★ 权重必须压过 `.users-page table.u-table th:nth-child(n)` 那组列宽（给列表页
   那 7 列定的像素值），否则「来源」会被撑成 200px、「套餐」被挤成一列空白 ——
   详情页四张表的列和列表页完全不是一回事，让浏览器按内容分配。 */
.users-page table.u-table.ud-table th:nth-child(n) { width: auto; }
.ud-table tbody td { padding: 10px 16px; }
.ud-table thead th { padding: 9px 16px; }
/* 短字段列不换行，长字段（原因 / 内容）吃剩下的宽度 */
.ud-table td.mono, .ud-table .u-cell-time { white-space: nowrap; }
.ud-table td:last-child { white-space: normal; }
/* 已吊销的凭证整行压暗：还活着的那几条才是封号要处理的对象 */
.ud-table tbody tr.is-muted td { background: #fafbfc; }
.ud-table tbody tr.is-muted:hover td { background: #f5f7fa; }
.ud-table tbody tr.is-muted .mono { color: var(--t3); }

/* 积分增减用颜色区分，数字本身等宽 */
.ud-amount { font-variant-numeric: tabular-nums; font-weight: 600; }
.ud-amount.is-plus { color: #529b2e; }
.ud-amount.is-minus { color: var(--danger); }

/* 吊销：一行输入框 + 按钮，不再是一个换行的 toolbar */
.ud-table .u-th-act { text-align: right; }
.ud-inline-form { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.ud-inline-form input[type=text] {
  width: 108px;
  height: 26px;
  padding: 0 8px;
  font-size: 12px;
}

/* 卡片里的空状态：详情页四张表都可能有空，44px 的上下留白太高 */
.u-empty.is-compact { gap: 3px; padding: 26px 16px 30px; }
.u-empty.is-compact span { font-size: 12px; }

.ud-link { color: var(--t3); font-size: 12px; }
.ud-link:hover { color: var(--primary); }

/* ---- 右栏操作面板 ---- */
.ud-op.is-danger { border-color: var(--danger-line); }
.ud-op.is-danger .card-head { background: var(--danger-bg); border-bottom-color: var(--danger-line); }

.ud-form { display: flex; flex-direction: column; gap: 12px; }
.ud-form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.ud-form .field { min-width: 0; }
.ud-form label { font-size: 12px; }
.ud-form-actions { display: flex; justify-content: flex-end; }
.ud-form-actions .primary, .ud-form-actions .danger { min-width: 88px; }

.ud-tip {
  margin: 0;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  color: var(--t3);
  font-size: 11.5px;
  line-height: 1.7;
}

/* ---- 折叠卡：低频操作 / 空表格，标题行就是开关 ---- */
/* ★ 卡片本身是 <details>：保留 .card 的圆角与边框，只把 summary 的默认箭头换掉。
   `display:block` 是必须的 —— summary 默认 `list-item`，会和 .card-head 的
   flex 打架，标题和右侧提示会各占一行。 */
details.ud-fold > summary.card-head {
  display: flex;
  list-style: none;
  cursor: pointer;
  user-select: none;
}
details.ud-fold > summary.card-head::-webkit-details-marker { display: none; }
/* 右侧那个小三角：收起时朝下，展开时朝上 */
details.ud-fold > summary.card-head::after {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  margin-left: 4px;
  border-right: 1.5px solid var(--t3);
  border-bottom: 1.5px solid var(--t3);
  transform: rotate(45deg) translateY(-2px);
  transition: transform .12s ease;
}
details.ud-fold[open] > summary.card-head::after { transform: rotate(-135deg) translateY(-2px); }
details.ud-fold > summary.card-head:hover { background: #f5f7fa; }
/* 标题行本身已经是 48px 的分隔线，展开后不要再叠一条 */
details.ud-fold[open] > summary.card-head { border-bottom: 1px solid var(--line); }
details.ud-fold:not([open]) > .card-body { display: none; }
/* 收起时右侧的 hint 还可以看，但别让它喧宾夺主 */
details.ud-fold:not([open]) > summary .hint { color: var(--t3); }

/* ---- 面额 / 天数预设：一排小按钮，点一下填进输入框 ---- */
.u-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.u-preset {
  height: 26px;
  padding: 0 10px;
  border-radius: 4px;
  background: #fff;
  color: var(--t2);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.u-preset:hover { background: var(--primary-tint); border-color: #c6e2ff; color: var(--primary); }

/* ---- 积分流水分页 ---- */
.ud-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px 12px;
  border-top: 1px solid var(--line);
}
.ud-pager-btns { display: flex; gap: 8px; }

/* ==================================================================
   送积分弹窗（用户列表行内）
   ------------------------------------------------------------------
   用原生 <dialog>：自带遮罩、Esc 关闭和焦点圈定，不必自己写一套。
   ================================================================== */
.u-dialog {
  width: 420px;
  max-width: calc(100vw - 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--card);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .16);
  color: var(--t1);
}
/* 居中由浏览器默认样式负责，但 Safari 老版本会贴到左上角 —— 显式给一次 */
.u-dialog[open] { margin: auto; }
.u-dialog::backdrop { background: rgba(31, 45, 61, .42); }
.u-dialog .card-head {
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: var(--head-bg);
}
.u-dialog .card-title {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}
.u-dialog-user {
  overflow: hidden;
  color: var(--t2);
  font-size: 13px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.u-dialog .card-body { padding: 16px; }
.u-dialog .field { margin-bottom: 12px; }
.u-dialog-tip {
  margin: 0 0 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  color: var(--t3);
  font-size: 11.5px;
  line-height: 1.7;
}
.u-dialog-foot { display: flex; justify-content: flex-end; gap: 8px; }

@media (max-width: 1240px) {
  .ud-grid { grid-template-columns: minmax(0, 1fr) 300px; }
  .ud-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ud-fact:nth-last-child(-n+3) { border-bottom: 1px solid var(--line); }
  .ud-fact:nth-last-child(-n+2) { border-bottom: 0; }
}

@media (max-width: 1080px) {
  .ud-grid { grid-template-columns: minmax(0, 1fr); }
  .ud-side { position: static; }
  .ud-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ==================================================================
   卡密（/admin/codes 与批次明细）
   ------------------------------------------------------------------
   ★ 同用户列表：规则全部挂在 `.codes-page` 下，不外溢。
     `.u-*` 那一套（概览卡 / 工具条 / 分段 / 徽章 / 空状态）直接复用 ——
     它们本来就是无状态的通用件，只有用户页自己的表格样式加了 `u-table` 限定。
   ================================================================== */

/* ---- 两栏骨架：左列表吃掉剩余宽度，右栏是常驻的「生成」 ---- */
/* ★ 右栏固定 300px 而不是按比例分：生成表单只有两个字段，按比例分会在
   1440 屏上白撑到 500px 宽，输入框长得像搜索框。
   ★ 概览不放在右栏：四张统计卡竖排比列表还高，批次少的时候右栏底下空一片，
     看着像没加载完。它现在横贯在页顶（.c-overview）。 */
.codes-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
  align-items: start;
}
.codes-main { min-width: 0; }
.codes-main .card { margin-bottom: 0; }
.codes-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  /* 长列表滚下去时「生成」还在视野里 —— 这是它单独成一栏的唯一理由 */
  position: sticky;
  top: 72px;
}
.codes-side .card { margin-bottom: 0; }

/* ---- 批次表格 ---- */
.c-batches th:nth-child(1) { width: 190px; }
.c-batches th:nth-child(2) { width: 110px; }
.c-batches th:nth-child(3) { width: 260px; }
.c-batches th:nth-child(4) { width: 92px; }
.c-batches th:nth-child(5) { width: 150px; }
.c-batches th:last-child { width: 150px; }

/* 未兑换数是这一页唯一「要发货」的量：给一点主色底，扫一眼就知道还剩多少 */
.c-free {
  display: inline-block;
  padding: 0 7px;
  border-radius: 4px;
  background: var(--warn-bg);
  color: #b88230;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---- 右栏：生成表单 ---- */
.c-gen-body { padding: 14px 16px 16px; }
.c-gen-form .field { margin-bottom: 14px; }
.c-gen-form .field:last-of-type { margin-bottom: 0; }

.c-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.c-preset {
  height: 26px;
  padding: 0 10px;
  border-radius: 4px;
  background: #f4f4f5;
  color: var(--t2);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.c-preset:hover { border-color: var(--primary); color: var(--primary); background: #fff; }

.c-gen-submit { width: 100%; margin-top: 4px; }

.c-gen-note {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  color: var(--t3);
  font-size: 11.5px;
  line-height: 1.7;
}

/* ---- 顶部概览：左边整体兑换率，右边四个数 ---- */
/* ★ 原来四张统计卡各占一格、底下再一张生成卡，一屏里三块大留白。
   合并成一条：率是这一页唯一需要「看一眼就知道」的量，给它宽度；
   四个计数用小字横排，扫视顺序不变。 */
.c-overview {
  display: flex;
  align-items: stretch;
  gap: 24px;
  padding: 16px;
}
.c-over-rate {
  flex: 0 0 300px;
  min-width: 0;
  padding-right: 24px;
  border-right: 1px solid var(--line);
}
.c-over-top { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.c-over-pct {
  color: var(--t1);
  font-size: 28px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}
.c-over-cap { color: var(--t3); font-size: 12px; }
.c-over-foot { margin-top: 9px; color: var(--t3); font-size: 11.5px; }
.c-over-foot b { color: var(--t2); font-weight: 600; }

.c-over-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  flex: 1;
  min-width: 0;
}
.c-fact { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.c-fact-label { color: var(--t3); font-size: 12px; }
.c-fact-value {
  color: var(--t1);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}
.c-fact-value.is-ok { color: #529b2e; }
.c-fact-value.is-warn { color: #b88230; }
.c-fact-foot { color: var(--t3); font-size: 11.5px; }

.c-batch { font-size: 12.5px; }
.c-batch .mono { font-size: 12px; }

/* 兑换进度：细条 + 数字 + 百分比。 */
.c-cell-progress { white-space: nowrap; }
.c-meter {
  display: inline-block;
  width: 96px;
  height: 6px;
  margin-right: 10px;
  border-radius: 3px;
  background: #ebeef5;
  vertical-align: middle;
  overflow: hidden;
}
.c-meter i { display: block; height: 100%; background: var(--primary); border-radius: 3px; }
/* 撑满容器的那种进度条：批次明细抬头和页顶概览都用它 */
.c-meter.is-block { display: block; width: 100%; height: 8px; margin: 0; border-radius: 4px; }
.c-meter-text {
  color: var(--t3);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
}
.c-meter-text b { color: var(--t1); font-weight: 600; }
.c-meter-pct {
  display: inline-block;
  min-width: 38px;
  margin-left: 8px;
  color: var(--t3);
  font-size: 11.5px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
}

/* 行尾两个动作：看明细（主）+ CSV（次） */
.c-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.c-dl {
  color: var(--t3);
  font-size: 12px;
  border-bottom: 1px dashed transparent;
}
.c-dl:hover { color: var(--primary); border-bottom-color: currentColor; }

/* ---- 批次明细：抬头四个数 + 进度 ---- */
.c-summary {
  display: grid;
  grid-template-columns: repeat(3, 148px) minmax(200px, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.c-sum {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}
.c-sum-label { color: var(--t3); font-size: 12px; }
.c-sum-value {
  color: var(--t1);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}
.c-sum-value.is-ok { color: #529b2e; }
.c-sum-value.is-warn { color: #b88230; }
.c-sum-wide { justify-content: center; }
.c-sum-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.c-sum-pct { color: var(--primary); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---- 明细表 ---- */
/* 窄屏放不下四列时横向滚动，而不是把卡密截断 —— 卡密必须能完整看到/选中 */
.u-card .u-table-wrap { overflow-x: auto; }
.c-codes { min-width: 520px; }

.c-codes th:nth-child(1) { width: 280px; }
.c-codes th:nth-child(2) { width: 120px; }
.c-codes th:nth-child(4) { width: 170px; }

.c-cell-code { white-space: nowrap; }
.c-code {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: .04em;
  color: var(--t1);
  /* ★ 已兑换的码压暗但不能太淡：它仍是这一行的主键，管理员要能照着念出来 */
  user-select: all;
}
/* 已兑换整行压淡 —— 未兑换的卡才是要发货的那批 */
.c-codes tbody tr.is-used .c-code,
.c-codes tbody tr.is-used .c-user { color: var(--t3); }

.c-copy {
  height: 22px;
  margin-left: 10px;
  padding: 0 8px;
  border-radius: 3px;
  background: #f4f4f5;
  color: var(--t3);
  font-size: 11px;
  vertical-align: 1px;
}
.c-copy:hover { border-color: var(--primary); color: var(--primary); background: #fff; }
.c-copy.is-ok { border-color: var(--ok-line); background: var(--ok-bg); color: #529b2e; }
.c-copy.is-bad { border-color: var(--danger-line); background: var(--danger-bg); color: var(--danger); }

.c-user { font-size: 12.5px; }
.c-user .u-id { margin-left: 2px; }

/* ---- 翻页 ---- */
.c-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px 16px;
}
.c-pager-info { color: var(--t3); font-size: 12px; font-variant-numeric: tabular-nums; }
.c-pager-info b { color: var(--t2); font-weight: 600; }
.btn.is-disabled,
.btn.is-disabled:hover {
  border-color: var(--line);
  color: #c0c4cc;
  background: #fafafa;
  cursor: default;
}

/* 窄屏：进度条先让位，保住数字可读 */
@media (max-width: 1180px) {
  .codes-grid { grid-template-columns: minmax(0, 1fr) 260px; }
  .c-batches th:nth-child(3) { width: 200px; }
  .c-over-rate { flex-basis: 240px; }
  .c-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .c-sum-wide { grid-column: 1 / -1; }
}
@media (max-width: 1000px) {
  /* 两栏挤成一行会两边都窄，直接把右栏挪到列表上面 */
  .codes-grid { grid-template-columns: minmax(0, 1fr); }
  .codes-side { position: static; order: -1; }
  /* 概览条：率不再独占一列，改成横贯在上，四个数两行两列 */
  .c-overview { flex-direction: column; gap: 14px; }
  .c-over-rate {
    flex: none;
    padding-right: 0;
    padding-bottom: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .c-over-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* 生成卡横跨整行时，两个字段并排，别在页顶竖着占掉半屏 */
  .c-gen-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0 16px;
    align-items: start;
  }
  .c-gen-form .field:first-of-type { grid-column: 1; }
  .c-gen-form .field:nth-of-type(2) { grid-column: 2; }
  .c-gen-submit { grid-column: 1 / -1; width: 220px; }
  .c-gen-note { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .c-meter { width: 56px; }
  .c-batches th:nth-child(5) { display: none; }
  .c-batches tbody td:nth-child(5) { display: none; }
}

/* ==================================================================
   订单：宽表，列多且有一列（外部单号）可以很长
   ------------------------------------------------------------------
   套 .u-table，再钉住短列的宽度 —— 不钉的话浏览器会把「外部单号」
   这种长串按比例分走一半宽度，短列被压成两行。
   ================================================================== */

/* 表格外面统一留一个可横向滚动的壳：窄屏时表格滑，卡片不滑 */
.u-table-wrap { overflow-x: auto; }

/* ---- 订单 ---- */
.o-table { min-width: 820px; }
.o-table th.o-col-id { width: 64px; }
.o-table th.o-col-user { width: 88px; }
.o-table th.o-col-time { width: 160px; }
/* 单号是主键，不换行；金额列靠右已有 .num */
.o-table td.mono { white-space: nowrap; }

/* ==================================================================
   页脚
   ================================================================== */

.colophon {
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--t3);
  font-size: 11.5px;
}

/* ==================================================================
   登录页：左品牌 + 右表单
   ================================================================== */

.login-screen {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: 100vh;
}

.login-side {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 44px 48px;
  background: var(--nav);
  color: #fff;
  overflow: hidden;
}
/* 一层很淡的网格，暗示「工作台」而不是装饰 */
.login-side::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .04) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}
.login-side > * { position: relative; z-index: 1; }
.login-side .logo { width: 36px; height: 36px; font-size: 18px; }
.login-side h2 {
  margin: 0 0 10px;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: .01em;
  line-height: 1.45;
}
.login-side p {
  margin: 0;
  max-width: 34ch;
  color: #a9b6c5;
  font-size: 13px;
  line-height: 1.8;
}
.login-side ul {
  margin: 26px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
  color: #a9b6c5;
  font-size: 12.5px;
}
.login-side li { display: flex; align-items: center; gap: 9px; }
.login-side li::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--primary);
}
.login-side .login-ver { color: #5d6b7a; font-size: 11.5px; letter-spacing: .04em; }

.login-main {
  display: grid;
  place-items: center;
  padding: 32px 24px;
  background: var(--page);
}
.login-form {
  width: min(380px, 100%);
  padding: 32px 32px 28px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .06);
}
.login-form h1 { font-size: 20px; }
.login-form .page-desc { margin-bottom: 22px; }
.login-form .field { margin-bottom: 16px; }
.login-form button { width: 100%; height: 38px; }
.login-form .error { margin: 14px 0 0; }
.login-foot {
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--t3);
  font-size: 11.5px;
  line-height: 1.7;
}

/* ==================================================================
   错误页
   ================================================================== */

.error-screen {
  display: grid;
  place-items: center;
  padding: 40px 20px;
}
/* 未登录时错误页独占一屏（带侧栏的后台里只占内容区那一块） */
.page-bare .error-screen { min-height: 100vh; }
.error-card { width: min(460px, 100%); }
.error-card .card-body { padding: 22px; }
.error-card h1 { font-size: 18px; margin-bottom: 12px; }

/* ==================================================================
   分镜技能（/admin/skills）
   ------------------------------------------------------------------
   ★ 和用户页一样，全部规则挂在 `.skills-page` 下，不外溢。
   ★ 这一页是「分类 + 卡片」结构：左边目录、右边按分类分组的卡片网格，
     每条技能 / 每个素材库一张卡，摘要行就能看全关键信息。
   ================================================================== */

/* ---- 概览条 ---- */
.sk-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.sk-stat {
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  min-width: 0;
}
.sk-stat-label { color: var(--t3); font-size: 12px; }
.sk-stat-value {
  margin-top: 2px;
  color: var(--t1);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}
.sk-stat-sub { margin-left: 2px; color: var(--t3); font-size: 13px; font-weight: 400; }
.sk-stat-foot { margin-top: 2px; color: var(--t3); font-size: 11.5px; }
.sk-stat-foot b { color: var(--t2); font-weight: 600; }

/* ---- 两栏：左目录 + 右内容 ---- */
.sk-layout {
  display: grid;
  grid-template-columns: 196px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.sk-nav {
  position: sticky;
  top: 72px;              /* 顶栏 56 + 一点呼吸 */
  display: flex;
  flex-direction: column;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}
.sk-nav-title {
  padding: 6px 8px 4px;
  color: var(--t3);
  font-size: 11.5px;
  letter-spacing: .04em;
}
.sk-nav-split {
  margin: 6px 4px 2px;
  padding: 6px 4px 0;
  border-top: 1px solid var(--line);
  color: var(--t3);
  font-size: 11.5px;
}
.sk-nav a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 8px;
  border-radius: var(--r);
  color: var(--t2);
  font-size: 13px;
  line-height: 1.3;
}
.sk-nav a span {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sk-nav a em {
  margin-left: auto;
  flex: none;
  padding: 0 5px;
  border-radius: 999px;
  background: #f4f4f5;
  color: var(--t3);
  font-size: 11px;
  font-style: normal;
  line-height: 16px;
  font-variant-numeric: tabular-nums;
}
.sk-nav a:hover { background: #f5f7fa; color: var(--t1); }
.sk-nav a:hover em { background: #ebeef5; }
.sk-nav a.is-empty { color: var(--t3); }
.sk-nav a.is-warn { color: var(--danger); }
.sk-nav a.is-warn em { background: var(--danger-bg); color: var(--danger); }

/* 分类色点：和分类卡标题上的点是同一个，目录里能对上 */
.sk-dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
}
.sk-dot-1 { background: var(--primary); }
.sk-dot-2 { background: #e6a23c; }
.sk-dot-3 { background: #6b4fd8; }
.sk-dot-4 { background: #529b2e; }
.sk-dot-5 { background: #909399; }
.sk-dot-warn { background: var(--danger); }
/* 非分类条目（契约 / 素材库）也占一格，目录里的文字才和分类条目对齐 */
.sk-dot.is-none { background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); }

.sk-main { min-width: 0; }

/* 目录里点锚点跳转时，目标别钻到吸顶的工具栏下面（顶栏 56 + 余量）。
   ★ 目标是 .sk-sec / .sk-cat / 单张卡，都要留出这段，否则跳过去只剩半行标题。 */
.sk-sec, .sk-cat, .sk-item { scroll-margin-top: 72px; }

/* ---- 大区块（交付契约 / 素材库 / 内置技能） ---- */
.sk-sec {
  margin-bottom: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}
.sk-sec-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--head-bg);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.sk-sec-head h2 { margin: 0; font-size: 14px; font-weight: 600; }
/* 计数贴右边，说明文字跟在标题后面 —— 收尾时右对齐才整齐 */
.sk-sec-head .sk-head-num { margin-left: auto; text-align: right; }
.sk-sec-body { padding: 16px; }
.sk-sec-body > :first-child { margin-top: 0; }
.sk-sec-body > :last-child { margin-bottom: 0; }

/* ---- 分类块 ---- */
.sk-cat { margin-top: 18px; }
.sk-cat:first-of-type { margin-top: 0; }
.sk-cat-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.sk-cat-head .sk-dot { transform: translateY(-1px); }
.sk-cat-head h3 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--t1);
}
.sk-cat-head .hint { min-width: 0; }
.sk-cat-num {
  margin-left: auto;
  flex: none;
  padding: 0 7px;
  border-radius: 999px;
  background: #f4f4f5;
  color: var(--t3);
  font-size: 11.5px;
  line-height: 19px;
  font-variant-numeric: tabular-nums;
}
.sk-cat.is-warn .sk-cat-head h3 { color: var(--danger); }
.sk-cat.is-warn .sk-cat-num { background: var(--danger-bg); color: var(--danger); }

/* 卡片网格：技能卡 / 素材库卡 / 提示词卡共用。
   ★ 这里不挂页面作用域 —— 提示词页也整块复用这套骨架，页面自己只补差异
     （见下面「提示词项」一节）。页面内的裸 .sk-* 类名只出现在这两页。 */
.sk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 10px;
  align-items: start;
}

.sk-item {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: #fff;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.sk-item:hover { border-color: var(--line-2); }
.sk-item[open] {
  grid-column: 1 / -1;       /* 展开的卡吃掉整行，正文才有地方写 */
  border-color: var(--line-2);
  box-shadow: var(--shadow);
}

.sk-item > summary {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 11px 13px;
  border-radius: var(--r-lg);
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.sk-item > summary::-webkit-details-marker { display: none; }
.sk-item > summary::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  margin-right: 1px;
  border-right: 1.5px solid var(--t3);
  border-bottom: 1.5px solid var(--t3);
  transform: rotate(-45deg);
  transition: transform .12s ease;
}
.sk-item[open] > summary::before { transform: rotate(45deg); }
.sk-item[open] > summary {
  border-bottom: 1px dashed var(--line);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: var(--head-bg);
}

.sk-ttl {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--t1);
  font-size: 13px;
  font-weight: 600;
}
.sk-key {
  flex: none;
  max-width: 42%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--t3);
}
.sk-flags { display: flex; gap: 4px; flex: none; }
.sk-flag {
  padding: 0 5px;
  border-radius: 3px;
  background: var(--primary-tint);
  color: var(--primary);
  font-size: 10.5px;
  line-height: 16px;
  white-space: nowrap;
}
.sk-right {
  margin-left: auto;
  flex: none;
  padding-left: 6px;
  color: var(--t3);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

/* 只读字段（技能的 category）：灰底、不显示手型，看就知道改不了。
   ★ 选择器必须写成 `input.sk-readonly`：单写 `.sk-readonly` 的权重比全局的
     `input[type=text]` 低，背景色会被白底盖掉。 */
input.sk-readonly,
input.sk-readonly:hover {
  border-color: var(--line);
  background: #f7f8fa;
  color: var(--t3);
  cursor: not-allowed;
}

.sk-body { padding: 14px; }
.sk-body .field { margin-bottom: 12px; }
.sk-body > .field:last-child, .sk-body .group .field:last-child { margin-bottom: 0; }

/* 素材库卡：收起时露出前几个词，一眼认库 */
.sk-preview {
  padding: 0 13px 11px 27px;
  color: var(--t3);
  font-size: 12px;
  line-height: 1.6;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.sk-item[open] > .sk-preview { display: none; }

/* 交付契约整块可折叠 */
.sk-block { border: 1px solid var(--line); border-radius: var(--r-lg); }
.sk-block > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 13px;
  border-radius: var(--r-lg);
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.sk-block > summary::-webkit-details-marker { display: none; }
.sk-block > summary::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  margin-right: 1px;
  border-right: 1.5px solid var(--t3);
  border-bottom: 1.5px solid var(--t3);
  transform: rotate(-45deg);
  transition: transform .12s ease;
}
.sk-block[open] > summary::before { transform: rotate(45deg); }
.sk-block[open] > summary {
  border-bottom: 1px dashed var(--line);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: var(--head-bg);
}
.sk-block > summary strong { font-size: 13px; color: var(--t1); }
.sk-block-body { padding: 14px; }

/* 嵌在技能卡里的 meta 折叠块：去掉老规则的缩进和左边线，按卡片重新排 */
.sk-body details.group.meta,
.sk-body details.group {
  margin-top: 4px;
  padding: 0;
  border-top: 1px dashed var(--line);
  border-left: 0;
  border-bottom: 0;
}
.sk-body details.group > summary { padding: 10px 0 8px; }
.sk-body details.group > summary:hover { background: none; }
.sk-body details.group[open] > summary { border-bottom: 0; background: none; }
.sk-body details.group > summary strong { font-size: 12.5px; }
.sk-body details.group > details.group > summary { padding-left: 0; }

/* 窄屏：目录条横过来，统计条折行 */
@media (max-width: 1180px) {
  .sk-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .sk-layout { grid-template-columns: minmax(0, 1fr); }
  .sk-nav {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
  }
  .sk-nav-title, .sk-nav-split { display: none; }
  .sk-nav a { padding: 6px 9px; }
  .sk-nav a em { margin-left: 4px; }
}
@media (max-width: 720px) {
  .sk-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sk-grid { grid-template-columns: minmax(0, 1fr); }
  .sk-key { display: none; }
  .sk-preview { -webkit-line-clamp: 1; }
}

/* ==================================================================
   窄屏
   ================================================================== */

@media (max-width: 960px) {
  .shell { flex-direction: column; }

  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .brand {
    height: 52px;
    padding: 0 14px;
    border-bottom: 0;
    border-right: 1px solid var(--nav-line);
  }
  .brand-sub { display: none; }
  .side-nav { display: flex; align-items: center; gap: 2px; padding: 0 8px; }
  .side-label, .side-foot { display: none; }
  .side-link {
    height: 52px;
    padding: 0 12px;
    border-left: 0;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
  }
  .side-link.on { border-bottom-color: var(--primary); }

  .topbar { padding: 0 14px; }
  .main { padding: 14px 12px 32px; }
  .form-grid { grid-template-columns: 1fr; }
  .login-screen { grid-template-columns: 1fr; }
  .login-side { display: none; }
  thead th { position: static; }

  /* ★ 窄屏表格：卡片默认 overflow:hidden（为了圆角不露边），手机上表格比卡片宽，
     右边的列会被直接裁掉、也没法滑过去看。这里让卡片自己横向滚动，并把表头行
     钉在左侧，横向滑动时标题不会跟着跑掉。 */
  .card { overflow-x: auto; overflow-y: hidden; }
  .card-head { position: sticky; left: 0; background: var(--card); }

  /* 用户列表：概览折成两列，表格横向滑动交给内层容器（卡片本身不能滚，
     否则工具条会跟着一起滑走） */
  .users-page .u-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .users-page .card.u-card { overflow: hidden; }
  .users-page .u-toolbar { flex-direction: column; align-items: stretch; }
  .users-page .u-search { max-width: none; }
  .users-page .u-seg { margin-left: 0; align-self: flex-start; }
  .users-page .u-table-wrap { overflow-x: auto; }
  .users-page table.u-table { min-width: 720px; }
}

/* 五张概览卡在中等宽度会挤成一排小格子：上排 3 张、下排 2 张各占一半宽，
   最后一行不留空档（3+2 直接排会空出第三格）。
   ★ :not(.ud-stats) —— 用户详情页只有 4 张，按自己那套（4 列 / 2 列）排；
     这条选择器权重比 `.ud-stats` 高，不排除掉就会把详情页也排成 6 格。 */
@media (max-width: 1280px) and (min-width: 961px) {
  .users-page .u-stats:not(.ud-stats) { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .users-page .u-stats:not(.ud-stats) .u-stat { grid-column: span 2; }
  .users-page .u-stats:not(.ud-stats) .u-stat:nth-child(4),
  .users-page .u-stats:not(.ud-stats) .u-stat:nth-child(5) { grid-column: span 3; }
}

@media (max-width: 620px) {
  .users-page .u-stats { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ==================================================================
   版本发布（/admin/versions）
   ------------------------------------------------------------------
   ★ 同用户列表 / 卡密页：规则全部挂在 `.versions-page` 下，不外溢。
     概览卡、徽章、空状态直接复用 `.u-*` 那套通用件，这里只加这一页自己的：
     发版表单（两格宽度差很大）和「平台」那一排小徽章。
   ================================================================== */

/* 概览只有 4 张，别按用户页的 5 列铺 */
.v-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* 值里带单位（「3 / 4」）：小一号、灰色，别和主数字抢 */
.u-stat-unit { margin-left: 3px; color: var(--t3); font-size: 13px; font-weight: 400; }

/* ---- 发版表单 ----
   ★ 两个字段宽度差得很远（版本号几个字符，网盘地址一整屏），用等分两列会把
     版本号撑成一条空荡荡的长框 —— 这里用 grid 钉死版本号那一格。 */
.v-form {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  gap: 0 16px;
  align-items: start;
}
.v-field-version, .v-field-url, .v-field-hot { min-width: 0; }
/* 热更新包占满整行（版本号 + 网盘地址那一行之后）：三个输入框横排太挤，
   而且它是可选的一段，单独一行更容易被理解为「另一件事」。 */
.v-field-hot { grid-column: 1 / -1; padding-top: 18px; }
.v-hot-row { display: flex; gap: 10px; margin-top: 8px; }
.v-hot-row input:first-child { flex: 2 1 0; min-width: 0; }
.v-hot-row input:last-child { flex: 1 1 0; min-width: 0; }
/* 按钮和输入框底边对齐：label 占一行，按钮要落下来才不悬在标题旁 */
.v-submit { padding-top: 24px; }
.v-submit .primary { height: 32px; padding: 0 22px; }

/* ---- 列表 ---- */
/* 列宽按「版本 / 平台 / 网盘地址 / 发布时间 / 操作」排：
   版本号和平台钉死，地址吃掉剩下的宽度。 */
.v-table { min-width: 760px; }
.v-table th:nth-child(1) { width: 168px; }
.v-table th:nth-child(2) { width: 268px; }
.v-table th:nth-child(4) { width: 132px; }
.v-table th:nth-child(5) { width: 132px; }

/* 当前版本那一行：左侧一道蓝边 + 极淡的底色，扫一眼就知道哪条在生效。
   ★ 用 td 上的 inset 阴影而不是给 tr 加 border —— tr 的 border 在
     border-collapse 下画不出来。 */
.v-table tbody tr.is-current td { background: var(--primary-tint-2); }
.v-table tbody tr.is-current td:first-child { box-shadow: inset 2px 0 0 var(--primary); }
.v-table tbody tr.is-current:hover td { background: #eef6ff; }

.v-ver { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.v-no {
  color: var(--t1);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: .01em;
}

/* ---- 平台徽章：四个都画，没发的压灰 ---- */
.v-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.v-chip {
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fafafa;
  color: #c0c4cc;
  font-size: 11px;
  line-height: 18px;
  white-space: nowrap;
}
.v-chip.on {
  border-color: var(--ok-line);
  background: var(--ok-bg);
  color: #529b2e;
}

/* ---- 网盘地址：单行省略，悬停看全文；旁边一个复制键 ---- */
.v-url { display: flex; align-items: center; gap: 8px; min-width: 0; }
td.version-target {
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
td.version-target a {
  overflow: hidden;
  color: var(--t2);
  text-overflow: ellipsis;
  white-space: nowrap;
}
td.version-target a:hover { color: var(--primary); }
.v-copy {
  flex: none;
  height: 22px;
  padding: 0 8px;
  border-radius: 3px;
  background: #f4f4f5;
  color: var(--t3);
  font-size: 11px;
}
.v-copy:hover { border-color: var(--primary); background: #fff; color: var(--primary); }
.v-copy.is-ok { border-color: var(--ok-line); background: var(--ok-bg); color: #529b2e; }
.v-copy.is-bad { border-color: var(--danger-line); background: var(--danger-bg); color: var(--danger); }

.v-ago { margin-top: 2px; color: var(--t3); font-size: 11px; }

/* ---- 行尾两个动作 ---- */
.v-actions { display: inline-flex; align-items: center; gap: 12px; white-space: nowrap; }
.v-act {
  padding: 0;
  border: 0;
  background: none;
  color: var(--t3);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.v-act:hover { background: none; border: 0; color: var(--primary); }
.v-act.is-danger:hover { color: var(--danger); }

/* 中等宽度：地址列让出宽度，别把平台徽章挤成两行 */
@media (max-width: 1280px) {
  td.version-target { max-width: 300px; }
}
@media (max-width: 1080px) {
  .v-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* 三格排不下：按钮换到下一行，占满整行右侧 */
  .v-form { grid-template-columns: 150px minmax(0, 1fr); }
  .v-submit { grid-column: 2; padding-top: 12px; justify-self: end; }
}
@media (max-width: 720px) {
  .v-form { grid-template-columns: minmax(0, 1fr); }
  .v-submit { grid-column: 1; padding-top: 12px; justify-self: stretch; }
  .v-submit .primary { width: 100%; }
  .v-stats { grid-template-columns: 1fr; }
}

/* ==================================================================
   提示词项（/admin/prompts）
   ------------------------------------------------------------------
   ★ 骨架（概览条 / 左目录 / 分区 / 卡片网格）整块复用分镜技能页的 `.sk-*`，
     这里只补这一页独有的三处：字段成组排（4 个字段一屏放得下）、
     风格预设里的分类小标题、模板组卡片底部的删除键。本页自有规则一律
     `.pr-` 前缀，和技能页的 `.sk-*` 不打架。
   ★ 表单字段名是保存的唯一依据（`item.*` / `group.*` / `style.*`），
     样式怎么改都不能动 name。
   ================================================================== */

/* 字段成组：两个一排，extract 那种长模板独占一整行 */
.pr-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
}
.pr-fields > .field { margin-bottom: 0; }
/* 第一格永远是 extract（模板，几行字）—— 让它横跨两列，正文才不用在窄框里挤 */
.pr-fields > .field:first-child { grid-column: 1 / -1; }

/* 模板组卡：元信息（id / platform / 分隔符）走两列小格 */
.pr-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  margin-bottom: 12px;
}
.pr-meta > .field { margin-bottom: 0; }

/* 风格预设里每个类别一小节：标题 + 点 + 字段组 */
.pr-sub { margin-top: 16px; }
.pr-sub:first-of-type { margin-top: 4px; }
.pr-sub-title {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-bottom: 9px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
  color: var(--t1);
  font-size: 12.5px;
  font-weight: 600;
}
.pr-sub-title .sk-dot { transform: translateY(-1px); }
.pr-sub-title .hint { min-width: 0; font-weight: 400; }

/* 卡片底部动作（删除这一组 / 新建模板组） */
.pr-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
/* 网格里单独一个「新建」按钮：不要被拉伸成整行宽的巨块 */
.sk-sec-body > .pr-foot { margin-top: 14px; }
.pr-foot .ghost { height: 28px; font-size: 12.5px; }

/* 「正文为空」这类提示要看得见：其它小徽章是蓝的，警告压成橙 */
.pr-item .sk-flag.is-warn { background: var(--warn-bg); color: #b88230; }

@media (max-width: 1180px) {
  .pr-fields, .pr-meta { grid-template-columns: minmax(0, 1fr); }
}

/* ==================================================================
   模型接口（/admin/llm）
   ------------------------------------------------------------------
   ★ 本页自有规则一律 `.llm-` 前缀（概览卡复用 `.u-*` 那套通用件）。
     左栏改配置、右栏探活 + 说明 —— 改完先存再测，探活挨着配置才顺手。
   ================================================================== */

/* 概览只有 4 张 */
.llm-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.llm-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 348px;
  gap: 16px;
  align-items: start;
}
.llm-main { min-width: 0; }
.llm-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.llm-side .card { margin-bottom: 0; }

/* 上游配置：接口地址整行，Key 和模型并排，超时和额度并排 */
.llm-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 20px;
}
.llm-form-grid .span-2 { grid-column: 1 / -1; }
.llm-form-grid > .field { margin-bottom: 0; }
.llm-hint { margin-top: 4px; }

/* ---- 探活结果：成不成都按同一张块画，只是换个色 ---- */
.llm-result {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: #fafafa;
}
.llm-result.is-ok { border-color: var(--ok-line); background: var(--ok-bg); }
.llm-result.is-bad { border-color: var(--danger-line); background: var(--danger-bg); }
.llm-result-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--t1);
  font-size: 13px;
  font-weight: 600;
}
.llm-result.is-ok .llm-result-head { color: #529b2e; }
.llm-result.is-bad .llm-result-head { color: var(--danger); }
.llm-result-ms {
  margin-left: auto;
  color: var(--t3);
  font-size: 11.5px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.llm-result-row {
  display: flex;
  gap: 8px;
  font-size: 12px;
  line-height: 1.6;
}
.llm-result-row span { flex: none; width: 28px; color: var(--t3); }
.llm-result-row b {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--t2);
  font-weight: 600;
}
.llm-result-url {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed rgba(0, 0, 0, .08);
  color: var(--t3);
  font-size: 11px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.llm-probe-idle {
  margin: 0 0 12px;
  color: var(--t3);
  font-size: 12.5px;
  line-height: 1.65;
}
.llm-probe-idle b { color: var(--t2); }
.llm-probe-form { margin: 0 0 8px; }
.llm-probe-form .ghost { width: 100%; }

.llm-note {
  margin: 0 0 10px;
  color: var(--t3);
  font-size: 12.5px;
  line-height: 1.7;
}
.llm-note:last-child { margin-bottom: 0; }
.llm-note b { color: var(--t2); font-weight: 600; }

@media (max-width: 1180px) {
  .llm-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .llm-grid { grid-template-columns: minmax(0, 1fr); }
  .llm-side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}
@media (max-width: 720px) {
  .llm-stats { grid-template-columns: minmax(0, 1fr); }
  .llm-side { grid-template-columns: minmax(0, 1fr); }
  .llm-form-grid { grid-template-columns: minmax(0, 1fr); }
}
