/* ============================================================
   S011 内置助手 —— 样式（1080×2388 舞台坐标）
   ------------------------------------------------------------
   视觉定稿：demo/assist-style.html（浅蓝紫水彩风 —— 冷白底 + 大留白 + 衬线
   标题 + 虚线分隔 + 细线 Lucide 图标）。数值 = demo 的 392px 宽度按
   1080/392 ≈ 2.755 等比放大，所以看上去跟 demo 一致。

   两条硬规矩（AGENTS.md）：
   ① 字体只写在 html,body —— **别用 `*{}` 去套**，那会连字号/行高一起改（实测差 4~6px）；
   ② 夜间靠 `html.dark` 切这套 --as-*，不另写一份 CSS。
   ============================================================ */

/* ---------- 助手自有配色 ---------- */
:root{
  --as-bg:#F7F9FC;              /* 冷白底（比宿主的 --s-bg:#fff 更冷一点，是这一屏的调子） */
  --as-card:#FFFFFF;
  --as-ink:#3B4356;             /* 墨色偏蓝灰，不用纯黑 */
  --as-ink2:#8B95A9;
  --as-ink3:#AEB7C7;
  --as-line:rgba(122,140,170,.20);
  --as-hair:rgba(122,140,170,.13);
  --as-accent:#7E9BD1;          /* 浅蓝紫（主色） */
  --as-accent2:#5B79B5;
  --as-soft:rgba(126,155,209,.12);
  --as-accent-line:rgba(126,155,209,.34);
  --as-danger:#C0777F;
  --as-mono:"Roboto","Source Han Serif CN",ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
}
html.dark{
  --as-bg:#161616;              /* ≈ 宿主 --s-bg */
  --as-card:#242424;            /* ≈ 宿主 --s-card */
  --as-ink:#E8E8E8;
  --as-ink2:#9A9A9A;
  --as-ink3:#6E6E6E;
  --as-line:rgba(255,255,255,.16);
  --as-hair:rgba(255,255,255,.10);
  --as-accent:#8FA6C8;
  --as-accent2:#AFC3E0;
  --as-soft:rgba(143,166,200,.16);
  --as-accent-line:rgba(143,166,200,.34);
  --as-danger:#C98C93;
}

#S011{ background:var(--as-bg); color:var(--as-ink); }
.as-wrap{ position:absolute; inset:0; display:flex; flex-direction:column; }

/* ---------- 顶栏 ---------- */
.as-top{
  flex:none; display:flex; align-items:center; gap:26px;
  padding:38px 44px 33px; border-bottom:1px dashed var(--as-line);
}
.as-icbtn{
  flex:none; width:94px; height:94px; border-radius:30px;
  display:flex; align-items:center; justify-content:center;
  color:var(--as-ink2); cursor:pointer; background:transparent;
  border:1px solid transparent; transition:color .15s, background .15s, border-color .15s;
  -webkit-tap-highlight-color:transparent;
}
.as-icbtn:active,.as-icbtn.on{ color:var(--as-accent2); background:var(--as-soft); border-color:var(--as-accent-line); }
.as-title{
  flex:1; text-align:center; font-size:47px; font-weight:400;
  letter-spacing:.14em; color:var(--as-ink); line-height:1.15;
}
.as-title small{ display:block; font-size:29px; letter-spacing:.22em; color:var(--as-ink3); margin-top:8px; }

/* ---------- 消息区 ---------- */
.as-msgs{
  flex:1; overflow-y:auto; overflow-x:hidden; overscroll-behavior:contain;
  /* ⚠ 左边留 78 是给定位轨道的一条专用列（轨道最宽 46 + 左右各 10 余量）；
     不留的话轨道会压在气泡左缘上。右边仍是 44。 */
  padding:55px 44px 66px 78px; display:flex; flex-direction:column; gap:36px;
  scrollbar-width:none;
}
.as-msgs::-webkit-scrollbar{ display:none; }
/* ⚠ 列向 flex 的子项默认 flex-shrink:1 —— 内容超高时会把子项压扁，
   而带 overflow:hidden 的子项 min-height 解析成 0（直接压成一条线，工具卡片踩过）。
   消息区必须"超出就滚"，不许压子项。 */
.as-msgs>*{ flex:none; }

.as-daysep{
  display:flex; align-items:center; gap:28px; margin:6px 0 16px;
  font-size:30px; color:var(--as-ink3); letter-spacing:.1em;
}
.as-daysep::before,.as-daysep::after{ content:""; flex:1; border-top:1px dashed var(--as-line); }

.as-msg{
  max-width:82%; font-size:37px; line-height:1.85; letter-spacing:.01em;
  padding:30px 39px; border-radius:44px; word-break:break-word;
  cursor:pointer; -webkit-tap-highlight-color:transparent;
}
.as-msg.a{ align-self:flex-start; background:var(--as-card); border:1px solid var(--as-line); border-top-left-radius:19px; }
.as-msg.me{ align-self:flex-end; background:var(--as-soft); border:1px solid var(--as-accent-line); border-top-right-radius:19px; }
.as-msg .as-who{ display:block; font-size:29px; letter-spacing:.14em; color:var(--as-ink3); margin-bottom:14px; }
.as-msg .as-tx{ white-space:pre-wrap; }
.as-msg .as-tx code{ font-family:var(--as-mono); font-size:34px; color:var(--as-accent2); }
/* 光标（流式中） */
.as-caret{ display:inline-block; width:4px; height:34px; vertical-align:-4px;
  background:var(--as-accent); animation:as-blink 1s steps(1) infinite; }
@keyframes as-blink{ 50%{ opacity:0; } }

/* 选中某条消息 → 底下冒出操作行（编辑重发 / 删除 / 重新生成） */
.as-acts{ display:none; gap:14px; margin-top:20px; flex-wrap:wrap; }
.as-msg.on .as-acts{ display:flex; }

/* ---------- 发出去的图：气泡里的缩略图 + 点开看大图（灯箱） ----------
   存的是**压缩后**的 dataURL（最长边 1280 / jpeg 0.82，见 assist.ts 的 compressImage）。 */
.as-thumbs{ display:flex; gap:14px; flex-wrap:wrap; margin-top:18px; }
.as-thumb{ width:200px; height:200px; object-fit:cover; border-radius:19px;
  border:1px solid var(--as-line); cursor:zoom-in; background:var(--as-soft); }
.as-lightbox{ position:fixed; inset:0; z-index:99; display:none; align-items:center; justify-content:center;
  background:rgba(12,16,22,.82); padding:40px; }
.as-lightbox.on{ display:flex; }
.as-lightbox img{ max-width:100%; max-height:100%; border-radius:19px; box-shadow:0 18px 60px rgba(0,0,0,.5); }

/* ---------- 工具卡片（二期接工具；一期只会出现"执行中"占位） ---------- */
.as-tool{
  align-self:flex-start; width:88%; border:1px solid var(--as-line); border-radius:39px;
  background:var(--as-card); overflow:hidden;
}
.as-tool.running{ border-color:var(--as-accent-line); background:var(--as-soft); }
.as-tool.fail{ border-color:rgba(192,119,127,.36); }
.as-tool-h{
  display:flex; align-items:center; gap:22px; padding:28px 33px;
  border-bottom:1px dashed var(--as-hair); font-size:34px;
  background:rgba(126,155,209,.05);
}
html.dark .as-tool-h{ background:rgba(143,166,200,.07); }
.as-tool-h .nm{ color:var(--as-ink); letter-spacing:.03em; }
.as-tool-h .nm b{ font-weight:400; color:var(--as-accent2); }
.as-tool-h .sp{ flex:1; }
.as-tool-b{ padding:28px 33px; font-size:33px; line-height:1.8; color:var(--as-ink2); font-family:var(--as-mono); }
.as-tool-f{ display:flex; align-items:center; gap:22px; padding:22px 33px; border-top:1px dashed var(--as-hair); }
.as-tool-f .sp{ flex:1; }

.as-chip{
  display:inline-flex; align-items:center; gap:11px; font-size:30px; letter-spacing:.06em;
  padding:7px 25px; border-radius:999px; border:1px solid var(--as-line); color:var(--as-ink2);
}
.as-chip.run{ color:var(--as-accent2); border-color:var(--as-accent-line); background:var(--as-card); }
.as-chip.ok{ color:var(--as-accent2); border-color:var(--as-accent-line); }
.as-chip.no{ color:var(--as-danger); border-color:rgba(192,119,127,.4); }
.as-spin{ display:inline-flex; animation:as-spin 1s linear infinite; }
@keyframes as-spin{ to{ transform:rotate(360deg); } }

.as-mini{
  display:inline-flex; align-items:center; gap:14px; font-family:inherit; font-size:32px;
  color:var(--as-accent2); background:transparent; border:1px solid var(--as-accent-line);
  padding:11px 30px; border-radius:999px; cursor:pointer; transition:background .15s;
  white-space:nowrap; flex:none;      /* ⚠ 不加这两条，在窄行里「撤销」会被挤成两行 */
}
.as-mini:active{ background:var(--as-soft); }
.as-mini.mute{ color:var(--as-ink2); border-color:var(--as-line); }

/* ---------- 输入行 ---------- */
.as-composer{
  flex:none; display:flex; align-items:center; gap:26px;
  padding:33px 39px 55px; border-top:1px dashed var(--as-line);
}
.as-pill{
  flex:1; display:flex; align-items:center; gap:24px;
  background:var(--as-card); border:1px solid var(--as-line); border-radius:999px;
  padding:28px 41px; transition:border-color .15s;
}
.as-pill:focus-within{ border-color:var(--as-accent-line); }
.as-pill input{
  flex:1; border:0; outline:0; background:transparent;
  font-family:inherit; font-size:37px; color:var(--as-ink);
}
.as-pill input::placeholder{ color:var(--as-ink3); }
.as-send{
  flex:none; width:110px; height:110px; border-radius:50%; border:0; cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  background:var(--as-accent); color:#fff; box-shadow:0 10px 28px var(--as-soft);
  transition:background .15s, transform .15s;
}
.as-send:active{ transform:scale(.94); }
.as-send.busy{ background:var(--as-ink3); }
html.dark .as-send{ color:#161616; }

/* ---------- 会话抽屉 ---------- */
.as-scrim{
  position:absolute; inset:0; background:rgba(18,24,38,.30);
  opacity:0; pointer-events:none; transition:opacity .22s; z-index:18;
}
#S011.drawer-open .as-scrim{ opacity:1; pointer-events:auto; }
.as-drawer{
  position:absolute; top:0; bottom:0; left:0; width:76%; max-width:826px;
  background:var(--as-bg); border-right:1px solid var(--as-line); z-index:19;
  display:flex; flex-direction:column; transform:translateX(-102%);
  transition:transform .28s cubic-bezier(.2,.8,.2,1);
}
#S011.drawer-open .as-drawer{ transform:none; }
.as-drawer-top{
  flex:none; display:flex; align-items:center; gap:22px;
  padding:44px 44px 36px; border-bottom:1px dashed var(--as-line);
  font-size:37px; letter-spacing:.12em; color:var(--as-ink2);
}
.as-drawer-top .sp{ flex:1; }
.as-drawer-list{ flex:1; overflow-y:auto; padding:22px 28px; scrollbar-width:none; }
.as-drawer-list::-webkit-scrollbar{ display:none; }
.as-sess{
  position:relative; padding:30px 33px; border-radius:33px; cursor:pointer;
  display:flex; flex-direction:column; gap:11px; transition:background .15s;
}
.as-sess:active{ background:var(--as-hair); }
.as-sess.on{ background:var(--as-soft); }
.as-sess .t{ font-size:37px; color:var(--as-ink); line-height:1.4;
  padding-right:126px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.as-sess .m{ font-size:30px; color:var(--as-ink3); letter-spacing:.06em; display:flex; align-items:center; gap:16px; }
.as-sess .acts{ position:absolute; right:22px; top:25px; display:flex; gap:6px; }
.as-sess .acts .as-icbtn{ width:72px; height:72px; border-radius:22px; }
.as-sess+.as-sess::before{
  content:""; position:absolute; left:33px; right:33px; top:-1px; border-top:1px dashed var(--as-hair);
}
.as-drawer-foot{ flex:none; padding:28px 33px 50px; border-top:1px dashed var(--as-line); }
.as-newbtn{
  display:flex; align-items:center; justify-content:center; gap:19px; width:100%;
  font-family:inherit; font-size:37px; color:var(--as-accent2); cursor:pointer;
  background:var(--as-soft); border:1px solid var(--as-accent-line);
  padding:30px; border-radius:33px;
}
.as-newbtn:active{ background:var(--as-card); }

/* ---------- 设置弹层（底部） ---------- */
.as-sheetwrap{
  position:absolute; inset:0; z-index:21; display:flex; align-items:flex-end;
  background:rgba(18,24,38,.30); opacity:0; pointer-events:none; transition:opacity .22s;
}
/* ⚠ 这里必须用 **id** 区分两个弹层：问题清单也复用了 .as-sheetwrap 的外观，
   要是按类名开合，settings 一开问题清单也会跟着开（两个一起冒出来）。 */
#S011.sheet-open #as-sheetwrap{ opacity:1; pointer-events:auto; }
.as-sheet{
  width:100%; background:var(--as-bg); border-radius:66px 66px 0 0;
  padding:28px 50px 66px; transform:translateY(38px);
  transition:transform .26s cubic-bezier(.2,.8,.2,1); max-height:88%; overflow-y:auto;
  scrollbar-width:none;
}
.as-sheet::-webkit-scrollbar{ display:none; }
#S011.sheet-open .as-sheet{ transform:none; }
.as-grab{ width:105px; height:11px; border-radius:99px; background:var(--as-line); margin:11px auto 39px; }
.as-sheet h3{ margin:0 0 11px; font-size:42px; font-weight:400; letter-spacing:.1em; color:var(--as-ink); }
.as-sheet .as-sub{ font-size:32px; color:var(--as-ink3); letter-spacing:.06em; margin-bottom:39px; }
.as-opt{
  display:flex; align-items:flex-start; gap:30px; padding:33px; border-radius:36px;
  cursor:pointer; border:1px solid transparent; transition:background .15s, border-color .15s;
}
.as-opt:active{ background:var(--as-hair); }
.as-opt.on{ background:var(--as-soft); border-color:var(--as-accent-line); }
.as-opt .badge{
  flex:none; width:88px; height:88px; border-radius:28px;
  display:flex; align-items:center; justify-content:center;
  background:var(--as-soft); color:var(--as-accent2);
}
.as-opt .txt{ flex:1; min-width:0; }
.as-opt .txt .n{ font-size:37px; color:var(--as-ink); }
.as-opt .txt .d{ font-size:32px; color:var(--as-ink2); line-height:1.75; margin-top:9px; }
.as-opt .dot{
  flex:none; width:44px; height:44px; border-radius:50%;
  border:2px solid var(--as-line); margin-top:19px;
  display:flex; align-items:center; justify-content:center;
}
.as-opt.on .dot{ border-color:var(--as-accent); }
.as-opt.on .dot::after{ content:""; width:22px; height:22px; border-radius:50%; background:var(--as-accent); }
.as-hr{ border:0; border-top:1px dashed var(--as-line); margin:44px 0; }
.as-note{ font-size:30px; color:var(--as-ink3); padding:0 33px 6px; line-height:1.75; }
/* 弹层里的小分节标题（改动记录 …） */
.as-sect{ display:flex; align-items:center; gap:22px; padding:0 33px 14px; font-size:34px; letter-spacing:.1em; color:var(--as-ink2); }
.as-sect .sp{ flex:1; }
.as-ulb{ min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* ---------- 写操作确认框（自绘，约定②） ---------- */
.as-cf{
  position:absolute; inset:0; z-index:30; display:flex; align-items:center; justify-content:center;
  background:rgba(18,24,38,.34); padding:60px 44px;
}
.as-cf-card{
  width:100%; max-height:100%; overflow-y:auto; scrollbar-width:none;
  background:var(--as-bg); border:1px solid var(--as-line); border-radius:44px;
  box-shadow:0 24px 60px rgba(20,30,50,.28); padding:38px 39px 33px;
}
.as-cf-card::-webkit-scrollbar{ display:none; }
.as-cf-h{ display:flex; align-items:center; gap:22px; font-size:40px; color:var(--as-ink); margin-bottom:26px; }
.as-cf-h svg{ color:var(--as-accent2); }
.as-cf-b{
  margin:0 0 28px; padding:28px 30px; border-radius:28px;
  background:var(--as-card); border:1px solid var(--as-line);
  font-family:var(--as-mono); font-size:31px; line-height:1.7; color:var(--as-ink2);
  white-space:pre-wrap; word-break:break-word; max-height:52vh; overflow-y:auto; scrollbar-width:none;
}
.as-cf-b::-webkit-scrollbar{ display:none; }
.as-cf-f{ display:flex; gap:16px; justify-content:flex-end; flex-wrap:wrap; }
.as-rowline{ display:flex; align-items:center; gap:28px; padding:28px 33px; font-size:37px; color:var(--as-ink); }
.as-rowline .sp{ flex:1; }
.as-rowline .val{ font-size:34px; color:var(--as-ink2); font-family:var(--as-mono); }

/* ---------- 左侧快速定位轨道（一轮一条条形，宽度 ∝ 那句问句的长度） ----------
   ⚠ 它挂在 `.as-wrap` 上、**不能放进 `.as-msgs`**：`.as-msgs` 是滚动容器，
   绝对定位的后代**会跟着内容一起滚走**（挂进去就"划没了"）。 */
.as-rail{
  position:absolute; left:8px; top:232px; bottom:252px;
  display:none; flex-direction:column; justify-content:center; gap:11px;
  z-index:6; padding:0 10px; cursor:pointer;
}
.as-rail.on{ display:flex; }
.as-rail-t{
  height:7px; min-width:12px; border-radius:4px;
  background:var(--as-line); transition:background .15s, transform .15s;
}
.as-rail-t:hover{ background:var(--as-accent2); transform:scaleY(1.6); }
.as-rail-t.on{ background:var(--as-accent); transform:scaleY(1.6); }
/* 跳过去之后那一条的柔和脉冲（照参考里 xf-target-pulse 的写法）：
   ⚠ 只动 outline / box-shadow，**别动 background** —— 气泡自己有底色，
   动画一旦碰 background，结束后会把底色抹掉（除非写 forwards，那又永久盖住）。 */
@keyframes as-pulse{
  0%{ outline:3px solid rgba(126,155,209,.9); box-shadow:0 0 0 10px rgba(126,155,209,.13); }
  100%{ outline:3px solid transparent; box-shadow:0 0 0 0 rgba(126,155,209,0); }
}
.as-msg.as-hit{ animation:as-pulse 1.4s cubic-bezier(.2,.8,.2,1); }

/* ---------- 问题清单（= 讨论备注的状态视图 + 检修历史） ---------- */
#S011.issues-open #as-issueswrap{ opacity:1; pointer-events:auto; }
.as-issue-foot{ display:flex; align-items:center; gap:16px; margin-top:26px; }
.as-issue-foot .sp{ flex:1; }
.as-is{
  border:1px solid var(--as-line); border-radius:30px; background:var(--as-card);
  padding:22px 26px; margin-bottom:16px;
}
.as-is-h{ display:flex; align-items:center; gap:16px; font-size:34px; }
.as-is-h .sp{ flex:1; }
/* 五个状态点：灰=待处理 / 蓝=正在解决 / 黄=要确认或待审批 / 红=没解决 / 绿=已解决 */
.as-dot{ flex:none; width:22px; height:22px; border-radius:50%; background:#b9b9b9; }
.as-dot.new{ background:#b9b9b9; }
.as-dot.work{ background:#3b82f6; }
.as-dot.ask{ background:#eab308; }
.as-dot.bad{ background:#ef4444; }
.as-dot.ok{ background:#22c55e; }
.as-is-no{ flex:none; font-size:30px; color:var(--as-ink3); letter-spacing:.06em; }
.as-is-scr{ flex:none; font-size:30px; color:var(--as-accent2); }
.as-is-tx{ min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--as-ink); }
.as-st{ flex:none; font-size:28px; border-radius:999px; padding:4px 18px; font-weight:700; }
.as-st.new{ color:#6b7280; background:rgba(140,145,155,.14); }
.as-st.work{ color:#1d4ed8; background:rgba(59,130,246,.14); }
.as-st.ask{ color:#a16207; background:rgba(234,179,8,.16); }
.as-st.bad{ color:#b91c1c; background:rgba(239,68,68,.14); }
.as-st.ok{ color:#15803d; background:rgba(34,197,94,.14); }
.as-is-sel{ font-size:29px; color:var(--as-ink3); font-family:var(--as-mono); margin-top:12px; word-break:break-all; }
.as-is-hist{ margin-top:14px; border-top:1px dashed var(--as-hair); padding-top:12px; }
.as-is-hrow{ font-size:29px; color:var(--as-ink2); line-height:1.9; }
.as-is-acts{ display:flex; gap:14px; margin-top:16px; flex-wrap:wrap; }
/* 待审批里的补丁代码原文：能滚、别把弹层撑爆 */
.as-pvcode{ max-height:340px; overflow:auto; font-size:27px; margin:10px 0 0; scrollbar-width:none; }
.as-pvcode::-webkit-scrollbar{ display:none; }

/* ---------- 附件（📎）：文本文件附给助手，图片只记名字 ---------- */
.as-atts{ display:none; gap:14px; flex-wrap:wrap; padding:0 39px 16px; }
.as-att{
  display:inline-flex; align-items:center; gap:12px; font-size:29px; color:var(--as-ink2);
  background:var(--as-card); border:1px solid var(--as-line); border-radius:999px; padding:9px 18px;
}
.as-att .nm{ max-width:280px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.as-att .sz{ color:var(--as-ink3); }
.as-att .x{ display:inline-flex; cursor:pointer; color:var(--as-ink3); }
.as-att .x:active{ color:var(--as-danger); }
.as-msg .as-attsline{ display:block; font-size:28px; color:var(--as-ink3); margin-top:10px; }

/* ---------- 空态 ---------- */
.as-empty{
  margin:auto; text-align:center; color:var(--as-ink3); font-size:34px; line-height:2;
}
.as-empty .big{ font-size:47px; color:var(--as-ink2); letter-spacing:.1em; margin-bottom:22px; }
