:root {
  --bg: #0b0c10;
  --bg-2: #111318;
  --panel: #14161c;
  --card: #1a1d25;
  --card-2: #20242e;
  --line: #2a2f3a;
  --text: #e8eaf0;
  --muted: #8b93a7;
  --accent: #7c5cff;
  --accent-2: #36c6ff;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text); font: 14px/1.55 var(--font); }
button, input, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: 12px; }
.pad { padding: 14px 4px; }
[hidden] { display: none !important; }

/* 顶栏 */
.topbar { height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px;
  border-bottom: 1px solid var(--line); background: rgba(11,12,16,.85); backdrop-filter: blur(10px); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { width: 26px; height: 26px; }
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: .2px; }
.brand-sub { color: var(--muted); font-size: 13px; padding-left: 10px; border-left: 1px solid var(--line);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.top-right { display: flex; gap: 8px; align-items: center; flex: none; }
.top-right .btn, .top-right .chip { white-space: nowrap; }

/* 布局 */
body { --rw: 380px; }                                          /* 右栏宽度；收起时变成 46px 的竖条 */
.layout { height: calc(100% - 56px); display: grid; grid-template-columns: 340px 1fr var(--rw); }
/* 宽屏：最左侧独立任务栏；收起后变成一条细边 */
body.side-open .layout { grid-template-columns: 264px 340px 1fr var(--rw); }
body.side-rail-on .layout { grid-template-columns: 46px 340px 1fr var(--rw); }
@media (max-width: 1499px) {                                  /* 中等宽度手动展开：各栏收窄，给 3D 视图留空间 */
  body.side-open { --rw: 320px; }
  body.side-open .layout { grid-template-columns: 228px 300px 1fr var(--rw); }
}
.panel.side { background: #0f1116; border-right: 1px solid var(--line); padding: 14px 12px; gap: 10px; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px; }
.side-title { font-weight: 600; font-size: 15px; }
.side-new { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; padding: 9px; background: var(--card);
  border-color: #343a48; font-weight: 500; }
.side-new svg { width: 16px; height: 16px; }
.side-new:hover { border-color: var(--accent); }
.side-search { width: 100%; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; outline: none; font-size: 13px; }
.side-search:focus { border-color: var(--accent); }
.side-slot { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.side-slot .history { margin: 0 -4px; padding: 0 4px; }
.side-rail { border: 0; border-right: 1px solid var(--line); background: #0f1116; color: var(--muted); cursor: pointer; display: flex;
  flex-direction: column; align-items: center; gap: 10px; padding-top: 16px; font: inherit; font-size: 12px; }
.side-rail svg { width: 18px; height: 18px; }
.side-rail span { writing-mode: vertical-rl; letter-spacing: 4px; }
.side-rail:hover { color: var(--text); background: #151821; }
.hist-group { font-size: 11.5px; color: var(--muted); padding: 10px 10px 2px; letter-spacing: .5px; }
.hist-group:first-child { padding-top: 0; }
.hist.hidden-by-search { display: none; }
/* 任务栏里：标题一行完整显示，状态和时间放第二行；分组已写“示例”，不再重复标签 */
.side-slot .hist { flex-wrap: wrap; row-gap: 2px; padding: 8px 30px 8px 10px; }
.side-slot .hist .t { flex: 1 1 calc(100% - 20px); white-space: nowrap; }
.side-slot .hist .m { flex-basis: 100%; padding-left: 18px; }
.side-slot .hist .tag { display: none; }
.panel { overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; background: var(--panel); }
.panel.left { border-right: 1px solid var(--line); }
.panel.right { border-left: 1px solid var(--line); padding: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.card.grow { flex: 1 0 240px; min-height: 240px; display: flex; flex-direction: column; }
.card-title { font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#historyCard .card-title .icon-btn { margin: -4px -6px -4px 0; }

/* 上传 */
.drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px 12px; border: 1.5px dashed #3a4050;
  border-radius: 12px; cursor: pointer; transition: .15s; background: var(--bg-2); text-align: center; }
.drop:hover, .drop.over { border-color: var(--accent); background: #171428; }
.drop-icon { width: 28px; height: 28px; color: var(--accent); }
.drop-text u { color: var(--accent-2); text-decoration: none; }
.drop-hint { color: var(--muted); font-size: 12px; }
.thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--card-2); border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .pdf { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; color: var(--accent-2); font-size: 13px; }
.thumb button { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(0,0,0,.65); color: #fff; font-size: 12px; line-height: 20px; padding: 0; }

/* 表单 */
textarea, input:not([type]), input[type=password] { width: 100%; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; outline: none; resize: vertical; }
textarea:focus, input:focus { border-color: var(--accent); }
.field { margin-top: 12px; }
.field-label { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 7px 4px; border-radius: 8px; cursor: pointer; color: var(--muted); font-size: 12.5px; }
.seg button.on { background: var(--card-2); color: var(--text); box-shadow: inset 0 0 0 1px #3a4050; }
.seg button small { display: block; font-size: 11px; color: var(--muted); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 0; cursor: pointer; font-size: 13px; }
.switch-row input { display: none; }
.switch { width: 38px; height: 22px; border-radius: 11px; background: #3a4050; position: relative; flex: none; transition: .15s; }
.switch::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: .15s; }
.switch-row input:checked + .switch { background: var(--accent); }
.switch-row input:checked + .switch::after { left: 19px; }

.btn { border: 1px solid var(--line); background: var(--card-2); border-radius: 10px; padding: 8px 14px; cursor: pointer; transition: .15s; }
.btn:hover { border-color: #4a5164; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.ghost { background: transparent; }
.btn.primary { border: 0; color: #fff; background: linear-gradient(100deg, var(--accent), #5b7bff 55%, var(--accent-2)); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.big { width: 100%; padding: 12px; font-weight: 600; font-size: 15px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn.big svg { width: 18px; height: 18px; }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn.busy:disabled { opacity: 1; cursor: progress; font-size: 13.5px; font-weight: 500; }
.form-err { color: var(--err); font-size: 12.5px; margin-top: 8px; }

/* 历史 */
.history { display: flex; flex-direction: column; gap: 6px; flex: 1 1 0; min-height: 0; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.hist { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; }
.hist:hover { background: var(--card-2); }
.hist.on { border-color: #3a4050; background: var(--card-2); }
.hist .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.done { background: var(--ok); } .dot.running, .dot.queued { background: var(--accent-2); } .dot.waiting { background: var(--warn); }
.dot.failed, .dot.cancelled, .dot.interrupted, .dot.rejected { background: var(--err); }
.hist .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist .tag { font-size: 11px; color: var(--accent-2); border: 1px solid rgba(54,198,255,.4); border-radius: 6px; padding: 0 5px; margin-right: 6px; }
.hist { position: relative; }
.hist.has-del:hover { padding-right: 36px; }                 /* 悬停出现删除按钮时让出位置，不盖住时间 */
.hist-del { display: none; position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border-radius: 50%;
  border: 0; background: var(--card); color: var(--muted); cursor: pointer; font-size: 14px; line-height: 22px; padding: 0; }
.hist:hover .hist-del { display: block; }
.hist-del:hover { color: var(--err); background: #2a1a1a; }
@media (hover: none) { .hist-del { display: block; position: static; transform: none; margin-left: 4px; flex: none; } }
.loading-line { display: flex; align-items: center; gap: 8px; padding: 12px 4px; }
.loading-line .spin { width: 12px; height: 12px; border: 2px solid #3a4050; border-top-color: var(--accent-2); border-radius: 50%; animation: rot .8s linear infinite; }
.chip.loading { color: var(--muted); }
.hist .m { color: var(--muted); font-size: 11.5px; white-space: nowrap; }

/* 中间 3D 视图 */
.stage { position: relative; overflow: hidden; background: radial-gradient(1200px 700px at 50% 35%, #1b1e2a 0%, #0e0f14 60%, #0b0c10 100%); }
.viewport { position: absolute; inset: 0; }
.viewport canvas { display: block; }
.empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 24px; pointer-events: none; }
.empty-cube { width: 86px; height: 86px; border-radius: 22px; background: linear-gradient(135deg, rgba(124,92,255,.35), rgba(54,198,255,.25));
  box-shadow: 0 0 80px rgba(124,92,255,.35); transform: rotate(45deg); margin-bottom: 18px; }
.empty-title { font-size: 18px; font-weight: 600; }
.empty-sub { color: var(--muted); max-width: 420px; }
.overlay { position: absolute; }
.overlay.top { top: 14px; left: 16px; right: 16px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.job-title { font-weight: 600; font-size: 15px; max-width: 32%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.steps { display: flex; gap: 4px; background: rgba(20,22,28,.8); border: 1px solid var(--line); border-radius: 999px; padding: 4px; backdrop-filter: blur(8px); }
.step { white-space: nowrap; display: flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; color: var(--muted); font-size: 12.5px; }
.step i { width: 7px; height: 7px; border-radius: 50%; background: #3a4050; }
.step.active { color: var(--text); background: var(--card-2); }
.step.active i { background: var(--accent-2); box-shadow: 0 0 0 4px rgba(54,198,255,.18); animation: pulse 1.4s infinite; }
.step.done { color: var(--text); }
.step.done i { background: var(--ok); }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(54,198,255,.05); } }
.chip { padding: 4px 10px; border-radius: 999px; font-size: 12px; background: var(--card-2); border: 1px solid var(--line); white-space: nowrap; }
.chip.ghost { background: transparent; color: var(--muted); }
.chip.done { color: var(--ok); border-color: rgba(52,211,153,.4); }
.chip.waiting { color: var(--warn); border-color: rgba(251,191,36,.45); }
.chip.failed, .chip.cancelled, .chip.interrupted, .chip.rejected { color: var(--err); border-color: rgba(248,113,113,.45); }
.chip.running, .chip.queued { color: var(--accent-2); border-color: rgba(54,198,255,.4); }
.dims { left: 16px; bottom: 16px; font-size: 12.5px; color: var(--muted); background: rgba(20,22,28,.75); border: 1px solid var(--line);
  border-radius: 10px; padding: 6px 10px; backdrop-filter: blur(8px); }
.dims b { color: var(--text); font-weight: 600; }
.tools { left: 50%; transform: translateX(-50%); bottom: 16px; display: flex; gap: 6px; background: rgba(20,22,28,.8); border: 1px solid var(--line);
  border-radius: 12px; padding: 5px; backdrop-filter: blur(8px); }
.icon-btn { width: 34px; height: 34px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--card-2); color: var(--text); }
.icon-btn.on { color: var(--accent-2); background: var(--card-2); }
.result { right: 16px; bottom: 16px; width: 300px; background: rgba(20,22,28,.88); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; backdrop-filter: blur(10px); box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.result .badge { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; margin-bottom: 8px; }
.badge.ok { color: var(--ok); } .badge.bad { color: var(--warn); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 12.5px; margin-bottom: 10px; }
.kv span:nth-child(odd) { color: var(--muted); }
.dl { display: flex; flex-direction: column; gap: 6px; }
.dl a { color: var(--text); display: flex; justify-content: space-between; align-items: center; text-decoration: none; padding: 8px 10px; border-radius: 10px;
  background: var(--card-2); border: 1px solid var(--line); font-size: 13px; }
.dl a:hover { border-color: var(--accent); }
.dl a.main { background: linear-gradient(100deg, rgba(124,92,255,.28), rgba(54,198,255,.18)); border-color: rgba(124,92,255,.6); }
.dl a span { color: var(--muted); font-size: 12px; }

/* 结果卡片：头部按钮 / 缩小后的小条 */
.result-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.result-head .badge { margin: 0; }
.result-btns { display: flex; gap: 2px; margin-right: -6px; }
.icon-btn.sm { width: 26px; height: 26px; border-radius: 7px; }
.icon-btn.sm svg { width: 14px; height: 14px; }
.result-pill { right: 16px; bottom: 16px; display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; cursor: pointer;
  background: rgba(20,22,28,.9); border: 1px solid var(--line); backdrop-filter: blur(10px); font-size: 13px; box-shadow: 0 6px 24px rgba(0,0,0,.35); }
.result-pill:hover { border-color: #4a5164; }
.result-pill .ok { color: var(--ok); font-weight: 700; } .result-pill .bad { color: var(--warn); font-weight: 700; }
.result-pill a { color: var(--accent-2); text-decoration: none; }

/* 实时画面：还没有模型时显示 Agent 正在看的图 */
.live { position: absolute; inset: 64px 24px 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; cursor: zoom-in; }
.live img { max-width: 100%; max-height: calc(100% - 34px); object-fit: contain; border-radius: 12px; border: 1px solid var(--line);
  box-shadow: 0 20px 60px rgba(0,0,0,.45); background: #fff; animation: fadein .35s ease; }
.live-cap { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.live-cap::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 0 4px rgba(54,198,255,.18); animation: pulse 1.4s infinite; }
@keyframes fadein { from { opacity: .2; transform: scale(.985); } }

/* 画中画：有模型后，后续的渲染 / 叠图显示在右上角 */
.pip { top: 64px; right: 16px; width: 210px; border-radius: 12px; overflow: hidden; background: rgba(20,22,28,.9); border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(0,0,0,.4); cursor: zoom-in; }
.pip img { width: 100%; display: block; aspect-ratio: 4/3; object-fit: cover; background: #fff; }
.pip-cap { font-size: 11.5px; color: var(--muted); padding: 5px 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pip.quad-off { display: none; }
.pip-x { position: absolute; top: 5px; right: 5px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; line-height: 22px; padding: 0; }

/* 三视图：2×2 分格线与标签（画面由 WebGL 分区渲染） */
.quad { position: absolute; inset: 0; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; pointer-events: none; }
.quad span { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 64px 0 0 14px; font-size: 12px; color: var(--muted); }
.quad span:nth-child(2n) { border-right: 0; }
.quad span:nth-child(n+3) { border-bottom: 0; padding-top: 12px; }

.dims.flash { animation: flash 1.2s ease; }
@keyframes flash { 0% { border-color: var(--accent-2); color: var(--text); } 100% { border-color: var(--line); } }

/* 等待用户：中间顶部的醒目提示 */
.wait-banner { top: 64px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; border: 1px solid rgba(251,191,36,.6);
  background: rgba(40,32,10,.92); color: #fde68a; border-radius: 999px; padding: 8px 16px; cursor: pointer; font: inherit; font-size: 13.5px;
  box-shadow: 0 8px 30px rgba(0,0,0,.4); z-index: 5; white-space: nowrap; }
.wait-banner i { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 4px rgba(251,191,36,.2); animation: pulse 1.4s infinite; }
.wait-banner b { color: #fff; font-weight: 600; }
.req.pulse { animation: reqpulse 1.6s ease; }
@keyframes reqpulse { 0%, 100% { box-shadow: none; } 30% { box-shadow: 0 0 0 4px rgba(251,191,36,.45); } }

/* 全局“等你确认”提醒、历史高亮、提交提示 */
.attn-chip { cursor: pointer; font: inherit; font-size: 12.5px; color: #fde68a; background: rgba(40,32,10,.92); border-color: rgba(251,191,36,.6);
  animation: attn 1.6s ease-in-out infinite; }
@keyframes attn { 50% { box-shadow: 0 0 0 4px rgba(251,191,36,.18); } }
.hist.attn { border-color: rgba(251,191,36,.55); background: rgba(40,32,10,.55); animation: attn 1.6s ease-in-out infinite; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 45; background: var(--card-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 16px; font-size: 13.5px; box-shadow: 0 10px 30px rgba(0,0,0,.45); max-width: calc(100vw - 32px); }

/* 继续调整 */
.followup { position: sticky; bottom: 0; margin-top: auto; background: linear-gradient(180deg, rgba(20,22,28,0), var(--panel) 18px);
  padding: 22px 14px 14px; display: flex; flex-direction: column; gap: 8px; border-top: 1px solid transparent; }
.fu-head { display: flex; align-items: center; gap: 8px; }
.fu-title { font-weight: 600; font-size: 13.5px; flex: 1; min-width: 0; }
.fu-btns { display: flex; gap: 2px; margin-right: -6px; }
.fu-expand { display: none; font-size: 12px; color: var(--accent-2); }
.followup.mini { padding-top: 10px; padding-bottom: 10px; }
.followup.mini .fu-body, .followup.mini .fu-btns [data-fu="mini"] { display: none; }
.followup.mini .fu-head { cursor: pointer; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.followup.mini .fu-head:hover { border-color: var(--accent); }
.followup.mini .fu-expand { display: inline; }
.fu-body { display: flex; flex-direction: column; gap: 8px; }
.right-btns { display: flex; gap: 6px; }
.fu-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fu-chips button { border: 1px solid var(--line); background: var(--bg-2); color: var(--muted); border-radius: 999px; padding: 3px 10px; font-size: 12px; cursor: pointer; }
.fu-chips button:hover { color: var(--text); border-color: var(--accent); }
.followup textarea { min-height: 64px; font-size: 13px; }
.fu-row { display: flex; align-items: center; gap: 8px; }
.seg.mini { grid-template-columns: repeat(3, auto); padding: 2px; }
.seg.mini button { padding: 4px 9px; font-size: 12px; }
.fu-auto { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; white-space: nowrap; cursor: pointer; }
.fu-row .btn.primary { margin-left: auto; padding: 7px 14px; white-space: nowrap; }
.msg .md { white-space: pre-wrap; }
.msg .md b { font-weight: 600; color: #fff; }
.msg .md .md-h { display: inline-block; margin-top: 2px; color: #fff; }
.msg .md code { font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 5px; padding: 0 4px; word-break: break-all; }
.msg .md.clamp, .req pre.clamp { max-height: 10.5em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent); }
.req .foldable { margin: 0 0 10px; }
.req .foldable pre { margin: 0; }
.req pre.clamp { overflow: hidden; }
.fold-btn { margin-top: 6px; border: 0; background: none; color: var(--accent-2); cursor: pointer; padding: 0; font-size: 12.5px; }
.fold-btn:hover { text-decoration: underline; }
.msg.user { border-left: 3px solid var(--accent-2); background: #182132; }

/* 右：时间线 */
.right-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 4px; position: sticky; top: 0; background: var(--panel); z-index: 1; }
.right-head .card-title { margin: 0; }
.timeline { padding: 6px 14px 24px; display: flex; flex-direction: column; gap: 10px; }
.msg { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; white-space: pre-wrap; word-break: break-word; }
.msg.agent { white-space: normal; }
.msg.agent { border-left: 3px solid var(--accent); }
.msg details.notes { margin-top: 6px; }
.msg details.notes summary { cursor: pointer; color: var(--accent-2); font-size: 12.5px; }
.msg details.notes div { margin-top: 6px; font-size: 12.5px; color: #c4c9d6; max-height: 260px; overflow: auto; }
.msg .who { font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.sys { font-size: 12px; color: var(--muted); padding: 0 4px; white-space: pre-wrap; }
.sys.warn { color: var(--warn); } .sys.err { color: var(--err); }
.tool { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); font-size: 12.5px; }
.tool .ic { width: 16px; height: 16px; flex: none; display: grid; place-items: center; }
.tool .spin { width: 12px; height: 12px; border: 2px solid #3a4050; border-top-color: var(--accent-2); border-radius: 50%; animation: rot .8s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
.tool .ok { color: var(--ok); } .tool .bad { color: var(--err); }
.tool .nm { font-weight: 500; }
.tool .arg { color: var(--muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool .sec { color: var(--muted); font-size: 11.5px; }
.tool-block details { margin: 4px 2px 0; }
.tool-block summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.tool-block pre { white-space: pre-wrap; font-size: 11.5px; color: #c4c9d6; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px; max-height: 220px; overflow: auto; margin: 6px 0 0; }
.imgs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 6px; }
.imgs img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in; background: #fff; }
.req { background: linear-gradient(180deg, rgba(124,92,255,.12), rgba(124,92,255,.04)); border: 1px solid rgba(124,92,255,.55); border-radius: 12px; padding: 12px; }
.req.answered { border-color: var(--line); background: var(--card); opacity: .8; }
.req h4 { margin: 0 0 8px; font-size: 13.5px; }
.req pre { white-space: pre-wrap; font: 12px/1.6 var(--font); background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px; max-height: 340px; overflow: auto; margin: 0 0 10px; }
.req .q { margin-bottom: 10px; }
.req .q-label { font-size: 13px; margin-bottom: 6px; }
.req .opts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.req .opts button { border: 1px solid var(--line); background: var(--bg-2); border-radius: 999px; padding: 3px 10px; cursor: pointer; font-size: 12px; }
.req .opts button.on { border-color: var(--accent); color: #fff; background: rgba(124,92,255,.25); }
.req .row { display: flex; gap: 8px; margin-top: 8px; }
.req .row .btn { flex: 1; }
.req textarea { min-height: 60px; }
.req .done-note { font-size: 12px; color: var(--muted); }

/* 新手教程 */
.tour { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
/* 只对 transform 做动画：GPU 合成，不触发大面积阴影重绘 */
.tour-hole { position: fixed; left: 0; top: 0; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(4,5,9,.6), 0 0 0 2px var(--accent-2);
  transition: transform .28s cubic-bezier(.2,.7,.2,1); will-change: transform; pointer-events: none; }
.tour-card { position: fixed; left: 0; top: 0; pointer-events: auto; background: var(--card); border: 1px solid rgba(124,92,255,.6); border-radius: 16px; padding: 16px 18px;
  box-shadow: 0 16px 40px rgba(0,0,0,.5); transition: transform .28s cubic-bezier(.2,.7,.2,1); will-change: transform; }
.tour.no-anim .tour-hole, .tour.no-anim .tour-card { transition: none; }
.tour-card.center { left: 50%; top: 50%; transform: translate(-50%, -50%) !important; width: min(420px, calc(100vw - 32px)); transition: none; }
.tour-card h3 { margin: 4px 0 6px; font-size: 16px; }
.tour-card p { margin: 0 0 14px; color: #c4c9d6; line-height: 1.65; }
.tour-step { font-size: 12px; color: var(--accent-2); }
.tour-btns { display: flex; align-items: center; gap: 8px; }
.tour-btns .grow { flex: 1; }
.tour-btns .btn.primary { padding: 8px 18px; }
.modal-card.welcome { text-align: center; align-items: center; }
.modal-card.welcome p { margin: 0; line-height: 1.7; font-size: 13.5px; }
.modal-card.welcome .btn { width: 100%; }
.empty-cube.small { width: 46px; height: 46px; border-radius: 12px; margin: 6px 0 8px; box-shadow: 0 0 40px rgba(124,92,255,.35); }

/* 弹层 */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.82); display: grid; place-items: center; z-index: 42; cursor: zoom-out; padding: 24px; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; background: #fff; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 30; padding: 16px; }
.modal-card { width: min(360px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 12px; }

/* 窄屏：上下堆叠 */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 300px 1fr; grid-template-rows: 1fr auto; }
  .panel.right { grid-column: 1 / -1; max-height: 45vh; border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 760px) {
  html, body { height: auto; }
  .brand-sub { display: none; }
  .top-right .chip.ghost:last-child { display: none; }
  #costChip { display: none !important; }
  .attn-chip { max-width: 52vw; overflow: hidden; text-overflow: ellipsis; }
  .topbar:has(#attnChip:not([hidden])) .brand-name { display: none; }      /* 有提醒时让出位置 */
  .topbar { padding: 0 12px; }
  .layout { display: flex; flex-direction: column; height: auto; }
  .panel.left { border-right: 0; }
  .stage { height: auto; }
  .viewport { position: relative; height: 60vh; min-height: 340px; }
  .empty { height: 60vh; min-height: 340px; bottom: auto; }
  .dims { bottom: auto; top: calc(max(60vh, 340px) - 44px); }
  .panel.right { max-height: none; }
  .result { position: static; width: auto; margin: 0 12px 12px; }
  .result-pill { position: static; margin: 0 12px 12px; justify-content: center; }
  .live { inset: 110px 12px 12px; height: calc(max(60vh, 340px) - 122px); }
  .pip { width: 130px; top: auto; bottom: auto; right: auto; left: 10px; top: 130px; }
  .quad { height: max(60vh, 340px); bottom: auto; }
  .quad span { padding-top: 110px; }
  .job-title { max-width: 100%; }
  .wait-banner { top: 110px; max-width: calc(100% - 24px); white-space: normal; }
  .tools { bottom: auto; left: auto; right: 10px; transform: none; top: 130px; flex-direction: column; }
  .steps { max-width: 100%; overflow-x: auto; }
  .step { white-space: nowrap; padding: 4px 8px; }
}

.boot-fail { position: fixed; left: 50%; top: 72px; transform: translateX(-50%); z-index: 50; max-width: calc(100vw - 32px);
  background: #2a1a1a; color: #ffd2d2; border: 1px solid rgba(248,113,113,.6); border-radius: 12px; padding: 10px 16px; font-size: 13.5px; }

/* 悬停提示小框 */
.tip { position: fixed; left: 0; top: 0; z-index: 60; pointer-events: none; padding: 5px 9px; border-radius: 7px; font-size: 12px; line-height: 1.3;
  white-space: nowrap; color: var(--text); background: var(--card-2); border: 1px solid var(--line); box-shadow: 0 6px 20px rgba(0,0,0,.35);
  opacity: 0; transform: translateY(3px); transition: opacity .12s, transform .12s; }
.tip.below { transform: translateY(-3px); }
.tip.show { opacity: 1; transform: none; }
@media (hover: none) { .tip { display: none; } }

/* 发现问题 / 拒答卡片 */
.req.issue { background: linear-gradient(180deg, rgba(245,166,35,.13), rgba(245,166,35,.04)); border-color: rgba(245,166,35,.6); }
.req.issue.refuse { background: linear-gradient(180deg, rgba(240,82,82,.13), rgba(240,82,82,.04)); border-color: rgba(240,82,82,.6); }
.req .issue-title { font-size: 13.5px; font-weight: 600; margin: 0 0 8px; line-height: 1.5; }
.req .issue-sug { font-size: 12.5px; line-height: 1.6; margin: 0 0 10px; color: var(--text); }
.req .issue-tip { font-size: 12px; color: var(--muted); }
.req .issue-btns { flex-wrap: wrap; gap: 6px; }
.req textarea + .fold-btn { display: block; margin: 4px 0 2px; }
.req .issue-btns .btn { flex: 1 1 calc(50% - 3px); }
.btn.danger { color: var(--err); }

/* 右栏收起 / 展开（≥1101 px 才有；更窄时右栏在下方，不收起） */
.right-rail { display: none; border-right: 0; border-left: 1px solid var(--line); position: relative; }
.right-rail .rail-dot { display: none; position: absolute; top: 12px; right: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--warn);
  box-shadow: 0 0 0 4px rgba(251,191,36,.18); }
body.job-waiting .right-rail .rail-dot { display: block; }
@media (min-width: 1101px) {
  body.right-collapsed { --rw: 46px !important; }
  body.right-collapsed .panel.right { display: none; }
  body.right-collapsed .right-rail { display: flex; }
}
@media (max-width: 1100px) { #rightCollapse { display: none; } }

/* 3D 视图底栏：尺寸（左）/ 工具（中）/ 结果（右）。窄了工具挪到尺寸上方，结果靠右，互不遮挡 */
.stage { container-type: inline-size; container-name: stage; }
.bottom-bar { position: absolute; left: 16px; right: 16px; bottom: 16px; display: grid; gap: 10px; align-items: end;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); pointer-events: none; }
.bottom-bar > * { pointer-events: auto; min-width: 0; }
@media (min-width: 761px) {
  .bottom-bar > .overlay { position: static; transform: none; }
  .bottom-bar > .dims { grid-column: 1; grid-row: 1; justify-self: start; }
  .bottom-bar > .tools { grid-column: 2; grid-row: 1; justify-self: center; }
  .bottom-bar > .result, .bottom-bar > .result-pill { grid-column: 3; grid-row: 1; justify-self: end; max-width: 100%; }
  @container stage (max-width: 940px) {
    .bottom-bar { grid-template-columns: auto minmax(0, 1fr); grid-template-rows: 1fr auto; }
    .bottom-bar > .tools { grid-column: 1; grid-row: 1; justify-self: start; }
    .bottom-bar > .dims { grid-column: 1; grid-row: 2; }
    .bottom-bar > .result, .bottom-bar > .result-pill { grid-column: 2; grid-row: 1 / span 2; }
  }
  @container stage (max-width: 520px) {                       /* 很窄：三样上下排成一列，靠左 */
    .bottom-bar { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; }
    .bottom-bar > .tools { grid-column: 1; grid-row: 1; }
    .bottom-bar > .result, .bottom-bar > .result-pill { grid-column: 1; grid-row: 2; justify-self: start; }
    .bottom-bar > .dims { grid-column: 1; grid-row: 3; }
    .bottom-bar > .result { width: min(300px, 100%); }
  }
}
@media (max-width: 760px) { .bottom-bar { display: contents; } }
