/* =====================================================================
   Agent 工作台 — 设计系统
   - 令牌：中性灰阶 / 品牌靛蓝 / 语义色 / 表面层级 / 圆角 / 间距 / 阴影 / 字号
   - 亮色默认；暗色跟随系统（prefers-color-scheme）或 html[data-theme=dark]（app.js setThemePref）
   - 旧变量名（--panel / --line / --green …）保留为别名，兼容内联样式
   ===================================================================== */
/* Inter 可变字体（本地托管，OFL 协议见 fonts/LICENSE-Inter.txt；内网无外网也可用，加载失败回退系统字体） */
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("fonts/InterVariable.woff2") format("woff2");
}
:root {
  color-scheme: light;
  /* 灰阶 */
  --gray-0: #ffffff; --gray-25: #fcfcfd; --gray-50: #f8f9fb; --gray-100: #f2f4f7; --gray-150: #eaedf1; --gray-200: #e4e7ec;
  --gray-300: #d0d5dd; --gray-400: #98a2b3; --gray-500: #667085; --gray-600: #475467; --gray-700: #344054; --gray-800: #1d2939; --gray-900: #101828;

  /* 表面与文本 */
  --bg: #f6f7f9;                 /* 画布 */
  --surface: #ffffff;            /* 卡片 / 面板 */
  --surface-2: #fafbfc;          /* 次级面板（侧栏、表头） */
  --surface-3: #f2f4f7;          /* 悬停 / 填充 */
  --surface-inset: #f5f6f8;      /* 代码块、日志 */
  --overlay: rgba(16, 24, 40, .45);
  --border: #e4e7ec;
  --border-subtle: #eef0f3;
  --border-strong: #d0d5dd;
  --text: #101828;
  --text-2: #344054;
  --muted: #667085;
  --faint: #98a2b3;

  /* 品牌 */
  --brand: #4f46e5;
  --brand-hover: #4338ca;
  --brand-active: #3730a3;
  --brand-fg: #ffffff;
  --brand-soft: #eef2ff;
  --brand-soft-2: #e0e7ff;
  --brand-text: #4338ca;
  --focus-ring: 0 0 0 3px rgba(79, 70, 229, .22);

  /* 语义色：fg 文字 / bg 浅底 / bd 边 */
  --success: #079455; --success-bg: #ecfdf3; --success-bd: #abefc6;
  --warning: #b54708; --warning-bg: #fffaeb; --warning-bd: #fedf89;
  --danger: #d92d20;  --danger-bg: #fef3f2;  --danger-bd: #fecdca;
  --info: #175cd3;    --info-bg: #eff8ff;    --info-bd: #b2ddff;
  --neutral-bg: #f2f4f7; --neutral-bd: #e4e7ec;

  /* 图标块（app-tile）明度 */
  --tile-l: 95%; --tile-s: 85%; --tile-bd-l: 88%;

  /* 圆角 / 间距 / 阴影 / 字号 / 动效 */
  --r-xs: 4px; --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-xl: 16px; --r-full: 999px;
  --radius: var(--r-lg);
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-md: 0 4px 12px -2px rgba(16, 24, 40, .08), 0 2px 4px -2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 16px 32px -8px rgba(16, 24, 40, .14), 0 4px 8px -4px rgba(16, 24, 40, .06);
  --shadow-xl: 0 24px 48px -12px rgba(16, 24, 40, .22);
  --fs-xs: 12px; --fs-sm: 13px; --fs-md: 14px; --fs-lg: 16px; --fs-xl: 20px; --fs-2xl: 24px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --dur: .15s;
  --topbar-h: 56px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", "WenQuanYi Zen Hei", sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;

  /* 旧变量别名（JS 内联样式与图表仍在用） */
  --bg2: var(--surface-2); --panel: var(--surface); --panel2: var(--surface-3); --line: var(--border);
  --green: var(--success); --orange: var(--warning); --blue: var(--brand); --red: var(--danger); --yellow: var(--warning);
}

/* 暗色令牌：系统暗色（未强制亮色）或强制暗色 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0a0b0f; --surface: #111318; --surface-2: #0e1015; --surface-3: #1a1d24; --surface-inset: #0b0d11;
    --overlay: rgba(0, 0, 0, .6);
    --border: #23262e; --border-subtle: #1b1e25; --border-strong: #30343e;
    --text: #ededf0; --text-2: #c9ccd3; --muted: #8d929e; --faint: #626774;
    --brand: #6d6af6; --brand-hover: #7f7cf8; --brand-active: #5b58e8; --brand-fg: #ffffff;
    --brand-soft: rgba(109, 106, 246, .14); --brand-soft-2: rgba(109, 106, 246, .24); --brand-text: #a5a3ff;
    --focus-ring: 0 0 0 3px rgba(129, 126, 255, .35);
    --success: #47cd89; --success-bg: rgba(71, 205, 137, .12); --success-bd: rgba(71, 205, 137, .3);
    --warning: #fdb022; --warning-bg: rgba(253, 176, 34, .12); --warning-bd: rgba(253, 176, 34, .3);
    --danger: #f97066;  --danger-bg: rgba(249, 112, 102, .12); --danger-bd: rgba(249, 112, 102, .32);
    --info: #53b1fd;    --info-bg: rgba(83, 177, 253, .12);   --info-bd: rgba(83, 177, 253, .3);
    --neutral-bg: rgba(255, 255, 255, .06); --neutral-bd: rgba(255, 255, 255, .1);
    --tile-l: 18%; --tile-s: 45%; --tile-bd-l: 26%;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .5);
    --shadow-md: 0 6px 16px -4px rgba(0, 0, 0, .55);
    --shadow-lg: 0 18px 40px -10px rgba(0, 0, 0, .7);
    --shadow-xl: 0 28px 56px -12px rgba(0, 0, 0, .75);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0b0f; --surface: #111318; --surface-2: #0e1015; --surface-3: #1a1d24; --surface-inset: #0b0d11;
  --overlay: rgba(0, 0, 0, .6);
  --border: #23262e; --border-subtle: #1b1e25; --border-strong: #30343e;
  --text: #ededf0; --text-2: #c9ccd3; --muted: #8d929e; --faint: #626774;
  --brand: #6d6af6; --brand-hover: #7f7cf8; --brand-active: #5b58e8; --brand-fg: #ffffff;
  --brand-soft: rgba(109, 106, 246, .14); --brand-soft-2: rgba(109, 106, 246, .24); --brand-text: #a5a3ff;
  --focus-ring: 0 0 0 3px rgba(129, 126, 255, .35);
  --success: #47cd89; --success-bg: rgba(71, 205, 137, .12); --success-bd: rgba(71, 205, 137, .3);
  --warning: #fdb022; --warning-bg: rgba(253, 176, 34, .12); --warning-bd: rgba(253, 176, 34, .3);
  --danger: #f97066;  --danger-bg: rgba(249, 112, 102, .12); --danger-bd: rgba(249, 112, 102, .32);
  --info: #53b1fd;    --info-bg: rgba(83, 177, 253, .12);   --info-bd: rgba(83, 177, 253, .3);
  --neutral-bg: rgba(255, 255, 255, .06); --neutral-bd: rgba(255, 255, 255, .1);
  --tile-l: 18%; --tile-s: 45%; --tile-bd-l: 26%;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .5);
  --shadow-md: 0 6px 16px -4px rgba(0, 0, 0, .55);
  --shadow-lg: 0 18px 40px -10px rgba(0, 0, 0, .7);
  --shadow-xl: 0 28px 56px -12px rgba(0, 0, 0, .75);
}

/* ---------------- 基础 ---------------- */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: var(--fs-md); line-height: 1.55;
  font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--brand-soft-2); }
a { color: var(--brand-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12px; }
.spacer { flex: 1; }
.row { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: var(--s-2); }
.i { display: inline-flex; align-items: center; justify-content: center; flex: none; line-height: 0; }
.i svg { display: block; }
kbd, .kbd {
  font-family: var(--font); font-size: 11px; font-weight: 500; line-height: 1; color: var(--muted);
  padding: 3px 6px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: var(--r-xs); background: var(--surface);
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--faint); }
::-webkit-scrollbar-track { background: transparent; }

h1, h2, h3 { margin: 0 0 var(--s-3); font-weight: 600; letter-spacing: -.01em; color: var(--text); }
h1 { font-size: var(--fs-2xl); line-height: 1.25; letter-spacing: -.02em; }
h2 { font-size: var(--fs-lg); }
h3 { font-size: 15px; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  height: var(--topbar-h); display: flex; align-items: center; gap: var(--s-6); padding: 0 var(--s-6);
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 86%, transparent); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20; backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
}
.brand { color: var(--text); font-weight: 650; font-size: 15px; display: flex; align-items: center; gap: 10px; letter-spacing: -.01em; flex: none; }
.brand:hover { text-decoration: none; }
.logo-mark { display: inline-flex; width: 28px; height: 28px; flex: none; border-radius: 8px; box-shadow: 0 1px 2px rgba(79, 70, 229, .3), inset 0 0 0 1px rgba(255, 255, 255, .12); }
.logo-mark svg { width: 100%; height: 100%; display: block; }
.brand-dot { display: none; }
nav { display: flex; gap: 2px; align-items: center; }
nav a {
  color: var(--muted); padding: 6px 10px; border-radius: var(--r-sm); font-weight: 500; font-size: var(--fs-md);
  display: inline-flex; align-items: center; gap: 7px; transition: color var(--dur), background-color var(--dur); position: relative;
}
nav a .nav-ico { opacity: .85; flex: none; }
nav a:hover { color: var(--text); background: var(--surface-3); text-decoration: none; }
nav a.active { color: var(--text); background: var(--surface-3); }
nav a.active .nav-ico { color: var(--brand); opacity: 1; }
.userbox { display: flex; align-items: center; gap: var(--s-1); color: var(--muted); position: relative; }
.userbox b { color: var(--text); font-weight: 500; }
.userbox .ub-info, .userbox .ub-logout { display: none; }       /* 桌面也收进头像菜单 */

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; flex: none;
  background: none; border: 1px solid transparent; border-radius: var(--r-md); color: var(--muted); cursor: pointer;
  transition: color var(--dur), background-color var(--dur), border-color var(--dur);
}
.icon-btn:hover, .icon-btn.active { color: var(--text); background: var(--surface-3); text-decoration: none; }
.ub-help.active { color: var(--brand); }

/* 顶栏搜索（桌面） */
.gsearch { position: relative; display: flex; align-items: center; width: 240px; flex: none; }
.gsearch.on-home { visibility: hidden; }
.gsearch-ico { position: absolute; left: 10px; color: var(--faint); pointer-events: none; }
.gsearch input {
  width: 100%; height: 34px; padding: 0 34px 0 32px; background: var(--surface-3); border-color: transparent; border-radius: var(--r-md);
}
.gsearch input:hover { border-color: var(--border); }
.gsearch input:focus { background: var(--surface); }
.gsearch .kbd { position: absolute; right: 8px; pointer-events: none; }
.gsearch input:focus ~ .kbd { display: none; }

main { padding: var(--s-8) var(--s-8) var(--s-10); max-width: 1320px; margin: 0 auto; }
main.full { max-width: none; padding: 0; height: calc(100vh - var(--topbar-h)); }

/* ---------------- 控件 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; background: var(--surface); color: var(--text-2);
  border: 1px solid var(--border-strong); border-radius: var(--r-md); box-shadow: var(--shadow-xs);
  cursor: pointer; font: inherit; font-size: var(--fs-md); font-weight: 500; white-space: nowrap; line-height: 1; text-decoration: none;
  transition: background-color var(--dur), border-color var(--dur), color var(--dur), box-shadow var(--dur), transform .05s;
}
.btn:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.btn:active:not(:disabled) { transform: translateY(.5px); }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); color: var(--brand-fg); border-color: var(--brand); box-shadow: 0 1px 2px rgba(79, 70, 229, .25), inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: var(--brand-fg); }
.btn.primary:active:not(:disabled) { background: var(--brand-active); }
.btn.warn { color: var(--warning); border-color: var(--warning-bd); }
.btn.warn:hover { background: var(--warning-bg); }
.btn.danger { color: var(--danger); border-color: var(--danger-bd); }
.btn.danger:hover { background: var(--danger-bg); color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.sm { height: 28px; padding: 0 10px; font-size: var(--fs-sm); border-radius: var(--r-sm); gap: 5px; }
.btn.icon-only { padding: 0; width: 36px; }
.btn.sm.icon-only { width: 28px; }

input, select, textarea {
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--r-md);
  padding: 7px 11px; font: inherit; font-size: var(--fs-md); outline: none; box-shadow: var(--shadow-xs);
  transition: border-color var(--dur), box-shadow var(--dur), background-color var(--dur);
}
input, select { height: 36px; }
input[type=file] { height: auto; padding: 5px; }
input[type=checkbox], input[type=radio] { height: auto; box-shadow: none; accent-color: var(--brand); }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: var(--gray-400); }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: var(--focus-ring); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-3); color: var(--muted); cursor: not-allowed; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2398a2b3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
input[type=file]::file-selector-button {
  font: inherit; font-size: var(--fs-sm); font-weight: 500; margin-right: 10px; padding: 5px 10px; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface-3); color: var(--text-2);
}
input[type=search]::-webkit-search-cancel-button { cursor: pointer; }
label.field { display: flex; flex-direction: column; gap: 6px; color: var(--text-2); font-size: var(--fs-sm); font-weight: 500; }
label.field > * { color: var(--text); font-size: var(--fs-md); font-weight: 400; }
label.field > .muted { color: var(--muted); font-size: 12px; }

/* 开关（仅看我的收藏） */
.switch-label { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: var(--fs-md); cursor: pointer; user-select: none; white-space: nowrap; }
input.switch {
  appearance: none; -webkit-appearance: none; width: 34px; height: 20px; margin: 0; border-radius: var(--r-full); position: relative; cursor: pointer;
  background: var(--gray-300); border: 0; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .08); transition: background-color var(--dur); flex: none; padding: 0;
}
input.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .2); transition: transform .2s var(--ease);
}
input.switch:checked { background: var(--brand); }
input.switch:checked::after { transform: translateX(14px); }
input.switch:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s-6);
  box-shadow: var(--shadow-xs);
}
.panel + .panel { margin-top: var(--s-4); }
.panel > h2:first-child { margin-bottom: var(--s-2); }
.page-head { display: flex; align-items: flex-end; gap: var(--s-3); margin-bottom: var(--s-6); flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-title { min-width: 0; flex: 0 1 auto; max-width: 760px; }
.page-desc { margin: 6px 0 0; color: var(--muted); font-size: var(--fs-md); line-height: 1.6; }
.toolbar { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; margin-bottom: var(--s-6); }

/* 空状态 / 加载 */
.empty { color: var(--muted); text-align: center; padding: var(--s-8) var(--s-4); font-size: var(--fs-md); }
.empty.loading { display: flex; align-items: center; justify-content: center; gap: 10px; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--brand);
  animation: spin .7s linear infinite; flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty-lg { padding: 56px var(--s-4); }
div.empty-lg { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.empty-ico {
  width: 44px; height: 44px; border-radius: var(--r-lg); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 8px;
  background: var(--surface); color: var(--muted); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.empty-title { color: var(--text); font-weight: 600; font-size: 15px; }
.empty-sub { color: var(--muted); font-size: var(--fs-sm); max-width: 360px; margin: 0 auto; }
td.empty-lg .empty-ico { display: flex; margin: 0 auto 10px; }

/* 骨架屏 */
.skel {
  display: block; border-radius: var(--r-sm); background: var(--surface-3);
  background-image: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 70%, transparent), transparent);
  background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }
.skel-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s-5); display: flex; flex-direction: column; gap: 12px; min-height: 196px; }
.skel-tile { width: 44px; height: 44px; border-radius: var(--r-md); flex: none; }
.skel-line { height: 10px; width: 100%; }
.skel-line.w80 { width: 80%; } .skel-line.w60 { width: 60%; } .skel-line.w40 { width: 40%; } .skel-line.w30 { width: 30%; margin-top: auto; }

/* ---------------- 徽章（状态 pill） ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 0 8px; height: 22px; border-radius: var(--r-full);
  font-size: 12px; font-weight: 500; line-height: 1; white-space: nowrap; vertical-align: middle;
  color: var(--text-2); background: var(--neutral-bg); border: 1px solid var(--neutral-bd);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.st-ok, .badge.cred-on { color: var(--success); }
.st-run { color: var(--info); }
.st-wait { color: var(--warning); }
.st-bad { color: var(--danger); }
.st-off, .badge.cred-off { color: var(--muted); }
.badge.st-ok, .badge.cred-on { background: var(--success-bg); border-color: var(--success-bd); }
.badge.st-run { background: var(--info-bg); border-color: var(--info-bd); }
.badge.st-run::before { animation: pulse 1.4s ease-in-out infinite; }
.badge.st-wait { background: var(--warning-bg); border-color: var(--warning-bd); }
.badge.st-bad { background: var(--danger-bg); border-color: var(--danger-bd); }
.badge.st-off, .badge.cred-off { background: var(--neutral-bg); border-color: var(--neutral-bd); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------------- 应用图标块 / 头像 ---------------- */
.app-tile {
  --h: 232;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 44px; height: 44px; border-radius: var(--r-md); font-size: 24px; line-height: 1;
  background: hsl(var(--h) var(--tile-s) var(--tile-l));
  box-shadow: inset 0 0 0 1px hsl(var(--h) 60% var(--tile-bd-l));
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", var(--font);
}
.app-tile.lg { width: 52px; height: 52px; font-size: 28px; border-radius: var(--r-lg); }
.app-tile.sm { width: 28px; height: 28px; font-size: 16px; border-radius: 7px; }
.app-tile.xs { width: 24px; height: 24px; font-size: 14px; border-radius: 6px; }
.app-label { display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; }
.app-label-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.avatar {
  --h: 232; display: inline-flex; align-items: center; justify-content: center; flex: none; width: 28px; height: 28px; border-radius: 50%;
  font-size: 12px; font-weight: 600; color: #fff; background: linear-gradient(135deg, hsl(var(--h) 70% 58%), hsl(calc(var(--h) + 30) 70% 52%));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15);
}
.avatar.lg { width: 36px; height: 36px; font-size: 14px; }
.svc-tile {
  --h: 232; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--r-md); flex: none;
  font-weight: 650; font-size: 14px; color: hsl(var(--h) 60% 42%);
  background: hsl(var(--h) var(--tile-s) var(--tile-l)); box-shadow: inset 0 0 0 1px hsl(var(--h) 60% var(--tile-bd-l));
}
:root[data-theme="dark"] .svc-tile { color: hsl(var(--h) 80% 75%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .svc-tile { color: hsl(var(--h) 80% 75%); } }

/* ---------------- 登录 ---------------- */
main.login-main {
  max-width: none; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: var(--s-6) var(--s-4);
  background:
    radial-gradient(900px 480px at 50% -10%, color-mix(in srgb, var(--brand) 16%, transparent), transparent 70%),
    radial-gradient(600px 400px at 100% 100%, color-mix(in srgb, #8b5cf6 9%, transparent), transparent 70%),
    var(--bg);
  position: relative; overflow: hidden;
}
main.login-main::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .6;
  background-image: linear-gradient(var(--border-subtle) 1px, transparent 1px), linear-gradient(90deg, var(--border-subtle) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 60% 55% at 50% 40%, #000 30%, transparent 75%); mask-image: radial-gradient(ellipse 60% 55% at 50% 40%, #000 30%, transparent 75%);
}
.login-wrap { width: 100%; max-width: 400px; position: relative; z-index: 1; }
.login-wrap .panel { padding: 36px 32px 28px; }
.login-card { box-shadow: var(--shadow-lg); border-color: var(--border); }
.login-brand { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: var(--s-6); }
.login-brand .logo-mark { border-radius: 11px; margin-bottom: var(--s-4); box-shadow: 0 8px 20px -6px rgba(79, 70, 229, .55), inset 0 0 0 1px rgba(255, 255, 255, .15); }
.login-brand h1 { font-size: 22px; margin: 0; }
.login-sub { margin: 6px 0 0; font-size: var(--fs-md); }
.login-error {
  display: flex; gap: 8px; align-items: flex-start; color: var(--danger); background: var(--danger-bg); border: 1px solid var(--danger-bd);
  border-radius: var(--r-md); padding: 10px 12px; font-size: var(--fs-sm); margin: 0 0 var(--s-4);
}
.login-error .i { margin-top: 1px; }
.login-label { display: block; font-size: var(--fs-sm); font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.login-row { flex-wrap: nowrap; }
.login-row > input { flex: 1 1 auto; min-width: 0; height: 40px; }
.login-row > .btn { height: 40px; padding: 0 18px; }
.login-body .btn.primary[data-sso] { height: 42px; font-size: 15px; display: flex !important; }
.login-or { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 12px; margin: 18px 0 14px; }
.login-or::before, .login-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.login-dev { margin: 20px 0 0; text-align: center; }
.login-foot { text-align: center; font-size: 12px; margin: 18px 0 0; color: var(--faint); }
.login-body > p.muted { font-size: var(--fs-sm); }
.login-form { display: flex; flex-direction: column; }
.login-form > input, .pw-field > input { width: 100%; height: 40px; box-sizing: border-box; margin-bottom: 14px; }
.login-form > .btn.primary { height: 42px; font-size: 15px; margin-top: 4px; justify-content: center; }
.login-tip { font-size: 12px; margin: 12px 0 0; text-align: center; }
.captcha-row { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.captcha-row > input { flex: 1 1 auto; min-width: 0; height: 40px; box-sizing: border-box; text-transform: uppercase; letter-spacing: .2em; }
.captcha-row > input::placeholder { text-transform: none; letter-spacing: normal; }
.captcha-img {
  flex: 0 0 120px; width: 120px; height: 40px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface-3);
  cursor: pointer; overflow: hidden; font-size: 11px; line-height: 1.3; color: var(--muted); text-align: center; box-sizing: border-box;
}
.pw-field > input { margin-bottom: 4px; }
.pw-field { margin-bottom: 12px; }
.pw-hint { font-size: 12px; line-height: 1.5; margin: 2px 0 0; }
.pw-hint.pw-ok { color: var(--success); }
.pw-hint.pw-bad { color: var(--danger); }
.pw-panel { max-width: 440px; }
.cred-note { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.cred-note .token-box { flex: 1; min-width: 0; }

/* 分享 */
.share-drawer { display: flex; flex-direction: column; gap: 14px; }
.share-drawer h3 { margin: 6px 0 0; font-size: var(--fs-md); }
.share-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.share-form .field { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-sm); color: var(--text-2); }
.share-max { width: 120px; }
.share-created { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px dashed var(--brand); border-radius: var(--r-md); background: var(--surface-inset); }
.share-created .row { flex-wrap: nowrap; }
.share-url { flex: 1; min-width: 0; }
.share-accept { max-width: 520px; margin: 40px auto; }
.share-error { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.share-error p { margin: 0; }
.about-head .about-share { margin-left: auto; align-self: flex-start; }
.user-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0 20px; }
.user-pick button { height: auto; padding: 14px 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.user-pick small { color: var(--muted); font-weight: 400; }

/* ---------------- 应用中心 ---------------- */
.search-field { position: relative; display: flex; align-items: center; flex: 0 1 360px; min-width: 220px; }
.search-field .search-ico { position: absolute; left: 11px; color: var(--faint); pointer-events: none; }
.search-field input { width: 100%; padding-left: 34px; padding-right: 34px; height: 38px; }
.search-field .kbd { position: absolute; right: 10px; pointer-events: none; }
.search-field input:focus ~ .kbd { display: none; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--s-4); }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s-5);
  display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow-xs); position: relative;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), transform .2s var(--ease);
}
.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card-head { display: flex; gap: 12px; align-items: center; }
.card-head-text { min-width: 0; flex: 1; }
.card-icon { flex: none; }
.card-title { font-weight: 600; font-size: 15px; color: var(--text); letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-slug { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--faint); margin-top: 1px; }
.card-desc { color: var(--muted); font-size: var(--fs-md); line-height: 1.6; min-height: 45px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-meta { display: flex; gap: 4px 12px; font-size: 12px; color: var(--muted); flex-wrap: wrap; align-items: center; }
.card-meta > span + span::before { content: ""; display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: var(--faint); margin: 0 12px 2px 0; vertical-align: middle; opacity: .7; }
.card .card-meta { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border-subtle); }
.card-actions { display: flex; gap: var(--s-2); align-items: center; }
.card .card-actions { margin-top: 0; }
.card-ver { color: var(--text-2); }
.fav-btn {
  flex: none; align-self: flex-start; width: 32px; height: 32px; margin: -4px -6px 0 0; display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 0; border-radius: var(--r-md); color: var(--faint); cursor: pointer; transition: color var(--dur), background-color var(--dur), transform .15s;
}
.fav-btn:hover { color: var(--text-2); background: var(--surface-3); }
.fav-btn:active { transform: scale(.9); }
.fav-btn.fav-on { color: #f5a524; }
.fav-btn.fav-on svg { fill: currentColor; }
.fav-on { color: #f5a524; }
.section-title { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: var(--fs-sm); font-weight: 600; margin: var(--s-8) 0 var(--s-3); }
.home-body > .section-title:first-child { margin-top: 0; }
.section-n { font-size: 11px; font-weight: 500; color: var(--muted); background: var(--surface-3); border-radius: var(--r-full); padding: 1px 7px; font-variant-numeric: tabular-nums; }

/* ---------------- 应用页（三栏工作区） ---------------- */
.appview { --lw: 260px; --rw: 360px; display: grid; grid-template-columns: var(--lw) minmax(0, 1fr) var(--rw); height: 100%; transition: grid-template-columns .22s var(--ease); }
.appview > section { min-height: 0; display: flex; flex-direction: column; }
.sessions { border-right: 1px solid var(--border); background: var(--surface-2); }
.sessions-head, .timeline-head { height: 52px; padding: 0 12px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; flex: none; }
.timeline-head b { font-weight: 600; font-size: var(--fs-md); }
.sessions-new { padding: 12px 12px 4px; }
.btn.new-sess { width: 100%; justify-content: flex-start; color: var(--text); }
.btn.new-sess .i { color: var(--brand); }
.sessions-label { padding: 12px 16px 6px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.sessions-list { overflow: auto; flex: 1; padding: 0 8px 8px; display: flex; flex-direction: column; gap: 1px; }
.sess {
  padding: 7px 8px 7px 10px; border-radius: var(--r-sm); cursor: pointer; display: flex; align-items: center; gap: 8px; color: var(--text-2);
  transition: background-color var(--dur), color var(--dur); min-height: 36px;
}
.sess:hover { background: var(--surface-3); color: var(--text); }
.sess.active { background: var(--surface); color: var(--text); font-weight: 500; box-shadow: var(--shadow-xs), inset 0 0 0 1px var(--border); }
.sess-ico { color: var(--faint); }
.sess.active .sess-ico { color: var(--brand); }
.sess .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sess-time { font-size: 11px; color: var(--faint); white-space: nowrap; flex: none; font-variant-numeric: tabular-nums; }
.sess:hover .sess-time { display: none; }
.sess .x {
  display: none; color: var(--muted); border: 0; background: none; cursor: pointer; padding: 0; width: 22px; height: 22px; border-radius: var(--r-xs);
  align-items: center; justify-content: center; flex: none;
}
.sess:hover .x { display: inline-flex; }
.sess .x:hover { color: var(--danger); background: var(--danger-bg); }
.stage { background: var(--surface); position: relative; }
.stage iframe { border: 0; width: 100%; height: 100%; background: #fff; }
.stage .stage-empty { position: absolute; inset: 0; background: var(--bg); display: grid; place-items: center; color: var(--muted); }
.timeline { border-left: 1px solid var(--border); background: var(--surface-2); }
.timeline-list { overflow: auto; flex: 1; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.task {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 12px 14px; box-shadow: var(--shadow-xs);
  position: relative; overflow: hidden; flex: none; transition: border-color var(--dur), box-shadow var(--dur);
}
.task::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: transparent; }
.task.s-running::before { background: var(--info); }
.task.s-queued::before { background: var(--warning); }
.task.s-succeeded::before { background: var(--success); }
.task.s-failed::before, .task.s-timeout::before { background: var(--danger); }
.task.s-cancelled::before { background: var(--border-strong); }
.task.s-running::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--info), transparent); background-size: 50% 100%; background-repeat: no-repeat;
  animation: indet 1.4s ease-in-out infinite;
}
@keyframes indet { from { background-position: -50% 0; } to { background-position: 150% 0; } }
.task-head { display: flex; align-items: center; gap: 8px; }
.task-id { font-family: var(--mono); font-size: 12px; color: var(--faint); }
.task-progress { margin-top: 8px; font-size: var(--fs-sm); color: var(--text-2); }
.task-error {
  margin-top: 8px; color: var(--danger); font-size: 12px; white-space: pre-wrap; word-break: break-word;
  background: var(--danger-bg); border: 1px solid var(--danger-bd); border-radius: var(--r-sm); padding: 6px 8px;
}
.task-meta { font-size: 12px; color: var(--muted); margin-top: 6px; font-variant-numeric: tabular-nums; }
.task-files { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.task-files a {
  font-size: var(--fs-sm); cursor: pointer; display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: var(--r-sm);
  background: var(--surface-inset); border: 1px solid var(--border-subtle); color: var(--text-2); min-width: 0;
}
.task-files a:hover { text-decoration: none; border-color: var(--brand); color: var(--brand-text); }
.task-files a .i { color: var(--muted); }
.task-files a .file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; font-weight: 500; }
.task-files a .muted { margin-left: auto; font-size: 12px; flex: none; font-variant-numeric: tabular-nums; }
.task details, .task-detail details { margin-top: 8px; }
.task summary, .task-detail summary { cursor: pointer; font-size: var(--fs-sm); user-select: none; list-style: none; display: inline-flex; align-items: center; gap: 4px; }
.task summary::-webkit-details-marker, .task-detail summary::-webkit-details-marker { display: none; }
.task summary::before, .task-detail summary::before {
  content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg); transition: transform var(--dur); margin: 0 4px 0 2px;
}
.task details[open] > summary::before, .task-detail details[open] > summary::before { transform: rotate(45deg); }
.task summary:hover, .task-detail summary:hover { color: var(--text); }
.task-logs {
  margin-top: 6px; max-height: 180px; overflow: auto; background: var(--surface-inset); border: 1px solid var(--border-subtle); border-radius: var(--r-sm);
  padding: 8px 10px; font-family: var(--mono); font-size: 11.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-all; color: var(--text-2);
}
.app-title { display: flex; gap: 8px; align-items: center; font-weight: 600; min-width: 0; }
.app-title-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.app-title-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-md); }
.app-title-text .mono { font-size: 11px; font-weight: 400; }

/* ---------------- 表格 ---------------- */
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
.tbl th, .tbl td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
.tbl th {
  color: var(--muted); font-weight: 500; font-size: 12px; background: var(--surface-2); position: sticky; top: 0; z-index: 1;
  border-bottom: 1px solid var(--border); white-space: nowrap; letter-spacing: .01em;
}
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background-color var(--dur); }
.tbl tr:hover td { background: var(--surface-2); }
.tbl td.actions { white-space: nowrap; }
.tbl td.actions .btn + .btn { margin-left: 6px; }
.tbl-wrap { overflow: auto; max-height: 70vh; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-xs); }
.cell-detail { max-width: 420px; font-family: var(--mono); font-size: 12px; color: var(--muted); word-break: break-all; }
.app-cell { display: flex; gap: 10px; align-items: center; }

/* ---------------- 我的应用 ---------------- */
.app-block { margin-bottom: var(--s-4); }
.app-block-head { display: flex; align-items: center; gap: 12px; margin-bottom: var(--s-4); flex-wrap: wrap; }
.app-block .tbl-wrap { box-shadow: none; }
.upload-form { display: flex; gap: var(--s-3); align-items: flex-end; flex-wrap: wrap; margin-top: var(--s-4); }

/* ---------------- 管理 tabs ---------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: var(--s-6); flex-wrap: wrap; }
.tabs button {
  background: none; border: 0; color: var(--muted); padding: 10px 12px; cursor: pointer; font: inherit; font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color var(--dur), border-color var(--dur);
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--text); border-bottom-color: var(--brand); }
.bar { height: 8px; background: var(--surface-3); border-radius: 4px; overflow: hidden; min-width: 80px; }
.bar > i { display: block; height: 100%; background: var(--brand); }
.bar.blue > i { background: var(--info); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--s-3); margin-bottom: var(--s-4); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s-4) var(--s-5); box-shadow: var(--shadow-xs); }
.stat .v { font-size: 26px; font-weight: 600; color: var(--text); letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.2; order: 2; }
.stat .k { color: var(--muted); font-size: var(--fs-sm); font-weight: 500; }
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat .k { order: 1; }
.stat .sub { order: 3; }
.token-box { background: var(--surface-inset); border: 1px dashed var(--brand); padding: 10px 12px; border-radius: var(--r-md); font-family: var(--mono); word-break: break-all; }

/* ---------------- 抽屉 ---------------- */
.drawer-mask { position: fixed; inset: 0; background: var(--overlay); z-index: 40; backdrop-filter: blur(2px); animation: fadein .18s ease-out; }
.drawer {
  position: fixed; top: 8px; right: 8px; bottom: 8px; width: min(720px, calc(100vw - 16px)); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-xl); z-index: 41; display: flex; flex-direction: column; box-shadow: var(--shadow-xl);
  animation: slidein .24s var(--ease); overflow: hidden;
}
@keyframes slidein { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.drawer-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px 14px 24px; border-bottom: 1px solid var(--border); }
.drawer-head h3 { margin: 0; flex: 1; font-size: var(--fs-lg); }
.drawer-body { overflow: auto; padding: var(--s-6); flex: 1; }
.drawer-body h3 { font-size: var(--fs-md); margin: 20px 0 8px; }
pre.log {
  background: var(--surface-inset); border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px; margin: 0 0 16px; color: var(--text-2);
  font-family: var(--mono); font-size: 12px; line-height: 1.6; white-space: pre-wrap; word-break: break-all; max-height: 40vh; overflow: auto;
}
.form-grid { display: grid; gap: var(--s-4); }

/* ---------------- toast ---------------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast {
  background: var(--surface); color: var(--text); border: 1px solid var(--border); padding: 12px 16px 12px 36px; border-radius: var(--r-lg);
  min-width: 260px; max-width: 420px; box-shadow: var(--shadow-lg); animation: tin .22s var(--ease); word-break: break-word; position: relative; font-size: var(--fs-md);
}
.toast::before { content: ""; position: absolute; left: 14px; top: 18px; width: 8px; height: 8px; border-radius: 50%; background: var(--info); box-shadow: 0 0 0 3px var(--info-bg); }
.toast.error::before { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }
.toast.ok::before { background: var(--success); box-shadow: 0 0 0 3px var(--success-bg); }
@keyframes tin { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------------- 应用说明（README） ---------------- */
.about-pane, .appview > section.about-pane { display: none; }               /* 仅手机端"说明"面板使用 */
.about-brief { padding: 12px; border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: flex-start; flex: none; }
.about-brief-text { flex: 1; min-width: 0; color: var(--muted); font-size: var(--fs-sm); line-height: 1.55; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.about-head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.about-desc { color: var(--muted); margin: 0 0 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.md { line-height: 1.75; word-break: break-word; color: var(--text-2); }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { margin: 22px 0 8px; line-height: 1.35; color: var(--text); }
.md h1 { font-size: 20px; } .md h2 { font-size: 17px; } .md h3 { font-size: 15px; } .md h4, .md h5, .md h6 { font-size: 14px; color: var(--muted); }
.md > :first-child { margin-top: 0; }
.md p { margin: 0 0 12px; white-space: pre-line; }
.md ul, .md ol { margin: 0 0 12px; padding-left: 22px; }
.md li { margin: 3px 0; white-space: pre-line; }
.md code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-3); border: 1px solid var(--border-subtle); border-radius: var(--r-xs); padding: 1px 5px; color: var(--text); }
.md pre { background: var(--surface-inset); border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px; overflow: auto; margin: 0 0 12px; }
.md pre code { border: 0; padding: 0; background: none; white-space: pre; }
.md blockquote { margin: 0 0 12px; padding: 6px 14px; border-left: 3px solid var(--brand); color: var(--muted); background: var(--brand-soft); border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.md a { word-break: break-all; }
.md-tbl { overflow-x: auto; margin: 0 0 12px; }
.md table { border-collapse: collapse; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 12px; text-align: left; }
.md th { background: var(--surface-2); color: var(--text); font-weight: 600; }

/* ---------------- 提示条 ---------------- */
.notice { background: var(--warning-bg); border: 1px solid var(--warning-bd); border-radius: var(--r-lg); padding: 16px 18px; margin-bottom: var(--s-4); }
.notice-title { font-weight: 600; color: var(--warning); margin-bottom: 4px; }
.notice-id { font-size: 13px; color: var(--text); background: var(--surface); border: 1px solid var(--border); padding: 3px 8px; border-radius: var(--r-sm); user-select: all; }

/* ---------------- 管理 → 用户 ---------------- */
.users-bar { margin-bottom: var(--s-4); }
.users-search { width: 320px; }
.users-tbl { max-height: none; }
.tbl .cell-input { width: 100%; min-width: 120px; padding: 4px 8px; height: 32px; }
.tbl tr.dirty td { background: var(--warning-bg); }
.me-tag { margin-left: 6px; }
select.role-admin { color: var(--warning); } select.role-author { color: var(--success); } select.role-user { color: var(--text); }
select option { color: var(--text); }
.create-user { margin-top: var(--s-4); }
.create-user summary { cursor: pointer; color: var(--text-2); font-weight: 500; }

@media (max-width: 1100px) {
  .appview { --lw: 220px; --rw: 300px; }
  .gsearch { width: 180px; }
  .topbar { gap: var(--s-4); }
}
@media (max-width: 960px) and (min-width: 769px) {
  .gsearch { display: none; }
  nav a .nav-ico { display: none; }
}

/* 侧栏折叠（仅桌面/平板；手机端不受影响） */
.rail-btn { display: none; }
@media (min-width: 769px) {
  .appview.col-l { --lw: 44px; }
  .appview.col-r { --rw: 44px; }
  .appview > section { overflow: hidden; }
  .appview.col-l > .sessions > :not(.rail-btn), .appview.col-r > .timeline > :not(.rail-btn) { display: none; }
  .appview.col-l > .sessions > .rail-btn, .appview.col-r > .timeline > .rail-btn {
    display: flex; flex-direction: column; align-items: center; gap: 12px; flex: 1; width: 100%; padding: 14px 0;
    background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; transition: color var(--dur), background-color var(--dur); }
  .rail-btn:hover { color: var(--text); background: var(--surface-3); }
  .rail-glyph { display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-xs); }
  .rail-text { writing-mode: vertical-rl; letter-spacing: 3px; font-size: 12px; font-weight: 500; }
}
.collapse-btn { color: var(--faint); }
@media (max-width: 768px) { .appview .btn.collapse-btn { display: none; } }

/* 应用页手机端切换条：桌面隐藏 */
.mtabs { display: none; }

/* ---------------- 手机端 (≤768px) ---------------- */
@media (max-width: 768px) {
  body { font-size: 15px; -webkit-text-size-adjust: 100%; }
  .mono, .badge, .card-meta, .section-title, label.field, .tbl th, .task-id, .task-meta, .task-error,
  .task-logs, .cell-detail, .stat .k, pre.log, .btn.sm, .user-pick small { font-size: 14px; }
  .badge { height: 24px; }
  h1 { font-size: 22px; }

  /* 触控尺寸 & 防 iOS 缩放 */
  .btn, .btn.sm { min-height: 40px; height: auto; padding: 8px 14px; display: inline-flex; align-items: center; justify-content: center; }
  .btn.icon-only, .btn.sm.icon-only { width: 40px; padding: 0; }
  input, select, textarea { font-size: 16px; min-height: 40px; max-width: 100%; }
  input[type=checkbox], input[type=radio] { min-height: 0; width: 20px; height: 20px; }
  input.switch { width: 40px; height: 24px; min-height: 0; }
  input.switch::after { width: 20px; height: 20px; }
  input.switch:checked::after { transform: translateX(16px); }
  label.field > * { font-size: 16px; }
  .tabs button { min-height: 40px; }

  /* 顶栏：品牌缩为图标；导航只留「应用 / 任务」两个短文字入口，凭证/我的应用/管理/帮助/退出收进头像菜单 */
  .topbar { gap: 6px; padding: 0 12px; }
  .brand { font-size: 0; gap: 0; flex: none; margin-right: 4px; }
  .brand-text { display: none; }
  .topbar .spacer { display: none; }
  .gsearch { display: none; }
  nav { flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; }
  nav a.nav-more { display: none; }
  nav a .nav-ico { display: none; }
  nav a[data-short] { flex: none; white-space: nowrap; padding: 8px 10px; font-size: 0; gap: 0; }
  nav a[data-short]::after { content: attr(data-short); font-size: 15px; }
  .userbox { flex: none; gap: 4px; position: relative; }
  .userbox .ub-info, .userbox .ub-help, .userbox .ub-logout, .userbox .theme-btn { display: none; }

  main { padding: 20px 16px 32px; }
  main.full { padding: 0; height: calc(100vh - var(--topbar-h)); height: calc(100dvh - var(--topbar-h)); }
  .page-head { margin-bottom: 16px; }
  .page-desc { font-size: 14px; }

  /* 登录 */
  main.login-main { padding: 24px 16px; align-items: flex-start; padding-top: 12vh; }
  .login-wrap { max-width: none; margin: 0; }
  .login-wrap .panel { padding: 28px 20px 22px; }
  .login-wrap .row > input { flex: 1 1 160px; min-width: 0; }
  .user-pick { gap: 8px; }
  .login-wrap a.muted { font-size: 14px !important; display: inline-block; padding: 8px 0; }

  /* 首页 */
  .toolbar { gap: 10px; margin-bottom: 16px; }
  .search-field { flex: 1 1 100%; min-width: 0; }
  .search-field .kbd { display: none; }
  .search-field input { padding-right: 12px; }
  .toolbar > .spacer { display: none; }
  .page-head > input, .page-head > select { flex: 1 1 100%; }
  .cards { grid-template-columns: 1fr; gap: 12px; }
  .card { padding: 16px; }
  .card:hover { transform: none; box-shadow: var(--shadow-xs); }
  .card-actions { flex-wrap: wrap; }
  .section-title { margin-top: 24px; }

  /* 应用页：单栏 + 顶部 segmented 切换 */
  .appview { display: flex; flex-direction: column; height: 100%; }
  .appview > section { flex: 1 1 auto; min-height: 0; border: 0; }
  .appview[data-pane=app] > .sessions, .appview[data-pane=app] > .timeline,
  .appview[data-pane=sess] > .stage, .appview[data-pane=sess] > .timeline,
  .appview[data-pane=tasks] > .stage, .appview[data-pane=tasks] > .sessions { display: none; }
  .mtabs {
    display: flex; flex: none; gap: 6px; padding: 8px 12px; align-items: center;
    background: var(--surface); border-bottom: 1px solid var(--border);
  }
  .mtabs-back { flex: none; width: 40px; padding: 0 !important; }
  .mtabs button {
    flex: 1; min-height: 36px; background: transparent; color: var(--muted); border: 0;
    border-radius: var(--r-md); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; transition: background-color var(--dur), color var(--dur);
  }
  .mtabs button.active { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
  .sessions-head > a.btn { display: none; } /* 返回按钮已在切换条中 */
  .stage iframe { flex: 1 1 auto; height: auto; min-height: 0; }
  .sess { min-height: 48px; }
  .sess .x { display: inline-flex; min-width: 36px; min-height: 36px; }
  .sess-time { display: none; }

  /* 表格：外层容器横向滚动 */
  .tbl-wrap { max-width: 100%; max-height: none; -webkit-overflow-scrolling: touch; }
  .tbl th, .tbl td { white-space: nowrap; }
  .tbl td.cell-detail { white-space: normal; min-width: 220px; }
  .panel { padding: 16px; min-width: 0; }
  .upload-form > * { flex: 1 1 100%; min-width: 0; }
  label.field > input, label.field > select, label.field > textarea { width: 100%; min-width: 0; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* 应用说明：手机端作为第 4 个面板；右栏简介条隐藏 */
  .about-brief { display: none; }
  .appview[data-pane=about] > .stage, .appview[data-pane=about] > .sessions, .appview[data-pane=about] > .timeline { display: none; }
  .appview[data-pane=about] > .about-pane { display: block; overflow: auto; padding: 16px; background: var(--bg); -webkit-overflow-scrolling: touch; }
  .mtabs button { min-width: 0; padding: 0 4px; }
  .md code, .md pre { font-size: 13px; }

  /* 表格改为卡片堆叠 */
  .users-search { width: auto; flex: 1 1 100%; }
  .users-tbl { border: 0; overflow: visible; background: none; box-shadow: none; }
  .tbl-stack thead { display: none; }
  .tbl-stack, .tbl-stack tbody, .tbl-stack tr, .tbl-stack td { display: block; width: 100%; }
  .tbl-stack tr { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 10px 14px; margin-bottom: 10px; box-shadow: var(--shadow-xs); }
  .tbl-stack tr:hover td { background: none; }
  .tbl-stack tr.dirty { border-color: var(--warning-bd); }
  .tbl-stack tr.dirty td { background: none; }
  .tbl-stack td { border: 0; padding: 5px 0; white-space: normal; display: flex; align-items: center; gap: 10px; }
  .tbl-stack td::before { content: attr(data-label); flex: 0 0 76px; color: var(--muted); font-size: 13px; }
  .tbl-stack td[data-label=""]::before { display: none; }
  .tbl-stack td > input, .tbl-stack td > select { flex: 1 1 auto; min-width: 0; width: auto; }
  .tbl-stack td.actions { justify-content: flex-end; padding-top: 8px; }
  .tbl-stack td.actions .btn { flex: 1 1 auto; }
  .tbl-stack td.empty { display: block; }
  .tbl-stack td.empty::before { display: none; }
  .tbl-stack tbody tr:last-child td { border-bottom: 0; }

  /* 抽屉全宽 */
  .drawer { width: 100vw; top: 0; right: 0; bottom: 0; border: 0; border-radius: 0; }
  .drawer-head { padding: 10px 12px 10px 16px; }
  .drawer-body { padding: 16px; }

  /* toast 不超出屏幕 */
  .toasts { left: 12px; right: 12px; bottom: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .toast { min-width: 0; max-width: none; }
}

/* ---------------- 用量页 / 我的任务 ---------------- */
.filters { margin-bottom: var(--s-4); }
.seg { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-3); }
.seg button {
  background: transparent; color: var(--muted); border: 0; padding: 5px 12px; font: inherit; font-size: var(--fs-sm); font-weight: 500;
  cursor: pointer; border-radius: var(--r-sm); transition: background-color var(--dur), color var(--dur);
}
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.stat .sub { color: var(--muted); font-size: 12px; }
.usage-cards { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: var(--s-3); margin-bottom: 8px; }
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s-4) var(--s-5); min-width: 0; box-shadow: var(--shadow-xs); }
.chart-title { font-weight: 600; margin-bottom: 10px; }
.chart-title .muted { font-weight: 400; font-size: var(--fs-sm); }
.chart-host { position: relative; min-height: 180px; }
.chart-svg { display: block; max-width: 100%; overflow: visible; }
.ch-grid { stroke: var(--border-subtle); stroke-width: 1; }
.ch-axis { stroke: var(--border); stroke-width: 1; }
.ch-tick { fill: var(--faint); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.ch-bar { fill: var(--brand); transition: opacity .12s; }
.ch-bar.dim { opacity: .35; }
.ch-line { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ch-dot { fill: var(--brand); stroke: var(--surface); stroke-width: 2; }
.ch-cross { stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 3 3; }
.ch-hit { fill: transparent; cursor: crosshair; }
.chart-tip { position: absolute; top: 0; pointer-events: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 8px 10px; font-size: 12px; line-height: 1.6; white-space: nowrap; box-shadow: var(--shadow-lg); z-index: 2; font-variant-numeric: tabular-nums; }
.stats-sec { margin-top: var(--s-6); }
.sec-head { margin-bottom: 10px; }
.sec-head h2 { margin: 0; font-size: var(--fs-lg); }
.tbl th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.tbl th.sortable:hover, .tbl th.sorted { color: var(--text); }
.tbl th.num, .tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
.stats-foot { margin-top: var(--s-4); font-size: 12px; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:focus { outline: none; }
.tbl tr.clickable:focus-visible td { background: var(--brand-soft); }
.tbl td.go { color: var(--faint); width: 1%; }
.tbl tr.clickable:hover td.go { color: var(--text); }
.cell-err { font-size: 12px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 4px; }
.my-tasks { max-height: none; }
.my-tasks .cell-detail { font-family: var(--font); font-size: var(--fs-md); color: var(--text-2); }
.pager { margin-top: var(--s-4); font-variant-numeric: tabular-nums; font-size: var(--fs-sm); }
.task.focus { border-color: var(--brand); box-shadow: var(--focus-ring); }
.kv { display: grid; grid-template-columns: 72px 1fr; gap: 10px 16px; margin: 0 0 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.task-detail h3 { font-size: 14px; margin: 18px 0 8px; }

@media (max-width: 768px) {
  .stats-filters .range { flex: 1 1 100%; }
  .stats-filters .range input { flex: 1 1 0; min-width: 0; }
  .seg button { min-height: 36px; }
  .charts { grid-template-columns: minmax(0, 1fr); }
  .usage-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .usage-cards .stat .v { font-size: 20px; }
  .filters > select { flex: 1 1 0; min-width: 0; }
  .my-tasks { border: 0; overflow: visible; background: none; box-shadow: none; }
  .my-tasks .tbl td.num { text-align: left; }
  .my-tasks .tbl td.go { display: none; }
  .my-tasks .tbl td.cell-detail { min-width: 0; }
  .my-tasks .tbl tr.clickable:hover td { background: none; }
}
@media (max-width: 420px) {
  nav a { padding: 8px 8px; }
}

/* ---------------- 服务网关：我的凭证 + 应用页授权引导 ---------------- */
.cred-intro { margin: -8px 0 16px; }
.cred-list { display: grid; gap: var(--s-3); max-width: 820px; }
.cred-list .panel + .panel { margin-top: 0; }
.cred { padding: var(--s-5); transition: border-color var(--dur), box-shadow var(--dur); }
.cred.focus { border-color: var(--brand); box-shadow: var(--focus-ring); }
.cred.ok { border-left: 1px solid var(--border); }
.cred-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cred-name { font-size: 15px; font-weight: 600; }
.cred-on { color: var(--success); }
.cred-off { color: var(--muted); }
.cred-meta { display: flex; gap: 6px 18px; flex-wrap: wrap; color: var(--muted); font-size: 12px; margin-top: 10px; min-width: 0; padding-left: 42px; }
.cred-meta .mono { word-break: break-all; color: var(--text-2); }
.cred-form { display: grid; gap: var(--s-3); margin-top: var(--s-4); padding-top: var(--s-4); border-top: 1px solid var(--border-subtle); }
.cred-form label.field > input, .cred-form label.field > select, .cred-form label.field > textarea { width: 100%; min-width: 0; }
.cred-form textarea { resize: vertical; min-height: 72px; }
.cred-msg { font-size: 13px; color: var(--muted); flex: 1 1 200px; min-width: 0; }
.cred-msg.err { color: var(--danger); }
.cred-banner {
  display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; padding: 8px 16px;
  background: var(--warning-bg); border-bottom: 1px solid var(--warning-bd); color: var(--warning); font-size: var(--fs-sm); font-weight: 500;
}
main.full.has-banner { display: flex; flex-direction: column; }
main.full.has-banner > .appview { flex: 1 1 auto; height: auto; min-height: 0; }
@media (max-width: 768px) {
  .cred-banner { padding: 8px 12px; font-size: 14px; }
  .cred-head .btn.sm { min-width: 64px; }
  .cred-meta { padding-left: 0; }
}

/* ---------------- 任务通知铃铛（顶栏） ---------------- */
.bell-wrap { position: relative; flex: none; }
.bell {
  position: relative; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
  background: none; border: 1px solid transparent; border-radius: var(--r-md); color: var(--muted); cursor: pointer; padding: 0;
  transition: color var(--dur), background-color var(--dur);
}
.bell svg { width: 18px; height: 18px; }
.bell:hover, .bell[aria-expanded=true] { color: var(--text); background: var(--surface-3); }
.bell-count {
  position: absolute; top: 3px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
  box-shadow: 0 0 0 2px var(--surface); font-variant-numeric: tabular-nums;
}
.bell-panel {
  position: absolute; right: -8px; top: calc(100% + 10px); width: 380px; max-height: min(540px, calc(100vh - 80px));
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-xl); z-index: 60; overflow: hidden; animation: pop .16s var(--ease); transform-origin: top right;
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.bell-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.bell-head b { font-weight: 600; }
.bell-head .muted { font-size: 12px; }
.bell-list { overflow-y: auto; flex: 1 1 auto; padding: 4px; }
.bell-item {
  display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: var(--r-md);
  color: var(--text); font: inherit; padding: 10px 12px 10px 24px; cursor: pointer; position: relative; transition: background-color var(--dur);
}
.bell-item + .bell-item { margin-top: 1px; }
.bell-item:hover, .bell-item:focus-visible { background: var(--surface-3); outline: none; }
.bell-item.unread::before {
  content: ""; position: absolute; left: 10px; top: 20px; width: 7px; height: 7px; border-radius: 50%; background: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.bell-item:not(.unread) .bell-app { color: var(--text-2); }
.bell-item.unread .bell-app { font-weight: 600; }
.bell-line { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.bell-app { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.bell-sub { display: flex; gap: 8px; justify-content: space-between; font-size: 12px; margin-top: 4px; padding-left: 32px; }
.bell-sess { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.bell-err { color: var(--danger); font-size: 12px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 32px; }
.bell-empty { padding: 32px 12px; }
.bell-foot {
  display: flex; gap: 8px; justify-content: space-between; align-items: center; flex-wrap: wrap; padding: 10px 14px; font-size: 12px;
  border-top: 1px solid var(--border); background: var(--surface-2);
}
.link-more { display: inline-flex; align-items: center; gap: 2px; font-weight: 500; }
.toast.clickable { cursor: pointer; display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.toast.clickable:hover { border-color: var(--border-strong); }
.toast-go { color: var(--brand-text); white-space: nowrap; flex: none; display: inline-flex; align-items: center; gap: 2px; font-weight: 500; font-size: var(--fs-sm); }

/* ---------------- 应用中心：分类 chips 与标签 ---------------- */
.home-search { width: 320px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  background: var(--surface); color: var(--text-2); border: 1px solid var(--border); border-radius: var(--r-full); padding: 0 12px; height: 32px;
  font: inherit; font-size: var(--fs-sm); font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: background-color var(--dur), border-color var(--dur), color var(--dur);
}
.chip:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-3); }
.chip.active { color: var(--brand-fg); background: var(--text); border-color: var(--text); }
:root[data-theme="dark"] .chip.active { color: var(--bg); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip.active { color: var(--bg); } }
.chip-n { font-size: 11px; opacity: .65; font-variant-numeric: tabular-nums; }
.card-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  background: var(--surface-3); color: var(--text-2); border: 0; border-radius: var(--r-xs); padding: 2px 7px; font: inherit; font-size: 12px; cursor: pointer;
  transition: background-color var(--dur), color var(--dur);
}
.tag:hover { background: var(--brand-soft); color: var(--brand-text); }
.tag.cat { background: var(--brand-soft); color: var(--brand-text); cursor: default; font-weight: 500; }

/* ---------------- 管理后台：应用 ---------------- */
.apps-tbl .app-cell { display: flex; gap: 10px; align-items: center; }
.apps-tbl input.cell-input { width: 100%; min-width: 120px; }
.apps-tbl td.actions { white-space: nowrap; }
.apps-tbl td.actions .btn + .btn { margin-left: 6px; }
.apps-tbl .owner-name { display: block; font-size: 12px; margin-top: 2px; }
.apps-note { font-size: 12px; margin-top: 12px; }

@media (max-width: 768px) {
  .bell { width: 40px; height: 40px; }
  .bell-panel { position: fixed; left: 8px; right: 8px; top: calc(var(--topbar-h) + 4px); width: auto; max-height: calc(100dvh - 72px); }
  .bell-item { padding: 12px 12px 12px 24px; }
  .home-search { width: auto; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: -16px; padding-right: 16px; flex: 1 1 100%; min-width: 0; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; min-height: 36px; }
  .tag { font-size: 13px; padding: 3px 8px; }
  .apps-tbl .owner-name { display: none; }
  .apps-tbl td.actions .btn + .btn { margin-left: 0; }
  .apps-tbl input.cell-input { min-width: 0; }
}

/* ---------------- 用户菜单（桌面与手机端都用头像菜单） ---------------- */
.umenu-btn {
  display: inline-flex; align-items: center; gap: 8px; max-width: 180px; height: 36px; padding: 0 8px 0 4px; margin-left: 4px;
  background: none; border: 1px solid transparent; border-radius: var(--r-full); color: var(--text); font: inherit; font-size: var(--fs-md); font-weight: 500; cursor: pointer;
  transition: background-color var(--dur), border-color var(--dur);
}
.umenu-btn:hover, .umenu-btn[aria-expanded=true] { background: var(--surface-3); }
.umenu-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.umenu-btn.active .umenu-name { color: var(--brand-text); }
.umenu-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.umenu-caret { flex: none; color: var(--faint); display: inline-flex; }
.umenu {
  position: absolute; right: 0; top: calc(100% + 10px); min-width: 240px; z-index: 30; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-xl);
  display: flex; flex-direction: column; animation: pop .16s var(--ease); transform-origin: top right;
}
.umenu.hidden { display: none; }
.umenu-who { display: flex; align-items: center; gap: 10px; padding: 8px 10px 12px; border-bottom: 1px solid var(--border); margin: 0 -6px 6px; padding-left: 16px; padding-right: 16px; }
.umenu-who-text { min-width: 0; font-size: var(--fs-sm); line-height: 1.4; }
.umenu-who b { color: var(--text); font-weight: 600; font-size: var(--fs-md); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.umenu-item {
  display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 10px; border-radius: var(--r-sm);
  color: var(--text-2); background: none; border: 0; font: inherit; font-size: var(--fs-md); text-align: left; cursor: pointer; width: 100%;
}
.umenu-item:hover, .umenu-item:focus-visible { background: var(--surface-3); color: var(--text); text-decoration: none; outline: none; }
.umenu-item.active { color: var(--brand-text); }
.umenu-item.active .umenu-ico { color: var(--brand); }
.umenu-ico { width: 20px; color: var(--muted); }
.umenu-val { margin-left: auto; font-size: 12px; color: var(--muted); background: var(--surface-3); border-radius: var(--r-full); padding: 1px 8px; }
.umenu-sep { height: 1px; background: var(--border); margin: 6px -6px; }
@media (max-width: 768px) {
  .umenu-btn { max-width: 120px; height: 40px; margin-left: 0; font-size: 14px; }
  .umenu { position: fixed; left: auto; right: 8px; top: calc(var(--topbar-h) + 4px); min-width: 240px; }
  .umenu-item { min-height: 44px; font-size: 15px; }
}

/* ---------------- 帮助页 ---------------- */
.help-page { max-width: 860px; margin: 0 auto; }
.help-toc { margin: 0 0 var(--s-6); }
.help-sec { margin-bottom: var(--s-4); scroll-margin-top: 72px; }
.help-sec + .help-sec { margin-top: 0; }
.help-sec h2 { font-size: 17px; margin-bottom: 14px; }
.help-sec ul, .help-sec ol { margin: 0; padding-left: 20px; line-height: 1.8; color: var(--text-2); }
.help-sec li + li { margin-top: 4px; }
.help-sec li::marker { color: var(--faint); }
.help-sec b { color: var(--text); font-weight: 600; }
.help-qa { border-top: 1px solid var(--border-subtle); padding: 12px 0; }
.help-qa:first-of-type { border-top: 0; padding-top: 0; }
.help-qa summary { cursor: pointer; font-weight: 500; color: var(--text); list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.help-qa summary::-webkit-details-marker { display: none; }
.help-qa summary::after {
  content: ""; width: 7px; height: 7px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg); transition: transform var(--dur); flex: none; margin-right: 4px;
}
.help-qa[open] summary::after { transform: rotate(-135deg); }
.help-qa summary:hover { color: var(--brand-text); }
.help-qa > div { margin-top: 8px; color: var(--text-2); line-height: 1.8; }
.help-qa > div ul { margin-top: 0; }
@media (max-width: 768px) {
  .help-toc { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: -16px; padding-right: 16px; }
  .help-toc::-webkit-scrollbar { display: none; }
  .help-sec { padding: 16px; }
  .help-qa summary { min-height: 32px; }
}

/* ---------------- 服务配置：候选模型列表 ---------------- */
div.field.model-field { display: flex; flex-direction: column; gap: 6px; color: var(--text-2); font-size: var(--fs-sm); font-weight: 500; }
.model-list { display: flex; flex-direction: column; gap: 8px; color: var(--text); font-size: 14px; font-weight: 400; }
.model-rows { display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--border); border-radius: var(--r-md); padding: 4px 10px; background: var(--surface-2); }
.model-rows:empty { display: none; }
.model-row { align-items: center; padding: 6px 0; flex-wrap: nowrap; }
.model-row + .model-row { border-top: 1px solid var(--border-subtle); }
.model-row label { display: flex; align-items: center; gap: 8px; min-width: 0; overflow-wrap: anywhere; }
.model-add { flex-wrap: nowrap; }
.model-add input { flex: 1 1 auto; min-width: 0; width: 100%; }
.model-add button { flex: none; }
.model-list .muted { font-size: 12px; }
.model-list > .cred-msg { flex: none; }          /* .cred-msg 的 flex-basis 200px 在纵向 flex 里会变成 200px 高 */
.model-list > .cred-msg:empty { display: none; }
.model-row:has(.model-caps) { flex-wrap: wrap; gap: 4px 10px; }
.model-caps { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; color: var(--muted, inherit); }
.model-caps .cap-in { width: 72px; min-width: 0; padding: 2px 8px; height: 30px; }
div.field.cert-field { display: flex; flex-direction: column; gap: 6px; color: var(--text-2); font-size: var(--fs-sm); font-weight: 500; }
.cert-field textarea { color: var(--text); font-size: 13px; font-family: var(--mono); font-weight: 400; }
.cert-head { align-items: center; flex-wrap: nowrap; }
.cert-field textarea { min-height: 120px; }

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