/* workspace/assets/ws.css —— EnjakuAi 工作台样式（与主页 anime-home 同一套暖色设计语言）
   色板来源：assets/css/anime-home.css（暖紫褐底 + 珊瑚粉强调 + 点阵纹理），深浅双色跟随主页 */
:root {
  color-scheme: dark;
  --bg: #18151e; --bg-soft: #211c28; --card: #25212d; --card-2: #302936;
  --border: rgba(255,255,255,.07); --border-strong: rgba(255,255,255,.16);
  --text: #f7f0f4; --text-dim: #bdb0c0; --text-faint: #a294a6;
  --accent: #ff817c; --accent-2: #e7799f;
  /* 白字压在渐变上：原 #ef7365→#e3658e 只有 2.9~3.2:1（不达标）；加深到 4.6:1 以上，仍是珊瑚→玫红 */
  --grad: linear-gradient(120deg,#cc4843,#c24a73);
  --soft-accent: rgba(239,115,101,.1); --ink-accent: #ffaaa0;
  --green: #34d399; --red: #f87171; --amber: #ffb224;
  --veil: rgba(24,21,30,.82); --overlay: rgba(12,8,18,.62);
  --hover: rgba(255,255,255,.05); --hover-strong: rgba(255,255,255,.1);
  --field: rgba(255,255,255,.04); --code-bg: rgba(255,255,255,.08);
  --pre-bg: #131019; --scroll-thumb: rgba(255,255,255,.14);
  --grad-shadow: 0 4px 12px rgba(227,101,142,.22);
  --radius: 14px; --sidebar-w: 222px;
  --font: -apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;
}
html.theme-light {
  color-scheme: light;
  --bg: #fcf9f7; --bg-soft: #fffdfb; --card: #ffffff; --card-2: #f5eeee;
  --border: rgba(108,66,84,.09); --border-strong: rgba(108,66,84,.2);
  --text: #372d3e; --text-dim: #6f5f70; --text-faint: #7c6c7d; /* 原 #827382/#948393 只有 3.4~4.2:1，小字号看不清 */
  --accent: #d85e59; --accent-2: #ba6291;
  --grad: linear-gradient(120deg,#cc4843,#c24a73);
  --soft-accent: #f7e6e3; --ink-accent: #a8403f;
  --green: #059669; --red: #dc2626; --amber: #b45309;
  --veil: rgba(252,249,247,.86); --overlay: rgba(55,45,62,.4);
  --hover: rgba(108,66,84,.06); --hover-strong: rgba(108,66,84,.12);
  --field: rgba(108,66,84,.05); --code-bg: rgba(108,66,84,.09);
  --pre-bg: #f7f1ee; --scroll-thumb: rgba(108,66,84,.24);
  --grad-shadow: 0 4px 12px rgba(220,99,129,.2);
}
html.theme-light .cap-chip.vision { color:#0369a1; border-color:rgba(3,105,161,.3); }
* { margin:0; padding:0; box-sizing:border-box; }
html, body { height:100%; }
body {
  font-family:var(--font); background:var(--bg); color:var(--text); -webkit-font-smoothing:antialiased;
  /* 与主页一致的点阵纹理 */
  background-image:radial-gradient(rgba(165,128,148,.063) .7px,transparent .7px); background-size:7px 7px;
}
::selection { background:rgba(239,115,101,.3); }
a { color:inherit; text-decoration:none; }
button { font-family:inherit; cursor:pointer; border:none; background:none; color:inherit; }
textarea, input, select { font-family:inherit; }
/* 与主页侧栏同源的内联图标（svg.ico：单路径、fill 继承文字色） */
svg.ico { width:15px; height:15px; flex-shrink:0; display:inline-block; vertical-align:-2px; }
.ws-item__ops svg.ico { width:12px; height:12px; vertical-align:middle; }
.ws-side-toggle svg.ico { display:block; margin:auto; }
[hidden] { display:none !important; }
::-webkit-scrollbar { width:6px; height:6px; }
::-webkit-scrollbar-thumb { background:var(--scroll-thumb); border-radius:3px; }
a:focus-visible,button:focus-visible,select:focus-visible,textarea:focus-visible,input:focus-visible,[tabindex]:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
::placeholder { color:var(--text-faint); opacity:1; }

.ws-app { display:flex; height:100vh; height:100dvh; overflow:hidden; }
.ws-side {
  width:var(--sidebar-w); flex-shrink:0; background:var(--bg-soft);
  border-right:1px solid var(--border); display:flex; flex-direction:column;
}
.ws-side__head { display:flex; align-items:center; gap:8px; padding:14px 12px 9px; }
.ws-side__head .logo { width:28px; height:28px; flex:0 0 28px; }
.ws-side__head strong {
  min-width:0; flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  font-size:15px; font-weight:800; letter-spacing:0;
}
.ws-side__back {
  width:32px; height:32px; flex:0 0 32px; display:grid; place-items:center;
  color:var(--text-dim); border:1px solid var(--border); border-radius:8px;
  transition:color .15s,border-color .15s,background .15s;
}
.ws-side__back .ico { width:16px; height:16px; }
.ws-side__back:hover { color:var(--ink-accent); border-color:rgba(239,115,101,.4); background:var(--hover); }
.ws-new {
  min-height:38px; margin:3px 12px 8px; padding:9px 10px; display:flex; align-items:center; justify-content:center; gap:6px;
  background:var(--grad); color:#fff; border-radius:10px; font-size:13px; font-weight:600; line-height:1.2;
  text-align:center; box-shadow:var(--grad-shadow); transition:filter .15s;
}
.ws-new:hover { filter:brightness(1.06); }
.ws-new--ghost { background:var(--hover); color:var(--text); box-shadow:none; }
.ws-new--ghost:hover { background:var(--hover-strong); }
.ws-list { flex:1; overflow-y:auto; padding:4px 8px; }
.ws-item {
  padding:9px 11px; border-radius:10px; cursor:pointer; margin-bottom:2px;
  display:flex; align-items:center; gap:8px; position:relative; transition:background .15s;
}
.ws-item:hover { background:var(--hover); }
.ws-item.is-active { background:var(--soft-accent); }
.ws-item.is-active .ws-item__title { color:var(--ink-accent); font-weight:600; }
.ws-item__title { flex:1; font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ws-item__time { font-size:10.5px; color:var(--text-faint); }
.ws-item__ops { display:none; gap:2px; }
.ws-item:hover .ws-item__ops, .ws-item:focus-within .ws-item__ops { display:flex; }
@media (hover:none) { .ws-item__ops { display:flex; } }
.ws-item__ops button { padding:2px 5px; border-radius:6px; font-size:11px; color:var(--text-dim); }
.ws-item__ops button:hover { background:var(--hover-strong); color:var(--text); }
.ws-main { flex:1; display:flex; flex-direction:column; min-width:0; }
.ws-side-scrim {
  position:fixed; inset:0; z-index:50; background:var(--overlay);
  opacity:0; pointer-events:none; transition:opacity .25s;
}
.ws-top {
  display:flex; align-items:center; gap:10px; padding:10px 18px;
  border-bottom:1px solid var(--border); background:var(--veil); backdrop-filter:blur(10px);
}
.ws-top select {
  background:var(--card); color:var(--text); border:1px solid var(--border-strong);
  border-radius:10px; padding:7px 10px; font-size:13px; max-width:340px; outline:none;
}
.ws-top select:focus { border-color:var(--accent); box-shadow:0 0 0 3px var(--soft-accent); }
.ws-top { overflow: visible; position: relative; z-index: 50; }
.ws-top-actions { margin-left:auto; display:flex; gap:8px; align-items:center; overflow:visible; position:relative; z-index:60; }
.ws-caps { font-size:12px; color:var(--text-dim); display:flex; align-items:center; gap:6px; }
.cap-chip { border:1px solid var(--border); border-radius:999px; padding:2px 9px; font-size:11px; }
.cap-chip.vision { color:#7dd3fc; border-color:rgba(125,211,252,.3); }
.ws-msgs { flex:1; overflow-y:auto; padding:22px 26px; display:flex; flex-direction:column; gap:16px; }
.ws-msg { display:flex; gap:10px; max-width:860px; }
.ws-msg.is-user { align-self:flex-end; flex-direction:row-reverse; }
.ws-msg__avatar {
  width:30px; height:30px; border-radius:9px; flex-shrink:0; display:grid; place-items:center;
  font-size:13px; font-weight:700; color:#fff; overflow:hidden;
}
.ws-msg__avatar img { width:100%; height:100%; object-fit:cover; }
.ws-msg__avatar.is-action { transition:transform .15s,box-shadow .15s; }
.ws-msg__avatar.is-action:hover { transform:translateY(-1px); box-shadow:0 4px 12px rgba(12,8,22,.2); }
.ws-msg__avatar.is-action:disabled { opacity:.5; cursor:default; transform:none; box-shadow:none; }
.ws-msg__body { min-width:0; }
.ws-msg__name { font-size:11.5px; color:var(--text-faint); margin-bottom:4px; display:flex; gap:8px; align-items:center; }
.ws-msg__name .m { font-family:ui-monospace,Menlo,monospace; }
.ws-bubble {
  background:var(--card); border:1px solid var(--border); border-radius:12px;
  padding:10px 14px; font-size:14px; line-height:1.75; word-break:break-word; overflow-wrap:break-word;
}
.ws-msg.is-user .ws-bubble { background:rgba(239,115,101,.13); border-color:rgba(239,115,101,.32); }
.ws-bubble.incomplete { border-color:rgba(248,113,113,.4); }
.ws-bubble p { margin:0 0 8px; } .ws-bubble p:last-child { margin-bottom:0; }
.ws-bubble pre {
  background:var(--pre-bg); border:1px solid var(--border); border-radius:10px; padding:10px 12px;
  overflow-x:auto; margin:8px 0; font-size:12.5px; line-height:1.6;
}
.ws-bubble code { font-family:ui-monospace,Menlo,monospace; }
.ws-bubble :not(pre) > code { background:var(--code-bg); border-radius:5px; padding:1px 5px; font-size:12.5px; }
.ws-bubble ul, .ws-bubble ol { padding-left:20px; margin:6px 0; }
.ws-bubble blockquote { border-left:3px solid var(--accent); padding-left:10px; color:var(--text-dim); margin:6px 0; }
.ws-bubble img.att-img { max-width:280px; max-height:220px; border-radius:10px; display:block; margin:6px 0; }
.ws-msg__ops { display:flex; gap:6px; margin-top:6px; opacity:0; transition:opacity .15s; }
.ws-msg:hover .ws-msg__ops, .ws-msg:focus-within .ws-msg__ops { opacity:1; }
@media (hover:none) { .ws-msg__ops { opacity:1; } } /* 触屏没有 hover：回复/复制/重新生成之前在手机上根本点不到 */
.ws-msg__ops button { font-size:11px; color:var(--text-faint); border:1px solid var(--border); border-radius:7px; padding:3px 8px; }
.ws-msg__ops button:hover { color:var(--text); border-color:var(--border-strong); }
.ws-composer {
  border-top:1px solid var(--border); padding:12px 18px 14px; background:var(--veil); backdrop-filter:blur(10px);
}
.ws-atts { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:8px; }
.ws-att {
  display:flex; align-items:center; gap:6px; background:var(--card); border:1px solid var(--border);
  border-radius:10px; padding:5px 9px; font-size:12px; max-width:260px;
}
.ws-att img { width:36px; height:36px; object-fit:cover; border-radius:6px; }
.ws-att .n { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:150px; }
.ws-att .rm { color:var(--text-faint); } .ws-att .rm:hover { color:var(--red); }
.ws-att.st-failed { border-color:rgba(248,113,113,.4); }
.ws-att.st-pending { opacity:.6; }
.ws-input-row { display:flex; gap:10px; align-items:flex-end; }
.ws-input-row textarea {
  flex:1; background:var(--card); border:1px solid var(--border-strong); border-radius:12px;
  color:var(--text); font-size:14px; line-height:1.6; padding:10px 14px; resize:none;
  min-height:46px; max-height:180px; outline:none; transition:border-color .15s, box-shadow .15s;
}
.ws-input-row textarea:focus { border-color:var(--accent); box-shadow:0 0 0 3px var(--soft-accent); }
.ws-send {
  background:var(--grad); color:#fff; border-radius:12px; padding:11px 20px; font-size:14px; font-weight:600;
  box-shadow:var(--grad-shadow); transition:filter .15s;
}
.ws-send:hover { filter:brightness(1.06); }
.ws-send:disabled { opacity:.5; cursor:default; }
.ws-stop { background:rgba(248,113,113,.14); color:var(--red); border:1px solid rgba(248,113,113,.4); border-radius:12px; padding:11px 18px; font-weight:600; }
.ws-attach-btn {
  width:46px; height:46px; flex:0 0 46px; display:grid; place-items:center;
  border:1px solid var(--border-strong); border-radius:12px; padding:0; color:var(--text-dim);
}
.ws-attach-btn:hover { color:var(--text); border-color:rgba(239,115,101,.45); }
.ws-continue-entry { min-height:0; margin-top:0; }
.ws-continue-entry:not(:empty) { display:flex; justify-content:center; margin-top:9px; }
.ws-continue-entry .ws-btn-grad { display:inline-flex; align-items:center; gap:6px; padding:8px 13px; }
.ws-empty {
  flex:1; min-height:360px; display:grid; place-items:center; padding:34px 22px;
  color:var(--text-faint); font-size:14px; text-align:center;
}
.ws-empty__card {
  width:min(720px,100%); min-height:410px; display:grid; grid-template-columns:minmax(220px, .9fr) minmax(260px, 1.1fr);
  align-items:center; gap:clamp(22px,5vw,62px); padding:clamp(24px,4vw,44px);
  position:relative; overflow:hidden; isolation:isolate;
  border:1px solid var(--border); border-radius:26px;
  background:linear-gradient(145deg, color-mix(in srgb, var(--card) 88%, transparent), color-mix(in srgb, var(--soft-accent) 46%, var(--card)));
  box-shadow:0 18px 56px rgba(48,25,44,.08);
}
/* 内容区不足 ~560px 时两栏会挤出卡片：提前改为单栏 */
@media (max-width:700px) { .ws-empty__card { grid-template-columns:minmax(0,1fr); gap:12px; } }
.ws-empty__card::before, .ws-empty__card::after { content:""; position:absolute; z-index:-1; border-radius:50%; filter:blur(2px); pointer-events:none; }
.ws-empty__card::before { width:230px; height:230px; left:-86px; bottom:-124px; background:rgba(239,115,101,.14); }
.ws-empty__card::after { width:270px; height:270px; right:-128px; top:-138px; background:rgba(231,121,159,.11); }
.ws-empty__art { min-width:0; display:grid; place-items:center; position:relative; }
.ws-empty__art::before { content:""; position:absolute; width:190px; height:190px; border-radius:50%; background:var(--soft-accent); box-shadow:0 0 0 14px color-mix(in srgb, var(--soft-accent) 35%, transparent); }
.ws-empty__art img { position:relative; z-index:1; width:min(280px,100%); height:220px; object-fit:contain; object-position:center bottom; filter:drop-shadow(0 12px 12px rgba(42,22,40,.14)); animation:ws-empty-float 5s ease-in-out infinite; }
.ws-empty__copy { min-width:0; text-align:left; }
.ws-empty__eyebrow { display:inline-flex; align-items:center; gap:7px; color:var(--ink-accent); font-size:11px; font-weight:700; letter-spacing:2px; }
.ws-empty__eyebrow::before { content:""; width:22px; height:1px; background:currentColor; opacity:.7; }
.ws-empty__title { margin:14px 0 9px; color:var(--text); font-size:clamp(22px,3vw,30px); line-height:1.25; letter-spacing:-.02em; text-wrap:balance; }
.ws-empty__hint { max-width:34em; margin:0; color:var(--text-dim); font-size:13px; line-height:1.85; text-wrap:pretty; }
.ws-empty__chips { display:flex; flex-wrap:wrap; gap:7px; margin-top:18px; }
.ws-empty__chip { padding:6px 9px; border:1px solid var(--border-strong); border-radius:999px; background:color-mix(in srgb, var(--card) 70%, transparent); color:var(--text-dim); font-size:11px; }
.ws-empty__actions { display:flex; flex-wrap:wrap; gap:9px; margin-top:22px; }
.ws-empty__action { display:inline-flex; align-items:center; justify-content:center; gap:7px; min-height:36px; padding:8px 14px; border-radius:10px; font-size:12px; font-weight:650; }
.ws-empty__action--primary { background:var(--grad); color:#fff; box-shadow:var(--grad-shadow); }
.ws-empty__action--primary:hover { filter:brightness(1.06); }
.ws-empty__action--ghost { border:1px solid var(--border-strong); color:var(--text-dim); background:var(--field); }
.ws-empty__action--ghost:hover { color:var(--text); background:var(--hover-strong); }
.ws-empty--roleplay .ws-empty__art::before { background:rgba(231,121,159,.12); box-shadow:0 0 0 14px rgba(231,121,159,.06); }
.ws-empty--roleplay .ws-empty__card { background:linear-gradient(145deg, color-mix(in srgb, var(--card) 90%, transparent), color-mix(in srgb, rgba(231,121,159,.18) 55%, var(--card))); }
.ws-empty__bubble { position:absolute; z-index:2; max-width:110px; padding:7px 9px; border:1px solid var(--border-strong); border-radius:11px 11px 11px 3px; background:var(--card); color:var(--ink-accent); font-size:10px; line-height:1.45; box-shadow:0 8px 20px rgba(42,22,40,.1); }
.ws-empty__bubble--one { left:3%; top:13%; transform:rotate(-4deg); }
.ws-empty__bubble--two { right:1%; top:31%; border-radius:11px 11px 3px 11px; transform:rotate(4deg); color:var(--text-dim); }
@keyframes ws-empty-float { 0%,100% { transform:translateY(0); } 50% { transform:translateY(-6px); } }
.ws-mode-row { display:flex; gap:6px; margin-bottom:8px; }
.ws-mode-chip { border:1px solid var(--border); border-radius:999px; padding:4px 12px; font-size:12px; color:var(--text-dim); transition:background .15s,color .15s,border-color .15s; }
.ws-mode-chip:hover { color:var(--text); }
.ws-mode-chip.is-active { background:var(--soft-accent); border-color:rgba(239,115,101,.45); color:var(--ink-accent); font-weight:600; }
.ws-speaker-strip { display:flex; min-width:0; align-items:center; gap:9px; margin-bottom:9px; }
.ws-speaker-strip__label { flex-shrink:0; font-size:11.5px; color:var(--text-faint); }
.ws-speaker-list {
  display:flex; min-width:0; align-items:center; gap:7px; overflow-x:auto; padding:2px 2px 4px;
  scrollbar-width:thin;
}
.ws-speaker {
  height:36px; flex-shrink:0; display:inline-flex; align-items:center; gap:7px; padding:3px 10px 3px 4px;
  border:1px solid var(--border-strong); border-radius:18px; background:var(--card); color:var(--text);
  font-size:12px; font-weight:600; white-space:nowrap; transition:border-color .15s,background .15s,transform .15s;
}
.ws-speaker:hover { border-color:rgba(239,115,101,.5); background:var(--soft-accent); transform:translateY(-1px); }
.ws-speaker.is-narrator { border-style:dashed; color:var(--ink-accent); }
.ws-speaker:disabled { opacity:.45; cursor:default; transform:none; }
.ws-speaker__avatar {
  width:28px; height:28px; display:grid; place-items:center; flex-shrink:0; overflow:hidden;
  border-radius:50%; object-fit:cover; color:#fff; font-size:11px; font-weight:700;
}
.ws-summary-bar {
  display:flex; gap:8px; align-items:center; padding:7px 18px; font-size:12px; color:var(--text-dim);
  background:rgba(255,178,36,.06); border-bottom:1px solid rgba(255,178,36,.14);
}
.ws-toast {
  position:fixed; bottom:26px; left:50%; transform:translateX(-50%) translateY(12px);
  background:var(--card-2); border:1px solid var(--border-strong); border-radius:12px;
  padding:10px 18px; font-size:13px; z-index:2000; opacity:0; transition:.2s; pointer-events:none; max-width:min(70vw,520px); margin-bottom:env(safe-area-inset-bottom,0px);
  box-shadow:0 12px 36px rgba(12,8,22,.18);
}
.ws-toast.show { opacity:1; transform:translateX(-50%); }
.ws-toast.err { border-color:rgba(248,113,113,.45); }
.ws-modal {
  position:fixed; inset:0; background:var(--overlay); backdrop-filter:blur(6px); z-index:80; display:grid; place-items:center; padding:20px;
}
.ws-modal--top { z-index:90; }
.ws-modal__card {
  width:min(620px,100%); max-height:88vh; overflow-y:auto; background:var(--card);
  border:1px solid var(--border-strong); border-radius:18px; padding:22px;
  box-shadow:0 12px 36px rgba(12,8,22,.2);
}
.ws-modal__card h3 { font-size:16px; margin-bottom:14px; }
.ws-field { margin-bottom:12px; }
.ws-field > label { display:block; font-size:12px; color:var(--text-dim); margin-bottom:5px; }
.ws-field input[type=text], .ws-field input[type=password], .ws-field input[type=email], .ws-field input[type=number], .ws-field textarea, .ws-field select {
  width:100%; background:var(--field); border:1px solid var(--border); border-radius:10px;
  color:var(--text); padding:9px 12px; font-size:13px; outline:none; resize:vertical;
  transition:border-color .15s, box-shadow .15s;
}
.ws-field input:focus, .ws-field textarea:focus, .ws-field select:focus { border-color:var(--accent); box-shadow:0 0 0 3px var(--soft-accent); }
.ws-field .hint { font-size:11px; color:var(--text-faint); margin-top:4px; }
.ws-row2 { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.ws-btn-grad { background:var(--grad); color:#fff; border-radius:11px; padding:10px 18px; font-weight:600; font-size:13px; box-shadow:var(--grad-shadow); transition:filter .15s; }
.ws-btn-grad:hover { filter:brightness(1.06); }
.ws-btn-ghost { border:1px solid var(--border-strong); border-radius:11px; padding:10px 16px; font-size:13px; color:var(--text-dim); transition:color .15s,border-color .15s; }
.ws-btn-ghost:hover { color:var(--text); border-color:rgba(239,115,101,.45); }
/* 角色扮演侧栏 · 角色库页签 */
.ws-rolebar { display:flex; gap:8px; margin:2px 4px 12px; }
.ws-rolebar__manage {
  flex:1; min-width:0; display:flex; align-items:center; gap:8px; padding:9px 12px; border-radius:12px;
  border:1px solid var(--border); background:var(--field); color:var(--text); font-size:13px; font-weight:500;
  cursor:pointer; transition:background .15s, border-color .15s;
}
.ws-rolebar__manage span { flex:1; text-align:left; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ws-rolebar__manage .ico { width:15px; height:15px; color:var(--ink-accent); flex-shrink:0; }
.ws-rolebar__manage .ws-rolebar__chev { width:13px; height:13px; color:var(--text-faint); transition:transform .15s; }
.ws-rolebar__manage:hover { background:var(--hover); border-color:var(--border-strong); }
.ws-rolebar__manage:hover .ws-rolebar__chev { transform:translateX(2px); }
.ws-rolebar__add {
  flex:0 0 38px; height:38px; display:grid; place-items:center; border-radius:12px; border:0; cursor:pointer;
  background:var(--grad); color:#fff; box-shadow:var(--grad-shadow); transition:filter .15s, transform .15s;
}
.ws-rolebar__add .ico { width:16px; height:16px; }
.ws-rolebar__add:hover { filter:brightness(1.08); transform:translateY(-1px); }
.ws-rolelist__label { margin:0 10px 6px; font-size:11px; letter-spacing:.04em; color:var(--text-faint); }
.ws-rolelist__empty { margin:18px 10px; padding:18px 12px; border:1px dashed var(--border-strong); border-radius:12px; text-align:center; color:var(--text-faint); font-size:12.5px; }
.ws-rolerow {
  display:flex; align-items:center; gap:11px; padding:9px 10px; margin-bottom:2px; border-radius:12px; cursor:pointer;
  transition:background .15s;
}
.ws-rolerow:hover, .ws-rolerow:focus-visible { background:var(--hover); }
.ws-rolerow__avatar {
  flex:0 0 38px; width:38px; height:38px; display:grid; place-items:center; border-radius:12px; overflow:hidden;
  background-size:cover; background-position:center; color:#fff; font-size:15px; font-weight:700; box-shadow:0 0 0 1px var(--border-strong);
}
.ws-rolerow__body { flex:1; min-width:0; display:flex; flex-direction:column; gap:2px; }
.ws-rolerow__name { display:flex; align-items:center; gap:6px; min-width:0; }
.ws-rolerow__name strong { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:13.5px; font-weight:600; }
.ws-rolerow__desc { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:11.5px; color:var(--text-dim); }
.ws-rolerow__chev { width:13px; height:13px; flex-shrink:0; color:var(--text-faint); opacity:0; transform:translateX(-3px); transition:opacity .15s, transform .15s; }
.ws-rolerow:hover .ws-rolerow__chev, .ws-rolerow:focus-visible .ws-rolerow__chev { opacity:1; transform:none; }
@media (hover:none) { .ws-rolerow__chev { opacity:.6; transform:none; } }

.ws-role-pick { display:flex; flex-wrap:wrap; gap:8px; }
.ws-pick-bar { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.ws-pick-bar .ws-role-pick { flex:1; min-width:0; }
.ws-pick-bar .ws-btn-ghost { flex-shrink:0; }
.ws-role-pick .rp {
  display:flex; align-items:center; gap:7px; border:1px solid var(--border); border-radius:12px;
  padding:7px 11px; cursor:pointer; font-size:13px; transition:border-color .15s,background .15s;
}
.ws-role-pick .rp.is-on { border-color:rgba(239,115,101,.55); background:var(--soft-accent); color:var(--ink-accent); }
.ws-role-pick .rp .av { width:26px; height:26px; border-radius:8px; display:grid; place-items:center; font-size:12px; color:#fff; font-weight:700; }
.ws-role-pick .rp img.av { object-fit:cover; }
.ws-role-pick .ws-chip-x {
  border:0; background:transparent; color:inherit; cursor:pointer; font-size:11px; opacity:.65; padding:0 2px; line-height:1;
}
.ws-role-pick .ws-chip-x:hover { opacity:1; }
.ws-pick-hint { font-size:12px; color:var(--text-faint); padding:4px 0; }
.ws-lang-select {
  max-width:120px; background:var(--field); border:1px solid var(--border); border-radius:10px;
  color:var(--text); padding:7px 8px; font-size:12.5px; outline:none;
}
.ws-form-row { display:flex; gap:8px; align-items:center; margin-bottom:10px; }
.ws-form-row input { flex:1; }

/* ---------- 角色库与角色编辑 ---------- */
.ws-role-library-dialog { width:min(920px,100%); padding:0; overflow:hidden; display:flex; flex-direction:column; max-height:90vh; }
.ws-role-editor-dialog { width:min(720px,100%); }
.ws-dialog-head {
  min-height:68px; display:flex; align-items:center; justify-content:space-between; gap:16px;
  padding:18px 20px; border-bottom:1px solid var(--border);
}
.ws-role-editor-dialog > .ws-dialog-head { margin:-22px -22px 18px; }
.ws-dialog-head h3 { margin:0 0 3px; }
.ws-dialog-head p { color:var(--text-faint); font-size:11.5px; }
.ws-dialog-head .ws-btn-grad { flex-shrink:0; display:inline-flex; align-items:center; gap:6px; }
.ws-dialog-foot { display:flex; justify-content:flex-end; gap:9px; padding:14px 20px; border-top:1px solid var(--border); }
.ws-role-editor-dialog .ws-dialog-foot { margin:18px -22px -22px; }
.ws-role-library { min-height:280px; max-height:min(58vh,560px); overflow-y:auto; flex:1; }
.ws-role-card {
  min-height:84px; display:grid; grid-template-columns:48px minmax(0,1fr) auto; align-items:center; gap:13px;
  padding:14px 20px; border-bottom:1px solid var(--border); transition:background .15s;
}
.ws-role-card:last-child { border-bottom:0; }
.ws-role-card:hover { background:var(--hover); }
.ws-role-card__avatar {
  width:48px; height:48px; display:grid; place-items:center; overflow:hidden; border-radius:50%; object-fit:cover;
  color:#fff; font-size:17px; font-weight:700; box-shadow:0 0 0 1px var(--border-strong);
}
.ws-role-card__body { min-width:0; }
.ws-role-card__title { display:flex; min-width:0; align-items:center; gap:6px; margin-bottom:4px; }
.ws-role-card__title strong { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:14px; }
.ws-role-tag {
  flex-shrink:0; border:1px solid var(--border); border-radius:8px; padding:1px 5px;
  color:var(--text-faint); background:var(--field); font-size:10px; line-height:1.5;
}
.ws-role-tag.is-gender { color:var(--ink-accent); border-color:rgba(239,115,101,.22); background:var(--soft-accent); }
.ws-role-card__desc { color:var(--text-dim); font-size:12px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ws-role-card__prompt {
  margin-top:3px; color:var(--text-faint); font-size:11.5px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.ws-role-card__actions { display:flex; align-items:center; gap:3px; }
.ws-role-card__actions button {
  width:36px; height:36px; display:grid; place-items:center; border-radius:8px; color:var(--text-dim);
  transition:color .15s,background .15s;
}
.ws-role-card__actions button:hover { color:var(--text); background:var(--hover-strong); }
.ws-role-card__actions button.is-danger:hover { color:var(--red); background:rgba(248,113,113,.1); }
.ws-role-library__empty { min-height:220px; display:grid; place-content:center; justify-items:center; gap:12px; color:var(--text-faint); font-size:13px; }
.ws-role-avatar-editor { display:flex; align-items:center; gap:16px; margin-bottom:18px; }
.ws-role-avatar-preview {
  width:72px; height:72px; display:grid; place-items:center; flex-shrink:0; overflow:hidden; border-radius:50%;
  color:#fff; font-size:22px; font-weight:700; box-shadow:0 0 0 1px var(--border-strong);
}
.ws-role-avatar-preview img { width:100%; height:100%; object-fit:cover; }
.ws-file-input { position:absolute; width:1px; height:1px; overflow:hidden; opacity:0; pointer-events:none; }
.ws-file-button { display:inline-flex; align-items:center; gap:6px; cursor:pointer; padding:8px 11px; }
.ws-avatar-remove { margin-left:8px; color:var(--red); font-size:12px; }
.ws-role-avatar-editor p { margin-top:6px; color:var(--text-faint); font-size:11px; }

/* 标签编辑：chips + 输入 + 已有标签建议 */
.ws-tag-editor {
  display:flex; flex-wrap:wrap; align-items:center; gap:6px;
  background:var(--field); border:1px solid var(--border); border-radius:10px; padding:7px 10px;
}
.ws-tag-editor:focus-within { border-color:var(--accent); box-shadow:0 0 0 3px var(--soft-accent); }
.ws-tag-editor__list { display:flex; flex-wrap:wrap; gap:6px; }
.ws-tag-editor__list .ws-role-tag {
  display:inline-flex; align-items:center; gap:4px; cursor:pointer;
  color:var(--ink-accent); border-color:rgba(239,115,101,.35); background:var(--soft-accent);
}
.ws-tag-editor__list .ws-role-tag:hover { border-color:rgba(248,113,113,.5); }
.ws-tag-editor input {
  flex:1; min-width:120px; border:0 !important; background:transparent !important; box-shadow:none !important;
  padding:2px 0 !important; font-size:13px;
}
.ws-tag-editor__suggest { display:flex; flex-wrap:wrap; gap:6px; margin-top:8px; }
.ws-tag-editor__suggest:empty { display:none; }
.ws-tag-editor__suggest .ws-role-tag { cursor:pointer; }
.ws-tag-editor__suggest .ws-role-tag:hover { border-color:rgba(239,115,101,.45); color:var(--ink-accent); }

/* ---------- 角色选择二级弹窗 ---------- */
.ws-role-picker-dialog { width:min(720px,100%); padding:0; overflow:hidden; display:flex; flex-direction:column; max-height:88vh; }
.ws-role-picker__filters {
  display:flex; flex-wrap:wrap; align-items:center; gap:10px;
  padding:12px 20px; border-bottom:1px solid var(--border);
}
.ws-role-picker__filters input[type=search] {
  flex:1; min-width:160px; background:var(--field); border:1px solid var(--border); border-radius:10px;
  color:var(--text); padding:8px 12px; font-size:13px; outline:none;
}
.ws-role-picker__tags { display:flex; flex-wrap:wrap; gap:6px; max-width:100%; }
.ws-role-picker__tag {
  border:1px solid var(--border); border-radius:999px; padding:3px 10px; cursor:pointer;
  font-size:11.5px; color:var(--text-dim); background:var(--field); transition:border-color .15s,background .15s,color .15s;
}
.ws-role-picker__tag.is-on {
  border-color:rgba(239,115,101,.55); background:var(--soft-accent); color:var(--ink-accent);
}
.ws-role-picker__page-size {
  display:inline-flex; align-items:center; gap:6px; font-size:12px; color:var(--text-dim); flex-shrink:0;
}
.ws-role-picker__page-size select {
  background:var(--field); border:1px solid var(--border); border-radius:8px; color:var(--text);
  padding:6px 8px; font-size:12.5px; outline:none;
}
.ws-role-picker__list {
  min-height:280px; max-height:min(52vh,480px); overflow-y:auto; flex:1;
}
.ws-role-picker__item {
  min-height:72px; display:grid; grid-template-columns:44px minmax(0,1fr) auto; align-items:center; gap:12px;
  padding:11px 20px; border-bottom:1px solid var(--border); cursor:pointer; transition:background .15s;
}
.ws-role-picker__item:hover { background:var(--hover); }
.ws-role-picker__item.is-on { background:var(--soft-accent); }
.ws-role-picker__item.is-on .ws-role-picker__check { opacity:1; color:var(--ink-accent); }
.ws-role-picker__item.is-disabled { opacity:.45; cursor:not-allowed; }
.ws-role-picker__item.is-disabled:hover { background:transparent; }
.ws-role-picker__check { opacity:0; color:var(--text-faint); font-size:12px; font-weight:700; }
.ws-role-picker__meta { display:flex; flex-wrap:wrap; gap:5px; margin-top:3px; }
.ws-role-picker__empty {
  min-height:280px; display:grid; place-content:center; color:var(--text-faint); font-size:13px;
}
.ws-role-picker__foot { justify-content:space-between; align-items:center; }
.ws-role-picker__pager { display:flex; align-items:center; gap:10px; font-size:12.5px; color:var(--text-dim); }
.ws-role-picker__pager button:disabled { opacity:.4; cursor:default; }
.ws-role-picker__actions { display:flex; gap:9px; }

/* ---------- Key 登录弹窗 ---------- */
.ws-key-card { width:min(420px,100%); }
.ws-key-status {
  font-size:12.5px; color:var(--text-dim); line-height:1.7;
  background:var(--soft-accent); border:1px solid rgba(239,115,101,.22);
  border-radius:10px; padding:9px 12px; margin-bottom:14px;
}
.ws-key-status b { color:var(--ink-accent); }
.ws-key-status a, .ws-key-status button { color:var(--ink-accent); }
.ws-key-tabs { display:flex; gap:4px; background:var(--field); border-radius:999px; padding:4px; margin-bottom:14px; }
.ws-key-tab { flex:1; padding:8px 0; border-radius:999px; font-size:13px; color:var(--text-dim); text-align:center; transition:background .15s,color .15s; }
.ws-key-tab.is-active { background:var(--grad); color:#fff; font-weight:600; }
.ws-or-divider { display:flex; align-items:center; gap:10px; color:var(--text-faint); font-size:11.5px; margin:16px 0 12px; }
.ws-or-divider::before, .ws-or-divider::after { content:""; flex:1; border-top:1px solid var(--border-strong); }
@media (max-width:820px) {
  .ws-side { position:fixed; z-index:60; left:0; top:0; bottom:0; transform:translateX(-100%); transition:.25s; }
  .ws-side.open { transform:none; }
  .ws-side-scrim.show { opacity:1; pointer-events:auto; }
  .ws-side-toggle { display:grid !important; }
  .ws-speaker-strip { display:block; margin-bottom:8px; }
  .ws-speaker-strip__label { display:block; margin-bottom:4px; }
  .ws-speaker-list { margin:0 -2px; }
  .ws-speaker { height:42px; padding-right:12px; }
  .ws-speaker__avatar { width:34px; height:34px; }
  .ws-role-library-dialog, .ws-role-editor-dialog {
    width:100%; height:100%; max-height:none; border:0; border-radius:0;
  }
  .ws-role-library-dialog { display:flex; flex-direction:column; }
  .ws-role-library { flex:1; max-height:none; }
  .ws-role-editor-dialog { padding:18px; }
  .ws-role-editor-dialog > .ws-dialog-head { margin:-18px -18px 16px; }
  .ws-role-editor-dialog .ws-dialog-foot { margin:16px -18px -18px; padding-bottom:max(14px,env(safe-area-inset-bottom)); }
  .ws-role-card { grid-template-columns:44px minmax(0,1fr) auto; gap:10px; padding:12px 14px; }
  .ws-role-card__avatar { width:44px; height:44px; }
}
@media (max-width:560px) {
  .ws-top { flex-wrap:wrap; padding:8px 12px; }
  .ws-top select { flex:1 1 150px; min-width:0; max-width:100%; }
  .ws-top .ws-caps { flex-wrap:wrap; }
  .ws-top-actions { width:100%; margin-left:0; justify-content:flex-end; }
  .ws-top-actions .ws-btn-ghost { padding:7px 9px; }
  .ws-modal { padding:0; }
  .ws-row2 { grid-template-columns:1fr; gap:0; }
  .ws-dialog-head { padding:14px; }
  .ws-dialog-head .ws-btn-grad { padding:9px 11px; }
  .ws-dialog-foot { padding:12px 14px; }
  .ws-role-card__desc { white-space:normal; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; }
  .ws-role-card__prompt { display:none; }
  .ws-role-card__actions button { width:34px; height:34px; }
  .ws-empty { min-height:310px; padding:20px 12px; }
  .ws-empty__card { grid-template-columns:1fr; gap:8px; min-height:0; padding:24px 18px 26px; border-radius:20px; }
  .ws-empty__art { min-height:180px; }
  .ws-empty__art img { width:min(250px,90%); height:185px; }
  .ws-empty__art::before { width:150px; height:150px; }
  .ws-empty__copy { text-align:center; }
  .ws-empty__eyebrow { justify-content:center; }
  .ws-empty__hint { margin-left:auto; margin-right:auto; }
  .ws-empty__chips, .ws-empty__actions { justify-content:center; }
  .ws-empty__bubble { display:none; }
}
.ws-side-toggle { display:none; border:1px solid var(--border); border-radius:9px; padding:7px 9px; color:var(--text-dim); }

/* 侧栏导航链接（生图/生视频/资料库快捷入口） */
.ws-side-nav { display: grid; gap: 4px; padding: 0 10px 8px; }
.ws-side-nav a {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; border-radius: 10px;
  color: var(--ink-dim, #a2a2ae); text-decoration: none;
  font-size: 13.5px; transition: background 0.15s, color 0.15s;
}
.ws-side-nav a:hover { background: var(--hover, rgba(255,255,255,0.06)); color: var(--ink, #f4f4f6); }
.ws-side-nav a.is-active { background: var(--soft-accent); color: var(--ink-accent, #ef7365); font-weight: 600; }
.ws-side-nav a .ico { width: 15px; height: 15px; flex-shrink: 0; }
.ws-side-divider { height: 1px; background: var(--border, rgba(255,255,255,0.08)); margin: 6px 12px; }

/* ============================================================
   双侧栏布局（仅 .ws-app.has-rail 生效，不影响 create/matting）
   结构：.ws-rail 一级窄导航 | .ws-side 二级上下文栏（可收起）| .ws-main
   状态类：.ws-app.is-panel-collapsed（二级栏收起）
   移动端：rail 变顶部图标条，side 变抽屉（.ws-side.open / .ws-side-scrim）
   ============================================================ */
.ws-app.has-rail {
  --rail-w: 64px;
  --panel-w: 260px;
  --panel-anim: .22s cubic-bezier(.4, 0, .2, 1);
}

/* ---------- 一级窄导航 ---------- */
.ws-rail {
  width: var(--rail-w); flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; padding: 12px 0 14px;
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  z-index: 40;
}
.ws-rail__logo {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center;
  margin-bottom: 6px; transition: background .15s;
}
.ws-rail__logo:hover { background: var(--hover); }
.ws-rail__logo img { width: 28px; height: 28px; border-radius: 8px; }
.ws-rail__nav {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px; width: 100%;
}
.ws-rail__btn {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  color: var(--text-dim); text-decoration: none;
  border: 1px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
  position: relative;
}
.ws-rail__btn .ico { width: 19px; height: 19px; }
.ws-rail__btn:hover { background: var(--hover); color: var(--text); }
.ws-rail__btn.is-active {
  background: var(--soft-accent); color: var(--ink-accent);
  border-color: rgba(239, 115, 101, .28); font-weight: 600;
}
.ws-rail__btn::after {
  content: attr(data-label);
  position: absolute; left: calc(100% + 8px); top: 50%;
  transform: translateY(-50%) scale(.92);
  background: var(--card-2); color: var(--text);
  font-size: 12px; padding: 5px 9px; border-radius: 7px;
  white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity .12s, transform .12s;
  border: 1px solid var(--border-strong);
  z-index: 80;
}
.ws-rail__btn:hover::after { opacity: 1; transform: translateY(-50%) scale(1); }
.ws-rail__spacer { flex: 1; }

/* ---------- 二级上下文栏（has-rail 页面） ---------- */
.ws-app.has-rail .ws-side {
  width: var(--panel-w); flex-shrink: 0;
  display: flex; flex-direction: column;
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  overflow: hidden;
  transition: width var(--panel-anim), opacity var(--panel-anim), transform .25s;
}
.ws-app.has-rail.is-panel-collapsed .ws-side {
  width: 0; opacity: 0; border-right-width: 0;
  pointer-events: none;
}

.ws-app.has-rail .ws-side__head {
  display: flex; align-items: center; gap: 8px;
  padding: 13px 12px 10px;
}
.ws-side__title {
  flex: 1; min-width: 0;
  font-size: 13.5px; font-weight: 600; color: var(--text-dim);
  letter-spacing: .02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ws-side__collapse {
  width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center;
  color: var(--text-dim); background: transparent;
  border: 1px solid var(--border);
  cursor: pointer; transition: background .15s, color .15s;
}
.ws-side__collapse:hover { background: var(--hover); color: var(--text); }
.ws-side__collapse .ico { width: 15px; height: 15px; }

/* 二级栏分段 tab（角色扮演：历史 / 角色库） */
.ws-side__tabs {
  display: flex; gap: 3px;
  margin: 0 12px 10px; padding: 3px;
  background: var(--field); border-radius: 9px;
}
.ws-side__tab {
  flex: 1; padding: 7px 0; border: 0; border-radius: 7px;
  background: transparent; color: var(--text-dim);
  font-size: 12.5px; cursor: pointer;
  transition: background .15s, color .15s;
}
.ws-side__tab:hover { color: var(--text); }
.ws-side__tab.is-active {
  background: var(--soft-accent); color: var(--ink-accent); font-weight: 600;
}

/* 二级栏操作区 */
.ws-side__actions {
  display: flex; flex-direction: column; gap: 7px;
  padding: 0 12px 10px;
}

/* 顶栏展开按钮（二级栏收起时显示） */
.ws-panel-expand {
  display: none;
  border: 1px solid var(--border); border-radius: 9px;
  padding: 7px 9px; color: var(--text-dim);
  background: transparent; cursor: pointer;
  transition: background .15s, color .15s;
}
.ws-panel-expand:hover { background: var(--hover); color: var(--text); }
.ws-panel-expand .ico { width: 15px; height: 15px; display: block; }
.ws-app.has-rail.is-panel-collapsed .ws-panel-expand { display: grid; place-items: center; }

/* ---------- 顶栏紧凑登录入口 ---------- */
.phx-auth-entry--top {
  display: flex; align-items: center;
  padding: 0; margin: 0;
}
.phx-auth-entry--top .phx-auth-entry__mascot { display: none; }
.phx-auth-entry--top .phx-auth-entry__panel { width: auto; }
.phx-auth-entry--top .phx-auth-entry__button {
  padding: 7px 12px; gap: 8px;
  border-radius: 10px;
}
.phx-auth-entry--top .phx-auth-entry__summary,
.phx-auth-entry--top .phx-auth-entry__legal { display: none; }
.phx-auth-entry--top .phx-auth-entry__button-copy strong { font-size: 12.5px; }
.phx-auth-entry--top .phx-auth-entry__button svg { width: 16px; height: 16px; }

/* ---------- 响应式：≤820px rail 顶条 + side 抽屉 ---------- */
@media (max-width: 820px) {
  .ws-app.has-rail { flex-direction: column; }

  .ws-app.has-rail .ws-rail {
    width: 100%; height: 54px;
    flex-direction: row; align-items: center;
    padding: 0 10px; gap: 4px;
    border-right: 0; border-bottom: 1px solid var(--border);
    overflow-x: auto;
  }
  .ws-rail__logo { margin: 0 6px 0 0; width: 34px; height: 34px; }
  .ws-rail__logo img { width: 24px; height: 24px; }
  .ws-rail__nav { flex-direction: row; width: auto; gap: 2px; }
  .ws-rail__btn { width: 40px; height: 40px; }
  .ws-rail__btn::after { display: none; }
  .ws-rail__spacer { display: none; }

  .ws-app.has-rail .ws-side {
    position: fixed; z-index: 60;
    left: 0; top: 54px; bottom: 0;
    width: min(var(--panel-w), 82vw);
    border-right: 1px solid var(--border);
    transform: translateX(-100%); opacity: 1;
    transition: transform .25s;
    pointer-events: auto;
  }
  .ws-app.has-rail .ws-side.open { transform: none; }
  .ws-app.has-rail.is-panel-collapsed .ws-side {
    width: min(var(--panel-w), 82vw);
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-100%);
  }
  .ws-app.has-rail.is-panel-collapsed .ws-side.open { transform: none; }

  .ws-app.has-rail .ws-side-toggle {
    display: grid !important;
    width: 38px; height: 38px;
  }
  .ws-app.has-rail .ws-panel-expand { display: none !important; }

  .phx-auth-entry--top .phx-auth-entry__button-copy { display: none; }
  .phx-auth-entry--top .phx-auth-entry__button { padding: 8px; }
}

/* ============================================================
   主页式 topbar 登录组件（btn-signin + user-chip）
   与主页 assets/css/style.css 同源风格，四页共用
   ============================================================ */
.btn-signin {
  position: relative;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  border: 1.5px solid transparent;
  background:
    linear-gradient(var(--bg-soft), var(--bg-soft)) padding-box,
    linear-gradient(90deg, #22d3a5, #38bdf8, #818cf8, #e879f9, #fb7185) border-box;
  background-size: 100% 100%, 250% 100%;
  animation: wsBorderFlow 6s linear infinite;
  transition: box-shadow .2s, transform .15s;
  cursor: pointer;
}
.btn-signin:hover {
  box-shadow: 0 0 22px rgba(129, 140, 248, .35);
  transform: translateY(-1px);
}
@keyframes wsBorderFlow {
  0% { background-position: 0 0, 0% 0; }
  100% { background-position: 0 0, 250% 0; }
}

.user-chip { position: relative; }
.user-chip__btn {
  display: flex; align-items: center; gap: 8px;
  height: 36px;
  border: 1px solid var(--border-strong);
  background: var(--hover);
  border-radius: 999px;
  padding: 4px 12px 4px 4px;
  color: var(--text);
  cursor: pointer;
  transition: border-color .2s;
}
.user-chip__btn:hover { border-color: rgba(239, 115, 101, .5); }
.user-chip__avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--grad);
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: #fff;
  overflow: hidden;
}
.user-chip__avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-chip__name {
  font-size: 13px; font-weight: 600;
  max-width: 110px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-chip__btn svg { width: 14px; height: 14px; fill: var(--text-dim); flex-shrink: 0; }

.user-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  width: 200px;
  background: var(--card-2);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .28);
  z-index: 80;
}
.user-menu__info { padding: 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.user-menu__info strong { display: block; font-size: 13px; margin-bottom: 2px; }
.user-menu__info span { font-size: 12px; color: var(--text-dim); }
.user-menu__item {
  display: block; width: 100%; text-align: left;
  padding: 9px 12px; border-radius: 9px;
  font-size: 13px; color: var(--text-dim);
  background: none; border: 0; cursor: pointer;
  text-decoration: none;
}
.user-menu__item:hover { background: var(--hover-strong); color: var(--text); }

/* 顶栏主题下拉（与主页 theme-select 一致） */
.theme-select {
  font: inherit; font-size: 12px;
  color: var(--text-dim);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 10px;
  cursor: pointer;
  max-width: 112px;
}
.theme-select:hover { color: var(--text); border-color: var(--border-strong); }

/* workspace 顶栏右侧行 */
.ws-top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.ws-top-actions .btn-signin { white-space: nowrap; }

@media (max-width: 560px) {
  .user-chip__name { display: none; }
  .user-chip__btn { padding: 4px 8px 4px 4px; }
}

/* ============================================================
   ws-rail 窄导航 ↔ 展开为带文字侧栏（Tabler Icons 统一图标）
   默认收起（图标栏）；底部按钮切换展开（图标+文字）
   状态类：.ws-rail.is-expanded
   ============================================================ */
.ws-rail__text {
  display: none;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ws-rail.is-expanded {
  width: 210px;
  align-items: stretch;
  padding: 12px 10px 14px;
}
.ws-rail.is-expanded .ws-rail__nav { align-items: stretch; }
.ws-rail.is-expanded .ws-rail__btn {
  display: flex;
  width: 100%;
  height: 42px;
  justify-content: flex-start;
  align-items: center;
  gap: 11px;
  padding: 0 12px;
}
.ws-rail.is-expanded .ws-rail__text { display: block; }
.ws-rail.is-expanded .ws-rail__btn .ico { flex-shrink: 0; }
.ws-rail.is-expanded .ws-rail__btn::after { display: none; }
.ws-rail.is-expanded .ws-rail__logo {
  display: flex;
  width: 100%;
  height: 40px;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  margin-bottom: 8px;
}
.ws-rail.is-expanded .ws-rail__logo::after {
  content: attr(data-brand);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: .01em;
}

/* 底部展开/收起按钮 */
.ws-rail__toggle {
  width: 44px; height: 40px;
  border-radius: 11px;
  display: grid; place-items: center;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.ws-rail__toggle:hover { background: var(--hover); color: var(--text); }
.ws-rail__toggle .ico { width: 18px; height: 18px; }
.ws-rail.is-expanded .ws-rail__toggle {
  width: 100%;
  height: 38px;
  display: flex;
  justify-content: center;
  gap: 8px;
}
.ws-rail.is-expanded .ws-rail__toggle .ws-rail__text {
  display: inline;
  font-size: 12.5px;
}

/* 移动端：rail 仍是顶部横条，展开态只显示文字标签 */
@media (max-width: 820px) {
  .ws-rail.is-expanded {
    width: 100%;
    align-items: center;
    padding: 0 10px;
  }
  .ws-rail.is-expanded .ws-rail__logo::after { content: none; }
  .ws-rail.is-expanded .ws-rail__btn {
    width: auto;
    height: 40px;
    padding: 0 10px;
    gap: 6px;
  }
  .ws-rail.is-expanded .ws-rail__toggle {
    width: 40px;
    margin-left: auto;
  }
  .ws-rail.is-expanded .ws-rail__toggle .ws-rail__text { display: none; }
  html.nav-pre-expanded .ws-rail {
    width: 100%;
    align-items: center;
    padding: 0 10px;
  }
  html.nav-pre-expanded .ws-rail .ws-rail__logo::after { content: none; }
  html.nav-pre-expanded .ws-rail .ws-rail__btn {
    width: auto;
    height: 40px;
    padding: 0 10px;
    gap: 6px;
  }
  html.nav-pre-expanded .ws-rail .ws-rail__toggle {
    width: 40px;
    margin-left: auto;
  }
  html.nav-pre-expanded .ws-rail .ws-rail__toggle .ws-rail__text { display: none; }
}


/* 首屏/页面切换：禁用过渡，避免「先窄后宽」的自动展开动画 */
.ws-app.no-anim .ws-side,
.ws-app.no-anim .ws-rail,
.ws-app.no-anim .ws-side * {
  transition: none !important;
}

/* 首屏预置标记：与 .ws-rail.is-expanded 视觉完全一致，避免「只有宽度没有内容」 */
html.nav-pre-expanded .ws-rail {
  width: 210px;
  align-items: stretch;
  padding: 12px 10px 14px;
}
html.nav-pre-expanded .ws-rail .ws-rail__nav { align-items: stretch; }
html.nav-pre-expanded .ws-rail .ws-rail__btn {
  display: flex;
  width: 100%;
  height: 42px;
  justify-content: flex-start;
  align-items: center;
  gap: 11px;
  padding: 0 12px;
}
html.nav-pre-expanded .ws-rail .ws-rail__text { display: block; }
html.nav-pre-expanded .ws-rail .ws-rail__btn .ico { flex-shrink: 0; }
html.nav-pre-expanded .ws-rail .ws-rail__btn::after { display: none; }
html.nav-pre-expanded .ws-rail .ws-rail__logo {
  display: flex;
  width: 100%;
  height: 40px;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  margin-bottom: 8px;
}
html.nav-pre-expanded .ws-rail .ws-rail__logo::after {
  content: attr(data-brand);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: .01em;
}
html.nav-pre-expanded .ws-rail .ws-rail__toggle {
  width: 100%;
  height: 38px;
  display: flex;
  justify-content: center;
  gap: 8px;
}
html.nav-pre-expanded .ws-rail .ws-rail__toggle .ws-rail__text {
  display: inline;
  font-size: 12.5px;
}

/* 需要大量输入的弹窗：点空白不关闭，卡片轻微抖动提示（data-modal-persistent） */
@keyframes ws-modal-nudge { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
.ws-modal__nudge { animation: ws-modal-nudge .32s ease-out; }
@media (prefers-reduced-motion: reduce) { .ws-modal__nudge { animation: none; } }

/* 系统开启「减少动态效果」时：关掉所有循环动画、过渡和平滑滚动（此前只有弹窗抖动尊重这个设置） */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration:.001ms !important; animation-iteration-count:1 !important; transition-duration:.001ms !important; scroll-behavior:auto !important; }
}
