/* ==========================================================================
   皮可AI · Piccc AI — Design System v3.1 (平整通透 · 轻灰轻线 · 阴影克制)
   结构：1 Tokens  2 Base  3 Components  4 App shell  5 Pages
   规范文档：根目录 DESIGN.md
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
  color-scheme: light;
  /* surface — 素雅中性浅画布 + 纯白面层 */
  --bg-canvas: #f8f9fa;
  --bg: #ffffff;
  --bg-surface: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-subtle: #f2f3f5;
  --bg-muted: rgba(0, 0, 0, .04);
  --bg-mode-track: #f0f1f4;
  --bg-hover: rgba(0, 0, 0, .038);
  --bg-active: #eef0f3;
  --bg-elevated: #ffffff;
  --bg-glass: rgba(255, 255, 255, .88);
  --bg-glass-strong: rgba(255, 255, 255, .95);
  --overlay: rgba(15, 18, 24, .42);
  /* line — 极轻发丝线（平顺边界，拒绝重框） */
  --line-hairline: rgba(0, 0, 0, .06);
  --line-subtle: rgba(0, 0, 0, .06);
  --line: rgba(0, 0, 0, .09);
  --line-strong: rgba(0, 0, 0, .15);
  /* text — 净墨文字阶 */
  --fg: #181a1f;
  --fg-2: #5c6270;
  --fg-3: #7a818f;
  --fg-inverse: #ffffff;
  /* brand & status — 克制品牌蓝 */
  --accent: #007ce6;
  --accent-text: #0072dc;
  --accent-hover: #0068cc;
  --accent-grad: linear-gradient(135deg, #1692ff 0%, #0074e0 100%);
  --accent-grad-hover: linear-gradient(135deg, #0b86f5 0%, #0067cc 100%);
  --accent-weak: rgba(0, 124, 230, .08);
  --accent-soft: rgba(0, 124, 230, .13);
  --accent-line: rgba(0, 124, 230, .32);
  --brand-teal: #00b8cc;
  --brand-teal-weak: rgba(0, 184, 204, .11);
  --brand-indigo: #5b6bff;
  --brand-indigo-weak: rgba(91, 107, 255, .10);
  --brand-hot: #ff8826;
  --brand-hot-weak: rgba(255, 136, 38, .12);
  --success: #109963;
  --success-weak: rgba(16, 153, 99, .10);
  --warning: #d97706;
  --warning-weak: rgba(217, 119, 6, .11);
  --danger: #e03e4e;
  --danger-weak: rgba(224, 62, 78, .10);
  /* syntax highlighting */
  --hljs-kw: #cf222e;
  --hljs-str: #0a3069;
  --hljs-num: #0550ae;
  --hljs-fn: #8250df;
  --hljs-tag: #116329;
  --hljs-attr: #0550ae;
  --hljs-com: #6e7781;
  --hljs-var: #953800;
  --hljs-type: #953800;
  --hljs-meta: #0550ae;
  --hljs-pun: #5c6270;
  --hljs-add: #116329;
  --hljs-del: #cf222e;
  /* radius — 控件 < 卡片 < 大容器，温润阶梯 */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-full: 999px;
  /* elevation — 扁平优先，阴影仅留真正浮层 */
  --shadow-xs: none;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .04);
  --shadow-card: none;
  --shadow-card-hover: 0 4px 14px rgba(0, 0, 0, .045);
  --shadow-pop: 0 8px 28px rgba(0, 0, 0, .09), 0 0 0 1px rgba(0, 0, 0, .05);
  --shadow-dock: 0 2px 12px rgba(0, 0, 0, .035);
  --shadow-dock-focus: 0 4px 18px rgba(0, 124, 230, .08);
  --shadow-accent: none;
  /* type */
  --font: "Inter Variable", -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  --fs-2xs: 11px;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 18px;
  --fs-2xl: 24px;
  --fs-3xl: 28px;
  --fs-4xl: 32px;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --lh-none: 1;
  --lh-tight: 1.28;
  --lh-snug: 1.45;
  --lh-normal: 1.6;
  --lh-relaxed: 1.72;
  --ls-tight: -.01em;
  --ls-normal: 0;
  --ls-wide: .02em;
  /* layout */
  --sidebar-w: 232px;
  --rail-w: 64px;
  --topbar-h: 56px;
  --banner-h: 0px;
  --ease-standard: cubic-bezier(.2, 0, 0, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in: cubic-bezier(.4, 0, 1, 1);
  --ease-spring: cubic-bezier(.22, 1.12, .36, 1);
  --ease: var(--ease-standard);
  --dur-instant: 100ms;
  --dur-fast: 150ms;
  --dur: var(--dur-fast);
  --dur-base: 220ms;
  --dur-moderate: 280ms;
  --dur-slow: 360ms;
  --motion-dist-xs: 4px;
  --motion-dist-sm: 8px;
  --motion-dist-md: 16px;
}

:root:lang(en) {
  --ls-tight: -.02em;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg-canvas: #131417;
  --bg: #1b1d22;
  --bg-surface: #1b1d22;
  --bg-sidebar: #16181c;
  --bg-subtle: rgba(255, 255, 255, .055);
  --bg-muted: rgba(255, 255, 255, .06);
  --bg-mode-track: rgba(255, 255, 255, .06);
  --bg-hover: rgba(255, 255, 255, .055);
  --bg-active: rgba(255, 255, 255, .10);
  --bg-elevated: #23262d;
  --bg-glass: rgba(27, 29, 34, .84);
  --bg-glass-strong: rgba(31, 34, 40, .94);
  --overlay: rgba(0, 0, 0, .62);
  --line-hairline: rgba(255, 255, 255, .07);
  --line-subtle: rgba(255, 255, 255, .07);
  --line: rgba(255, 255, 255, .11);
  --line-strong: rgba(255, 255, 255, .18);
  --fg: #f0f2f5;
  --fg-2: rgba(240, 242, 245, .68);
  --fg-3: rgba(240, 242, 245, .50);
  --fg-inverse: #ffffff;
  --accent: #2b9cff;
  --accent-text: #52b0ff;
  --accent-hover: #47abff;
  --accent-grad: linear-gradient(135deg, #3bb0ff 0%, #178af5 100%);
  --accent-grad-hover: linear-gradient(135deg, #52bcff 0%, #2796ff 100%);
  --accent-weak: rgba(43, 156, 255, .14);
  --accent-soft: rgba(43, 156, 255, .22);
  --accent-line: rgba(43, 156, 255, .36);
  --brand-teal: #1fd4e6;
  --brand-teal-weak: rgba(31, 212, 230, .14);
  --brand-indigo: #7c8bff;
  --brand-indigo-weak: rgba(124, 139, 255, .15);
  --brand-hot: #ff9a3d;
  --brand-hot-weak: rgba(255, 154, 61, .16);
  --success: #34d399;
  --success-weak: rgba(52, 211, 153, .14);
  --warning: #fbbf24;
  --warning-weak: rgba(251, 191, 36, .14);
  --danger: #f87171;
  --danger-weak: rgba(248, 113, 113, .14);
  --hljs-kw: #ff7b72;
  --hljs-str: #a5d6ff;
  --hljs-num: #79c0ff;
  --hljs-fn: #d2a8ff;
  --hljs-tag: #7ee787;
  --hljs-attr: #79c0ff;
  --hljs-com: #8b949e;
  --hljs-var: #ffa657;
  --hljs-type: #ffa657;
  --hljs-meta: #79c0ff;
  --hljs-pun: rgba(240, 242, 245, .64);
  --hljs-add: #7ee787;
  --hljs-del: #ff7b72;
  --shadow-xs: none;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .24);
  --shadow-card: none;
  --shadow-card-hover: 0 6px 18px rgba(0, 0, 0, .26);
  --shadow-pop: 0 12px 36px rgba(0, 0, 0, .48), 0 0 0 1px rgba(255, 255, 255, .08);
  --shadow-dock: 0 2px 12px rgba(0, 0, 0, .22);
  --shadow-dock-focus: 0 4px 18px rgba(43, 156, 255, .12);
  --shadow-accent: none;
}

/* 2. Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: var(--lh-normal);
  color: var(--fg);
  background: var(--bg-canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, p, ul, ol, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1, h2, h3, h4 { font-weight: var(--fw-semibold); line-height: var(--lh-tight); letter-spacing: var(--ls-normal); text-wrap: balance; }
b, strong { font-weight: var(--fw-semibold); }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; }
textarea { resize: none; }
::selection { background: var(--accent-weak); color: var(--fg); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-xs); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--fg-2); }
.subtle { color: var(--fg-3); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.scroll-y { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.scroll-y::-webkit-scrollbar { width: 10px; }
.scroll-y::-webkit-scrollbar-thumb { background: var(--line-strong); border: 3px solid transparent; background-clip: padding-box; border-radius: 10px; }

/* 3. Components ------------------------------------------------------------ */

/* Icon */
.i { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: middle; }
.i-sm { width: 16px; height: 16px; flex: none; }
.i-xs { width: 14px; height: 14px; flex: none; }
.i-lg { width: 22px; height: 22px; flex: none; }

/* Logo */
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: var(--fw-semibold); font-size: var(--fs-lg); letter-spacing: var(--ls-tight); color: var(--fg); white-space: nowrap; flex: none; }
.logo-wordmark, .logo-compact { display: inline-flex; align-items: center; flex: none; line-height: 0; }
.logo-compact { display: none; }
.logo-img { display: block; width: auto; height: 27px; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.logo-compact .logo-img { width: 26px; height: 26px; }
.logo-sm .logo-img { height: 20px; }
.logo-img--dark { display: none; }
[data-theme="dark"] .logo-img--light { display: none; }
[data-theme="dark"] .logo-img--dark { display: block; }

/* Button */
.btn {
  --h: 40px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--h); padding: 0 18px; border-radius: var(--r-sm);
  font-size: var(--fs-md); font-weight: var(--fw-medium); white-space: nowrap; line-height: var(--lh-none);
  border: 1px solid transparent;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), opacity var(--dur), transform var(--dur-fast) var(--ease-out);
}
.btn:not(:disabled):active { transform: scale(.98); }
.btn .i { width: 16px; height: 16px; }
.btn-xs { --h: 26px; padding: 0 9px; font-size: var(--fs-xs); gap: 5px; border-radius: 7px; }
.btn-xs .i { width: 13px; height: 13px; }
.btn-sm { --h: 34px; padding: 0 13px; font-size: var(--fs-sm); border-radius: 9px; }
.btn-lg { --h: 48px; padding: 0 24px; font-size: var(--fs-md); border-radius: 12px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent-grad); color: #ffffff; box-shadow: none; }
.btn-primary:hover { background: var(--accent-grad-hover); opacity: 1; }
.btn-primary:disabled { background: var(--bg-subtle); color: var(--fg-3); box-shadow: none; opacity: 1; }
.btn-tonal { background: var(--accent-weak); color: var(--accent-text); border-color: transparent; box-shadow: none; }
.btn-tonal:hover { background: var(--accent-soft); color: var(--accent-text); }
.btn-tonal:disabled { background: var(--bg-subtle); color: var(--fg-3); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-surface); border-color: var(--line); color: var(--fg); box-shadow: none; }
.btn-secondary:hover { background: var(--bg-subtle); border-color: var(--line-strong); }
.btn-ghost { color: var(--fg-2); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--fg); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-weak); }

.icon-btn {
  --s: 38px;
  width: var(--s); height: var(--s); flex: none;
  display: inline-grid; place-items: center; border-radius: var(--r-sm);
  color: var(--fg-2);
  transition: background var(--dur), color var(--dur), transform var(--dur-fast) var(--ease-out);
}
.icon-btn:hover { background: var(--bg-hover); color: var(--fg); }
.icon-btn:not(:disabled):active { transform: scale(.94); }
.icon-btn[aria-pressed="true"] { color: var(--accent-text); background: var(--accent-weak); }
.icon-btn-sm { --s: 32px; border-radius: 9px; }
.icon-btn-sm .i { width: 16px; height: 16px; }

/* Chip — 用于参数选择触发器、筛选 */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 12px; border-radius: var(--r-sm);
  font-size: var(--fs-sm); color: var(--fg-2); white-space: nowrap;
  border: 1px solid var(--line-hairline);
  background: var(--bg-surface);
  box-shadow: none;
  transition: background var(--dur), border-color var(--dur), color var(--dur), transform var(--dur-fast) var(--ease-out);
}
.chip:hover { background: var(--bg-surface); border-color: var(--line-strong); box-shadow: none; color: var(--fg); }
.chip:not(:disabled):active { transform: scale(.97); }
.chip .i { width: 15px; height: 15px; }
.chip .chev { width: 14px; height: 14px; color: var(--fg-3); margin-right: -2px; }
.chip[aria-expanded="true"] { background: var(--bg-subtle); border-color: var(--line); color: var(--fg); box-shadow: none; }
.chip.is-on { color: var(--accent-text); border-color: var(--accent-line); background: var(--accent-weak); box-shadow: none; }

/* Filter pill */
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  position: relative;
  height: 34px; padding: 0 14px; border-radius: var(--r-full);
  font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--fg-2);
  transition: background var(--dur), color var(--dur);
}
.pill:hover { color: var(--fg); background: var(--bg-hover); }
.pill[aria-pressed="true"] { background: var(--bg-active); color: var(--fg); font-weight: var(--fw-semibold); }

/* Segmented */
.seg { display: inline-flex; padding: 4px; gap: 2px; background: var(--bg-muted); border-radius: 12px; }
.seg > button {
  flex: 1; min-width: 0; height: 34px; padding: 0 14px; border-radius: 8px;
  font-size: var(--fs-sm); color: var(--fg-2); white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background var(--dur), color var(--dur), box-shadow var(--dur);
}
.seg > button:hover:not(:disabled) { color: var(--fg); }
.seg > button[aria-pressed="true"] { background: var(--bg-surface); color: var(--fg); font-weight: var(--fw-semibold); box-shadow: var(--shadow-sm); }
.seg > button:disabled { opacity: .4; }
.seg-block { display: flex; width: 100%; }

/* Tabs (underline) */
.tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--line-hairline); }
.tab {
  position: relative; height: 48px; font-size: var(--fs-md); color: var(--fg-2);
  display: inline-flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--fg); }
.tab[aria-selected="true"] { color: var(--fg); font-weight: var(--fw-semibold); }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--fg); border-radius: 2px; }
.tab .count { font-size: var(--fs-xs); color: var(--fg-3); font-weight: var(--fw-regular); }

/* Badge / status */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 8px; border-radius: var(--r-full);
  font-size: var(--fs-xs); font-weight: var(--fw-medium); white-space: nowrap;
  background: var(--bg-muted); color: var(--fg-2);
}
.badge-accent { background: var(--accent-weak); color: var(--accent-text); }
.badge-teal { background: var(--brand-teal-weak); color: var(--brand-teal); }
.badge-hot { background: var(--brand-hot-weak); color: var(--brand-hot); }
.badge-success { background: var(--success-weak); color: var(--success); }
.badge-warning { background: var(--warning-weak); color: var(--warning); }
.badge-danger { background: var(--danger-weak); color: var(--danger); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }

/* Input */
.input {
  height: 40px; width: 100%; padding: 0 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--bg-surface); caret-color: var(--accent);
  transition: border-color var(--dur), background var(--dur), box-shadow var(--dur);
}
.input::placeholder, .textarea::placeholder { color: var(--fg-3); }
.input:hover { border-color: var(--line-strong); }
.input:focus { background: var(--bg-surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.search, .search-field { position: relative; width: 100%; }
.search .i, .search-field .i { position: absolute; left: 13px; top: 50%; translate: 0 -50%; width: 16px; height: 16px; color: var(--fg-3); pointer-events: none; }
.search .input, .search-field .input { padding-left: 38px; background: var(--bg-surface); border-color: var(--line); }
.search .input:hover, .search-field .input:hover { border-color: var(--line-strong); }
.search .input:focus, .search-field .input:focus { background: var(--bg-surface); border-color: var(--accent); }
.textarea { width: 100%; border: 0; background: transparent; padding: 0; line-height: var(--lh-normal); font-size: var(--fs-md); caret-color: var(--accent); }

/* Kbd */
kbd { font-family: var(--mono); font-size: var(--fs-2xs); padding: 2px 6px; border-radius: 5px; border: 0; color: var(--fg-3); background: var(--bg-subtle); }

/* Popover & menu */
.pop { position: relative; display: inline-flex; }
.pop-panel {
  position: absolute; z-index: 60; top: calc(100% + 6px); left: 0;
  min-width: 220px; max-width: calc(100vw - 16px); padding: 6px;
  overflow: visible; translate: var(--pop-shift, 0px) 0;
  background: var(--bg-elevated); border-radius: var(--r-md); box-shadow: var(--shadow-pop);
  opacity: 0; visibility: hidden; transform: translateY(-6px) scale(.97); transform-origin: top left;
  transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-spring);
}
:is(.param-panel, .mp-panel, .mp-list, .slash-menu)::-webkit-scrollbar { width: 8px; }
:is(.param-panel, .mp-panel, .mp-list, .slash-menu)::-webkit-scrollbar-thumb { background: var(--line-strong); border: 2px solid transparent; background-clip: padding-box; border-radius: 8px; }
.pop-panel[data-side="top"] { top: auto; bottom: calc(100% + 8px); transform-origin: bottom left; transform: translateY(6px) scale(.97); }
.pop-panel[data-align="end"] { left: auto; right: 0; transform-origin: top right; }
.pop-panel[data-side="top"][data-align="end"] { transform-origin: bottom right; }
.pop.is-open > .pop-panel, .pop-panel.is-open { opacity: 1; visibility: visible; transform: none; }
.menu-label { padding: 8px 12px 4px; font-size: var(--fs-xs); color: var(--fg-3); }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu-item, .pop-item {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px; text-align: left;
  font-size: var(--fs-md); color: var(--fg);
}
.menu-item:hover, .menu-item:focus-visible, .pop-item:hover, .pop-item:focus-visible { background: var(--bg-hover); }
.menu-item .i, .pop-item .i { width: 16px; height: 16px; color: var(--fg-2); }
.menu-item .mi-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.pop-item > span { flex: 1; min-width: 0; }
.menu-item .mi-desc { font-size: var(--fs-xs); color: var(--fg-3); line-height: var(--lh-snug); }
.menu-item .mi-meta { font-size: var(--fs-xs); color: var(--fg-3); margin-left: auto; white-space: nowrap; display: inline-flex; align-items: center; justify-content: flex-end; gap: 3px; font-variant-numeric: tabular-nums; }
.menu-item .mi-check, .pop-item .pop-check { width: 16px; height: 16px; color: var(--fg); visibility: hidden; flex: none; }
.menu-item[aria-checked="true"] .mi-check, .pop-item[aria-checked="true"] .pop-check { visibility: visible; }
.menu-item.is-danger, .menu-item.is-danger .i { color: var(--danger); }

/* Tooltip (CSS only, data-tip) */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip); position: absolute; z-index: 80; left: 50%; bottom: calc(100% + 6px);
  translate: -50% 4px; padding: 5px 8px; border-radius: 6px;
  background: #1b2538; color: #fff; font-size: var(--fs-xs); line-height: var(--lh-tight); white-space: nowrap; font-weight: var(--fw-regular);
  opacity: 0; pointer-events: none; transition: opacity var(--dur-instant) var(--ease-standard), translate var(--dur-instant) var(--ease-standard);
}
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; translate: -50% 0; transition-delay: .35s; }
[data-tip-side="bottom"]::after { bottom: auto; top: calc(100% + 6px); }
[data-tip-side="right"]::after { left: calc(100% + 8px); bottom: auto; top: 50%; translate: 4px -50%; }
[data-tip-side="right"]:hover::after { translate: 0 -50%; }
[data-tip-side="left"]::after { left: auto; right: calc(100% + 10px); bottom: auto; top: 50%; translate: -4px -50%; }
[data-tip-side="left"]:hover::after, [data-tip-side="left"]:focus-visible::after { translate: 0 -50%; }
[data-tip][aria-expanded="true"]::after { opacity: 0 !important; visibility: hidden; pointer-events: none; }

/* Toast */
.toasts { position: fixed; z-index: 100; inset: calc(var(--banner-h, 0px) + max(16px, env(safe-area-inset-top))) 12px auto; display: flex; justify-content: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 8px; max-width: 100%; padding: 11px 16px; border-radius: var(--r-full);
  overflow-wrap: anywhere;
  background: #1b2538; color: #fff; font-size: var(--fs-sm); box-shadow: 0 10px 30px -10px rgba(10, 20, 40, .42);
  animation: toast-in var(--dur-base) var(--ease-spring);
}
.toast .i { width: 16px; height: 16px; }
.toast.has-action { pointer-events: auto; padding-right: 10px; }
.toast-action {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: var(--r-full);
  background: rgba(255, 255, 255, .16); color: var(--fg-inverse); font-size: var(--fs-xs); font-weight: var(--fw-medium);
  text-decoration: none; white-space: nowrap; transition: background var(--dur);
}
.toast-action:hover { background: rgba(255, 255, 255, .26); }
.toast.is-leaving { animation: toast-out var(--dur-fast) var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-6px) scale(.98); } }

/* Dialog */
.dialog { border: 0; padding: 0; background: transparent; color: var(--fg); max-width: none; max-height: none; }
.dialog::backdrop, dialog.modal::backdrop { background: var(--overlay); backdrop-filter: blur(2px); }
dialog.modal { color: var(--fg); max-height: calc(100dvh - 24px); }
[data-credits].is-updated { display: inline-block; animation: credit-pop var(--dur-slow) var(--ease-spring); }
.fade-up { animation: fade-up var(--dur-base) var(--ease-out) both; }

/* Image & Video viewer */
.viewer { width: min(1180px, calc(100vw - 48px)); height: min(780px, calc(100dvh - 48px)); overflow: visible; }
.viewer-inner { display: grid; grid-template-columns: minmax(0, 1fr) 340px; height: 100%; background: var(--bg-elevated); border-radius: var(--r-lg); overflow: hidden; }
.viewer-stage { background: var(--bg-muted); display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; padding: 24px 56px 76px; min-width: 0; min-height: 0; overflow: hidden; position: relative; }
.viewer-stage.has-strip { padding-bottom: 132px; }
.viewer-stage.is-video { background: #0e0f13; padding: 24px 56px 24px; }
.viewer-stage.is-video.has-strip { padding-bottom: 84px; }
.viewer-stage.is-audio,
.viewer-stage.is-subtitle { background: var(--bg-canvas); padding: 24px 56px 24px; }
.viewer-stage.is-audio.has-strip,
.viewer-stage.is-subtitle.has-strip { padding-bottom: 84px; }
.viewer-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--r-sm); }
.viewer-stage video { max-width: 100%; max-height: 100%; width: 100%; border-radius: var(--r-sm); background: #000; outline: none; }
.viewer-audio-box {
  width: min(460px, 100%);
  padding: 24px;
  border-radius: var(--r-md);
  background: var(--bg-surface);
  border: 1px solid var(--line-hairline);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.viewer-audio-box[hidden],
.viewer-text-box[hidden] { display: none; }
.viewer-audio-ic {
  width: 52px;
  height: 52px;
  border-radius: var(--r-full);
  background: var(--bg-subtle);
  color: var(--accent-text);
  display: grid;
  place-items: center;
}
.viewer-audio-ic .i { width: 22px; height: 22px; }
.viewer-audio-name {
  max-width: 100%;
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.viewer-audio-box audio { width: 100%; }
.viewer-text-box {
  width: min(720px, 100%);
  height: 100%;
  max-height: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--line-hairline);
  border-radius: var(--r-md);
  box-shadow: none;
  overflow: hidden;
  display: flex;
}
.viewer-text-pre {
  margin: 0;
  padding: 18px 20px;
  width: 100%;
  height: 100%;
  font-family: var(--mono);
  font-size: var(--fs-xs);
  line-height: var(--lh-relaxed);
  color: var(--fg);
  white-space: pre-wrap;
  word-break: break-word;
}
.viewer-nav {
  position: absolute; top: 50%; translate: 0 -50%; z-index: 5;
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .86); color: #111215;
  border: 1px solid rgba(0, 0, 0, .08); box-shadow: 0 4px 16px rgba(0, 0, 0, .14);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur);
}
.viewer-nav:hover { background: #fff; transform: scale(1.06); }
.viewer-nav.is-prev { left: 12px; }
.viewer-nav.is-next { right: 12px; }
[data-theme="dark"] .viewer-nav,
.viewer-stage.is-video .viewer-nav { background: rgba(28, 30, 36, .84); color: #fff; border-color: rgba(255, 255, 255, .14); }
[data-theme="dark"] .viewer-nav:hover,
.viewer-stage.is-video .viewer-nav:hover { background: rgba(42, 45, 54, .95); color: #fff; transform: scale(1.06); }
.viewer-counter {
  position: absolute; top: 14px; left: 16px; z-index: 4;
  height: 26px; padding: 0 10px; border-radius: 999px;
  display: inline-flex; align-items: center;
  background: rgba(18, 19, 24, .72); color: #fff; font-size: var(--fs-xs); font-weight: var(--fw-medium); font-variant-numeric: tabular-nums;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.viewer-stage-bar {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  max-width: calc(100% - 24px);
  z-index: 4;
}
.viewer-stage.has-strip .viewer-stage-bar { bottom: 74px; }
.viewer-strip {
  position: absolute; left: 50%; bottom: 14px; translate: -50% 0; z-index: 4;
  display: flex; align-items: center; gap: 6px; max-width: calc(100% - 32px);
  padding: 5px; border-radius: 12px; overflow-x: auto; scrollbar-width: none;
  background: var(--bg-glass-strong); border: 1px solid var(--line-hairline); box-shadow: none;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
[data-theme="dark"] .viewer-strip,
.viewer-stage.is-video .viewer-strip { background: rgba(24, 26, 31, .90); border-color: var(--line-hairline); box-shadow: none; }
.viewer-strip::-webkit-scrollbar { display: none; }
.viewer-strip-item {
  position: relative; width: 42px; height: 42px; border-radius: 8px; overflow: hidden; flex: none;
  border: 2px solid transparent; opacity: .68; transition: opacity var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast);
}
.viewer-strip-item:hover { opacity: .95; }
.viewer-strip-item.is-active { opacity: 1; border-color: var(--accent); transform: translateY(-1px); }
.viewer-strip-item img,
.viewer-strip-item video { width: 100%; height: 100%; object-fit: cover; display: block; }
.viewer-strip-vid { width: 100%; height: 100%; display: grid; place-items: center; background: #182030; color: #fff; }
.viewer-strip-media { width: 100%; height: 100%; display: grid; place-items: center; background: var(--bg-subtle); color: var(--fg-2); }
.viewer-strip-media .i { width: 18px; height: 18px; }
.viewer-strip-badge { position: absolute; right: 2px; bottom: 2px; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; background: rgba(14, 22, 36, .72); color: #fff; }
.viewer-strip-badge .i { width: 9px; height: 9px; }
.viewer-bar-inner {
  display: flex;
  align-items: center;
  gap: 3px;
  max-width: 100%;
  padding: 5px 6px;
  border-radius: 999px;
  background: var(--bg-glass-strong);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 0;
  box-shadow: var(--shadow-pop);
  color: var(--fg);
  overflow-x: auto;
  scrollbar-width: none;
}
[data-theme="dark"] .viewer-bar-inner {
  background: rgba(24, 31, 44, .88);
}
.viewer-bar-inner::-webkit-scrollbar { display: none; }
.viewer-bar-inner .viewer-bar-cta {
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-grad);
  color: #ffffff;
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  flex: none;
  transition: opacity var(--dur), transform var(--dur-fast) var(--ease-out);
}
.viewer-bar-inner .viewer-bar-cta:hover { opacity: .92; }
.viewer-bar-inner .viewer-bar-cta .i { width: 14px; height: 14px; }
.viewer-bar-inner .img-ov-btn {
  width: auto;
  height: 30px;
  padding: 0 9px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: transparent;
  color: var(--fg-2);
  font-size: var(--fs-xs);
  white-space: nowrap;
  flex: none;
  transition: background var(--dur), color var(--dur);
}
.viewer-bar-inner .img-ov-btn:hover { background: var(--bg-hover); color: var(--fg); }
.viewer-bar-inner .img-ov-btn.is-favorited { color: #f59e0b; }
.viewer-bar-inner .img-ov-btn.is-favorited svg { fill: currentColor; }
.viewer-bar-inner .img-ov-btn .i { width: 14px; height: 14px; }
.viewer-side { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; border-left: 1px solid var(--line-hairline); }
.viewer-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; padding: 14px 14px 10px 20px; }
.viewer-head b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-md); font-weight: var(--fw-semibold); }
.viewer-head .icon-btn { flex: none; }
.viewer-body { flex: 1; min-height: 0; padding: 0 20px 20px; display: flex; flex-direction: column; gap: 20px; }
.viewer-prompt { font-size: var(--fs-md); line-height: var(--lh-relaxed); overflow-wrap: anywhere; white-space: pre-wrap; }
.viewer-foot { padding: 14px 20px 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; border-top: 1px solid var(--line-hairline); }
.viewer-foot .btn-primary,
.viewer-foot > :only-child { grid-column: 1 / -1; }
.kv { display: grid; grid-template-columns: 72px 1fr; row-gap: 8px; font-size: var(--fs-sm); }
.kv dt { color: var(--fg-3); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.field-label { font-size: var(--fs-xs); color: var(--fg-3); margin-bottom: 6px; display: flex; align-items: center; justify-content: space-between; }

/* Skeleton */
.skeleton { position: relative; overflow: hidden; background: var(--bg-muted); }
.skeleton::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent);
  animation: shimmer 1.6s infinite;
}
[data-theme="dark"] .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent); }
@keyframes shimmer { to { transform: translateX(100%); } }

/* Avatar */
.avatar { width: 32px; height: 32px; border-radius: 50%; overflow: hidden; flex: none; background: var(--bg-muted); display: grid; place-items: center; font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--fg-2); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Section header */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-head h2 { font-size: var(--fs-xl); font-weight: var(--fw-semibold); line-height: var(--lh-tight); letter-spacing: var(--ls-normal); }
.section-head p { font-size: var(--fs-md); color: var(--fg-2); margin-top: 6px; }
.link { display: inline-flex; align-items: center; gap: 2px; font-size: var(--fs-sm); color: var(--fg-2); white-space: nowrap; }
.link:hover { color: var(--fg); }
.link .i { width: 15px; height: 15px; }

/* 4. App shell ------------------------------------------------------------- */
body:has(> .app) { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
body:has(> .site-banner:not([hidden])) { --banner-h: 40px; }
html[data-banner-dismissed="1"] .site-banner { display: none !important; }
html[data-banner-dismissed="1"] body { --banner-h: 0px; }

/* Top Fixed Announcement Bar */
.site-banner {
  flex: none;
  height: 40px;
  padding: 0 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 45;
  color: #ffffff;
  background: linear-gradient(90deg, #132344 0%, #174485 52%, #0e699e 100%);
  border-bottom: 0;
}
.site-banner-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}
.site-banner-tag {
  flex: none;
  padding: 1px 8px;
  border-radius: var(--r-full);
  background: rgba(255, 255, 255, .16);
  border: 0;
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  line-height: 18px;
  white-space: nowrap;
}
.site-banner-text {
  font-size: var(--fs-sm);
  line-height: var(--lh-snug);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.site-banner-link {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: #ffffff;
  opacity: .92;
  white-space: nowrap;
}
.site-banner-link:hover { opacity: 1; text-decoration: underline; }
.site-banner-close {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, .78);
  transition: background var(--dur), color var(--dur);
}
.site-banner-close:hover { background: rgba(255, 255, 255, .14); color: #ffffff; }

.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); flex: 1; min-height: 0; overflow: hidden; }
.app.is-rail { --sidebar-w: var(--rail-w); }
.main { min-width: 0; min-height: 0; display: flex; flex-direction: column; position: relative; background: var(--bg-canvas); }
.main-scroll { flex: 1; min-height: 0; overflow-y: auto; }

/* Sidebar */
.sidebar {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--bg-sidebar); border-right: 1px solid var(--line-hairline);
  width: var(--sidebar-w); transition: width var(--dur-base) var(--ease-standard);
  position: relative; z-index: 40;
}
.sb-head { height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between; padding: 0 12px 0 16px; flex: none; }
.sb-nav { --sb-nav-inset: 10px; flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; padding: 6px var(--sb-nav-inset) 12px; }
@media (max-height: 520px) {
  .sb-nav { overflow-y: auto; }
}
.sb-group { flex: none; }
.sb-group + .sb-group { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-hairline); }
.sb-group-title { padding: 0 10px; height: 28px; display: flex; align-items: center; font-size: var(--fs-xs); color: var(--fg-3); }
.nav-item {
  display: flex; align-items: center; gap: 9px; height: 36px; padding: 0 10px; border-radius: 10px;
  color: color-mix(in srgb, var(--fg) 80%, transparent); font-size: var(--fs-md); font-weight: var(--fw-medium); white-space: nowrap; overflow: hidden;
  transition: background var(--dur), color var(--dur);
}
.nav-item .i { width: 16px; height: 16px; color: var(--fg-2); transition: color var(--dur); }
.nav-item + .nav-item { margin-top: 2px; }
.nav-item:hover { background: var(--bg-hover); color: var(--fg); }
.nav-item:hover .i, .nav-item[aria-current="page"] .i { color: var(--fg); }
.nav-item[aria-current="page"] { background: var(--bg-active); color: var(--fg); font-weight: var(--fw-semibold); box-shadow: none; }
.nav-badge {
  margin-left: auto;
  height: 17px;
  padding: 0 5px;
  border-radius: 4px;
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-none);
  display: inline-flex;
  align-items: center;
  flex: none;
}
.nav-badge.is-new { background: var(--accent-weak); color: var(--accent-text); }
.nav-badge.is-hot { background: var(--brand-hot-weak); color: var(--brand-hot); }
.nav-badge.is-free { background: var(--success-weak); color: var(--success); }
.nav-badge.is-teal { background: var(--brand-teal-weak); color: var(--brand-teal); }
.sb-foot { display: none; flex: none; }
.sb-drawer-close { display: none; }

/* Global Sidebar Conversations (Jimeng-style) */
.sb-convs {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-hairline);
}
.sb-convs-head {
  display: flex; align-items: center; justify-content: space-between; gap: 4px;
  padding: 0 2px 6px 8px; flex: none;
}
.sb-convs-toggle {
  display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 4px; margin-left: -4px;
  border-radius: 6px; font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--fg-3);
  transition: color var(--dur), background var(--dur);
}
.sb-convs-toggle:hover { color: var(--fg); background: var(--bg-hover); }
.sb-convs-chev { width: 14px; height: 14px; transition: transform var(--dur) var(--ease); }
.sb-convs.is-collapsed .sb-convs-chev { transform: rotate(-90deg); }
.sb-convs.is-collapsed .sb-convs-body { display: none; }
.sb-convs-actions { display: inline-flex; align-items: center; gap: 2px; flex: none; }
.sb-convs-search-btn, .sb-convs-new-btn { --s: 28px; border-radius: 7px; color: var(--fg-2); }
.sb-convs-search-btn:hover, .sb-convs-new-btn:hover { background: var(--bg-hover); color: var(--fg); }
.sb-convs-body { flex: 1; min-height: 0; display: flex; flex-direction: column; margin-inline-end: calc(-1 * var(--sb-nav-inset)); }
.sb-convs-search {
  display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 6px 0 9px; margin: 0 2px 6px;
  margin-inline-end: calc(var(--sb-nav-inset) + 2px);
  border-radius: 8px; background: var(--bg-subtle); border: 1px solid transparent; flex: none;
  transition: background var(--dur), border-color var(--dur), box-shadow var(--dur);
}
.sb-convs-search:focus-within { background: var(--bg-elevated); border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-weak); }
.sb-convs-search > .i { width: 14px; height: 14px; color: var(--fg-3); flex: none; }
.sb-convs-search-input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: var(--fs-xs); color: var(--fg); outline: none; }
.sb-convs-search-input::placeholder { color: var(--fg-3); }
.sb-convs-search-clear { --s: 22px; border-radius: 5px; }
.sb-convs-search-clear .i { width: 12px; height: 12px; }

.sb-convs-list {
  --sb-scrollbar-thumb: transparent;
  flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 2px;
  padding: 0 0 4px; padding-inline-end: calc(var(--sb-nav-inset) + 2px);
  scrollbar-color: var(--sb-scrollbar-thumb) transparent;
}
.sb-convs-list::-webkit-scrollbar-thumb { background-color: var(--sb-scrollbar-thumb); border: 0; }
.sb-convs-list:is(:focus-visible, :has(:focus-visible)) { --sb-scrollbar-thumb: var(--line-strong); }
@media (hover: hover) {
  .sb-convs-list:hover { --sb-scrollbar-thumb: var(--line-strong); }
}
.sb-conv {
  position: relative; display: flex; align-items: center; gap: 4px; height: 36px;
  padding: 0 4px 0 6px; border-radius: 10px; color: var(--fg-2);
  transition: background var(--dur), color var(--dur); flex: none;
}
.sb-conv:hover { background: var(--bg-hover); color: var(--fg); }
.sb-conv.is-active { background: var(--bg-active); color: var(--fg); font-weight: var(--fw-medium); }
.sb-conv-link {
  flex: 1; min-width: 0; height: 100%; display: flex; align-items: center; gap: 9px;
}
.sb-conv-thumb {
  width: 24px; height: 24px; border-radius: 6px; flex: none; overflow: hidden;
  display: grid; place-items: center;
  background: var(--bg-subtle); border: 0; color: var(--fg-3);
}
[data-theme="dark"] .sb-conv-thumb { background: rgba(255, 255, 255, .07); border: 0; }
.sb-conv.is-active .sb-conv-thumb { color: var(--fg); }
.sb-conv-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sb-conv-thumb .i { width: 14px; height: 14px; }
.sb-conv-title { flex: 1; min-width: 0; font-size: var(--fs-sm); font-weight: var(--fw-regular); line-height: var(--lh-snug); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-conv-title.is-title-updated { animation: sbTitleFadeIn 180ms var(--ease); }
@keyframes sbTitleFadeIn { from { opacity: .35; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .sb-conv-title.is-title-updated { animation: none; }
}

.sb-conv-tail {
  position: relative; flex: none; width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
}
.sb-conv-spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid var(--line-strong); border-top-color: var(--accent);
  animation: spin .75s linear infinite;
}
.sb-conv-done-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
}
.sb-conv-pin { display: inline-grid; place-items: center; color: var(--fg-3); pointer-events: none; }
.sb-conv-pin .i { width: 13px; height: 13px; }
.sb-conv.is-busy .sb-conv-pin,
.sb-conv.has-done-dot .sb-conv-pin { display: none; }

.sb-conv-more {
  position: absolute; inset: 0; width: 26px; height: 26px; border-radius: 7px;
  display: grid; place-items: center; color: var(--fg-2);
  opacity: 0; pointer-events: none; transition: opacity var(--dur), background var(--dur), color var(--dur);
}
.sb-conv-more .i { width: 15px; height: 15px; }
.sb-conv:hover .sb-conv-more,
.sb-conv:focus-within .sb-conv-more,
.sb-conv.is-menu-open .sb-conv-more { opacity: 1; pointer-events: auto; }
.sb-conv:hover .sb-conv-pin,
.sb-conv:focus-within .sb-conv-pin,
.sb-conv.is-menu-open .sb-conv-pin { opacity: 0; }
.sb-conv:hover .sb-conv-spinner,
.sb-conv:focus-within .sb-conv-spinner,
.sb-conv.is-menu-open .sb-conv-spinner,
.sb-conv:hover .sb-conv-done-dot,
.sb-conv:focus-within .sb-conv-done-dot,
.sb-conv.is-menu-open .sb-conv-done-dot { opacity: 0; }
.sb-conv-more:hover { background: var(--bg-active); color: var(--fg); }

@media (hover: none) {
  .sb-conv-tail { width: auto; min-width: 26px; gap: 4px; }
  .sb-conv-more { position: static; opacity: .72; pointer-events: auto; }
  .sb-conv-pin { display: none; }
}

.sb-conv-menu {
  position: fixed; z-index: 85; top: 0; left: 0; min-width: 156px; padding: 6px;
}
.sb-conv-menu .menu-item { white-space: nowrap; }
.sb-rename-modal {
  max-width: 400px; width: 92vw; border-radius: 18px; padding: 22px;
  border: 0; background: var(--bg-elevated); box-shadow: var(--shadow-pop);
}
.sb-convs-empty {
  padding: 16px 10px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  font-size: var(--fs-xs); color: var(--fg-3);
}
.sb-convs-guest {
  width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border-radius: 10px; border: 0; background: transparent;
  color: var(--fg-3); font-size: var(--fs-xs); text-align: left;
  transition: background var(--dur), color var(--dur);
}
.sb-convs-guest:hover { background: var(--bg-hover); color: var(--accent-text); }
.sb-convs-guest .i { width: 15px; height: 15px; color: var(--accent-text); flex: none; }

/* rail (collapsed) */
.is-rail .sb-head { padding: 0; justify-content: center; }
.is-rail .sb-head .logo-wordmark, .is-rail .sb-head .sb-collapse { display: none; }
.is-rail .sb-head .logo-compact { display: inline-flex; }
.is-rail .sb-nav { padding: 8px var(--sb-nav-inset) 16px; }
.is-rail .sb-group-title:not(.is-link) { height: 1px; margin: 10px 6px; padding: 0; background: var(--line-hairline); font-size: 0; }
.is-rail .sb-group-title.is-link { width: 42px; height: 34px; padding: 0; margin: 4px auto 0; justify-content: center; }
.is-rail .sb-group-title.is-link span { display: none; }
.is-rail .sb-group-title.is-link:hover, .is-rail .sb-group-title.is-link[aria-current="page"] { background: var(--bg-active); color: var(--fg); }
.is-rail .sb-group + .sb-group { margin-top: 8px; padding-top: 8px; }
.is-rail .nav-item { justify-content: center; padding: 0; width: 42px; height: 34px; margin-inline: auto; }
.is-rail .nav-item .nav-text, .is-rail .nav-badge { display: none; }
.is-rail .sb-convs { margin-top: 8px; padding-top: 8px; }
.is-rail .sb-convs-head { padding: 0 0 6px; justify-content: center; }
.is-rail .sb-convs-body { margin-inline-end: 0; }
.is-rail .sb-convs-toggle,
.is-rail .sb-convs-search-btn,
.is-rail .sb-convs-search,
.is-rail .sb-convs-guest,
.is-rail .sb-convs-empty,
.is-rail .sb-conv-title,
.is-rail .sb-conv-tail { display: none !important; }
.is-rail .sb-convs-new-btn { width: 42px; height: 34px; border-radius: 8px; }
.is-rail .sb-convs-list { padding: 0; align-items: center; scrollbar-width: none; }
.is-rail .sb-convs-list::-webkit-scrollbar { display: none; }
.is-rail .sb-conv { width: 42px; height: 38px; padding: 0; justify-content: center; }
.is-rail .sb-conv-link { justify-content: center; gap: 0; }
.sb-expand { display: none; }
.is-rail .sb-foot { display: flex; padding: 10px 0; justify-content: center; border-top: 0; }
.is-rail .sb-expand { display: inline-grid; }
.is-rail .logo { margin: 0; }

/* Unified App Header & Top-Right Utility Capsules */
.scrim { position: fixed; inset: 0; background: var(--overlay); z-index: 39; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity var(--dur-base) var(--ease-standard), visibility 0s var(--dur-base); }
.app-header {
  height: var(--topbar-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  border-bottom: 1px solid transparent;
  background: transparent;
  position: relative;
  z-index: 35;
  transition: background var(--dur-base) var(--ease), border-color var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease);
}
.app-header.is-scrolled {
  background: var(--bg-glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom-color: var(--line-hairline);
}
.app-header.is-overlay {
  position: absolute;
  inset: 0 0 auto;
  height: var(--topbar-h);
  padding: 0 24px;
  border-bottom: 0;
  background: transparent;
  pointer-events: none;
  justify-content: flex-end;
}
.app-header.is-overlay .app-header-slot { display: none; }
.app-header.is-floating {
  position: absolute;
  inset: 0 0 auto;
  height: var(--topbar-h);
  padding: 0 24px;
  border-bottom: 0;
  background: transparent;
  pointer-events: none;
  justify-content: flex-end;
}
.app-header.is-floating .app-header-slot {
  flex: 0 1 auto;
  justify-content: flex-end;
}
.app-header.is-floating .page-head-title,
.app-header.is-floating .page-head-actions { pointer-events: auto; }
.app-header-mobile { display: none; align-items: center; gap: 8px; flex: none; }
.app-header-mobile .logo-img { height: 23px; }
.app-header-slot { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.page-head-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.page-head-title h1 { font-size: var(--fs-lg); font-weight: var(--fw-semibold); letter-spacing: var(--ls-normal); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-head-actions { display: flex; align-items: center; gap: 8px; flex: none; margin-left: auto; }
.page-head-actions .btn-ghost { border: 1px solid transparent; background: transparent; color: var(--fg-2); height: 32px; padding: 0 11px; border-radius: var(--r-full); }
.page-head-actions .btn-ghost:hover { border-color: var(--line-hairline); background: var(--bg-glass-strong); color: var(--fg); box-shadow: none; }
.page-head-actions .btn-primary { height: 32px; border-radius: var(--r-full); padding: 0 14px; }
.page-head-actions .select { height: 32px; padding: 0 12px; border-radius: var(--r-full); border: 1px solid var(--line-hairline); background: var(--bg-glass); box-shadow: none; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.app-header #chatModel { width: auto; height: 32px; min-width: 0; max-width: 190px; }

.shell-utility { display: inline-flex; align-items: center; gap: 8px; flex: none; pointer-events: auto; }
.utility-pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 36px;
  padding: 0 4px;
  border-radius: var(--r-full);
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line-hairline);
  box-shadow: none;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.utility-pill:hover {
  background: var(--bg-glass-strong);
  border-color: var(--line);
  box-shadow: none;
}
[data-theme="dark"] .utility-pill {
  background: var(--bg-glass);
  border: 1px solid var(--line-hairline);
  box-shadow: none;
}
[data-theme="dark"] .utility-pill:hover {
  background: var(--bg-glass-strong);
  border-color: var(--line);
  box-shadow: none;
}
.head-action-pill {
  gap: 2px;
}
.head-pill-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-2);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), padding var(--dur) var(--ease);
}
.head-pill-icon:hover,
.head-pill-icon[aria-expanded="true"] {
  background: var(--bg-hover);
  color: var(--fg);
}
.head-pill-icon .i {
  width: 16px;
  height: 16px;
  flex: none;
}
.head-pill-icon.is-active {
  width: auto;
  padding: 0 10px 0 8px;
  border-radius: var(--r-full);
  gap: 5px;
  color: var(--accent);
  background: var(--accent-weak);
}
.head-pill-icon.is-active:hover,
.head-pill-icon.is-active[aria-expanded="true"] {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
}
.head-pill-val {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-none);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.head-pill-btn {
  height: 28px;
  padding: 0 10px;
  border-radius: var(--r-full);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--fg-2);
  white-space: nowrap;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.head-pill-btn:hover,
.head-pill-btn[aria-expanded="true"] {
  background: var(--bg-hover);
  color: var(--fg);
}
.head-pill-btn .i {
  width: 15px;
  height: 15px;
  flex: none;
}
.head-pill-btn.is-primary {
  color: var(--accent);
  background: var(--accent-weak);
  font-weight: var(--fw-semibold);
}
.head-pill-btn.is-primary:hover {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
}
.utility-credits, .utility-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--r-full);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--fg);
  white-space: nowrap;
  transition: background var(--dur);
}
.utility-credits:hover, .utility-link:hover { background: var(--bg-hover); }
.utility-topup-tag {
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  color: var(--accent);
  background: var(--accent-weak);
  padding: 1px 7px;
  border-radius: var(--r-full);
}
.utility-icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  color: var(--fg-2);
  transition: background var(--dur), color var(--dur);
}
.utility-icon-btn:hover, .utility-icon-btn[aria-expanded="true"] { background: var(--bg-hover); color: var(--fg); }
.utility-icon-btn .i { width: 16px; height: 16px; }
.utility-sep { width: 1px; height: 16px; background: var(--line); margin: 0 2px; flex: none; }
.utility-user-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 10px 0 3px;
  border-radius: var(--r-full);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--fg);
  transition: background var(--dur);
}
.utility-user-btn:hover, .utility-user-btn[aria-expanded="true"] { background: var(--bg-hover); }
.utility-avatar { width: 24px; height: 24px; font-size: var(--fs-2xs); }
.utility-user-name { max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.utility-login-btn {
  --h: 28px;
  padding: 0 12px;
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  background: var(--bg-subtle);
  color: var(--fg);
  box-shadow: none;
}
.utility-login-btn:hover {
  background: var(--accent);
  color: #ffffff;
  box-shadow: none;
}
.pop-panel.utility-account-panel {
  width: min(328px, calc(100vw - 16px));
  min-width: 0;
  max-height: none;
  overflow: visible;
  padding: 10px;
  border-radius: 18px;
  border: 1px solid var(--line-hairline);
}
.ua-card {
  border-radius: 13px;
  padding: 11px 12px;
  background: var(--bg-subtle);
  border: 0;
}
[data-theme="dark"] .ua-card {
  background: var(--bg-subtle);
  border: 0;
}
.ua-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ua-avatar {
  width: 38px;
  height: 38px;
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  background: var(--accent-weak);
  color: var(--accent);
}
.ua-profile-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ua-profile-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.ua-profile-name {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ua-tier-badge {
  flex: none;
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  padding: 1px 7px;
  border-radius: var(--r-full);
  background: var(--bg-muted);
  color: var(--fg-2);
  white-space: nowrap;
}
.ua-tier-badge[data-tier="silver"] { background: rgba(100, 116, 139, .14); color: #475569; }
.ua-tier-badge[data-tier="gold"] { background: rgba(245, 158, 11, .16); color: #b45309; }
.ua-tier-badge[data-tier="diamond"] { background: var(--accent-weak); color: var(--accent); }
[data-theme="dark"] .ua-tier-badge[data-tier="silver"] { background: rgba(148, 163, 184, .18); color: #cbd5e1; }
[data-theme="dark"] .ua-tier-badge[data-tier="gold"] { background: rgba(251, 191, 36, .18); color: #fbbf24; }
.ua-profile-sub {
  font-size: var(--fs-xs);
  color: var(--fg-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ua-credits-bar {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--line-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ua-credits-left {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}
.ua-credits-val {
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}
.ua-credits-lbl {
  font-size: var(--fs-xs);
  color: var(--fg-3);
}
.ua-topup-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  padding: 0 11px;
  border-radius: var(--r-full);
  background: var(--accent);
  color: #fff;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  transition: filter var(--dur-fast), transform var(--dur-fast);
}
.ua-topup-btn:hover { filter: brightness(1.06); }
.ua-topup-btn:active { transform: scale(.97); }
.ua-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin-top: 8px;
}
.ua-tile {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px;
  border-radius: 9px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--fg);
  min-width: 0;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.ua-tile .i {
  width: 15px;
  height: 15px;
  color: var(--fg-2);
  flex: none;
}
.ua-tile span:first-of-type {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ua-tile:hover, .ua-tile:focus-visible { background: var(--bg-hover); }
.ua-tile.is-active {
  background: var(--accent-weak);
  color: var(--accent);
  font-weight: var(--fw-semibold);
}
.ua-tile.is-active .i { color: var(--accent); }
.ua-tile-badge {
  margin-left: auto;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: var(--r-full);
  background: var(--danger);
  color: #fff;
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  line-height: var(--lh-none);
  font-variant-numeric: tabular-nums;
}
.ua-tile-badge[hidden] { display: none; }
.ua-foot {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--line-subtle);
}
.ua-logout {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--fg-2);
  transition: background var(--dur-fast), color var(--dur-fast);
}
.ua-logout .i { width: 15px; height: 15px; flex: none; }
.ua-logout:hover, .ua-logout:focus-visible {
  background: var(--danger-weak);
  color: var(--danger);
}

/* Notification bell & popover */
.utility-notif-btn { position: relative; }
.utility-notif-badge {
  position: absolute;
  top: -2px;
  right: -3px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--r-full);
  background: var(--danger);
  color: #fff;
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  line-height: 16px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px var(--bg-elevated);
  pointer-events: none;
}
.utility-notif-btn.is-ringing .i {
  animation: notif-bell-ring .55s var(--ease-out);
  transform-origin: top center;
}
@keyframes notif-bell-ring {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(15deg); }
  40% { transform: rotate(-13deg); }
  60% { transform: rotate(9deg); }
  80% { transform: rotate(-5deg); }
}
.pop-panel.utility-notif-panel {
  width: min(380px, calc(100vw - 16px));
  max-height: min(520px, 75dvh);
  padding: 0;
  overflow: hidden;
}
.pop-panel.utility-notif-panel:not([hidden]) {
  display: flex;
  flex-direction: column;
}
.notif-pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--line-hairline);
}
.notif-pop-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: var(--fs-md);
}
.notif-pop-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: var(--r-full);
  background: var(--accent-weak);
  color: var(--accent);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
}
.notif-mark-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--accent);
  transition: background var(--dur), opacity var(--dur);
}
.notif-mark-all-btn:hover:not(:disabled) { background: var(--accent-weak); }
.notif-mark-all-btn:disabled { opacity: .42; cursor: default; }
.notif-pop-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-subtle);
  background: var(--bg-subtle);
}
.notif-pop-tab {
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--fg-2);
  transition: background var(--dur), color var(--dur);
}
.notif-pop-tab:hover { color: var(--fg); background: var(--bg-hover); }
.notif-pop-tab.is-active {
  background: var(--bg-elevated);
  color: var(--fg);
  box-shadow: var(--shadow-sm);
  font-weight: var(--fw-semibold);
}
.notif-pop-list {
  flex: 1;
  min-height: 120px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px;
  display: grid;
  gap: 4px;
}
.notif-pop-empty {
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 36px 16px;
  text-align: center;
  color: var(--fg-3);
  font-size: var(--fs-xs);
}
.notif-pop-empty .i { width: 22px; height: 22px; opacity: .65; }
.notif-pop-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--dur);
}
.notif-pop-item:hover, .notif-pop-item:focus-visible { background: var(--bg-hover); }
.notif-pop-item.is-unread { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.notif-pop-item.is-unread:hover { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.notif-cat-icon {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  display: inline-grid;
  place-items: center;
  background: var(--accent-weak);
  color: var(--accent);
}
.notif-cat-icon .i { width: 15px; height: 15px; }
.notif-cat-icon.is-success { background: var(--success-weak); color: var(--success); }
.notif-cat-icon.is-warning { background: var(--warning-weak); color: var(--warning); }
.notif-cat-icon.is-danger { background: var(--danger-weak); color: var(--danger); }
.notif-pop-item-body { flex: 1; min-width: 0; }
.notif-pop-item-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.notif-pop-item-title {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notif-pop-item.is-unread .notif-pop-item-title { font-weight: var(--fw-semibold); }
.notif-unread-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 6px;
  vertical-align: middle;
}
.notif-pop-time { flex: none; font-size: var(--fs-2xs); color: var(--fg-3); white-space: nowrap; }
.notif-pop-item-desc {
  margin: 3px 0 6px;
  font-size: var(--fs-xs);
  color: var(--fg-2);
  line-height: var(--lh-snug);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.notif-pop-item-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.notif-cat-tag {
  font-size: var(--fs-2xs);
  color: var(--fg-3);
}
.notif-pop-item-cta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: var(--fs-2xs);
  font-weight: var(--fw-medium);
  color: var(--accent);
}
.notif-pop-read-btn {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  color: var(--fg-3);
  transition: background var(--dur), color var(--dur);
}
.notif-pop-read-btn:hover { background: var(--accent-weak); color: var(--accent); }
.notif-pop-foot {
  border-top: 1px solid var(--line-hairline);
  padding: 8px 10px;
  background: var(--bg-elevated);
}
.utility-notif-all {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--accent-text);
  transition: background var(--dur);
}
.utility-notif-all:hover { background: var(--accent-weak); }
.head-pill-btn.is-active { background: var(--accent-weak); color: var(--accent-text); }
.head-pill-btn:disabled { opacity: .45; cursor: default; }

/* Page header (legacy fallback if used) */
.page-head { height: var(--topbar-h); flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 28px 0 32px; border-bottom: 1px solid var(--line-hairline); background: var(--bg); }
.page-head h1 { font-size: var(--fs-lg); font-weight: var(--fw-semibold); white-space: nowrap; }

/* Footer */
.site-foot { padding: 32px 0 48px; margin-top: 112px; border-top: 1px solid var(--line-hairline); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; font-size: var(--fs-xs); color: var(--fg-3); }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.site-foot a:hover { color: var(--fg); }
.ref-wrap > .site-foot, .tools-container > .site-foot { margin-top: 48px; }
.main-scroll > .site-foot, .creative-catalog-scroll > .site-foot { padding-inline: 28px; }

/* 5. Pages ================================================================= */

/* 5.1 Home ----------------------------------------------------------------- */
.home-scroll { position: relative; }
.home-scroll > .container { position: relative; z-index: 1; }
.home-ambient {
  position: absolute;
  inset: 0 0 auto;
  height: 420px;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.home-ambient::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(0, 0, 0, .045) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse 74% 76% at 50% 22%, #000 22%, transparent 90%);
  mask-image: radial-gradient(ellipse 74% 76% at 50% 22%, #000 22%, transparent 90%);
}
[data-theme="dark"] .home-ambient::before {
  background-image: radial-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px);
}
.home-ambient::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(960px 360px at 50% -10%, rgba(0, 142, 229, .06), transparent 72%);
}
[data-theme="dark"] .home-ambient::after {
  background: radial-gradient(960px 360px at 50% -10%, rgba(43, 156, 255, .10), transparent 72%);
}
.page-ambient {
  position: absolute;
  inset: 0 0 auto;
  height: 340px;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(640px 260px at 78% -12%, rgba(125, 211, 252, .12), transparent 72%),
    radial-gradient(760px 280px at 42% -18%, rgba(186, 230, 253, .08), transparent 74%);
}
[data-theme="dark"] .page-ambient {
  background:
    radial-gradient(640px 260px at 78% -12%, rgba(43, 156, 255, .10), transparent 72%),
    radial-gradient(760px 280px at 42% -18%, rgba(0, 202, 224, .05), transparent 74%);
}

.container { width: 100%; max-width: 1600px; margin: 0 auto; padding: 0 32px; }
.home-hero { padding: 44px 0 0; position: relative; z-index: 20; }
.home-hero h1 { font-size: clamp(24px, 2.6vw, var(--fs-3xl)); font-weight: var(--fw-semibold); letter-spacing: var(--ls-tight); line-height: var(--lh-tight); text-align: center; }
#hero-title { font-size: clamp(24px, 2.6vw, var(--fs-3xl)); font-weight: var(--fw-semibold); }
.home-hero .lede { text-align: center; color: var(--fg-2); margin-top: 10px; font-size: var(--fs-md); line-height: var(--lh-normal); }

/* Composer — 首页、AI 生图、对话助手共用的输入框
   结构：.composer > .composer-refs(可选) + .composer-input + .composer-bar (+ .composer-drop 拖拽层) */
.composer-modes { display: flex; justify-content: center; margin: 20px 0 14px; }
.modes { display: inline-flex; gap: 2px; padding: 3px; height: 40px; border-radius: var(--r-full); background: var(--bg-mode-track); }
.mode {
  height: 34px; padding: 0 18px; border-radius: var(--r-full); display: inline-flex; align-items: center; gap: 7px;
  white-space: nowrap; flex: none;
  color: var(--fg-2); font-size: var(--fs-sm); font-weight: var(--fw-medium); transition: background var(--dur), color var(--dur), box-shadow var(--dur);
}
.mode .i { width: 15px; height: 15px; }
.mode:hover { color: var(--fg); }
.mode[aria-selected="true"] {
  color: var(--fg);
  background: var(--bg-surface);
  border: 1px solid var(--line-hairline);
  font-weight: var(--fw-semibold);
  box-shadow: var(--shadow-sm);
}
[data-theme="dark"] .mode[aria-selected="true"] {
  background: rgba(255, 255, 255, .12);
  color: #ffffff;
  font-weight: var(--fw-semibold);
  border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: none;
}

.composer {
  position: relative; z-index: 20; max-width: 880px; margin: 0 auto;
  background: var(--bg-glass-strong);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1px solid var(--line); border-radius: 24px;
  box-shadow: var(--shadow-dock);
  transition: box-shadow .24s var(--ease), border-color .24s var(--ease), background var(--dur);
}
.home-hero .composer { max-width: 1120px; }
.composer:has(.pop.is-open),
.composer:has(.slash-host:not([hidden])),
.composer:has(.cost-quote:hover),
.composer:has(.cost-quote:focus-within) { z-index: 30; }
[data-theme="dark"] .composer {
  background: var(--bg-glass-strong);
  border-color: var(--line);
  box-shadow: var(--shadow-dock);
}
.composer:hover { border-color: var(--line-strong); box-shadow: var(--shadow-dock); }
.composer:focus-within { border-color: var(--accent-line); box-shadow: var(--shadow-dock-focus); }
[data-theme="dark"] .composer:hover { border-color: var(--line-strong); box-shadow: var(--shadow-dock); }
[data-theme="dark"] .composer:focus-within { border-color: var(--accent-line); box-shadow: var(--shadow-dock-focus); }
.composer-refs { display: flex; flex-wrap: wrap; gap: 10px; padding: 16px 20px 0; }
.composer-input { padding: 16px 20px 6px; }
.composer .textarea { display: block; font-size: var(--fs-md); line-height: var(--lh-normal); min-height: 72px; max-height: 260px; overflow-y: auto; scrollbar-width: thin; }
.composer .textarea:focus,
.composer .textarea:focus-visible { outline: none; box-shadow: none; }
.composer-bar { display: flex; align-items: center; gap: 4px; padding: 8px 14px 12px 14px; }
.composer-bar #modeChips { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.composer-bar .grow { flex: 1; min-width: 8px; }
.composer-bar .grow ~ .mp-slot { margin-right: 4px; }
.composer-add { --s: 32px; position: relative; border-radius: 8px; border: 0; background: transparent; color: var(--fg-2); margin-right: 10px; }
.composer-add::before {
  content: "";
  position: absolute;
  right: -6px;
  top: 50%;
  translate: 0 -50%;
  width: 1px;
  height: 16px;
  background: var(--line);
  pointer-events: none;
}
.composer-add:hover:not(:disabled) { background: var(--bg-hover); color: var(--fg); }
.composer-add:disabled:hover { background: transparent; color: var(--fg-2); }
.composer-add:disabled .i { opacity: .4; }
.composer-add .i { transition: transform var(--dur-fast) var(--ease-out); }
.composer-add[aria-expanded="true"] { background: var(--bg-active); color: var(--fg); }
.composer-add[aria-expanded="true"] .i { transform: rotate(45deg); }
.composer-sep { display: none; }
#studioRefAdd[hidden] + .composer-sep { display: none; }
.chip-ghost {
  height: 30px; padding: 0 9px; gap: 5px;
  border: 0; border-radius: 8px;
  background: transparent; font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--fg-2);
}
.chip-ghost .i { width: 14px; height: 14px; }
.chip-ghost .chev { width: 13px; height: 13px; color: var(--fg-3); margin-left: -1px; margin-right: -3px; transition: transform var(--dur) var(--ease); }
.chip-ghost[aria-expanded="true"] .chev { transform: rotate(180deg); }
.chip-ghost:hover, .chip-ghost[aria-expanded="true"] { border: 0; background: var(--bg-hover); color: var(--fg); }
.chip-ghost.is-on { border: 0; background: var(--accent-weak); color: var(--accent-text); font-weight: var(--fw-semibold); }
.chip-ghost.is-on:hover { background: var(--accent-soft); color: var(--accent-text); }
.cost { position: relative; font-size: var(--fs-sm); color: var(--fg-2); white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; margin-right: 10px; }
.cost b, .cost-val { color: inherit; font-weight: var(--fw-regular); font-variant-numeric: tabular-nums; }
.credit-star { width: 14px; height: 14px; flex: none; display: inline-block; color: currentColor; opacity: .78; }
.credit-num { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.cost-quote { position: relative; }
.cost-trigger {
  display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 8px; margin: 0 -4px;
  border-radius: 8px; cursor: default; color: var(--fg-2); font-weight: var(--fw-regular);
  transition: background var(--dur), color var(--dur);
}
.cost-trigger .credit-star { width: 13.5px; height: 13.5px; }
.cost-trigger:hover, .cost-quote:focus-within .cost-trigger { background: var(--bg-hover); color: var(--fg); }
.cost-popover {
  position: absolute; bottom: calc(100% + 10px); right: -8px; z-index: 75;
  width: 304px; max-width: calc(100vw - 24px); border-radius: 16px;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-pop);
  border: 0;
  white-space: normal; text-align: left;
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translateY(6px) scale(.985); transform-origin: bottom right;
  transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-out), visibility 0s var(--dur);
}
.cost-popover::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 14px; }
.cost-quote:hover .cost-popover, .cost-quote:focus-within .cost-popover {
  opacity: 1; visibility: visible; pointer-events: auto; transform: none;
  transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-out), visibility 0s;
}
.home-hero .cost-popover {
  bottom: auto;
  top: calc(100% + 10px);
  transform: translateY(-6px) scale(.985);
  transform-origin: top right;
}
.home-hero .cost-popover::after {
  top: auto;
  bottom: 100%;
}
.home-hero .cost-quote:hover .cost-popover,
.home-hero .cost-quote:focus-within .cost-popover {
  transform: none;
}
.cost-pop-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 15px 10px; border-bottom: 1px solid var(--line-subtle);
  border-radius: 15px 15px 0 0;
}
.cost-pop-head-main { display: inline-flex; align-items: center; gap: 6px; min-width: 0; flex: 1; }
.cost-pop-model {
  font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--fg);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cost-pop-mode {
  font-size: var(--fs-2xs); font-weight: var(--fw-medium); line-height: var(--lh-tight); padding: 2px 6px; border-radius: 5px;
  background: var(--bg-subtle); color: var(--fg-2); white-space: nowrap; flex: none;
}
.cost-pop-body { padding: 11px 15px 12px; display: grid; gap: 10px; }
.cost-pop-list { display: grid; gap: 7px; }
.cost-pop-item {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  font-size: var(--fs-xs); line-height: var(--lh-snug);
}
.cost-pop-item-label {
  display: inline-flex; align-items: center; flex-wrap: wrap; gap: 5px;
  min-width: 0; color: var(--fg-2);
}
.cost-pop-sub { font-size: var(--fs-xs); color: var(--fg-3); font-variant-numeric: tabular-nums; }
.cost-pop-item-val { flex: none; color: var(--fg); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cost-pop-free { color: var(--success); font-size: var(--fs-xs); font-weight: var(--fw-medium); }
.cost-pop-discount-pill {
  display: inline-flex; align-items: center; padding: 0.5px 5px; border-radius: 4px;
  background: var(--success-weak); color: var(--success);
  font-size: var(--fs-2xs); font-weight: var(--fw-medium); line-height: var(--lh-tight); white-space: nowrap;
}
.cost-pop-save { color: var(--success); font-weight: var(--fw-medium); }
.cost-pop-muted { color: var(--fg-3); font-size: var(--fs-xs); }
.cost-pop-sep { height: 1px; background: var(--line-subtle); }
.cost-pop-total {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: var(--fs-sm); color: var(--fg);
}
.cost-pop-total-label { font-weight: var(--fw-medium); color: var(--fg-2); }
.cost-pop-total-val {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--fg); font-variant-numeric: tabular-nums;
}
.cost-pop-total-val .credit-star { width: 14px; height: 14px; color: var(--fg-2); opacity: 1; }
.cost-pop-total-num { font-size: var(--fs-md); font-weight: var(--fw-semibold); letter-spacing: var(--ls-tight); color: var(--fg); }
.cost-pop-total-unit { font-size: var(--fs-xs); color: var(--fg-3); font-weight: var(--fw-regular); margin-left: 1px; }
.cost-pop-note {
  padding: 7px 10px; border-radius: 8px;
  background: var(--bg-subtle); color: var(--fg-3);
  font-size: var(--fs-xs); line-height: var(--lh-snug);
}
.cost-pop-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 15px; border-top: 1px solid var(--line-subtle); border-radius: 0 0 15px 15px;
  background: var(--bg-subtle); color: var(--fg-2);
  font-size: var(--fs-xs); transition: background var(--dur), color var(--dur);
}
.cost-pop-foot:hover { background: var(--bg-hover); color: var(--fg); }
.cost-pop-foot.is-warn > span:first-child { color: var(--danger); font-weight: var(--fw-medium); }
.cost-pop-cta { display: inline-flex; align-items: center; gap: 2px; font-weight: var(--fw-medium); color: var(--fg); white-space: nowrap; flex: none; }
.cost-pop-foot:hover .cost-pop-cta,
.cost-pop-foot.is-warn .cost-pop-cta { color: var(--accent); }
[data-theme="dark"] .cost-popover { box-shadow: var(--shadow-pop); }
.send-btn {
  width: 38px; height: 38px; border-radius: 50%; flex: none; display: inline-grid; place-items: center;
  background: var(--accent-grad); color: #ffffff; box-shadow: none;
  transition: background var(--dur), color var(--dur), opacity var(--dur), transform .12s var(--ease);
}
.send-btn .i { width: 17px; height: 17px; stroke-width: 2.2; }
.send-btn:hover:not(:disabled) { background: var(--accent-grad-hover); }
.send-btn:active:not(:disabled) { transform: scale(.96); }
.send-btn:disabled { background: var(--bg-subtle); color: var(--fg-3); box-shadow: none; opacity: 1; }
[data-theme="dark"] .send-btn:disabled { background: rgba(255, 255, 255, .08); color: rgba(255, 255, 255, .34); box-shadow: none; }
.send-btn.is-text { width: auto; display: inline-flex; align-items: center; gap: 6px; padding: 0 18px 0 14px; border-radius: var(--r-full); font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.send-btn.is-text .i { width: 15px; height: 15px; }
.send-btn.is-stop .i { width: 15px; height: 15px; }
.composer.is-generating .composer-input,
.composer.is-generating .composer-refs,
.composer.is-generating .skill-chip-slot { opacity: .62; }
.composer.is-generating .textarea:disabled { cursor: not-allowed; opacity: 1; }
.composer.is-generating .composer-bar > :not(#chatStopBtn):not(.grow) { pointer-events: none; opacity: .5; }
.composer-drop {
  position: absolute; inset: -1px; z-index: 3; display: none; place-items: center; border-radius: inherit;
  border: 1.5px dashed var(--accent); background: color-mix(in srgb, var(--bg-elevated) 88%, var(--accent));
  color: var(--accent); font-size: var(--fs-md); font-weight: var(--fw-medium); pointer-events: none;
}
.composer.is-dragover .composer-drop { display: grid; }
.ref { position: relative; width: 64px; height: 64px; border-radius: 12px; overflow: hidden; flex: none; box-shadow: 0 0 0 1px var(--line); }
.ref img { width: 100%; height: 100%; object-fit: cover; }
.ref button { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%; background: rgba(20,20,22,.66); color: #fff; display: grid; place-items: center; opacity: 0; transition: opacity var(--dur-fast); }
.ref:hover button, .ref button:focus-visible { opacity: 1; }
.attachment {
  display: flex; align-items: center; gap: 8px; min-width: 0; max-width: min(100%, 280px);
  padding: 8px 10px; border: 0; border-radius: var(--r-md);
  background: var(--bg-subtle); color: var(--fg); font-size: var(--fs-sm); line-height: var(--lh-snug);
}
.attachment .i { width: 16px; height: 16px; flex: none; color: var(--fg-2); }
.attachment span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment button { display: grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 50%; }
.attachment button:hover { background: var(--bg-hover); }
.ref button .i { width: 12px; height: 12px; stroke-width: 2.4; }
[data-ref-preview] { cursor: zoom-in; }
[data-ref-preview]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ref-chip-preview { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }

.home-section { position: relative; z-index: 1; margin-top: 40px; }
.home-tools-section { margin-top: 28px; }

/* Jimeng-style 2-row horizontal image tools rail (Home) */
.tool-rail { position: relative; }
.tool-rail::before,
.tool-rail::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 56px;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
.tool-rail::before { left: 0; background: linear-gradient(to right, var(--bg-canvas) 15%, transparent); }
.tool-rail::after { right: 0; background: linear-gradient(to left, var(--bg-canvas) 15%, transparent); }
.tool-rail.can-prev::before,
.tool-rail.can-next::after { opacity: 1; }

.tool-rail-track {
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  grid-auto-flow: column;
  grid-template-columns: repeat(4, minmax(256px, 1fr));
  gap: 12px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 4px 2px 8px;
  margin: -4px -2px -8px;
}
.tool-rail-track::-webkit-scrollbar { display: none; }
.tool-rail-track.is-dragging { scroll-behavior: auto; user-select: none; cursor: grabbing; }
.tool-rail-track.is-dragging .tool-card { cursor: grabbing; }

.tool-card {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 84px;
  padding: 6px 14px 6px 6px;
  border-radius: var(--r-lg);
  background: var(--bg-surface);
  border: 1px solid var(--line-hairline);
  box-shadow: none;
  transition: transform var(--dur) var(--ease), border-color var(--dur), box-shadow var(--dur), background var(--dur);
}
[data-theme="dark"] .tool-card { background: var(--bg-surface); border-color: var(--line-hairline); }
.tool-card:hover { transform: translateY(-1px); border-color: var(--line-strong); box-shadow: var(--shadow-card-hover); }
[data-theme="dark"] .tool-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-card-hover); }
.tool-card-media {
  width: clamp(104px, 42%, 136px);
  height: 72px;
  border-radius: 12px;
  overflow: hidden;
  flex: none;
  background: var(--bg-muted);
}
.tool-card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--dur-slow) var(--ease-out); }
.tool-card:hover .tool-card-media img { transform: scale(1.05); }
.tool-card-body { min-width: 0; flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.tool-card-head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.tool-card-head b { font-size: var(--fs-md); font-weight: var(--fw-semibold); color: var(--fg); line-height: var(--lh-tight); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool-card-head .nav-badge { margin-left: 0; }
.tool-card-body p {
  font-size: var(--fs-xs);
  color: var(--fg-2);
  line-height: var(--lh-snug);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tool-rail-nav {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  z-index: 3;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--bg-elevated);
  color: var(--fg);
  border: 1px solid var(--line-hairline);
  box-shadow: var(--shadow-pop);
  transition: background var(--dur), box-shadow var(--dur), transform var(--dur-fast) var(--ease-out);
}
.tool-rail-nav.is-prev { left: 6px; }
.tool-rail-nav.is-next { right: 6px; }
.tool-rail-nav .i { width: 18px; height: 18px; }
.tool-rail-nav:hover { background: var(--bg-elevated); color: var(--fg); box-shadow: var(--shadow-pop); transform: scale(1.06); }
.tool-rail-nav:active { transform: scale(.96); }
[data-theme="dark"] .tool-rail-nav { box-shadow: var(--shadow-pop); }

/* commerce tiles (used on /ecommerce hub) */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px 20px; }
.tile { display: flex; flex-direction: column; gap: 16px; }
.tile-media { position: relative; aspect-ratio: 4 / 5; border-radius: var(--r-lg); border: 0; box-shadow: inset 0 0 0 1px var(--line-hairline); overflow: hidden; background: var(--bg-muted); }
.tile-media > img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--dur-slow) var(--ease-out); }
.tile:hover .tile-media > img { transform: scale(1.03); }
.tile-input {
  position: absolute; left: 10px; bottom: 10px; display: flex; align-items: center; gap: 6px;
  padding: 4px 8px 4px 4px; border-radius: 10px; background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  font-size: var(--fs-2xs); color: #56657d; box-shadow: 0 2px 8px rgba(15, 35, 66, .08);
}
.tile-input img { width: 34px; height: 34px; border-radius: 7px; object-fit: cover; }
.tile-input .i { width: 12px; height: 12px; color: #8c9ab0; }
.tile h3 { font-size: var(--fs-md); display: flex; align-items: center; gap: 6px; }
.tile p { font-size: var(--fs-sm); color: var(--fg-2); margin-top: 4px; line-height: var(--lh-normal); }

/* gallery masonry */
.gallery-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.masonry { column-count: 5; column-gap: 16px; }
.shot { break-inside: avoid; margin-bottom: 16px; position: relative; border-radius: 16px; border: 0; overflow: hidden; background: var(--bg-muted); cursor: zoom-in; display: block; width: 100%; padding: 0; text-align: left; transition: transform var(--dur) var(--ease); }
.shot:hover { box-shadow: none; }
.shot img { width: 100%; height: auto; }
.shot-over {
  position: absolute; inset: auto 0 0 0; padding: 40px 12px 12px; color: #fff;
  background: linear-gradient(to top, rgba(14, 22, 36, .62), rgba(14, 22, 36, 0));
  display: flex; align-items: flex-end; gap: 10px;
  opacity: 0; transition: opacity var(--dur-fast) var(--ease-standard);
}
.shot:hover .shot-over, .shot:focus-visible .shot-over { opacity: 1; }
.shot-over .shot-prompt { flex: 1; font-size: var(--fs-xs); line-height: var(--lh-snug); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.shot-over .btn { --h: 28px; padding: 0 10px; font-size: var(--fs-xs); background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); color: #162032; border-radius: 8px; }
.shot-author { position: absolute; left: 10px; top: 10px; display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: #fff; opacity: 0; transition: opacity var(--dur-fast); text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.shot-author .avatar { width: 20px; height: 20px; }
.shot:hover .shot-author { opacity: 1; }
.shot[hidden] { display: none; }

/* 5.2 Studio (AI 生图) ----------------------------------------------------- */
.studio { --dock-content-w: 984px; --dock-gutter: 48px; --dock-inset: 22px; --dock-sb: 0px; flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.studio .empty-state { max-width: 100%; }
.studio .empty-state .chip { max-width: 100%; height: auto; min-height: 34px; padding: 7px 14px; white-space: normal; text-align: left; line-height: var(--lh-snug); overflow-wrap: anywhere; }
.feed { flex: 1; min-height: 0; }
.feed-inner { width: 100%; max-width: calc(var(--dock-content-w) + var(--dock-gutter) * 2); margin: 0 auto; padding: 16px calc(var(--dock-gutter) + var(--dock-inset, 22px)) 300px; }
.feed-history-bar { display: flex; align-items: center; justify-content: center; padding: 4px 0 14px; font-size: var(--fs-xs); color: var(--fg-3); }
.feed-history-btn {
  height: 30px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line-hairline); background: var(--bg-surface); color: var(--fg-2); box-shadow: none;
  font-size: var(--fs-xs); display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer; transition: background var(--dur), color var(--dur), border-color var(--dur);
}
.feed-history-btn:hover { background: var(--bg-surface); border-color: var(--line-strong); color: var(--fg); box-shadow: none; }
.feed-history-status { display: inline-flex; align-items: center; gap: 6px; color: var(--fg-3); }
.feed-history-spinner {
  width: 12px; height: 12px; border-radius: 999px;
  border: 1.5px solid var(--line-strong); border-top-color: var(--accent);
  animation: spin .75s linear infinite;
}
.feed-day { font-size: var(--fs-xl); font-weight: var(--fw-semibold); color: var(--fg); padding: 28px 0 8px; position: sticky; top: 0; background: var(--bg-canvas); z-index: 2; }
.task { padding: 18px 0 26px; border-bottom: 1px solid var(--line-hairline); }
.task:last-child { border-bottom: 0; }
.task-head { display: flex; gap: 16px; align-items: flex-start; }
.task-prompt { font-size: var(--fs-md); line-height: var(--lh-normal); color: var(--fg); overflow-wrap: anywhere; }
.task-prompt.is-clamped { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }

/* Collapsible 3-line prompt */
.prompt-fold { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.prompt-fold-text {
  width: 100%; min-width: 0;
  white-space: pre-wrap; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: var(--prompt-fold-lines, 3); overflow: hidden;
}
.prompt-fold.is-overflowing:not(.is-expanded) .prompt-fold-text { cursor: pointer; }
.prompt-fold.is-expanded .prompt-fold-text {
  display: block; -webkit-line-clamp: unset; overflow: visible; cursor: text;
}
.prompt-fold-toggle {
  display: inline-flex; align-items: center; gap: 3px;
  margin-top: 4px; margin-left: -6px; padding: 2px 8px 2px 6px;
  border: 0; border-radius: var(--r-xs);
  background: transparent; color: var(--fg-2);
  font-size: var(--fs-xs); font-weight: var(--fw-medium); line-height: var(--lh-snug);
  cursor: pointer; box-shadow: none;
  transition: color var(--dur-fast) var(--ease-standard), background var(--dur-fast) var(--ease-standard);
}
.prompt-fold-toggle[hidden] { display: none; }
.prompt-fold-toggle:hover { color: var(--accent-text); background: var(--bg-hover); }
.prompt-fold-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.prompt-fold-chev { width: 13px; height: 13px; flex: none; transition: transform var(--dur-base) var(--ease-standard); }
.prompt-fold.is-expanded .prompt-fold-chev { transform: rotate(180deg); }
@media (hover: none), (max-width: 767px) {
  .prompt-fold-toggle { min-height: 28px; padding: 4px 10px 4px 6px; }
}
.task-actions { display: flex; gap: 2px; flex: none; opacity: .0; transition: opacity var(--dur); }
.task:hover .task-actions, .task:focus-within .task-actions { opacity: 1; }
.task-foot-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px;
  margin-left: -6px; margin-top: 8px;
  opacity: .48; transition: opacity var(--dur);
}
.task-foot-actions:empty { display: none; }
.task:hover .task-foot-actions,
.task:focus-within .task-foot-actions { opacity: 1; }
@media (hover: none) {
  .task-foot-actions { opacity: 1; }
}
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-bottom: 10px; font-size: var(--fs-xs); color: var(--fg-3); }
.task-meta .meta-item { display: inline-flex; align-items: center; gap: 4px; }
.task-meta .i { width: 13px; height: 13px; }
.task-time { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--fg-3); }
.task-ref-row { display: flex; align-items: center; margin: 0 0 10px; }
.task-refs { display: flex; flex-wrap: wrap; gap: 6px; }
.task-refs img { width: 100%; height: 100%; object-fit: cover; }
.task-images { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; }
.task-media-audio { margin-top: 14px; display: grid; gap: 8px; max-width: 640px; }
.thumb {
  position: relative; height: 248px; max-width: 100%; border-radius: 14px; border: 0; box-shadow: inset 0 0 0 1px var(--line-hairline); overflow: hidden; background: var(--bg-muted);
  flex: none; cursor: zoom-in;
}
.thumb.img-action-card { overflow: visible; }
.thumb.img-action-card .thumb-media { width: 100%; height: 100%; border-radius: inherit; overflow: hidden; }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* Unified image hover actions */
.img-action-card { position: relative; }
.agent-compare-img.img-action-card,
.agent-slot-img-wrap.img-action-card { overflow: visible; }
.agent-compare-img.img-action-card .thumb-media,
.agent-slot-img-wrap.img-action-card .thumb-media,
.ref-library-media .thumb-media {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  overflow: hidden;
}
.agent-slot-img-wrap { width: 100%; aspect-ratio: 3 / 4; border-radius: var(--r-sm); background: var(--bg-muted); }
.ref-library-media { position: relative; }

.img-ov-top {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}
.img-ov-chip {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .90);
  color: #111215;
  border: 1px solid rgba(255, 255, 255, .72);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .14);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-3px) scale(.96);
  transition: opacity var(--dur-fast) var(--ease-standard), transform var(--dur-fast) var(--ease-out), background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}
.img-ov-chip .i { width: 15px; height: 15px; }
.img-ov-chip:hover { background: #fff; border-color: #fff; color: var(--accent); transform: translateY(0) scale(1.04); }
.img-ov-chip.is-favorited,
[data-theme="dark"] .img-ov-chip.is-favorited,
.img-ov-chip.is-favorited:hover,
[data-theme="dark"] .img-ov-chip.is-favorited:hover {
  opacity: 1;
  pointer-events: auto;
  transform: none;
  color: #f59e0b;
}
.img-ov-chip.is-favorited svg { fill: currentColor; }

.img-ov-scrim {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 76px;
  border-radius: 0 0 11px 11px;
  background: linear-gradient(to top, rgba(10, 12, 16, .34) 0%, rgba(10, 12, 16, .10) 58%, transparent 100%);
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-standard);
}

.img-ov-dock {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity var(--dur-fast) var(--ease-standard), transform var(--dur-fast) var(--ease-out);
}
.img-ov-cta {
  height: 30px;
  padding: 0 11px 0 9px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, .90);
  color: #111215;
  border: 1px solid rgba(255, 255, 255, .72);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .14);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  white-space: nowrap;
  flex: none;
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast), transform var(--dur-fast) var(--ease-out);
}
.img-ov-cta .i { width: 14px; height: 14px; }
.img-ov-cta:hover { background: #fff; border-color: #fff; color: var(--accent); transform: translateY(-1px); }

.img-ov-group { display: flex; align-items: center; gap: 4px; }
.img-ov-dock .img-ov-btn {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .90);
  border: 1px solid rgba(255, 255, 255, .72);
  color: #111215;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .14);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  flex: none;
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast), transform var(--dur-fast) var(--ease-out);
}
.img-ov-dock .img-ov-btn .i { width: 14px; height: 14px; }
.img-ov-dock .img-ov-btn:hover,
.img-ov-dock .img-ov-btn[aria-expanded="true"] {
  background: #fff;
  border-color: #fff;
  color: var(--accent);
  transform: translateY(-1px);
}
[data-theme="dark"] .img-ov-chip,
[data-theme="dark"] .img-ov-cta,
[data-theme="dark"] .img-ov-dock .img-ov-btn {
  background: rgba(24, 25, 30, .86);
  color: rgba(255, 255, 255, .94);
  border-color: rgba(255, 255, 255, .16);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .36);
}
[data-theme="dark"] .img-ov-chip:hover,
[data-theme="dark"] .img-ov-cta:hover,
[data-theme="dark"] .img-ov-dock .img-ov-btn:hover,
[data-theme="dark"] .img-ov-dock .img-ov-btn[aria-expanded="true"] {
  background: rgba(38, 40, 48, .96);
  border-color: rgba(255, 255, 255, .28);
  color: var(--accent);
}

.img-action-card:hover .img-ov-chip,
.img-action-card:focus-within .img-ov-chip,
.img-action-card.is-menu-open .img-ov-chip,
.ref-library-media:hover .img-ov-chip,
.ref-library-media:focus-within .img-ov-chip {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}
.img-action-card:hover .img-ov-scrim,
.img-action-card:focus-within .img-ov-scrim,
.img-action-card.is-menu-open .img-ov-scrim,
.ref-library-media:hover .img-ov-scrim,
.ref-library-media:focus-within .img-ov-scrim {
  opacity: 1;
}
.img-action-card:hover .img-ov-dock,
.img-action-card:focus-within .img-ov-dock,
.img-action-card.is-menu-open .img-ov-dock,
.ref-library-media:hover .img-ov-dock,
.ref-library-media:focus-within .img-ov-dock {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.img-action-card.is-narrow .img-ov-btn.is-hide-narrow { display: none; }
.img-action-card.is-ultra-narrow .img-ov-cta { width: 28px; height: 28px; padding: 0; justify-content: center; }
.img-action-card.is-ultra-narrow .img-ov-cta span { display: none; }
@media (hover: none) {
  .img-ov-scrim, .img-ov-dock { display: none; }
  .img-ov-chip { opacity: 1; pointer-events: auto; transform: none; }
}

.img-portal-tip {
  position: fixed;
  inset: auto;
  margin: 0;
  border: 0;
  overflow: visible;
  z-index: 9999;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(15, 16, 20, .92);
  color: #fff;
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .24);
}
.img-portal-menu {
  position: fixed;
  inset: auto;
  margin: 0;
  z-index: 9998;
  width: 356px;
  max-width: calc(100vw - 16px);
  max-height: calc(100dvh - 16px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px;
  border-radius: 16px;
  background: var(--bg-elevated);
  color: var(--fg);
  border: 1px solid var(--line-hairline);
  box-shadow: var(--shadow-pop);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px) scale(.97);
  transition: opacity var(--dur-fast) var(--ease-standard), transform var(--dur-fast) var(--ease-out);
}
.img-portal-menu[data-side="top"] {
  transform-origin: bottom right;
  transform: translateY(6px) scale(.97);
}
.img-portal-menu[data-side="bottom"] {
  transform-origin: top right;
  transform: translateY(-6px) scale(.97);
}
[data-theme="dark"] .img-portal-menu {
  box-shadow: var(--shadow-pop);
}
.img-portal-menu.is-open {
  opacity: 1;
  visibility: visible;
  transform: none;
}
.ipm-head {
  padding: 4px 4px 6px;
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-wide);
  color: var(--fg-3);
}
.ipm-tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 8px;
}
.ipm-tile {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border-radius: 9px;
  background: var(--bg-subtle);
  color: var(--fg);
  font-size: var(--fs-sm);
  text-align: left;
  transition: background var(--dur-instant), color var(--dur-instant);
}
.ipm-tile:hover,
.ipm-tile:focus-visible {
  background: var(--accent-weak);
  color: var(--accent);
}
.ipm-tile .i { width: 14px; height: 14px; color: var(--fg-2); flex: none; }
.ipm-tile:hover .i,
.ipm-tile:focus-visible .i { color: var(--accent); }
.ipm-tile span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ipm-cross-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}
.ipm-cross-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  padding: 7px 6px;
  border-radius: 9px;
  border: 0;
  background: var(--bg-subtle);
  color: var(--fg);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  transition: background var(--dur-instant), color var(--dur-instant);
}
.ipm-cross-btn:hover,
.ipm-cross-btn:focus-visible {
  background: var(--accent-weak);
  color: var(--accent-text);
}
.ipm-cross-btn .i { width: 14px; height: 14px; color: var(--accent); flex: none; }
.ipm-cross-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ipm-foot {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--line-hairline);
}
.ipm-foot-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  padding: 6px 4px;
  border-radius: 8px;
  color: var(--fg-2);
  font-size: var(--fs-xs);
  white-space: nowrap;
  transition: background var(--dur-instant), color var(--dur-instant);
}
.ipm-foot-btn:hover,
.ipm-foot-btn:focus-visible {
  background: var(--bg-hover);
  color: var(--fg);
}
.ipm-foot-btn .i { width: 13px; height: 13px; flex: none; }
.ipm-foot-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 379px) {
  .ipm-cross-btn { gap: 4px; padding: 7px 4px; font-size: var(--fs-xs); }
}
.task-ref-btn {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid transparent;
  background: var(--bg-muted);
  flex: none;
  cursor: zoom-in;
  transition: border-color var(--dur), transform var(--dur-fast) var(--ease-out);
}
.task-ref-btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.task-ref-btn img { width: 100%; height: 100%; object-fit: cover; }
.task-ref-media {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  max-width: min(260px, 100%);
  padding: 0 10px 0 0;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-hairline);
  background: var(--bg-subtle);
  color: var(--fg);
  text-align: left;
  overflow: hidden;
  flex: none;
  cursor: pointer;
  box-shadow: none;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.task-ref-media:hover {
  border-color: var(--accent);
  background: var(--bg-surface);
}
.task-ref-video-thumb {
  position: relative;
  width: 44px;
  height: 44px;
  flex: none;
  overflow: hidden;
  background: #151517;
}
.task-ref-video-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.task-ref-play {
  position: absolute;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(24, 26, 31, .60);
  color: #fff;
  pointer-events: none;
}
.task-ref-play .i { width: 10px; height: 10px; }
.task-ref-icon-box {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  background: var(--bg-muted);
  color: var(--fg-2);
}
.task-ref-media.is-audio .task-ref-icon-box { color: var(--accent-text); }
.task-ref-icon-box .i { width: 18px; height: 18px; }
.task-ref-media-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}
.task-ref-media-name {
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--fg);
  line-height: var(--lh-tight);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.task-ref-media-sub {
  font-size: var(--fs-xs);
  color: var(--fg-3);
  line-height: var(--lh-tight);
  font-variant-numeric: tabular-nums;
}
.task-tool-tag {
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--bg-subtle);
  border: 0;
  color: var(--fg-2);
  font-weight: var(--fw-medium);
}
.thumb-tools { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: rgba(16, 16, 20, .72); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); opacity: 0; transition: opacity var(--dur-fast); }
.thumb:hover .thumb-tools, .thumb:focus-within .thumb-tools { opacity: 1; }
.thumb-tools button { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; background: transparent; color: #fff; }
.thumb-tools button:hover { background: rgba(255, 255, 255, .16); }
.thumb-tools .i { width: 15px; height: 15px; }
.thumb-ratio {
  position: absolute; left: 8px; top: 8px; z-index: 2; pointer-events: none;
  height: 30px; padding: 0 10px; border-radius: 999px;
  display: inline-flex; align-items: center;
  font-size: var(--fs-2xs); font-weight: var(--fw-semibold);
  background: rgba(255, 255, 255, .90); color: #111215;
  border: 1px solid rgba(255, 255, 255, .72);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .14);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  opacity: 0; transition: opacity var(--dur-fast); font-variant-numeric: tabular-nums;
}
[data-theme="dark"] .thumb-ratio {
  background: rgba(24, 25, 30, .86); color: rgba(255, 255, 255, .94);
  border-color: rgba(255, 255, 255, .16); box-shadow: 0 2px 10px rgba(0, 0, 0, .36);
}
.thumb:hover .thumb-ratio,
.thumb:focus-within .thumb-ratio,
.thumb.is-menu-open .thumb-ratio { opacity: 1; }
.thumb-ratio.is-pinned {
  opacity: 1;
  height: 22px;
  padding: 0 7px;
  border-radius: 6px;
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-none);
  background: rgba(15, 16, 20, .62);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .16);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
[data-theme="dark"] .thumb-ratio.is-pinned {
  background: rgba(15, 16, 20, .72);
  color: #fff;
  border-color: rgba(255, 255, 255, .18);
}
.thumb-ratio[hidden] { display: none; }
.thumb.is-pending { cursor: default; display: grid; place-items: center; }
.thumb.is-pending .pending-label { position: relative; z-index: 1; font-size: var(--fs-xs); color: var(--fg-2); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.progress { width: 120px; height: 3px; border-radius: 3px; background: var(--bg-muted); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent-grad); border-radius: 3px; transition: width var(--dur-slow) var(--ease-standard); }
.task-error { margin-top: 14px; display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--r-md); background: var(--danger-weak); color: var(--danger); font-size: var(--fs-sm); max-width: 560px; }
.task-error .i { width: 16px; height: 16px; margin-top: 2px; }
.task-error p { flex: 1; color: var(--fg); }
.task-error p span { color: var(--fg-2); display: block; }
.task.is-new { animation: task-in .35s var(--ease); }
@keyframes task-in { from { opacity: 0; transform: translateY(-6px); } }

/* dock composer */
.dock { position: absolute; left: 0; right: 0; bottom: 0; z-index: 20; padding: 0 calc(var(--dock-gutter, 48px) + var(--dock-sb, 0px)) 24px var(--dock-gutter, 48px); pointer-events: none; }
.dock::before { content: ""; position: absolute; inset: -64px 0 0; background: linear-gradient(to bottom, color-mix(in srgb, var(--bg-canvas) 0%, transparent), var(--bg-canvas) 58%); pointer-events: none; }
.dock .composer { width: 100%; max-width: var(--dock-content-w, 984px); pointer-events: auto; }
.dock .composer .textarea { min-height: 54px; }

/* parameter panel */
.param-panel {
  width: 376px; max-width: calc(100vw - 16px); max-height: min(500px, 64dvh); padding: 16px 18px; border-radius: 18px;
  overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
.param-group + .param-group { margin-top: 15px; }
.param-group > .field-label { margin-bottom: 7px; font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--fg-3); }
.ratio-grid {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px;
  padding: 4px; border-radius: 14px; background: var(--bg-subtle);
}
.ratio-grid.is-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.param-ratio-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); gap: 4px;
  padding: 4px; border-radius: 14px; background: var(--bg-subtle);
}
.ratio {
  height: 54px; border-radius: 10px; border: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--fg-2); font-variant-numeric: tabular-nums;
  transition: background var(--dur), color var(--dur), box-shadow var(--dur);
}
.ratio:hover:not(:disabled) { color: var(--fg); background: var(--bg-hover); }
.ratio:disabled { opacity: .35; }
.ratio[aria-pressed="true"] {
  background: var(--bg-elevated); color: var(--fg); font-weight: var(--fw-semibold);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .07);
}
.ratio-shape { border: 1.6px solid currentColor; border-radius: 3px; }
.param-panel .seg { padding: 4px; border-radius: 12px; background: var(--bg-subtle); flex-wrap: wrap; }
.param-panel .seg > button { height: 32px; border-radius: 9px; font-weight: var(--fw-medium); font-size: var(--fs-xs); }
.param-panel .seg > button[aria-pressed="true"] {
  background: var(--bg-elevated); color: var(--fg); font-weight: var(--fw-semibold);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .07);
}
.param-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.param-chip {
  height: 30px; padding: 0 11px; border-radius: 8px;
  font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--fg-2); font-variant-numeric: tabular-nums;
  background: var(--bg-subtle); border: 1px solid transparent;
  transition: background var(--dur), color var(--dur), border-color var(--dur), box-shadow var(--dur);
}
.param-chip:hover { color: var(--fg); background: var(--bg-hover); }
.param-chip[aria-pressed="true"] {
  background: var(--accent-weak); color: var(--accent-text); font-weight: var(--fw-semibold);
  border-color: transparent; box-shadow: none;
}
.param-readonly-pill {
  display: inline-flex; align-items: center; gap: 6px; width: 100%;
  padding: 7px 10px; border-radius: 10px;
  background: var(--bg-subtle); color: var(--fg-2); font-size: var(--fs-xs); font-weight: var(--fw-medium);
}
.param-note {
  margin-top: 14px; padding: 8px 10px; border-radius: 10px;
  background: var(--bg-subtle); color: var(--fg-2); font-size: var(--fs-xs); line-height: var(--lh-snug);
  display: flex; align-items: flex-start; gap: 6px;
}
.param-note .i { margin-top: 2px; color: var(--accent); flex: none; }
[data-theme="dark"] .ratio-grid,
[data-theme="dark"] .param-ratio-grid,
[data-theme="dark"] .param-panel .seg,
[data-theme="dark"] .param-chip { background: rgba(255, 255, 255, .06); }
[data-theme="dark"] .ratio[aria-pressed="true"],
[data-theme="dark"] .param-panel .seg > button[aria-pressed="true"],
[data-theme="dark"] .param-chip[aria-pressed="true"] {
  background: rgba(255, 255, 255, .13); box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}
.model-panel { width: 320px; }

/* Minimal Model Picker */
.composer-submodes { padding: 14px 20px 0; }
.composer-voice-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 20px 0; }
.composer-voice-select { max-width: 200px; height: 32px; }
.composer-voice-count { font-size: var(--fs-xs); color: var(--fg-3); margin-left: auto; white-space: nowrap; }
.mp-slot { display: inline-flex; align-items: center; max-width: 100%; }
.mp-pop.is-block { display: flex; width: 100%; }
.mp-trigger { max-width: 100%; }
.mp-trigger-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--fg); }
.agent-param-trigger { font-weight: var(--fw-regular); color: var(--fg-2); }
.agent-param-label { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: var(--fw-regular); color: inherit; }
.mp-offer-tag {
  font-size: var(--fs-2xs); font-weight: var(--fw-semibold); line-height: var(--lh-tight); padding: 1px 5px; border-radius: 4px;
  background: var(--brand-hot-weak); color: var(--brand-hot); white-space: nowrap; flex: none;
}
.mp-trigger.is-block {
  width: 100%; height: 42px; padding: 0 12px; gap: 8px;
  border-radius: var(--r-sm); border: 1px solid transparent; background: var(--bg-subtle);
}
.mp-trigger.is-block:hover { border-color: transparent; background: var(--bg-active); }
.mp-trigger-brand { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; flex: none; }
.mp-trigger-icon { width: 15px; height: 15px; display: block; object-fit: contain; }
.mp-brand {
  width: 28px; height: 28px; border-radius: 8px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-subtle); border: 0;
}
.mp-brand.is-sm { width: 22px; height: 22px; border-radius: 6px; }
.mp-brand-img { width: 17px; height: 17px; display: block; object-fit: contain; }
.mp-brand.is-sm .mp-brand-img { width: 14px; height: 14px; }
.mp-brand .i { width: 15px; height: 15px; color: var(--fg-2); }
.mp-brand.is-sm .i { width: 13px; height: 13px; }
[data-theme="dark"] .is-mono { filter: invert(1); }
.mp-pop.is-open > .mp-trigger.is-block {
  border-color: var(--accent);
  background: var(--bg);
  box-shadow: 0 0 0 3px var(--accent-weak);
}
.mp-block-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; }
.mp-block-name { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-panel {
  width: 384px; max-width: calc(100vw - 16px); max-height: min(440px, 62dvh); padding: 6px;
  overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
.mp-pop.is-block > .mp-panel { width: 100%; min-width: 0; max-height: min(400px, 54dvh); }
.mp-item { align-items: flex-start; gap: 10px; padding: 8px 10px; border-radius: 10px; transition: background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease); }
.mp-item[aria-checked="true"] {
  background: var(--accent-weak);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 26%, transparent);
}
.mp-item[aria-checked="true"] .mp-brand {
  background: var(--bg);
  border-color: var(--accent-line);
  box-shadow: 0 1px 4px rgba(0, 142, 229, .10);
}
.mp-item[aria-checked="true"] .mp-name { color: var(--accent); font-weight: var(--fw-semibold); }
.mp-item[aria-checked="true"] .mp-price { color: var(--accent); }
.mp-row-top { width: 100%; display: flex; align-items: center; gap: 6px; min-width: 0; }
.mp-name { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mp-price {
  margin-left: auto; flex: none; display: inline-flex; align-items: center; justify-content: flex-end; gap: 3px;
  min-width: 58px; text-align: right;
  font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--fg-3); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.mp-price .credit-star { width: 13px; height: 13px; }
.agent-model-list {
  max-height: 212px; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; gap: 2px;
  padding: 4px; border-radius: var(--r-sm); border: 0; background: var(--bg-subtle);
}
.agent-model-opt {
  width: 100%; display: flex; align-items: center; gap: 8px; padding: 7px 8px;
  border-radius: 7px; text-align: left; font-size: var(--fs-sm); color: var(--fg);
  transition: background var(--dur), color var(--dur), box-shadow var(--dur);
}
.agent-model-opt:hover { background: var(--bg-hover); }
.agent-model-opt.is-selected {
  background: var(--accent-weak);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 26%, transparent);
  color: var(--accent);
  font-weight: var(--fw-semibold);
}
.agent-model-opt.is-selected .mp-brand {
  background: var(--bg);
  border-color: var(--accent-line);
}
.agent-model-opt.is-selected .mp-price { color: var(--accent); }
.agent-model-opt-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.mp-tag {
  font-size: var(--fs-xs); line-height: var(--lh-tight); padding: 1.5px 6px; border-radius: 5px;
  background: var(--bg-subtle); color: var(--fg-2); white-space: nowrap;
}
.mp-item[aria-checked="true"] .mp-tag { background: rgba(255, 255, 255, .82); color: var(--fg-2); }
[data-theme="dark"] .mp-item[aria-checked="true"] .mp-tag { background: rgba(255, 255, 255, .10); color: var(--fg-2); }
.mp-panel:has(.mp-think-sec) { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.mp-panel:has(.mp-think-sec)[hidden] { display: none; }
.mp-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 6px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.mp-think-badge {
  font-size: var(--fs-xs); line-height: var(--lh-tight); padding: 1.5px 6px; border-radius: var(--r-full);
  background: var(--bg-subtle); color: var(--fg-3); white-space: nowrap; flex: none;
}
.mp-think-badge.is-on { background: var(--accent-weak); color: var(--accent); font-weight: var(--fw-medium); }
.mp-think-sec {
  flex: none; padding: 9px 10px 10px; border-top: 1px solid var(--line-hairline);
  background: var(--bg-subtle); border-radius: 0 0 calc(var(--r-md) - 1px) calc(var(--r-md) - 1px);
}
.mp-think-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.mp-think-title { font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--fg-2); white-space: nowrap; }
.mp-think-desc { font-size: var(--fs-xs); color: var(--fg-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: end; }
.mp-think-pills { display: flex; flex-wrap: wrap; gap: 5px; }
.mp-think-pill {
  height: 26px; padding: 0 10px; border-radius: var(--r-full);
  border: 1px solid var(--line-hairline); background: var(--bg-surface); color: var(--fg-2); box-shadow: none;
  font: inherit; font-size: var(--fs-xs); font-weight: var(--fw-medium); cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.mp-think-pill:hover { background: var(--bg-subtle); color: var(--fg); }
.mp-think-pill[aria-pressed="true"] {
  background: var(--bg-active); border-color: transparent; color: var(--fg); font-weight: var(--fw-semibold); box-shadow: none;
}
.ep-model-sec { padding-top: 18px; padding-bottom: 18px; }

/* 5.3 Chat ----------------------------------------------------------------- */
body[data-nav="chat"] .app-header.is-floating .app-header-slot {
  flex: 1 1 auto;
  justify-content: space-between;
  min-width: 0;
}
.chat-head-context {
  display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 480px;
  height: 36px; padding: 0 12px; border-radius: var(--r-full);
  background: var(--bg-glass);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line-hairline);
  box-shadow: none;
}
[data-theme="dark"] .chat-head-context {
  background: var(--bg-glass);
  border-color: var(--line-hairline);
  box-shadow: none;
}
.chat-head-context h1 { font-size: var(--fs-md); font-weight: var(--fw-semibold); color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head-skill {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--r-full);
  background: var(--accent-weak); color: var(--accent); font-size: var(--fs-xs); font-weight: var(--fw-semibold); white-space: nowrap; flex: none;
}

.chat-layout { flex: 1; min-height: 0; display: flex; flex-direction: row; position: relative; overflow: hidden; }
.chat-layout.is-resizing { user-select: none; cursor: col-resize; }
.chat-layout.is-resizing iframe { pointer-events: none; }
.chat-main { --dock-content-w: 880px; --dock-gutter: 32px; --dock-inset: 22px; --dock-sb: 0px; flex: 1; display: flex; flex-direction: column; min-height: 0; min-width: 0; position: relative; }
.chat-layout.is-drawer-open .chat-main { --dock-gutter: 20px; --dock-inset: 14px; }
.chat-edit-notice { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 8px 14px 0; color: var(--accent); font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.chat-scroll { flex: 1; min-height: 0; position: relative; }
.chat-ambient {
  position: absolute; inset: 0 0 auto; height: 360px; pointer-events: none; z-index: 0;
  background: radial-gradient(840px 300px at 50% -12%, rgba(0, 142, 229, .05), transparent 72%);
}
[data-theme="dark"] .chat-ambient {
  background: radial-gradient(840px 300px at 50% -12%, rgba(43, 156, 255, .09), transparent 72%);
}

.chat-scroll-bottom {
  position: absolute; left: 50%; bottom: calc(100% + 12px); translate: -50% 0; z-index: 25;
  pointer-events: auto;
  display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 13px; border-radius: var(--r-full);
  background: var(--bg-elevated); color: var(--fg); border: 1px solid var(--line-hairline);
  box-shadow: var(--shadow-pop); font-size: var(--fs-xs); font-weight: var(--fw-medium);
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur);
}
.chat-scroll-bottom:hover { background: var(--bg-subtle); transform: translateY(-1px); }

.thread {
  position: relative; z-index: 1; width: 100%;
  max-width: calc(var(--dock-content-w) + var(--dock-gutter) * 2);
  margin: 0 auto;
  padding: calc(var(--topbar-h) + 22px) calc(var(--dock-gutter) + var(--dock-inset, 22px)) 240px;
  display: flex; flex-direction: column; gap: 28px;
}

.turn.is-located {
  animation: turnLocatePulse 1.5s var(--ease-out);
  border-radius: var(--r-md);
}
@keyframes turnLocatePulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 142, 229, .38); background: var(--accent-weak); }
  100% { box-shadow: 0 0 0 12px rgba(0, 142, 229, 0); background: transparent; }
}

/* User turn */
.turn-user { align-self: flex-end; max-width: min(78%, 680px); display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.turn-user-skill {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: var(--r-full);
  background: var(--accent-weak); color: var(--accent-text); font-size: var(--fs-xs); font-weight: var(--fw-medium);
}
.turn-user-media { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.turn-user-thumb {
  position: relative; width: 78px; height: 78px; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--line); background: var(--bg-muted); cursor: zoom-in;
  transition: transform var(--dur-fast) var(--ease-out), border-color var(--dur);
}
.turn-user-thumb:hover { transform: translateY(-1px); border-color: var(--accent); }
.turn-user-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.turn-user-thumb span {
  position: absolute; left: 4px; bottom: 4px; padding: 1px 5px; border-radius: 5px;
  background: rgba(16, 16, 20, .72); color: #fff; font-size: var(--fs-2xs); font-weight: var(--fw-semibold);
}
.turn-user-files { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.turn-user-bubble {
  padding: 11px 16px; border-radius: 18px 18px 4px 18px;
  background: var(--bg-subtle); color: var(--fg); font-size: var(--fs-md); line-height: var(--lh-normal);
  border: 1px solid transparent;
}
[data-theme="dark"] .turn-user-bubble {
  background: var(--bg-elevated);
  border-color: var(--line-hairline);
}
.turn-user-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.turn-user-actions {
  display: flex; align-items: center; justify-content: flex-end; gap: 4px;
  opacity: 0; pointer-events: none; transition: opacity var(--dur);
}
.turn-user:hover .turn-user-actions,
.turn-user:focus-within .turn-user-actions { opacity: 1; pointer-events: auto; }
.turn-act-btn {
  display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 6px;
  font-size: var(--fs-xs); color: var(--fg-3); transition: background var(--dur), color var(--dur);
}
.turn-act-btn:hover { background: var(--bg-hover); color: var(--fg); }
@media (hover: none) {
  .turn-user-actions { opacity: 1; pointer-events: auto; }
}

/* AI turn */
.turn-ai { display: flex; flex-direction: column; gap: 10px; }
.turn-ai-trace-slot:empty,
.turn-ai-flow:empty,
.turn-ai-foot-slot:empty { display: none; }
.turn-ai-flow { display: flex; flex-direction: column; gap: 12px; }
.turn-ai-media { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.turn-ai-media[hidden] { display: none; }
.turn-ai-foot {
  display: flex; align-items: center; gap: 2px; margin-left: -6px; margin-top: 4px;
  opacity: .55; transition: opacity var(--dur);
}
.turn-ai:hover .turn-ai-foot,
.turn-ai:focus-within .turn-ai-foot { opacity: 1; }
@media (hover: none) {
  .turn-ai-foot { opacity: 1; }
}
.turn-ai-model {
  margin-left: 8px; font-size: var(--fs-xs); color: var(--fg-3); font-weight: var(--fw-medium);
}
.turn-live-status { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--fg-3); }
.turn-live-status .trace-status-dot { background: var(--accent); animation: tracePulse 1.2s ease-in-out infinite; }

/* Minimalist Reasoning & Tool Trace Timeline (Borderless trigger, single timeline line, per-step max-height) */
.turn-trace {
  border: 0; border-radius: 0; background: transparent;
  overflow: visible; max-width: 100%;
}
.turn-trace.is-running,
.turn-trace.is-error { border: 0; background: transparent; }
.turn-trace summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; max-width: 100%;
  padding: 2px 0; border: 0; border-radius: 0; background: transparent; box-shadow: none;
  font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--fg-3); user-select: none; width: fit-content;
  transition: color var(--dur);
}
.turn-trace summary::-webkit-details-marker { display: none; }
.turn-trace summary:hover { background: transparent; color: var(--fg-2); }
.turn-trace summary:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 2px; border-radius: 4px; }
.turn-trace.is-running summary { color: var(--fg-2); }
.turn-trace.is-error summary { color: var(--danger); }
.trace-lead { display: inline-flex; align-items: center; justify-content: center; flex: none; }
.trace-done-ic { color: var(--fg-3); flex: none; }
.trace-status-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--success); }
.turn-trace.is-running .trace-status-dot { background: var(--accent); animation: tracePulse 1.2s ease-in-out infinite; }
.turn-trace.is-error .trace-status-dot { background: var(--danger); }
@keyframes tracePulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.4); opacity: .55; } }
.trace-summary-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trace-chev { color: var(--fg-3); transition: rotate var(--dur-fast) var(--ease-standard); flex: none; }
.turn-trace[open] .trace-chev { rotate: 90deg; }
.turn-trace-body {
  margin: 6px 0 2px 3px; padding: 2px 0 4px 14px;
  border: 0; border-left: 1px solid var(--line); border-radius: 0;
  background: transparent; box-shadow: none;
  display: flex; flex-direction: column; gap: 10px; max-width: 780px;
}
.trace-item-head { display: flex; align-items: center; gap: 7px; font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--fg-2); }
.trace-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--fg-3); flex: none; }
.trace-dot.is-running { background: var(--accent); animation: tracePulse 1.2s infinite; }
.trace-dur { margin-left: auto; font-size: var(--fs-2xs); color: var(--fg-3); font-variant-numeric: tabular-nums; font-weight: var(--fw-medium); }
.thinking-body {
  margin: 5px 0 0 13px; padding: 0 6px 0 0; border: 0; background: transparent;
  max-height: 220px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
  font-size: var(--fs-xs); color: var(--fg-2); line-height: var(--lh-normal); white-space: pre-wrap; overflow-wrap: anywhere;
}
.trace-tool { display: flex; align-items: flex-start; gap: 8px; font-size: var(--fs-xs); color: var(--fg-2); }
.trace-tool-ic {
  width: 20px; height: 20px; border-radius: 6px; flex: none; display: grid; place-items: center;
  background: var(--bg-subtle); color: var(--fg-2); margin-top: 1px;
}
.trace-tool.is-running .trace-tool-ic { background: var(--accent-weak); color: var(--accent); }
.trace-tool.is-running .trace-tool-ic .i { animation: spin 1s linear infinite; }
.trace-tool.is-done .trace-tool-ic { background: var(--success-weak); color: var(--success); }
.trace-tool.is-error .trace-tool-ic { background: var(--danger-weak); color: var(--danger); }
.trace-tool-body {
  display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1;
  max-height: 160px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
  padding-right: 4px; overflow-wrap: anywhere;
}
.trace-tool-err { color: var(--danger); font-size: var(--fs-xs); line-height: var(--lh-snug); white-space: pre-wrap; }

/* Rich Markdown prose */
.prose { font-size: var(--fs-md); line-height: var(--lh-relaxed); max-width: 100%; color: var(--fg); overflow-wrap: anywhere; }
.prose > * + * { margin-top: .85em; }
.prose ul, .prose ol { padding-left: 1.35em; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li + li { margin-top: .32em; }
.prose li::marker { color: var(--fg-3); }
.prose strong { font-weight: var(--fw-semibold); }
.prose h1, .prose h2, .prose h3, .prose h4 { margin-top: 1.35em; font-weight: var(--fw-semibold); }
.prose h2 { font-size: var(--fs-xl); }
.prose h3 { font-size: var(--fs-lg); }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.prose blockquote {
  padding: 6px 14px; border-left: 3px solid var(--accent-line);
  background: var(--bg-subtle); border-radius: 0 var(--r-xs) var(--r-xs) 0; color: var(--fg-2);
}
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 1.2em 0; }
.prose code { font-family: var(--mono); font-size: .88em; padding: .1em .35em; border-radius: 5px; background: var(--bg-muted); }
.md-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-sm); }
.prose table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.prose th, .prose td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.prose th { background: var(--bg-subtle); font-weight: var(--fw-semibold); color: var(--fg); }
.prose tr:last-child td { border-bottom: 0; }
.codeblock { border-radius: var(--r-md); border: 1px solid var(--line-hairline); overflow: hidden; background: var(--bg-surface); }
[data-theme="dark"] .codeblock { background: var(--bg-subtle); }
.codeblock-head { display: flex; align-items: center; justify-content: space-between; height: 36px; padding: 0 6px 0 14px; font-size: var(--fs-xs); color: var(--fg-3); border-bottom: 1px solid var(--line-hairline); background: var(--bg-subtle); }
.codeblock-actions { display: inline-flex; align-items: center; gap: 4px; }
.codeblock-preview-btn { color: var(--accent-text); font-weight: var(--fw-medium); }
.codeblock-preview-btn:hover { background: var(--accent-weak); color: var(--accent-text); }
.codeblock-live-tag { font-size: var(--fs-2xs); color: var(--accent-text); padding: 0 6px; }
.codeblock pre { margin: 0; padding: 14px; max-height: min(440px, 52vh); overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; contain: layout style; font-family: var(--mono); font-size: var(--fs-sm); line-height: var(--lh-normal); }
.codeblock.is-expanded pre { max-height: none; }
.codeblock code { background: none; padding: 0; font-size: inherit; }

/* Syntax Highlighting Tokens (hljs) */
.hljs { color: var(--fg); }
.hljs-comment, .hljs-quote { color: var(--hljs-com); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-meta .hljs-keyword, .hljs-doctag, .hljs-section { color: var(--hljs-kw); }
.hljs-string, .hljs-regexp, .hljs-meta .hljs-string, .hljs-attribute { color: var(--hljs-str); }
.hljs-number, .hljs-literal, .hljs-symbol, .hljs-bullet, .hljs-link { color: var(--hljs-num); }
.hljs-title, .hljs-title.function_, .hljs-function .hljs-title { color: var(--hljs-fn); }
.hljs-name, .hljs-tag { color: var(--hljs-tag); }
.hljs-attr, .hljs-property { color: var(--hljs-attr); }
.hljs-variable, .hljs-template-variable, .hljs-params { color: var(--hljs-var); }
.hljs-type, .hljs-title.class_, .hljs-built_in { color: var(--hljs-type); }
.hljs-meta { color: var(--hljs-meta); }
.hljs-punctuation, .hljs-operator { color: var(--hljs-pun); }
.hljs-addition { color: var(--hljs-add); }
.hljs-deletion { color: var(--hljs-del); }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: var(--fw-semibold); }

/* Bottom Deploy Action Bar for Runnable Webpage Code */
.turn-deploy-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 9px 12px; margin: 10px 0 4px;
  border-radius: var(--r-md); border: 1px solid var(--line-hairline);
  background: var(--bg-surface); box-shadow: none;
}
.turn-deploy-info { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--fg-2); }
.turn-deploy-info .i { color: var(--accent-text); flex: none; }
.turn-deploy-acts { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.caret > p:last-child::after, .caret > h3:last-child::after, .caret > ul:last-child > li:last-child::after, .caret > ol:last-child > li:last-child::after, .caret:empty::after { content: ""; display: inline-block; width: 7px; height: 1.1em; vertical-align: -.18em; margin-left: 2px; background: var(--fg); animation: blink 1s steps(1) infinite; border-radius: 1px; }
@keyframes blink { 50% { opacity: 0; } }

.chat-empty { position: relative; z-index: 1; width: 100%; max-width: calc(var(--dock-content-w) + var(--dock-gutter) * 2); margin: 0 auto; padding: max(96px, 12vh) calc(var(--dock-gutter) + var(--dock-inset, 22px)) 240px; text-align: center; }
.chat-empty h2 { font-size: clamp(20px, 2.4vw, var(--fs-2xl)); font-weight: var(--fw-semibold); letter-spacing: var(--ls-normal); }
.chat-empty p { color: var(--fg-2); margin-top: 8px; max-width: 620px; margin-inline: auto; font-size: var(--fs-md); }
.starters { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 28px; text-align: left; }
.starter {
  display: flex; align-items: flex-start; gap: 12px; padding: 18px; border-radius: var(--r-lg);
  border: 1px solid var(--line-hairline); background: var(--bg-surface); box-shadow: none; text-align: left;
  transition: background var(--dur), border-color var(--dur), transform var(--dur);
}
.starter:hover { background: var(--bg-surface); border-color: var(--line-strong); transform: translateY(-1px); box-shadow: none; }
.starter-ic {
  width: 34px; height: 34px; border-radius: 9px; flex: none; display: grid; place-items: center;
  background: var(--bg-subtle); color: var(--fg-2); border: 0;
}
.starter:hover .starter-ic { background: var(--accent-weak); color: var(--accent-text); }
.starter-ic .i { width: 17px; height: 17px; margin: 0; }
.starter b { font-weight: var(--fw-medium); display: block; font-size: var(--fs-md); color: var(--fg); }
.starter span { font-size: var(--fs-sm); color: var(--fg-3); }
.chat-main .dock { padding-bottom: 14px; }
.chat-main .dock .composer { max-width: var(--dock-content-w); }
.chat-main .dock .composer-input { padding: 18px 22px 4px; }
.chat-main .dock .composer .textarea { min-height: 28px; }
.dock-note { position: relative; max-width: var(--dock-content-w, 880px); margin: 10px auto 0; text-align: center; font-size: var(--fs-xs); color: var(--fg-3); pointer-events: auto; }
.ref.is-video {
  width: 84px;
  height: 64px;
  background: var(--bg-muted);
  border: 1px solid var(--line-hairline);
  box-shadow: none;
}
.ref-video-trigger {
  position: relative;
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
}
.ref-video-trigger video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #151517;
}
.ref-video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(24, 26, 31, .58);
  color: #fff;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  pointer-events: none;
}
.ref-video-play .i { width: 11px; height: 11px; }
.ref-video-dur {
  position: absolute;
  left: 4px;
  bottom: 4px;
  padding: 1px 5px;
  border-radius: var(--r-xs);
  font-size: var(--fs-2xs);
  line-height: var(--lh-tight);
  background: rgba(24, 26, 31, .64);
  color: #fff;
  pointer-events: none;
}
.ref.is-file { width: auto; max-width: 190px; height: 42px; padding: 0 28px 0 10px; border-radius: 10px; display: inline-flex; align-items: center; background: var(--bg-subtle); border: 1px solid var(--line-hairline); box-shadow: none; }
.ref-media-chip { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--fg); min-width: 0; }
.ref.is-file.is-audio .ref-media-chip { cursor: pointer; }
.ref-media-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ref-media-chip small { flex: none; color: var(--fg-3); font-size: var(--fs-2xs); }
.ref.is-file button { top: 50%; translate: 0 -50%; right: 6px; opacity: .75; }

/* Resizable Split Bar & Session Right Drawers */
.chat-split-resizer {
  width: 12px; flex: none; cursor: col-resize; position: relative; z-index: 26;
  margin: calc(var(--topbar-h) + 6px) 0 14px;
  display: flex; align-items: center; justify-content: center; touch-action: none;
}
.chat-split-resizer[hidden] { display: none !important; }
.chat-split-resizer::after {
  content: ""; width: 3px; height: 36px; border-radius: var(--r-full);
  background: var(--line); transition: background var(--dur), height var(--dur), width var(--dur);
}
.chat-split-resizer:hover::after,
.chat-split-resizer:focus-visible::after,
.chat-split-resizer.is-dragging::after {
  width: 4px; height: 56px; background: var(--accent);
}
.chat-split-resizer:focus-visible { outline: none; }

.chat-gallery-drawer {
  width: 332px; flex: none; display: flex; flex-direction: column; min-height: 0;
  margin: calc(var(--topbar-h) + 6px) 16px 14px 0; padding-top: 0;
  border: 1px solid var(--line-hairline); border-radius: var(--r-lg);
  background: var(--bg-surface); overflow: hidden; box-shadow: none; z-index: 25;
}
.cgd-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 14px 10px; border-bottom: 1px solid var(--line-hairline); flex: none;
}
.cgd-title { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-md); }
.cgd-head-acts { display: inline-flex; align-items: center; gap: 4px; }
.cgd-filters { display: flex; gap: 4px; padding: 10px 14px; border-bottom: 1px solid var(--line-hairline); flex: none; }
.cgd-filters .pill { height: 28px; padding: 0 11px; font-size: var(--fs-xs); }
.cgd-body { flex: 1; min-height: 0; padding: 12px 14px 24px; }
.cgd-empty { padding: 40px 12px; text-align: center; font-size: var(--fs-sm); color: var(--fg-3); }
.cgd-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cgd-item {
  border: 0; border-radius: 12px; overflow: hidden; background: var(--bg-subtle);
  display: flex; flex-direction: column;
}
.cgd-thumb { position: relative; aspect-ratio: 1; background: var(--bg-muted); overflow: hidden; cursor: zoom-in; }
.cgd-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cgd-placeholder { width: 100%; height: 100%; display: grid; place-items: center; color: var(--fg-2); background: #181a20; }
.cgd-placeholder.is-audio { background: var(--accent-weak); color: var(--accent); padding: 8px; text-align: center; font-size: var(--fs-xs); }
.cgd-kind-tag {
  position: absolute; left: 6px; bottom: 6px; display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 6px; border-radius: 6px; background: rgba(15, 16, 20, .74); color: #fff; font-size: var(--fs-2xs);
}
.cgd-meta { padding: 6px 8px 2px; display: flex; flex-direction: column; gap: 1px; }
.cgd-meta strong { font-size: var(--fs-xs); font-weight: var(--fw-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cgd-meta small { font-size: var(--fs-xs); color: var(--fg-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cgd-acts { display: flex; align-items: center; justify-content: flex-end; gap: 2px; padding: 2px 4px 4px; }

/* 5.4 Pricing -------------------------------------------------------------- */
#pricingWorkspace { position: relative; }
#pricingWorkspace > .container { position: relative; z-index: 1; }
.pricing-container { max-width: 1600px; padding-bottom: 72px; }
.pricing-hero { padding: 52px 0 28px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; }
.pricing-hero h1 { font-size: clamp(24px, 3vw, var(--fs-4xl)); font-weight: var(--fw-semibold); letter-spacing: var(--ls-tight); line-height: var(--lh-tight); }
.pricing-hero p { color: var(--fg-2); font-size: var(--fs-md); max-width: 640px; line-height: var(--lh-relaxed); }
.pricing-trust { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; margin-top: 6px; }
.pricing-trust-item {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: var(--r-full);
  background: var(--bg-surface); border: 1px solid var(--line-hairline); box-shadow: none;
  font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--fg-2);
}
.pricing-trust-item .i { color: var(--accent); }

.pricing-status-strip {
  display: flex; align-items: center; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap;
  padding: 16px 20px; margin-bottom: 28px;
  border: 1px solid var(--line-hairline); border-radius: var(--r-lg);
  background: var(--bg-surface); box-shadow: none;
}
.pricing-status-metrics { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.pricing-metric { display: flex; flex-direction: column; gap: 3px; }
.pricing-metric-label { font-size: var(--fs-xs); color: var(--fg-3); }
.pricing-metric-val { font-size: var(--fs-2xl); font-weight: var(--fw-bold); letter-spacing: var(--ls-tight); line-height: var(--lh-tight); }
.pricing-metric-tier { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pricing-metric-sub { font-size: var(--fs-xs); color: var(--fg-2); }
.pricing-metric-sep { width: 1px; height: 32px; background: var(--line); }

.pricing-status-growth { flex: 1 1 280px; min-width: 220px; max-width: 440px; display: grid; gap: 6px; }
.pricing-growth-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: var(--fs-xs); color: var(--fg-2); flex-wrap: wrap; }
.pricing-growth-head > span:first-child { font-weight: var(--fw-semibold); color: var(--fg); }
.pricing-progress-bar { height: 6px; border-radius: var(--r-full); background: var(--bg-muted); overflow: hidden; }
.pricing-progress-bar > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--brand-teal)); transition: width var(--dur-slow) var(--ease-out); }
.pricing-growth-hint { font-size: var(--fs-xs); color: var(--fg-3); }
.pricing-growth-done { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--success); }

.pricing-guest-copy { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pricing-guest-title { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--fg); }
.pricing-guest-title .i { color: var(--accent); flex: none; }
.pricing-status-actions { display: flex; align-items: center; gap: 8px; flex: none; margin-left: auto; }

.pricing-section { margin-top: 44px; scroll-margin-top: 76px; }
.pricing-section:first-of-type { margin-top: 0; }
.pricing-benefits-section { margin-top: 64px; }

.save-tag { font-size: var(--fs-2xs); color: var(--success); font-weight: var(--fw-semibold); }
.plans { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line-hairline); border-radius: var(--r-lg); overflow: hidden; background: var(--bg-surface); box-shadow: none; }
.plans.plans-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.plan { padding: 28px 24px; display: flex; flex-direction: column; gap: 18px; position: relative; transition: background var(--dur-base) var(--ease-out); }
.plan + .plan { border-left: 1px solid var(--line-hairline); }
.plan.is-featured { background: var(--bg-subtle); }
.plan.is-current { box-shadow: inset 0 2px 0 var(--accent); background: color-mix(in srgb, var(--accent-weak) 32%, var(--bg-surface)); }
.plan.is-tier-silver.is-current { box-shadow: inset 0 2px 0 #64748b; }
.plan.is-tier-gold.is-current, .plan.is-tier-gold.is-featured { box-shadow: inset 0 2px 0 #d97706; }
.plan.is-tier-diamond.is-current, .plan.is-tier-diamond.is-featured {
  box-shadow: inset 0 2px 0 var(--accent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent-weak) 36%, var(--bg-surface)) 0%, var(--bg-surface) 58%);
}
[data-theme="dark"] .ua-tier-badge[data-tier="diamond"] { background: var(--accent-weak); color: var(--accent-text); }
.plan-head { display: grid; gap: 4px; }
.plan-name { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: var(--fs-lg); font-weight: var(--fw-semibold); }
.plan-threshold { font-size: var(--fs-xs); color: var(--fg-2); margin-top: 4px; }
.plan-threshold-sub { font-size: var(--fs-xs); color: var(--fg-3); }
.plan-desc { font-size: var(--fs-sm); color: var(--fg-2); min-height: 42px; margin-top: 4px; font-weight: var(--fw-regular); }
.price { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.price b { font-size: var(--fs-4xl); font-weight: var(--fw-bold); letter-spacing: var(--ls-tight); font-variant-numeric: tabular-nums; line-height: var(--lh-tight); }
.price .cur { font-size: var(--fs-xl); font-weight: var(--fw-semibold); }
.price span { color: var(--fg-3); font-size: var(--fs-xs); }
.price-note { font-size: var(--fs-xs); color: var(--fg-3); min-height: 18px; margin-top: -12px; }
.plan-credits { padding: 11px 14px; border-radius: var(--r-md); background: var(--bg-subtle); font-size: var(--fs-sm); color: var(--fg-2); display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.plan.is-featured .plan-credits, .plan.is-current .plan-credits { background: var(--bg-subtle); box-shadow: none; }
.plan-credits b { color: var(--fg); font-size: var(--fs-lg); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; }
.plan-credits-sep { margin: 0 4px; color: var(--fg-3); }
.features { display: flex; flex-direction: column; gap: 11px; font-size: var(--fs-sm); }
.features li { display: flex; gap: 8px; align-items: flex-start; color: var(--fg-2); }
.features .i { width: 16px; height: 16px; margin-top: 2px; color: var(--accent); flex: none; }
.features li.is-off { color: var(--fg-3); }
.features li.is-off .i { color: var(--fg-3); }
.plan-cta { margin-top: auto; padding-top: 4px; }

.packs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.packs.packs-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pack {
  padding: 20px; border-radius: var(--r-lg); border: 1px solid var(--line-hairline); background: var(--bg-surface); box-shadow: none;
  text-align: left; display: flex; flex-direction: column; gap: 8px;
  transition: background var(--dur), border-color var(--dur), transform var(--dur-fast) var(--ease-out), box-shadow var(--dur);
}
.pack:hover { transform: translateY(-1px); border-color: var(--line-strong); box-shadow: var(--shadow-card-hover); }
[data-theme="dark"] .pack:hover { border-color: var(--line-strong); box-shadow: var(--shadow-card-hover); }
.pack.is-featured { border: 1.5px solid var(--accent-line); box-shadow: none; background: linear-gradient(180deg, color-mix(in srgb, var(--accent-weak) 42%, var(--bg-surface)) 0%, var(--bg-surface) 58%); }
.pack-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 24px; }
.pack-name { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--fg-2); }
.pack-credits { display: inline-flex; align-items: baseline; gap: 5px; font-size: var(--fs-2xl); font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; letter-spacing: var(--ls-tight); margin-top: 2px; }
.pack-credits .credit-star { align-self: center; color: var(--accent); opacity: 1; }
.pack-credits small { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--fg-2); margin-left: 2px; letter-spacing: 0; }
.pack-price-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pack-price { font-size: var(--fs-2xl); font-weight: var(--fw-bold); color: var(--fg); font-variant-numeric: tabular-nums; letter-spacing: var(--ls-tight); }
.pack-save-pill { padding: 2px 8px; border-radius: var(--r-full); background: var(--success-weak); color: var(--success); font-size: var(--fs-2xs); font-weight: var(--fw-semibold); }
.pack-desc { font-size: var(--fs-xs); color: var(--fg-2); line-height: var(--lh-normal); flex: 1; }
.pack-tier-slot { min-height: 24px; display: flex; align-items: center; }
.pack-tier-hint {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--r-full);
  background: var(--accent-weak); color: var(--accent);
  font-size: var(--fs-xs); font-weight: var(--fw-semibold);
}
.pack-cta { margin-top: 6px; }

.pack-bar { margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; border-radius: var(--r-md); background: var(--bg-surface); box-shadow: none; border: 1px solid var(--line-hairline); flex-wrap: wrap; }
.pack-bar .num { font-weight: var(--fw-semibold); }
.pricing-redeem-copy { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.pricing-redeem-copy span { font-size: var(--fs-sm); color: var(--fg-2); }
.pricing-redeem-form { display: flex; gap: 8px; align-items: center; flex: 0 1 340px; }
.pricing-redeem-form .input { min-width: 180px; }

.pricing-matrix-wrap { margin-top: 24px; background: var(--bg-surface); border: 1px solid var(--line-hairline); box-shadow: none; }
.pricing-matrix-wrap .ref-matrix th:first-child,
.pricing-matrix-wrap .ref-matrix td:first-child { min-width: 140px; white-space: nowrap; }
.pricing-matrix-wrap .ref-matrix td .i { color: var(--success); }
.pricing-rules-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }

/* Cashier Checkout Modal */
.cashier-modal {
  width: min(94vw, 480px);
  border-radius: var(--r-xl);
  border: 0;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
}
.cashier-box { display: flex; flex-direction: column; max-height: calc(100dvh - 32px); }
.cashier-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 20px 22px 14px; border-bottom: 1px solid var(--line-hairline);
}
.cashier-head-copy h2 { font-size: var(--fs-xl); font-weight: var(--fw-semibold); }
.cashier-head-sub { display: block; margin-top: 2px; font-size: var(--fs-xs); color: var(--fg-3); }
.cashier-body { padding: 18px 22px 22px; display: grid; gap: 14px; }
.cashier-stage { display: grid; gap: 14px; }
.cashier-error {
  padding: 10px 12px; border-radius: var(--r-sm);
  background: var(--danger-weak); color: var(--danger);
  font-size: var(--fs-sm);
}
.cashier-summary {
  padding: 14px 16px; border-radius: var(--r-md);
  background: var(--bg-subtle); border: 0;
  display: grid; gap: 10px;
}
.cashier-summary-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cashier-pack-title-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: var(--fs-md); }
.cashier-pack-credits { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; font-size: var(--fs-sm); color: var(--fg-2); }
.cashier-pack-credits .credit-star { color: var(--accent); opacity: 1; }
.cashier-pack-amount { font-size: var(--fs-2xl); font-weight: var(--fw-bold); letter-spacing: var(--ls-tight); color: var(--fg); flex: none; }
.cashier-summary-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  padding-top: 8px; border-top: 1px solid var(--line-hairline);
  font-size: var(--fs-xs); color: var(--fg-2);
}
.cashier-upgrade-tag { color: var(--accent-text); font-weight: var(--fw-semibold); }
.cashier-section-label { font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--fg-2); }
.cashier-methods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cashier-method {
  position: relative; display: flex; align-items: center; gap: 10px;
  padding: 12px; border-radius: var(--r-md);
  border: 1.5px solid transparent; background: var(--bg-subtle);
  cursor: pointer; transition: border-color var(--dur), background var(--dur), box-shadow var(--dur);
}
.cashier-method input { position: absolute; opacity: 0; pointer-events: none; }
.cashier-method:hover { background: var(--bg-active); }
.cashier-method:has(:checked) { border-color: var(--accent); background: var(--accent-weak); box-shadow: none; }
.cashier-method-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.cashier-method-info strong { font-size: var(--fs-sm); font-weight: var(--fw-semibold); }
.cashier-method-info small { font-size: var(--fs-xs); color: var(--fg-3); line-height: var(--lh-tight); }
.cashier-method-check {
  width: 18px; height: 18px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--bg-muted); color: transparent;
  transition: background var(--dur), color var(--dur);
}
.cashier-method:has(:checked) .cashier-method-check { background: var(--accent); color: #fff; }
.cashier-terms-note { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--fg-3); }
.cashier-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding-top: 4px; }
.cashier-foot-split { justify-content: space-between; flex-wrap: wrap; border-top: 1px solid var(--line-hairline); padding-top: 12px; }
.cashier-foot-left { display: flex; align-items: center; gap: 4px; }

.cashier-order-meta { display: grid; gap: 8px; padding: 12px 14px; border-radius: var(--r-md); background: var(--bg-subtle); border: 0; }
.cashier-kv { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: var(--fs-sm); }
.cashier-kv > span:first-child { color: var(--fg-2); }
.cashier-kv code { font-family: var(--mono); font-size: var(--fs-xs); }
.cashier-order-amt { font-size: var(--fs-xl); color: var(--fg); }
.cashier-qr-box { padding: 14px; }
.cashier-sandbox-box {
  padding: 14px; border-radius: var(--r-md);
  background: var(--bg-subtle); border: 1px dashed var(--line-strong);
  display: grid; gap: 10px;
}
.cashier-sandbox-box p { font-size: var(--fs-xs); color: var(--fg-2); line-height: var(--lh-normal); }
.cashier-gateway-box { display: grid; }
.cashier-poll-status { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: var(--fs-xs); color: var(--fg-3); }
.cashier-poll-status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: tracePulse 1.2s ease-in-out infinite; }

.cashier-paid-view { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 12px 4px; }
.cashier-paid-ic { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--success-weak); color: var(--success); }
.cashier-paid-view h3 { font-size: var(--fs-xl); font-weight: var(--fw-semibold); }
.cashier-paid-sub { font-size: var(--fs-sm); color: var(--fg-2); max-width: 360px; }
.cashier-paid-tier {
  width: 100%; padding: 10px 14px; border-radius: var(--r-md);
  background: var(--accent-weak); color: var(--accent);
  font-size: var(--fs-xs); font-weight: var(--fw-semibold);
}
.cashier-paid-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 8px; width: 100%; }

.table-wrap { border: 1px solid var(--line-hairline); border-radius: var(--r-lg); background: var(--bg-surface); box-shadow: none; overflow: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); min-width: 640px; }
.table th { text-align: left; font-weight: var(--fw-medium); color: var(--fg-3); padding: 14px 24px; background: var(--bg-subtle); border-bottom: 1px solid var(--line-hairline); white-space: nowrap; }
.table td { padding: 14px 24px; border-bottom: 1px solid var(--line-hairline); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; }
.table .row-group td { background: var(--bg); font-weight: var(--fw-semibold); padding-top: 18px; color: var(--fg); border-bottom-color: var(--line-hairline); }
.table .cell-tool { display: flex; align-items: center; gap: 10px; }
.table .cell-tool .i { color: var(--fg-3); width: 16px; height: 16px; }

.faq { border-top: 1px solid var(--line-hairline); }
.faq details { border-bottom: 1px solid var(--line-hairline); }
.faq summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 4px; font-size: var(--fs-md); font-weight: var(--fw-medium); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary .i { color: var(--fg-3); transition: rotate var(--dur-base) var(--ease-standard); }
.faq details[open] summary .i { rotate: 45deg; }
.faq details p { padding: 0 4px 20px; color: var(--fg-2); max-width: 720px; line-height: var(--lh-relaxed); }
.two-col { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 64px; }
.two-col h2 { font-size: var(--fs-xl); }
.two-col .muted { font-size: var(--fs-sm); margin-top: 6px; }

/* 5.5 Index (prototype hub) ------------------------------------------------ */
.hub { max-width: 1120px; margin: 0 auto; padding: 88px 48px; }
.hub h1 { font-size: var(--fs-2xl); }
.hub-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px 28px; margin-top: 40px; }
.hub-card { display: flex; flex-direction: column; gap: 12px; }
.hub-card .frame { aspect-ratio: 16 / 10; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line); background: var(--bg-subtle); position: relative; }
.hub-card iframe { width: 1440px; height: 900px; border: 0; transform: scale(var(--s, .36)); transform-origin: 0 0; pointer-events: none; }
.hub-card:hover .frame { border-color: var(--line-strong); }
.hub-card h2 { font-size: var(--fs-lg); display: flex; align-items: center; justify-content: space-between; }
.hub-card p { font-size: var(--fs-sm); color: var(--fg-2); }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.swatch { display: flex; align-items: center; gap: 8px; font-size: var(--fs-xs); color: var(--fg-2); padding: 4px 10px 4px 4px; border-radius: var(--r-full); border: 1px solid var(--line); }
.swatch i { width: 20px; height: 20px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }

/* 6. Responsive ------------------------------------------------------------ */
@media (max-width: 1279px) {
  .masonry { column-count: 3; }
  .plans { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .plans.plans-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .plan:nth-child(3) { border-left: 0; }
  .plans.plans-3 .plan:nth-child(3) { border-left: 1px solid var(--line-hairline); }
  .plan:nth-child(n+3) { border-top: 1px solid var(--line-hairline); }
  .plans.plans-3 .plan:nth-child(n+3) { border-top: 0; }
  .packs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .packs.packs-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pricing-rules-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
  .plans.plans-3 { grid-template-columns: 1fr; }
  .plans.plans-3 .plan + .plan { border-left: 0; border-top: 1px solid var(--line); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col { grid-template-columns: 1fr; gap: 20px; }
  .viewer-inner { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .viewer-side { border-left: 0; border-top: 1px solid var(--line); max-height: 46vh; }
  .viewer-body { overflow-y: auto; }
}
@media (max-width: 767px) {
  body:has(> .site-banner:not([hidden])) { --banner-h: 36px; }
  .site-banner { height: 36px; padding: 0 34px 0 12px; }
  .site-banner-inner { gap: 6px; }
  .site-banner-text { font-size: var(--fs-xs); }
  .site-banner-close { right: 4px; }
  .app, .app.is-rail { grid-template-columns: minmax(0, 1fr); --sidebar-w: 272px; }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: min(var(--sidebar-w), 85vw); z-index: 50; visibility: hidden; transform: translateX(-100%); transition: transform var(--dur-moderate) var(--ease-standard), visibility 0s var(--dur-moderate); box-shadow: var(--shadow-pop); }
  .scrim { z-index: 49; }
  .app.is-drawer-open .sidebar { visibility: visible; transform: none; transition-delay: 0s; }
  .app.is-drawer-open .scrim { opacity: 1; visibility: visible; pointer-events: auto; transition-delay: 0s; }
  .sb-collapse { display: none !important; }
  .sb-drawer-close { display: inline-grid; }
  .app-header, .app-header.is-overlay, .app-header.is-floating {
    position: relative; inset: auto; height: auto; padding: 0; gap: 0;
    background: color-mix(in srgb, var(--bg-canvas) 92%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line-subtle); pointer-events: auto;
    flex-wrap: wrap; justify-content: flex-start;
  }
  .app-header.is-overlay .app-header-slot { display: none; }
  .app-header.is-floating .page-head-title,
  .app-header.is-floating .page-head-actions { pointer-events: auto; }
  .app-header-mobile { order: 1; display: flex; height: 48px; padding-left: 8px; margin-right: auto; gap: 6px; }
  .shell-utility { order: 2; height: 48px; padding-right: 8px; gap: 4px; }
  .utility-pill { height: 32px; }
  .utility-user-name, .utility-topup-tag { display: none; }
  .utility-user-btn { padding: 0 2px; }
  .utility-credits, .utility-link { padding: 0 8px; font-size: var(--fs-xs); }
  .app-header-slot:not(:empty),
  .app-header.is-floating .app-header-slot:not(:empty) {
    order: 3; flex: 1 0 100%; border-top: 1px solid var(--line-subtle);
    padding: 5px 12px; min-height: 38px; flex-wrap: nowrap; align-items: center; gap: 6px; justify-content: space-between;
  }
  .app-header-slot:empty { display: none; }
  .app-header .page-head-title { flex: 1 1 0; min-width: 0; overflow: hidden; }
  .app-header .page-head-title h1 { font-size: var(--fs-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .app-header .page-head-actions { flex: none; flex-wrap: nowrap; }
  .app-header .head-pill-btn { padding: 0 7px; gap: 3px; }
  .app-header .head-pill-btn > span:not(.head-pill-val) { display: none; }
  .app-header #chatModel { max-width: min(44vw, 190px); }
  .site-foot { margin-top: 36px; padding: 20px 0 28px; gap: 8px; flex-direction: column; align-items: flex-start; }
  .site-foot nav { gap: 6px 14px; }
  .site-foot .foot-desktop-only { display: none; }
  .main-scroll > .site-foot, .creative-catalog-scroll > .site-foot { padding-inline: 16px; }
  .viewer-bar-inner .img-ov-btn > span { display: none; }
  .viewer-bar-inner .img-ov-btn { width: 30px; padding: 0; gap: 0; }
  .page-head { padding: 0 12px; height: 52px; }
  .page-head-title { gap: 8px; }
  .page-head h1 { font-size: var(--fs-lg); }
  .container, .home-scroll > .container { padding: 0 16px; }
  .home-hero { padding-top: 32px; }
  .home-hero h1 { font-size: var(--fs-2xl); }
  .pricing-hero { padding-top: 32px; }
  .pricing-hero h1 { font-size: var(--fs-2xl); }
  .composer { border-radius: var(--r-lg); }
  .composer-modes { margin-top: 18px; }
  .modes { max-width: 100%; height: 36px; overflow-x: auto; scrollbar-width: none; }
  .modes::-webkit-scrollbar { display: none; }
  .mode { height: 32px; padding: 0 10px; gap: 4px; font-size: var(--fs-xs); flex: none; white-space: nowrap; }
  .mode .i { width: 13px; height: 13px; }
  .composer-input { padding: 14px 16px 4px; }
  .composer .textarea { font-size: var(--fs-md); min-height: 60px; }
  .chat-main .dock .composer .textarea { min-height: 54px; line-height: var(--lh-normal); padding-right: 4px; }
  .composer-bar,
  #chatComposer .composer-bar,
  #studioPage .composer-bar,
  #wsComposer .composer-bar {
    flex-wrap: nowrap;
    gap: 4px;
    padding: 6px 10px 8px;
  }
  .composer-bar #modeChips { flex-wrap: nowrap; gap: 4px; min-width: 0; }
  .composer-bar .grow { flex: 1; min-width: 4px; }
  .composer-bar .grow ~ .mp-slot { margin-right: 0; }
  .composer-bar .composer-add { --s: 34px; margin-right: 0; flex: none; }
  .composer-bar .composer-add::before { display: none; }
  .composer-bar .chip-ghost,
  .composer-bar .mp-trigger {
    width: 34px; min-width: 34px; height: 34px; padding: 0; gap: 0;
    justify-content: center; border-radius: 10px; font-size: 0; flex: none;
  }
  .composer-bar .chip-ghost > span:not(.mp-trigger-brand),
  .composer-bar .chip-ghost .chev,
  .composer-bar .mp-trigger-name,
  .composer-bar .mp-think-badge,
  .composer-bar .mp-offer-tag { display: none !important; }
  .composer-bar .chip-ghost > .i:not(.chev) { width: 17px; height: 17px; }
  .composer-bar .mp-trigger-brand,
  .composer-bar .mp-trigger-icon { width: 18px; height: 18px; }
  .composer-bar .cost,
  #studioPage .composer-bar .cost,
  #composer .composer-bar .cost { display: none !important; }
  .composer-bar .send-btn,
  #studioSendBtn.is-text {
    width: 34px; min-width: 34px; height: 34px; padding: 0; gap: 0;
    font-size: 0; flex: none; justify-content: center; margin-left: auto;
  }
  .composer-bar .send-btn .i,
  #studioSendBtn.is-text .i { width: 17px; height: 17px; }
  .composer-bar .grow ~ .send-btn { margin-left: 0; }
  .composer .param-panel { width: min(340px, calc(100vw - 24px)); }
  .composer .mp-panel { width: min(350px, calc(100vw - 24px)); }
  .slash-menu { left: 8px; right: 8px; }
  .composer-submodes {
    padding: 10px 12px 0; flex-wrap: nowrap; overflow-x: auto;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .composer-submodes::-webkit-scrollbar { display: none; }
  .composer-submodes .pill { flex: none; white-space: nowrap; height: 28px; padding: 0 11px; font-size: var(--fs-sm); }
  .composer-voice-bar { padding: 10px 12px 0; flex-wrap: nowrap; gap: 6px; }
  .composer-voice-select { flex: 1 1 0; min-width: 0; max-width: none; }
  #voiceAuditionBtn { width: 32px; min-width: 32px; height: 32px; padding: 0; gap: 0; justify-content: center; flex: none; }
  #voiceAuditionBtn > span { display: none; }
  .composer-voice-count { font-size: var(--fs-2xs); margin-left: 0; flex: none; }
  .composer-sep { display: none; }
  .home-hero .skill-pills, #hmSkillStrip { display: none !important; }
  .home-section { margin-top: 32px; }
  .home-tools-section { margin-top: 20px; }
  .tool-rail-track { grid-template-columns: repeat(4, 248px); gap: 10px; }
  .tool-card { min-height: 78px; gap: 12px; }
  .tool-card-media { width: 96px; height: 66px; }
  .tool-rail-nav { display: none !important; }
  .tool-rail::before, .tool-rail::after { width: 20px; }
  .home-gallery-head { flex-wrap: nowrap; gap: 8px; }
  .home-gallery-head h2 { font-size: var(--fs-xl); white-space: nowrap; }
  .home-gallery-head .link { font-size: var(--fs-sm); white-space: nowrap; }
  .home-gallery-head .chip { height: 30px; padding: 0 9px; font-size: var(--fs-sm); }
  .gallery-bar { margin-bottom: 12px; overflow: hidden; }
  .gallery-bar .pills { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; width: 100%; }
  .gallery-bar .pills::-webkit-scrollbar { display: none; }
  .gallery-bar .pill { flex: none; white-space: nowrap; height: 30px; padding: 0 12px; font-size: var(--fs-sm); }
  .tiles { gap: 12px; }
  .masonry { column-count: 2; column-gap: 8px; }
  .shot { margin-bottom: 8px; }
  .studio, .chat-main { --dock-gutter: 16px; --dock-inset: 0px; }
  .feed-inner { padding-top: 12px; padding-bottom: 240px; }
  .thumb { height: 168px; }
  .task-actions { opacity: 1; }
  .dock { padding-bottom: 8px; }
  .dock-note { display: none; }
  .thread { padding-top: 20px; }
  .chat-empty { padding: 28px 16px 150px; }
  #chatSkillQuickStrip { display: none !important; }
  .starters { grid-template-columns: 1fr; gap: 8px; margin-top: 18px; }
  .starter { padding: 12px 14px; gap: 10px; align-items: center; }
  .starter > div { min-width: 0; flex: 1; }
  .starter span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #chatScrollBottomBtn { width: 32px; padding: 0; justify-content: center; gap: 0; }
  #chatScrollBottomBtn span { display: none; }
  .pricing-trust { gap: 4px 10px; }
  .pricing-trust-item { padding: 2px 4px; border: 0; background: transparent; font-size: var(--fs-xs); }
  .pricing-status-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; gap: 12px; }
  .pricing-metric-sep { display: none; }
  .pricing-growth-hint,
  .pricing-status-actions a[href="#benefits"],
  .pricing-redeem-copy > span,
  .pricing-matrix-wrap { display: none; }
  .plan { padding: 18px 16px; }
  .pack { padding: 16px; }
  .plans, .packs, .packs.packs-3, .pricing-rules-grid { grid-template-columns: 1fr; }
  .pricing-status-strip { padding: 14px 16px; }
  .pricing-status-actions { width: 100%; justify-content: flex-end; margin-left: 0; }
  .pricing-redeem-form { width: 100%; flex: 1 1 100%; }
  .cashier-methods { grid-template-columns: 1fr; }
  #cashierModal .cashier-head { padding: 14px 16px 12px; }
  #cashierModal .cashier-body { padding: 14px 16px 16px; }
  #cashierOrderLink { display: none; }
  .plan + .plan { border-left: 0; border-top: 1px solid var(--line); }
  .hub-grid { grid-template-columns: 1fr; }
  .param-panel { width: min(340px, calc(100vw - 24px)); }
  .viewer { width: 100vw; height: 100dvh; }
  .viewer-inner { border-radius: 0; }
  .viewer-stage { padding: 16px 40px 68px; }
  .viewer-stage.has-strip { padding-bottom: 122px; }
}
@media (max-width: 480px) {
  .site-banner-tag { display: none; }
  .app-header-mobile .logo-img { height: 20px; }
  .utility-credits, .utility-link { padding: 0 7px; gap: 4px; }
  .utility-login-btn { padding: 0 10px; }
  #chatHeadSkill { display: none; }
  .home-gallery-head .link span { display: none; }
}
@media (max-width: 420px) {
  .mode .i { display: none; }
  .mode { padding: 0 11px; }
}
@media (max-width: 380px) {
  .home-hero:lang(en) .mode { gap: 4px; padding-inline: 5px; }
}

/* 5.6 E-commerce tools ------------------------------------------------------ */
.field + .field { margin-top: 24px; }
.field > .field-label { font-size: var(--fs-sm); color: var(--fg); font-weight: var(--fw-medium); margin-bottom: 10px; }
.field-label .opt { color: var(--fg-3); font-weight: var(--fw-regular); font-size: var(--fs-xs); }
.field-hint { font-size: var(--fs-xs); color: var(--fg-3); margin-top: 6px; }
.field .seg { display: flex; }
.textarea-box { height: auto; min-height: 84px; padding: 9px 12px; line-height: var(--lh-normal); }
.input-wrap { position: relative; }

/* upload */
.drop {
  display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%;
  padding: 28px 20px; border-radius: var(--r-md); border: 1.5px dashed var(--line-strong); background: var(--bg-subtle);
  color: var(--fg-2); text-align: center; transition: border-color var(--dur), background var(--dur);
}
.drop:hover, .drop.is-over { border-color: var(--accent); background: var(--accent-weak); }
.drop .i { width: 24px; height: 24px; color: var(--fg-3); margin-bottom: 4px; }
.drop-title { font-size: var(--fs-md); font-weight: var(--fw-medium); color: var(--fg); }
.drop-hint { font-size: var(--fs-xs); color: var(--fg-3); }
.samples { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: var(--fs-xs); color: var(--fg-3); }
.samples button { width: 36px; height: 36px; border-radius: 8px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--line-hairline); transition: box-shadow var(--dur); }
.samples button:hover { box-shadow: 0 0 0 2px var(--accent); }
.samples img { width: 100%; height: 100%; object-fit: cover; }

/* option controls */
.multi { display: flex; flex-wrap: wrap; gap: 6px; }
.multi .chip[aria-pressed="true"] { border-color: transparent; color: var(--accent-text); background: var(--accent-weak); box-shadow: none; }
.multi .chip .chk { width: 14px; height: 14px; margin-left: -2px; display: none; }
.multi .chip[aria-pressed="true"] .chk { display: inline-block; }
.multi .chip small { color: var(--fg-3); font-size: var(--fs-2xs); }
.opt-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.opt-card { border-radius: var(--r-sm); overflow: hidden; text-align: left; border: 1px solid var(--line-hairline); box-shadow: none; background: var(--bg-surface); transition: border-color var(--dur), transform var(--dur); }
.opt-card:hover { border-color: var(--line-strong); box-shadow: none; }
.opt-card[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.opt-card .oc-media { aspect-ratio: 1; background: var(--bg-muted); display: grid; place-items: center; color: var(--fg-3); }
.opt-card .oc-media img { width: 100%; height: 100%; object-fit: cover; }
.opt-card .oc-label { display: block; padding: 6px 8px; font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.range { width: 100%; accent-color: var(--accent); margin: 0; }
.range-labels { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--fg-3); margin-top: 4px; }
.range-labels .is-on { color: var(--accent-text); font-weight: var(--fw-medium); }


/* results */
.results-inner { max-width: 1160px; margin: 0 auto; padding: 32px 40px 72px; display: flex; flex-direction: column; gap: 20px; }
.batch { background: var(--bg-surface); border: 1px solid var(--line-hairline); border-radius: var(--r-lg); box-shadow: none; padding: 24px 28px 28px; }
.batch.is-new { animation: task-in .35s var(--ease); }
.batch.is-highlighted {
  box-shadow: 0 0 0 2px var(--accent), var(--shadow-pop);
  transition: box-shadow var(--dur-slow) var(--ease-standard);
}
.batch-body { margin-top: 20px; }
.out-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(184px, 1fr)); gap: 20px 14px; }
.out .thumb { width: 100%; height: auto; aspect-ratio: var(--ar, 1); }
.out .thumb img { transform: scale(var(--z, 1)); object-position: var(--pos, 50% 50%); filter: var(--f, none); }
.out-label { display: flex; justify-content: space-between; margin-top: 8px; font-size: var(--fs-xs); color: var(--fg-2); }
.out-label span:last-child { color: var(--fg-3); font-variant-numeric: tabular-nums; }
.thumb-text { position: absolute; left: 0; right: 0; bottom: 0; padding: 28px 12px 12px; color: #fff; background: linear-gradient(to top, rgba(0,0,0,.55), transparent); pointer-events: none; }
.thumb-text b { display: block; font-size: var(--fs-md); line-height: var(--lh-tight); }
.thumb-text span { font-size: var(--fs-2xs); opacity: .9; }
.batch-progress { display: flex; align-items: center; gap: 10px; font-size: var(--fs-xs); color: var(--fg-2); margin-bottom: 14px; }
.batch-progress .progress { width: 160px; }

/* compare */
.compare-out { display: grid; grid-template-columns: minmax(0, 480px) minmax(220px, 1fr); gap: 28px; align-items: start; }
.compare { --pos: 50%; position: relative; aspect-ratio: 4 / 5; border-radius: var(--r-md); overflow: hidden; user-select: none; background: var(--bg-muted); }
.compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.compare .before { clip-path: inset(0 calc(100% - var(--pos)) 0 0); filter: brightness(.8) contrast(.86) saturate(.7) sepia(.08); }
.compare .handle { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.08); pointer-events: none; }
.compare .handle::after { content: ""; position: absolute; top: 50%; left: 50%; width: 32px; height: 32px; translate: -50% -50%; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.compare .knob { position: absolute; top: 50%; left: var(--pos); translate: -50% -50%; z-index: 1; color: #333; display: flex; pointer-events: none; }
.compare .knob .i { width: 14px; height: 14px; }
.compare input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; z-index: 2; }
.compare input:focus-visible ~ .handle::after { outline: 2px solid var(--accent); outline-offset: 2px; }
.compare-tag { position: absolute; top: 10px; padding: 2px 8px; border-radius: 6px; font-size: var(--fs-2xs); background: rgba(20,20,22,.6); color: #fff; pointer-events: none; }
.compare-tag.l { left: 10px; }
.compare-tag.r { right: 10px; }
.side-list { display: flex; flex-direction: column; gap: 10px; font-size: var(--fs-sm); }
.side-list li { display: flex; gap: 8px; align-items: center; color: var(--fg-2); }
.side-list .i { width: 16px; height: 16px; color: var(--success); }
.side-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }

/* detail long image (内容区模拟成品长图，配色独立于界面主题) */
.detail-out { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 28px; align-items: start; }
.longimg { --li-bg: #ffffff; --li-fg: #1a1a1a; --li-sub: #6b6b70; --li-card: #f4f4f2;
  width: 100%; max-height: 640px; overflow-y: auto; border-radius: var(--r-md); box-shadow: 0 0 0 1px var(--line); background: var(--li-bg); color: var(--li-fg); scrollbar-width: thin; }
.longimg.s-premium { --li-bg: #17171a; --li-fg: #f2f2f2; --li-sub: #9a9aa2; --li-card: #232327; }
.longimg.s-warm { --li-bg: #f7f1ea; --li-fg: #3a2e25; --li-sub: #8a7766; --li-card: #efe5d9; }
.li-hero { position: relative; aspect-ratio: 3 / 4; }
.li-hero img { width: 100%; height: 100%; object-fit: cover; }
.li-hero-text { position: absolute; left: 0; right: 0; bottom: 0; padding: 60px 22px 24px; color: #fff; background: linear-gradient(to top, rgba(0,0,0,.55), transparent); }
.li-hero-text b { display: block; font-size: var(--fs-2xl); line-height: var(--lh-tight); letter-spacing: var(--ls-tight); }
.li-hero-text span { font-size: var(--fs-sm); opacity: .9; }
.li-sec { padding: 28px 22px; }
.li-sec + .li-sec { padding-top: 4px; }
.li-sec h4 { font-size: var(--fs-xl); margin-bottom: 14px; font-weight: var(--fw-semibold); }
.li-feature { display: grid; grid-template-columns: 112px 1fr; gap: 14px; align-items: center; padding: 10px; border-radius: 12px; background: var(--li-card); }
.li-feature + .li-feature { margin-top: 8px; }
.li-feature img { width: 112px; height: 112px; border-radius: 8px; object-fit: cover; }
.li-feature b { font-size: var(--fs-md); display: block; line-height: var(--lh-snug); }
.li-feature span { font-size: var(--fs-xs); color: var(--li-sub); }
.li-scene img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; }
.li-sec > p { font-size: var(--fs-sm); color: var(--li-sub); margin-top: 10px; }
.li-crops { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.li-crops img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; }
.li-params { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.li-params td { padding: 9px 0; border-bottom: 1px solid color-mix(in srgb, var(--li-fg) 12%, transparent); }
.li-params td:first-child { color: var(--li-sub); width: 84px; }
.li-service { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; font-size: var(--fs-xs); }
.li-service div { padding: 14px 6px; border-radius: 10px; background: var(--li-card); }
.li-service .i { width: 20px; height: 20px; display: block; margin: 0 auto 6px; }
.module-list { border: 0; background: var(--bg-subtle); border-radius: var(--r-md); margin-top: 10px; }
.module { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 16px; font-size: var(--fs-sm); }
.module + .module { border-top: 1px solid var(--line-hairline); }
.module .m-name { flex: 1; }
.module .m-name small { color: var(--fg-3); margin-left: 6px; }
.module:hover { background: var(--bg-subtle); }

/* note */
.note-out { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.covers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.cover { position: relative; aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden; background: var(--bg-muted); }
.cover img { width: 100%; height: 100%; object-fit: cover; transform: scale(var(--z, 1)); object-position: var(--pos, 50% 50%); }
.cover-title { position: absolute; left: 8px; right: 8px; top: 10px; font-size: var(--fs-md); font-weight: var(--fw-bold); line-height: var(--lh-tight); color: #fff; text-shadow: 0 1px 8px rgba(0,0,0,.45); }
.cover-title mark { background: #ffe14d; color: #1a1a1a; padding: 0 4px; border-radius: 3px; text-shadow: none; }
.note-copy { border: 1px solid var(--line); border-radius: var(--r-md); padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.note-copy h4 { font-size: var(--fs-lg); line-height: var(--lh-snug); }
.note-copy .note-body { font-size: var(--fs-sm); line-height: var(--lh-relaxed); white-space: pre-wrap; }
.note-tags { display: flex; flex-wrap: wrap; gap: 6px 10px; }
.note-tags span { font-size: var(--fs-xs); color: var(--accent); }
.nc-head { display: flex; align-items: center; justify-content: space-between; font-size: var(--fs-xs); color: var(--fg-3); margin-bottom: -4px; }

/* hub & nav link helpers */
.sb-group-title.is-link { justify-content: space-between; border-radius: 8px; height: 32px; padding: 0 10px; }
.sb-group-title.is-link:hover { color: var(--fg); background: var(--bg-hover); }
.sb-group-title.is-link .i { width: 14px; height: 14px; opacity: 0; transition: opacity var(--dur); }
.sb-group-title.is-link:hover .i { opacity: 1; }
.sb-group-title.is-link[aria-current="page"] { color: var(--fg); font-weight: var(--fw-semibold); background: var(--bg-active); }
.sb-group-title.is-link .sb-group-icon, .is-rail .sb-group-title.is-link .i { display: none; }
.is-rail .sb-group-title.is-link .sb-group-icon { display: block; width: 18px; height: 18px; opacity: 1; }
.is-rail .sb-nav { scrollbar-width: none; }
.is-rail .sb-nav::-webkit-scrollbar { display: none; }

.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--fg); animation: spin .7s linear infinite; flex: none; }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 7px; background: var(--bg-muted); font-size: var(--fs-xs); color: var(--fg-2); max-width: 100%; }
.select { width: 100%; height: 38px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--bg); color: var(--fg); font-size: var(--fs-sm); }
.batch-head { display: flex; align-items: flex-start; gap: 14px; }
.batch-title { flex: 1; min-width: 0; padding-top: 2px; }
.batch-title-row { display: flex; align-items: center; gap: 10px; }
.batch-title-row h3 { font-size: var(--fs-lg); font-weight: var(--fw-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.batch-meta { display: flex; flex-wrap: wrap; gap: 2px 0; margin-top: 6px; font-size: var(--fs-xs); color: var(--fg-3); }
.batch-meta span + span::before { content: ""; display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: var(--line-strong); vertical-align: middle; margin: 0 9px; }

/* 5.8 Jimeng-style Skills & Agent Cards ------------------------------------ */
.skill-chip-slot { padding: 12px 20px 0; }
.skill-chip { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.skill-chip-badge {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px;
  border-radius: 999px; background: var(--accent-weak); color: var(--accent);
  font-size: var(--fs-sm); font-weight: var(--fw-semibold);
}
.skill-chip-badge .i { width: 14px; height: 14px; }
.skill-chip-hint {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px;
  border-radius: 7px; font-size: var(--fs-xs); color: var(--fg-3); background: transparent;
  transition: background var(--dur), color var(--dur);
}
.skill-chip-hint:hover { background: var(--bg-hover); color: var(--fg-2); }
.skill-chip-hint kbd {
  padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line-strong);
  font-family: var(--mono); font-size: var(--fs-2xs); color: var(--fg-3);
}
.skill-chip-rm {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  color: var(--fg-3); transition: background var(--dur), color var(--dur);
}
.skill-chip-rm:hover { background: var(--bg-hover); color: var(--fg); }
.skill-chip-rm .i { width: 13px; height: 13px; }

.skill-pop-wrap { position: relative; }
.skill-pop { width: 340px; max-width: calc(100vw - 32px); padding: 10px; }
.skill-pop:not([hidden]) { display: flex; flex-direction: column; overflow: hidden; }
.skill-pop-head { flex: none; display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.skill-pop-search {
  flex: 1; display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px;
  border-radius: var(--r-sm); background: var(--bg-subtle); border: 1px solid transparent;
}
.skill-pop-search:focus-within { background: var(--bg-elevated); border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-weak); }
.skill-pop-search .i { width: 14px; height: 14px; color: var(--fg-3); flex: none; }
.skill-pop-search input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: var(--fs-sm); color: var(--fg); outline: none; }
.skill-pop-more { display: inline-flex; align-items: center; gap: 2px; font-size: var(--fs-xs); color: var(--fg-2); white-space: nowrap; padding: 4px 6px; border-radius: 6px; }
.skill-pop-more:hover { background: var(--bg-hover); color: var(--fg); }
.skill-pop-more .i { width: 13px; height: 13px; }
.skill-pop-list { flex: 1 1 auto; min-height: 0; max-height: 290px; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; gap: 2px; }
.skill-pop-item {
  width: 100%; display: flex; align-items: flex-start; gap: 10px; padding: 9px 10px;
  border-radius: var(--r-sm); text-align: left; transition: background var(--dur);
}
.skill-pop-item:hover { background: var(--bg-hover); }
.skill-pop-item.is-selected { background: var(--accent-weak); }
.skill-pop-ic {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: var(--bg-muted); color: var(--fg-2); flex: none; margin-top: 1px;
}
.skill-pop-item.is-selected .skill-pop-ic { background: var(--accent); color: #fff; }
.skill-pop-ic .i { width: 15px; height: 15px; }
.skill-pop-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.skill-pop-title { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); }
.skill-pop-title b { font-weight: var(--fw-semibold); color: var(--fg); }
.skill-badge {
  font-size: var(--fs-2xs); line-height: 16px; padding: 0 5px; border-radius: 4px; font-weight: var(--fw-medium);
}
.skill-badge.is-official { background: var(--bg-muted); color: var(--fg-3); }
.skill-badge.is-mine { background: var(--accent-weak); color: var(--accent); }
.skill-pop-desc {
  font-size: var(--fs-xs); color: var(--fg-3);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.skill-pop-check { width: 15px; height: 15px; color: var(--accent); flex: none; margin-top: 4px; }
.skill-pop-empty { padding: 20px; text-align: center; font-size: var(--fs-xs); color: var(--fg-3); }
.skill-pop-foot {
  flex: none;
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 2px;
}
.skill-pop-action {
  width: 100%; display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px;
  border-radius: var(--r-sm); font-size: var(--fs-sm); color: var(--fg-2); text-align: left;
}
.skill-pop-action:hover { background: var(--bg-hover); color: var(--fg); }
.skill-pop-action .i { width: 15px; height: 15px; }
.skill-pop-action .chev { margin-left: auto; color: var(--fg-3); }

.skill-pills { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.skill-pill {
  display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 13px;
  border-radius: 999px; border: 1px solid var(--line-hairline); background: var(--bg-surface); box-shadow: none;
  font-size: var(--fs-sm); font-weight: var(--fw-regular); color: var(--fg-2); transition: background var(--dur), color var(--dur), border-color var(--dur);
}
.skill-pill:hover { background: var(--bg-surface); border-color: var(--line-strong); color: var(--fg); box-shadow: none; transform: none; }
.skill-pill.is-active { border-color: var(--accent-line); background: var(--accent-weak); color: var(--accent-text); font-weight: var(--fw-medium); box-shadow: none; }
.skill-pill .slash { color: var(--fg-3); font-family: var(--mono); font-size: var(--fs-xs); }
.skill-pill.is-active .slash { color: var(--accent-text); }
.skill-pill.is-more .i { width: 13px; height: 13px; }

.slash-host { position: static; }
.slash-menu {
  position: absolute; left: 16px; right: 16px; bottom: calc(100% + 8px); z-index: 60;
  background: var(--bg-elevated); border: 1px solid var(--line-hairline);
  border-radius: var(--r-md); box-shadow: var(--shadow-pop); padding: 6px; max-height: 280px;
  overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
.slash-menu[data-side="bottom"] {
  bottom: auto;
  top: calc(100% + 8px);
}
.slash-menu-head { padding: 6px 10px; font-size: var(--fs-xs); color: var(--fg-3); }
.slash-item {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: var(--r-sm); text-align: left;
}
.slash-item .i { width: 16px; height: 16px; color: var(--fg-3); flex: none; }
.slash-item b { display: block; font-size: var(--fs-sm); color: var(--fg); }
.slash-item span { display: block; font-size: var(--fs-xs); color: var(--fg-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slash-item > div { min-width: 0; flex: 1; }
.slash-item:hover, .slash-item.is-active { background: var(--bg-hover); }
.slash-item.is-active .i { color: var(--accent); }

/* Skill Library & Editor Modals */
.skill-modal { max-width: 740px; width: 94vw; border-radius: 20px; padding: 22px; border: 0; background: var(--bg-elevated); box-shadow: var(--shadow-pop); }
.skill-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; position: relative; }
.skill-modal-head > div:first-child,
.skill-modal-head-copy { flex: 1; min-width: 0; }
.skill-modal-head-acts {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  white-space: nowrap;
}
.skill-modal-head-acts .btn,
.skill-modal-head-acts .skill-lib-center-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex: none;
}
.skill-modal-head h3 { margin: 0; font-size: var(--fs-xl); font-weight: var(--fw-semibold); }
.skill-modal-head p { margin: 4px 0 0; font-size: var(--fs-xs); color: var(--fg-3); line-height: 1.45; }
.skill-modal-search { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid transparent; background: var(--bg-subtle); margin-bottom: 14px; }
.skill-modal-search:focus-within { background: var(--bg-elevated); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.skill-modal-search .i { width: 15px; height: 15px; color: var(--fg-3); }
.skill-modal-search input { flex: 1; border: 0; background: transparent; outline: none; font-size: var(--fs-sm); color: var(--fg); }
.skill-lib-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-height: 55vh; }
.skill-lib-card {
  display: flex; flex-direction: column; justify-content: space-between; gap: 12px;
  padding: 14px; border-radius: var(--r-md); border: 0; background: var(--bg-subtle);
}
.skill-lib-card.is-active { background: var(--accent-weak); box-shadow: inset 0 0 0 1.5px var(--accent); }
.skill-lib-top { display: flex; gap: 10px; align-items: flex-start; }
.skill-lib-ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--bg-muted); color: var(--fg-2); flex: none; }
.skill-lib-meta { min-width: 0; flex: 1; }
.skill-lib-name { display: flex; align-items: center; gap: 6px; font-size: var(--fs-md); }
.skill-lib-meta p {
  margin: 4px 0 0;
  font-size: var(--fs-xs);
  color: var(--fg-3);
  line-height: var(--lh-snug);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(var(--fs-xs) * 1.45 * 2);
}
.skill-lib-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.skill-lib-empty { grid-column: 1 / -1; text-align: center; padding: 32px; color: var(--fg-3); font-size: var(--fs-sm); }
.skill-editor-form { display: flex; flex-direction: column; gap: 14px; max-height: 68vh; }
.skill-form-row { display: flex; gap: 12px; }
.skill-tool-checks { display: flex; flex-wrap: wrap; gap: 8px 14px; padding: 10px 12px; border-radius: var(--r-sm); border: 0; background: var(--bg-subtle); }
.skill-check { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--fg-2); cursor: pointer; }

/* Thread attachments & Interactive Agent Cards */
.agent-tool-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  background: var(--bg-subtle); border: 0; font-size: var(--fs-xs); color: var(--fg-2);
  align-self: flex-start;
}
.agent-tool-pill .i { width: 14px; height: 14px; }
.agent-tool-pill.is-running { color: var(--accent-text); background: var(--accent-weak); }
.agent-tool-pill.is-running .i { animation: spin 1.2s linear infinite; }

.agent-card {
  border: 1px solid var(--line-hairline); border-radius: 16px; background: var(--bg-surface);
  padding: 14px; display: flex; flex-direction: column; gap: 12px; box-shadow: none;
}
.agent-media-flat {
  display: flex; flex-direction: column; gap: 0;
  border: 0; background: transparent; padding: 0; box-shadow: none;
}
.ag-inline-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 8px;
}
.ag-inline-bar[hidden] { display: none; }
.ag-bar-btn {
  display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 8px;
  border-radius: 6px; font-size: var(--fs-xs); font-weight: var(--fw-regular); color: var(--fg-3); background: transparent;
  transition: background var(--dur), color var(--dur);
}
.ag-bar-btn:hover { background: var(--bg-hover); color: var(--fg); }
.ag-bar-btn .i { width: 13px; height: 13px; }
.agent-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.agent-card-head-main { min-width: 0; flex: 1; }
.agent-card-head-acts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.agent-card-title { display: flex; align-items: center; gap: 8px; font-size: var(--fs-md); font-weight: var(--fw-semibold); color: var(--fg); flex-wrap: wrap; }
.agent-card-ic {
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex: none;
  background: var(--accent-weak); color: var(--accent);
}
.agent-card-ic.is-video { background: var(--brand-teal-weak); color: var(--brand-teal); }
.agent-card-ic .i { width: 14px; height: 14px; }
.agent-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 4px; font-size: var(--fs-xs); color: var(--fg-3); }
.agent-card-meta .is-running { display: inline-flex; align-items: center; gap: 5px; color: var(--accent); font-weight: var(--fw-medium); }
.pulse-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: tracePulse 1.2s infinite; }

.seg.seg-sm { padding: 3px; border-radius: 10px; }
.seg.seg-sm > button { height: 26px; padding: 0 10px; font-size: var(--fs-xs); border-radius: 7px; }

/* Lightweight Interactive Options & Legacy Plan Summary */
.turn-ai-options { margin-top: 10px; }
.turn-ai-options[hidden] { display: none; }
.ag-options { display: flex; flex-direction: column; gap: 8px; }
.ag-options.is-disabled { opacity: .55; pointer-events: none; }
.ag-opt-hint { font-size: var(--fs-xs); color: var(--fg-3); line-height: var(--lh-snug); }
.ag-opt-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ag-opt-pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 32px; padding: 5px 14px; border-radius: 999px;
  font-size: var(--fs-sm); font-weight: var(--fw-medium); line-height: var(--lh-tight);
  border: 1px solid var(--line-hairline); background: var(--bg-surface); color: var(--fg); box-shadow: none;
  cursor: pointer; transition: background var(--dur), color var(--dur), border-color var(--dur), transform .12s;
}
.ag-opt-pill:hover:not(:disabled) { border-color: var(--accent-line); color: var(--accent-text); background: var(--accent-weak); box-shadow: none; }
.ag-opt-pill.is-primary {
  border-color: transparent; background: var(--accent-grad); color: #ffffff; box-shadow: none;
}
.ag-opt-pill.is-primary:hover:not(:disabled) { background: var(--accent-grad-hover); color: #ffffff; }
.ag-opt-pill:disabled { opacity: .5; cursor: not-allowed; }

.ag-opt-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.ag-opt-group-lbl { font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--fg-3); min-width: 56px; }
.ag-opt-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ag-opt-chip {
  height: 28px; padding: 0 11px; border-radius: 8px; font-size: var(--fs-sm); font-weight: var(--fw-regular);
  border: 0; background: var(--bg-subtle); color: var(--fg-2);
  cursor: pointer; transition: background var(--dur), color var(--dur);
}
.ag-opt-chip:hover:not(:disabled) { background: var(--bg-active); color: var(--fg); }
.ag-opt-chip[aria-pressed="true"] {
  background: var(--accent-weak); color: var(--accent-text); font-weight: var(--fw-semibold);
}

.ag-opt-resolved {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-xs); color: var(--fg-3); padding: 2px 0;
}
.ag-opt-resolved .i { color: var(--accent); }

.agent-legacy-plan {
  padding: 10px 14px; border-radius: 10px; border: 0; background: var(--bg-subtle);
  font-size: var(--fs-sm); color: var(--fg-2);
}
.agent-legacy-plan-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.agent-legacy-plan-head strong { color: var(--fg); font-size: var(--fs-sm); }
.agent-legacy-plan-head span { font-size: var(--fs-xs); color: var(--fg-3); }
.agent-legacy-plan-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }

/* Fixed 1:1 Frameless Image Gallery */
.ag-gallery { display: grid; gap: 8px; }
.ag-gallery[data-count="1"] { grid-template-columns: minmax(0, 320px); }
.ag-gallery[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 260px)); }
.ag-gallery[data-count="3"] { grid-template-columns: repeat(3, minmax(0, 260px)); }
.ag-gallery[data-count="4"],
.ag-gallery[data-count="many"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ag-gallery.is-long-preview { grid-template-columns: minmax(0, 480px); gap: 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.ag-gallery.is-long-preview .ag-frame { aspect-ratio: auto; border-radius: 0; border: 0; }
.ag-gallery.is-long-preview .ag-frame.img-action-card .thumb-media { position: relative; inset: auto; height: auto; }
.ag-gallery.is-long-preview .ag-img-btn { height: auto; }
.ag-gallery.is-long-preview .ag-img-btn img { height: auto; object-fit: cover; }

.ag-slot { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.ag-frame {
  position: relative; width: 100%; aspect-ratio: 1 / 1; border-radius: 12px; background: var(--bg-muted);
  border: 0; box-shadow: inset 0 0 0 1px var(--line-hairline); overflow: hidden;
}
.ag-frame.img-action-card { overflow: hidden; }
.ag-frame.img-action-card .thumb-media { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: inherit; overflow: hidden; }
.ag-img-btn { width: 100%; height: 100%; display: block; padding: 0; cursor: zoom-in; }
.ag-img-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ag-frame.is-bg-transparent { background-color: var(--bg); background-image: repeating-conic-gradient(var(--bg-muted) 0% 25%, transparent 0% 50%); background-size: 16px 16px; }
.ag-frame.is-bg-white { background: #fff; }
.ag-frame.is-bg-black { background: #141418; }
.ag-frame.is-bg-blue { background: #2d78c9; }
.ag-frame.is-bg-red { background: #ce4545; }
.ag-frame.is-bg-transparent img,
.ag-frame.is-bg-white img,
.ag-frame.is-bg-black img,
.ag-frame.is-bg-blue img,
.ag-frame.is-bg-red img { object-fit: contain; }

.ag-slot-badge {
  position: absolute; left: 8px; top: 8px; z-index: 2; pointer-events: none;
  height: 24px; padding: 0 9px; border-radius: 999px;
  display: inline-flex; align-items: center;
  background: rgba(15, 16, 20, .72); color: #fff; font-size: var(--fs-2xs); font-weight: var(--fw-medium);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  opacity: 0; transition: opacity var(--dur-fast);
}
.ag-frame:hover .ag-slot-badge,
.ag-frame:focus-within .ag-slot-badge { opacity: 1; }

.ag-skeleton { display: grid; place-items: center; padding: 16px; }
.ag-cancel-btn {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 9px; border-radius: 999px;
  background: rgba(255, 255, 255, .90); color: var(--fg); border: 1px solid var(--line);
  font-size: var(--fs-xs); font-weight: var(--fw-medium); backdrop-filter: blur(8px);
}
.ag-cancel-btn:hover { background: #fff; color: var(--danger); }
[data-theme="dark"] .ag-cancel-btn,
.ag-cancel-btn.is-dark { background: rgba(24, 26, 32, .82); color: #fff; border-color: rgba(255, 255, 255, .16); }
[data-theme="dark"] .ag-cancel-btn:hover,
.ag-cancel-btn.is-dark:hover { background: rgba(40, 42, 50, .95); color: #ff8080; }
.ag-skeleton-inner { position: relative; z-index: 1; width: min(80%, 190px); display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.ag-skeleton-state { font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--fg-2); }
.ag-skeleton-inner .progress { width: 100%; height: 4px; }
.ag-skeleton-sub { font-size: var(--fs-xs); color: var(--fg-3); font-variant-numeric: tabular-nums; }

.ag-error { display: grid; place-items: center; padding: 18px; background: var(--bg-subtle); border: 1px dashed var(--line-strong); }
.ag-error-inner { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; max-width: 240px; }
.ag-error-inner .i { width: 22px; height: 22px; color: var(--danger); }
.ag-error-inner strong { font-size: var(--fs-sm); color: var(--fg); }
.ag-error-inner p { font-size: var(--fs-xs); color: var(--fg-2); line-height: var(--lh-snug); }

.ag-caption { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 2px; min-height: 26px; }
.ag-caption-title { display: inline-flex; align-items: center; gap: 6px; min-width: 0; font-size: var(--fs-sm); color: var(--fg-2); font-weight: var(--fw-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-no {
  width: 18px; height: 18px; border-radius: 50%; flex: none; display: inline-grid; place-items: center;
  background: var(--bg-muted); color: var(--fg-2); font-size: var(--fs-2xs); font-weight: var(--fw-semibold);
}
.ag-caption-acts { display: inline-flex; align-items: center; gap: 2px; flex: none; }
.ag-credit { display: inline-flex; align-items: center; gap: 2px; font-size: var(--fs-xs); color: var(--fg-3); margin-right: 4px; font-variant-numeric: tabular-nums; }
.ag-credit .credit-star { width: 12px; height: 12px; }
.ag-touch-act { display: none; }
@media (hover: none) {
  .ag-touch-act { display: inline-grid; }
}

/* Interactive Before/After Compare Slider */
.ac-compare-slider {
  position: relative; width: 100%; max-width: 360px; aspect-ratio: 1 / 1; min-height: 220px; max-height: 420px;
  border-radius: 12px; overflow: hidden; border: 1px solid var(--line-hairline); box-shadow: none; background: var(--bg-muted);
  user-select: none; touch-action: pan-y;
}
.ac-compare-slider.is-bg-transparent { background-color: var(--bg); background-image: repeating-conic-gradient(var(--bg-muted) 0% 25%, transparent 0% 50%); background-size: 16px 16px; }
.ac-compare-slider.is-bg-white { background: #fff; }
.ac-compare-slider.is-bg-black { background: #141418; }
.ac-compare-slider.is-bg-blue { background: #2d78c9; }
.ac-compare-slider.is-bg-red { background: #ce4545; }
.ac-compare-layer { position: absolute; inset: 0; }
.ac-compare-layer .thumb-media,
.ac-compare-img-btn { width: 100%; height: 100%; display: block; padding: 0; }
.ac-compare-layer img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
.ac-compare-layer.is-before { clip-path: inset(0 calc(100% - var(--split, 50%)) 0 0); pointer-events: none; background: var(--bg-muted); }
.ac-compare-label {
  position: absolute; top: 10px; z-index: 4; pointer-events: none;
  padding: 2px 8px; border-radius: 999px; background: rgba(15, 16, 20, .72); color: #fff; font-size: var(--fs-xs); font-weight: var(--fw-medium);
}
.ac-compare-label.is-before { left: 10px; }
.ac-compare-label.is-after { right: 10px; }
.ac-compare-divider {
  position: absolute; top: 0; bottom: 0; left: var(--split, 50%); width: 2px; translate: -1px 0;
  background: rgba(255, 255, 255, .92); box-shadow: 0 0 8px rgba(0, 0, 0, .35); pointer-events: none; z-index: 4;
}
.ac-compare-knob {
  position: absolute; top: 50%; left: 50%; translate: -50% -50%;
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: #fff; color: #111215; box-shadow: 0 2px 10px rgba(0, 0, 0, .28);
}
.ac-compare-range {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; z-index: 5;
}
.ac-compare-slider .img-ov-top,
.ac-compare-slider .img-ov-dock { z-index: 6; }

.aa-bg-swatches { display: flex; align-items: center; gap: 8px; padding-top: 2px; }
.aa-bg-dot {
  width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-strong); cursor: pointer;
  transition: transform var(--dur-instant) var(--ease-out), box-shadow var(--dur-instant);
}
.aa-bg-dot[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-weak); transform: scale(1.1); }
.aa-bg-dot[data-bg="transparent"] { background-color: #fff; background-image: repeating-conic-gradient(#d5d5d8 0% 25%, transparent 0% 50%); background-size: 8px 8px; }
.aa-bg-dot[data-bg="white"] { background: #fff; }
.aa-bg-dot[data-bg="black"] { background: #141418; }
.aa-bg-dot[data-bg="blue"] { background: #2d78c9; }
.aa-bg-dot[data-bg="red"] { background: #ce4545; }

/* Side-by-side compare */
.agent-compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-width: 560px; }
.agent-compare figure { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.agent-compare figcaption { font-size: var(--fs-xs); color: var(--fg-3); text-align: center; }
.agent-compare-img { aspect-ratio: 1 / 1; border-radius: 12px; overflow: hidden; border: 0; box-shadow: inset 0 0 0 1px var(--line-hairline); background: var(--bg-muted); }
.agent-compare-img.is-bg-transparent { background-color: var(--bg); background-image: repeating-conic-gradient(var(--bg-muted) 0% 25%, transparent 0% 50%); background-size: 16px 16px; }
.agent-compare-img.is-bg-white { background: #fff; }
.agent-compare-img.is-bg-black { background: #141418; }
.agent-compare-img.is-bg-blue { background: #2d78c9; }
.agent-compare-img.is-bg-red { background: #ce4545; }
.agent-compare-img img, .agent-img-btn { width: 100%; height: 100%; display: block; padding: 0; }
.agent-compare-img img { object-fit: contain; }

/* Frameless Cinema Video Grid */
.av-grid { display: grid; gap: 10px; }
.av-grid[data-count="1"].is-landscape { grid-template-columns: minmax(0, 520px); }
.av-grid[data-count="1"].is-square { grid-template-columns: minmax(0, 320px); }
.av-grid[data-count="1"].is-portrait { grid-template-columns: minmax(0, 260px); }
.av-grid[data-count="2"],
.av-grid[data-count="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.av-grid[data-count="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.av-slot { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.av-stage {
  position: relative; width: 100%; border-radius: 12px; overflow: hidden;
  background: #101116; border: 1px solid rgba(255, 255, 255, .08);
}
.av-stage.is-portrait { max-height: 500px; }
.av-stage video { width: 100%; height: 100%; display: block; object-fit: contain; background: #000; }
.av-badges {
  position: absolute; left: 10px; top: 10px; z-index: 2; display: flex; flex-wrap: wrap; gap: 4px; pointer-events: none;
}
.av-badges span {
  padding: 2px 7px; border-radius: 6px; background: rgba(15, 16, 20, .72); color: #fff; font-size: var(--fs-xs); font-weight: var(--fw-medium);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.av-expand-btn {
  position: absolute; right: 10px; top: 10px; z-index: 2;
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(15, 16, 20, .72); color: #fff; border: 1px solid rgba(255, 255, 255, .18);
  backdrop-filter: blur(8px); transition: background var(--dur-fast), transform var(--dur-fast) var(--ease-out);
}
.av-expand-btn:hover { background: rgba(0, 0, 0, .9); transform: scale(1.06); }

.av-skeleton { display: grid; place-items: center; padding: 20px; background: linear-gradient(145deg, #13151d 0%, #1b1f2c 100%); }
.av-skeleton-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .22; filter: blur(10px) scale(1.06); pointer-events: none; }
.av-skeleton-inner { position: relative; z-index: 1; width: min(86%, 280px); display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; color: #fff; }
.av-skeleton-ring {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(0, 142, 229, .22); color: #5cc4ff; border: 1px solid rgba(92, 196, 255, .36);
}
.av-skeleton-inner strong { font-size: var(--fs-sm); font-weight: var(--fw-semibold); }
.av-skeleton-bar { width: 100%; height: 5px; border-radius: 99px; background: rgba(255, 255, 255, .14); overflow: hidden; }
.av-skeleton-bar > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--brand-teal)); transition: width var(--dur-slow) var(--ease-standard); }
.av-skeleton-inner small { font-size: var(--fs-xs); color: rgba(255, 255, 255, .72); font-variant-numeric: tabular-nums; }

.av-error { display: grid; place-items: center; padding: 20px; background: #19171b; }
.av-error-inner { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; color: #fff; max-width: 260px; }
.av-error-inner .i { width: 24px; height: 24px; color: #f87171; }
.av-error-inner p { font-size: var(--fs-xs); color: rgba(255, 255, 255, .72); }

.av-foot { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; }
.av-foot-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.av-title { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.av-frames { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.av-frames-lbl { font-size: var(--fs-xs); color: var(--fg-3); }
.av-frame-chip {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 2px 8px 2px 3px;
  border-radius: 7px; border: 0; background: var(--bg-subtle); font-size: var(--fs-xs); color: var(--fg-2);
}
.av-frame-chip:hover { background: var(--accent-weak); color: var(--accent-text); }
.av-frame-chip img { width: 20px; height: 20px; border-radius: 4px; object-fit: cover; }
.av-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }

/* Interactive Waveform Audio Card */
.aa-player {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; max-width: 480px;
  border-radius: var(--r-md); border: 0; background: var(--bg-subtle);
}
.aa-dl-btn {
  width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center;
  color: var(--fg-3); flex: none; transition: background var(--dur), color var(--dur);
}
.aa-dl-btn:hover { background: var(--bg-hover); color: var(--fg); }
.aa-player audio { display: none; }
.aa-play-btn {
  width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--accent-grad); color: #ffffff; box-shadow: none; transition: opacity var(--dur), transform var(--dur-instant) var(--ease-out);
}
.aa-play-btn:hover { background: var(--accent-grad-hover); }
.aa-play-btn .i { width: 14px; height: 14px; }
.aa-wave-track { flex: 1; min-width: 0; height: 34px; display: flex; align-items: center; gap: 2px; cursor: pointer; }
.aa-wave-track i { flex: 1; height: var(--bar); min-width: 2px; border-radius: 2px; background: var(--line-strong); transition: background var(--dur-instant); }
.aa-wave-track i.is-played { background: var(--accent); }
.aa-time { font-size: var(--fs-xs); color: var(--fg-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.aa-speed-btn {
  height: 24px; padding: 0 7px; border-radius: 6px; border: 1px solid var(--line-hairline); background: var(--bg-surface); box-shadow: none;
  font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--fg-2); flex: none;
}
.aa-speed-btn:hover { color: var(--accent-text); }

.ag-tool-pending {
  display: flex; flex-direction: column; gap: 8px; max-width: 440px;
  padding: 10px 14px; border-radius: 10px; background: var(--bg-muted);
}
.ag-tool-pending .progress { width: 100%; height: 4px; }
.ag-tool-pending-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: var(--fs-xs); color: var(--fg-2); }

.agent-slot-err {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--r-sm);
  background: var(--danger-weak); color: var(--danger); font-size: var(--fs-xs); line-height: var(--lh-snug);
}

@media (max-width: 1100px) {
  .chat-split-resizer { display: none !important; }
  .chat-gallery-drawer {
    position: absolute; right: 0; top: 0; bottom: 0; margin: 0;
    border-radius: 0; border: 0; border-left: 1px solid var(--line-hairline);
    padding-top: var(--topbar-h); box-shadow: var(--shadow-pop);
  }
}
@media (max-width: 767px) {
  .chat-head-context { max-width: 100%; height: 32px; padding: 0 10px; }
  .chat-gallery-drawer { width: min(100vw, 340px); padding-top: 0; }
  .codeblock pre { max-height: min(320px, 46vh); }
  .turn-user { max-width: 90%; }
  .turn-trace-body { padding: 2px 0 4px 12px; }
  .thinking-body { max-height: 180px; margin-left: 12px; }
  .trace-tool-body, .trace-web-fetch-links { max-height: 140px; }
  .ag-gallery[data-count="1"] { grid-template-columns: minmax(0, 280px); }
  .ag-gallery[data-count="2"],
  .ag-gallery[data-count="3"],
  .ag-gallery[data-count="4"],
  .ag-gallery[data-count="many"] { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .turn-deploy-bar { flex-wrap: nowrap; padding: 8px 10px; gap: 6px; }
  .turn-deploy-info { min-width: 0; flex: 1; }
  .turn-deploy-info > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .turn-deploy-acts .btn { padding: 0 8px; font-size: var(--fs-xs); }
  .turn-ai-foot { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .turn-ai-foot::-webkit-scrollbar { display: none; }
  .turn-ai-model { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .skill-modal { padding: 16px; }
  .skill-modal-head p, .skill-lib-center-link { display: none; }
  .skill-editor-form .field + .field { margin-top: 0; }
  .av-grid[data-count="2"],
  .av-grid[data-count="3"],
  .av-grid[data-count="4"] { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .skill-lib-grid, .agent-compare { grid-template-columns: 1fr; }
  .skill-form-row { flex-direction: column; }
}

/* Floating Back-to-Top & Customer Support Dock --------------------------- */
.float-dock {
  position: fixed;
  right: calc(24px + var(--float-right-offset, 0px));
  bottom: calc(26px + env(safe-area-inset-bottom, 0px));
  z-index: 35;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  transition: right var(--dur-base) var(--ease);
}
.float-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--bg-glass-strong);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--fg-2);
  border: 1px solid var(--line-hairline);
  box-shadow: var(--shadow-pop);
  pointer-events: auto;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur) var(--ease), color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.float-btn .i { width: 20px; height: 20px; }
.float-btn:hover {
  color: var(--fg);
  transform: translateY(-2px);
  box-shadow: var(--shadow-pop);
}
.float-btn:active { transform: scale(.96); }
[data-theme="dark"] .float-btn {
  background: var(--bg-glass-strong);
  border: 1px solid var(--line-hairline);
  box-shadow: var(--shadow-pop);
}
[data-theme="dark"] .float-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--line);
  box-shadow: var(--shadow-pop);
}

.float-btn--top {
  height: 0;
  margin-bottom: -10px;
  border-width: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px) scale(.88);
  transition: opacity .18s var(--ease), transform .22s var(--ease-spring), height .2s var(--ease), margin-bottom .2s var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), color var(--dur) var(--ease), visibility 0s linear .2s;
}
.float-btn--top.is-visible {
  height: 44px;
  margin-bottom: 0;
  border-width: 1px;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  transition: opacity .2s var(--ease), transform .22s var(--ease-spring), height .2s var(--ease), margin-bottom .2s var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), color var(--dur) var(--ease), visibility 0s linear 0s;
}
.float-btn--top.is-visible:hover { transform: translateY(-1px); }

@media (max-width: 1240px) {
  body:has(.dock) .float-dock {
    right: 14px;
    bottom: calc(176px + env(safe-area-inset-bottom, 0px));
  }
}
@media (max-width: 767px) {
  .float-dock { display: none !important; }
}
@media (hover: none) {
  .float-btn[data-tip]::after { display: none; }
}

/* Support Modal ------------------------------------------------------------ */
.support-modal {
  width: min(500px, calc(100vw - 24px));
  max-height: min(680px, calc(100dvh - 32px));
  margin: auto;
}
.support-sheet {
  display: flex;
  flex-direction: column;
  max-height: min(680px, calc(100dvh - 32px));
  background: var(--bg-elevated);
  border: 0;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
}
.support-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--line-hairline);
  flex: none;
}
.support-head-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}
.support-head-icon {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--accent-weak);
  color: var(--accent);
  flex: none;
}
.support-head h2 {
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  margin: 0;
}
.support-head-sub {
  font-size: var(--fs-xs);
  color: var(--fg-3);
  margin: 2px 0 0;
}
.support-main-view {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}
.support-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 18px 0;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.support-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 10px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--fg-2);
  transition: color var(--dur) var(--ease);
}
.support-tab:hover { color: var(--fg); }
.support-tab[aria-selected="true"] {
  color: var(--fg);
  font-weight: var(--fw-semibold);
}
.support-tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--fg);
}
.support-body {
  padding: 16px 18px;
  flex: 1;
  min-height: 220px;
}
.support-faq-search-wrap { margin-bottom: 12px; }
.support-faq-list {
  display: grid;
  gap: 8px;
}
.support-faq-loading {
  padding: 28px 12px;
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--fg-3);
}
.support-faq-item {
  border: 0;
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  transition: background var(--dur) var(--ease);
}
.support-faq-item[open] {
  background: var(--accent-weak);
}
.support-faq-item summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--fg);
}
.support-faq-item summary::-webkit-details-marker { display: none; }
.support-faq-chev {
  width: 15px;
  height: 15px;
  color: var(--fg-3);
  flex: none;
  transition: transform var(--dur) var(--ease);
}
.support-faq-item[open] .support-faq-chev { transform: rotate(180deg); color: var(--accent); }
.support-faq-answer {
  padding: 0 14px 13px;
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
  color: var(--fg-2);
  display: grid;
  gap: 8px;
}
.support-faq-link {
  justify-self: start;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
}
.support-faq-empty {
  padding: 28px 12px;
  text-align: center;
  color: var(--fg-2);
  font-size: var(--fs-sm);
  display: grid;
  gap: 10px;
  justify-items: center;
}
.support-sla-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.support-all-tickets-link { font-size: var(--fs-xs); font-weight: var(--fw-medium); }
.support-ticket-form { display: grid; gap: 12px; }
.support-field { display: grid; gap: 6px; }
.support-field .field-label { font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--fg); }
.support-field .select {
  height: 40px;
  width: 100%;
  padding: 0 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--bg-surface);
  color: var(--fg);
}
.support-field .select:focus {
  background: var(--bg-elevated);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-weak);
}
.support-textarea {
  height: auto;
  min-height: 92px;
  padding: 10px 12px;
  resize: vertical;
  line-height: var(--lh-normal);
}
.support-att-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.support-att-hint { font-size: var(--fs-xs); color: var(--fg-3); }
.support-att-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.support-att-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 10px;
  border-radius: var(--r-full);
  background: var(--bg-subtle);
  border: 0;
  font-size: var(--fs-xs);
  color: var(--fg-2);
}
.support-att-chip button {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--fg-3);
}
.support-att-chip button:hover { background: var(--bg-hover); color: var(--fg); }
.support-guest-card {
  padding: 22px 16px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  text-align: center;
  display: grid;
  gap: 10px;
  justify-items: center;
}
.support-guest-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--line-hairline);
  box-shadow: none;
  color: var(--accent-text);
}
.support-guest-card h3 { font-size: var(--fs-md); margin: 0; }
.support-guest-card p { font-size: var(--fs-sm); color: var(--fg-2); max-width: 34ch; }
.support-guest-email { font-size: var(--fs-xs); color: var(--fg-3); display: flex; align-items: center; gap: 6px; }
.support-ticket-success {
  padding: 24px 16px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  text-align: center;
  display: grid;
  gap: 8px;
  justify-items: center;
}
.support-success-badge {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--success-weak);
  color: var(--success);
}
.support-ticket-success h3 { font-size: var(--fs-lg); margin: 4px 0 0; }
.support-success-desc { font-size: var(--fs-xs); color: var(--fg-2); max-width: 36ch; }
.support-success-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }

.support-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 18px;
  border-top: 1px solid var(--line-hairline);
  background: var(--bg-subtle);
  flex: none;
}
.support-wecom-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 13px;
  border-radius: var(--r-sm);
  background: var(--bg-surface);
  border: 1px solid var(--line-hairline);
  box-shadow: none;
  color: var(--fg);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), transform var(--dur-fast) var(--ease-out);
}
.support-wecom-btn:hover {
  background: var(--accent-weak);
  color: var(--accent-text);
  box-shadow: none;
}
.support-wecom-btn:active { transform: scale(.98); }
.support-wecom-btn .i { width: 16px; height: 16px; color: var(--accent); }
.support-wecom-tag {
  padding: 1px 6px;
  border-radius: var(--r-full);
  background: var(--success-weak);
  color: var(--success);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
}
.support-foot-links {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-size: var(--fs-xs);
  color: var(--fg-2);
}

.support-wecom-view {
  display: flex;
  flex-direction: column;
  padding: 12px 18px 22px;
  overflow-y: auto;
}
.support-wecom-top { margin-bottom: 6px; }
.support-qr-card {
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
  padding: 8px 8px 4px;
}
.support-qr-card h3 { font-size: var(--fs-lg); margin: 0; }
.support-qr-desc { font-size: var(--fs-sm); color: var(--fg-2); max-width: 36ch; line-height: var(--lh-normal); }
.support-qr-frame {
  width: 212px;
  height: 212px;
  padding: 12px;
  margin: 6px 0;
  border-radius: var(--r-md);
  background: #ffffff;
  border: 1px solid var(--line-hairline);
  box-shadow: none;
  display: grid;
  place-items: center;
}
.support-qr-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: var(--r-xs);
}
.support-qr-placeholder {
  display: grid;
  gap: 8px;
  justify-items: center;
  color: #56657d;
  font-size: var(--fs-xs);
  padding: 8px;
}
.support-qr-placeholder .i { width: 32px; height: 32px; opacity: .55; }
.support-qr-placeholder small { font-size: var(--fs-xs); color: #8c9ab0; line-height: var(--lh-snug); }
.support-qr-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.support-email-copy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border-radius: var(--r-full);
  background: var(--bg-subtle);
  border: 0;
  font-size: var(--fs-xs);
  color: var(--fg-2);
}
.support-email-copy:hover { background: var(--accent-weak); color: var(--accent-text); }

/* Web Search & Fetch Agent Cards */
/* ─── DeepSeek-style Web Search / Fetch Trace, Citations & Sources Drawer ─── */
.trace-web-row {
  display: flex; align-items: center; gap: 8px;
  font-size: var(--fs-xs); color: var(--fg-2); padding: 2px 0;
}
.trace-web-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  background: none; border: 0; padding: 2px 4px; margin: -2px -4px; border-radius: 8px;
  font: inherit; color: var(--fg-2); cursor: pointer;
  transition: background var(--dur), color var(--dur);
}
.trace-web-trigger:hover:not(:disabled) { background: var(--bg-hover); color: var(--fg); }
.trace-web-trigger:disabled { cursor: default; opacity: 0.85; }

.trace-web-fetch-row {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: var(--fs-xs); color: var(--fg-2); padding: 2px 0;
}
.trace-web-fetch-row .trace-tool-ic { margin-top: 2px; }
.trace-web-fetch-links {
  display: flex; align-items: center; flex-wrap: wrap; gap: 5px 8px;
  min-width: 0; flex: 1; line-height: var(--lh-snug);
  max-height: 160px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding-right: 4px;
}
.trace-web-fetch-label { color: var(--fg-2); font-weight: var(--fw-medium); flex: none; }
.trace-web-page-link {
  display: inline-flex; align-items: center; gap: 2px; max-width: 240px;
  color: var(--fg-3); text-decoration: none; font-size: var(--fs-xs);
  transition: color var(--dur);
}
.trace-web-page-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trace-web-page-link .i { width: 11px; height: 11px; opacity: 0.65; flex: none; }
.trace-web-page-link:hover { color: var(--fg); text-decoration: underline; }
.trace-web-all-btn {
  display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 6px;
  background: var(--bg-muted); border: 0;
  color: var(--fg-2); font-size: var(--fs-xs); cursor: pointer;
  transition: background var(--dur), color var(--dur);
}
.trace-web-all-btn:hover { background: var(--bg-hover); color: var(--fg); }

.web-fav-stack {
  display: inline-flex; align-items: center; flex-direction: row;
  vertical-align: middle;
}
.web-fav-dot {
  width: 16px; height: 16px; border-radius: 50%; object-fit: cover;
  background: var(--bg); border: 1.5px solid var(--bg);
  box-shadow: 0 0 0 1px var(--line-hairline);
}
.web-fav-dot + .web-fav-dot { margin-left: -4px; }
.web-fav-dot.is-fallback {
  display: inline-grid; place-items: center; color: var(--fg-3);
  background: var(--bg-subtle);
}
.web-fav-dot.is-fallback .i { width: 10px; height: 10px; }

.cite-pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 17px; height: 17px; padding: 0 5px; margin: 0 2px;
  border-radius: 999px; background: var(--bg-muted); border: 0;
  color: var(--fg-2); font-size: var(--fs-2xs); font-weight: var(--fw-semibold); line-height: var(--lh-none);
  vertical-align: 1px; text-decoration: none; cursor: pointer;
  transition: background var(--dur), color var(--dur);
}
.cite-pill:hover { background: var(--accent-weak); color: var(--accent-text); text-decoration: none; }
.cite-pill.is-plain { cursor: default; }

.turn-web-sources-bar { margin: 10px 0 4px; }
.web-sources-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--bg-subtle); border: 0;
  color: var(--fg-2); font-size: var(--fs-xs); font-weight: var(--fw-medium); cursor: pointer;
  transition: background var(--dur), color var(--dur);
}
.web-sources-pill:hover { background: var(--bg-hover); color: var(--fg); }

.chat-sources-drawer { width: 360px; }
.web-drawer-list { display: flex; flex-direction: column; gap: 4px; }
.web-drawer-item {
  display: flex; flex-direction: column; gap: 5px;
  padding: 11px 12px; border-radius: 12px;
  text-decoration: none; border: 0;
  transition: background var(--dur);
}
.web-drawer-item:hover { background: var(--bg-subtle); text-decoration: none; }
.web-drawer-item-head { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--fg-3); }
.web-drawer-fav { width: 15px; height: 15px; border-radius: 4px; object-fit: contain; flex: none; }
.web-drawer-fav-ic { display: inline-flex; color: var(--fg-3); flex: none; }
.web-drawer-site { font-weight: var(--fw-medium); color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.web-drawer-dot { opacity: 0.5; }
.web-drawer-date { font-size: var(--fs-xs); color: var(--fg-3); flex: none; }
.web-drawer-idx {
  margin-left: auto; display: inline-grid; place-items: center;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--bg-muted); border: 0;
  font-size: var(--fs-2xs); font-weight: var(--fw-semibold); color: var(--fg-2); flex: none;
}
.web-drawer-title {
  font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--fg); line-height: var(--lh-snug);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.web-drawer-snippet {
  font-size: var(--fs-xs); color: var(--fg-3); line-height: var(--lh-snug);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* Task Groups in Creative Studio */
.task-group-badge {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-weak);
  color: var(--accent);
  font-weight: var(--fw-medium);
}
.task-group-conv-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: var(--fw-medium);
}
.task-group-conv-link:hover { text-decoration: underline; }
.task-group-title { font-weight: var(--fw-semibold); }
.task-group-images .thumb { position: relative; }
.task-group-slot-label {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 2;
  max-width: calc(100% - 16px);
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(15, 17, 22, 0.72);
  color: #fff;
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.thumb.img-action-card:hover .task-group-slot-label { opacity: 0; transition: opacity var(--dur); }
.task-group-pending-slot {
  min-width: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  cursor: default;
}
.task-group-slot-cancel {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--line-hairline);
  background: var(--bg-glass-strong);
  box-shadow: none;
  color: var(--fg-2);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.task-group-slot-cancel:hover { color: var(--danger); background: var(--bg-elevated); }
.task-group-slot-error {
  min-width: 196px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  cursor: default;
  background: var(--danger-weak);
  border-color: rgba(220, 38, 38, 0.25);
}
.task-group-slot-error-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  font-size: var(--fs-xs);
  color: var(--danger);
}
.task-group-slot-error-body p {
  margin: 0;
  color: var(--fg-2);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.task-group-video-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
}
.task-group-video-title {
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--fg-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
[data-theme="dark"] .task-group-slot-cancel { background: var(--bg-elevated); }

/* Dual-Site Switch Modal & Cookie Consent Banner (Overlay surfaces only) */
.site-switch-modal {
  width: min(460px, calc(100vw - 24px));
  padding: 22px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line-hairline);
  background: var(--bg-elevated);
  color: var(--fg);
  box-shadow: var(--shadow-pop);
}
.site-switch-modal::backdrop {
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
[data-theme="dark"] .site-switch-modal::backdrop {
  background: rgba(10, 12, 16, .62);
}
.site-switch-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.site-switch-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  color: var(--accent-text);
  display: grid;
  place-items: center;
}
.site-switch-title {
  margin: 0 0 8px;
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  color: var(--fg);
}
.site-switch-desc {
  margin: 0 0 12px;
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
  color: var(--fg-2);
}
.site-switch-bullets {
  margin: 0 0 18px;
  padding: 12px 14px 12px 28px;
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  display: grid;
  gap: 6px;
  font-size: var(--fs-xs);
  line-height: var(--lh-snug);
  color: var(--fg-2);
}
.site-switch-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.cookie-banner {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 45;
  width: min(760px, calc(100vw - 24px));
  padding: 12px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-hairline);
  background: var(--bg-elevated);
  color: var(--fg);
  box-shadow: var(--shadow-pop);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.cookie-banner[hidden] { display: none; }
.cookie-banner-text {
  display: grid;
  gap: 2px;
  font-size: var(--fs-xs);
  line-height: var(--lh-snug);
  color: var(--fg-2);
}
.cookie-banner-text strong { color: var(--fg); font-size: var(--fs-sm); }
.cookie-banner-text a { color: var(--accent-text); text-decoration: underline; }
.cookie-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

@media (max-width: 640px) {
  .site-switch-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }
  .cookie-banner {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .cookie-banner-actions {
    justify-content: flex-end;
  }
}
@media (prefers-reduced-motion: reduce) {
  .site-switch-modal,
  .cookie-banner { transition: none; }
}

/* ============================================================================
   Upload Source Popover Menu & Asset Library Picker Modal
   ============================================================================ */
.pop-panel.upload-source-menu,
.pop-panel.upload-source-menu[data-side="top"] {
  position: fixed;
  top: auto;
  bottom: auto;
  right: auto;
  min-width: 184px;
  border: 1px solid var(--line-hairline);
  z-index: 96;
}
.upload-source-menu .menu-item {
  font-size: var(--fs-sm);
  padding: 8px 11px;
  white-space: nowrap;
}

.asset-picker-modal {
  width: min(1080px, calc(100vw - 32px));
  height: min(740px, calc(100dvh - 32px));
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--r-xl);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
}
.ap-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  background: var(--bg-canvas);
}
.ap-head {
  flex: none;
  padding: 16px 20px 12px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--line-hairline);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ap-head-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.ap-head-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.ap-head-title h3 {
  margin: 0;
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ap-count {
  flex: none;
  padding: 2px 8px;
  border-radius: var(--r-full);
  background: var(--bg-subtle);
  color: var(--fg-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
}
.ap-count[hidden] { display: none; }
.ap-head-acts {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}
.ap-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.ap-filter-stack {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.ap-source-pills,
.ap-kind-pills {
  gap: 4px;
}
.ap-source-pills .pill,
.ap-kind-pills .pill {
  height: 30px;
  padding: 0 11px;
  font-size: var(--fs-xs);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ap-kind-pills {
  padding-left: 8px;
  border-left: 1px solid var(--line-hairline);
}
.ap-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  width: 230px;
  max-width: 100%;
  padding: 0 8px 0 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--bg-canvas);
  color: var(--fg-3);
  transition: border-color var(--dur), background var(--dur), box-shadow var(--dur);
}
.ap-search:focus-within {
  border-color: var(--accent);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--accent-weak);
  color: var(--fg-2);
}
.ap-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--fg);
  font-size: var(--fs-xs);
}
.ap-search input::placeholder { color: var(--fg-3); }
.ap-search-clear {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  color: var(--fg-3);
  flex: none;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.ap-search-clear:hover {
  background: var(--bg-hover);
  color: var(--fg);
}
.ap-search-clear[hidden] { display: none; }

.ap-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 20px 20px;
}
.ap-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
  align-content: start;
}
.ap-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  padding: 0;
  text-align: left;
  border-radius: var(--r-md);
  background: var(--bg-surface);
  border: 1px solid var(--line-hairline);
  box-shadow: none;
  overflow: hidden;
  cursor: pointer;
  transition: border-color var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease);
}
.ap-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-card-hover);
}
.ap-card.is-picked {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-weak);
}
.ap-card.is-skeleton {
  pointer-events: none;
  cursor: default;
}
.ap-media {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  flex: none;
  background: var(--bg-muted);
  overflow: hidden;
}
.ap-media video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ap-card:hover .ap-media .bh-frame > img {
  transform: scale(1.03);
}
.ap-video-play {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(16, 16, 20, .62);
  color: #fff;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
}
.ap-audio-tile {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg-subtle);
  color: var(--fg-2);
}
.ap-audio-tile-ic {
  width: 42px;
  height: 42px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--line-hairline);
}
.ap-audio-tile-dur {
  font-size: var(--fs-xs);
  color: var(--fg-3);
}
.ap-check {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 1.5px solid rgba(255, 255, 255, .86);
  background: rgba(16, 16, 20, .44);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: transparent;
  display: grid;
  place-items: center;
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}
.ap-check.is-checked {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.ap-attached-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 7px;
  border-radius: 6px;
  background: rgba(16, 16, 20, .62);
  border: 1px solid rgba(255, 255, 255, .14);
  color: #fff;
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  line-height: var(--lh-none);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
}
.ap-attached-tag.is-bottom-shift {
  left: 36px;
}
.ap-fav-mark {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(16, 16, 20, .62);
  border: 1px solid rgba(255, 255, 255, .14);
  color: #f59e0b;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
}
.ap-fav-mark svg { fill: currentColor; }
[data-theme="dark"] .ap-fav-mark,
[data-theme="dark"] .ap-attached-tag {
  background: rgba(16, 16, 20, .72);
  border-color: rgba(255, 255, 255, .16);
}
.ap-badges {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  pointer-events: none;
}
.ap-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 7px;
  border-radius: 6px;
  background: rgba(16, 16, 20, .62);
  border: 1px solid rgba(255, 255, 255, .14);
  color: #fff;
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-none);
  letter-spacing: var(--ls-wide);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
[data-theme="dark"] .ap-badge {
  background: rgba(16, 16, 20, .72);
  border-color: rgba(255, 255, 255, .16);
}
.ap-ratio {
  margin-left: auto;
  letter-spacing: var(--ls-normal);
  font-variant-numeric: tabular-nums;
}
.ap-ratio[hidden] { display: none; }
.ap-card-foot {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  min-width: 0;
  padding: 8px 10px 9px;
}
.ap-card-title {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ap-card-meta {
  font-size: var(--fs-xs);
  color: var(--fg-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.ap-sk-media { width: 100%; aspect-ratio: 1 / 1; }
.ap-sk-title { display: block; height: 13px; width: 72%; border-radius: 4px; }
.ap-sk-meta { display: block; height: 11px; width: 48%; border-radius: 4px; margin-top: 4px; }

.ap-audio-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-content: start;
}
.ap-audio-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-hairline);
  background: var(--bg-surface);
  box-shadow: none;
  text-align: left;
  cursor: pointer;
  transition: background var(--dur), border-color var(--dur), box-shadow var(--dur);
}
.ap-audio-row:hover {
  background: var(--bg-subtle);
  border-color: var(--accent);
}
.ap-audio-row.is-picked {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-weak);
}
.ap-audio-row.is-skeleton {
  pointer-events: none;
  cursor: default;
}
.ap-audio-ic {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  flex: none;
  background: var(--bg-subtle);
  color: var(--fg-2);
}
.ap-audio-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ap-audio-info strong {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ap-audio-info small {
  font-size: var(--fs-xs);
  color: var(--fg-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ap-audio-end {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
}
.ap-audio-fav {
  color: #f59e0b;
  display: inline-grid;
  place-items: center;
}
.ap-audio-fav svg { fill: currentColor; }
.ap-audio-tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 7px;
  border-radius: 6px;
  background: var(--bg-subtle);
  color: var(--fg-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
}
.ap-audio-check {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.5px solid var(--line-strong);
  background: var(--bg-surface);
  color: transparent;
  display: grid;
  place-items: center;
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}
.ap-audio-check.is-checked {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.ap-empty {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 28px 16px;
  text-align: center;
  color: var(--fg-3);
}
.ap-empty-ic {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--bg-subtle);
  color: var(--fg-2);
  margin-bottom: 2px;
}
.ap-empty h4 {
  margin: 0;
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--fg);
}
.ap-empty p {
  margin: 0 0 6px;
  font-size: var(--fs-xs);
  color: var(--fg-2);
  max-width: 360px;
  line-height: var(--lh-snug);
}
.ap-empty-acts {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}
.ap-more {
  display: flex;
  justify-content: center;
  padding-top: 16px;
}

.ap-foot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  background: var(--bg-surface);
  border-top: 1px solid var(--line-hairline);
}
.ap-foot[hidden] { display: none; }
.ap-sel-status {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--fg-2);
}
.ap-foot-acts {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

@media (max-width: 1023px) {
  .ap-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
}
@media (max-width: 767px) {
  .asset-picker-modal {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
  }
  .ap-head { padding: 12px 14px 10px; gap: 8px; }
  .ap-body { padding: 12px 14px 16px; }
  .ap-foot { padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .ap-filter-stack { width: 100%; gap: 6px; }
  .ap-source-pills,
  .ap-kind-pills {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
  .ap-source-pills::-webkit-scrollbar,
  .ap-kind-pills::-webkit-scrollbar { display: none; }
  .ap-source-pills .pill,
  .ap-kind-pills .pill { flex: none; white-space: nowrap; }
  .ap-kind-pills { padding-left: 0; border-left: 0; }
  .ap-search { width: 100%; }
  .ap-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .ap-audio-list { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .ap-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .composer-add .i,
  .task-ref-btn,
  .task-ref-media,
  .ap-card:hover .ap-media .bh-frame > img { transition: none; transform: none; }
}

/* Unified Skill Modals (v3.1 flat hairline & subtle blocks, dark mode + mobile) */
.skill-modal .field { min-width: 0; }
.skill-modal .field + .field { margin-top: 0; }
.skill-modal .field > .field-label {
  justify-content: flex-start;
  gap: 4px;
  margin-bottom: 6px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--fg-2);
  line-height: 1.4;
}
.skill-modal .skill-form-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.skill-modal .skill-form-row > .field { min-width: 0; }
.skill-field-cat { width: 160px; flex: none; }
.skill-modal .select {
  height: 40px;
  border-color: var(--line);
  background: var(--bg-surface);
  transition: border-color var(--dur), background var(--dur), box-shadow var(--dur);
}
.skill-modal .select:hover { border-color: var(--line-strong); }
.skill-modal .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); outline: none; }

.skill-pop-hint {
  flex: none;
  padding: 4px 8px 6px;
  font-size: var(--fs-2xs);
  color: var(--fg-3);
  border-bottom: 1px solid var(--line-hairline);
  margin-bottom: 4px;
}

.skill-modal-ai-bar {
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  border: 1px solid var(--line-hairline);
}
.skill-modal-ai-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.skill-modal-ai-row .input { flex: 1; min-width: 0; }
.skill-modal-ai-row .btn { flex: none; height: 40px; padding: 0 14px; white-space: nowrap; }
.skill-req { color: var(--danger); font-weight: var(--fw-semibold); }
.skill-sop-box {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  line-height: 1.55;
}

.skill-att-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.skill-att-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.skill-att-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.skill-att-empty {
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--bg-subtle);
  font-size: var(--fs-xs);
  color: var(--fg-3);
}
.skill-att-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  background: var(--bg-subtle);
  font-size: var(--fs-xs);
}
.skill-att-kind {
  flex: none;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--line-hairline);
  color: var(--fg-2);
  font-size: var(--fs-2xs);
}
.skill-att-path {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--fg);
  font-family: var(--mono);
}
.skill-att-size { flex: none; color: var(--fg-3); font-size: var(--fs-2xs); }

.skill-adv-details {
  border: 1px solid var(--line-hairline);
  border-radius: var(--r-md);
  background: var(--bg-surface);
  padding: 10px 12px;
}
.skill-adv-details summary {
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--fg-2);
  user-select: none;
}
.skill-adv-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-hairline);
}
.skill-modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--line-hairline);
  margin-top: 4px;
}

.skill-import-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 62vh;
  padding-right: 2px;
}
.skill-import-tabs { display: flex; gap: 6px; }
.skill-import-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 28px 16px;
  border-radius: var(--r-md);
  border: 1px dashed var(--line-strong);
  background: var(--bg-subtle);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--dur), background var(--dur);
}
.skill-import-dropzone:hover,
.skill-import-dropzone.is-drag {
  border-color: var(--accent-line);
  background: var(--accent-weak);
}
.skill-import-dropzone .i { width: 22px; height: 22px; color: var(--accent-text); }
.skill-import-drop-title { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--fg); }
.skill-import-drop-sub { font-size: var(--fs-xs); color: var(--fg-3); }

.skill-import-preview-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-hairline);
  background: var(--bg-surface);
}
.skill-import-warn {
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--line-hairline);
  font-size: var(--fs-xs);
  color: var(--fg-2);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.skill-detail-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.skill-meta-pill {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-subtle);
  font-size: var(--fs-2xs);
  color: var(--fg-2);
}
.skill-det-head-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.skill-det-ic {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--line-hairline);
  color: var(--accent-text);
  flex: none;
}
.skill-det-sub { font-size: var(--fs-xs); color: var(--fg-3); margin-top: 2px; }
.skill-det-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 60vh;
  padding: 4px 2px 8px;
}
.skill-det-cover {
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--line-hairline);
  max-height: 190px;
}
.skill-det-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.skill-det-desc { margin: 0; font-size: var(--fs-sm); color: var(--fg-2); line-height: 1.6; }
.skill-det-starter {
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--bg-subtle);
}
.skill-det-starter-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: var(--fs-xs); color: var(--fg-3); margin-bottom: 4px;
}
.skill-det-starter p { margin: 0; font-size: var(--fs-xs); color: var(--fg); line-height: 1.5; }
.skill-det-assets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}
.skill-det-asset {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px;
  border-radius: var(--r-sm);
  background: var(--bg-subtle);
  font-size: var(--fs-2xs);
  color: var(--fg-2);
}
.skill-det-asset img {
  width: 100%; height: 70px; object-fit: cover; border-radius: 6px; display: block;
}
.skill-det-asset span {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.skill-det-pre {
  margin: 10px 0 0;
  padding: 10px;
  border-radius: var(--r-sm);
  background: var(--bg-subtle);
  font-family: var(--mono);
  font-size: var(--fs-xs);
  line-height: 1.55;
  color: var(--fg-2);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 260px;
  overflow-y: auto;
}
.skill-det-foot-left { display: flex; align-items: center; gap: 6px; margin-right: auto; flex-wrap: wrap; }

/* Agent file_output Download Card (v3.1 flat hairline card) */
.ag-file-card {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-hairline);
  background: var(--bg-surface);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ag-file-card-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.ag-file-card-icon {
  width: 34px; height: 34px; border-radius: var(--r-sm);
  display: grid; place-items: center;
  background: var(--bg-subtle);
  color: var(--accent-text);
  flex: none;
}
.ag-file-card-info { flex: 1; min-width: 0; }
.ag-file-card-name {
  font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--fg);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ag-file-card-meta { font-size: var(--fs-2xs); color: var(--fg-3); margin-top: 2px; }
.ag-file-card-dl { flex: none; }
.ag-file-preview summary {
  cursor: pointer;
  font-size: var(--fs-xs);
  color: var(--fg-2);
}
.ag-file-preview pre {
  margin: 6px 0 0;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: var(--bg-subtle);
  font-family: var(--mono);
  font-size: var(--fs-2xs);
  color: var(--fg-2);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
}

@media (max-width: 720px) {
  .skill-modal .skill-form-row { flex-direction: column; }
  .skill-modal .skill-form-row > .field,
  .skill-field-cat { width: 100%; }
}
@media (max-width: 640px) {
  .skill-modal-head { flex-direction: column; gap: 10px; }
  .skill-modal-head-copy { padding-right: 36px; }
  .skill-modal-head-acts { width: 100%; flex-wrap: wrap; }
  .skill-modal-head-acts .modal-close { position: absolute; top: 0; right: 0; }
  .skill-modal-ai-row { flex-direction: column; align-items: stretch; }
  .skill-det-foot-left { width: 100%; margin-right: 0; }
  .ag-file-card-main { flex-wrap: wrap; }
}
