/* ============================================================
   sp-v50.css  20260918 批次
   1) 工作台外壳高度根治（消除底部 26px 裁切 / 会员卡片遮挡 / 发送钮被挡）
   2) S2 作曲器「逐步确认 / 智能托管」分段滑动开关（1:1 参考站 .mode-switch）
   3) 玩法说明：横排圆角矩形（图标+文字），作曲器卡片内左下，不再被裁切
   4) 左侧智能体图标：玻璃渐变 + 彩色 conic 旋转光环（1:1 参考站右上圆钮）
   ============================================================ */

/* ---------- 1) 外壳高度根治（flex 列，彻底消除 margin 塌陷/100vh 溢出） ---------- */
body.workspace-page{
  display:flex; flex-direction:column;
  height:100vh; height:100dvh;
  overflow:hidden;
}
.workspace-shell.ws-v2{
  flex:1 1 auto; min-height:0;
  height:auto !important;
}
.ws-v2 .ws-main{
  height:100% !important;
  max-height:none !important;
  min-height:0;
}
#agentWorkspace.agent-ws{ min-height:0; }
#agentWorkspace .s2-studio-body{ min-height:0; }
#wsComposer.ws-composer{ flex:0 0 auto; }

/* ---------- 2) 分段滑动开关：逐步确认 / 智能托管 ---------- */
.s2c-ms{
  position:relative; display:flex; align-items:center;
  height:40px; padding:3px;
  border-radius:22px;
  background:rgba(0,0,0,.55);
  border:.67px solid rgba(255,255,255,.08);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.04);
  flex:0 0 auto;
}
.s2c-ms-slider{
  position:absolute; top:3px; left:3px;
  width:calc(50% - 3px); height:calc(100% - 6px);
  border-radius:19px;
  background:linear-gradient(135deg, rgba(0,202,224,.24), rgba(0,202,224,.07));
  border:.67px solid rgba(0,202,224,.42);
  box-shadow:0 0 12px rgba(0,202,224,.22);
  transition:transform .35s cubic-bezier(.4,0,.2,1);
  pointer-events:none;
}
.s2c-ms[data-flow="auto"] .s2c-ms-slider{ transform:translateX(100%); }
.s2c-ms-opt{
  position:relative; z-index:1;
  display:flex; align-items:center; gap:6px;
  height:34px; padding:0 13px;
  background:none; border:0; cursor:pointer;
  border-radius:18px;
  color:rgba(255,255,255,.62);
  font-size:13px; line-height:1; white-space:nowrap;
  transition:color .25s;
}
.s2c-ms-opt svg{ width:16px; height:16px; }
.s2c-ms-opt.on{ color:#04262e; font-weight:600; }
.s2c-ms-opt.on svg{ stroke:#04262e; }
.s2c-right{ gap:10px; align-items:center; }
/* 旧的两枚独立胶囊在 S2 作曲器里隐藏（避免与分段开关重复） */
#s2ComposerBar .s2c-flow-btn{ display:none !important; }

/* @GUIDE-ORDER-V4 */
/* 玩法说明：34px 纯圆形问号图标钮（1:1 参考 .guide-btn.is-icon-only），悬停在上方浮“玩法说明” */
#wsComposer.agent-mode .composer-bottom:has(#agPlaybookBtn){ position:relative; }
#wsComposer.agent-mode #agPlaybookBtn{
  position:static !important; display:inline-flex !important; flex:0 0 auto;
  align-items:center !important; justify-content:center !important; gap:0;
  width:34px !important; height:34px !important; min-width:34px; padding:0 !important;
  margin:0 8px 0 0 !important; border-radius:50% !important;
  background:rgba(0,202,224,.10) !important;
  border:1.33px solid rgba(0,202,224,.40) !important;
  color:rgba(0,202,224,.95) !important;
  box-shadow:0 0 12px rgba(0,202,224,.18) !important;
  transition:background .2s,border-color .2s,box-shadow .2s,transform .2s;
}
#wsComposer.agent-mode #agPlaybookBtn svg{ width:19px; height:19px; flex:0 0 auto; }
#wsComposer.agent-mode #agPlaybookBtn span{ display:none !important; }
#wsComposer.agent-mode #agPlaybookBtn::before{ content:none !important; }
#wsComposer.agent-mode #agPlaybookBtn::after{
  content:"玩法说明"; position:absolute; bottom:calc(100% + 8px); left:50%;
  transform:translateX(-50%) translateY(4px);
  background:rgba(8,16,22,.96); border:1px solid rgba(0,202,224,.35); color:#bff6fd;
  font-size:11.5px; line-height:1; white-space:nowrap; padding:6px 9px; border-radius:7px;
  box-shadow:0 6px 18px rgba(0,0,0,.45); opacity:0; pointer-events:none;
  transition:opacity .18s,transform .18s; z-index:200;
}
#wsComposer.agent-mode #agPlaybookBtn:hover{ background:rgba(0,202,224,.20) !important; border-color:rgba(0,202,224,.85) !important; transform:translateY(-1px); }
#wsComposer.agent-mode #agPlaybookBtn:hover::after{ opacity:1; transform:translateX(-50%) translateY(0); }
#wsComposer.agent-mode:has(#agPlaybookBtn) .s2cbar{ padding-left:0; margin-right:auto; }
#wsComposer:not(.agent-mode) #agPlaybookBtn{ display:none !important; }
/* 底栏排序：玩法说明 → 模型chips →（弹性空隙）→ 逐步确认/智能托管 → 发送钮(最右)，1:1 参考 */
#wsComposer.agent-mode .composer-bottom{ flex-wrap:nowrap; }
#wsComposer.agent-mode .composer-bottom > #agPlaybookBtn{ order:1; }
#wsComposer.agent-mode .composer-bottom > #s2ComposerBar{ order:2; }
#wsComposer.agent-mode .composer-bottom > #modeButtons{ order:3; }
#wsComposer.agent-mode .composer-bottom > #cpEnterHint{ order:4; }
#wsComposer.agent-mode .composer-bottom > #s2ModeSwitch{ order:5; margin-left:10px; flex:0 0 auto; }
#wsComposer.agent-mode .composer-bottom > .send-stack{ order:6; margin-left:10px; flex:0 0 auto; }
/* ---------- 4) 左侧智能体图标：玻璃渐变 + 彩色旋转光环 ---------- */
.agent-item .m-badge.ag-badge{
  position:relative;
  isolation:isolate;
  overflow:visible;
  box-shadow:0 4px 12px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.18);
}
.agent-item .m-badge.ag-badge img{
  position:relative; z-index:2;
  border-radius:inherit;
}
/* 顶部玻璃高光 */
.agent-item .m-badge.ag-badge::before{
  content:""; position:absolute; inset:0; z-index:3;
  border-radius:inherit; pointer-events:none;
  background:radial-gradient(120% 120% at 30% 22%, rgba(255,255,255,.28), rgba(255,255,255,0) 58%);
}
/* 彩色 conic 旋转光环（取该智能体主题色 --ag-rgb，回退青色） */
.agent-item .m-badge.ag-badge::after{
  content:""; position:absolute; z-index:-1;
  inset:-4px; border-radius:inherit;
  pointer-events:none;
  opacity:.22;
  background:conic-gradient(from 0deg,
    rgba(var(--ag-rgb,34,211,238),.85),
    rgba(var(--ag-rgb,34,211,238),.10) 28%,
    rgba(168,85,247,.55) 50%,
    rgba(var(--ag-rgb,34,211,238),.10) 72%,
    rgba(var(--ag-rgb,34,211,238),.85));
  filter:blur(5px);
  transition:opacity .3s;
}
.agent-item:hover .m-badge.ag-badge::after{
  opacity:.7;
  animation:spAgHaloSpin 3.2s linear infinite;
}
.agent-item.active .m-badge.ag-badge::after{
  opacity:.6;
  animation:spAgHaloSpin 6s linear infinite;
}
@keyframes spAgHaloSpin{ to{ transform:rotate(360deg); } }

/* ---------- 窄屏：分段开关紧凑、玩法说明缩窄 ---------- */
@media (max-width:640px){
  .s2c-ms-opt{ padding:0 10px; font-size:12px; }
  #wsComposer.agent-mode #agPlaybookBtn{ width:32px !important; height:32px !important; min-width:32px; }
}

/* ============================================================
   5) 对话历史：竖排轨 + 停靠第二侧栏（1:1 参考站 .celan-rail / .celan-panel）
   ============================================================ */
.ws-v2 .sb-history-rail{
  display:none;
  flex-direction:column; align-items:center; justify-content:center; gap:7px;
  width:42px; min-height:132px; padding:12px 0;
  position:fixed; top:50%; transform:translateY(-50%);
  z-index:1390;
  border-radius:14px 0 0 14px;
  background:rgba(18,22,34,.72);
  backdrop-filter:blur(14px) saturate(1.3);
  border:1px solid rgba(255,255,255,.08); border-right:0;
  color:rgba(255,255,255,.72);
  box-shadow:-8px 0 26px rgba(0,0,0,.35);
  transition:background .2s,color .2s,transform .2s;
}
.ws-v2 .sb-history-rail.has{ display:flex; }
.ws-v2 .sb-history-rail:hover{ background:rgba(28,34,50,.9); color:#ffe08a; transform:translateY(-50%) translateX(-2px); }
.ws-v2 .sb-history-rail .hr-ico{ display:flex; color:#ffd34d; }
.ws-v2 .sb-history-rail .hr-txt{ writing-mode:vertical-rl; text-orientation:upright; font-size:13px; letter-spacing:2px; line-height:1; }
.ws-v2 .sb-history-rail .hr-count{
  min-width:18px; height:18px; padding:0 5px; border-radius:999px;
  display:flex; align-items:center; justify-content:center;
  font-size:11px; font-weight:700; color:rgba(255,224,126,.95); background:rgba(255,215,0,.12);
}
@media (min-width:1920px){.ws-v2 .sb-history-rail{left:320px;}}
@media (max-width:1440px) and (min-width:1281px){.ws-v2 .sb-history-rail{left:288px;}}
@media (max-width:1280px){.ws-v2 .sb-history-rail{left:264px;}}
.ws-v2 .ws-sidebar.collapsed ~ .sb-history-rail{left:0 !important;}
@media (max-width:991px){.ws-v2 .sb-history-rail{display:none !important;}}

#historyPanel.history-panel{
  left:264px !important; right:auto !important; top:0 !important; bottom:0 !important;
  width:294px !important; height:100dvh !important;
  border-radius:0 !important;
  border-left:0 !important; border-right:.67px solid rgba(255,255,255,.06) !important;
  background:rgba(12,15,24,.82) !important;
  backdrop-filter:blur(21px) saturate(1.4);
  box-shadow:24px 0 60px rgba(0,0,0,.45) !important;
  z-index:1400 !important;
  padding:14px 13px !important;
  display:flex; flex-direction:column; gap:10px;
  animation:histDockIn .22s ease !important;
}
@keyframes histDockIn{ from{transform:translateX(-12px);opacity:.4;} to{transform:translateX(0);opacity:1;} }
@media (min-width:1920px){#historyPanel.history-panel{left:320px !important;}}
@media (max-width:1440px) and (min-width:1281px){#historyPanel.history-panel{left:288px !important;}}
@media (max-width:991px){#historyPanel.history-panel{left:0 !important;width:min(320px,88vw) !important;}}
#historyPanel.history-panel.hidden{display:none !important;}

#historyPanel .history-head{ display:flex;align-items:center;justify-content:space-between;flex:0 0 auto; }
#historyPanel .hh-title{ display:flex;align-items:center;gap:7px;color:#ffe08a;font-size:15px;font-weight:700;}
#historyPanel .hh-clock{ color:#ffd34d; font-size:15px; }
#historyPanel .hh-unread{
  min-width:20px;height:19px;padding:0 6px;border-radius:999px;
  display:inline-flex;align-items:center;justify-content:center;
  font-size:11.5px;font-weight:700;color:rgba(255,224,126,.92);background:rgba(255,215,0,.1);
}
#historyPanel .hh-tools{display:flex;gap:6px;}
#historyPanel .hh-tools button{
  width:32px;height:32px;border-radius:9px;border:1px solid rgba(255,255,255,.08);
  background:rgba(255,255,255,.04);color:rgba(255,255,255,.7);font-size:15px;cursor:pointer;
}
#historyPanel .hh-tools button:hover{background:rgba(255,255,255,.1);color:#fff;}

#historyPanel .hp-new-chat{
  flex:0 0 auto; height:38px; border:0; border-radius:12.6px; cursor:pointer;
  font-size:14px;font-weight:700;color:rgb(44,31,0);
  background:linear-gradient(135deg,rgb(255,224,102),rgb(255,197,61) 48%,rgb(240,147,43));
  box-shadow:inset 0 1.05px 0 rgba(255,255,255,.45),0 1.05px 2.1px rgba(0,0,0,.18),0 4.2px 14.7px rgba(240,147,43,.22);
}
#historyPanel .hp-new-chat:hover{ filter:brightness(1.05); }

#historyPanel .history-search{
  flex:0 0 auto; display:flex;align-items:center;gap:8px;height:36px;padding:0 12px;
  border-radius:10px;background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.07);
}
#historyPanel .history-search span{ color:rgba(255,255,255,.4);font-size:13px; }
#historyPanel .history-search input{ flex:1;min-width:0;background:transparent;border:0;outline:0;color:#fff;font-size:13px;}
#historyPanel .history-search input::placeholder{ color:rgba(255,255,255,.35); }

#historyPanel .hp-toolrow{ flex:0 0 auto;display:flex;align-items:center;justify-content:space-between; }
#historyPanel .hp-selectall{ display:flex;align-items:center;gap:6px;font-size:12.5px;color:rgba(255,255,255,.6);cursor:pointer;}
#historyPanel .hp-viewtoggle{ display:flex;align-items:center;gap:6px; }
#historyPanel .hp-viewtoggle button{
  height:28px;padding:0 10px;border-radius:8px;font-size:12px;cursor:pointer;
  background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.08);color:rgba(255,255,255,.72);
}
#historyPanel .hp-batch-del{ color:#ffb4b4 !important; }
#historyPanel .hp-batch-del:hover{ background:rgba(244,63,94,.16)!important;border-color:rgba(244,63,94,.4)!important;}

#historyPanel .history-list{ flex:1 1 auto; overflow-y:auto; margin:2px -4px 0;padding:0 4px; display:flex;flex-direction:column;gap:6px;}
#historyPanel .history-empty{ color:rgba(255,255,255,.4);font-size:13px;line-height:1.7;text-align:center;padding:40px 14px; }

#historyPanel .duihua-item{
  position:relative; display:flex; align-items:flex-start; gap:9px;
  min-height:64px; padding:9px; border-radius:12px; cursor:pointer;
  border:1px solid transparent; background:transparent;
  transition:background .16s,border-color .16s;
}
#historyPanel .duihua-item:hover{ background:rgba(255,255,255,.05); }
#historyPanel .duihua-item.active{
  background:linear-gradient(135deg,rgba(255,211,77,.16),rgba(240,147,43,.08));
  border-color:rgba(255,211,77,.4);
}
#historyPanel .duihua-item .item-check{ display:flex;align-items:center;height:22px;margin-top:2px; }
#historyPanel .duihua-item .item-check input{ accent-color:#ffd34d; width:14px;height:14px;cursor:pointer; }
#historyPanel .duihua-item .item-icon{
  flex:0 0 auto; width:28px;height:28px;border-radius:8px;overflow:hidden;
  display:flex;align-items:center;justify-content:center;margin-top:1px;background:transparent;
}
#historyPanel .duihua-item .item-icon .m-badge{ margin:0 !important; box-shadow:none !important; }
#historyPanel .duihua-item .item-icon img{ width:26px;height:26px;border-radius:7px;object-fit:cover;display:block;}
#historyPanel .duihua-item .item-icon .mb-letter{ width:26px;height:26px;border-radius:7px;color:#fff;font-size:13px;font-weight:700;display:flex;align-items:center;justify-content:center;}
#historyPanel .duihua-item .item-content{ flex:1 1 auto; min-width:0; display:flex;flex-direction:column;gap:5px;}
#historyPanel .duihua-item .item-title{ display:flex;align-items:center;gap:6px;min-width:0;}
#historyPanel .duihua-item .title-text{
  flex:1 1 auto; min-width:0; font-size:13.5px; line-height:1.35; color:rgba(255,255,255,.82);
  overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;
}
#historyPanel .duihua-item.active .title-text{ color:rgb(255,235,150);font-weight:600;}
#historyPanel .duihua-item .dui-hua-tag{
  flex:0 0 auto; font-size:10.5px; line-height:1; padding:3px 6px; border-radius:6px;
  color:rgba(125,211,252,.95); background:rgba(56,189,248,.12); border:1px solid rgba(56,189,248,.25);
}
#historyPanel .duihua-item .item-meta{ display:flex;align-items:center;}
#historyPanel .duihua-item .item-meta-left{ display:flex;align-items:center;gap:8px;min-width:0;}
#historyPanel .duihua-item .item-count{ font-size:11.5px;color:rgb(255,211,77);font-weight:700;}
#historyPanel .duihua-item .item-time{ display:flex;gap:6px;font-size:11px;color:rgba(255,255,255,.4);}

/* @GUIDE-CIRCLE-V5 */
#wsComposer.agent-mode:has(#s2ComposerBar) #agPlaybookBtn{
  position:static !important; display:inline-flex !important; flex:0 0 auto;
  align-items:center !important; justify-content:center !important; gap:0 !important;
  width:34px !important; height:34px !important; min-width:34px !important; max-width:34px !important;
  padding:0 !important; margin:0 8px 0 0 !important; border-radius:50% !important;
  background:rgba(0,202,224,.10) !important;
  border:1.33px solid rgba(0,202,224,.40) !important;
  color:rgba(0,202,224,.95) !important; font-size:0 !important; line-height:1 !important; white-space:nowrap;
  box-shadow:0 0 12px rgba(0,202,224,.18) !important;
  transition:background .2s,border-color .2s,box-shadow .2s,transform .2s;
}
#wsComposer.agent-mode:has(#s2ComposerBar) #agPlaybookBtn svg{ width:19px !important; height:19px !important; flex:0 0 auto; }
#wsComposer.agent-mode:has(#s2ComposerBar) #agPlaybookBtn span{ display:none !important; }
#wsComposer.agent-mode:has(#s2ComposerBar) #agPlaybookBtn::before{ content:none !important; }
#wsComposer.agent-mode:has(#s2ComposerBar) #agPlaybookBtn::after{
  content:"玩法说明" !important; position:absolute !important; bottom:calc(100% + 8px) !important; left:50% !important;
  transform:translateX(-50%) translateY(4px) !important;
  background:rgba(8,16,22,.96) !important; border:1px solid rgba(0,202,224,.35) !important; color:#bff6fd !important;
  font-size:11.5px !important; font-weight:500; line-height:1 !important; white-space:nowrap; padding:6px 9px !important;
  border-radius:7px !important; box-shadow:0 6px 18px rgba(0,0,0,.45); opacity:0; pointer-events:none;
  transition:opacity .18s,transform .18s; z-index:200;
}
#wsComposer.agent-mode:has(#s2ComposerBar) #agPlaybookBtn:hover{ background:rgba(0,202,224,.20) !important; border-color:rgba(0,202,224,.85) !important; transform:translateY(-1px); }
#wsComposer.agent-mode:has(#s2ComposerBar) #agPlaybookBtn:hover::after{ opacity:1; transform:translateX(-50%) translateY(0) !important; }
@media (max-width:640px){
  #wsComposer.agent-mode:has(#s2ComposerBar) #agPlaybookBtn{ width:32px !important; height:32px !important; min-width:32px !important; max-width:32px !important; }
}

/* @GUIDE-PACK-V6 */
#wsComposer.agent-mode .composer-bottom:has(#s2ComposerBar){ justify-content:flex-start !important; }
#wsComposer.agent-mode .composer-bottom > #agPlaybookBtn{ margin:0 8px 0 0 !important; }
#wsComposer.agent-mode .composer-bottom > #s2ComposerBar{ margin-right:auto !important; padding-left:0 !important; }
#wsComposer.agent-mode .composer-bottom > #s2ModeSwitch{ margin-left:10px !important; }
#wsComposer.agent-mode .composer-bottom > .send-stack{ margin-left:8px !important; }

/* @GUIDE-PACK2-V7 */
#wsComposer.agent-mode .composer-bottom > #s2ModeSwitch{ margin-left:auto !important; }
#wsComposer.agent-mode .composer-bottom > .send-stack{ margin-left:10px !important; }
/* @MODE-ORDER-ANY-V8 */
#wsComposer:has(#s2ModeSwitch) .composer-bottom{flex-wrap:nowrap;justify-content:flex-start !important;}
#wsComposer:has(#s2ModeSwitch) .composer-bottom > #s2ModeSwitch{order:5 !important;margin-left:auto !important;flex:0 0 auto;}
#wsComposer:has(#s2ModeSwitch) .composer-bottom > .send-stack{order:6 !important;margin-left:10px !important;flex:0 0 auto;}
