/* 版式与配色沿用产品界面（web/src/style.css）：左侧导航、中间对话、右侧模型画布 */
:root {
  --bg: #f5f7fb; --panel: #ffffff; --panel-2: #f8faff; --line: #e7ecf3; --grid: #eef2f7;
  --text: #26364d; --text-2: #5b6a80; --muted: #8390a3;
  --brand: #3869dd; --brand-soft: #edf3ff; --navy: #0c1a36;
  --s-agent: #2a78d6; --s-r1: #eb6834; --s-3: #1baf7a; --obs: #26364d; --dim: #c6cfdc;
  --good: #1f8f5a; --good-soft: #e5f5ec; --warn: #a86b12; --warn-soft: #fff4e0; --bad: #c2462d;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px; line-height: 1.6; color: var(--text); background: var(--bg); font-synthesis: none; -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
svg { flex-shrink: 0; vertical-align: middle; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #dce3ee; border-radius: 5px; }

.app { display: grid; grid-template-columns: 232px minmax(400px, 0.9fr) minmax(0, 1.3fr); height: 100dvh; overflow: hidden; }
.btn { border: 1px solid #dfe5ef; background: #fff; border-radius: 8px; padding: 7px 13px; font-size: 13px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { border-color: #b8c7e3; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #2f5fcc; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn:disabled { opacity: .5; cursor: default; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; padding: 2px 8px; border-radius: 5px; color: #6e7d92; background: #f1f4f8; white-space: nowrap; font-weight: 500; }
.badge.demo { color: #906c27; background: #fff6e4; }
.badge.ok { color: var(--good); background: var(--good-soft); }
.badge.warn { color: var(--warn); background: var(--warn-soft); }
.badge.run { color: var(--brand); background: var(--brand-soft); }
.eyebrow { display: block; font-size: 10px; font-weight: 600; letter-spacing: 1.6px; color: #99aac2; text-transform: uppercase; }
.muted { color: var(--muted); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
.spin { width: 13px; height: 13px; border: 2px solid #c9d6ef; border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* 左侧导航 */
.sidebar { background: #f8faff; border-right: 1px solid #e4eaf3; padding: 22px 14px 14px; display: flex; flex-direction: column; min-height: 0; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--brand); color: #fff; display: grid; place-items: center; }
.brand b { display: block; font-size: 18px; letter-spacing: -.4px; line-height: 1.15; }
.brand small { display: block; font-size: 9px; letter-spacing: 2.4px; color: #98a8bf; font-weight: 600; }
.side-label { font-size: 11px; color: #9aa8bc; padding: 0 6px; margin-bottom: 6px; display: block; }
.model-card { background: #fff; border: 1px solid #e0e7f2; border-radius: 10px; padding: 10px 12px; }
.model-card b { font-size: 13px; display: block; }
.model-card small { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.side-btn { width: 100%; justify-content: center; color: #4f72b6; border-color: #dae5f6; }
.conv-list { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 4px; }
.conv { padding: 8px 10px; border-radius: 8px; font-size: 12.5px; color: var(--text-2); }
.conv.on { background: var(--brand-soft); color: var(--text); }
.conv small { display: block; font-size: 11px; color: var(--muted); }
.side-foot { border-top: 1px solid #e7edf6; padding-top: 12px; display: flex; flex-direction: column; gap: 8px; font-size: 12px; color: var(--text-2); }
.side-foot .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.seg { display: inline-flex; border: 1px solid #dfe5ef; border-radius: 7px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: transparent; padding: 4px 10px; font-size: 12px; color: var(--text-2); }
.seg button.on { background: var(--brand); color: #fff; }
.pilot { width: 100%; justify-content: center; }
.pilot.on { background: var(--navy); border-color: var(--navy); color: #fff; }

/* 对话 */
.chat { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: #fff; }
.chat-head { padding: 18px 22px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.chat-head .icon { width: 38px; height: 38px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.chat-head h1 { font-size: 16px; }
.chat-head p { font-size: 12px; color: var(--muted); }
.chat-head .badge { margin-left: auto; }
.messages { flex: 1; min-height: 0; overflow: auto; padding: 18px 22px 8px; display: flex; flex-direction: column; gap: 18px; }
.msg { animation: rise .3s ease; }
.msg.user { align-self: flex-end; max-width: 85%; }
.msg.user .bubble { background: var(--brand-soft); border: 1px solid #dbe6fb; border-radius: 12px 12px 4px 12px; padding: 9px 14px; font-size: 14px; white-space: pre-wrap; }
.msg time { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; text-align: right; }
.msg.agent { max-width: 100%; }
.agent-name { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #4f72b6; font-weight: 600; margin-bottom: 6px; }
.agent-name time { display: inline; margin: 0; font-weight: 400; color: var(--muted); }
.steps { list-style: none; padding: 8px 10px; margin: 0 0 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--text-2); }
.steps li { display: flex; align-items: flex-start; gap: 8px; animation: rise .25s ease; }
.steps li .st { width: 16px; height: 18px; display: grid; place-items: center; flex-shrink: 0; }
.steps li .ok { color: var(--good); }
.steps li small { color: var(--muted); margin-left: 4px; }
.agent-text { font-size: 14px; color: var(--text); }
.agent-text p { margin: 0 0 8px; animation: rise .3s ease; }
.agent-text ul, .agent-text ol { margin: 0 0 8px; padding-left: 20px; animation: rise .3s ease; }
.agent-text li { margin-bottom: 3px; }
.agent-text b { font-weight: 600; }
.thinking { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }

/* 对话里的卡片 */
.card-x { border: 1px solid #dbe4f2; border-radius: 11px; background: #fff; padding: 12px 14px; margin: 4px 0 8px; box-shadow: 0 2px 8px #24365a0a; animation: rise .3s ease; }
.card-x h3 { font-size: 13.5px; display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.card-x .kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 12.5px; margin-bottom: 10px; }
.card-x .kv span:nth-child(odd) { color: var(--muted); }
.card-x .acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.card-x .note { font-size: 12px; color: var(--muted); margin-top: 8px; }
.card-x.done { background: var(--panel-2); }
.card-x input.n { width: 70px; border: 1px solid #dfe5ef; border-radius: 6px; padding: 2px 8px; }
.card-x select { border: 1px solid #dfe5ef; border-radius: 6px; padding: 2px 6px; background: #fff; font-size: 12.5px; }
.chg { display: grid; grid-template-columns: minmax(110px, 1fr) auto; gap: 2px 10px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 12.5px; }
.chg:first-of-type { border-top: 0; }
.chg b { font-weight: 600; }
.chg .vals { font-variant-numeric: tabular-nums; white-space: nowrap; }
.chg .vals s { color: var(--muted); }
.chg .vals i { font-style: normal; color: var(--brand); font-weight: 600; }
.chg small { grid-column: 1 / -1; color: var(--muted); font-size: 11.5px; }
.minibar { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 44px; gap: 8px; align-items: center; font-size: 12px; padding: 2px 0; }
.minibar span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.minibar .bar { height: 8px; background: var(--grid); border-radius: 0 4px 4px 0; overflow: hidden; }
.minibar .bar i { display: block; height: 100%; background: var(--dim); border-radius: 0 4px 4px 0; }
.minibar.top .bar i { background: var(--s-agent); }
.minibar.top span:first-child { font-weight: 600; }
.minibar span:last-child { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }
.evid { font-size: 12.5px; color: var(--text-2); margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.evid div { display: flex; gap: 8px; align-items: baseline; padding: 1px 0; }
.evid div::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--s-r1); flex-shrink: 0; transform: translateY(-1px); }
.tiles-mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tiles-mini div { background: var(--panel-2); border-radius: 8px; padding: 6px 10px; }
.tiles-mini span { display: block; font-size: 11px; color: var(--muted); }
.tiles-mini b { font-size: 18px; font-variant-numeric: tabular-nums; }
.tiles-mini b.bad { color: var(--bad); } .tiles-mini b.good { color: var(--good); }
.progress { height: 6px; border-radius: 3px; background: var(--grid); overflow: hidden; margin: 6px 0; }
.progress i { display: block; height: 100%; background: var(--brand); transition: width .2s; }
.progress.ok i { background: var(--good); }

/* 输入区 */
.composer-wrap { padding: 8px 22px 12px; border-top: 1px solid var(--line); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; min-height: 30px; }
.chip { border: 1px solid #dfe5ef; background: #fff; border-radius: 7px; padding: 4px 10px; font-size: 12.5px; color: var(--text-2); animation: rise .25s ease; }
.chip:hover { border-color: var(--brand); color: var(--brand); }
.composer { border: 1px solid #dfe5ef; border-radius: 12px; padding: 10px 12px; display: flex; gap: 10px; align-items: flex-end; background: #fff; }
.composer:focus-within { border-color: #9db5e6; box-shadow: 0 0 0 3px #3869dd14; }
.composer textarea { flex: 1; border: 0; outline: none; resize: none; height: 46px; font-size: 14px; background: transparent; }
.send { width: 36px; height: 36px; border-radius: 9px; border: 0; background: var(--brand); color: #fff; display: grid; place-items: center; }
.send:disabled { background: #b9c9ea; cursor: default; }
.composer-foot { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; gap: 10px; }

/* 模型画布 */
.canvas { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.canvas-head { padding: 16px 22px 0; }
.canvas-title { display: flex; align-items: center; gap: 10px; margin: 2px 0 10px; flex-wrap: wrap; }
.canvas-title h2 { font-size: 18px; }
.rail { display: flex; align-items: center; gap: 4px; margin-bottom: 12px; flex-wrap: wrap; }
.stage { display: flex; align-items: center; gap: 6px; font-size: 12px; padding: 4px 10px 4px 5px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.stage i { width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 10px; background: #e9eef5; color: #8a97ab; }
.stage.done { color: var(--text-2); } .stage.done i { background: var(--good); color: #fff; }
.stage.running { color: var(--brand); border-color: #c7d7f5; } .stage.running i { background: var(--brand); color: #fff; }
.stage.review { color: var(--warn); border-color: #f0dcb4; } .stage.review i { background: #e7a83c; color: #fff; }
.stage.ready { color: var(--text-2); border-color: #c7d7f5; } .stage.ready i { background: #fff; box-shadow: inset 0 0 0 1.5px var(--brand); color: var(--brand); }
.rail .sep { width: 10px; height: 1px; background: #d6deea; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { border: 0; background: transparent; padding: 8px 12px; font-size: 13px; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.canvas-body { flex: 1; min-height: 0; overflow: auto; padding: 16px 22px 20px; display: flex; flex-direction: column; gap: 14px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.card-head h3 { font-size: 14px; }
.card-head .sub { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 4px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.tile span { display: block; font-size: 11.5px; color: var(--muted); }
.tile b { font-size: 24px; font-weight: 650; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
.tile b small { font-size: 12px; font-weight: 500; color: var(--text-2); margin-left: 3px; }
.tile b.good { color: var(--good); } .tile b.bad { color: var(--bad); } .tile b.accent { color: var(--brand); }
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.chart { position: relative; height: 190px; }
.chart.tall { height: 260px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; }
.legend i.dot { width: 8px; height: 8px; border-radius: 50%; }
.legend i.ln { width: 16px; height: 2px; }
.legend i.sw { width: 14px; height: 10px; border-radius: 3px; }
.pick { display: inline-flex; gap: 3px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.pick button { border: 0; background: transparent; padding: 3px 11px; border-radius: 6px; font-size: 12.5px; color: var(--text-2); }
.pick button.on { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 3px #1d2b4222; }
select.sel { border: 1px solid #dfe5ef; border-radius: 7px; padding: 5px 8px; background: #fff; font-size: 12.5px; max-width: 100%; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.err-row { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--text-2); }
.err-row b { color: var(--good); font-variant-numeric: tabular-nums; }
.err-row b.bad { color: var(--bad); }
.err-row b.mid { color: var(--text); }

/* 配置表 */
.cfg-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.cfg-bar label { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.cfg-bar input[type=number] { width: 72px; border: 1px solid #dfe5ef; border-radius: 6px; padding: 4px 8px; }
.cfg-table { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.cfg-table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 11.5px; padding: 6px 8px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 1; }
.cfg-table td { padding: 5px 8px; border-bottom: 1px solid #f0f3f8; vertical-align: middle; }
.cfg-table tr.changed td { background: #f4f8ff; }
.cfg-table tr.dirty td { background: #fffaf0; }
.cfg-table input { width: 72px; border: 1px solid #e0e6f0; border-radius: 5px; padding: 3px 6px; text-align: right; background: #fff; }
.cfg-table input:focus { outline: none; border-color: var(--brand); }
.cfg-table .name small { color: var(--muted); margin-left: 4px; }
.rbar { position: relative; height: 14px; min-width: 100px; }
.rbar .base { position: absolute; left: 0; right: 0; top: 6px; height: 2px; background: var(--grid); }
.rbar .old { position: absolute; top: 1px; height: 4px; background: #f3b598; border-radius: 2px; }
.rbar .cur { position: absolute; top: 7px; height: 5px; background: var(--s-agent); border-radius: 3px; }
.src { font-size: 11px; padding: 1px 6px; border-radius: 4px; background: #f1f4f8; color: #6e7d92; white-space: nowrap; }
.src.agent { background: var(--brand-soft); color: var(--brand); }
.src.user { background: var(--warn-soft); color: var(--warn); }
.table-wrap { max-height: 520px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }

/* 任务 */
.task { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); font-size: 13px; }
.task:first-of-type { border-top: 0; }
.task b { font-weight: 600; }
.task small { color: var(--muted); font-size: 12px; }
.task .progress { grid-column: 1 / -1; margin: 4px 0 0; }

/* 三维 */
.viewer { position: relative; height: 380px; border-radius: 10px; overflow: hidden; background: radial-gradient(ellipse at 50% 40%, #fbfcff, #eff3f9); }
.viewer-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; display: block; }
.well-labels { position: absolute; inset: 0; pointer-events: none; }
.well-labels span { position: absolute; left: 0; top: 0; font-size: 11px; font-weight: 700; background: #fff; border: 1px solid var(--line); border-radius: 5px; padding: 0 6px; }
.viewer-hud { position: absolute; left: 12px; top: 10px; pointer-events: none; }
.viewer-hud b { font-size: 20px; font-variant-numeric: tabular-nums; display: block; line-height: 1.3; }
.viewer-hud small { font-size: 11px; color: var(--muted); }
.colorbar { position: absolute; right: 12px; bottom: 12px; width: 170px; font-size: 11px; color: var(--text-2); background: #ffffffcc; border-radius: 8px; padding: 6px 8px; pointer-events: none; }
.colorbar .cb { height: 9px; border-radius: 3px; margin: 3px 0 1px; }
.colorbar .ends { display: flex; justify-content: space-between; color: var(--muted); }
.viewer-ctl { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-top: 10px; font-size: 12.5px; color: var(--text-2); }
.viewer-ctl label { display: inline-flex; align-items: center; gap: 8px; }
.viewer-ctl input[type=range] { width: 140px; accent-color: var(--brand); }
.no-gl { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }

/* 经验 */
.lesson { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #fff; }
.lesson.new { border-color: #b9cdf3; background: #f6f9ff; animation: rise .4s ease; }
.lesson h4 { margin: 0 0 4px; font-size: 13.5px; display: flex; gap: 8px; align-items: center; }
.lesson p { font-size: 13px; color: var(--text-2); }
.lesson small { display: block; margin-top: 6px; font-size: 11.5px; color: var(--muted); }

/* 图表 */
.chart svg { display: block; overflow: visible; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--line); }
.chart .tick, .chart .axis-label { fill: var(--muted); font-size: 11px; }
.chart .ref-label { fill: var(--text-2); font-size: 11px; font-weight: 600; paint-order: stroke; stroke: #fff; stroke-width: 3px; }
.chart .band-label { fill: var(--text-2); font-size: 11px; }
.chart .crosshair { stroke: var(--muted); stroke-width: 1; }
.chart-tip { position: fixed; z-index: 50; pointer-events: none; display: none; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 12px; line-height: 1.55; box-shadow: 0 6px 20px #0f1b3222; white-space: nowrap; }
.chart-tip .k { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.chart-tip .muted { color: var(--muted); }

/* 自动演示 */
.pilot-bar { position: fixed; left: 50%; top: 12px; transform: translateX(-50%); background: var(--navy); color: #fff; font-size: 12.5px; padding: 7px 8px 7px 14px; border-radius: 999px; display: none; align-items: center; gap: 10px; z-index: 60; box-shadow: 0 6px 20px #0c1a3644; }
.pilot-bar.on { display: flex; }
.pilot-bar button { border: 0; background: #ffffff22; color: #fff; border-radius: 999px; padding: 2px 10px; font-size: 12px; }
.press { animation: press .5s ease; }
@keyframes press { 0% { box-shadow: 0 0 0 0 #3869dd88; } 100% { box-shadow: 0 0 0 10px #3869dd00; } }

@media (max-width: 1180px) {
  .app { grid-template-columns: 1fr; height: auto; overflow: visible; }
  .sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px 16px; }
  .sidebar .conv-list, .sidebar .side-label, .sidebar .model-card, .sidebar .side-btn { display: none; }
  .side-foot { border: 0; padding: 0; flex-direction: row; flex-wrap: wrap; margin-left: auto; align-items: center; }
  .pilot { width: auto; }
  .chat { height: 85dvh; border-right: 0; border-bottom: 1px solid var(--line); }
  .row3 { grid-template-columns: 1fr; }
  .canvas-body { overflow: visible; }
}
