/* 10-13 改版：assistant（只用 tokens.css 的令牌，不写死颜色；皮肤在后面加载，可覆盖）
   范围：顶栏正中的 AI 助手输入框（截图缩略、附件小菜单、下面那条提示）、带撤销的提示条、拖入时的全屏放下提示、手机页签「助手」升起的输入条、
   编辑态顶栏、全部模块面板头上的搜索。结构在 desk.js 的 topHtml、asstHtml、modsHtml。 */

/* ---------- 顶栏 ---------- */
/* 输入框沿用 .search 的外观（皮肤给的底色、内阴影都跟着走），这里只改尺寸和里面的按钮 */
.top-in .search.asst-bar { flex: 0 1 560px; width: auto; min-width: 220px; height: 40px; padding: 0 5px; gap: 4px; color: var(--ink-3); }
.asst-bar input::placeholder { color: var(--ink-3); }
.top-in .search.asst-bar:focus-within, .top-in .search.asst-bar.on { box-shadow: inset 0 0 0 1.5px var(--accent-line); }
.asst-clip, .asst-send { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: var(--radius-pill); color: var(--ink-2); transition: background var(--dur-fast), color var(--dur-fast); }
.asst-clip:hover, .asst-clip.on, .asst-send:hover { background: var(--surface-3); color: var(--ink); }
/* 打了字，发送键才变实心 */
.asst-bar input:not(:placeholder-shown) ~ .asst-send, .asst-compose input:not(:placeholder-shown) ~ .asst-send { background: var(--accent); color: var(--on-accent); }
.asst-att ~ .asst-send { background: var(--accent); color: var(--on-accent); }
/* 粘贴进来的截图：输入框前的缩略 */
.asst-att { flex: 0 1 auto; display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 200px; height: 30px; padding: 0 4px 0 3px; border-radius: var(--radius-sm); background: var(--surface-2); box-shadow: var(--shadow-inset); font-size: var(--fs-small); color: var(--ink); animation: fadein .2s ease; }
.asst-att .ext { width: 22px; height: 24px; font-size: 8px; }
.asst-att img { flex: none; width: 24px; height: 24px; border-radius: var(--radius-xs); object-fit: cover; }
.asst-att:not(:only-of-type) .t { display: none; }   /* 放了几张时只留缩略，名字看悬停 */
.asst-att .t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asst-att button { flex: none; width: 20px; height: 20px; display: grid; place-items: center; border-radius: var(--radius-pill); color: var(--ink-3); }
.asst-att button:hover { background: var(--surface-3); color: var(--ink); }
.asst-sug { top: 46px; }
.sr-k { padding: 8px 12px 2px; font-size: var(--fs-xs); color: var(--ink-3); }
/* 下拉只在输入框有焦点（或鼠标在上面，免得点按钮前先失焦收起）时出现；面板开着时不叠在面板底下 */
.asst-bar:not(:focus-within):not(:hover) .asst-sug, body[data-layer="asst"] .asst-bar .asst-sug { display: none; }
/* 「我能做这几件」、改标题的说明：回完话就一直挂着，打字、点别处、Esc 才收 */
.top-in .search.asst-bar.hint .asst-sug:not(:empty) { display: flex; }
.top-in .search.asst-bar.on .asst-sug { display: none; }
.asst-hint { display: flex; align-items: flex-start; gap: 8px; padding: 11px 14px; font-size: var(--fs-label); line-height: 1.6; color: var(--ink-2); }
.asst-hint svg.i { flex: none; margin-top: 3px; color: var(--accent); }
/* 空着时的几个说法：点一下填进输入框 */
.asst-ex { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 12px; }
.asst-ex .bchip { height: auto; min-height: 30px; padding: 0 11px; font-size: var(--fs-label); }
/* 附件：只有「粘贴」「上传」的小菜单 */
.asst-menu { position: absolute; top: 46px; left: 0; z-index: 31; display: flex; flex-direction: column; width: 248px; padding: 6px; border-radius: var(--radius-ctl); background: var(--surface-raised); box-shadow: var(--shadow-pop); animation: asst-in .16s var(--ease); }
@keyframes asst-in { from { opacity: 0; transform: translateY(-4px); } }
.asst-menu button { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: var(--radius-sm); font-size: var(--fs-ui); color: var(--ink); text-align: left; }
.asst-menu button:hover { background: var(--surface-2); }
.asst-menu svg.i { color: var(--ink-2); }
/* 带按钮的提示条：撤销、改一下、去看看 */
.toasts { width: max-content; max-width: calc(100% - 24px); }   /* 容器按最宽的一条撑开，窄屏上提示条不被挤成两行 */
.toast.asst-toast { pointer-events: auto; gap: 10px; padding-right: 8px; }
.asst-toast .tt { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.toast-a { flex: none; padding: 2px 10px; border: 1px solid currentColor; border-radius: var(--radius-pill); font-size: var(--fs-label); font-weight: 600; color: inherit; opacity: .9; }
.toast-a:hover { opacity: 1; }
.tbtn.icon { width: 34px; padding: 0; justify-content: center; }
.edit-k { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-label); color: var(--ink-2); }
.top-in .btn.pri { flex: none; }

/* ---------- 10-14：单份文件问答的对话面板（desk.js 的 asstConvHtml）：电脑上从顶栏输入框下方展开、可收起；手机上在助手输入条上方 ---------- */
/* 每次重画都会换掉顶栏，面板不做进场动画，免得识别进度一跳就闪一下 */
.asst-conv { position: absolute; top: 46px; left: 0; right: 0; z-index: 30; display: flex; flex-direction: column; max-height: min(66vh, 560px); border-radius: var(--radius-ctl); background: var(--surface-raised); box-shadow: var(--shadow-pop); overflow: hidden; color: var(--ink); font-size: var(--fs-ui); text-align: left; cursor: auto; }
.ac-h { flex: none; display: flex; align-items: center; gap: 6px; min-width: 0; padding: 7px 8px 7px 14px; border-bottom: 1px solid var(--line); font-size: var(--fs-label); }
.ac-h > svg.i { flex: none; color: var(--accent); }
.ac-h b { flex: none; }
.ac-who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-small); color: var(--ink-3); }
.ac-h .sp { flex: 1; }
.ac-h .btn { flex: none; }
.ac-h .btn.icon { width: 26px; }
.ac-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 10px; padding: 12px 14px 14px; }
.ac-f { flex: none; padding: 6px 14px 8px; border-top: 1px solid var(--line); font-size: var(--fs-xs); color: var(--ink-3); }
/* 你说的话、你交的文件靠右；助手的回答靠左，不套气泡 */
.fq-q, .fq-up { display: flex; justify-content: flex-end; min-width: 0; }
.fq-q > span { max-width: 85%; padding: 7px 12px; border-radius: var(--radius-ctl) var(--radius-ctl) var(--radius-xs) var(--radius-ctl); background: var(--accent); color: var(--on-accent); line-height: 1.55; overflow-wrap: anywhere; }
.fq-chip { display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 85%; padding: 6px 10px 6px 6px; border-radius: var(--radius-sm); background: var(--surface-2); box-shadow: var(--shadow-inset); font-size: var(--fs-small); color: var(--ink-3); }
.fq-chip .ext { width: 26px; height: 30px; }
.fq-chip img { flex: none; width: 30px; height: 30px; border-radius: var(--radius-xs); object-fit: cover; }
.fq-chip .t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: var(--fw-strong); color: var(--ink); }
.fq-chip .small { flex: none; }
.fq-a { align-self: stretch; display: flex; flex-direction: column; gap: 6px; min-width: 0; line-height: 1.6; color: var(--ink); }
.fq-t { min-width: 0; overflow-wrap: anywhere; }
.fq-t .src, .fq-ol .src { margin-left: 6px; }
.fq-ol { margin: 0; padding-left: 1.5em; display: flex; flex-direction: column; gap: 4px; }
.fq-ol li::marker { color: var(--ink-3); }
.fq-cite { cursor: pointer; }
.fq-link { padding: 0 2px; border: 0; background: none; font: inherit; color: var(--accent); text-decoration: underline; text-decoration-color: var(--accent-line); text-underline-offset: 3px; cursor: pointer; }
.fq-link:hover { text-decoration-color: currentColor; }
/* 文件那条下面的状态：正在读、正在识别 x/12 页（带进度条）、读好了、读不了 */
.fq-st { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: var(--fs-small); color: var(--ink-2); }
.fq-st.fq-ready > svg.i { color: var(--ok); }
.fq-st.fq-none > svg.i { color: var(--warn); }
.fq-st .num { font-weight: var(--fw-strong); color: var(--ink); }
.fq-bar { flex: 1 1 80px; max-width: 180px; height: 4px; border-radius: var(--radius-pill); background: var(--surface-3); overflow: hidden; }
.fq-bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width var(--dur-fast) linear; }
.fq-st .btn { margin-left: 4px; }
.fq-wait { flex-direction: row; align-items: center; gap: 8px; font-size: var(--fs-small); color: var(--ink-3); }
.fq-demo { font-size: var(--fs-xs); color: var(--ink-3); }
.fq-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-top: 2px; }
.fq-done { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; }

/* ---------- 手机：底部页签「助手」升起一条输入（10-13 晚起电脑上没有助手面板，只有顶栏输入框） ---------- */
.asst-scrim, .asst-sheet { display: none; }

/* ---------- 拖入：整页放下提示 ---------- */
.asst-drop { position: absolute; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; background: var(--scrim); pointer-events: none; animation: fadein .16s ease; }
.asst-drop[hidden] { display: none; }
.asst-drop-in { display: flex; flex-direction: column; align-items: center; gap: 10px; width: min(520px, 100%); padding: 44px 28px; border-radius: var(--radius-panel); background: var(--surface-raised); box-shadow: var(--shadow-pop); outline: 2px dashed var(--accent-line); outline-offset: -12px; text-align: center; font-size: var(--fs-ui); color: var(--ink-2); }
.asst-drop-in b { font-size: var(--fs-h3); color: var(--ink); }
.asst-drop-in svg.i { width: 36px; height: 36px; color: var(--accent); }

/* ---------- 等你定：顶栏下拉面板（right 由 desk.js 的 placeWait 对齐到按钮） ---------- */
.wait-scrim { display: none; }
.wait-sheet { top: calc(var(--top-h) + 8px); right: 16px; width: min(440px, calc(100% - 24px)); max-height: min(70vh, calc(100% - var(--top-h) - 24px)); animation: wait-in .22s var(--ease); }
@keyframes wait-in { from { opacity: 0; transform: translateY(-6px); } }
.wait-sheet .sheet-h { flex-wrap: nowrap; padding: 12px 12px 12px 16px; }
.wait-sheet .sheet-h h3 { white-space: nowrap; }
.wait-n { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-pill); background: var(--decide-dot); color: var(--on-dot); font-size: var(--fs-caption); font-weight: 700; }
.wait-body { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 12px 16px; }
.wait-body .ap-group-h { font-size: var(--fs-label); }
.wait-clear { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 32px 16px 28px; text-align: center; }
.wait-clear svg.i { color: var(--ok); }
.wait-clear b { font-size: var(--fs-h3); }

/* ---------- 全部模块面板头上的搜索 ---------- */
.sheet-h .search.mods-search { flex: 0 1 220px; width: auto; min-width: 140px; height: 34px; }

/* ---------- 窄屏 ---------- */
@media (max-width: 1180px) {
  .top-in .search.asst-bar { flex-basis: 420px; }
  .edit-k { display: none; }
}
@media (max-width: 760px) {
  .asst-scrim, .wait-scrim { display: block; }
  .asst-sheet, .wait-sheet { left: 0; right: 0 !important; bottom: 0; top: auto; width: auto; transform: none; max-height: 82%; border-radius: var(--radius-panel) var(--radius-panel) 0 0; animation: slideup .28s var(--ease); }
  .wait-body { padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .asst-compose { position: relative; display: flex; align-items: center; gap: 6px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); }
  .asst-compose input { flex: 1; min-width: 0; height: 40px; padding: 0 14px; border: 0; outline: 0; border-radius: var(--radius-pill); background: var(--surface-2); box-shadow: var(--shadow-inset); font-size: var(--fs-body); }
  /* 助手：只是一条输入，上面一行提示；附件菜单从输入条上方弹出，所以面板不裁切 */
  .asst-sheet { display: flex; overflow: visible; max-height: none; }
  .asst-tips:empty { display: none; }
  .asst-tips { padding: 6px 4px 0; }
  .asst-tips .asst-ex { padding: 8px 10px 2px; }
  .asst-tips .sr { border-radius: var(--radius-sm); }
  .asst-compose .asst-menu { top: auto; bottom: calc(100% + 6px); left: 12px; }
  .asst-compose .asst-att { max-width: 120px; }
  /* 文件问答：对话放在输入条上方，跟着升起的助手条走，不再悬浮 */
  .asst-sheet .asst-conv { position: static; max-height: min(62vh, 520px); border-radius: var(--radius-panel) var(--radius-panel) 0 0; background: transparent; box-shadow: none; }
  .asst-sheet .ac-h { padding: 12px 10px 8px 16px; }
  .asst-sheet .ac-body { padding: 12px 16px 14px; }
  .asst-sheet .ac-f { display: none; }
  .tabs .asst-tab > svg { box-sizing: content-box; padding: 3px 14px; border-radius: var(--radius-pill); background: var(--accent); color: var(--on-accent); }
  .tabs .asst-tab.on { color: var(--ink); }
  .sheet-h .search.mods-search { flex: 1 1 100%; order: 5; }
}
