/* ============================================================
   RelayOS 用户端 UI 重设计 v3 —— SaaS 双主题设计系统
   浅色默认 :root，深色 html[data-theme="dark"] 变量覆盖
   全站零硬编码配色；admin 控制台共享本文件（结构 class 不变）
   ============================================================ */

/* 视频功能已隐藏：全局兜底确保 hidden 属性不被业务样式覆盖（恢复：删除本规则，所有 hidden 元素恢复默认隐藏逻辑） */
[hidden] { display: none !important; }

/* ---------- 1. 设计系统 Tokens ---------- */
/* 视觉对齐 miaoapi.xyz：暗色默认、主色 #0A84FF、卡片 #171D25 / 浮层 #1A1B1D / 弹窗 #141920 */
:root {
  --bg: #0b0f14;
  --panel: #171d25;
  --panel-raised: #1a1b1d;
  --panel-deep: rgba(25, 32, 41, .92);
  --line: rgba(235, 235, 245, .16);
  --line-light: rgba(235, 235, 245, .09);
  --text: #e8edf4;
  --muted: #94a3b8;
  --quiet: #64748b;
  --accent: #0a84ff;
  --accent-strong: #2f93ff;
  --accent-glow: #6db8ff;
  --accent-soft: rgba(10, 132, 255, .14);
  --success-soft: rgba(74, 222, 128, .12);
  --mint: #4ade80;
  --blue: #0a84ff;
  --yellow: #fbbf24;
  --coral: #fb7185;
  --danger: #f87171;
  --violet: #a78bfa;
  --code-bg: #0b1220;
  --code-text: #cbd5e1;
  --orange: var(--accent);
  --mint-dark: #1d4b3a;
  --wf-accent: #0a84ff;
  --wf-accent-strong: #2f93ff;
  --wf-accent-dim: rgba(10, 132, 255, .16);
  --wf-success: #4ade80;
  --wf-failed: #f87171;
  --wf-running: #fbbf24;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .22), inset 0 1px 0 rgba(255, 255, 255, .06);
  --shadow-card-hover: 0 2px 6px rgba(0, 0, 0, .45), 0 16px 40px rgba(0, 0, 0, .32), inset 0 1px 0 rgba(255, 255, 255, .06);
  --radius-card: 18px;
  --radius-panel: 12px;
  --radius-control: 10px;

  /* ---------- miaoapi --ds-* 设计系统（keys 重构 / 极速对话共用） ---------- */
  --ds-canvas: #0b0f14;
  --ds-canvas-recessed: #070a0e;
  --ds-surface: #141920;
  --ds-surface-raised: #171d25;
  --ds-surface-2: #1a2029;
  --ds-surface-hover: #222b36;
  --ds-surface-recessed: #0f141a;
  --ds-control-surface: rgba(25, 32, 41, .92);
  --ds-accent: #0a84ff;
  --ds-accent-strong: #5ac8fa;
  --ds-on-accent: #ffffff;
  --ds-ink: #f8fafc;
  --ds-ink-2: #cbd5e1;
  --ds-ink-3: #94a3b8;
  --ds-ink-4: #64748b;
  --ds-on-ink: #0b0f17;
  --ds-ok: #34d399;
  --ds-danger: #f87171;
  --ds-line: rgba(235, 235, 245, .16);
  --ds-line-soft: rgba(235, 235, 245, .09);
  --ds-line-strong: rgba(235, 235, 245, .2);
  --ds-sidebar-surface: rgba(12, 16, 21, .97);
  --ds-sidebar-surface-elevated: #11161d;
  --ds-sidebar-footer: rgba(9, 13, 18, .97);
  --ds-sidebar-hover: #19212b;
  --ds-sidebar-ink: #f5f5f7;
  --ds-sidebar-ink-muted: #a1a1a6;
  --ds-sidebar-icon: #94a3b8;
  --ds-sidebar-icon-hover: #e2e8f0;
  --ds-sidebar-icon-active: #5ac8fa;
  --ds-sidebar-active-bg: rgba(10, 132, 255, .16);
  --ds-sidebar-active-ink: #8ecbff;
  --ds-sidebar-active-line: rgba(90, 200, 250, .26);
  --ds-sidebar-logo-bg: linear-gradient(145deg, #242426, #1c2733);
  --ds-sidebar-logo-border: rgba(90, 200, 250, .24);
  --ds-sidebar-logo-shadow: 0 10px 24px rgba(0, 0, 0, .32);
  --ds-sidebar-line: rgba(235, 235, 245, .13);
  --ds-radius-sm: 10px;
  --ds-radius-md: 14px;
  --ds-radius-lg: 20px;
  --ds-control-height: 40px;
  --ds-control-height-touch: 44px;
  --ds-shadow-panel: 0 8px 24px rgba(0, 0, 0, .22);
  --ds-shadow-control: inset 0 1px 0 rgba(255, 255, 255, .04), 0 1px 2px rgba(0, 0, 0, .18);
  --ds-shadow-float: 0 22px 52px rgba(0, 0, 0, .54);
  --ds-card-highlight: rgba(255, 255, 255, .06);
}

html[data-theme="dark"] {
  --bg: #0b0f14;
  --panel: #171d25;
  --panel-raised: #1a1b1d;
  --panel-deep: rgba(25, 32, 41, .92);
  --line: rgba(235, 235, 245, .16);
  --line-light: rgba(235, 235, 245, .09);
  --text: #e8edf4;
  --muted: #94a3b8;
  --quiet: #64748b;
  --accent: #0a84ff;
  --accent-strong: #2f93ff;
  --accent-glow: #6db8ff;
  --accent-soft: rgba(10, 132, 255, .14);
  --success-soft: rgba(74, 222, 128, .12);
  --mint: #4ade80;
  --blue: #0a84ff;
  --yellow: #fbbf24;
  --coral: #fb7185;
  --danger: #f87171;
  --violet: #a78bfa;
  --code-bg: #0b1220;
  --code-text: #cbd5e1;
  --orange: var(--accent);
  --mint-dark: #1d4b3a;
  --wf-accent: #0a84ff;
  --wf-accent-strong: #2f93ff;
  --wf-accent-dim: rgba(10, 132, 255, .16);
  --wf-success: #4ade80;
  --wf-failed: #f87171;
  --wf-running: #fbbf24;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .22), inset 0 1px 0 rgba(255, 255, 255, .06);
  --shadow-card-hover: 0 2px 6px rgba(0, 0, 0, .45), 0 16px 40px rgba(0, 0, 0, .32), inset 0 1px 0 rgba(255, 255, 255, .06);
  --radius-card: 18px;
  --radius-panel: 12px;
  --radius-control: 10px;

  /* ---------- miaoapi --ds-* 设计系统（keys 重构 / 极速对话共用） ---------- */
  --ds-canvas: #0b0f14;
  --ds-canvas-recessed: #070a0e;
  --ds-surface: #141920;
  --ds-surface-raised: #171d25;
  --ds-surface-2: #1a2029;
  --ds-surface-hover: #222b36;
  --ds-surface-recessed: #0f141a;
  --ds-control-surface: rgba(25, 32, 41, .92);
  --ds-accent: #0a84ff;
  --ds-accent-strong: #5ac8fa;
  --ds-on-accent: #ffffff;
  --ds-ink: #f8fafc;
  --ds-ink-2: #cbd5e1;
  --ds-ink-3: #94a3b8;
  --ds-ink-4: #64748b;
  --ds-on-ink: #0b0f17;
  --ds-ok: #34d399;
  --ds-danger: #f87171;
  --ds-line: rgba(235, 235, 245, .16);
  --ds-line-soft: rgba(235, 235, 245, .09);
  --ds-line-strong: rgba(235, 235, 245, .2);
  --ds-sidebar-surface: rgba(12, 16, 21, .97);
  --ds-sidebar-surface-elevated: #11161d;
  --ds-sidebar-footer: rgba(9, 13, 18, .97);
  --ds-sidebar-hover: #19212b;
  --ds-sidebar-ink: #f5f5f7;
  --ds-sidebar-ink-muted: #a1a1a6;
  --ds-sidebar-icon: #94a3b8;
  --ds-sidebar-icon-hover: #e2e8f0;
  --ds-sidebar-icon-active: #5ac8fa;
  --ds-sidebar-active-bg: rgba(10, 132, 255, .16);
  --ds-sidebar-active-ink: #8ecbff;
  --ds-sidebar-active-line: rgba(90, 200, 250, .26);
  --ds-sidebar-logo-bg: linear-gradient(145deg, #242426, #1c2733);
  --ds-sidebar-logo-border: rgba(90, 200, 250, .24);
  --ds-sidebar-logo-shadow: 0 10px 24px rgba(0, 0, 0, .32);
  --ds-sidebar-line: rgba(235, 235, 245, .13);
  --ds-radius-sm: 10px;
  --ds-radius-md: 14px;
  --ds-radius-lg: 20px;
  --ds-control-height: 40px;
  --ds-control-height-touch: 44px;
  --ds-shadow-panel: 0 8px 24px rgba(0, 0, 0, .22);
  --ds-shadow-control: inset 0 1px 0 rgba(255, 255, 255, .04), 0 1px 2px rgba(0, 0, 0, .18);
  --ds-shadow-float: 0 22px 52px rgba(0, 0, 0, .54);
  --ds-card-highlight: rgba(255, 255, 255, .06);
}

/* ---------- 2. 全局基础 ---------- */
* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body { min-height: 100%; margin: 0; color: var(--text); background: var(--bg); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; letter-spacing: 0; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.is-hidden { display: none !important; }

label { display: grid; gap: 8px; color: var(--muted); font-size: 11px; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: var(--radius-control); outline: 0; color: var(--text); background: var(--panel-deep); transition: border-color .15s ease, box-shadow .15s ease; }
input, select { height: 42px; padding: 0 12px; }
textarea { min-height: 92px; padding: 11px 12px; line-height: 1.55; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(224, 113, 79, .14); }
input::placeholder, textarea::placeholder { color: var(--quiet); }

.solid-button, .outline-button, .ghost-button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 38px; border-radius: var(--radius-control); font-size: 12px; font-weight: 800; transition: all .15s ease; }
.solid-button { padding: 0 16px; border: 1px solid transparent; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-strong)); box-shadow: 0 1px 2px rgba(16, 24, 40, .08), 0 4px 12px rgba(224, 113, 79, .25); }
.solid-button:hover { transform: translateY(-1px); filter: brightness(1.06); box-shadow: 0 2px 4px rgba(16, 24, 40, .10), 0 8px 20px rgba(224, 113, 79, .32); }
.solid-button:disabled { cursor: wait; opacity: .55; transform: none; box-shadow: none; }
.small-button { min-height: 34px; padding: 0 13px; }
.outline-button { padding: 0 13px; border: 1px solid var(--line); color: var(--muted); background: var(--panel); text-decoration: none; }
.outline-button:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.ghost-button { min-height: auto; padding: 3px 0; border: 0; color: var(--muted); background: transparent; }
.ghost-button:hover { color: var(--accent); }
.text-button { padding: 0; border: 0; color: var(--accent); background: transparent; font-size: 11px; }
.text-button:hover { color: var(--accent-strong); text-decoration: underline; }
.danger-link { padding: 0; border: 0; color: var(--danger); background: transparent; font-size: 10px; }
.danger-link:hover { text-decoration: underline; }
.danger-button { padding: 7px 12px; border: 1px solid rgba(248, 113, 113, .55); border-radius: 8px; color: var(--wf-failed); background: transparent; font-size: 12px; }
.danger-button:hover { background: rgba(248, 113, 113, .1); }
.form-message { min-height: 16px; color: var(--danger); font-size: 11px; line-height: 1.4; }
.form-message:not(.has-error) { color: var(--mint); }

/* ---------- 3. 登录页 ---------- */
.auth-page { min-height: 100vh; background: radial-gradient(circle at 12% 7%, var(--accent-soft), transparent 32%), var(--bg); }
.public-header { display: flex; align-items: center; justify-content: space-between; min-height: 76px; padding: 0 clamp(24px, 7vw, 108px); border-bottom: 1px solid var(--line-light); background: rgba(255, 255, 255, .82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
html[data-theme="dark"] .public-header { background: rgba(11, 15, 20, .78); }
.wordmark { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-size: 14px; font-weight: 850; letter-spacing: 1.4px; text-decoration: none; }
.wordmark-symbol { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 9px; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-strong)); font-size: 17px; font-weight: 900; box-shadow: 0 2px 8px rgba(224, 113, 79, .35); }
.wordmark-muted { color: var(--quiet); font-weight: 650; }
.public-actions, .header-account { display: flex; align-items: center; gap: 18px; }
.public-actions a { color: var(--muted); font-size: 12px; text-decoration: none; }
.public-actions a:hover { color: var(--text); }
.secure-status { display: inline-flex; align-items: center; gap: 8px; color: var(--quiet); font-size: 10px; letter-spacing: .7px; }
.secure-status i, .connection-line i, .endpoint-meta i, .mode-pill i, .key-status i, .admin-trust-list i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 3px rgba(47, 158, 119, .12); }

.auth-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(370px, 430px); gap: clamp(50px, 11vw, 150px); align-items: center; width: min(1180px, calc(100% - 48px)); min-height: calc(100vh - 76px); margin: 0 auto; padding: 70px 0 90px; }
.overline, .form-kicker { color: var(--quiet); font-size: 10px; font-weight: 850; letter-spacing: 1.6px; text-transform: uppercase; }
.auth-intro h1 { max-width: 680px; margin: 16px 0 25px; font-size: clamp(42px, 5.6vw, 72px); line-height: 1.03; letter-spacing: -2.5px; color: var(--text); }
.auth-intro h1 em { font-style: normal; background: linear-gradient(90deg, var(--accent), var(--accent-glow)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { max-width: 510px; color: var(--muted); font-size: 15px; line-height: 1.75; }
.intro-points { display: grid; gap: 20px; max-width: 520px; margin-top: 52px; }
.intro-points > div { display: flex; gap: 15px; align-items: flex-start; }
.point-index { min-width: 24px; padding-top: 2px; color: var(--accent); font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; }
.intro-points strong, .intro-points small { display: block; }
.intro-points strong { margin-bottom: 4px; color: var(--text); font-size: 12px; }
.intro-points small { color: var(--quiet); font-size: 11px; line-height: 1.55; }

.auth-card, .surface, .console-panel { border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--panel); box-shadow: var(--shadow-card); }
.auth-card { padding: 30px; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 28px; padding: 4px; border: 1px solid var(--line-light); border-radius: 999px; background: var(--panel-deep); width: fit-content; }
.auth-tab { position: relative; padding: 8px 18px; border: 0; border-radius: 999px; color: var(--quiet); background: transparent; font-size: 12px; font-weight: 700; transition: all .15s ease; }
.auth-tab:hover { color: var(--text); }
.auth-tab.is-active { color: var(--accent); background: var(--accent-soft); }
.form-heading { margin-bottom: 23px; }
.form-heading h2 { margin: 8px 0 7px; font-size: 23px; letter-spacing: -.4px; color: var(--text); }
.form-heading p { color: var(--quiet); font-size: 11px; }
.auth-form { display: grid; gap: 15px; }
.form-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.card-footnote { display: flex; align-items: flex-start; gap: 8px; margin-top: 23px; padding-top: 16px; border-top: 1px solid var(--line-light); color: var(--quiet); font-size: 10px; line-height: 1.6; }
.lock-icon { color: var(--accent); font-size: 14px; line-height: 1; }

/* ---------- 4. 工作台骨架 ---------- */
.dashboard { display: flex; min-height: 100vh; background: var(--bg); }
.app-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 2; display: flex; flex-direction: column; width: 232px; padding: 26px 14px 18px; border-right: 1px solid var(--line-light); background: var(--panel); }
.sidebar-wordmark { padding: 0 10px; }
.wordmark-logo { display: block; height: 30px; width: auto; object-fit: contain; border-radius: 8px; padding: 2px 4px; background: #101a28; }
html[data-theme="dark"] .wordmark-logo { filter: brightness(1.1) contrast(1.05); }
.sidebar-caption { margin: 54px 12px 12px; color: var(--quiet); font-size: 9px; font-weight: 850; letter-spacing: 1.6px; }
.app-nav { display: grid; gap: 4px; }
.app-nav-item { position: relative; display: flex; align-items: center; gap: 12px; padding: 11px 12px 11px 16px; border: 0; border-radius: var(--radius-panel); color: var(--muted); background: transparent; text-align: left; font-size: 12px; transition: all .15s ease; }
.app-nav-item:hover { color: var(--text); background: var(--panel-deep); }
.app-nav-item.is-active { color: var(--text); background: var(--accent-soft); font-weight: 700; }
.app-nav-item.is-active::before { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 3px; height: 18px; border-radius: 999px; background: var(--accent); }
.nav-glyph { display: grid; place-items: center; width: 16px; color: var(--quiet); font-size: 16px; }
.app-nav-item.is-active .nav-glyph { color: var(--accent); }
.sidebar-bottom { margin-top: auto; }
.connection-line { display: flex; align-items: center; gap: 10px; padding: 13px 11px; border: 1px solid var(--line-light); border-radius: var(--radius-panel); background: var(--panel-deep); }
.connection-line strong, .connection-line small { display: block; }
.connection-line strong { color: var(--text); font-size: 11px; }
.connection-line small { margin-top: 4px; color: var(--quiet); font-size: 10px; }
.sidebar-link { display: flex; align-items: center; justify-content: space-between; padding: 14px 12px 0; color: var(--muted); font-size: 11px; text-decoration: none; }
.sidebar-link:hover { color: var(--accent); }
.app-main { min-width: 0; flex: 1; margin-left: 232px; }
.app-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 29px clamp(26px, 4vw, 60px) 23px; border-bottom: 1px solid var(--line-light); background: rgba(255, 255, 255, .72); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
html[data-theme="dark"] .app-header { background: rgba(11, 15, 20, .72); }
.app-header h1 { margin-top: 8px; font-size: 26px; letter-spacing: -.5px; color: var(--text); }
.user-badge { color: var(--muted); font-size: 11px; }
.usage-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border: 1px solid var(--line-light); border-radius: 999px; background: var(--panel-deep); color: var(--muted); font-size: 11px; white-space: nowrap; }
.usage-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--quiet); }
#userBalanceBadge { border-color: rgba(224, 113, 79, .35); color: var(--accent); background: var(--accent-soft); font-weight: 700; font-variant-numeric: tabular-nums; }
#userBalanceBadge::before { display: none; }
#userBalanceBadge i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.app-view-panel { width: min(1240px, calc(100% - 52px)); margin: 0 auto; padding: 31px 0 60px; }

/* ---------- 5. 总览 ---------- */
.welcome-row, .section-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; margin-bottom: 23px; }
.section-intro { align-items: center; }
.welcome-row h2, .section-intro h2 { margin: 8px 0 8px; font-size: 21px; letter-spacing: -.3px; color: var(--text); }
.welcome-row p, .section-intro p { color: var(--muted); font-size: 12px; line-height: 1.6; }
.overview-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat-card { position: relative; min-height: 134px; padding: 18px 19px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--panel); box-shadow: var(--shadow-card); transition: transform .18s ease, box-shadow .18s ease; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card-hover); }
.stat-card > span, .stat-card small { display: block; color: var(--muted); font-size: 11px; }
.stat-card strong { display: block; margin: 20px 0 9px; color: var(--text); font-size: 30px; letter-spacing: -.8px; font-variant-numeric: tabular-nums; }
.stat-card small { color: var(--quiet); font-size: 10px; }
.stat-mark { position: absolute; right: 18px; top: 18px; width: 8px; height: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 5px rgba(47, 158, 119, .10); }
.stat-mark.blue { background: var(--blue); box-shadow: 0 0 0 5px rgba(59, 130, 246, .10); }
.stat-mark.yellow { background: var(--yellow); box-shadow: 0 0 0 5px rgba(217, 119, 6, .10); }
.stat-mark.coral { background: var(--coral); box-shadow: 0 0 0 5px rgba(224, 83, 61, .10); }
.stat-mark.violet { background: var(--violet); box-shadow: 0 0 0 5px rgba(124, 92, 240, .12); }
.overview-columns { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(330px, .85fr); gap: 16px; margin-top: 16px; }

.surface { padding: 21px; }
.surface-heading, .key-manager-top, .list-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.surface-heading h3, .key-manager-top h3 { margin: 7px 0 5px; font-size: 15px; color: var(--text); }
.surface-heading p, .key-manager-top p { color: var(--quiet); font-size: 11px; line-height: 1.5; }
.step-count { color: var(--quiet); font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; }
.steps { display: grid; gap: 0; margin: 22px 0 18px; padding: 0; list-style: none; }
.steps li { display: flex; gap: 13px; padding: 13px 0; border-top: 1px solid var(--line-light); }
.steps li > span { color: var(--accent); font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; }
.steps strong, .steps small { display: block; }
.steps strong { margin-bottom: 4px; color: var(--text); font-size: 11px; }
.steps small { color: var(--quiet); font-size: 10px; line-height: 1.5; }

.endpoint-card { display: flex; flex-direction: column; }
.icon-action { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; border: 1px solid var(--line-light); border-radius: 8px; color: var(--muted); background: var(--panel); font-size: 15px; cursor: pointer; transition: all .15s ease; }
.icon-action:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.endpoint-card > code { display: block; margin: 21px 0 15px; padding: 13px 14px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-panel); color: var(--code-text); background: var(--code-bg); font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; white-space: nowrap; }
.endpoint-meta { display: flex; justify-content: space-between; color: var(--quiet); font-size: 10px; }
.endpoint-meta span:first-child { display: inline-flex; align-items: center; gap: 7px; color: var(--mint); }
.endpoint-card pre { margin: 22px 0 0; padding: 13px 14px; border-top: 1px solid var(--line-light); color: var(--muted); font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; line-height: 1.65; white-space: pre-wrap; }

.billing-head { margin-top: 28px; }
.billing-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
.billing-card { display: flex; flex-direction: column; }
.billing-list { display: flex; flex-direction: column; gap: 0; margin-top: 14px; }
.billing-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line-light); }
.billing-row:last-child { border-bottom: 0; }
.billing-row strong { display: block; color: var(--text); font-size: 13px; letter-spacing: -.1px; }
.billing-row small { display: block; margin-top: 3px; color: var(--quiet); font-size: 11px; }
.billing-row small code { color: var(--blue); }
.billing-price { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 12px; white-space: nowrap; }
.billing-free { color: var(--mint); }
.billing-empty { color: var(--quiet); font-size: 12px; padding: 12px 0; }

/* ---------- 6. API Keys ---------- */
.key-manager { padding: 0; overflow: hidden; }
.key-manager-top { align-items: center; padding: 22px; border-bottom: 1px solid var(--line-light); }
.key-form { display: flex; gap: 8px; width: min(440px, 50%); }
.key-form input { height: 36px; background: var(--panel-deep); }
.key-form .solid-button { flex: 0 0 auto; }
.new-key-notice { display: grid; grid-template-columns: minmax(230px, auto) minmax(0, 1fr) auto; gap: 15px; align-items: center; margin: 14px 22px 0; padding: 14px 16px; border: 1px solid rgba(47, 158, 119, .35); border-radius: var(--radius-panel); background: var(--success-soft); }
.new-key-notice > div { display: flex; align-items: flex-start; gap: 9px; }
.notice-icon { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; color: #fff; background: var(--mint); font-size: 12px; font-weight: 900; }
.new-key-notice strong, .new-key-notice small { display: block; }
.new-key-notice strong { color: var(--text); font-size: 11px; }
.new-key-notice small { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.new-key-notice code { overflow: auto; padding: 9px 10px; border-radius: 8px; color: var(--code-text); background: var(--code-bg); font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; white-space: nowrap; }
.list-heading { align-items: center; margin: 20px 22px 0; color: var(--muted); font-size: 11px; font-weight: 750; }
.list-heading span:last-child { color: var(--quiet); font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; font-weight: 400; }
.key-list { display: grid; margin: 10px 22px 0; }
.key-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 10px; border-top: 1px solid var(--line-light); border-radius: var(--radius-panel); transition: background .12s ease; }
.key-row:hover { background: var(--panel-deep); }
.key-identity, .key-actions { display: flex; align-items: center; gap: 11px; min-width: 0; }
.key-avatar { display: grid; place-items: center; flex: 0 0 auto; width: 28px; height: 28px; border: 1px solid var(--accent-soft); border-radius: 8px; color: var(--accent); background: var(--accent-soft); font-size: 11px; font-weight: 800; }
.key-identity strong, .key-identity code, .key-identity small { display: block; }
.key-identity strong { margin-bottom: 5px; color: var(--text); font-size: 11px; }
.key-identity code { color: var(--muted); font-size: 10px; }
.key-identity small { margin-top: 4px; color: var(--quiet); font-size: 9px; }
.key-actions { flex-wrap: wrap; justify-content: flex-end; }
.key-status { display: inline-flex; align-items: center; gap: 6px; color: var(--mint); font-size: 10px; white-space: nowrap; }
.key-status.revoked { color: var(--danger); }
.key-status.revoked i { background: var(--danger); box-shadow: 0 0 0 3px rgba(220, 38, 38, .12); }
.key-last-used { color: var(--quiet); font-size: 10px; white-space: nowrap; }
.empty-key-state { padding: 22px 0 24px; color: var(--quiet); font-size: 11px; }
.security-banner { display: flex; gap: 11px; align-items: flex-start; margin-top: 13px; padding: 13px 15px; border: 1px solid rgba(224, 113, 79, .28); border-radius: var(--radius-panel); background: var(--accent-soft); }
.security-banner > span { color: var(--accent); font-size: 16px; }
.security-banner strong { display: block; margin-bottom: 4px; color: var(--accent-strong); font-size: 11px; }
.security-banner p { color: var(--muted); font-size: 10px; line-height: 1.5; }

/* ---------- 7. 请求测试 ---------- */
.request-layout { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: 16px; }
.toggle-label { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 10px; font-weight: 600; white-space: nowrap; }
.toggle-label input { width: 15px; height: 15px; accent-color: var(--accent); }
#chatForm { display: grid; gap: 15px; }
.request-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; color: var(--quiet); font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; }
.response-panel { min-height: 360px; }
.response-state { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; color: var(--muted); background: var(--panel-deep); font-size: 10px; font-weight: 700; white-space: nowrap; }
.response-panel pre { min-height: 276px; max-height: 480px; overflow: auto; margin: 20px 0 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-panel); color: var(--code-text); background: var(--code-bg); font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }

.mode-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--line-light); border-radius: 999px; color: var(--muted); background: var(--panel); font-size: 10px; }
.mode-pill.is-degraded { color: var(--yellow); border-color: rgba(217, 119, 6, .3); background: rgba(217, 119, 6, .08); }

/* ---------- 8. AI 绘图 / 视频结果 ---------- */
.media-result { min-height: 300px; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.media-placeholder { color: var(--quiet); font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; margin: 18px 0; }
.media-thumb { display: block; max-width: 100%; }
.media-thumb img { max-width: 100%; max-height: 420px; border-radius: var(--radius-panel); border: 1px solid var(--line); box-shadow: 0 6px 18px rgba(16, 24, 40, .10); }
.media-thumb-video { display: block; }
.media-thumb-video video { width: 100%; max-height: 420px; border-radius: var(--radius-panel); border: 1px solid var(--line); background: #000; box-shadow: 0 6px 18px rgba(16, 24, 40, .10); }
.wf-config-download { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; padding: 5px 12px; border: 1px solid var(--line-light); border-radius: 999px; color: var(--accent); background: var(--accent-soft); font-size: 11px; font-weight: 700; text-decoration: none; transition: all .12s ease; }
.wf-config-download:hover { border-color: var(--accent); color: var(--accent); }
.media-meta { font-size: 12px; color: var(--muted); }
.media-note { font-size: 13px; color: var(--muted); margin: 4px 0; }
.media-raw { width: 100%; max-height: 260px; overflow: auto; margin: 0; padding: 12px; border-radius: 8px; background: var(--code-bg); color: var(--code-text); border: 1px solid var(--line); font-size: 12px; }

/* ---------- 9. 充值 ---------- */
.recharge-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.recharge-card { display: flex; flex-direction: column; }
.amount-quick-row { display: flex; flex-wrap: wrap; gap: 8px; }
.quick-amount { min-height: 34px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius-control); color: var(--muted); background: var(--panel); font-size: 11px; font-weight: 700; transition: all .12s ease; }
.quick-amount:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ---------- 10. 文档预览 ---------- */
.docs-preview-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.docs-preview { min-height: 200px; }
.doc-number { color: var(--accent); font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; }
.docs-preview h3 { margin: 29px 0 9px; font-size: 16px; color: var(--text); }
.docs-preview p { min-height: 53px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.docs-preview p code { color: var(--blue); }
.block-code { display: block; margin-top: 19px; padding: 11px 12px; border-top: 1px solid var(--line-light); border-radius: 8px; color: var(--code-text); background: var(--code-bg); font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; word-break: break-word; }

/* ---------- 11. Toast / 主题切换 ---------- */
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 5; max-width: 340px; padding: 11px 14px; border: 1px solid rgba(47, 158, 119, .4); border-radius: var(--radius-panel); color: #fff; background: var(--mint); box-shadow: 0 14px 35px rgba(16, 24, 40, .18); font-size: 11px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: all .16s ease; }
.toast[data-kind="error"] { border-color: rgba(220, 38, 38, .4); background: var(--danger); }
.toast[data-kind="info"] { background: var(--mint); }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex: none; border: 1px solid var(--line-light); border-radius: 50%; color: var(--muted); background: var(--panel); font-size: 14px; line-height: 1; cursor: pointer; transition: all .15s ease; }
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- 12. AI 视频制作向导（兼容保留） ---------- */
.wizard-steps { display: flex; gap: 8px; margin: 16px 0 14px; padding: 6px; border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--panel); width: fit-content; max-width: 100%; overflow-x: auto; }
.wizard-step { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 0 14px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 700; white-space: nowrap; cursor: pointer; opacity: .55; }
.wizard-step span { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; color: #fff; background: var(--muted); font-size: 11px; }
.wizard-step.is-active { color: var(--text); background: var(--panel-deep); opacity: 1; }
.wizard-step.is-active span { background: var(--accent); }
.wizard-step:disabled { cursor: default; }
.wizard-pane { display: block; }
.wizard-pane.is-hidden { display: none; }
.wizard-pane-actions { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 14px; }
.wizard-body { margin-top: 6px; }
.script-meta { display: grid; gap: 4px; margin-bottom: 12px; }
.script-meta strong { font-size: 16px; }
.script-meta small { color: var(--muted); }
.script-shots { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.script-shots li { display: flex; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.script-shots li > span { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 6px; color: #fff; background: var(--accent); font-size: 12px; font-weight: 800; }
.script-shots li strong { display: block; font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.script-shots li small { color: var(--muted); font-size: 11px; }
.shot-list { display: grid; gap: 12px; }
.shot-card { display: grid; gap: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); }
.shot-card-head { display: flex; align-items: center; justify-content: space-between; }
.shot-index { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 7px; color: #fff; background: var(--accent); font-size: 12px; font-weight: 800; }
.shot-card label { display: grid; gap: 5px; font-size: 11px; color: var(--muted); }
.shot-card textarea { min-height: 52px; resize: vertical; }
.generate-summary { margin: 12px 0 4px; padding: 9px 12px; border: 1px dashed var(--line); border-radius: 7px; color: var(--muted); font-size: 12px; }
.progress-block { display: flex; align-items: center; gap: 12px; margin: 8px 0 16px; }
.progress-track { flex: 1; height: 10px; border-radius: 999px; overflow: hidden; background: var(--panel); border: 1px solid var(--line); }
.progress-bar { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-strong)); transition: width .5s ease; }
.shot-progress { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.shot-progress img { width: 56px; height: 56px; object-fit: cover; border-radius: 7px; border: 1px solid var(--line); }
.shot-progress-main { flex: 1; display: grid; gap: 2px; min-width: 0; }
.shot-progress-main strong { font-size: 12px; }
.shot-progress-main small { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shot-progress-state { flex: none; padding: 3px 8px; border-radius: 999px; color: var(--muted); background: var(--panel-deep); font-size: 10px; font-weight: 700; }
.shot-progress.done { border-color: rgba(47, 158, 119, .45); }
.shot-progress.done .shot-progress-state { color: var(--mint); background: rgba(47, 158, 119, .16); }
.shot-progress.failed { border-color: rgba(220, 38, 38, .5); }
.shot-progress.failed .shot-progress-state { color: var(--danger); background: rgba(220, 38, 38, .14); }
.shot-progress.processing .shot-progress-state { color: var(--yellow); background: rgba(217, 119, 6, .14); }
.shot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; width: 100%; }
.shot-grid .media-thumb img { max-height: 160px; }
.shot-grid .media-thumb-video video { max-height: 160px; }
.video-result-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; width: 100%; }
.video-result-list .media-thumb { position: relative; }
.video-result-list .media-thumb img { max-height: 150px; }
.video-result-list .media-thumb span { position: absolute; left: 8px; bottom: 8px; padding: 3px 8px; border-radius: 6px; color: #fff; background: rgba(0, 0, 0, .55); font-size: 11px; }
.wizard-guide { display: grid; gap: 10px; margin: 0; padding: 0 0 0 2px; list-style: none; counter-reset: wguide; }
.wizard-guide li { display: grid; gap: 3px; padding-left: 30px; position: relative; }
.wizard-guide li::before { counter-increment: wguide; content: counter(wguide); position: absolute; left: 0; top: 0; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 6px; color: #fff; background: var(--accent); font-size: 11px; font-weight: 800; }
.wizard-guide strong { font-size: 12px; }
.wizard-guide small { color: var(--muted); font-size: 11px; }
.wizard-note { display: flex; gap: 9px; margin-top: 12px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 8px; }
.wizard-note span { flex: none; color: var(--accent); font-size: 15px; }
.wizard-note strong { display: block; font-size: 12px; margin-bottom: 2px; }
.wizard-note p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }

/* ---------- 13. AI 视频工作流画布 ---------- */
.workflow-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 12px; }
.workflow-bar-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.workflow-bar-status { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 12px; background: var(--panel-deep); }
.workflow-bar-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--quiet); box-shadow: 0 0 0 3px rgba(100, 116, 139, .12); }
.workflow-bar-status[data-kind="running"] i { background: var(--wf-running); box-shadow: 0 0 0 3px rgba(251, 191, 36, .18); animation: wf-pulse 1s ease-in-out infinite; }
.workflow-bar-status[data-kind="success"] i { background: var(--wf-success); box-shadow: 0 0 0 3px rgba(74, 222, 128, .16); }
.workflow-bar-status[data-kind="error"] i { background: var(--wf-failed); box-shadow: 0 0 0 3px rgba(248, 113, 113, .16); }
@keyframes wf-pulse { 50% { opacity: .35; } }
.workflow-bar-hint { color: var(--quiet); font-size: 12px; }
.workflow-layout { display: grid; grid-template-columns: 218px minmax(0, 1fr) 282px; gap: 16px; align-items: stretch; }
.workflow-palette { display: flex; flex-direction: column; min-height: 520px; }
.wf-palette-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.wf-palette-item { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-panel); color: var(--text); background: var(--panel-deep); text-align: left; transition: border-color .15s, background .15s; }
.wf-palette-item:hover { border-color: var(--wf-accent); background: var(--wf-accent-dim); }
.wf-palette-icon { display: grid; place-items: center; flex: 0 0 28px; height: 28px; border-radius: 8px; color: var(--wf-accent-strong); background: var(--wf-accent-dim); font-size: 14px; }
.wf-palette-item strong { display: block; font-size: 12px; font-weight: 750; }
.wf-palette-item small { display: block; margin-top: 2px; color: var(--quiet); font-size: 10px; line-height: 1.35; }
.workflow-palette-note { margin: 14px 0 0; color: var(--quiet); font-size: 11px; line-height: 1.55; }
.workflow-canvas-wrap { position: relative; display: flex; min-height: 520px; overflow: hidden; padding: 0; }
.workflow-canvas { position: relative; flex: 1; overflow: hidden; cursor: grab; background-color: var(--panel-deep); background-image: radial-gradient(circle, var(--line) 1px, transparent 1px); background-size: 20px 20px; }
.workflow-canvas:active { cursor: grabbing; }
.workflow-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.workflow-nodes { position: absolute; inset: 0; z-index: 2; transform-origin: 0 0; }
.wf-edge-layer { pointer-events: stroke; }
.wf-edge { fill: none; stroke: var(--line); stroke-width: 2; stroke-linecap: round; pointer-events: stroke; transition: stroke .2s, stroke-width .2s; cursor: pointer; }
.wf-edge.is-selected { stroke: var(--wf-accent); stroke-width: 3; }
.wf-edge.is-success { stroke: var(--wf-success); }
.wf-edge.is-failed { stroke: var(--wf-failed); }
.wf-edge.is-flow { stroke-dasharray: 8 7; animation: wf-flow .7s linear infinite; }
.wf-edge.is-dragging { stroke: var(--wf-accent); stroke-width: 2.5; stroke-dasharray: 6 5; animation: wf-flow .5s linear infinite; pointer-events: none; }
@keyframes wf-flow { to { stroke-dashoffset: -15; } }
.wf-node { position: absolute; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--panel); box-shadow: var(--shadow-card); color: var(--text); user-select: none; cursor: grab; transition: border-color .15s, box-shadow .15s; }
.wf-node:hover { border-color: var(--wf-accent); }
.wf-node:active { cursor: grabbing; }
.wf-node.is-selected { border-color: var(--wf-accent); box-shadow: 0 0 0 2px var(--wf-accent-dim), var(--shadow-card-hover); }
.wf-node.is-success { border-color: rgba(74, 222, 128, .55); }
.wf-node.is-failed { border-color: rgba(248, 113, 113, .65); }
.wf-node.is-running { border-color: var(--wf-running); box-shadow: 0 0 16px rgba(251, 191, 36, .22); }
.wf-node-head { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border-bottom: 1px solid var(--line-light); border-radius: 11px 11px 0 0; background: var(--panel-deep); }
.wf-node-icon { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; color: var(--wf-accent-strong); background: var(--wf-accent-dim); font-size: 13px; }
.wf-node-type { font-size: 12px; font-weight: 800; letter-spacing: .3px; }
.wf-node-status { margin-left: auto; padding: 2px 8px; border-radius: 999px; color: var(--quiet); background: var(--panel-deep); font-size: 10px; }
.wf-node.is-success .wf-node-status { color: #fff; background: var(--wf-success); font-weight: 750; }
.wf-node.is-failed .wf-node-status { color: #fff; background: var(--wf-failed); font-weight: 750; }
.wf-node.is-running .wf-node-status { color: #fff; background: var(--wf-running); font-weight: 750; }
.wf-node.is-skipped { opacity: .45; }
.wf-node-rerun { padding: 1px 8px; border: 1px solid rgba(248, 113, 113, .6); border-radius: 999px; color: var(--wf-failed); background: transparent; font-size: 10px; }
.wf-node-rerun:hover { background: rgba(248, 113, 113, .12); }
.wf-node-body { padding: 9px 11px; font-size: 12px; line-height: 1.5; }
.wf-node-title { color: var(--text); font-weight: 650; word-break: break-word; }
.wf-node-preview { margin-top: 7px; color: var(--muted); font-size: 11px; }
.wf-node-preview strong { display: block; color: var(--text); }
.wf-node-thumbs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.wf-node-thumbs img { width: 34px; height: 34px; border-radius: 6px; object-fit: cover; border: 1px solid var(--line); background: var(--panel-deep); }
.wf-node-thumbs video { width: 34px; height: 34px; border-radius: 6px; object-fit: cover; border: 1px solid var(--line); background: #000; }
.wf-node-thumb-more { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 6px; color: var(--muted); background: var(--panel-deep); font-size: 10px; }
.wf-node-error { margin-top: 7px; padding: 5px 7px; border-radius: 6px; color: var(--wf-failed); background: rgba(248, 113, 113, .08); font-size: 10px; word-break: break-word; }
.wf-node-footer { display: flex; align-items: center; justify-content: space-between; padding: 5px 11px; border-top: 1px solid var(--line-light); color: var(--quiet); font-size: 9px; }
.wf-node-id { color: var(--quiet); font-family: "SFMono-Regular", Consolas, monospace; font-size: 9px; letter-spacing: .4px; }
.wf-node-latency { color: var(--muted); }
.wf-port { position: absolute; top: 26px; width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--panel); background: var(--muted); transition: background .15s, transform .15s, box-shadow .15s; z-index: 3; }
.wf-port-in { left: -7px; }
.wf-port-out { right: -7px; }
.wf-port:hover, .wf-node.is-selected .wf-port { background: var(--wf-accent); box-shadow: 0 0 0 3px var(--wf-accent-dim); transform: scale(1.12); }
.workflow-canvas-toolbar { position: absolute; right: 10px; bottom: 10px; z-index: 5; display: flex; align-items: center; gap: 4px; padding: 4px 6px; border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--panel); box-shadow: var(--shadow-card); }
.workflow-canvas-toolbar span { min-width: 40px; color: var(--muted); font-size: 11px; text-align: center; }
.workflow-canvas-hint { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; color: var(--quiet); font-size: 13px; pointer-events: none; }
.workflow-config { display: flex; flex-direction: column; min-height: 520px; }
.workflow-config-body { flex: 1; padding: 14px; overflow-y: auto; font-size: 13px; }
.workflow-config-body label { display: block; margin: 0 0 12px; color: var(--muted); font-size: 11px; }
.wf-config-input { width: 100%; margin-top: 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: var(--panel-deep); font-size: 13px; outline: none; transition: border-color .15s; }
.wf-config-input:focus { border-color: var(--wf-accent); }
select.wf-config-input { appearance: none; }
.wf-config-static { margin: 2px 0 12px; padding: 9px 10px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.wf-config-static code { padding: 1px 4px; border-radius: 4px; color: var(--wf-accent-strong); background: var(--wf-accent-dim); font-size: 10px; }
.wf-config-node .wf-config-head { display: flex; align-items: center; gap: 9px; margin-bottom: 13px; }
.wf-config-node .wf-config-head .wf-node-icon { flex: 0 0 auto; }
.wf-config-node .wf-config-head strong { display: block; font-size: 13px; }
.wf-config-node .wf-config-head small { display: block; margin-top: 2px; color: var(--quiet); font-size: 11px; }
.wf-config-latency { margin-left: auto; color: var(--muted); font-size: 10px; white-space: nowrap; }
.wf-config-result { margin-top: 4px; padding: 10px; border: 1px solid rgba(74, 222, 128, .22); border-radius: var(--radius-panel); background: rgba(74, 222, 128, .05); }
.wf-config-result .overline { display: block; margin-bottom: 7px; }
.wf-config-result > strong { display: block; margin-bottom: 6px; }
.wf-config-result .media-note { margin: 6px 0 0; }
.wf-result-shot { display: flex; gap: 8px; padding: 5px 0; border-top: 1px solid var(--line-light); }
.wf-result-shot span { flex: 0 0 16px; color: var(--quiet); font-size: 10px; }
.wf-result-shot strong { display: block; font-size: 11px; font-weight: 600; }
.wf-result-shot small { color: var(--muted); font-size: 10px; }
.wf-config-shots .wf-shot-row { margin-bottom: 10px; padding: 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-deep); }
.wf-shot-row-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.wf-shot-row textarea, .wf-shot-row input { margin-top: 0; margin-bottom: 6px; }
.wf-config-edge .overline { display: block; margin-bottom: 8px; }
.wf-config-edge p { margin: 0 0 8px; line-height: 1.5; }
.workflow-result-bar { margin-top: 16px; }
.workflow-result-body { padding: 14px; overflow-x: auto; }
.wf-result-summary { margin-bottom: 10px; color: var(--muted); font-size: 13px; }
.wf-result-summary strong { color: var(--wf-accent-strong); font-size: 15px; }
.wf-result-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.wf-result-table th { padding: 7px 10px; border-bottom: 1px solid var(--line); color: var(--quiet); font-size: 10px; text-align: left; letter-spacing: .6px; text-transform: uppercase; }
.wf-result-table td { padding: 7px 10px; border-bottom: 1px solid var(--line-light); color: var(--muted); }
.wf-result-table tr.is-success td:first-child { color: var(--wf-success); }
.wf-result-table tr.is-failed td:first-child { color: var(--wf-failed); }
.wf-result-cost { font-variant-numeric: tabular-nums; }

/* ---------- 14. 管理后台（共享皮肤，结构不变） ---------- */
.admin-page { min-height: 100vh; background: var(--bg); }
.admin-header { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; min-height: 66px; padding: 0 clamp(22px, 5vw, 64px); border-bottom: 1px solid var(--line-light); background: rgba(255, 255, 255, .82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
html[data-theme="dark"] .admin-header { background: rgba(11, 15, 20, .78); }
.admin-main { width: min(1240px, calc(100% - 48px)); margin: 0 auto; padding: 42px 0 72px; }
.admin-login-layout { display: flex; justify-content: center; align-items: center; gap: clamp(40px, 6vw, 90px); min-height: calc(100vh - 66px); padding: 60px 0; }
.admin-login-copy { flex: 0 1 460px; min-width: 0; }
.admin-login-copy h1 { margin: 14px 0 12px; font-size: 40px; line-height: 1.1; letter-spacing: -1.2px; }
.admin-login-copy p { max-width: 460px; color: var(--muted); font-size: 14px; line-height: 1.75; }
.admin-auth-card { flex: 0 0 min(400px, 100%); padding: 28px; }
.admin-trust-list { display: grid; gap: 12px; margin-top: 32px; color: var(--muted); font-size: 12px; }
.admin-trust-list span { display: flex; align-items: center; gap: 10px; }
.admin-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.admin-toolbar h1 { margin: 0; font-size: 25px; letter-spacing: -.5px; }
.admin-stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 22px 0 28px; }
.admin-stat { position: relative; min-height: 118px; padding: 17px 18px; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--panel); box-shadow: var(--shadow-card); }
.admin-stat > span, .admin-stat small { display: block; color: var(--muted); font-size: 11px; }
.admin-stat strong { display: block; margin: 18px 0 8px; color: var(--text); font-size: 26px; letter-spacing: -.6px; font-variant-numeric: tabular-nums; }
.admin-stat small { color: var(--quiet); font-size: 10px; }
.admin-content-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
.console-panel { padding: 20px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.panel-heading h2 { margin: 7px 0 4px; font-size: 15px; color: var(--text); }
.panel-heading p { color: var(--quiet); font-size: 11px; line-height: 1.5; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-panel); }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--quiet); background: var(--panel-deep); font-size: 9px; font-weight: 800; letter-spacing: 1px; text-align: left; text-transform: uppercase; }
.admin-table td { padding: 11px 12px; border-bottom: 1px solid var(--line-light); color: var(--muted); font-size: 11px; white-space: nowrap; }
.admin-table td strong { color: var(--text); }
.admin-table code { color: var(--muted); font-size: 10px; }
.admin-table tbody tr:hover td { background: var(--panel-deep); }
.admin-table tbody tr:last-child td { border-bottom: 0; }
.table-subtext { color: var(--quiet); font-size: 10px; }
.table-empty { padding: 26px 12px; color: var(--quiet); font-size: 11px; text-align: center; }
.users-toolbar { display: flex; align-items: flex-end; gap: 10px; margin: 14px 0; }
.users-toolbar label { margin: 0; }
.users-toolbar input, .users-toolbar select { background: var(--panel-deep); }
.balance-cell strong { color: var(--orange) !important; font-variant-numeric: tabular-nums; }
.role-label { padding: 4px 8px; border-radius: 999px; color: var(--muted); background: var(--panel-deep); font-size: 10px; white-space: nowrap; }
.role-label.is-admin { color: var(--accent); background: var(--accent-soft); }
.status-label { color: var(--mint); font-size: 10px; }
.status-label.is-danger { color: var(--danger); }
.status-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--mint); }
.status-dot.is-danger { background: var(--danger); }
.table-button { min-height: 28px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: var(--panel); font-size: 10px; transition: all .12s ease; }
.table-button:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.table-button.is-danger { color: var(--danger); }
.table-button.is-danger:hover { border-color: var(--danger); background: rgba(248, 113, 113, .1); }
.detail-empty { padding: 40px; color: var(--quiet); font-size: 12px; text-align: center; }
.detail-user-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.detail-avatar { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; color: var(--accent); background: var(--accent-soft); font-size: 16px; font-weight: 800; }
.detail-list { display: grid; gap: 0; margin-top: 14px; }
.detail-row { display: flex; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line-light); }
.detail-row:last-child { border-bottom: 0; }
.detail-row span { color: var(--quiet); font-size: 11px; }
.detail-row strong { color: var(--text); font-size: 11px; }
.detail-warning { margin: 18px 0; padding: 13px 15px; border: 1px solid rgba(217, 119, 6, .3); border-radius: var(--radius-panel); color: var(--yellow); background: rgba(217, 119, 6, .08); font-size: 11px; line-height: 1.6; }
.detail-warning strong { color: var(--yellow); }
.detail-warning code { color: var(--yellow); }
.logs-panel { min-height: 340px; }
.http-status { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.http-status.is-ok { color: var(--mint); background: rgba(47, 158, 119, .1); }
.http-status.is-error { color: var(--danger); background: rgba(220, 38, 38, .08); }
.admin-tabs { display: flex; gap: 6px; margin: 2px 0 18px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); width: fit-content; max-width: 100%; overflow-x: auto; }
.admin-tab { min-height: 30px; padding: 0 15px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: 11px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.admin-tab:hover { color: var(--text); background: var(--panel-deep); }
.admin-tab.is-active { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-strong)); }
.admin-tab-panel { display: block; }
.admin-tab-panel.is-hidden { display: none; }
.playground-layout { margin-top: 14px; }
.playground-usage { margin-top: 12px; padding: 11px 13px; border: 1px dashed var(--line); border-radius: 7px; color: var(--muted); background: var(--panel); font-size: 11px; }
.log-filter-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; align-items: end; padding: 0; }
.log-filter-form label { display: grid; gap: 6px; margin: 0; }
.log-filter-form .ghost-button { min-height: 36px; }
.billing-summary-panel { margin-bottom: 14px; }
.billing-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }

/* ---------- 15. 弹窗 ---------- */
.modal-overlay { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 20px; background: rgba(11, 15, 20, .55); }
.modal-overlay.is-hidden { display: none; }
.modal-card { width: min(420px, 100%); padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: var(--shadow-card-hover); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.modal-head h3 { margin: 6px 0 4px; font-size: 16px; color: var(--text); }
.modal-head p { color: var(--quiet); font-size: 11px; line-height: 1.5; }
.modal-card form label { display: block; margin-bottom: 12px; }
.modal-card form label > span, .modal-card form label { color: var(--muted); font-size: 11px; }
.modal-card input, .modal-card select { width: 100%; min-width: 0; margin-top: 6px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; outline: 0; color: var(--text); background: var(--panel-deep); font-size: 12px; }
.modal-card input:focus, .modal-card select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(224, 113, 79, .14); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.modal-actions .solid-button, .modal-actions .ghost-button { min-height: 34px; }

/* 用户协议 */
.terms-check { display: flex; align-items: center; gap: 6px; margin: 10px 0 12px !important; font-size: 12px; color: var(--muted); }
.terms-check input[type="checkbox"] { width: auto; margin: 0; accent-color: var(--accent); cursor: pointer; }
.terms-check span { cursor: default; }
.terms-link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.terms-link:hover { opacity: .85; }
.terms-modal { width: min(720px, 100%); max-height: 86vh; display: flex; flex-direction: column; }
.terms-body { flex: 1; min-height: 0; max-height: 58vh; overflow-y: auto; padding-right: 6px; margin-right: -4px; }
.terms-body::-webkit-scrollbar { width: 6px; }
.terms-body::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.terms-body h4 { margin: 16px 0 8px; font-size: 14px; color: var(--text); }
.terms-body p { margin: 0 0 8px; font-size: 12.5px; line-height: 1.8; color: var(--muted); text-align: justify; }
.terms-tail { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); color: var(--quiet) !important; font-size: 12px !important; }
.terms-actions { position: relative; flex-shrink: 0; margin-top: 14px; }
#termsAgreeBtn:disabled { opacity: .45; cursor: not-allowed; }
#termsAgreeBtn:disabled:hover { transform: none; box-shadow: none; }

/* ---------- 16. 共享页头（docs.html 兼容） ---------- */
.docs-header { display: flex; align-items: center; justify-content: space-between; min-height: 76px; padding: 0 clamp(24px, 7vw, 108px); border-bottom: 1px solid var(--line-light); background: rgba(255, 255, 255, .82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
html[data-theme="dark"] .docs-header { background: rgba(11, 15, 20, .78); }

/* ---------- 17. 响应式 ---------- */
@media (max-width: 1050px) {
  .auth-main { gap: 40px; grid-template-columns: 1fr; }
  .auth-intro { max-width: 560px; }
  .admin-login-layout { flex-direction: column; align-items: center; }
  .overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-columns { grid-template-columns: 1fr; }
  .docs-preview-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .billing-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-content-grid { grid-template-columns: 1fr; }
  .admin-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .request-layout { grid-template-columns: 1fr; }
  .billing-grid { grid-template-columns: 1fr; }
  .recharge-layout { grid-template-columns: 1fr; }
  .new-key-notice { grid-template-columns: 1fr; }
  .key-form { width: 100%; }
}
@media (max-width: 820px) {
  .app-sidebar { position: static; width: 100%; min-height: auto; padding: 14px 16px; border-right: 0; border-bottom: 1px solid var(--line-light); }
  .app-main { margin-left: 0; }
  .sidebar-caption { margin: 24px 11px 10px; }
  .app-nav { grid-template-columns: repeat(4, 1fr); }
  .app-nav-item { justify-content: center; padding: 10px 6px; }
  .app-nav-item.is-active::before { display: none; }
  .nav-glyph { display: none; }
  .dashboard { flex-direction: column; }
  .sidebar-bottom { display: none; }
  .app-header { align-items: flex-start; flex-direction: column; gap: 12px; }
}
@media (max-width: 620px) {
  .admin-tabs { width: 100%; }
  .billing-summary-grid { grid-template-columns: 1fr; }
  .admin-stats-grid { grid-template-columns: 1fr; }
  .form-columns { grid-template-columns: 1fr; }
  .overview-grid { grid-template-columns: 1fr; }
  .docs-preview-grid { grid-template-columns: 1fr; }
  .request-actions { flex-direction: column; align-items: stretch; }
}
@media (max-width: 560px) {
  .app-nav { grid-template-columns: repeat(2, 1fr); }
  .public-actions a:not(.solid-button) { display: none; }
  .auth-main { padding-top: 40px; }
  .intro-points { margin-top: 30px; }
  .endpoint-card > code { font-size: 9px; }
}
@media (max-width: 1180px) {
  .workflow-layout { grid-template-columns: 1fr; }
  .workflow-palette .wf-palette-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

/* ===== 使用记录面板（用户端 + 管理端详情） ===== */
.usage-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.usage-panel { margin-bottom: 18px; }
.usage-panel .surface-heading { padding: 16px 18px; }
.usage-table th, .usage-table td { text-align: left; }
.usage-table td.amount-plus { color: var(--mint); font-weight: 700; }
.usage-table td.amount-minus { color: var(--danger); font-weight: 700; }
.detail-usage { margin-top: 18px; border-top: 1px solid var(--line-light); padding-top: 14px; }
.detail-usage-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.detail-usage-head h4 { margin: 0; font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--quiet); }
.detail-usage-head span { font-size: 11px; color: var(--quiet); white-space: nowrap; }
.detail-usage .table-scroll { border-radius: var(--radius-panel); }
.detail-usage .admin-table th { background: transparent; }
@media (max-width: 900px) {
  .usage-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .usage-summary-grid { grid-template-columns: 1fr; }
}

/* ---------- 视频工作台 ---------- */

/* ---------- 新建 KEY 弹窗（MiaoAPI 风格固定深色） ---------- */
.key-create-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 8px 16px; border: 0; border-radius: 10px; color: #fff; background: #0A84FF; font-size: 13px; font-weight: 600; cursor: pointer; transition: background .15s ease, transform .15s ease; }
.key-create-btn:hover { background: #2f93ff; transform: translateY(-1px); }
.key-modal-mask { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(0, 0, 0, .6); animation: keyMaskIn .18s ease; }
.key-modal-content { width: 512px; max-width: 100%; box-sizing: border-box; max-height: calc(100vh - 48px); overflow: auto; border: 1px solid rgba(235, 235, 245, .16); border-radius: 20px; background: #141920; box-shadow: rgba(0, 0, 0, .54) 0 22px 52px; color: #F8FAFC; scrollbar-width: thin; }
.key-modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; border-bottom: 1px solid rgba(235, 235, 245, .09); }
.key-modal-header h3 { margin: 0; color: #F8FAFC; font-size: 16px; font-weight: 600; }
.key-modal-close { padding: 4px 10px; border: 0; border-radius: 10px; color: #9CA3AF; background: transparent; font-size: 18px; line-height: 1; cursor: pointer; transition: background .15s ease, color .15s ease; }
.key-modal-close:hover { color: #F8FAFC; background: rgba(235, 235, 245, .1); }
.key-modal-body { display: grid; gap: 14px; padding: 20px 24px; position: relative; }
.input-label { display: block; color: #9CA3AF; font-size: 13px; font-weight: 500; }
.input-label .req { color: #ef4444; }
.key-input { width: 100%; box-sizing: border-box; height: 43px; padding: 0 12px; border: 1px solid rgba(235, 235, 245, .16); border-radius: 10px; outline: none; color: #F8FAFC; background: rgba(25, 32, 41, .92); font-size: 13px; transition: border-color .15s ease, box-shadow .15s ease; }
.key-input::placeholder { color: #64748b; }
.key-input:focus { border-color: #0A84FF; box-shadow: 0 0 0 3px rgba(10, 132, 255, .18); }
.provider-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.provider-card { position: relative; padding: 12px 10px; border: 1px solid rgba(235, 235, 245, .16); border-radius: 10px; color: #CBD5E1; background: rgba(25, 32, 41, .5); font-size: 12px; font-weight: 500; text-align: center; cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease; }
.provider-card:hover { border-color: rgba(10, 132, 255, .5); }
.provider-card input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.provider-card span { display: block; }
.provider-card:has(input:checked) { border-color: #0A84FF; background: rgba(10, 132, 255, .12); box-shadow: 0 0 0 1px #0A84FF; color: #F8FAFC; }
.provider-card i { position: absolute; top: 8px; right: 8px; width: 6px; height: 6px; border-radius: 50%; background: transparent; }
.provider-card:has(input:checked) i { background: #0A84FF; }
.key-hint { margin: 0; color: #64748b; font-size: 11px; line-height: 1.5; }
.toggle-row { display: flex; align-items: center; gap: 10px; color: #E2E8F0; font-size: 13px; cursor: pointer; user-select: none; }
.toggle-row input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.toggle-track { position: relative; width: 36px; height: 20px; flex: 0 0 auto; border-radius: 999px; background: rgba(235, 235, 245, .2); transition: background .15s ease; }
.toggle-track::after { content: ''; position: absolute; top: 50%; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transform: translateY(-50%); transition: left .15s ease; }
.toggle-row input:checked + .toggle-track { background: #0A84FF; }
.toggle-row input:checked + .toggle-track::after { left: 19px; }
.toggle-label-text { line-height: 1.3; }
.key-option-panel { display: grid; gap: 8px; margin-top: 2px; }
.quota-input-wrap { position: relative; }
.quota-input-wrap .quota-prefix { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #64748b; font-size: 13px; }
.quota-input-wrap .key-input { padding-left: 26px; }
.key-modal-footer { display: flex; justify-content: flex-end; gap: 12px; padding: 16px 24px; border-top: 1px solid rgba(235, 235, 245, .09); background: #1A2029; }
.btn-primary { padding: 9px 18px; border: 0; border-radius: 10px; color: #fff; background: #0A84FF; font-size: 13px; font-weight: 500; cursor: pointer; transition: background .15s ease; }
.btn-primary:hover { background: #2f93ff; }
.btn-primary:disabled { opacity: .5; cursor: wait; }
.btn-secondary { padding: 9px 18px; border: 1px solid rgba(235, 235, 245, .16); border-radius: 10px; color: #CBD5E1; background: #141920; font-size: 13px; font-weight: 500; cursor: pointer; transition: background .15s ease; }
.btn-secondary:hover { background: #1a2129; }
.key-modal .new-key-notice { grid-template-columns: 1fr; margin: 0; padding: 14px 16px; border-radius: 12px; }
.key-modal .new-key-notice code { white-space: pre-wrap; word-break: break-all; }
.key-group-tag { display: inline-block; margin-top: 2px; padding: 1px 6px; border-radius: 5px; color: #60a5fa; background: rgba(59, 130, 246, .14); font-size: 9px; vertical-align: 1px; }
@keyframes keyMaskIn { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 640px) { .provider-grid { grid-template-columns: repeat(2, 1fr); } .key-modal-footer .btn-primary, .key-modal-footer .btn-secondary { flex: 1; } }

/* ---- 分组管理区块（独立命名，避免污染全局样式） ---- */
.key-groups-manager { padding: 0; overflow: hidden; }
.key-groups-top { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 22px; border-bottom: 1px solid var(--line-light); }
.key-groups-top h3 { margin: 7px 0 5px; font-size: 15px; color: var(--text); }
.key-groups-top p { color: var(--quiet); font-size: 11px; line-height: 1.5; }
.key-group-list { display: grid; margin: 10px 22px 22px; }
.key-group-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 10px; border-top: 1px solid var(--line-light); border-radius: var(--radius-panel); transition: background .12s ease; }
.key-group-row:hover { background: var(--panel-deep); }
.key-group-main { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }
.key-group-main strong { color: var(--text); font-size: 13px; }
.key-group-count { color: var(--quiet); font-size: 11px; }
.key-group-desc { color: var(--quiet); font-size: 11px; opacity: .8; }
.key-group-provider { padding: 1px 6px; border-radius: 5px; color: #94a3b8; background: rgba(148, 163, 184, .12); font-size: 9px; }
.key-filter-wrap { display: inline-flex; align-items: center; gap: 10px; }
.key-filter-select { width: 150px; height: 30px; padding: 0 8px; border-radius: var(--radius-control); font-size: 11px; }
.ghost-link { padding: 3px 8px; border: 1px solid var(--line-light); border-radius: var(--radius-control); color: var(--muted); background: transparent; font-size: 10px; cursor: pointer; transition: all .12s ease; }
.ghost-link:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.key-group-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border: 1px solid var(--line-light); border-radius: var(--radius-panel); transition: background .12s ease; }
.key-group-item:hover { background: var(--panel-deep); border-color: var(--line); }
.key-group-item + .key-group-item { margin-top: 8px; }
.key-group-main { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; min-width: 0; }
.key-group-main strong { color: var(--text); font-size: 13px; }
.key-group-main-col { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.key-group-main-col strong { color: var(--text); font-size: 13px; }
.key-group-count { color: var(--quiet); font-size: 11px; }
.key-group-desc { color: var(--quiet); font-size: 11px; opacity: .8; }
.key-group-provider { padding: 1px 6px; border-radius: 5px; color: #94a3b8; background: rgba(148, 163, 184, .12); font-size: 9px; }
.key-group-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; flex: 0 0 auto; }
.key-detail-body { display: grid; gap: 2px; padding: 4px 2px 10px; }

/* ---------- 分组图标 ---------- */
.group-glyph { display: inline-block; flex: 0 0 auto; width: 15px; height: 15px; border-radius: 4px; background: linear-gradient(135deg, #0A84FF, #2f93ff); box-shadow: 0 1px 3px rgba(10, 132, 255, .35); }
.group-glyph.muted { background: rgba(148, 163, 184, .25); box-shadow: none; }

/* ---------- 倍率徽标（amber 琥珀色） ---------- */
.group-option-badge { display: inline-flex; align-items: center; flex: 0 0 auto; padding: 2px 8px; border-radius: 6px; background: rgba(120, 53, 15, .2); color: #fbbf24; font-size: 12px; font-weight: 500; line-height: 1.35; white-space: nowrap; }

/* ---------- 密钥详情面板头部（分组触发器） ---------- */
.keys-detail-head { display: flex; align-items: center; gap: 12px; padding: 0 0 10px; border-bottom: 1px solid var(--line-light); margin-bottom: 4px; }
.keys-group-button { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid rgba(235, 235, 245, .16); border-radius: 9px; color: #cbd5e1; background: #0f141a; font-size: 11px; transition: border-color .15s ease, background .15s ease; }
.keys-group-button:hover { border-color: rgba(10, 132, 255, .45); background: rgba(10, 132, 255, .08); }
.keys-group-button .select-icon { color: #64748b; font-size: 9px; }
#keyDetailGroupTriggerText.is-muted { color: #64748b; }

/* ---------- 详情浮层（fixed、fade + slide-in-from-top-2） ---------- */
.group-popover { position: fixed; z-index: 100000020; width: 340px; max-width: calc(100vw - 16px); box-sizing: border-box; padding: 8px; border: 1px solid rgba(255, 255, 255, .1); border-radius: 12px; background: #1a1b1d; box-shadow: 0 0 0 1px rgba(255, 255, 255, .1), 0 10px 15px -3px rgba(0, 0, 0, .1), 0 4px 6px -4px rgba(0, 0, 0, .1); animation: group-popover-in .16s ease-out; }
.group-popover.group-popover-closing { animation: group-popover-out .13s ease-in forwards; }
@keyframes group-popover-in { from { opacity: 0; transform: translateY(-2px); } to { opacity: 1; transform: translateY(0); } }
@keyframes group-popover-out { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-2px); } }
.group-search-input { width: 100%; box-sizing: border-box; height: 34px; padding: 0 10px; border: 1px solid rgba(235, 235, 245, .16); border-radius: 8px; outline: none; color: #e8edf4; background: rgba(25, 32, 41, .92); font-size: 13px; margin-bottom: 6px; }
.group-search-input::placeholder { color: #64748b; }
.group-search-input:focus { border-color: #0A84FF; box-shadow: 0 0 0 3px rgba(10, 132, 255, .18); }
.group-option-list { max-height: 320px; overflow-y: auto; padding: 2px; }
.group-option-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-bottom: 1px solid rgb(45, 47, 49); border-radius: 8px; color: #e8edf4; background: transparent; text-align: left; font-size: 14px; transition: background .12s ease; }
.group-option-item:last-child { border-bottom: 0; }
.group-option-item:hover { background: rgba(255, 255, 255, .05); }
.group-option-item.is-selected { background: rgba(10, 132, 255, .2); color: #8ed0ff; }
.group-option-icon { flex: 0 0 auto; display: grid; place-items: center; }
.group-option-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.group-option-name { font-size: 14px; font-weight: 500; }
.group-option-desc { color: #94a3b8; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.group-option-item.is-selected .group-option-name { color: #8ed0ff; }
.group-popover-empty { padding: 18px 10px; color: #64748b; font-size: 12px; text-align: center; }

/* ---------- 创建弹窗内 .select-trigger 分组下拉 ---------- */
.select-trigger { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; box-sizing: border-box; min-height: 43px; padding: 10px 14px; border: 1px solid rgba(235, 235, 245, .16); border-radius: 12px; outline: none; color: #e8edf4; background: #141920; font-size: 13px; cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease; }
.select-trigger:hover { border-color: rgba(10, 132, 255, .45); }
.select-trigger:focus-visible { border-color: #0A84FF; box-shadow: 0 0 0 3px rgba(10, 132, 255, .18); }
.select-value { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.select-value.is-muted { color: #64748b; }
.select-icon { color: #64748b; font-size: 10px; flex: 0 0 auto; }
.select-dropdown-portal { position: absolute; z-index: 100000021; width: 100%; box-sizing: border-box; max-height: 300px; overflow-y: auto; padding: 6px; border: 1px solid rgba(235, 235, 245, .16); border-radius: 14px; background: rgba(20, 25, 32, .92); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: rgba(4, 12, 20, .65) 0 18px 44px -28px, inset 0 1px 0 rgba(255, 255, 255, .12); animation: group-popover-in .16s ease-out; }
.select-option { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: 8px; color: #e8edf4; background: transparent; text-align: left; font-size: 13px; transition: background .12s ease; }
.select-option:hover, .select-option:focus-visible { background: rgb(34, 43, 54); outline: none; }
.select-option.is-selected { background: rgba(10, 132, 255, .2); }
.select-option-icon { flex: 0 0 auto; display: grid; place-items: center; }
.select-option-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.select-option-name { font-size: 13px; }
.select-option-desc { color: #94a3b8; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.key-detail-grid { display: grid; gap: 0; }
.key-detail-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 9px 2px; border-bottom: 1px solid var(--line-light); }
.key-detail-row span { color: var(--quiet); font-size: 11px; }
.key-detail-row strong { color: var(--text); font-size: 11px; font-weight: 600; text-align: right; word-break: break-all; }
.key-detail-danger { color: var(--danger) !important; border-color: rgba(220, 38, 38, .35) !important; }
.key-select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, #64748b 50%), linear-gradient(135deg, #64748b 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; cursor: pointer; }
.key-select option { background: #141920; color: #e2e8f0; }

/* ===== 上游渠道添加上游账号表单 ===== */
.upstream-form { margin: 16px 0; }
.upstream-form-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; align-items: end; margin-top: 14px; }
.upstream-form-grid label { display: grid; gap: 8px; color: var(--muted); font-size: 11px; font-weight: 700; }
.upstream-form-grid input, .upstream-form-grid select { height: 38px; background: var(--panel-deep); }
.upstream-form-grid .upstream-submit { min-height: 38px; grid-column: span 1; }
@media (max-width: 1100px) { .upstream-form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .upstream-form-grid { grid-template-columns: 1fr; } }

/* ============================================================
   miaoapi 风格 Keys 控制台（keys-console-page）
   ============================================================ */
.keys-console-page { padding: 8px 0 56px; }
.keys-page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 20px 4px 24px; }
.keys-page-heading .console-page-eyebrow { margin: 0 0 6px; color: var(--ds-accent-strong); font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.keys-page-heading h1 { margin: 0 0 8px; color: var(--ds-ink); font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.keys-page-heading .console-page-lead { margin: 0; color: var(--ds-ink-3); font-size: 14px; line-height: 1.5; }
.keys-page-actions { display: flex; align-items: center; gap: 10px; }
.keys-view-switch { display: inline-flex; gap: 2px; padding: 3px; background: var(--ds-surface); border: 1px solid var(--ds-line); border-radius: var(--ds-radius-sm); }
.keys-view-btn { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 7px; background: transparent; color: var(--ds-ink-3); cursor: pointer; font-size: 14px; line-height: 1; transition: background .15s, color .15s; }
.keys-view-btn:hover { background: var(--ds-surface-hover); color: var(--ds-ink); }
.keys-view-btn.is-active { background: var(--ds-accent); color: var(--ds-on-accent); }
.keys-assurance { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.keys-assurance-card { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; background: var(--ds-surface-raised); border: 1px solid var(--ds-line); border-radius: var(--ds-radius-md); box-shadow: var(--ds-shadow-panel), inset 0 1px 0 var(--ds-card-highlight); }
.keys-assurance-card strong { color: var(--ds-ink); font-size: 14px; font-weight: 600; }
.keys-assurance-card span { color: var(--ds-ink-3); font-size: 12px; line-height: 1.5; }
@media (max-width: 900px) { .keys-assurance { grid-template-columns: 1fr; } }
.keys-toolbar { margin-bottom: 16px; }
.keys-filter-row { display: grid; grid-template-columns: minmax(0, 1fr) 220px 180px; gap: 10px; }
@media (max-width: 900px) { .keys-filter-row { grid-template-columns: 1fr; } }
.keys-search { position: relative; }
.keys-search .input { width: 100%; padding-left: 38px; height: var(--ds-control-height); background: var(--ds-control-surface); }
.keys-search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ds-ink-4); font-size: 16px; pointer-events: none; }
.keys-filter-trigger { width: 100%; height: var(--ds-control-height); justify-content: space-between; background: var(--ds-control-surface); }
.keys-workspace { background: var(--ds-surface-raised); border: 1px solid var(--ds-line); border-radius: var(--ds-radius-lg); box-shadow: var(--ds-shadow-panel), inset 0 1px 0 var(--ds-card-highlight); padding: 10px; }
.keys-focus-view { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.keys-index { background: var(--ds-surface-recessed); border: 1px solid var(--ds-line-soft); border-radius: var(--ds-radius-md); min-height: 220px; }
.keys-index-head { padding: 12px 14px 8px; border-bottom: 1px solid var(--ds-line-soft); }
.keys-index-tab { border: 0; background: transparent; color: var(--ds-ink-2); font-size: 13px; font-weight: 600; padding: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.keys-index-count { display: inline-flex; min-width: 22px; height: 20px; padding: 0 6px; align-items: center; justify-content: center; background: var(--ds-accent-soft); color: var(--ds-accent-strong); border-radius: 999px; font-size: 11px; font-weight: 600; }
.keys-index-list { max-height: 420px; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.keys-index-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--ds-ink-2); font-size: 14px; font-weight: 500; cursor: pointer; text-align: left; transition: background .12s, color .12s; }
.keys-index-item:hover { background: var(--ds-surface-hover); color: var(--ds-ink); }
.keys-index-item.is-selected { background: #131f39; color: #f8fafc; }
.keys-index-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.keys-index-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ds-ink-4); flex: none; }
.keys-index-dot.is-active { background: var(--ds-ok); box-shadow: 0 0 0 3px rgba(52, 211, 153, .16); }
.keys-detail { background: var(--ds-surface-recessed); border: 1px solid var(--ds-line-soft); border-radius: var(--ds-radius-md); padding: 18px 20px; min-height: 300px; }
.keys-detail-placeholder { color: var(--ds-ink-4); font-size: 13px; text-align: center; padding: 80px 0; }
.keys-detail-head { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 18px; margin-bottom: 18px; }
.keys-status-label { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--ds-line-soft); color: var(--ds-ink-3); }
.keys-status-label.is-active { background: rgba(52, 211, 153, .12); color: var(--ds-ok); }
.keys-detail-head h2 { margin: 0; color: var(--ds-ink); font-size: 20px; font-weight: 700; }
.keys-group-button { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; background: var(--ds-surface-recessed); border: 1px solid var(--ds-line); border-radius: 9px; color: var(--ds-ink-2); font-size: 11px; cursor: pointer; transition: border-color .12s, background .12s; }
.keys-group-button:hover { border-color: var(--ds-accent); background: var(--ds-surface-hover); }
.keys-group-button .group-name { color: var(--ds-ink-2); font-weight: 600; }
.keys-group-button .group-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; background: rgba(251, 191, 36, .12); color: #fbbf24; font-size: 11px; font-weight: 600; }
.keys-group-button .group-caret { color: var(--ds-ink-4); }
.keys-credential-box { margin-bottom: 18px; padding: 4px 14px; background: var(--ds-control-surface); border: 1px solid var(--ds-line-soft); border-radius: var(--ds-radius-sm); }
.keys-credential-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 0; border: 0; border-bottom: 1px solid var(--ds-line-soft); background: transparent; color: var(--ds-ink-2); font-size: 12px; cursor: pointer; text-align: left; }
.keys-credential-row:last-child { border-bottom: 0; }
.keys-credential-row .cred-label { flex: none; color: var(--ds-ink-4); font-weight: 600; min-width: 74px; }
.keys-credential-row .cred-value { flex: 1; min-width: 0; font-family: "JetBrains Mono", ui-monospace, monospace; color: var(--ds-ink); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.keys-credential-row .cred-copy { flex: none; color: var(--ds-accent-strong); font-size: 11px; opacity: .8; }
.keys-credential-row:hover .cred-copy { opacity: 1; }
.keys-credential-note { padding: 8px 0 2px; color: var(--ds-ink-4); font-size: 11px; }
.keys-usage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.keys-usage-cell { padding: 12px 14px; background: var(--ds-surface); border: 1px solid var(--ds-line-soft); border-radius: var(--ds-radius-sm); }
.keys-usage-cell .u-label { display: block; color: var(--ds-ink-4); font-size: 11px; margin-bottom: 6px; }
.keys-usage-cell .u-value { display: block; color: var(--ds-ink); font-size: 13px; font-weight: 600; }
.keys-usage-cell .u-value.u-warn { color: var(--yellow); }
.keys-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.keys-action { padding: 5px 13px; border-radius: 9px; background: var(--ds-surface-raised); border: 1px solid var(--ds-line); color: var(--ds-ink-2); font-size: 12px; font-weight: 500; cursor: pointer; transition: border-color .12s, color .12s, background .12s; }
.keys-action:hover { border-color: var(--ds-accent); color: var(--ds-ink); background: var(--ds-surface-hover); }
.keys-action.is-primary { background: var(--ds-accent); border-color: transparent; color: var(--ds-on-accent); box-shadow: 0 8px 20px rgba(10, 132, 255, .24); }
.keys-action.is-danger { color: var(--ds-danger); border-color: rgba(248, 113, 113, .35); }
.keys-action.is-danger:hover { background: rgba(248, 113, 113, .12); border-color: var(--ds-danger); color: var(--ds-danger); }
.keys-action:disabled { opacity: .45; cursor: not-allowed; }
.pagination-shell.data-pagination { display: flex; align-items: center; justify-content: space-between; padding: 12px 4px; margin-top: 12px; }
.pagination-btn { padding: 7px 14px; border-radius: var(--ds-radius-sm); border: 1px solid var(--ds-line); background: var(--ds-surface); color: var(--ds-ink-2); font-size: 12px; cursor: pointer; }
.pagination-btn:disabled { opacity: .4; cursor: not-allowed; }
.pagination-btn:not(:disabled):hover { border-color: var(--ds-accent); color: var(--ds-ink); }
.pagination-info { color: var(--ds-ink-3); font-size: 12px; }
.keys-table-view { padding: 4px; }
.admin-table.keys-table { width: 100%; border-collapse: collapse; }
.admin-table.keys-table th { text-align: left; padding: 10px 12px; color: var(--ds-ink-4); font-size: 11px; font-weight: 600; border-bottom: 1px solid var(--ds-line-soft); }
.admin-table.keys-table td { padding: 10px 12px; border-bottom: 1px solid var(--ds-line-soft); color: var(--ds-ink-2); font-size: 13px; }
.admin-table.keys-table tr:hover td { background: var(--ds-surface-hover); }
.table-empty { text-align: center; color: var(--ds-ink-4); padding: 40px 0 !important; }
.keys-manage-groups-btn { display: block; width: calc(100% - 16px); margin: 8px 8px 10px; padding: 9px 12px; border-radius: var(--ds-radius-sm); border: 1px dashed var(--ds-line-strong); background: transparent; color: var(--ds-accent-strong); font-size: 12px; font-weight: 600; cursor: pointer; text-align: center; }
.keys-manage-groups-btn:hover { background: var(--ds-accent-soft); border-color: var(--ds-accent); }

/* ===== 侧边栏收起 ===== */
.sidebar-collapse { display: flex; align-items: center; justify-content: center; width: calc(100% - 24px); margin: 4px 12px 10px; padding: 7px 0; border: 1px solid var(--ds-sidebar-line); border-radius: var(--ds-radius-sm); background: transparent; color: var(--ds-sidebar-ink-muted); font-size: 14px; cursor: pointer; transition: color .12s, border-color .12s; }
.sidebar-collapse:hover { color: var(--ds-sidebar-icon-active); border-color: var(--ds-sidebar-active-line); }
.app-sidebar.is-collapsed { width: 72px; }
.app-sidebar.is-collapsed .sidebar-collapse { transform: rotate(180deg); }
.app-sidebar.is-collapsed .app-nav-item { font-size: 0; justify-content: center; padding: 6px 0; }
.app-sidebar.is-collapsed .app-nav-item .nav-glyph { font-size: 16px; margin: 0; }
.app-sidebar.is-collapsed .app-nav-item .nav-glyph::after { content: attr(title); position: absolute; left: 64px; background: var(--ds-surface-raised); border: 1px solid var(--ds-line); border-radius: 8px; padding: 6px 10px; font-size: 12px; color: var(--ds-ink); opacity: 0; pointer-events: none; transition: opacity .12s; white-space: nowrap; z-index: 90; }
.app-sidebar.is-collapsed .app-nav-item:hover .nav-glyph::after { opacity: 1; }
.app-sidebar.is-collapsed .sidebar-brand, .app-sidebar.is-collapsed .sidebar-bottom { display: none; }

/* ============================================================
   极速对话（data-panel="chat"）
   ============================================================ */
.chat-shell { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 12px; height: calc(100vh - 130px); min-height: 520px; }
@media (max-width: 900px) { .chat-shell { grid-template-columns: 1fr; } }
.chat-sidebar { display: flex; flex-direction: column; background: var(--ds-surface); border: 1px solid var(--ds-line); border-radius: var(--ds-radius-lg); overflow: hidden; }
.chat-sidebar-head { padding: 14px; border-bottom: 1px solid var(--ds-line-soft); }
.chat-new-btn { width: 100%; }
.chat-session-list { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 4px; }
.chat-session-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 10px; border-radius: var(--ds-radius-sm); border: 0; background: transparent; color: var(--ds-ink-2); font-size: 13px; cursor: pointer; text-align: left; }
.chat-session-item:hover { background: var(--ds-surface-hover); }
.chat-session-item.is-selected { background: var(--ds-accent-soft); color: var(--ds-ink); }
.chat-session-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-session-meta { color: var(--ds-ink-4); font-size: 11px; flex: none; }
.chat-session-del { border: 0; background: transparent; color: var(--ds-ink-4); cursor: pointer; font-size: 12px; padding: 2px 4px; border-radius: 6px; }
.chat-session-del:hover { color: var(--ds-danger); background: rgba(248, 113, 113, .12); }
.chat-main { display: flex; flex-direction: column; background: var(--ds-surface-raised); border: 1px solid var(--ds-line); border-radius: var(--ds-radius-lg); overflow: hidden; }
.chat-main-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--ds-line-soft); }
.chat-main-title h2 { margin: 0; color: var(--ds-ink); font-size: 16px; font-weight: 700; }
.chat-sub-title { color: var(--ds-ink-4); font-size: 11px; }
.chat-main-actions { display: flex; align-items: center; gap: 8px; }
.chat-model-select { min-width: 200px; height: 34px; font-size: 12px; background: var(--ds-control-surface); }
.chat-messages { flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.chat-welcome { text-align: center; color: var(--ds-ink-3); padding: 60px 0; }
.chat-welcome h3 { color: var(--ds-ink-2); font-size: 18px; margin: 0 0 8px; }
.chat-welcome p { margin: 0; font-size: 13px; }
.chat-msg { display: flex; gap: 10px; max-width: 860px; }
.chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg .msg-avatar { flex: none; width: 28px; height: 28px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--ds-on-accent); background: var(--ds-accent); }
.chat-msg.assistant .msg-avatar { background: linear-gradient(145deg, #242426, #1c2733); color: var(--ds-accent-strong); }
.chat-msg .msg-body { padding: 10px 14px; border-radius: 12px; font-size: 14px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.chat-msg.user .msg-body { background: var(--ds-accent); color: var(--ds-on-accent); border-top-right-radius: 4px; }
.chat-msg.assistant .msg-body { background: var(--ds-surface); border: 1px solid var(--ds-line-soft); color: var(--ds-ink); border-top-left-radius: 4px; }
.chat-msg .msg-meta { font-size: 10px; color: var(--ds-ink-4); }
.chat-input-panel { display: flex; align-items: flex-end; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--ds-line-soft); background: var(--ds-surface); }
.chat-input { flex: 1; resize: none; min-height: 44px; max-height: 160px; background: var(--ds-control-surface); border: 1px solid var(--ds-line); border-radius: var(--ds-radius-md); color: var(--ds-ink); font-size: 14px; line-height: 1.5; padding: 10px 14px; outline: none; font-family: inherit; }
.chat-input:focus { border-color: var(--ds-accent); }
.chat-send-btn { height: 44px; padding: 0 20px; flex: none; }
.chat-send-btn:disabled { opacity: .5; cursor: not-allowed; }
.chat-stream-cursor::after { content: "▍"; color: var(--ds-accent-strong); animation: chat-blink 1s steps(2, start) infinite; margin-left: 2px; }
@keyframes chat-blink { to { visibility: hidden; } }


/* ============ AI Video Studio（仿 miaoapi.xyz/video-studio 工作台） ============ */
.studio-tabs { display: inline-flex; gap: 6px; padding: 4px; margin-bottom: 16px; border: 1px solid var(--line-light); border-radius: 999px; background: var(--panel); }
.studio-tab { padding: 7px 18px; border: 0; border-radius: 999px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 650; cursor: pointer; transition: all .15s ease; }
.studio-tab:hover { color: var(--text); }
.studio-tab.is-active { color: #fff; background: var(--wf-accent); box-shadow: 0 4px 14px rgba(10, 132, 255, .35); }
.studio-view.is-hidden { display: none; }

.vs-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr) 292px; gap: 16px; align-items: start; margin-bottom: 16px; }
.vs-side { padding: 16px; }
.vs-assets { display: flex; flex-direction: column; gap: 14px; }
.vs-hint { color: var(--quiet); font-size: 11px; }
.vs-asset-block { display: flex; flex-direction: column; gap: 8px; }
.vs-asset-label { color: var(--text); font-size: 12px; font-weight: 700; }
.vs-asset-label span { color: var(--quiet); font-weight: 500; }
.vs-upload-zone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 88px; padding: 12px; border: 1px dashed var(--line); border-radius: var(--radius-panel); background: var(--panel-deep); color: var(--muted); cursor: pointer; transition: border-color .15s ease, background .15s ease; text-align: center; }
.vs-upload-zone:hover { border-color: var(--wf-accent); background: var(--wf-accent-dim); }
.vs-upload-zone.is-dragover { border-color: var(--wf-accent-strong); background: var(--wf-accent-dim); }
.vs-upload-icon { font-size: 18px; line-height: 1; color: var(--wf-accent-strong); }
.vs-upload-main { font-size: 12px; color: var(--text); font-weight: 650; }
.vs-upload-sub { font-size: 10px; color: var(--quiet); }
.vs-asset-preview { position: relative; margin-top: 2px; }
.vs-asset-preview video { width: 100%; max-height: 170px; border-radius: var(--radius-panel); border: 1px solid var(--line); background: #000; }
.vs-asset-preview audio { width: 100%; height: 38px; }
.vs-remove-btn { position: absolute; top: 6px; right: 6px; background: rgba(0, 0, 0, .6); color: #fff; border-radius: 50%; }
.vs-frames-list { display: flex; flex-direction: column; gap: 6px; max-height: 190px; overflow-y: auto; }
.vs-frame-item { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-deep); }
.vs-frame-item img { width: 42px; height: 42px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); flex: none; }
.vs-frame-meta { flex: 1; min-width: 0; }
.vs-frame-meta strong { display: block; font-size: 11px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vs-frame-meta small { color: var(--quiet); font-size: 10px; }
.vs-frame-actions { display: flex; align-items: center; gap: 2px; }
.vs-frame-actions button { padding: 3px 7px; border: 1px solid var(--line); border-radius: 7px; background: transparent; color: var(--muted); font-size: 10px; cursor: pointer; }
.vs-frame-actions button:hover { border-color: var(--wf-accent); color: var(--wf-accent-strong); }
.vs-frame-actions button.is-del:hover { border-color: var(--wf-failed); color: var(--wf-failed); }

.vs-canvas { display: flex; flex-direction: column; gap: 12px; }
.vs-preview-stage { position: relative; min-height: 380px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-panel); background: #05070a; border: 1px solid var(--line); overflow: hidden; }
.vs-preview-video { width: 100%; max-height: 500px; }
.vs-preview-frame { max-width: 100%; max-height: 500px; object-fit: contain; border-radius: 4px; }
.vs-preview-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--quiet); text-align: center; padding: 40px 24px; }
.vs-preview-empty-icon { font-size: 42px; color: var(--line); }
.vs-preview-empty p { font-size: 12px; line-height: 1.7; max-width: 320px; }
.vs-timeline { display: flex; flex-direction: column; gap: 6px; }
.vs-timeline-label { color: var(--quiet); font-size: 11px; }
.vs-timeline-track { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; min-height: 62px; }
.vs-timeline-item { flex: none; width: 78px; height: 54px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-deep); display: flex; align-items: center; justify-content: center; color: var(--quiet); font-size: 10px; cursor: pointer; overflow: hidden; position: relative; }
.vs-timeline-item img { width: 100%; height: 100%; object-fit: cover; }
.vs-timeline-item span { position: absolute; left: 4px; top: 4px; padding: 1px 5px; border-radius: 5px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 9px; }
.vs-timeline-item.is-selected { border-color: var(--wf-accent); box-shadow: 0 0 0 2px var(--wf-accent-dim); }
.vs-timeline-item.is-video { color: var(--wf-accent-strong); }
.vs-timeline-item.is-audio { color: var(--mint); }

.vs-params { display: flex; flex-direction: column; gap: 10px; }
.vs-params label { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 650; }
.vs-generate-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--line-light); }
.vs-cost { color: var(--quiet); font-size: 12px; }
.vs-generate-row .solid-button { flex: none; }

.vs-history-body { padding: 4px 0 2px; display: flex; flex-direction: column; gap: 10px; }
.vs-history-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--panel-deep); }
.vs-history-thumb { width: 84px; height: 54px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); flex: none; background: #000; }
.vs-history-meta { flex: 1; min-width: 0; }
.vs-history-meta strong { display: block; font-size: 12px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vs-history-meta small { color: var(--quiet); font-size: 10px; }
.vs-history-status { font-size: 11px; font-weight: 700; }
.vs-history-status[data-kind="running"] { color: var(--wf-running); }
.vs-history-status[data-kind="success"] { color: var(--wf-success); }
.vs-history-status[data-kind="error"] { color: var(--wf-failed); }
.vs-history-open { flex: none; }

@media (max-width: 1180px) { .vs-layout { grid-template-columns: 1fr; } .vs-canvas { order: -1; } }

/* ===== API Keys 分组优先视图（group-first view）===== */
.key-group-item { flex-direction: column; align-items: stretch; }
.key-group-item > .key-group-main { display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; }
.key-group-item.is-expanded { border-color: var(--line); background: var(--panel-deep); }
.key-group-toggle { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; min-width: 0; flex: 1 1 auto; border: none; background: transparent; padding: 0; cursor: pointer; color: inherit; text-align: left; font: inherit; }
.key-group-caret { color: var(--quiet); font-size: 12px; margin-left: auto; flex: 0 0 auto; }
.key-group-keys { width: 100%; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line-light); display: flex; flex-direction: column; gap: 4px; }
.key-group-key-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 1px solid transparent; border-radius: var(--radius-panel); background: transparent; cursor: pointer; text-align: left; font: inherit; color: inherit; width: 100%; }
.key-group-key-row:hover { background: var(--panel); border-color: var(--line); }
.key-group-key-row.is-selected { background: rgba(10, 132, 255, .10); border-color: var(--line); }
.key-group-key-name { font-weight: 600; font-size: 13px; color: var(--text); flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.key-group-key-time { color: var(--quiet); font-size: 11px; white-space: nowrap; }
.key-group-key-caret { color: var(--quiet); font-size: 14px; flex: 0 0 auto; }

/* ===== 一组一 Key 卡片（one-group-one-key）===== */
.key-group-item.key-group-keycard { border-color: var(--line-light); }
.key-group-item.key-group-keycard.is-selected { border-color: var(--line); background: var(--panel-deep); }
.key-group-keycard-body { width: 100%; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line-light); }
.key-group-keycard-key { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 1px solid transparent; border-radius: var(--radius-panel); background: transparent; cursor: pointer; text-align: left; font: inherit; color: inherit; width: 100%; }
.key-group-keycard-key:hover { background: var(--panel); border-color: var(--line); }
.key-group-keycard-key.is-selected { background: rgba(10, 132, 255, .10); border-color: var(--line); }
.key-display-prefix { font-family: var(--font-mono, ui-monospace, 'Cascadia Mono', Consolas, monospace); font-size: 12.5px; color: var(--text); font-weight: 600; letter-spacing: .3px; }
.key-display-mask { font-family: var(--font-mono, ui-monospace, 'Cascadia Mono', Consolas, monospace); font-size: 12.5px; color: var(--quiet); letter-spacing: 1px; }
.key-group-keycard-body .empty-key-state { margin: 0; font-size: 12px; }
