/* ============================================================
   Lovart2API Console · Bento Dark Design System
   参考 Bento Cards（styles/bento-variables.sass）提炼：
   - 底色 #202020 / 玻璃面 rgba(248,248,248,.04)
   - 内嵌高光 + 多层柔和投影 + blur(50px)
   - 32px 大圆角、顶边高光描边（mask-image 渐变）
   - Rubik 字体、胶囊按钮、等宽数字
   ============================================================ */

/* ---------- 1. Tokens ---------- */
:root {
  --n1: #ffffff;
  --n2: #f8f8f8;
  --n3: #282828;
  --n4: #121212;
  --bg: #202020;

  /* 主题色（默认银白；data-theme 切换） */
  --accent: #f8f8f8;
  --accent-ink: #161616;
  --accent-soft: rgba(248, 248, 248, .16);

  --fg:   rgba(248, 248, 248, .95);
  --fg-2: rgba(248, 248, 248, .70);
  --fg-3: rgba(248, 248, 248, .50);
  --fg-4: rgba(248, 248, 248, .30);

  --panel:      rgba(248, 248, 248, .04);
  --panel-2:    rgba(40, 40, 40, .70);
  --panel-3:    rgba(18, 18, 18, .55);
  --line:       rgba(255, 255, 255, .05);
  --line-2:     rgba(248, 248, 248, .10);
  --line-3:     rgba(248, 248, 248, .25);

  /* 派生面（明/暗两套模式各自覆盖，见文末「18. 明暗模式」） */
  --hover:        rgba(248, 248, 248, .05);
  --hover-2:      rgba(248, 248, 248, .085);
  --hover-3:      rgba(248, 248, 248, .12);
  --hair:         rgba(255, 255, 255, .035);
  --hair-2:       rgba(248, 248, 248, .03);
  --card-edge:    rgba(255, 255, 255, .05);
  --inset-hi:     rgba(248, 248, 248, .06);
  --btn-hover:    rgba(58, 58, 58, .78);
  --input-focus:  rgba(50, 50, 50, .72);
  --opt-bg:       #242424;
  --track:        rgba(248, 248, 248, .12);
  --knob:         rgba(248, 248, 248, .75);
  --knob-on:      #1c1c1c;
  --surface:      rgba(30, 30, 30, .96);
  --toast-bg:     rgba(32, 32, 32, .92);
  --surface-soft: rgba(18, 18, 18, .45);
  --mask:         rgba(10, 10, 10, .55);
  --code-bg:      rgba(12, 12, 12, .62);
  --imgbg:        rgba(10, 10, 10, .4);
  --lib-meta:     rgba(8, 8, 8, .85);
  --sk-a:         rgba(248, 248, 248, .05);
  --sk-b:         rgba(248, 248, 248, .11);
  --glow-1:       rgba(248, 248, 248, .05);
  --glow-2:       rgba(140, 170, 255, .045);
  --tooltip:      rgba(30, 30, 30, .96);
  --scroll:       rgba(248, 248, 248, .12);
  --scroll-hover: rgba(248, 248, 248, .22);
  --border-focus: rgba(248, 248, 248, .38);
  --spinner-track: rgba(248, 248, 248, .14);
  --spinner-head:  rgba(248, 248, 248, .9);

  --ok:   #8fd694;
  --warn: #f0c070;
  --err:  #f08a8a;
  --info: #9cc3ff;

  --shadow-card:
    inset 2px 4px 16px 0 rgba(248, 248, 248, .06),
    0 24px 24px -16px rgba(5, 5, 5, .30),
    0 6px 13px 0 rgba(5, 5, 5, .18),
    0 6px 4px -4px rgba(5, 5, 5, .18),
    0 5px 1.5px -4px rgba(5, 5, 5, .35);
  --shadow-pop:
    0 32px 60px -24px rgba(0, 0, 0, .65),
    0 8px 20px rgba(0, 0, 0, .35);

  --r-lg: 28px;
  --r-md: 20px;
  --r-sm: 14px;
  --r-pill: 999px;

  --sp: 8px;
  --sidebar-w: 236px;

  --ease: cubic-bezier(.22, .61, .36, 1);
  --font: "Rubik", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", -apple-system, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", "JetBrains Mono", Consolas, "Liberation Mono", monospace;

  color-scheme: dark;
}

/* ---------- 2. Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(900px 480px at 12% -8%, var(--glow-1), transparent 62%),
    radial-gradient(760px 420px at 108% 8%, var(--glow-2), transparent 60%);
}
#app { height: 100%; position: relative; z-index: 1; }

h1, h2, h3, h4, p { margin: 0; }
button { font-family: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
::selection { background: var(--accent-soft); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--scroll-hover); background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); }
.muted { color: var(--fg-2); }
.dim { color: var(--fg-3); }
.tiny { font-size: 12px; }
.sm { font-size: 13px; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gap4 { gap: 4px; } .gap8 { gap: 8px; } .gap16 { gap: 16px; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.hidden { display: none !important; }

/* ---------- 3. Layout ---------- */
.shell { display: flex; height: 100%; }

.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  display: flex; flex-direction: column;
  padding: 20px 14px;
  background: var(--surface-soft);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(30px);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 10px 20px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; flex: 0 0 38px;
  display: grid; place-items: center;
  background: linear-gradient(150deg, #f8f8f8, rgba(248, 248, 248, .55));
  color: #141414; font-weight: 600; font-size: 15px; letter-spacing: .02em;
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .8), inset 0 1px 0 rgba(255, 255, 255, .8);
}
.brand-name { font-size: 15px; font-weight: 600; letter-spacing: .01em; }
.brand-sub { font-size: 11px; color: var(--fg-3); letter-spacing: .08em; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  height: 42px; padding: 0 12px; border-radius: 13px;
  color: var(--fg-2); font-size: 13.5px; cursor: pointer; border: 1px solid transparent;
  transition: background .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease);
}
.nav-item svg { width: 17px; height: 17px; flex: 0 0 17px; opacity: .75; }
.nav-item:hover { background: var(--hover); color: var(--fg); }
.nav-item.on {
  background: var(--panel); color: var(--fg);
  border-color: var(--line-2);
  box-shadow: inset 2px 4px 14px rgba(248, 248, 248, .05);
}
.nav-item.on svg { opacity: 1; }
.nav-badge {
  margin-left: auto; font-size: 11px; padding: 1px 7px; border-radius: 999px;
  background: var(--hover-2); color: var(--fg-2); font-variant-numeric: tabular-nums;
}

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 10px; }
.side-card {
  border-radius: var(--r-sm); padding: 10px 12px;
  background: var(--hair-2); border: 1px solid var(--line);
  font-size: 11.5px; color: var(--fg-3); line-height: 1.6;
}
.side-card b { color: var(--fg-2); font-weight: 500; }

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 26px 34px 18px;
}
.page-title { font-size: 25px; font-weight: 500; letter-spacing: .005em; }
.page-sub { font-size: 12.5px; color: var(--fg-3); margin-top: 5px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.content { flex: 1 1 auto; overflow-y: auto; padding: 6px 34px 44px; scroll-behavior: smooth; }
.content-inner { max-width: 1280px; margin: 0 auto; }

/* ---------- 4. Card / glass ---------- */
.card {
  position: relative; border-radius: var(--r-lg);
  background: var(--panel);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(50px);
  -webkit-backdrop-filter: blur(50px);
}
.card::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  border: 1.5px solid var(--card-edge);
  -webkit-mask-image: linear-gradient(160deg, black, transparent 50%);
  mask-image: linear-gradient(160deg, black, transparent 50%);
}
.card-pad { padding: 22px 24px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 20px 24px 0; }
.card-title { font-size: 15px; font-weight: 500; }
.card-sub { font-size: 12px; color: var(--fg-3); }
.card-body { padding: 16px 24px 22px; }

/* ---------- 5. Stat ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat { padding: 20px 22px; display: flex; flex-direction: column; gap: 10px; min-height: 128px; }
.stat-label { font-size: 12px; color: var(--fg-3); display: flex; align-items: center; gap: 7px; }
.stat-value { font-size: 32px; font-weight: 500; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.stat-foot { font-size: 11.5px; color: var(--fg-3); display: flex; align-items: center; gap: 8px; }
.stat-spark { display: flex; gap: 3px; align-items: flex-end; height: 22px; }
.stat-spark i { width: 4px; border-radius: 2px; background: rgba(248, 248, 248, .22); }

/* ---------- 6. Buttons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 18px; border: 0; border-radius: var(--r-pill);
  font-size: 13px; font-weight: 500; color: var(--fg-2); cursor: pointer; overflow: hidden;
  background: var(--panel-2);
  box-shadow: inset 2px 4px 16px 0 var(--inset-hi);
  backdrop-filter: blur(50px);
  transition: color .18s var(--ease), transform .18s var(--ease), background .18s var(--ease), box-shadow .18s var(--ease);
  white-space: nowrap;
}
.btn::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  border: 1px solid var(--line-3); opacity: .28;
  -webkit-mask-image: linear-gradient(170deg, black, transparent 50%);
  mask-image: linear-gradient(170deg, black, transparent 50%);
}
.btn:hover { color: var(--fg); background: var(--btn-hover); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 2px solid var(--line-3); outline-offset: 2px; }
.btn[disabled] { opacity: .42; cursor: not-allowed; transform: none; }
.btn svg { width: 15px; height: 15px; }

.btn.primary {
  background: linear-gradient(180deg, #ffffff, #ededed); color: #161616; font-weight: 600;
  box-shadow: 0 12px 26px -12px rgba(255, 255, 255, .38), inset 0 1px 0 rgba(255, 255, 255, .9);
}
.btn.primary:hover { background: #ffffff; color: #000; }
.btn.primary::after { border-color: rgba(255, 255, 255, .9); opacity: .5; }

.btn.danger { color: var(--err); }
.btn.danger:hover { color: var(--err); background: color-mix(in srgb, var(--err) 13%, transparent); }

.btn.ghost { background: transparent; box-shadow: none; border: 1px solid var(--line-2); }
.btn.ghost:hover { background: var(--hover); }

.btn.sm { height: 30px; padding: 0 12px; font-size: 12px; }
.btn.icon { width: 30px; height: 30px; padding: 0; border-radius: 50%; }
.btn.lg { height: 48px; padding: 0 26px; font-size: 14px; }

/* ---------- 7. Inputs ---------- */
.field { display: flex; flex-direction: column; gap: 7px; }
.label { font-size: 12px; color: var(--fg-3); display: flex; align-items: center; gap: 6px; }
.label .req { color: var(--err); }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--panel-2); color: var(--fg-2); font-family: inherit; font-size: 13.5px;
  padding: 10px 14px; transition: border-color .18s var(--ease), background .18s var(--ease), box-shadow .18s var(--ease);
}
.input, .select { height: 42px; padding: 0 14px; }
.textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
.input::placeholder, .textarea::placeholder { color: var(--fg-4); }
.input:hover, .textarea:hover, .select:hover { border-color: var(--line-3); }
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--border-focus); color: var(--fg);
  background: var(--input-focus);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.select { appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer; }
.select option { background: var(--opt-bg); color: var(--fg); }
.select-wrap { position: relative; }
.select-wrap::after {
  content: ""; position: absolute; right: 14px; top: 50%; width: 6px; height: 6px;
  border-right: 1.5px solid var(--fg-3); border-bottom: 1.5px solid var(--fg-3);
  transform: translateY(-70%) rotate(45deg); pointer-events: none;
}
.hint { font-size: 11.5px; color: var(--fg-4); }

/* 开关 */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch-track {
  width: 40px; height: 22px; border-radius: 999px; position: relative;
  background: var(--track); border: 1px solid var(--line-2);
  transition: background .2s var(--ease), border-color .2s var(--ease);
}
.switch-track i {
  position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--knob); transition: transform .2s var(--ease), background .2s var(--ease);
}
.switch.on .switch-track { background: rgba(248, 248, 248, .9); border-color: transparent; }
.switch.on .switch-track i { transform: translateX(18px); background: var(--knob-on); }
.switch-text { font-size: 12.5px; color: var(--fg-2); }

/* 分段选择 */
.seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: var(--r-pill); background: var(--panel-3); border: 1px solid var(--line); }
.seg button {
  height: 30px; padding: 0 16px; border: 0; border-radius: 999px; cursor: pointer;
  background: transparent; color: var(--fg-3); font-size: 12.5px; font-weight: 500;
  transition: all .18s var(--ease);
}
.seg button:hover { color: var(--fg-2); }
.seg button.on { background: rgba(248, 248, 248, .92); color: #161616; }

/* ---------- 8. Chips / badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 11px; border-radius: 999px;
  font-size: 11.5px; color: var(--fg-2);
  background: var(--hover-2); border: 1px solid var(--line);
}
.chip.filter { cursor: pointer; transition: all .18s var(--ease); }
.chip.filter:hover { border-color: var(--line-3); color: var(--fg); }
.chip.filter.on { background: rgba(248, 248, 248, .9); color: #161616; border-color: transparent; font-weight: 500; }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; background: var(--fg-3); }
.dot.ok { background: var(--ok); box-shadow: 0 0 10px color-mix(in srgb, var(--ok) 55%, transparent); }
.dot.warn { background: var(--warn); box-shadow: 0 0 10px color-mix(in srgb, var(--warn) 50%, transparent); }
.dot.err { background: var(--err); box-shadow: 0 0 10px color-mix(in srgb, var(--err) 50%, transparent); }
.dot.info { background: var(--info); }
.dot.live { animation: pulse 1.8s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px;
  border-radius: 7px; font-size: 11px; font-weight: 500;
  background: var(--hover-2); color: var(--fg-2);
}
.badge.ok  { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.badge.warn{ background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.badge.err { background: color-mix(in srgb, var(--err) 14%, transparent); color: var(--err); }
.badge.info{ background: color-mix(in srgb, var(--info) 13%, transparent); color: var(--info); }
.badge.price { background: var(--hover-3); color: var(--fg); font-variant-numeric: tabular-nums; }

/* ---------- 9. Table ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; font-size: 11px; font-weight: 500; letter-spacing: .06em;
  text-transform: uppercase; color: var(--fg-4); padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.tbl td { padding: 13px 14px; border-bottom: 1px solid var(--hair); color: var(--fg-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .15s var(--ease); }
.tbl tbody tr:hover { background: var(--hair-2); }
.tbl .strong { color: var(--fg); font-weight: 500; }
.tbl .actions { display: flex; gap: 6px; justify-content: flex-end; }
.tbl-wrap { overflow-x: auto; }

/* ---------- 10. Toast / Modal / Overlay ---------- */
/* 完成提示固定在右上角（后台任务完成时最先看到的位置） */
.toasts { position: fixed; right: 22px; top: 18px; z-index: 90; display: flex; flex-direction: column; gap: 10px; }
.toast {
  min-width: 260px; max-width: 380px; padding: 13px 16px; border-radius: var(--r-md);
  background: var(--toast-bg); border: 1px solid var(--line-2);
  box-shadow: var(--shadow-pop); backdrop-filter: blur(30px);
  display: flex; gap: 11px; align-items: flex-start; font-size: 13px; color: var(--fg-2);
  animation: toast-in .28s var(--ease);
}
.toast b { color: var(--fg); font-weight: 500; display: block; margin-bottom: 2px; }
.toast.err { border-color: color-mix(in srgb, var(--err) 38%, transparent); }
.toast.ok { border-color: color-mix(in srgb, var(--ok) 34%, transparent); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px) scale(.98); } to { opacity: 1; transform: none; } }

.mask {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 32px;
  background: var(--mask); backdrop-filter: blur(14px);
  animation: fade-in .2s var(--ease);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(560px, 100%); max-height: 84vh; display: flex; flex-direction: column;
  border-radius: var(--r-lg); background: var(--surface);
  border: 1px solid var(--line-2); box-shadow: var(--shadow-pop);
  animation: modal-in .26s var(--ease);
}
.modal.wide { width: min(920px, 100%); }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 20px 24px 0; }
.modal-title { font-size: 16px; font-weight: 500; }
.modal-body { padding: 18px 24px; overflow-y: auto; }
.modal-foot { padding: 0 24px 22px; display: flex; gap: 10px; justify-content: flex-end; }

.busy {
  position: fixed; inset: 0; z-index: 85; display: grid; place-items: center;
  background: var(--mask); backdrop-filter: blur(10px);
}
.busy-card {
  width: 340px; padding: 26px 28px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow-pop);
  display: flex; flex-direction: column; gap: 14px; align-items: center; text-align: center;
}
.spinner {
  display: inline-block; flex: 0 0 auto;
  width: 34px; height: 34px; border-radius: 50%;
  border: 2.5px solid var(--spinner-track); border-top-color: var(--spinner-head);
  animation: spin 1s linear infinite;
}
.spinner.xs { width: 14px; height: 14px; border-width: 1.8px; }
.spinner.sm { width: 22px; height: 22px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress { width: 100%; height: 4px; border-radius: 4px; background: var(--hover-3); overflow: hidden; }
.progress i { display: block; height: 100%; width: 36%; border-radius: 4px; background: linear-gradient(90deg, rgba(248,248,248,.25), rgba(248,248,248,.85), rgba(248,248,248,.25)); animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-110%); } 100% { transform: translateX(320%); } }

/* ---------- 11. Page: dashboard ---------- */
.grid { display: grid; gap: 16px; }
.grid.dash { grid-template-columns: repeat(12, 1fr); }
.col-4 { grid-column: span 4; } .col-5 { grid-column: span 5; }
.col-6 { grid-column: span 6; } .col-7 { grid-column: span 7; }
.col-8 { grid-column: span 8; } .col-12 { grid-column: span 12; }

.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.quick .btn { justify-content: flex-start; height: 44px; padding: 0 16px; border-radius: var(--r-md); }
.quick .btn svg { opacity: .8; }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--hair); }
.list-item:last-child { border-bottom: 0; }
.thumb {
  width: 46px; height: 46px; border-radius: 12px; flex: 0 0 46px; overflow: hidden;
  background: var(--hover); border: 1px solid var(--line);
  display: grid; place-items: center;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.lg { width: 62px; height: 62px; flex-basis: 62px; border-radius: 14px; }

.bar { height: 5px; border-radius: 4px; background: var(--hover-3); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 4px; background: rgba(248, 248, 248, .55); }

/* ---------- 12. Page: studio ---------- */
.studio { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 16px; align-items: start; }
.stage {
  border-radius: var(--r-lg); overflow: hidden; position: relative; min-height: 420px;
  display: grid; place-items: center; background: var(--surface-soft); border: 1px solid var(--line);
}
.stage img { width: 100%; height: 100%; max-height: 620px; object-fit: contain; background: var(--imgbg); }
.stage-empty { display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--fg-4); padding: 40px; text-align: center; }
.stage-empty svg { width: 40px; height: 40px; opacity: .5; }
.stage-tag {
  position: absolute; left: 14px; top: 14px; z-index: 3;
  display: flex; gap: 6px; align-items: center;
}

.kv { display: grid; grid-template-columns: 96px 1fr; gap: 8px 14px; font-size: 12.5px; }
.kv dt { color: var(--fg-3); }
.kv dd { margin: 0; color: var(--fg-2); overflow-wrap: anywhere; }

.copy-field {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: var(--r-sm);
  background: var(--panel-3); border: 1px solid var(--line); font-size: 12px; color: var(--fg-2);
}
.copy-field span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; }
.copy-field button { border: 0; background: transparent; color: var(--fg-3); cursor: pointer; display: grid; place-items: center; }
.copy-field button:hover { color: var(--fg); }

/* ---------- 13. Page: library ---------- */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 14px; }
.lib-card {
  position: relative; border-radius: 18px; overflow: hidden; cursor: zoom-in;
  background: var(--surface-soft); border: 1px solid var(--line);
  aspect-ratio: 1 / 1; transition: transform .22s var(--ease), box-shadow .22s var(--ease), border-color .22s var(--ease);
}
.lib-card:hover { transform: translateY(-3px); box-shadow: 0 22px 40px -20px rgba(0, 0, 0, .8); border-color: var(--line-2); }
.lib-card img { width: 100%; height: 100%; object-fit: cover; }
.lib-meta {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 12px 10px;
  background: linear-gradient(180deg, transparent, var(--lib-meta));
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 11px; color: var(--fg-2);
}

/* ---------- 14. Page: jobs ---------- */
.steps { display: flex; flex-direction: column; gap: 10px; }
.step-row { display: flex; gap: 10px; align-items: center; }
.step-idx {
  width: 26px; height: 26px; border-radius: 50%; flex: 0 0 26px; display: grid; place-items: center;
  background: var(--hover-2); font-size: 11.5px; color: var(--fg-2);
}
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item { display: flex; gap: 14px; }
.tl-rail { display: flex; flex-direction: column; align-items: center; }
.tl-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--fg-4); margin-top: 5px; }
.tl-dot.ok { background: var(--ok); box-shadow: 0 0 10px color-mix(in srgb, var(--ok) 50%, transparent); }
.tl-dot.err { background: var(--err); }
.tl-line { flex: 1 1 auto; width: 1px; background: var(--line-2); margin: 4px 0; }
.tl-body { padding-bottom: 16px; flex: 1 1 auto; min-width: 0; }

/* ---------- 15. utils / responsive ---------- */
.skeleton {
  border-radius: 10px; background: linear-gradient(90deg, var(--sk-a) 25%, var(--sk-b) 37%, var(--sk-a) 63%);
  background-size: 400% 100%; animation: sk 1.3s ease infinite;
}
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 46px 20px; color: var(--fg-4); text-align: center; }
.empty svg { width: 34px; height: 34px; opacity: .55; }
.split { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

@media (max-width: 1180px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .studio { grid-template-columns: 1fr; }
  .col-4, .col-5, .col-6, .col-7, .col-8 { grid-column: span 12; }
}
@media (max-width: 900px) {
  .sidebar { display: none; }
  .topbar { padding: 18px 18px 12px; }
  .content { padding: 4px 18px 32px; }
  .stat-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   16. 主题换肤（data-theme）
   ============================================================ */
:root[data-theme="teal"]   { --accent: #5DCAA5; --accent-ink: #06231c; --accent-soft: rgba(93, 202, 165, .18); }
:root[data-theme="violet"] { --accent: #AFA9EC; --accent-ink: #17143b; --accent-soft: rgba(175, 169, 236, .18); }
:root[data-theme="amber"]  { --accent: #EF9F27; --accent-ink: #2b1c04; --accent-soft: rgba(239, 159, 39, .18); }
:root[data-theme="rose"]   { --accent: #ED93B1; --accent-ink: #3a0f1f; --accent-soft: rgba(237, 147, 177, .18); }

.brand-mark { background: linear-gradient(150deg, var(--accent), color-mix(in srgb, var(--accent) 62%, #000)); color: var(--accent-ink); }
.nav-item.on { border-color: var(--accent-soft); }
.nav-item.on svg { color: var(--accent); opacity: 1; }
.btn.primary {
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 84%, #000));
  color: var(--accent-ink);
  box-shadow: 0 12px 26px -12px color-mix(in srgb, var(--accent) 45%, transparent), inset 0 1px 0 rgba(255, 255, 255, .55);
}
.btn.primary:hover { background: var(--accent); color: var(--accent-ink); }
.btn.primary::after { border-color: color-mix(in srgb, var(--accent) 80%, #fff); opacity: .45; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.chip.filter.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.switch.on .switch-track { background: var(--accent); }
.switch.on .switch-track i { background: var(--accent-ink); }
.bar i, .progress i { background: var(--accent); opacity: .9; }
.stat-spark i { background: var(--accent-soft); }
::selection { background: var(--accent-soft); }
.input:focus, .textarea:focus, .select:focus { box-shadow: 0 0 0 3px var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 46%, transparent); }
.dot.ok, .badge.ok { color: var(--ok); }
a.plain:hover { color: var(--accent); }

.theme-pop {
  position: absolute; right: 0; top: 42px; z-index: 60; padding: 12px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow-pop);
  display: flex; gap: 8px; animation: modal-in .2s var(--ease);
}
.theme-sw {
  width: 26px; height: 26px; border-radius: 50%; cursor: pointer; border: 2px solid transparent;
  transition: transform .16s var(--ease), border-color .16s var(--ease);
}
.theme-sw:hover { transform: scale(1.12); }
.theme-sw.on { border-color: var(--fg); }
.theme-wrap { position: relative; }

/* ============================================================
   17. 登录页（品牌分栏 + 光晕背景）
   ============================================================ */
.login-wrap { height: 100%; display: grid; place-items: center; position: relative; }

.login-shell { height: 100%; position: relative; overflow: hidden; display: grid; place-items: center; }
.login-aurora { position: absolute; inset: 0; pointer-events: none; filter: blur(96px); opacity: .55; }
.login-aurora i { position: absolute; display: block; border-radius: 50%; }
.login-aurora .o1 { width: 560px; height: 560px; left: -2%; top: 2%;
  background: radial-gradient(circle at 40% 40%, var(--accent-soft), transparent 68%); }
.login-aurora .o2 { width: 500px; height: 500px; right: 2%; top: -8%;
  background: radial-gradient(circle at 55% 45%, var(--aurora-2), transparent 68%); }
.login-aurora .o3 { width: 700px; height: 520px; left: 32%; bottom: -22%;
  background: radial-gradient(circle at 50% 50%, var(--glow-1), transparent 70%); }

.login-grid {
  position: relative; z-index: 2; width: min(1160px, 100%); padding: 32px;
  display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr);
  gap: 56px; align-items: center;
}
.login-intro { display: flex; flex-direction: column; gap: 20px; padding-left: 8px; }
.brand-mark.lg { width: 46px; height: 46px; flex-basis: 46px; border-radius: 14px; font-size: 16px; }
.login-h1 { font-size: 40px; line-height: 1.2; font-weight: 500; letter-spacing: -.012em; margin-top: 8px; }
.login-h1 .glow {
  background: linear-gradient(100deg, var(--accent), color-mix(in srgb, var(--accent) 50%, #8fb3ff));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.login-lead { font-size: 14px; color: var(--fg-3); }
.login-feats { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.login-feats li { display: flex; align-items: flex-start; gap: 12px; }
.feat-ico {
  width: 32px; height: 32px; flex: 0 0 32px; border-radius: 10px; display: grid; place-items: center;
  background: var(--hover); border: 1px solid var(--line-2); color: var(--accent);
}
.login-feats b { display: block; font-size: 13.5px; font-weight: 500; color: var(--fg); }
.login-feats span { font-size: 12px; color: var(--fg-3); }
.login-foot { display: flex; align-items: center; gap: 12px; padding-top: 14px; }

.login-panel { display: grid; place-items: center; }
.login-card {
  width: 100%; max-width: 402px; padding: 32px 30px 24px; border-radius: 30px;
  background: var(--surface-soft);
  box-shadow: var(--shadow-card); backdrop-filter: blur(50px);
  position: relative;
}
.login-card::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  border: 1.5px solid var(--card-edge);
  -webkit-mask-image: linear-gradient(160deg, black, transparent 50%);
  mask-image: linear-gradient(160deg, black, transparent 50%);
}
.login-field {
  display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px;
  border-radius: var(--r-sm); background: var(--panel-2); border: 1px solid var(--line-2);
  transition: border-color .18s var(--ease), background .18s var(--ease), box-shadow .18s var(--ease);
  cursor: text;
}
.login-field > svg { color: var(--fg-4); flex: 0 0 auto; }
.login-field input {
  flex: 1 1 auto; min-width: 0; height: 100%; border: 0; background: transparent; outline: none;
  color: var(--fg); font-family: inherit; font-size: 13.5px;
}
.login-field input::placeholder { color: var(--fg-4); }
.login-field:hover { border-color: var(--line-3); }
.login-field:focus-within {
  border-color: color-mix(in srgb, var(--accent) 46%, transparent);
  background: var(--input-focus);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.login-field .eye {
  border: 0; background: transparent; color: var(--fg-4); cursor: pointer;
  display: grid; place-items: center; padding: 4px; border-radius: 8px;
}
.login-field .eye:hover { color: var(--fg-2); }
.login-card-foot {
  display: flex; align-items: center; gap: 8px; margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--line);
}
.login-title { font-size: 21px; font-weight: 500; }
.login-sub { font-size: 12.5px; color: var(--fg-3); margin-top: 6px; }
.login-err {
  padding: 10px 12px; border-radius: 12px; font-size: 12.5px;
  background: color-mix(in srgb, var(--err) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--err) 32%, transparent); color: var(--err);
}
@media (max-width: 1023px) {
  .login-grid { grid-template-columns: 1fr; gap: 26px; padding: 24px; }
  .login-intro { padding-left: 0; }
  .login-h1 { font-size: 28px; }
  .login-feats, .login-foot { display: none; }
}

/* ============================================================
   17b. 顶栏「后台任务」浮层
   ============================================================ */
.bg-wrap { position: relative; }
.btn.bg-hot { color: var(--fg); border-color: var(--accent-soft); }
.bg-pop {
  position: absolute; right: 0; top: 46px; z-index: 95; width: 392px;
  padding: 14px 16px 12px; border-radius: 22px;
  background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow-pop);
  animation: modal-in .2s var(--ease);
}
.bg-pop-head {
  display: flex; align-items: center; gap: 10px; padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.bg-pop-head b { font-size: 13.5px; font-weight: 500; }
.bg-list { max-height: 330px; overflow-y: auto; }
.bg-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 0;
  border-bottom: 1px solid var(--hair);
}
.bg-item:last-child { border-bottom: 0; }
.bg-item .dot { margin-top: 6px; }
.bg-right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: 0 0 auto; padding-left: 6px; }
.bg-pop-foot {
  display: flex; align-items: center; gap: 10px; padding-top: 10px;
  border-top: 1px solid var(--line);
}

/* ============================================================
   17c. 调用记录筛选条
   ============================================================ */
.filter-bar {
  display: grid; align-items: end; gap: 12px;
  grid-template-columns: minmax(170px, 1.5fr) repeat(5, minmax(118px, 1fr)) auto;
}
.filter-actions { gap: 8px; }
@media (max-width: 1240px) { .filter-bar { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .filter-bar { grid-template-columns: 1fr; } }

/* ============================================================
   18. 密钥 / 文档 / 配置 页面
   ============================================================ */
.key-cell { display: flex; align-items: center; gap: 8px; }
.key-mono { font-family: var(--mono); font-size: 12px; letter-spacing: .01em; }
.key-reveal {
  background: var(--hover-2); border: 1px dashed var(--line-3);
  padding: 10px 12px; border-radius: 12px; font-family: var(--mono); font-size: 12.5px;
  color: var(--fg); word-break: break-all; line-height: 1.7;
}
.notice {
  padding: 11px 14px; border-radius: 14px; font-size: 12.5px; line-height: 1.7;
  background: color-mix(in srgb, var(--warn) 11%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); color: var(--warn);
}

.doc-sec { display: grid; gap: 16px; }
.doc-ep { display: flex; align-items: center; gap: 10px; }
.method {
  font-family: var(--mono); font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 7px;
  background: var(--hover-3); color: var(--fg);
}
.method.get { background: color-mix(in srgb, var(--info) 17%, transparent); color: var(--info); }
.method.post { background: color-mix(in srgb, var(--ok) 17%, transparent); color: var(--ok); }
.method.del { background: color-mix(in srgb, var(--err) 17%, transparent); color: var(--err); }
.code {
  position: relative; border-radius: 14px; overflow: hidden;
  background: var(--code-bg); border: 1px solid var(--line);
  font-family: var(--mono); font-size: 12px; line-height: 1.75; color: var(--fg-2);
  padding: 13px 15px; white-space: pre; overflow-x: auto;
}
.code .tag {
  position: absolute; right: 10px; top: 8px; font-family: var(--font); font-size: 10.5px;
  color: var(--fg-4); letter-spacing: .06em; text-transform: uppercase;
}
.param-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.param-tbl th { text-align: left; font-size: 11px; color: var(--fg-4); text-transform: uppercase;
  letter-spacing: .05em; padding: 8px 10px; border-bottom: 1px solid var(--line); font-weight: 500; }
.param-tbl td { padding: 9px 10px; border-bottom: 1px solid var(--hair); color: var(--fg-2); vertical-align: top; }
.param-tbl tr:last-child td { border-bottom: 0; }
.param-tbl .nm { font-family: var(--mono); color: var(--fg); }
.param-tbl .ty { color: var(--fg-3); font-family: var(--mono); font-size: 11.5px; }
.req-y { color: var(--err); font-size: 11px; }
.req-n { color: var(--fg-4); font-size: 11px; }

.cfg-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.cfg-row {
  display: flex; align-items: center; gap: 14px; padding: 14px 0;
  border-bottom: 1px solid var(--hair);
}
.cfg-row:last-child { border-bottom: 0; }
.cfg-row .grow { display: flex; flex-direction: column; gap: 3px; }
.cfg-name { font-size: 13.5px; color: var(--fg); }
.cfg-desc { font-size: 11.5px; color: var(--fg-4); }
@media (max-width: 1023px) { .cfg-grid { grid-template-columns: 1fr; } }

/* ============================================================
   19. 明亮 / 暗色 模式（data-mode="light"）
   —— 所有颜色都走 token，切换即整站换肤；配合 html.theme-anim 做过渡
   ============================================================ */
:root[data-mode="light"] {
  color-scheme: light;

  --bg: #eef0f4;

  --fg:   rgba(22, 22, 26, .95);
  --fg-2: rgba(22, 22, 26, .74);
  --fg-3: rgba(22, 22, 26, .54);
  --fg-4: rgba(22, 22, 26, .42);   /* 最弱一档文字：亮色下略微加深，与暗色模式观感一致 */

  --panel:      rgba(255, 255, 255, .74);
  --panel-2:    rgba(255, 255, 255, .92);
  --panel-3:    rgba(255, 255, 255, .62);
  --line:       rgba(20, 20, 26, .08);
  --line-2:     rgba(20, 20, 26, .12);
  --line-3:     rgba(20, 20, 26, .22);

  --hover:        rgba(20, 20, 26, .05);
  --hover-2:      rgba(20, 20, 26, .075);
  --hover-3:      rgba(20, 20, 26, .12);
  --hair:         rgba(20, 20, 26, .07);
  --hair-2:       rgba(20, 20, 26, .032);
  --card-edge:    rgba(255, 255, 255, .85);
  --inset-hi:     rgba(255, 255, 255, .9);
  --btn-hover:    #ffffff;
  --input-focus:  #ffffff;
  --opt-bg:       #ffffff;
  --track:        rgba(20, 20, 26, .16);
  --knob:         #ffffff;
  --knob-on:      #ffffff;
  --surface:      rgba(255, 255, 255, .99);
  --toast-bg:     rgba(255, 255, 255, .97);
  --surface-soft: rgba(255, 255, 255, .68);
  --mask:         rgba(70, 74, 84, .34);
  --code-bg:      rgba(20, 20, 26, .045);
  --imgbg:        rgba(20, 20, 26, .06);
  --lib-meta:     rgba(14, 14, 18, .78);
  --sk-a:         rgba(20, 20, 26, .05);
  --sk-b:         rgba(20, 20, 26, .1);
  --glow-1:       rgba(90, 120, 255, .07);
  --glow-2:       rgba(140, 170, 255, .12);
  --aurora-2:     rgba(140, 170, 255, .3);
  --tooltip:      rgba(255, 255, 255, .99);
  --scroll:       rgba(20, 20, 26, .16);
  --scroll-hover: rgba(20, 20, 26, .28);
  --border-focus: rgba(20, 20, 26, .34);
  --spinner-track: rgba(20, 20, 26, .14);
  --spinner-head:  rgba(20, 20, 26, .8);

  /* 状态色：亮色模式用深色版，保证在白底上可读 */
  --ok:   #1c7f4b;
  --warn: #a86a06;
  --err:  #c93a3a;
  --info: #2c66c9;

  --shadow-card:
    inset 0 1px 0 0 rgba(255, 255, 255, .9),
    0 18px 38px -26px rgba(18, 22, 40, .28),
    0 6px 14px -10px rgba(18, 22, 40, .16),
    0 2px 4px -2px rgba(18, 22, 40, .08);
  --shadow-pop:
    0 30px 60px -26px rgba(18, 22, 40, .30),
    0 8px 20px rgba(18, 22, 40, .14);
}
/* 亮色模式下的主题色（用更深的色，保证在浅底上可读） */
:root[data-mode="light"]                                   { --accent: #1c1c1e; --accent-ink: #ffffff; --accent-soft: rgba(20, 20, 26, .14); }
:root[data-mode="light"][data-theme="teal"]                { --accent: #2f9e7c; --accent-ink: #ffffff; --accent-soft: rgba(47, 158, 124, .18); }
:root[data-mode="light"][data-theme="violet"]              { --accent: #6f66d9; --accent-ink: #ffffff; --accent-soft: rgba(111, 102, 217, .18); }
:root[data-mode="light"][data-theme="amber"]               { --accent: #d18411; --accent-ink: #ffffff; --accent-soft: rgba(209, 132, 17, .18); }
:root[data-mode="light"][data-theme="rose"]                { --accent: #d95f88; --accent-ink: #ffffff; --accent-soft: rgba(217, 95, 136, .18); }

/* 亮色下按钮内高光 / 主按钮阴影微调 */
:root[data-mode="light"] .btn { box-shadow: 0 1px 2px rgba(18, 22, 40, .06), inset 0 1px 0 rgba(255, 255, 255, .9); }
:root[data-mode="light"] .btn.primary {
  box-shadow: 0 12px 26px -14px color-mix(in srgb, var(--accent) 55%, transparent),
              inset 0 1px 0 rgba(255, 255, 255, .35);
}
:root[data-mode="light"] .nav-item.on { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9); }
:root[data-mode="light"] .card::after { border-color: rgba(255, 255, 255, .9); }
:root[data-mode="light"] .skeleton { background-size: 400% 100%; }

/* 模式切换过渡：给整棵树临时挂上颜色过渡（600ms 后移除，避免长期影响动画） */
html.theme-anim,
html.theme-anim *,
html.theme-anim *::before,
html.theme-anim *::after {
  transition: background-color .46s var(--ease), color .46s var(--ease),
              border-color .46s var(--ease), box-shadow .46s var(--ease),
              fill .46s var(--ease), stroke .46s var(--ease) !important;
}

/* 主题面板：明暗切换 + 主题色 */
.theme-pop { flex-direction: column; gap: 12px; padding: 14px; width: 210px; }
.theme-mode { display: flex; gap: 4px; padding: 4px; border-radius: var(--r-pill); background: var(--panel-3); border: 1px solid var(--line); }
.theme-mode button {
  flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; border: 0; border-radius: 999px; cursor: pointer; background: transparent;
  color: var(--fg-3); font-family: inherit; font-size: 12.5px; font-weight: 500;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.theme-mode button:hover { color: var(--fg-2); }
.theme-mode button.on { background: var(--accent); color: var(--accent-ink); }
.theme-pop .theme-row { display: flex; gap: 8px; }
.theme-label { font-size: 11px; color: var(--fg-4); letter-spacing: .04em; }

/* ============================================================
   20. 按钮加载态 / 代码块折叠
   ============================================================ */
.btn.loading { pointer-events: none; color: var(--fg-4) !important; }
.btn.loading::before {
  content: ""; position: absolute; left: 50%; top: 50%; z-index: 3;
  width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%;
  border: 1.8px solid var(--spinner-track); border-top-color: var(--spinner-head);
  animation: spin .85s linear infinite;
}
.btn.primary.loading::before { border-color: rgba(0, 0, 0, .16); border-top-color: rgba(0, 0, 0, .72); }
.btn.loading svg { opacity: .28; }
.spinner-inline {
  display: inline-block; width: 13px; height: 13px; vertical-align: -2px; margin-right: 6px;
  border-radius: 50%; border: 1.8px solid var(--spinner-track); border-top-color: var(--spinner-head);
  animation: spin .85s linear infinite;
}

.cc { position: relative; margin-top: 12px; }
.cc-body { overflow: hidden; transition: max-height .42s var(--ease); }
.cc.collapsed .cc-body { -webkit-mask-image: linear-gradient(180deg, black 55%, transparent); mask-image: linear-gradient(180deg, black 55%, transparent); }
.cc-toggle {
  display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%;
  height: 28px; margin-top: 6px; border: 1px solid var(--line-2); border-radius: var(--r-pill);
  background: var(--panel-2); color: var(--fg-3); font-family: inherit; font-size: 11.5px;
  cursor: pointer; transition: color .18s var(--ease), background .18s var(--ease), border-color .18s var(--ease);
}
.cc-toggle:hover { color: var(--fg); border-color: var(--line-3); background: var(--hover); }
.cc-toggle svg { transition: transform .3s var(--ease); }
.cc.open .cc-toggle svg { transform: rotate(180deg); }
.cc-line { font-size: 11px; color: var(--fg-4); }

/* ============================================================
   21. 分页器 / 复选框 / 表格工具条
   ============================================================ */
.pager {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 24px 16px;
}
.pager .pages { display: flex; align-items: center; gap: 4px; }
.pager .pg {
  min-width: 30px; height: 30px; padding: 0 8px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line-2); background: transparent; color: var(--fg-3);
  font-family: inherit; font-size: 12px; font-variant-numeric: tabular-nums;
  transition: color .16s var(--ease), background .16s var(--ease), border-color .16s var(--ease);
}
.pager .pg:hover { color: var(--fg); border-color: var(--line-3); background: var(--hover); }
.pager .pg.on { background: var(--accent); border-color: transparent; color: var(--accent-ink); font-weight: 500; }
.pager .pg[disabled] { opacity: .4; cursor: not-allowed; }
.select.sm { height: 30px; font-size: 12px; padding: 0 28px 0 10px; }
.select-wrap.sm::after { right: 11px; }

/* 复选框 */
.ck {
  width: 18px; height: 18px; flex: 0 0 18px; border-radius: 6px; cursor: pointer;
  border: 1.5px solid var(--line-3); background: var(--panel-2);
  display: inline-grid; place-items: center; color: var(--accent-ink);
  transition: background .16s var(--ease), border-color .16s var(--ease), transform .12s var(--ease);
}
.ck:hover { border-color: var(--fg-3); }
.ck.on { background: var(--accent); border-color: transparent; }
.ck.part { background: var(--accent); border-color: transparent; }
.ck.part::after { content: ""; width: 9px; height: 1.8px; border-radius: 2px; background: var(--accent-ink); }
.ck svg { width: 12px; height: 12px; stroke-width: 3; opacity: 0; transition: opacity .14s var(--ease); }
.ck.on svg { opacity: 1; }
.tbl th .ck, .tbl td .ck { vertical-align: middle; }

/* 表格工具条（批量操作） */
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 24px; border-bottom: 1px solid var(--hair);
}
.toolbar .sel-info { font-size: 12px; color: var(--fg-3); }
.toolbar .sel-info b { color: var(--fg); font-variant-numeric: tabular-nums; }

/* 产物库卡片选择态 */
.lib-card .pick {
  position: absolute; left: 10px; top: 10px; z-index: 4;
  width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center;
  background: rgba(12, 12, 14, .55); border: 1.5px solid rgba(255, 255, 255, .5);
  color: #fff; cursor: pointer; backdrop-filter: blur(6px);
  transition: background .16s var(--ease), border-color .16s var(--ease);
}
.lib-card .pick svg { width: 13px; height: 13px; stroke-width: 3; opacity: 0; }
.lib-card.picked .pick { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.lib-card.picked .pick svg { opacity: 1; }
.lib-card.picked { outline: 2px solid var(--accent); outline-offset: -2px; }
.lib-card .del {
  position: absolute; right: 10px; top: 10px; z-index: 4; width: 24px; height: 24px;
  border-radius: 8px; display: grid; place-items: center; cursor: pointer;
  background: rgba(12, 12, 14, .55); border: 1px solid rgba(255, 255, 255, .22);
  color: #fff; backdrop-filter: blur(6px); opacity: 0;
  transition: opacity .18s var(--ease), background .18s var(--ease);
}
.lib-card:hover .del { opacity: 1; }
.lib-card .del:hover { background: var(--err); border-color: transparent; }

/* 后台任务页 */
.task-title { display: flex; align-items: center; gap: 10px; }
.task-detail { background: var(--hair-2); }
.task-detail .kv { grid-template-columns: 110px 1fr; }
.err-text { color: var(--err); word-break: break-all; }

.tbl tbody tr.row-on { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.tbl tbody tr.row-on:hover { background: color-mix(in srgb, var(--accent) 13%, transparent); }

/* ============================================================
   22. 侧边栏折叠 / 工作台输入图（2026-09-18 第 10 轮）
   ============================================================ */
/* ---- 折叠：宽度过渡 + 文字渐隐（不用 display:none，否则没有动画） ---- */
.sidebar {
  overflow: hidden;
  transition: width .28s var(--ease), flex-basis .28s var(--ease), padding .28s var(--ease);
}
.brand > div { transition: opacity .2s var(--ease), width .28s var(--ease); }
.nav-item { position: relative; }
.nav-item > span:not(.nav-badge) {
  white-space: nowrap;
  transition: opacity .18s var(--ease), width .28s var(--ease);
}
.user-chip b { white-space: nowrap; transition: opacity .18s var(--ease), width .28s var(--ease); }
.sidebar-toggle { flex: 0 0 auto; }
.user-out { flex: 0 0 auto; }

.shell.collapsed .sidebar { width: 74px; flex: 0 0 74px; padding: 20px 12px; }
.shell.collapsed .brand { padding: 6px 0 20px; justify-content: center; }
.shell.collapsed .brand > div { opacity: 0; width: 0; overflow: hidden; }
.shell.collapsed .nav-item { justify-content: center; padding: 0; }
.shell.collapsed .nav-item > span:not(.nav-badge) { opacity: 0; width: 0; overflow: hidden; }
.shell.collapsed .nav-item .nav-badge {
  position: absolute; top: 3px; right: 13px; min-width: 15px; height: 15px;
  padding: 0 4px; font-size: 10px; line-height: 15px; text-align: center;
}
.shell.collapsed .sidebar-foot .side-card:not(.user-chip) { display: none; }
.shell.collapsed .user-chip { justify-content: center; padding: 6px 0; }
.shell.collapsed .user-chip b { opacity: 0; width: 0; overflow: hidden; }
.shell.collapsed .user-row { flex-direction: column; align-items: center; }
.shell.collapsed .user-row .user-out { width: 100%; }

/* ---- 工作台：输入图预览 ---- */
.src-stage {
  border-radius: var(--r-sm); overflow: hidden;
  background: var(--imgbg); border: 1px solid var(--line);
  display: grid; place-items: center; min-height: 168px;
}
.src-stage.ok { cursor: zoom-in; }
.src-stage img { width: 100%; max-height: 320px; object-fit: contain; display: block; }
.src-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--fg-3); padding: 30px 0; }

/* ============================================================
   23. 概览 5 列统计 / 工作台卡片折叠（2026-09-18 第 11 轮）
   ============================================================ */
/* 概览：一行 5 个卡片（不换行；窄屏再降列，避免溢出） */
.stat-grid-5 { grid-template-columns: repeat(5, 1fr); }
.stat-grid-5 .stat { padding: 18px 18px; min-height: 118px; gap: 9px; }
.stat-grid-5 .stat-value { font-size: 28px; }
@media (max-width: 1440px) {
  /* 空间略紧时压缩内边距与字号 —— 仍保持一行 5 个，不换行 */
  .stat-grid-5 .stat { padding: 16px 15px; }
  .stat-grid-5 .stat-value { font-size: 26px; }
}
@media (max-width: 1180px) { .stat-grid-5 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px)  { .stat-grid-5 { grid-template-columns: 1fr; } }

/* 折叠容器：grid-rows 0fr↔1fr 技巧，高度平滑过渡（不用 display:none，否则无动画） */
.fold {
  display: grid; grid-template-rows: 1fr;
  transition: grid-template-rows .34s var(--ease);
}
.fold.folded { grid-template-rows: 0fr; }
.fold > .fold-in { overflow: hidden; min-height: 0; }
/* 折叠态下卡片只剩标题行：给个轻微提示，hover 可见展开意图 */
.card .card-head .btn.icon svg { transition: transform .3s var(--ease); }

/* ============================================================
   24. 右侧抽屉 / 卡内信息排版（2026-09-18 第 12 轮）
   ============================================================ */
/* ---- 抽屉 ---- */
.drawer-mask {
  position: fixed; inset: 0; z-index: 86; display: flex; justify-content: flex-end;
  background: var(--mask); backdrop-filter: blur(10px);
  animation: fade-in .2s var(--ease);
}
.drawer {
  width: min(600px, 94vw); height: 100%; display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--line-2);
  box-shadow: -40px 0 80px -40px rgba(0, 0, 0, .55);
  animation: drawer-in .34s var(--ease);
}
.drawer.wide { width: min(760px, 96vw); }
@keyframes drawer-in { from { transform: translateX(100%); } to { transform: none; } }
.drawer-head {
  flex: 0 0 auto; display: flex; align-items: center; gap: 12px;
  padding: 20px 24px; border-bottom: 1px solid var(--line);
}
.drawer-title { font-size: 16px; font-weight: 500; }
.drawer-body { flex: 1 1 auto; overflow-y: auto; padding: 20px 24px; }
.drawer-foot {
  flex: 0 0 auto; padding: 16px 24px; border-top: 1px solid var(--line);
  display: flex; gap: 10px; align-items: center; justify-content: flex-end; flex-wrap: wrap;
}
.drawer-hero {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 14px; border-radius: var(--r-sm);
  background: var(--hair-2); border: 1px solid var(--line);
}

/* ---- 抽屉 / 弹窗内的信息区块 ---- */
.d-sec { display: flex; flex-direction: column; gap: 10px; }
.d-sec-head { display: flex; align-items: center; gap: 10px; }
.d-sec-title { font-size: 13px; font-weight: 500; color: var(--fg-2); }
.prompt-box {
  padding: 12px 14px; border-radius: var(--r-sm); font-size: 12.5px; line-height: 1.75;
  background: var(--code-bg); border: 1px solid var(--line); color: var(--fg);
  white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow-y: auto;
}
.d-thumb {
  display: block; width: 148px; height: 148px; border-radius: 14px; overflow: hidden;
  border: 1px solid var(--line); background: var(--imgbg); flex: 0 0 auto;
  transition: border-color .18s var(--ease), transform .18s var(--ease);
}
.d-thumb:hover { border-color: var(--line-3); transform: translateY(-1px); }
.d-thumb img { width: 100%; height: 100%; object-fit: cover; }
.d-preview {
  border-radius: 16px; overflow: hidden; background: var(--imgbg);
  display: grid; place-items: center; border: 1px solid var(--line);
}
.d-preview img { max-height: 54vh; object-fit: contain; }

/* ---- 卡内信息排版（工作台 / 产物库共用） ---- */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.meta-chip {
  display: inline-flex; align-items: center; gap: 5px; height: 25px; padding: 0 10px;
  border-radius: var(--r-pill); background: var(--hover-2); border: 1px solid var(--line);
  font-size: 11.5px; color: var(--fg-2); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.meta-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.meta-item {
  min-width: 0; display: flex; flex-direction: column; gap: 4px;
  padding: 10px 12px; border-radius: var(--r-sm);
  background: var(--hair-2); border: 1px solid var(--line);
}
.meta-k { font-size: 11px; color: var(--fg-4); }
.meta-v { font-size: 12.5px; color: var(--fg); min-width: 0; }
.link-list { display: flex; flex-direction: column; gap: 8px; }
.link-row { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 10px; align-items: center; }
.link-k { font-size: 11.5px; color: var(--fg-3); }

/* ---- 工作台卡片：生成结果（媒体 + 信息 一体式） ---- */
.result-card .stage {
  border-radius: 0; border: 0; border-bottom: 1px solid var(--line);
  min-height: 380px; max-height: 560px;
}
.result-info { padding: 16px 24px 20px; display: flex; flex-direction: column; gap: 12px; }
.src-stage { position: relative; }
.src-stage .zoom-hint {
  position: absolute; right: 10px; bottom: 10px; z-index: 2;
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 10px; border-radius: var(--r-pill);
  background: rgba(12, 12, 14, .58); border: 1px solid rgba(255, 255, 255, .18);
  color: #fff; font-size: 11px; backdrop-filter: blur(6px);
}
.result-card .card-head { padding-bottom: 16px; }
@media (max-width: 900px) {
  .meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .link-row { grid-template-columns: 1fr; gap: 5px; }
}

/* 可点击的折叠卡片头（代理池「已绑定」等） */
.card-head.fold-head { cursor: pointer; padding-bottom: 16px; user-select: none; }
.card-head.fold-head:hover .card-title { color: var(--accent); }

/* 固定列宽的表格（调用记录）：th 宽度严格生效，超长内容省略号 + hover 提示 */
.tbl-fixed { table-layout: fixed; }
.tbl-fixed td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }


/* 模型映射页 */
.alias-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.alias-row > .input:first-child { width: 210px; }
.alias-grow { flex: 1; min-width: 300px; }
.alias-arrow { font-size: 13px; color: var(--fg-3); }
.alias-en { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--fg-2); cursor: pointer; white-space: nowrap; }
.alias-en input { accent-color: var(--accent); }

/* 日期时间选择控件跟随明暗模式（密钥有效期用） */
.input { color-scheme: dark; }
:root[data-mode="light"] .input { color-scheme: light; }
