/* ==========================================================================
   爆剧获取 · drama-portal — style.css (v20)
   Design system generated with the ui-ux-pro-max skill
   (Developer Tool / IDE → Dark Mode (OLED) + Minimalism & Swiss Style,
   palette "Code dark + run green", type pairing "Developer Mono").
   User site = dark tokens. Admin host keeps its light purple identity.
   v13: Codex = one session thread (agent + built-in image tool).
   v14: /app = CloudCLI-style three-pane workbench (sessions | conversation | outputs).
   v15: one flat session list, no assistant cards; the assistant is picked from the composer chip;
        service status is a quiet dot unless something is wrong.
   v16: admin 技能配置 dialog — clearer list, one-step add (auto slug), in-row 启用 / Codex / Claude
        switches, green / red save feedback with the new-session reminder.
   v17: image previews the 漫天堂 way — CDN WebP thumbs only; a 「生成中…」 placeholder until the CDN copy
        exists (never the full file); grey tile when a thumb can't load; the viewer says when the
        original isn't there yet.
   v18: a turn whose run didn't end as "completed" but left pictures behind is done (green), with a quiet
        grey line about how the run ended — no red 「未成功」 next to a finished picture.
   v19: generated pictures travel as CDN addresses / session paths only (no base64 to the browser or back
        to the session); a pending chip whose picture is filed but not on the CDN yet shimmers like other tiles.
   Sections: 1 tokens · 2 base · 3 header · 4 layout · 5 components
   6 pages · 7 workbench forms · 8 workbench shell + Codex · 9 responsive · 10 motion · 11 skills dialog
   12 image previews · 13 run outcome
   ========================================================================== */

/* 1 · tokens ------------------------------------------------------------- */
:root {
  color-scheme: light;
  /* surfaces (light — used by the admin host) */
  --bg: #eef0f4;
  --bg-deep: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #edf1f6;
  --field: #ffffff;
  --code-bg: #f4f7fb;
  --row-hover: #fafbfd;
  /* lines */
  --line: #e1e6ee;
  --line-strong: #ccd4df;
  --field-line: #d3dae4;
  --field-line-hover: #b6c1d0;
  /* text */
  --text: #152033;
  --text-2: #344156;
  --muted: #5d6b82;
  --faint: #6b7890;
  --placeholder: #98a3b4;
  /* brand + semantic */
  --accent: #1a4f8c;
  --accent-hover: #143f71;
  --on-accent: #ffffff;
  --accent-text: #1a4f8c;
  --accent-soft: #e9f1fb;
  --accent-line: #c3d6ef;
  --link: #2563a8;
  --btn2-bg: #ffffff;
  --btn2-bg-hover: #f7f9fc;
  --info: #2563a8;
  --info-text: #1a4f8c;
  --info-soft: #e9f1fb;
  --info-line: #c3d6ef;
  --ok: #157a45;
  --ok-text: #157a45;
  --ok-soft: #e8f6ee;
  --ok-line: #b7e0c6;
  --warn: #9a6700;
  --warn-text: #8a6d1d;
  --warn-soft: #fff7e0;
  --warn-line: #f0d78c;
  --err: #b42318;
  --err-text: #b42318;
  --err-soft: #fdeceb;
  --err-line: #f3c1bc;
  --on-err: #ffffff;
  --alarm: #e11d48;
  --alarm-text: #be123c;
  --alarm-strong: #9f1239;
  --alarm-soft: #fff1f2;
  --alarm-soft-2: #ffe4e6;
  --alarm-line: #fda4af;
  --ring: #2563a8;
  --focus-halo: rgba(37, 99, 168, 0.18);
  --header-bg: #13294a;
  --header-text: #c6d3e6;
  --header-line: transparent;
  /* elevation (skill scale) */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
  --edge: 0 0 0 0 transparent;
  /* type (skill pairing: JetBrains Mono / IBM Plex Sans, local stacks + CJK) */
  --font-body: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei UI", "Microsoft YaHei",
    "Noto Sans SC", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  --font-heading: "JetBrains Mono", "SF Mono", "Cascadia Code", Consolas, Menlo, "PingFang SC",
    "Hiragino Sans GB", "HarmonyOS Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC",
    "Noto Sans CJK SC", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, SFMono-Regular, "Cascadia Code", Consolas,
    Menlo, "Liberation Mono", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", monospace;
  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-lg: 18px;
  --text-xl: 24px;
  --text-2xl: 32px;
  /* spacing (skill scale, density 7 = standard) */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-12: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  /* radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 999px;
  /* legacy aliases (inline styles in other templates use these) */
  --border: var(--line);
  --border-strong: var(--line-strong);
  --card: var(--surface);
  --radius: var(--radius-lg);
  --font: var(--font-body);
  --mono: var(--font-mono);
  /* motion */
  --dur-fast: 150ms;
  --dur: 200ms;
  --dur-slow: 300ms;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  /* layout */
  --container: 1200px;
  --gutter: 24px;
  --z-header: 20;
}

/* Admin host: unchanged light purple identity */
body.admin-host {
  --bg: #eef0f4;
  --accent: #3d2b6b;
  --accent-hover: #2f2154;
  --accent-text: #5b3d99;
  --accent-soft: #efeaf8;
  --accent-line: #d5c8ef;
  --link: #5b3d99;
  --ring: #5b3d99;
  --focus-halo: rgba(91, 61, 153, 0.2);
  --container: 1080px;
  font-size: 14.5px;
}

/* User site: dark tokens from the skill palette (Developer Tool / IDE) */
body.user-host {
  color-scheme: dark;
  --bg: #0f172a;
  --bg-deep: #0b1120;
  --surface: #1b2336;
  --surface-2: #212b40;
  --surface-3: #272f42;
  --field: #111a2e;
  --code-bg: #0b1120;
  --row-hover: rgba(148, 163, 184, 0.045);
  --line: rgba(148, 163, 184, 0.14);
  --line-strong: #475569;
  --field-line: #5b6b82;
  --field-line-hover: #74839a;
  --text: #f8fafc;
  --text-2: #cbd5e1;
  --muted: #94a3b8;
  --faint: #7c8ba1;
  --placeholder: #7c8ba1;
  --primary: #1e293b;
  --secondary: #334155;
  --accent: #22c55e;
  --accent-hover: #4ade80;
  --on-accent: #0f172a;
  --accent-text: #4ade80;
  --accent-soft: rgba(34, 197, 94, 0.12);
  --accent-line: rgba(34, 197, 94, 0.36);
  --link: #93c5fd;
  --btn2-bg: rgba(148, 163, 184, 0.06);
  --btn2-bg-hover: rgba(148, 163, 184, 0.13);
  --info: #60a5fa;
  --info-text: #93c5fd;
  --info-soft: rgba(96, 165, 250, 0.12);
  --info-line: rgba(96, 165, 250, 0.38);
  --ok: #22c55e;
  --ok-text: #4ade80;
  --ok-soft: rgba(34, 197, 94, 0.12);
  --ok-line: rgba(34, 197, 94, 0.36);
  --warn: #fbbf24;
  --warn-text: #fcd34d;
  --warn-soft: rgba(251, 191, 36, 0.12);
  --warn-line: rgba(251, 191, 36, 0.36);
  --err: #ef4444;
  --err-text: #f87171;
  --err-soft: rgba(239, 68, 68, 0.12);
  --err-line: rgba(239, 68, 68, 0.42);
  --on-err: #000000;
  --alarm: #f43f5e;
  --alarm-text: #fda4af;
  --alarm-strong: #fecdd3;
  --alarm-soft: rgba(244, 63, 94, 0.09);
  --alarm-soft-2: rgba(244, 63, 94, 0.15);
  --alarm-line: rgba(244, 63, 94, 0.45);
  --ring: #ffffff;
  --focus-halo: rgba(96, 165, 250, 0.35);
  --header-bg: #0b1120;
  --header-text: #94a3b8;
  --header-line: rgba(148, 163, 184, 0.12);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.35);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.45);
  --edge: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  font-size: var(--text-base);
}

/* 2 · base --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 84px; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
body.user-host { font-size: var(--text-base); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
code, kbd, pre, samp { font-family: var(--font-mono); }
h1, h2 { font-family: var(--font-heading); }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
::selection { background: rgba(96, 165, 250, 0.3); }
button, summary, label[for], select { cursor: pointer; }
button { touch-action: manipulation; }
.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;
}
.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 100;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  transition: top var(--dur) var(--ease-out);
}
.skip-link:focus { top: 10px; text-decoration: none; }
main.wrap:focus { outline: none; }
.ico { width: 16px; height: 16px; flex: none; }
.ico-lg { width: 22px; height: 22px; }
.ico-xl { width: 28px; height: 28px; }

/* 3 · header ------------------------------------------------------------- */
header.top {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  padding: 0 var(--gutter);
  background: var(--header-bg);
  color: #fff;
  border-bottom: 1px solid var(--header-line);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03), 0 6px 24px rgba(2, 6, 23, 0.25);
}
header.top .inner {
  max-width: var(--container);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  min-height: 60px;
}
header.top a { color: var(--header-text); text-decoration: none; }
header.top a:hover { color: #fff; text-decoration: none; }
header.top .brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.04em;
  color: #fff;
  white-space: nowrap;
}
/* vertical 9:16 frame with a play notch — 竖屏短剧 */
.brand-mark {
  position: relative;
  flex: none;
  width: 14px;
  height: 22px;
  border: 2px solid var(--accent);
  border-radius: 4px;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.25);
}
.brand-mark::after {
  content: "";
  position: absolute;
  left: 3.5px;
  top: 50%;
  margin-top: -3.5px;
  border-left: 5px solid var(--accent);
  border-top: 3.5px solid transparent;
  border-bottom: 3.5px solid transparent;
}
header.top nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 2px 4px;
  font-size: 14px;
}
header.top nav a {
  padding: 7px 12px;
  border-radius: var(--radius-md);
  transition: background var(--dur) ease, color var(--dur) ease;
}
header.top nav a:hover { background: rgba(255, 255, 255, 0.07); }
header.top nav a.active {
  color: #fff;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.1);
}
body.user-host header.top nav a.active { box-shadow: inset 0 -2px 0 var(--accent); border-radius: var(--radius-md) var(--radius-md) 4px 4px; }
.nav-user {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 6px 0 12px;
  color: var(--header-text);
  font-size: 13px;
  opacity: 0.85;
}
header.top nav a.nav-cta {
  padding: 7px 16px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}
body.user-host header.top nav a.nav-cta { background: var(--accent); color: var(--on-accent); font-weight: 600; }
body.user-host header.top nav a.nav-cta:hover { background: var(--accent-hover); }
.nav-sep { opacity: 0.35; margin: 0 2px; user-select: none; }
.nav-admin { font-weight: 700; }

/* 4 · layout ------------------------------------------------------------- */
.wrap {
  display: block;
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--space-xl) var(--gutter) var(--space-3xl);
  flex: 1;
}
body.admin-host .wrap { padding: 28px 20px 56px; }
footer.foot { border-top: 1px solid var(--line); padding: 16px 18px 28px; }
footer.foot .inner { max-width: var(--container); margin: 0 auto; font-size: 12px; }
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px 20px;
  flex-wrap: wrap;
  margin: 2px 0 6px;
}
.page-head h1 {
  margin: 0 0 6px;
  font-size: var(--text-xl);
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.page-head p { margin: 0; max-width: 48em; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.sep { height: 1px; background: var(--line); margin: 12px 0; }

/* 5 · components --------------------------------------------------------- */
.card {
  margin-top: var(--space-lg);
  padding: var(--space-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm), var(--edge);
}
body.admin-host .card { margin-top: 18px; padding: 22px 24px; border-radius: 16px; }
.card h2 { margin: 0 0 12px; font-size: var(--text-lg); line-height: 1.4; font-weight: 600; letter-spacing: -0.005em; }
.card h3 { margin: 0 0 8px; font-size: var(--text-sm); color: var(--text-2); font-weight: 600; }
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-12) var(--space-lg);
  margin-bottom: var(--space-lg);
}
.section-head h2 { margin: 0 0 4px; }
.section-head p { margin: 0; font-size: var(--text-sm); color: var(--muted); max-width: 56em; }

.muted { color: var(--muted); }
.hint { margin: 6px 0 0; font-size: 13px; line-height: 1.55; color: var(--muted); }
.mono { font-family: var(--font-mono); font-size: 12px; word-break: break-all; }
.nowrap { white-space: nowrap; }
.req { color: var(--err-text); font-weight: 700; }
form.inline { display: inline; }
.label-sm { display: block; margin-bottom: 2px; font-size: 12px; font-weight: 600; color: var(--muted); }
.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 12px;
  white-space: nowrap;
}

/* flash */
.flash {
  margin: 0 0 var(--space-md);
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-weight: 500;
}
.flash.ok { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok-text); }
.flash.err { background: var(--err-soft); border-color: var(--err-line); color: var(--err-text); }

/* fields — visible labels, inset dark fields, blue focus */
label {
  display: block;
  margin: 14px 0 6px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-2);
}
body.admin-host label { font-size: 13px; font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=search],
input[type=number], input[type=url], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--field-line);
  border-radius: var(--radius-md);
  background: var(--field);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  line-height: 1.5;
  transition: border-color var(--dur) ease, box-shadow var(--dur) ease, background var(--dur) ease;
}
body.admin-host input, body.admin-host textarea, body.admin-host select { font-size: 14.5px; padding: 9px 12px; }
input:hover, textarea:hover, select:hover { border-color: var(--field-line-hover); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--info);
  box-shadow: 0 0 0 3px var(--focus-halo);
}
input::placeholder, textarea::placeholder { color: var(--placeholder); opacity: 1; }
input:disabled, textarea:disabled, select:disabled {
  background: var(--surface-2);
  color: var(--faint);
  cursor: not-allowed;
}
textarea {
  min-height: 110px;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
}
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 256 256' fill='%235d6b82'%3E%3Cpath d='M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
body.user-host select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 256 256' fill='%2394a3b8'%3E%3Cpath d='M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z'/%3E%3C/svg%3E");
}
select option { background: var(--surface); color: var(--text); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); cursor: pointer; }

/* buttons — one filled CTA per zone, the rest subordinate */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 18px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background var(--dur) ease, border-color var(--dur) ease, color var(--dur) ease,
    box-shadow var(--dur) ease, opacity var(--dur) ease;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); text-decoration: none; }
.btn:active { opacity: 0.88; }
.btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.btn:disabled:hover { background: var(--accent); border-color: var(--accent); }
.btn .ico { width: 16px; height: 16px; }
.btn.secondary {
  background: var(--btn2-bg);
  border-color: var(--line-strong);
  color: var(--text);
  box-shadow: none;
}
.btn.secondary:hover { background: var(--btn2-bg-hover); border-color: var(--field-line-hover); color: var(--text); }
.btn.secondary:disabled:hover { background: var(--btn2-bg); border-color: var(--line-strong); }
.btn.ghost {
  background: transparent;
  border-color: var(--accent-line);
  color: var(--accent-text);
  box-shadow: none;
}
.btn.ghost:hover { background: var(--accent-soft); color: var(--accent-text); }
body.admin-host .btn.ghost { background: #fff; border-color: var(--accent); color: var(--accent); }
body.admin-host .btn.ghost:hover { background: var(--accent-soft); }
.btn.quiet {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  box-shadow: none;
}
.btn.quiet:hover { background: var(--btn2-bg-hover); color: var(--text); }
.btn.danger { background: var(--err); border-color: var(--err); color: var(--on-err); }
.btn.danger:hover { background: #912018; border-color: #912018; color: #fff; }
body.user-host .btn.danger:hover { background: #f87171; border-color: #f87171; color: #000; }
.btn.sm { min-height: 32px; padding: 4px 12px; font-size: 13px; gap: 6px; border-radius: var(--radius-sm); }
.btn.sm .ico { width: 14px; height: 14px; }
.btn-lg { min-height: 48px; padding: 12px 28px; font-size: var(--text-base); border-radius: var(--radius-md); }
.btn-lg .ico { width: 18px; height: 18px; }

/* status badges — dot + text, never colour alone */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 1px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.7;
  white-space: nowrap;
  vertical-align: middle;
}
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.queued, .badge.pending { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn-text); }
.badge.processing { background: var(--info-soft); border-color: var(--info-line); color: var(--info-text); }
.badge.done, .badge.approved { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok-text); }
.badge.failed, .badge.rejected, .badge.disabled { background: var(--err-soft); border-color: var(--err-line); color: var(--err-text); }

/* tables */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
th, td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
body.admin-host table { font-size: 13.5px; }
body.admin-host th, body.admin-host td { padding: 11px 10px; }
tbody tr { transition: background var(--dur-fast) ease; }
tbody tr:hover > td { background: var(--row-hover); }
.empty-state { padding: var(--space-xl) var(--space-md); text-align: center; color: var(--muted); }

/* 6 · pages -------------------------------------------------------------- */
/* landing */
.hero {
  margin-top: var(--space-md);
  padding: var(--space-xl) var(--space-xl);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(160deg, var(--surface) 0%, var(--surface-2) 60%, var(--accent-soft) 100%);
  box-shadow: var(--shadow-md), var(--edge);
}
.hero .eyebrow { margin: 0 0 8px; font-size: 13px; font-weight: 600; letter-spacing: 0.06em; color: var(--accent-text); }
.hero h1 { margin: 0 0 12px; font-size: 30px; line-height: 1.25; letter-spacing: -0.01em; }
.hero p { margin: 0 0 var(--space-lg); color: var(--muted); max-width: 620px; font-size: var(--text-base); }
.steps { margin: 0; padding-left: 18px; color: var(--text-2); }
.steps li { margin: 6px 0; }

/* auth */
.auth-wrap { display: flex; justify-content: center; }
.auth-card { width: 100%; max-width: 440px; margin-top: 40px; padding: var(--space-xl); }
body.admin-host .auth-card { padding: 28px; }

/* catalog */
.search-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search-bar input[type=search] { flex: 1; min-width: 200px; }
.drama-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.drama-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 16px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.drama-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.zh-title { margin: 0; font-size: 16px; color: var(--text); }
.unnamed { color: var(--muted); font-weight: 600; font-style: italic; }
.en-name { color: var(--accent-text); font-weight: 600; }
.link-row { display: flex; flex-direction: column; gap: 10px; }
.pwd-box { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pwd {
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--code-bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
}
.share-banner { background: linear-gradient(160deg, var(--surface) 0%, var(--surface-2) 100%); }
.share-banner-grid { display: grid; grid-template-columns: 1.4fr auto; gap: 16px; align-items: end; }
.share-link { display: inline-block; margin-top: 4px; font-size: 13px; font-weight: 600; }
.catalog-list td { vertical-align: middle; }
.catalog-list .badge { margin-left: 6px; }
.file-key {
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--code-bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12.5px;
  word-break: break-all;
}

/* admin */
.inline-edit { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.inline-edit input { margin: 0; }
.catalog-admin td { vertical-align: middle; }
.row-missing { background: var(--err-soft); }
.admin-banner { border-color: var(--warn-line); background: var(--warn-soft); }
.admin-jobs-table { table-layout: auto; min-width: 1280px; width: max-content; max-width: none; }
.admin-jobs-table th,
.admin-jobs-table td { white-space: normal; overflow-wrap: anywhere; word-break: normal; }
.admin-jobs-table .cell-baidu { min-width: 140px; max-width: 200px; }
.admin-jobs-table .cell-baidu a { display: inline-block; word-break: normal; overflow-wrap: normal; }
.admin-jobs-table .cell-note { min-width: 220px; max-width: 320px; }
.admin-jobs-table .cell-scroll {
  max-height: 4.8em;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: normal;
  line-height: 1.35;
}
.admin-jobs-table .cell-share { min-width: 120px; max-width: 180px; }
.admin-jobs-table .mono { word-break: normal; }

/* legacy per-row job editor (kept for older templates) */
.paste-helper { min-height: 72px; font-family: var(--font-mono); font-size: 12.5px; }
.job-rows { margin-top: 10px; border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; background: var(--surface-2); }
.job-rows-head,
.job-row {
  display: grid;
  grid-template-columns: minmax(180px, 2.2fr) minmax(110px, 1.2fr) minmax(90px, 0.9fr) 48px;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
}
.job-rows-head { background: var(--surface-3); border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 700; color: var(--muted); }
.job-row { background: var(--surface); border-bottom: 1px solid var(--line); }
.job-row:last-child { border-bottom: none; }
.job-cell input { width: 100%; margin: 0; font-size: 13px; }
.job-cell-actions { display: flex; justify-content: center; }

/* admin host chrome */
body.admin-host header.top {
  background: linear-gradient(135deg, #2a1f45 0%, #3d2b6b 55%, #5b3d99 100%);
  box-shadow: 0 2px 12px rgba(42, 31, 69, 0.3);
}
body.admin-host header.top a { color: #e8e1f7; }
body.admin-host header.top a:hover { color: #fff; }
body.admin-host .nav-user { color: #cfc4e6; }
body.admin-host header.top .brand::after {
  content: " · 仅管理员";
  font-weight: 500;
  font-size: 12px;
  opacity: 0.75;
}
body.admin-host .auth-badge {
  display: inline-block;
  margin: 0 0 8px;
  padding: 3px 8px;
  border: 1px solid #d5c8ef;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #5b3d99;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
body.admin-host .auth-card-admin { border-top: 3px solid #5b3d99; }
body.admin-host .admin-login-shell {
  min-height: calc(100vh - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background:
    radial-gradient(800px 320px at 80% -10%, #4a3578, transparent 55%),
    #1a1428;
  margin: -28px -20px -56px;
  width: calc(100% + 40px);
}
body.admin-host .wrap:has(.admin-login-shell) { max-width: none; padding: 0; }
body.admin-host .wrap:has(.admin-login-shell) .admin-login-shell { margin: 0; width: 100%; }
body.admin-host .admin-login-panel {
  width: 100%;
  max-width: 400px;
  padding: 28px 26px 24px;
  border: 1px solid #3d2f5c;
  border-radius: 16px;
  background: #241b38;
  color: #f2eefc;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}
body.admin-host .admin-login-mark {
  display: inline-block;
  margin-bottom: 14px;
  padding: 4px 10px;
  border: 1px solid #5b3d99;
  border-radius: 999px;
  background: #3b2a63;
  color: #c4b5fd;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
}
body.admin-host .admin-login-panel h1 { margin: 0 0 8px; font-size: 22px; color: #fff; }
body.admin-host .admin-login-sub { margin: 0 0 6px; color: #c9bfd9; font-size: 13px; }
body.admin-host .admin-login-host { margin: 0 0 18px; font-family: var(--font-mono); font-size: 12px; color: #8b7aad; }
body.admin-host .admin-login-form label { color: #d6cce8; }
body.admin-host .admin-login-form input { background: #1a1428; border-color: #4a3a6e; color: #fff; }
body.admin-host .admin-btn { width: 100%; margin-top: 8px; background: #7c5cbf; border-color: #7c5cbf; }
body.admin-host .admin-btn:hover { background: #8f6fd4; border-color: #8f6fd4; }
body.admin-host .admin-login-foot { margin: 14px 0 0; font-size: 12px; color: #9a8bb5; }
body.admin-host .admin-login-foot a { color: #c4b5fd; }

/* 7 · workbench /app ----------------------------------------------------- */
.wb-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-12) var(--space-lg);
}
.wb-head h1 { margin: 0; font-size: var(--text-xl); line-height: 1.3; font-weight: 700; letter-spacing: -0.01em; }
.wb-head p { margin: 6px 0 0; font-size: var(--text-sm); color: var(--muted); max-width: 52em; }
.wb-head .badge { margin-top: 4px; }

/* section jump links with live counts */
.wb-jump { display: flex; flex-wrap: wrap; gap: var(--space-sm); margin-top: var(--space-md); }
.wb-jump a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  transition: border-color var(--dur) ease, color var(--dur) ease, background var(--dur) ease;
}
.wb-jump a .ico { color: var(--muted); transition: color var(--dur) ease; }
.wb-jump a:hover { border-color: var(--line-strong); color: var(--text); background: var(--surface-2); text-decoration: none; }
.wb-jump a:hover .ico { color: var(--accent-text); }
.wb-count, .wb-live {
  padding: 0 7px;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.7;
  font-variant-numeric: tabular-nums;
}
.wb-count { background: var(--surface-3); color: var(--muted); }
.wb-live { background: var(--info-soft); color: var(--info-text); font-family: var(--font-body); }

/* notice (not approved) */
.notice {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  margin-top: var(--space-lg);
  padding: 18px 20px;
  border: 1px solid var(--warn-line);
  border-radius: var(--radius-lg);
  background: var(--warn-soft);
}
.notice h2 { margin: 2px 0 4px; font-size: var(--text-base); font-family: var(--font-body); }
.notice p { margin: 0; color: var(--text-2); font-size: var(--text-sm); }
.notice-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--warn-line);
  border-radius: var(--radius-md);
  background: var(--bg-deep);
  color: var(--warn-text);
}
.notice-icon .ico { width: 20px; height: 20px; }
.notice-err { border-color: var(--err-line); background: var(--err-soft); }
.notice-err .notice-icon { color: var(--err-text); border-color: var(--err-line); }

/* submit form */
.job-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 0 var(--space-xl); }
.job-links label,
.job-meta .field:first-child label { margin-top: 0; }
.job-links textarea { min-height: 260px; }
.job-meta .field + .field label { margin-top: var(--space-md); }
.delivery-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md) var(--space-xl); margin-top: var(--space-lg); }
.delivery-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.delivery-fieldset legend { margin: 0 0 8px; padding: 0; font-size: var(--text-sm); font-weight: 500; color: var(--text-2); }
.delivery-opts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-sm); }
.delivery-opt {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--field-line);
  border-radius: var(--radius-md);
  background: var(--field);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--dur) ease, background var(--dur) ease, box-shadow var(--dur) ease;
}
.delivery-opt:hover { border-color: var(--field-line-hover); }
.delivery-opt:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.delivery-opt:has(input:focus-visible) { box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--focus-halo); }
.delivery-opt input[type=radio] { flex-shrink: 0; width: 16px; height: 16px; margin: 2px 0 0; }
.opt-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.opt-title { font-size: var(--text-sm); font-weight: 600; line-height: 1.4; }
.opt-sub { font-size: 12px; line-height: 1.4; color: var(--muted); }
.delivery-note { margin-top: var(--space-12); }
.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--space-12) var(--space-md);
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--line);
}
.form-actions .hint { margin: 0 auto 0 0; }

/* share picker + recipients confirm (kept deliberately loud: missed recipients get no link) */
.share-picker {
  max-height: 228px;
  overflow-y: auto;
  margin-top: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}
.share-picker label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 8px 8px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 400;
  cursor: pointer;
  transition: background var(--dur-fast) ease;
}
.share-picker label:hover { background: var(--accent-soft); }
.share-picker input[type=checkbox] { width: 16px; height: 16px; margin-top: 3px; flex-shrink: 0; }
.share-self { opacity: 0.8; cursor: default !important; }
.share-self:hover { background: transparent !important; }
.share-confirm {
  margin-top: var(--space-lg);
  padding: var(--space-md) var(--space-md) var(--space-12);
  border: 1.5px solid var(--alarm);
  border-radius: var(--radius-lg);
  background: var(--alarm-soft);
  box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.12);
}
.share-confirm-pulse { animation: sharePulse 0.9s ease-in-out 2; }
@keyframes sharePulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.12); }
  50% { box-shadow: 0 0 0 7px rgba(244, 63, 94, 0.3); }
}
.share-confirm-banner { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; color: var(--alarm-text); }
.share-confirm-banner strong { font-size: 15px; letter-spacing: 0.01em; }
.share-confirm-banner span { font-size: 13px; line-height: 1.5; font-weight: 500; }
.share-confirm-label { margin-top: 12px; color: var(--alarm-strong); font-weight: 600; }
.share-confirm-hint { color: var(--alarm-text); }
.share-confirm .share-picker { border-color: var(--alarm-line); background: var(--field); }
.share-confirm-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px dashed var(--alarm);
  border-radius: var(--radius-md);
  background: var(--alarm-soft-2);
  color: var(--alarm-strong);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}
.share-confirm-check input[type=checkbox] { width: 16px; height: 16px; margin-top: 3px; flex-shrink: 0; accent-color: var(--alarm); }

/* my jobs */
.jobs-counts { display: flex; flex-wrap: wrap; gap: 6px; }
.jobs-table td { vertical-align: top; }
.jobs-table .col-id { width: 1%; color: var(--faint); font-family: var(--font-mono); font-size: 13px; white-space: nowrap; }
.jobs-table .num { white-space: nowrap; }
.jobs-table td.num { font-family: var(--font-mono); font-size: 13px; font-variant-numeric: tabular-nums; }
.jobs-table .col-act { width: 1%; white-space: nowrap; text-align: right; }
.jobs-table th.col-act { text-align: right; }
.th-note { margin-left: 6px; font-weight: 400; color: var(--faint); font-size: 11.5px; letter-spacing: 0; }
.job-title { min-width: 9em; font-weight: 600; color: var(--text); }
.job-genre { white-space: nowrap; }
.job-error { max-width: 22em; margin-top: 6px; font-size: 12.5px; line-height: 1.5; color: var(--err-text); overflow-wrap: anywhere; }
.job-delivery { font-size: 13px; white-space: nowrap; color: var(--text-2); }
.kv-k { display: inline-block; min-width: 2.4em; margin-right: 4px; color: var(--faint); }
.job-baidu { min-width: 150px; max-width: 240px; }
.job-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  font-family: var(--font-mono);
  font-size: 12.5px;
}
.job-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-link .ico { width: 14px; height: 14px; flex: none; }
.job-pwd { margin-top: 6px; font-size: 12px; color: var(--muted); }
.job-pwd .pwd { padding: 1px 6px; font-size: 12px; }
.job-failed > td { background: rgba(239, 68, 68, 0.04); }
.empty-state p { margin: 0; }
.empty-state .hint { margin-top: 4px; }

/* 8 · 工作台 /app — CloudCLI-style three-pane workbench -------------------
   left  : sessions (one flat list of session rows, search, 新建会话)
   middle: header (title · service dot · views 对话 / 提交请求 / 我的任务) + the view
   right : the selected session's outputs/ (images + file tree)
   Wide: three panes, either side pane collapses. ≤1179px outputs = drawer;
   ≤899px sessions = drawer; ≤768px bottom bar replaces the view tabs. */
body.user-host {
  --wb-side-bg: #0b1120;
  --wb-main-bg: #0f172a;
  --wb-hover: rgba(148, 163, 184, 0.08);
  --wb-soft: rgba(148, 163, 184, 0.05);
  --wb-current: rgba(96, 165, 250, 0.12);
  --wb-current-line: rgba(96, 165, 250, 0.36);
  --wb-head-h: 60px;
  --bubble: #2563eb;
  --on-bubble: #ffffff;
  --bubble-meta: rgba(255, 255, 255, 0.72);
  --claude: #d97757;
}
body.page-app { height: 100vh; height: 100dvh; overflow: hidden; }
body.page-app header.top .inner { max-width: none; min-height: 52px; }
body.page-app main.wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  max-width: none;
  padding: 0;
}
body.page-app .flash {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 12px;
  padding: 9px 8px 9px 14px;
  font-size: var(--text-sm);
}
.flash-x {
  flex: none;
  margin-left: auto;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  font-size: 18px;
  line-height: 1;
  opacity: 0.75;
}
.flash-x:hover { opacity: 1; background: rgba(148, 163, 184, 0.12); }
.ico-sm { width: 12px; height: 12px; }
.ico-caret { width: 12px; height: 12px; opacity: 0.7; }

/* 8.1 shell */
.wb {
  --wb-side-w: 280px;
  --wb-files-w: 320px;
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--wb-side-w) minmax(0, 1fr) var(--wb-files-w);
  grid-template-rows: minmax(0, 1fr);
  background: var(--wb-main-bg);
  overflow: hidden;
}
.wb[data-right="collapsed"],
.wb:not([data-tab="chat"]) { --wb-files-w: 0px; }
.wb[data-right="collapsed"] .wb-files,
.wb:not([data-tab="chat"]) .wb-files { display: none; }
.wb-scrim { position: absolute; inset: 0; z-index: 35; background: rgba(2, 6, 23, 0.62); }

/* 8.2 left: sessions */
.wb-side {
  grid-column: 1;
  grid-row: 1;
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--wb-side-bg);
  border-right: 1px solid var(--line);
}
.ws-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--wb-head-h);
  padding: 8px 8px 8px 14px;
  border-bottom: 1px solid var(--line);
}
.ws-logo {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 6px 18px -8px rgba(34, 197, 94, 0.7);
}
.ws-brand { flex: 1; min-width: 0; }
.ws-name {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.ws-sub { margin: 2px 0 0; overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.3; white-space: nowrap; text-overflow: ellipsis; }
.ws-tools { flex: none; display: flex; gap: 2px; }
.ws-icon {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}
.ws-icon:hover { background: var(--wb-hover); color: var(--text); }
.ws-icon:disabled { opacity: 0.4; cursor: not-allowed; background: transparent; color: var(--muted); }
.ws-close { display: none; }

.ws-search { position: relative; flex: none; margin: 12px 12px 8px; }
.ws-search > .ico {
  position: absolute;
  top: 50%;
  left: 11px;
  width: 15px;
  height: 15px;
  color: var(--faint);
  transform: translateY(-50%);
  pointer-events: none;
}
.ws-search input[type=search] {
  min-height: 36px;
  padding: 6px 10px 6px 34px;
  border-color: var(--line);
  border-radius: 10px;
  background: var(--wb-soft);
  font-family: var(--font-body);
  font-size: 13.5px;
}
.ws-search input[type=search]:focus { background: var(--field); }
.ws-filter {
  flex: none;
  display: flex;
  gap: 3px;
  margin: 0 12px 6px;
  padding: 3px;
  border-radius: 10px;
  background: var(--wb-soft);
}
.ws-filter-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 28px;
  padding: 2px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}
.ws-filter-btn:hover { color: var(--text); }
.ws-filter-btn[aria-pressed="true"] { background: var(--surface-3); color: var(--text); box-shadow: var(--shadow-sm); }
.ws-filter-n { color: var(--faint); font-family: var(--font-mono); font-size: 11px; font-variant-numeric: tabular-nums; }
.ws-filter-n:empty { display: none; }

.ws-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px 8px 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.ws-sessions { margin: 0; padding: 0; list-style: none; }
.ws-row { position: relative; margin: 2px 0; }
.ws-open {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  width: 100%;
  min-height: 48px;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  text-align: left;
  transition: background var(--dur-fast) ease, border-color var(--dur-fast) ease, color var(--dur-fast) ease;
}
.ws-open:hover { background: var(--wb-hover); color: var(--text); }
.ws-open[aria-current="true"] { border-color: var(--wb-current-line); background: var(--wb-current); color: var(--text); }
.ws-ico { position: relative; flex: none; display: inline-flex; margin-top: 2px; color: var(--faint); }
.ws-open[aria-current="true"] .ws-ico { color: var(--info-text); }
.ws-row[data-state="busy"] .ws-ico { color: var(--info-text); }
.ws-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ws-line { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.ws-title { flex: 1 1 auto; min-width: 0; overflow: hidden; color: inherit; font-size: 13.5px; font-weight: 500; line-height: 1.4; white-space: nowrap; text-overflow: ellipsis; }
.ws-open[aria-current="true"] .ws-title { font-weight: 600; }
.ws-time { flex: none; color: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ws-sub { align-items: center; color: var(--faint); font-size: 11.5px; line-height: 1.4; }
.ws-state { display: inline-flex; align-items: center; gap: 5px; min-width: 0; font-weight: 500; white-space: nowrap; }
.ws-state::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ws-row[data-state="busy"] .ws-state { color: var(--info-text); }
.ws-row[data-state="ok"] .ws-state { color: var(--ok-text); }
.ws-row[data-state="err"] .ws-state { color: var(--err-text); }
.ws-row[data-state="warn"] .ws-state { color: var(--warn-text); }
.ws-row[data-state="draft"] .ws-state::before { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }
.ws-files { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ws-files .ico { width: 12px; height: 12px; }
.ws-count {
  flex: none;
  min-width: 22px;
  margin-left: auto;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
/* row actions: "⋯" sits where the message count is, shown on hover / keyboard focus */
.ws-more {
  position: absolute;
  right: 6px;
  bottom: 6px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: var(--surface-3);
  color: var(--text-2);
  opacity: 0;
  transition: opacity var(--dur-fast) ease, background var(--dur-fast) ease;
}
.ws-row:hover .ws-more,
.ws-row:focus-within .ws-more,
.ws-more[aria-expanded="true"] { opacity: 1; }
.ws-row:hover .ws-count,
.ws-row:focus-within .ws-count,
.ws-row:has(.ws-more[aria-expanded="true"]) .ws-count { visibility: hidden; }
.ws-more:hover { background: var(--line-strong); color: var(--text); }
/* finished in the background while you were elsewhere: a dot on the row's icon (busy rows spin instead) */
.ws-row.is-unseen .ws-ico::after {
  content: "";
  position: absolute;
  top: -3px;
  right: -4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 2px var(--wb-side-bg);
}
.ws-empty { margin: 6px 4px; padding: 8px; color: var(--faint); font-size: 12.5px; line-height: 1.55; list-style: none; }
.ws-more-sessions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 34px;
  margin: 2px 0 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
}
.ws-more-sessions:hover { background: var(--wb-hover); color: var(--text); }
.ws-new { flex: none; padding: 10px 12px; border-top: 1px solid var(--line); }
.ws-new-btn { width: 100%; min-height: 40px; border-radius: 10px; }
.ws-locked {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 6px 0 14px;
  padding: 18px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
  text-align: center;
}
.ws-locked p { margin: 0; }
.ws-locked-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--wb-soft); color: var(--warn-text); }
.ws-locked-title { color: var(--text-2); font-size: 13.5px; font-weight: 600; }
.ws-foot { flex: none; padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.ws-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ws-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}
.ws-user-text { flex: 1; min-width: 0; }
.ws-user-name, .ws-user-mail { margin: 0; overflow: hidden; line-height: 1.35; white-space: nowrap; text-overflow: ellipsis; }
.ws-user-name { color: var(--text); font-size: 13px; font-weight: 600; }
.ws-user-mail { color: var(--faint); font-size: 11.5px; }
.ws-links { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 8px; }
.ws-links:not(:has(.ws-link:not(.ws-site))) { display: none; }
.ws-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
}
.ws-link:hover { background: var(--wb-hover); color: var(--text); text-decoration: none; }
.ws-link .ico { width: 15px; height: 15px; }
.ws-site { display: none; }
.ws-rail { display: none; }

/* 8.3 middle: header + views */
.wb-main { grid-column: 2; grid-row: 1; position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.wm-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--wb-head-h);
  padding: 8px 14px 8px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--wb-main-bg);
}
.wm-icon {
  flex: none;
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--text-2);
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.wm-icon:hover { background: var(--wb-hover); color: var(--text); border-color: var(--line-strong); }
.wm-icon[aria-expanded="true"] { color: var(--accent-text); border-color: var(--accent-line); }
.wm-menu { display: none; }
.wm-files-btn { display: none; }
.wb[data-right="collapsed"][data-tab="chat"] .wm-files-btn { display: inline-grid; }
.wm-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  padding: 0 5px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--wb-main-bg);
}
.wm-badge:empty { display: none; }
.wm-title { flex: 1 1 auto; min-width: 0; }
.wm-title-chat, .wm-title-alt { display: flex; flex-direction: column; min-width: 0; }
.wm-title-alt { display: none; }
.wb[data-tab="submit"] .wm-title-chat,
.wb[data-tab="jobs"] .wm-title-chat { display: none; }
.wb[data-tab="submit"] .wm-title-alt[data-for="submit"],
.wb[data-tab="jobs"] .wm-title-alt[data-for="jobs"] { display: flex; }
input.wm-title-input {
  width: 100%;
  min-height: 0;
  margin: 0 0 0 -8px;
  padding: 1px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.45;
  text-overflow: ellipsis;
  cursor: text;
}
input.wm-title-input:hover { border-color: var(--line); background: transparent; }
input.wm-title-input:focus { border-color: var(--info); background: var(--field); box-shadow: 0 0 0 3px var(--focus-halo); }
input.wm-title-input.is-auto::placeholder { color: var(--text); opacity: 1; }
input.wm-title-input:focus::placeholder { color: var(--placeholder); }
input.wm-title-input:disabled { background: transparent; color: var(--text); cursor: default; }
.wm-title-text { margin: 0; overflow: hidden; color: var(--text); font-size: 17px; font-weight: 600; line-height: 1.45; white-space: nowrap; text-overflow: ellipsis; }
.wm-sub {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 2px 12px;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
  white-space: nowrap;
}
.wm-sub > span { flex: none; }
.wm-sub > span:last-child { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.wm-pv { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); font-weight: 500; }
.wm-pv .ico { width: 13px; height: 13px; color: var(--accent-text); }
.wm-right { flex: none; display: flex; align-items: center; gap: 10px; min-width: 0; }
.wm-head .cx-gw { margin: 0; padding: 4px 11px 4px 10px; font-size: 12.5px; }
.wm-tabs {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--wb-soft);
}
.wm-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 4px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}
.wm-tab:hover { background: var(--wb-hover); color: var(--text); }
.wm-tab[aria-selected="true"] { background: var(--surface-3); color: var(--text); box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.05); }
.wm-tab .ico { width: 15px; height: 15px; }
.wm-tab[aria-selected="true"] > .ico { color: var(--accent-text); }
.wm-tab .wb-count, .wm-tab .wb-live { font-size: 11px; }

.wm-panels { position: relative; flex: 1 1 auto; min-height: 0; }
.wm-panel { position: absolute; inset: 0; display: flex; flex-direction: column; min-height: 0; }
.wm-panel:focus { outline: none; }
.wb.js .wm-panel { display: none; }
.wb.js[data-tab="chat"] .wm-panel[data-panel="chat"],
.wb.js[data-tab="submit"] .wm-panel[data-panel="submit"],
.wb.js[data-tab="jobs"] .wm-panel[data-panel="jobs"] { display: flex; }
.wb:not(.js) .wm-panels { overflow-y: auto; }
.wb:not(.js) .wm-panel { position: static; display: block; }
.wm-docpanel { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.wm-doc { width: 100%; max-width: 1080px; margin: 0 auto; padding: 4px 24px 40px; }
.wm-doc > .card { margin-top: 20px; }
/* the view title already sits in the header: keep the card's h2 for screen readers only */
.wm-doc .section-head h2 { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.wm-doc .section-head { align-items: center; margin-bottom: var(--space-md); }

/* bottom bar (phones) */
.wb-bottom {
  display: none;
  flex: none;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 2px;
  padding: 4px 6px 6px;
  border-top: 1px solid var(--line);
  background: var(--wb-side-bg);
}
.wb-bn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
  padding: 4px 2px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11.5px;
  font-weight: 500;
}
.wb-bn .ico { width: 21px; height: 21px; }
.wb-bn[aria-current="page"] { color: var(--accent-text); background: var(--accent-soft); }
.wb-bn-badge {
  position: absolute;
  top: 4px;
  left: calc(50% + 6px);
  min-width: 17px;
  padding: 0 4px;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
}
.wb-bn-badge:empty { display: none; }
.wb-bn-badge.is-live { background: var(--info); color: #0b1120; }

/* 8.4 right: session outputs */
.wb-files {
  grid-column: 3;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--wb-side-bg);
  border-left: 1px solid var(--line);
}
.wf-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: var(--wb-head-h);
  padding: 8px 8px 8px 16px;
  border-bottom: 1px solid var(--line);
}
.wf-head h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
}
.wf-head h2 > .ico { color: var(--muted); }
.wf-tools { display: flex; gap: 2px; }
.ws-icon[aria-busy="true"] .ico { animation: cxSpin 0.9s linear infinite; }
.wf-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.wf-sec h3 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 8px;
  color: var(--faint);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.wf-sec h3 .ico { width: 14px; height: 14px; }
.wf-tree .wf-list { margin: 0; padding: 0; list-style: none; }
.wf-tree .wf-list .wf-list { margin-left: 15px; padding-left: 6px; border-left: 1px solid var(--line); }
.wf-row {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 34px;
  padding: 5px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  text-align: left;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}
.wf-row:hover { background: var(--wb-hover); color: var(--text); text-decoration: none; }
.wf-row .ico { flex: none; width: 15px; height: 15px; color: var(--faint); }
.wf-row.is-dir .ico:first-child { width: 12px; height: 12px; }
.wf-row.is-dir .ico:nth-child(2) { color: var(--warn-text); opacity: 0.85; }
.wf-row.is-file .ico:first-child { color: var(--info-text); opacity: 0.85; }
.wf-name { flex: 1; min-width: 0; overflow: hidden; font-family: var(--font-mono); font-size: 12.5px; white-space: nowrap; text-overflow: ellipsis; }
.wf-size, .wf-meta { flex: none; color: var(--faint); font-family: var(--font-mono); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.wf-row .wf-dl { opacity: 0; transition: opacity var(--dur-fast) ease; }
.wf-row:hover .wf-dl, .wf-row:focus-visible .wf-dl { opacity: 1; color: var(--accent-text); }
@media (hover: none) { .wf-row .wf-dl { opacity: 0.8; } .ws-more { opacity: 1; } .ws-count { visibility: hidden; } }
/* flat skill-job outputs: always show download affordance */
.wf-tree.is-flat-outputs .wf-row .wf-dl { opacity: 0.85; }
.wf-tree.is-flat-outputs .wf-row.is-file { cursor: pointer; }
.wf-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: auto 0;
  padding: 16px 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}
.wf-empty p { margin: 0; }
.wf-empty .ico { color: var(--line-strong); }
.wf-empty-title { color: var(--text-2); font-size: 14px; font-weight: 600; }
.wf-foot { flex: none; margin: 0; padding: 9px 16px 11px; border-top: 1px solid var(--line); color: var(--faint); font-size: 11.5px; }

/* 8.5 conversation */
.wm-chat { background: var(--wb-main-bg); }
.cx-lock-note {
  flex: none;
  margin: 12px 24px 0;
  padding: 10px 14px;
  border: 1px solid var(--err-line);
  border-radius: var(--radius-md);
  background: var(--err-soft);
  color: var(--err-text);
  font-size: var(--text-sm);
  font-weight: 500;
}
.cx-window { position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
/* a thin running bar instead of a glowing frame */
.cx-window::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--info) 50%, transparent);
  background-size: 45% 100%;
  background-repeat: no-repeat;
  opacity: 0;
  pointer-events: none;
}
.cx-window:is([data-state="creating"], [data-state="submitting"], [data-state="queued"], [data-state="running"],
  [data-state="tools"], [data-state="continuing"], [data-state="imaging"])::before { opacity: 1; }
.cx-thread {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 26px 24px 18px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.cx-thread:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.cx-col { width: 100%; max-width: 860px; margin: 0 auto; }
.cx-thread > .cx-col { min-height: 100%; display: flex; flex-direction: column; }
.cx-turns { display: flex; flex-direction: column; gap: 26px; margin: 0; padding: 0; list-style: none; }
.cx-turns:empty { display: none; }
.cx-turn { min-width: 0; }

/* empty session: a short welcome; the assistant is picked from the composer chip */
.cx-intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: auto 0;
  padding: 12px 0 18px;
  text-align: center;
}
.cx-intro-logo {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 14px;
  border: 1px solid var(--accent-line);
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent-text);
}
.cx-intro-logo .ico { width: 24px; height: 24px; }
.cx-intro-logo[data-provider="claude"] { border-color: rgba(217, 119, 87, 0.4); background: rgba(217, 119, 87, 0.14); color: #eba68c; }
.cx-intro-title { margin: 0; color: var(--text); font-family: var(--font-heading); font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.cx-intro-text { max-width: 36em; margin: 8px 0 0; color: var(--muted); font-size: 14px; line-height: 1.65; }
.cx-intro .notice { width: 100%; max-width: 560px; margin: 0 0 6px; text-align: left; }
.cx-intro-hint { display: inline-flex; align-items: center; gap: 5px; margin: 6px 0 0; color: var(--faint); font-size: 12.5px; }
.cx-intro-hint .ico { width: 13px; height: 13px; }
.cx-intro-note {
  max-width: 40em;
  margin: 14px 0 0;
  padding: 7px 12px;
  border: 1px solid var(--warn-line);
  border-radius: var(--radius-md);
  background: var(--warn-soft);
  color: var(--warn-text);
  font-size: 13px;
  line-height: 1.55;
}
.cx-intro .cx-examples { justify-content: center; margin-top: 18px; }

/* user turns: blue bubble + avatar on the right */
.cx-turn.is-user,
.cx-turn-user { display: flex; justify-content: flex-end; align-items: flex-end; gap: 10px; }
.cx-user-col { display: flex; flex-direction: column; align-items: flex-end; min-width: 0; max-width: min(80%, 640px); }
.cx-bubble {
  max-width: 100%;
  padding: 10px 15px 7px;
  border-radius: 18px 18px 6px 18px;
  background: var(--bubble);
  color: var(--on-bubble);
  font-size: 15px;
  line-height: 1.65;
  box-shadow: 0 8px 22px -14px rgba(37, 99, 235, 0.9);
}
.cx-bubble-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.cx-bubble-time { display: block; margin-top: 3px; color: var(--bubble-meta); font-size: 11.5px; text-align: right; font-variant-numeric: tabular-nums; }
.cx-bubble-tag { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 4px; color: #dbeafe; font-size: 12px; font-weight: 600; }
.cx-bubble-tag .ico { width: 14px; height: 14px; }
.cx-uavatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-bottom: 2px;
  border-radius: 50%;
  background: var(--bubble);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}
.cx-turn-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px 10px; margin-top: 6px; padding: 0 2px; color: var(--faint); font-size: 12px; }
.cx-turn-meta .is-err { color: var(--err-text); }
.cx-turn-meta .is-ok { color: var(--ok-text); }
.cx-strip { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cx-strip-img {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-sm);
  background: var(--bg-deep);
  color: var(--faint);
  cursor: zoom-in;
}
.cx-strip-img:disabled { cursor: default; }
.cx-strip-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cx-strip.is-small { justify-content: center; margin-top: 6px; }
.cx-strip.is-small .cx-strip-img { width: 34px; height: 34px; border-color: var(--line); }
/* direct image request: a quieter bubble + the tool result under it */
.cx-turn.is-image .cx-bubble { border: 1px solid rgba(96, 165, 250, 0.32); background: rgba(37, 99, 235, 0.16); color: var(--text); box-shadow: none; }
.cx-turn.is-image .cx-bubble-time { color: var(--faint); }
.cx-turn.is-image .cx-bubble-tag { color: var(--info-text); }
.cx-tool-row { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 0 12px; margin-top: 14px; }

/* assistant turns: avatar + name row, body full width */
.cx-agent-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; min-height: 34px; margin-bottom: 8px; color: var(--muted); font-size: 12.5px; }
.cx-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--accent-line);
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-text);
}
.cx-avatar.is-tool { border-color: var(--info-line); background: var(--info-soft); color: var(--info-text); }
.cx-agent-name { color: var(--text); font-size: 15px; font-weight: 600; }
.cx-agent-round { padding: 0 8px; border: 1px dashed var(--line-strong); border-radius: var(--radius-full); color: var(--muted); font-size: 11.5px; }
.cx-run-id { color: var(--faint); font-size: 11.5px; }
.cx-turn-time { margin-left: auto; color: var(--faint); font-family: var(--font-mono); font-size: 12px; font-variant-numeric: tabular-nums; }
.cx-agent-body { min-width: 0; }
.cx-agent-note { margin: 8px 0 0; color: var(--warn-text); font-size: 13px; }
.cx-agent-err {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 8px 0 0;
  padding: 9px 12px;
  border: 1px solid var(--err-line);
  border-radius: var(--radius-md);
  background: var(--err-soft);
  color: var(--err-text);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.cx-agent-err .ico { margin-top: 3px; }
.cx-agent-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; margin-top: 8px; }
.cx-ai-label { display: inline-flex; align-items: center; gap: 6px; margin-right: auto; color: var(--faint); font-size: 12px; font-weight: 500; }
.cx-ai-label .ico { width: 14px; height: 14px; color: var(--accent-text); }
.wm-chat.is-busy :is([data-act="rerun"], [data-act="resend"], [data-act="resume"]),
.wm-chat.is-locked :is([data-act="rerun"], [data-act="resend"], [data-act="resume"]) { display: none; }

/* markdown-lite output (AI generated) */
.cx-md { color: var(--text-2); font-size: 15px; line-height: 1.75; overflow-wrap: anywhere; }
.cx-md p, .cx-md ul, .cx-md ol, .cx-md blockquote, .cx-md pre { margin: 0 0 10px; }
.cx-md > :last-child { margin-bottom: 0; }
.cx-md ul, .cx-md ol { padding-left: 1.4em; }
.cx-md ul { list-style: disc; }   /* turns live in an <ol>; don't inherit nested-list circles */
.cx-md ol { list-style: decimal; }
.cx-md li + li { margin-top: 3px; }
.cx-md li::marker { color: var(--faint); }
.cx-md strong { color: var(--text); font-weight: 600; }
.cx-md .cx-h { margin: 16px 0 6px; color: var(--text); font-size: 15.5px; font-weight: 600; line-height: 1.5; }
.cx-md .cx-h1 { font-size: 16.5px; }
.cx-md > .cx-h:first-child { margin-top: 0; }
.cx-md code { padding: 1px 6px; border-radius: 5px; background: var(--surface-3); color: #e2e8f0; font-size: 0.86em; }
.cx-md pre.cx-code {
  padding: 10px 12px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(2, 6, 23, 0.45);
  font-size: 13px;
  line-height: 1.65;
}
.cx-md pre.cx-code code { padding: 0; background: none; font-size: inherit; white-space: pre; }
.cx-md blockquote { padding-left: 12px; border-left: 3px solid var(--line-strong); color: var(--muted); }
.cx-md hr { margin: 14px 0; border: 0; border-top: 1px solid var(--line); }
.cx-md-img {
  display: inline-block;
  max-width: 220px;
  margin: 4px 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-3);
  vertical-align: top;
  cursor: zoom-in;
}
.cx-md-img img { display: block; max-width: 100%; max-height: 280px; object-fit: contain; }
.cx-md-img:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

/* tool call card (CloudCLI "Using …" → parameters → tool result) */
.cx-tool {
  max-width: 680px;
  margin: 12px 0;
  overflow: hidden;
  border: 1px solid var(--info-line);
  border-radius: 14px;
  background: rgba(96, 165, 250, 0.06);
  transition: border-color var(--dur-slow) ease;
}
.cx-tool-row .cx-tool { margin: 0; }
.cx-tool[data-state="error"] { border-color: var(--err-line); background: rgba(239, 68, 68, 0.05); }
.cx-tool[data-state="skipped"] { border-color: var(--warn-line); background: rgba(251, 191, 36, 0.04); }
.cx-tool-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: 11px 14px 8px; color: var(--info-text); font-size: 13px; }
.cx-tool-ico { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: var(--info); color: #0b1120; }
.cx-tool-ico .ico { width: 14px; height: 14px; }
.cx-tool-name { color: var(--info-text); font-size: 14.5px; font-weight: 600; }
.cx-tool-params { color: var(--muted); font-family: var(--font-mono); font-size: 12px; }
.cx-tool-state { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 600; }
.cx-tool:is([data-state="running"], [data-state="queued"]) .cx-tool-state { color: var(--info-text); }
.cx-tool[data-state="done"] .cx-tool-state { color: var(--ok-text); }
.cx-tool[data-state="error"] .cx-tool-state { color: var(--err-text); }
.cx-tool[data-state="skipped"] .cx-tool-state { color: var(--warn-text); }
.cx-tool-prompt {
  display: -webkit-box;
  margin: 0;
  padding: 0 14px;
  overflow: hidden;
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}
.cx-tool-args { margin: 6px 14px 0; }
.cx-tool-args summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  color: var(--link);
  font-size: 13px;
  font-weight: 500;
  list-style: none;
}
.cx-tool-args summary::-webkit-details-marker { display: none; }
.cx-tool-args summary .ico { width: 12px; height: 12px; transition: transform var(--dur) ease; }
.cx-tool-args[open] summary .ico { transform: rotate(90deg); }
.cx-tool-json {
  margin: 4px 0 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.5);
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.cx-tool-out { margin-top: 8px; padding: 0 0 2px; border-top: 1px solid var(--info-line); }
.cx-tool[data-state="error"] .cx-tool-out { border-top-color: var(--err-line); }
.cx-tool-result { display: flex; align-items: center; gap: 7px; margin: 0; padding: 9px 14px 0; color: var(--ok-text); font-size: 13px; font-weight: 600; }
.cx-tool-result .ico { width: 16px; height: 16px; }
.cx-tool .cx-shots { padding: 10px 14px 12px; grid-template-columns: repeat(auto-fill, minmax(140px, 180px)); }
.cx-tool-err { margin: 0; padding: 10px 14px; color: var(--err-text); font-size: 13px; overflow-wrap: anywhere; }
.cx-tool-note { margin: 0; padding: 0 14px 11px; color: var(--faint); font-size: 12px; overflow-wrap: anywhere; }
.cx-tool-err + .cx-tool-note,
.cx-tool-result + .cx-tool-note { padding-top: 8px; }
.cx-tool-note.is-ok { color: var(--ok-text); }
.cx-tool-note.is-err { color: var(--err-text); }

/* portal → Codex hand-off (tool result) */
.cx-turn.is-note { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.cx-note {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  max-width: 92%;
  padding: 5px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-full);
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}
.cx-note .ico { width: 14px; height: 14px; color: var(--accent-text); }
.cx-note-err { margin: 2px 0 0; color: var(--err-text); font-size: 12px; text-align: center; }

/* images */
.cx-shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--space-12); align-items: start; }
.cx-shot { margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--bg-deep); }
.cx-shot-img { position: relative; display: block; width: 100%; padding: 0; border: 0; background: var(--surface-3); cursor: zoom-in; }
.cx-shot-img:disabled { cursor: default; }
.cx-shot-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cx-shot-img:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.cx-shot-gone { position: absolute; inset: 0; display: grid; place-items: center; padding: 8px; color: var(--faint); font-size: 12px; text-align: center; }
.cx-shot figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 6px 6px 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.cx-shot-no { color: var(--text-2); font-family: var(--font-mono); font-weight: 600; }
.cx-shot-tag { display: inline-flex; align-items: center; gap: 4px; }
.cx-shot-tag .ico { width: 12px; height: 12px; color: var(--accent-text); }
.cx-shot.is-skeleton figcaption { padding-top: 10px; padding-bottom: 10px; }
.cx-shot.is-skeleton .cx-shot-img {
  background: linear-gradient(100deg, var(--surface-3) 30%, rgba(148, 163, 184, 0.22) 50%, var(--surface-3) 70%);
  background-size: 300% 100%;
  cursor: default;
}

/* typing */
.cx-typing { display: flex; align-items: center; gap: 10px; margin: 18px 0 0; color: var(--info-text); font-size: 13px; }
.cx-dots { display: inline-flex; gap: 4px; }
.cx-dots i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.4; }

/* produced files inside a turn */
.cx-produced { margin-top: 12px; }
.cx-produced-head { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; color: var(--faint); font-size: 12px; font-weight: 600; letter-spacing: 0.02em; }
.cx-produced-head .ico { width: 14px; height: 14px; }
.cx-produced .cx-file-list { max-width: 560px; }

/* file list */
.cx-file-list { margin: 0; padding: 0; overflow: hidden; list-style: none; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--wb-soft); }
.cx-file { border-top: 1px solid var(--line); }
.cx-file:first-child { border-top: 0; }
.cx-file-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 7px 12px;
  color: var(--text);
  font-size: 13px;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}
.cx-file-link:hover { background: var(--accent-soft); color: var(--accent-text); text-decoration: none; }
.cx-file-link .ico { color: var(--muted); }
.cx-file-link:hover .ico { color: var(--accent-text); }
.cx-file-name { flex: 1; min-width: 0; overflow: hidden; font-family: var(--font-mono); font-size: 12.5px; white-space: nowrap; text-overflow: ellipsis; }
.cx-file-size { color: var(--muted); font-family: var(--font-mono); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cx-files-note {
  margin: 8px 0 0;
  padding: 10px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.cx-files-note.is-err { border-color: var(--err-line); color: var(--err-text); }

/* thumbnails */
.cx-thumbs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.cx-thumbs.is-inline { grid-template-columns: repeat(auto-fill, minmax(88px, 112px)); margin-bottom: 8px; }
.cx-thumb {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-3);
  cursor: zoom-in;
}
.cx-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform var(--dur) var(--ease-out); }
.cx-thumb:hover img { transform: scale(1.04); }
.cx-thumb:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.cx-thumb.is-broken img { opacity: 0; }
.cx-thumb.is-broken::after { content: "无法预览"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); font-size: 11px; }

/* ---- bulk image gallery (P0) ---- */
.wf-gallery-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 10px;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--line);
}
.wf-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.wf-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.wf-chip:hover { color: var(--text); border-color: var(--line-strong); }
.wf-chip.is-on {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent-text);
}
.wf-chip .cx-count { margin-left: 2px; opacity: 0.85; font-family: var(--font-mono); font-weight: 500; }
.wf-gallery-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.wf-gallery-actions .btn { font-size: 12px; }
.wf-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}
.wf-toggle input { margin: 0; }
.wf-gallery-hint {
  margin: 0;
  color: var(--faint);
  font-size: 11.5px;
  line-height: 1.4;
}
.wf-more {
  margin: 8px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}
.cx-thumbs.is-gallery {
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
}
.cx-thumb-wrap {
  position: relative;
  border-radius: var(--radius-md);
}
.cx-thumb-wrap .cx-thumb { width: 100%; }
.cx-thumb-check {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 2;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent, #3b82f6);
  cursor: pointer;
}
.cx-thumb-wrap.is-selected .cx-thumb {
  outline: 2px solid var(--accent, #3b82f6);
  outline-offset: 1px;
}
.cx-thumb-wrap.is-selected::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-md);
  box-shadow: inset 0 0 0 999px rgba(59, 130, 246, 0.12);
  pointer-events: none;
}
.cx-viewer-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}
.cx-viewer-nav:hover { background: rgba(29, 78, 216, 0.9); }
.cx-viewer-nav.is-prev { left: 10px; }
.cx-viewer-nav.is-next { right: 10px; }
.cx-viewer-nav[hidden] { display: none !important; }
dialog.cx-viewer { position: relative; }

/* dock + composer (CloudCLI: rounded box, round send button, hint line) */
.cx-dock { position: relative; flex: none; padding: 4px 24px 14px; background: var(--wb-main-bg); }
.cx-jump {
  position: absolute;
  top: -54px;
  right: 28px;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--bubble);
  color: #fff;
  box-shadow: var(--shadow-lg), 0 0 0 4px rgba(15, 23, 42, 0.6);
}
.cx-jump:hover { background: #1d4ed8; }
.cx-jump .ico { width: 20px; height: 20px; }
.cx-composer {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--field-line);
  border-radius: 18px;
  background: var(--field);
  box-shadow: var(--shadow-lg);
  transition: border-color var(--dur) ease, box-shadow var(--dur) ease;
}
.cx-composer:hover { border-color: var(--field-line-hover); }
.cx-composer:focus-within { border-color: var(--info); box-shadow: var(--shadow-lg), 0 0 0 3px var(--focus-halo); }
.cx-composer.is-image { border-color: var(--accent-line); }
.cx-composer.is-image:focus-within { border-color: var(--accent); box-shadow: var(--shadow-lg), 0 0 0 3px var(--accent-soft); }
.cx-composer.is-invalid { border-color: var(--err); box-shadow: 0 0 0 3px var(--err-soft); }
.cx-composer.is-drop {
  border-color: var(--accent);
  box-shadow: var(--shadow-lg), 0 0 0 3px var(--accent-soft);
  background: color-mix(in srgb, var(--accent-soft) 55%, var(--field));
}
.cx-composer.is-drop::after {
  content: "松开以附上图片/文件";
  display: block;
  padding: 6px 12px 0;
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}
.cx-chip-img.is-file {
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--muted);
}
.cx-chip-img.is-file .ico { width: 18px; height: 18px; }
.cx-strip-img.is-file {
  display: grid;
  grid-template-rows: auto auto;
  place-items: center;
  gap: 2px;
  padding: 4px 3px;
  width: auto;
  min-width: 46px;
  max-width: 88px;
  height: auto;
  min-height: 46px;
  cursor: default;
  color: var(--muted);
  background: var(--surface-3);
  border-color: var(--line);
}
.cx-strip-img.is-file .ico { width: 18px; height: 18px; }
.cx-strip-img.is-file .cx-strip-fname {
  display: block;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  line-height: 1.2;
  color: var(--muted);
}
.cx-strip.is-small .cx-strip-img.is-file { min-width: 34px; max-width: 72px; min-height: 34px; }
.cx-strip.is-small .cx-strip-img.is-file .cx-strip-fname { max-width: 64px; font-size: 9px; }
.cx-composer.is-locked { border-style: dashed; background: var(--surface-2); box-shadow: none; }
.cx-input { display: flex; align-items: flex-end; gap: 8px; padding: 6px 8px 6px 4px; }
.cx-composer textarea.cx-composer-body {
  flex: 1;
  display: block;
  min-height: 52px;
  max-height: 240px;
  padding: 10px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  resize: none;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.65;
}
.cx-composer textarea.cx-composer-body:focus { box-shadow: none; }
.cx-composer textarea.cx-composer-body:disabled { background: transparent; }
.cx-send { flex: none; display: flex; align-items: center; gap: 6px; padding-bottom: 5px; }
.cx-run, .cx-stop {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  transition: background var(--dur) ease, color var(--dur) ease, box-shadow var(--dur) ease, transform var(--dur-fast) ease;
}
.cx-run { border: 0; background: var(--accent); color: var(--on-accent); box-shadow: 0 6px 16px -8px rgba(34, 197, 94, 0.8); }
.cx-run:hover { background: var(--accent-hover); }
.cx-run.is-empty:not(:disabled) { background: var(--surface-3); color: var(--muted); box-shadow: none; }
.cx-run.is-empty:not(:disabled):hover { background: var(--line-strong); color: var(--text); }
.cx-run:active, .cx-stop:active { transform: scale(0.95); }
.cx-run:disabled { background: var(--surface-3); color: var(--faint); box-shadow: none; cursor: not-allowed; transform: none; }
.cx-run .ico, .cx-stop .ico { width: 18px; height: 18px; }
.cx-stop { border: 1px solid var(--err-line); background: var(--err-soft); color: var(--err-text); }
.cx-stop:hover { background: rgba(239, 68, 68, 0.2); }
.cx-composer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding: 7px 10px 8px 12px;
  border-top: 1px solid var(--line);
}
.cx-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; min-width: 0; }
.cx-chip-btn,
.cx-tool-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 3px 12px 3px 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--dur) ease, background var(--dur) ease, color var(--dur) ease;
}
.cx-chip-btn:hover, .cx-tool-toggle:hover { border-color: var(--field-line-hover); background: var(--btn2-bg-hover); color: var(--text); }
.cx-chip-btn[aria-expanded="true"] { border-color: var(--info-line); color: var(--text); }
.cx-chip-btn:disabled, .cx-tool-toggle:disabled { opacity: 0.45; cursor: not-allowed; }
.cx-chip-btn[data-fixed="1"] .ico-caret { opacity: 0.35; }
.cx-chip-text { display: inline-flex; align-items: baseline; gap: 4px; min-width: 0; max-width: 14em; }
.cx-chip-model { color: var(--muted); font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 9em; }
.cx-effort-btn { padding-left: 10px; }
.cx-effort-k { font-size: 12px; font-weight: 600; letter-spacing: 0.02em; color: var(--muted); }
.cx-effort-btn[aria-expanded="true"] { border-color: var(--accent-line); }
.wb-menu[data-kind="provider"] { min-width: 260px; max-width: min(360px, 94vw); max-height: min(70vh, 520px); overflow: auto; }
.wb-menu[data-kind="provider"] .wb-menu-desc { font-family: var(--font-mono); font-size: 11px; }
.cx-chip-logo { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-text); }
.cx-chip-logo .ico { width: 13px; height: 13px; }
.cx-chip-btn[data-provider="claude"] .cx-chip-logo { background: rgba(217, 119, 87, 0.14); color: #eba68c; }
.cx-tool-toggle[aria-pressed="true"] { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-text); }
.cx-img-opts { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
label.cx-inline-field { display: inline-flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); font-size: 13px; font-weight: 500; }
.cx-inline-field select { width: auto; min-width: 0; min-height: 32px; padding: 3px 30px 3px 10px; font-size: 13px; }
.cx-inline-field input[type=number] { width: 56px; min-height: 32px; padding: 3px 6px; font-family: var(--font-mono); font-size: 13px; text-align: center; }
.cx-status { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.cx-elapsed { color: var(--muted); font-family: var(--font-mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.cx-elapsed:empty { display: none; }
.cx-hint { margin: 8px 0 0; color: var(--faint); font-size: 12px; text-align: center; }
.btn-ico { display: inline-flex; }
kbd {
  display: inline-block;
  min-width: 1.8em;
  padding: 0 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface-3);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
  text-align: center;
}
.cx-field-error { margin: 8px 2px 0; color: var(--err-text); font-size: 13px; font-weight: 500; }
.wm-chat.is-locked .cx-dock { opacity: 0.6; }

/* status pill + service status (a quiet dot while all is well; a chip only when something is off) */
.cx-gw {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  margin: 0;
  padding: 5px 12px 5px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--bg-deep);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}
.cx-gw > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.cx-gw .ico { width: 14px; height: 14px; }
.cx-gw-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.cx-gw[data-state="ok"],
.cx-gw[data-state="checking"] { gap: 6px; border-color: transparent; background: transparent; color: var(--faint); }
.cx-gw[data-state="ok"] .cx-gw-dot { width: 7px; height: 7px; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.cx-gw[data-state="warn"] { border-color: var(--warn-line); background: var(--warn-soft); color: var(--warn-text); }
.cx-gw[data-state="warn"] .cx-gw-dot { background: var(--warn); }
.cx-gw[data-state="err"] { border-color: var(--err-line); background: var(--err-soft); color: var(--err-text); }
.cx-gw[data-state="err"] .cx-gw-dot { background: var(--err); }
.cx-gw[data-state="locked"] { color: var(--muted); }
.cx-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 1px 11px 1px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.75;
  white-space: nowrap;
}
.cx-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.cx-pill:is([data-state="creating"], [data-state="submitting"], [data-state="queued"], [data-state="running"],
  [data-state="tools"], [data-state="continuing"], [data-state="imaging"]) { border-color: var(--info-line); background: var(--info-soft); color: var(--info-text); }
.cx-pill[data-state="completed"] { border-color: var(--ok-line); background: var(--ok-soft); color: var(--ok-text); }
.cx-pill:is([data-state="failed"], [data-state="error"]) { border-color: var(--err-line); background: var(--err-soft); color: var(--err-text); }
.cx-pill[data-state="stopped"] { border-color: var(--warn-line); background: var(--warn-soft); color: var(--warn-text); }
.cx-id { display: inline-flex; align-items: baseline; gap: 6px; min-width: 0; }
.cx-id-k { color: var(--faint); }
.cx-id code { color: var(--text-2); font-size: 12px; }
.cx-meta-idle { color: var(--faint); }
.cx-count {
  padding: 0 7px;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.7;
}
.cx-count:empty { display: none; }

/* pending images: ride along with the next message */
.cx-attach { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px 2px; }
.cx-attach-label { display: flex; flex-basis: 100%; align-items: center; gap: 6px; margin: 0; color: var(--muted); font-size: 12px; }
.cx-attach-label .ico { width: 14px; height: 14px; color: var(--accent-text); }
.cx-attach.is-loading .cx-attach-label,
.cx-attach-label.is-loading { color: var(--accent-text); }
.cx-attach-spin {
  display: inline-block;
  width: 12px; height: 12px;
  margin-left: 4px;
  border: 2px solid rgba(148, 163, 184, 0.35);
  border-top-color: var(--accent-text);
  border-radius: 50%;
  animation: cxAttachSpin 0.8s linear infinite;
  vertical-align: -1px;
}
@keyframes cxAttachSpin { to { transform: rotate(360deg); } }
.cx-composer.is-attach-loading .cx-run { opacity: 0.7; }

.cx-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
}
.cx-chip-img { flex: none; width: 36px; height: 36px; padding: 0; overflow: hidden; border: 0; border-radius: 7px; background: var(--surface-3); cursor: zoom-in; }
.cx-chip-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cx-chip-name { min-width: 0; max-width: 16em; overflow: hidden; font-family: var(--font-mono); font-size: 11.5px; white-space: nowrap; text-overflow: ellipsis; }
.cx-chip-x {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.cx-chip-x:hover { background: var(--btn2-bg-hover); color: var(--text); }
.cx-chip-x .ico { width: 14px; height: 14px; }

/* examples */
.cx-examples { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; color: var(--muted); font-size: 13px; }
.cx-example {
  min-height: 30px;
  padding: 3px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color var(--dur) ease, color var(--dur) ease, background var(--dur) ease;
}
.cx-example:hover { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-text); }

/* popover menu (session actions, assistant picker) */
.wb-menu {
  position: fixed;
  z-index: 60;
  min-width: 210px;
  max-width: min(320px, 92vw);
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-xl);
}
.wb-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  text-align: left;
}
.wb-menu-item:hover, .wb-menu-item:focus-visible { outline: none; background: var(--wb-hover); }
.wb-menu-item .ico { color: var(--muted); }
.wb-menu-item[aria-checked="true"]::after {
  content: "";
  width: 8px;
  height: 8px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--info);
}
.wb-menu-item[aria-disabled="true"] { color: var(--faint); cursor: not-allowed; }
.wb-menu-item[aria-disabled="true"]:hover { background: var(--wb-soft); }
.wb-menu-item.is-danger, .wb-menu-item.is-danger .ico { color: var(--err-text); }
.wb-menu-label { flex: 1; min-width: 0; }
.wb-menu-head { margin: 2px 0 2px; padding: 4px 10px 2px; color: var(--faint); font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em; }
.wb-menu-item.has-desc { min-height: 48px; padding-top: 7px; padding-bottom: 7px; }
.wb-menu-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.wb-menu-text .wb-menu-label { flex: none; font-weight: 500; }
.wb-menu-desc { color: var(--faint); font-size: 12px; line-height: 1.4; }
.wb-menu-item[aria-disabled="true"] .wb-menu-desc { color: var(--warn-text); opacity: 0.85; }
.wb-menu-note { flex: none; color: var(--faint); font-family: var(--font-mono); font-size: 11.5px; }
.wb-menu-note.is-off { color: var(--warn-text); font-family: var(--font-body); font-weight: 600; }
.wb-menu-sep { height: 1px; margin: 4px 6px; background: var(--line); }

/* image viewer */
dialog.cx-viewer {
  width: fit-content;
  min-width: min(360px, 94vw);
  max-width: min(94vw, 980px);
  max-height: 94vh;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xl);
}
dialog.cx-viewer::backdrop, dialog.wb-dialog::backdrop { background: rgba(2, 6, 23, 0.8); }
.cx-viewer-img { display: block; max-width: min(94vw, 980px); max-height: calc(94vh - 58px); margin: 0 auto; object-fit: contain; background: #020617; }
.cx-viewer-bar { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 14px; border-top: 1px solid var(--line); }
.cx-viewer-cap { flex: 1; min-width: 0; overflow: hidden; color: var(--muted); font-family: var(--font-mono); font-size: 12.5px; white-space: nowrap; text-overflow: ellipsis; }

/* legacy webhook — kept, moved into a dialog off the sidebar */
dialog.wb-dialog[open] {
  display: block;
  z-index: 100;
}
dialog.wb-dialog {
  width: min(560px, 94vw);
  max-height: 92vh;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xl);
}
.wb-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 10px 4px 18px; }
.wb-dialog-head h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-family: var(--font-body); font-size: 16px; font-weight: 600; }
.wb-dialog-note { margin: 4px 18px 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.cx-legacy-state:empty { display: none; }
.cx-legacy-state { padding: 0 8px; border-radius: var(--radius-full); background: var(--surface-3); color: var(--muted); font-size: 11.5px; font-weight: 600; }
.cx-legacy-state[data-ok="1"] { background: var(--ok-soft); color: var(--ok-text); }
.cx-legacy-form { margin: 0; padding: 0 18px 18px; }
.cx-legacy-form textarea { font-family: var(--font-body); font-size: 15px; }
.cx-legacy-actions { margin-top: var(--space-12); }

/* 9 · responsive -------------------------------------------------------- */
@media (min-width: 900px) {
  /* collapsed sessions pane: an icon rail */
  .wb[data-left="collapsed"] { --wb-side-w: 64px; }
  .wb[data-left="collapsed"] .wb-side > :not(.ws-rail) { display: none; }
  .wb[data-left="collapsed"] .ws-rail { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 0; }
  .ws-rail .ws-logo { margin-bottom: 6px; }
  .ws-rail-new { background: var(--accent-soft); color: var(--accent-text); }
  .ws-rail-run {
    min-width: 22px;
    padding: 0 6px;
    border-radius: var(--radius-full);
    background: var(--info-soft);
    color: var(--info-text);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
  }
}
@media (max-width: 1439px) {
  .wb { --wb-side-w: 264px; --wb-files-w: 296px; }
  .wm-head .cx-gw { max-width: 190px; }
}
@media (max-width: 1279px) {
  .wm-head .cx-gw .cx-gw-text { display: none; }
  .wm-head .cx-gw { padding: 8px; }
  .wm-tab .wb-live { display: none; }
}
@media (max-width: 1179px) {
  .wb { --wb-files-w: 0px; }
  .wb-files {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    width: min(360px, 92vw);
    visibility: hidden;
    box-shadow: var(--shadow-xl);
    transform: translateX(102%);
    transition: transform var(--dur-slow) var(--ease-out), visibility 0s linear var(--dur-slow);
  }
  .wb.files-open .wb-files { visibility: visible; transform: none; transition: transform var(--dur-slow) var(--ease-out), visibility 0s; }
  .wb-files { grid-column: auto; grid-row: auto; }   /* positioned against the whole workbench */
  .wb[data-right="collapsed"][data-tab="chat"] .wb-files { display: flex; }
  .wb[data-tab="chat"] .wm-files-btn { display: inline-grid; }
}
@media (max-width: 1023px) {
  .wm-tab { padding: 4px 10px; }
  .wm-tab > span:not(.wb-count) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .wm-tab .ico { width: 17px; height: 17px; }
}
@media (max-width: 899px) {
  .wb, .wb[data-left="collapsed"] { --wb-side-w: 0px; grid-template-columns: minmax(0, 1fr); }
  .wb-main { grid-column: 1; }
  .wb-side { grid-column: auto; grid-row: auto; }
  .wb-side {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    width: min(320px, 88vw);
    visibility: hidden;
    box-shadow: var(--shadow-xl);
    transform: translateX(-102%);
    transition: transform var(--dur-slow) var(--ease-out), visibility 0s linear var(--dur-slow);
  }
  .wb.side-open .wb-side { visibility: visible; transform: none; transition: transform var(--dur-slow) var(--ease-out), visibility 0s; }
  .wm-menu { display: inline-grid; }
  .ws-close { display: inline-grid; }
  .ws-collapse { display: none; }
  .wm-head { padding-left: 12px; }
  .wm-tab > span:not(.wb-count) { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
}
/* forms + jobs table stack by the width of the view itself (the side panes take room),
   with the old viewport breakpoint as the fallback */
.wm-doc { container-type: inline-size; container-name: wmdoc; }
@container wmdoc (max-width: 960px) {
  .job-grid { grid-template-columns: 1fr; }
  .job-links textarea { min-height: 180px; }
  .job-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--space-md); }
  .job-meta .field:first-child { grid-column: 1 / -1; }
  .job-meta .field:first-child label { margin-top: var(--space-md); }
  .delivery-grid { grid-template-columns: 1fr; }

  /* jobs table → stacked cards */
  .jobs-scroll { overflow: visible; }
  .jobs-table, .jobs-table tbody, .jobs-table tr, .jobs-table td { display: block; width: 100%; }
  .jobs-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .jobs-table tr {
    margin-bottom: 10px;
    padding: 6px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface-2);
  }
  .jobs-table tr:last-child { margin-bottom: 0; }
  .jobs-table tbody tr:hover > td,
  .job-failed > td { background: transparent; }
  .jobs-table td {
    position: relative;
    padding: 8px 0 8px 80px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    white-space: normal;
  }
  .jobs-table td:last-child { border-bottom: 0; }
  .jobs-table td::before {
    content: attr(data-label);
    position: absolute;
    top: 9px;
    left: 0;
    width: 72px;
    color: var(--faint);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 500;
  }
  .jobs-table .col-id, .jobs-table .col-act { width: 100%; text-align: left; }
  .jobs-table td.col-act-empty { display: none; }
  /* lead each card with the title, then status */
  .jobs-table tr { display: flex; flex-direction: column; }
  .jobs-table td.job-title { order: -2; padding: 8px 0 6px; border-bottom: 0; font-size: var(--text-base); }
  .jobs-table td.job-title::before { content: none; }
  .jobs-table td.job-status { order: -1; }
  .job-baidu { max-width: none; }
  .job-error { max-width: none; }
  .job-title { min-width: 0; }
}
@supports not (container-type: inline-size) {
@media (max-width: 900px) {
  .job-grid { grid-template-columns: 1fr; }
  .job-links textarea { min-height: 180px; }
  .job-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--space-md); }
  .job-meta .field:first-child { grid-column: 1 / -1; }
  .job-meta .field:first-child label { margin-top: var(--space-md); }
  .delivery-grid { grid-template-columns: 1fr; }

  /* jobs table → stacked cards */
  .jobs-scroll { overflow: visible; }
  .jobs-table, .jobs-table tbody, .jobs-table tr, .jobs-table td { display: block; width: 100%; }
  .jobs-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .jobs-table tr {
    margin-bottom: 10px;
    padding: 6px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface-2);
  }
  .jobs-table tr:last-child { margin-bottom: 0; }
  .jobs-table tbody tr:hover > td,
  .job-failed > td { background: transparent; }
  .jobs-table td {
    position: relative;
    padding: 8px 0 8px 80px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    white-space: normal;
  }
  .jobs-table td:last-child { border-bottom: 0; }
  .jobs-table td::before {
    content: attr(data-label);
    position: absolute;
    top: 9px;
    left: 0;
    width: 72px;
    color: var(--faint);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 500;
  }
  .jobs-table .col-id, .jobs-table .col-act { width: 100%; text-align: left; }
  .jobs-table td.col-act-empty { display: none; }
  /* lead each card with the title, then status */
  .jobs-table tr { display: flex; flex-direction: column; }
  .jobs-table td.job-title { order: -2; padding: 8px 0 6px; border-bottom: 0; font-size: var(--text-base); }
  .jobs-table td.job-title::before { content: none; }
  .jobs-table td.job-status { order: -1; }
  .job-baidu { max-width: none; }
  .job-error { max-width: none; }
  .job-title { min-width: 0; }
}
}
@media (max-width: 768px) {
  :root, body.user-host, body.admin-host { --gutter: 16px; }
  html { scroll-padding-top: 116px; }
  .wrap { padding: var(--space-lg) var(--gutter) var(--space-2xl); }
  body.admin-host .wrap { padding: 20px 14px 40px; }
  .card { padding: var(--space-md); border-radius: var(--radius-lg); }
  .page-head h1, .wb-head h1 { font-size: 22px; }
  .grid2 { grid-template-columns: 1fr; }
  .hero { padding: var(--space-lg) var(--space-md); }
  .hero h1 { font-size: 24px; }
  .inline-edit { grid-template-columns: 1fr; }
  .share-banner-grid { grid-template-columns: 1fr; }
  .job-rows-head { display: none; }
  .job-row { grid-template-columns: 1fr; gap: 6px; padding: 12px 10px; }
  .job-cell-actions { justify-content: flex-end; }

  header.top { padding: 0 12px; }
  header.top .inner { flex-wrap: wrap; gap: 0 10px; min-height: 0; padding: 10px 0 8px; }
  header.top nav {
    width: 100%;
    margin: 6px -4px 0;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }
  header.top nav::-webkit-scrollbar { display: none; }
  header.top nav a { white-space: nowrap; }
  .nav-user { display: none; }
  .nav-exit { margin-left: auto; }

  input[type=text], input[type=email], input[type=password], input[type=search],
  input[type=number], input[type=url], textarea, select { font-size: 16px; }
  .btn { min-height: 44px; }
  .btn.sm { min-height: 36px; }

  .job-meta { grid-template-columns: 1fr; }
  .delivery-opts { grid-template-columns: 1fr; }
  .form-actions { flex-direction: column-reverse; align-items: stretch; }
  .form-actions .hint { margin: 0; text-align: center; }
  .form-actions .btn { width: 100%; }
  .notice { padding: var(--space-md); }

  /* workbench on phones: the site links move into the sessions drawer, a bottom bar switches views */
  body.page-app header.top { display: none; }
  body.page-app .flash { margin: 8px 10px; }
  .ws-site { display: inline-flex; }
  .wm-head { gap: 8px; min-height: 56px; padding: 8px 10px; }
  .wm-tabs { display: none; }
  .wm-right { gap: 8px; }
  .wm-head .cx-gw { padding: 7px; }
  input.wm-title-input, .wm-title-text { font-size: 16px; }
  .wm-sub .cx-id:not(:first-of-type) { display: none; }
  .wb-bottom { display: grid; }
  .wb-files { width: 100%; }
  .wb-side { width: min(320px, 90vw); }
  .wm-doc { padding: 2px 12px 24px; }
  .wm-doc > .card { margin-top: 12px; }

  .cx-thread { padding: 16px 12px 12px; }
  .cx-dock { padding: 2px 10px 10px; }
  .cx-jump { top: -50px; right: 16px; width: 40px; height: 40px; }
  .cx-hint { display: none; }
  .cx-intro-title { font-size: 19px; }
  .cx-intro-text { font-size: 13.5px; }
  .cx-intro-logo { width: 42px; height: 42px; margin-bottom: 10px; border-radius: 12px; }
  .cx-user-col { max-width: 86%; }
  .cx-bubble { font-size: 15px; }
  .cx-uavatar { width: 28px; height: 28px; font-size: 12px; }
  .cx-turn.is-user, .cx-turn-user { gap: 8px; }
  .cx-avatar { width: 30px; height: 30px; }
  .cx-avatar .ico { width: 15px; height: 15px; }
  .cx-tool-row { grid-template-columns: 30px minmax(0, 1fr); gap: 0 8px; }
  .cx-md { font-size: 15px; }
  .cx-tool .cx-shots, .cx-shots { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .cx-tool .cx-shots { padding: 10px; }
  .cx-composer { border-radius: 16px; }
  .cx-composer-foot { padding: 6px 8px 7px; }
  .cx-img-opts { flex: 1 1 100%; }
  .cx-inline-field select { flex: 1; }
  label.cx-inline-field:first-child { flex: 1; }
  .cx-chip-name { max-width: 9em; }
  .cx-shot figcaption { padding: 4px 4px 4px 8px; }
  .cx-shot figcaption .btn { min-height: 32px; padding: 4px 8px; }
  .cx-shot figcaption .btn-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
}
@media (max-width: 380px) {
  .cx-status .cx-elapsed { display: none; }
  .cx-chip-btn, .cx-tool-toggle { padding: 3px 10px 3px 8px; }
}

/* 10 · motion (subtle; disabled for reduced motion) ---------------------- */
@keyframes cxPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
@keyframes cxDot {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}
@keyframes cxShimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}
@keyframes cxReveal {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes cxSpin { to { transform: rotate(360deg); } }
@keyframes cxBar {
  0% { background-position: -60% 0; }
  100% { background-position: 160% 0; }
}
.cx-gw[data-state="checking"] .cx-gw-dot,
.cx-pill:is([data-state="running"], [data-state="queued"], [data-state="creating"], [data-state="submitting"],
  [data-state="tools"], [data-state="continuing"], [data-state="imaging"])::before,
.ws-row[data-state="busy"] .ws-state::before,
.badge.processing.dot::before { animation: cxPulse 1.4s ease-in-out infinite; }
.ws-row[data-state="busy"] .ws-ico .ico { animation: cxSpin 1s linear infinite; }
.cx-window:is([data-state="creating"], [data-state="submitting"], [data-state="queued"], [data-state="running"],
  [data-state="tools"], [data-state="continuing"], [data-state="imaging"])::before { animation: cxBar 1.6s ease-in-out infinite; }
.cx-dots i { animation: cxDot 1.2s ease-in-out infinite; }
.cx-dots i:nth-child(2) { animation-delay: 0.15s; }
.cx-dots i:nth-child(3) { animation-delay: 0.3s; }
.cx-shot.is-skeleton .cx-shot-img { animation: cxShimmer 1.5s linear infinite; }
.cx-turn.is-new, .cx-shot.is-fresh { animation: cxReveal var(--dur-slow) var(--ease-out) both; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}


/* 11 · admin skills dialog (v16) ------------------------------------------
   Toolbar + status bar stay put; the add / edit form and the list scroll under them.
   A row = name · slug · 启用 switch / 说明 / Codex · Claude switches · 编辑 · 删除.
   The left rail of a row is green while the skill is on. */
dialog.wb-skills-dialog {
  width: min(760px, 96vw);
  max-height: min(88vh, 920px);
  overflow: hidden;
}
dialog.wb-skills-dialog[open] { display: flex; flex-direction: column; }
.wb-skills-dialog .wb-dialog-head { flex: none; }
.wb-skills-dialog .wb-dialog-note { flex: none; margin: 2px 18px 0; max-width: 62em; }
.wb-skills-dialog .wb-dialog-note strong { color: var(--text); font-weight: 600; }

.sk-bar { display: flex; flex: none; flex-wrap: wrap; align-items: center; gap: 8px; padding: 14px 18px 12px; }
.sk-sum { margin-left: auto; color: var(--muted); font-size: 12.5px; white-space: nowrap; }

.sk-status {
  flex: none;
  margin: 0 18px 12px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--wb-soft, transparent);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.sk-status[data-kind="ok"] { border-color: var(--ok-line); background: var(--ok-soft); color: var(--ok-text); }
.sk-status[data-kind="err"] { border-color: var(--err-line); background: var(--err-soft); color: var(--err-text); }
.sk-status-line { display: flex; align-items: flex-start; gap: 8px; margin: 0; font-weight: 500; }
.sk-status-line .ico { flex: none; width: 16px; height: 16px; margin-top: 2px; }
.sk-status[data-kind="busy"] .sk-status-line .ico { animation: cxSpin 0.9s linear infinite; }
.sk-status-hint { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 6px 0 0 24px; }
.sk-status-why { flex: 1 1 260px; color: var(--text-2); font-weight: 400; }
.sk-status-hint .btn { min-height: 28px; padding: 2px 10px; font-size: 12.5px; }

.sk-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 0 18px 18px; }

/* list */
.sk-list { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--wb-side-bg, var(--bg-deep)); }
.sk-loading { margin: 0; padding: 22px 16px; color: var(--muted); font-size: 13px; text-align: center; }
.sk-row { position: relative; padding: 12px 14px 12px 18px; outline: none; transition: background var(--dur) ease; }
.sk-row + .sk-row { border-top: 1px solid var(--line); }
.sk-row::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--line-strong);
}
.sk-row[data-on="1"]::before { background: var(--accent); }
.sk-row:hover { background: var(--wb-hover, var(--row-hover)); }
.sk-row:focus-visible { box-shadow: inset 0 0 0 2px var(--ring); }
.sk-row:first-child { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.sk-row:last-child { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.sk-row:only-child { border-radius: var(--radius-lg); }
.sk-row.is-flash { animation: skFlash 2.2s linear 1; }
@keyframes skFlash {
  0%, 40% { background: var(--accent-soft); }
  100% { background: transparent; }
}
.sk-row-head { display: flex; align-items: center; gap: 12px; }
.sk-row-id { display: flex; flex: 1; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; }
.sk-row-name { color: var(--text); font-size: 15px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.sk-row[data-on="0"] .sk-row-name { color: var(--text-2); }
.sk-row-slug { color: var(--faint); font-size: 12px; overflow-wrap: anywhere; }
.sk-row-desc {
  display: -webkit-box;
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.sk-row-desc.is-empty { color: var(--faint); }
.sk-row-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 10px; }
.sk-row-provs { display: flex; flex-wrap: wrap; gap: 6px; }
.sk-row[data-on="0"] .sk-row-provs { opacity: 0.6; }
.sk-row-time { color: var(--faint); font-size: 12px; white-space: nowrap; }
.sk-row-time:empty { display: none; }
.sk-row-acts { display: flex; gap: 2px; margin-left: auto; }
.sk-row-acts .btn { min-height: 30px; padding: 3px 9px; }
.sk-row-acts .btn.is-danger:hover { background: var(--err-soft); color: var(--err-text); }
.sk-row[aria-busy="true"] .sk-switch { cursor: progress; opacity: 0.7; }

/* switches (checkbox + role="switch"; the track is drawn, the input stays focusable) */
label.sk-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 4px 11px 4px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: border-color var(--dur-fast) ease, color var(--dur-fast) ease;
}
.sk-switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: inherit;
}
.sk-track {
  position: relative;
  flex: none;
  width: 28px;
  height: 16px;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  transition: background var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.sk-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast) ease;
}
.sk-switch input:checked + .sk-track { background: var(--accent); box-shadow: none; }
.sk-switch input:checked + .sk-track::after { background: #ffffff; transform: translateX(12px); }
.sk-switch input:focus-visible + .sk-track { outline: 2px solid var(--ring); outline-offset: 2px; }
.sk-switch:hover { border-color: var(--field-line-hover); color: var(--text-2); }
.sk-switch:has(input:checked) { border-color: var(--accent-line); color: var(--text); }
label.sk-switch.sk-switch-main { padding-right: 4px; border-color: transparent; }
label.sk-switch.sk-switch-main:has(input:checked) { color: var(--accent-text); }
.sk-switch-main .sk-switch-text { min-width: 3em; }

/* add / edit form */
.sk-form { margin: 0 0 14px; padding: 14px 16px 16px; border: 1px solid var(--accent-line); border-radius: var(--radius-lg); background: var(--surface-2); }
.sk-form-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.sk-form-title { margin: 0; color: var(--text); font-family: var(--font-body); font-size: 15px; font-weight: 600; }
.sk-form-sub { color: var(--muted); font-size: 12.5px; }
.sk-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 14px; }
.sk-field { min-width: 0; }
.sk-form label[for] { display: flex; align-items: center; gap: 6px; margin: 12px 0 5px; font-size: 13px; }
.sk-form input[type=text] { padding: 8px 11px; font-size: 14px; }
.sk-form input[type=text]#sk-slug { font-family: var(--font-mono); font-size: 13px; }
.sk-form input[readonly] { border-color: var(--line); background: var(--surface-3); color: var(--muted); cursor: default; }
.sk-form textarea { min-height: 190px; font-size: 13px; line-height: 1.65; }
.sk-form [aria-invalid="true"] { border-color: var(--err); box-shadow: 0 0 0 3px var(--err-soft); }
.sk-form label.sk-switch:has(input[aria-invalid="true"]) { border-color: var(--err); color: var(--err-text); }
.sk-auto { padding: 0 7px; border-radius: var(--radius-full); background: var(--info-soft); color: var(--info-text); font-size: 11px; font-weight: 600; line-height: 1.6; }
.sk-help { margin: 5px 0 0; color: var(--faint); font-size: 12px; line-height: 1.5; }
.sk-form-switches { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.sk-form-switches label.sk-switch { background: var(--field); }
.sk-form-err { margin: 12px 0 0; color: var(--err-text); font-size: 13px; font-weight: 500; }
.sk-form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.sk-form-actions .btn[aria-disabled="true"] { opacity: 0.6; cursor: progress; }
.sk-kbd { margin-left: auto; color: var(--faint); font-size: 12px; }

/* empty / failed list */
.sk-empty { padding: 28px 18px 26px; text-align: center; }
.sk-empty-title { margin: 0; color: var(--text); font-size: 14px; font-weight: 600; }
.sk-empty-text { max-width: 30em; margin: 4px auto 0; color: var(--muted); font-size: 13px; }
.sk-empty .btn { margin-top: 12px; }

@media (max-width: 768px) {
  .sk-form input[type=text], .sk-form input[type=text]#sk-slug, .sk-form textarea { font-size: 16px; }
  .sk-kbd { display: none; }
}
@media (max-width: 560px) {
  dialog.wb-skills-dialog { width: 96vw; max-height: 92dvh; }
  .wb-skills-dialog .wb-dialog-note { margin: 2px 14px 0; }
  .sk-bar { padding: 12px 14px 10px; }
  .sk-sum { flex-basis: 100%; order: 9; margin-left: 2px; }
  .sk-status { margin: 0 14px 10px; }
  .sk-status-hint { margin-left: 0; }
  .sk-scroll { padding: 0 12px 14px; }
  .sk-grid { grid-template-columns: minmax(0, 1fr); }
  .sk-row { padding: 12px 10px 12px 14px; }
  .sk-row-head { align-items: flex-start; }
  .sk-row-acts { margin-left: auto; }
}


/* 12 · image previews (v17) -----------------------------------------------
   Thumbs come from the CDN only. Until the CDN copy exists a tile is a shimmering placeholder with
   「生成中…」 (「暂无预览」 once the lookups stop); a thumb that can't load leaves a grey tile. */
.cx-wait {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 6px;
  color: var(--faint);
  font-size: 11.5px;
  line-height: 1.3;
  text-align: center;
  pointer-events: none;
}
:is(.cx-thumb, .cx-md-img, .cx-shot-img, .cx-strip-img, .cx-chip-img).is-wait {
  position: relative;
  background: linear-gradient(100deg, var(--surface-3) 30%, rgba(148, 163, 184, 0.22) 50%, var(--surface-3) 70%);
  background-size: 300% 100%;
  animation: cxShimmer 1.5s linear infinite;
  cursor: pointer;
}
.cx-md-img.is-wait { width: 168px; max-width: 100%; aspect-ratio: 4 / 3; }
.cx-shot-img.is-wait { min-height: 96px; }
:is(.cx-strip-img, .cx-chip-img).is-wait .cx-wait { font-size: 0; }   /* too small for words: the shimmer says it */
/* a thumb that can't load: grey tile (the original never loads in its place) */
:is(.cx-md-img, .cx-shot-img, .cx-strip-img, .cx-chip-img) { position: relative; }
:is(.cx-md-img, .cx-shot-img, .cx-strip-img, .cx-chip-img).is-broken img { opacity: 0; }
.cx-md-img.is-broken { min-width: 120px; min-height: 90px; }
:is(.cx-md-img, .cx-shot-img).is-broken::after {
  content: "无法预览";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--faint);
  font-size: 11.5px;
}
/* viewer: no CDN original yet (or it didn't load) — say so; 下载 stays */
.cx-viewer-wait {
  margin: 0;
  padding: 56px 28px;
  min-width: min(380px, 94vw);
  max-width: min(94vw, 560px);
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
  text-align: center;
}


/* 13 · run outcome (v18) ---------------------------------------------------
   A run that didn't end as "completed" but left pictures behind counts as done: instead of the red alert the
   turn gets this quiet grey line (how the run ended, technical status in small print underneath). */
.cx-agent-soft {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 10px 0 0;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.cx-agent-soft .ico { flex: none; width: 15px; height: 15px; margin-top: 3px; color: var(--faint); }
.cx-agent-soft-body { min-width: 0; }
.cx-agent-soft-text { margin: 0; }
.cx-agent-soft-why { margin: 1px 0 0; color: var(--faint); font-family: var(--font-mono); font-size: 11.5px; overflow-wrap: anywhere; }

.btn-sm{padding:4px 10px;font-size:12px;border-radius:8px;line-height:1.3}
/* UX: hide batch progress card (skill-driven single-task gen) */
#codex-batch-card,.cx-batch-card{display:none!important}
/* === P3 codex batch progress === */
.cx-batch-card{margin:10px 12px;padding:10px 12px;border:1px solid var(--border, #e5e7eb);border-radius:10px;background:var(--surface-2, #fafafa)}
.cx-batch-card[hidden]{display:none!important}
.cx-batch-title{display:flex;align-items:center;gap:6px;font-size:13px;font-weight:600;margin:0 0 6px}
.cx-batch-meta{font-size:12px;color:var(--muted, #6b7280);margin:0 0 8px;word-break:break-all}
.cx-batch-bar{height:8px;border-radius:999px;background:#e5e7eb;overflow:hidden}
.cx-batch-bar > i{display:block;height:100%;width:0;background:linear-gradient(90deg,#f59e0b,#10b981);transition:width .3s ease}
.cx-batch-actions{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
.cx-batch-actions button{font-size:12px}

/* Backend Evo fill card (portal → gateway; not sandbox) */
.cx-evo-card{margin:10px 12px;padding:10px 12px;border:1px solid var(--border, #e5e7eb);border-radius:10px;background:var(--surface-2, #fafafa)}
.cx-evo-card[hidden]{display:none!important}
.cx-evo-title{display:flex;align-items:center;gap:6px;font-size:13px;font-weight:600;margin:0 0 6px}
.cx-evo-meta{font-size:12px;color:var(--muted, #6b7280);margin:0 0 8px;word-break:break-all}
.cx-evo-bar{height:8px;border-radius:999px;background:#e5e7eb;overflow:hidden}
.cx-evo-bar > i{display:block;height:100%;width:0;background:linear-gradient(90deg,#6366f1,#10b981);transition:width .3s ease}
.cx-evo-actions{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
.cx-evo-actions button{font-size:12px}



/* skill stream: thinking + step progress */
.cx-agent-thinking {
  margin: 0 0 10px;
  padding: 8px 12px;
  border: 1px dashed var(--line-strong, #d1d5db);
  border-radius: var(--radius-md, 10px);
  background: var(--surface-2, #fafafa);
  color: var(--muted, #6b7280);
  font-size: 12.5px;
  line-height: 1.55;
}
.cx-agent-thinking-sum {
  cursor: pointer;
  font-weight: 600;
  color: var(--muted, #6b7280);
  list-style: none;
}
.cx-agent-thinking-sum::-webkit-details-marker { display: none; }
.cx-agent-thinking-body {
  margin: 8px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-sans, inherit);
  font-size: 12.5px;
  color: var(--faint, #9ca3af);
  max-height: 220px;
  overflow: auto;
}
.cx-agent-progress {
  margin: 0 0 10px;
  padding: 8px 12px;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: var(--radius-md, 10px);
  background: var(--surface-2, #fafafa);
  color: var(--muted, #6b7280);
  font-size: 12.5px;
  line-height: 1.5;
}
.cx-agent-progress-title {
  font-weight: 600;
  color: var(--text, #111827);
  margin: 0 0 4px;
  font-size: 12.5px;
}
.cx-agent-progress-hint {
  margin: 0 0 6px;
  color: var(--muted, #6b7280);
  font-size: 12px;
}
.cx-agent-steps {
  margin: 0;
  padding-left: 18px;
}
.cx-agent-step {
  margin: 2px 0;
}
.cx-agent-step-tool {
  font-weight: 600;
  font-family: var(--font-mono, ui-monospace, monospace);
  color: var(--text, #111827);
}
.cx-agent-step-preview {
  color: var(--faint, #9ca3af);
  word-break: break-word;
}


/* Upstream interactive prompt relay (phase 1 — display + answer stub) */
.cx-prompt-card {
  margin: 10px 0 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(245, 158, 11, 0.45);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.12), rgba(245, 158, 11, 0.04));
  color: var(--text, #e8e8e8);
}
.cx-prompt-card.is-answered {
  border-color: rgba(52, 211, 153, 0.35);
  background: linear-gradient(180deg, rgba(52, 211, 153, 0.10), rgba(52, 211, 153, 0.03));
}
.cx-prompt-card-kicker {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fbbf24;
  margin-bottom: 4px;
}
.cx-prompt-card-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
}
.cx-prompt-card-q {
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 10px;
  opacity: 0.95;
}
.cx-prompt-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.cx-prompt-btn {
  appearance: none;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.28);
  color: inherit;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
}
.cx-prompt-btn:hover {
  border-color: rgba(251, 191, 36, 0.7);
  background: rgba(245, 158, 11, 0.18);
}
.cx-prompt-card-hint,
.cx-prompt-card-note {
  font-size: 11px;
  opacity: 0.7;
  line-height: 1.4;
}

/* rankings tables */
.rankings-table th.num,
.rankings-table td.num { text-align: right; white-space: nowrap; width: 1%; }
.rankings-table td.num.mono,
.rankings-table th.num { font-variant-numeric: tabular-nums; }

/* Tik热榜 row scrape / multi-select */
.rankings-table th.tik-check-col,
.rankings-table td.tik-check-col { width: 1%; text-align: center; white-space: nowrap; padding-right: 6px; }
.rankings-table .tik-actions { white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.rankings-table .tik-actions .tik-scrape-one { padding: 2px 10px; font-size: 12px; }
.tik-bulk-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px;
  margin-bottom: 12px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2, var(--field));
}
.tik-bulk-select-all { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.tik-scrape-dialog { width: min(720px, 96vw); max-height: min(90vh, 900px); overflow: auto; }
.tik-scrape-dialog .delivery-grid { margin-top: 8px; }
.tik-scrape-dialog .share-confirm { margin-top: 12px; }
