* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; background: #0d1016; color: #e8edf4; overflow: hidden; }
.lab-shell { display: flex; flex-direction: column; height: 100vh; }

.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 9px 14px; background: #141925; border-bottom: 1px solid #232c3d; }
.title { display: flex; flex-direction: column; line-height: 1.3; }
.title strong { font-size: 15px; }
.title span { font-size: 11px; color: #8b97a8; }
.group { display: flex; align-items: center; gap: 7px; background: #161c28; border: 1px solid #232c3d; border-radius: 10px; padding: 5px 9px; }
.group-label { font-size: 11px; color: #7f8ca0; }
.toolbar button, .toolbar select {
  background: #1d2536; color: #c4cee0; border: 1px solid #2c3850;
  padding: 5px 10px; border-radius: 7px; cursor: pointer; font-size: 12.5px;
}
.toolbar button:hover { background: #26314a; }
.toolbar .ghost { background: transparent; color: #8b97a8; }
.toolbar .slider2 { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: #8b97a8; }
.toolbar input[type="range"] { width: 72px; }
.quick { display: flex; gap: 6px; margin-left: auto; }
#fullscreenBtn { border-color: #3b6ef0; color: #cdddff; }

.stage { position: relative; flex: 1; min-height: 0; }
#deck-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

.status { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: #141925; border: 1px solid #2c3850; padding: 12px 18px; border-radius: 10px; font-size: 14px; z-index: 6; }
.status.hidden { display: none; }

.legend { position: absolute; left: 14px; bottom: 14px; z-index: 4; display: flex; flex-wrap: wrap; gap: 3px 4px; max-width: calc(100% - 28px); background: rgba(20,25,37,.82); padding: 6px 9px; border-radius: 9px; border: 1px solid #232c3d; font-size: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex-shrink: 0; }

.stats { position: absolute; right: 14px; top: 14px; z-index: 4; background: rgba(20,25,37,.85); padding: 10px 12px; border-radius: 9px; border: 1px solid #232c3d; font-size: 12px; min-width: 120px; }
.stats > div { display: flex; justify-content: space-between; gap: 14px; line-height: 1.7; }
.stats > div span { color: #8b97a8; }
.stats .stats-types { display: block; margin-top: 6px; padding-top: 6px; border-top: 1px solid #2c3850; color: #c4cee0; }

.tip { position: absolute; z-index: 7; pointer-events: none; background: rgba(17,21,28,.95); border: 1px solid #2c3850; border-radius: 7px; padding: 5px 9px; font-size: 12px; color: #eef2f7; max-width: 260px; }
.tip.hidden { display: none; }

.detail { position: absolute; top: 14px; left: 14px; z-index: 8; width: 260px; background: #141925; border: 1px solid #2c3850; border-radius: 12px; padding: 14px; box-shadow: 0 12px 34px rgba(0,0,0,.5); }
.detail.hidden { display: none; }
.detail h3 { margin: 0 24px 8px 0; font-size: 15px; }
.detail dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; font-size: 12px; }
.detail dt { color: #8b97a8; }
.detail dd { margin: 0; }
.detail-close { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border: none; border-radius: 6px; background: #1d2536; color: #c4cee0; cursor: pointer; font-size: 16px; line-height: 1; }

.hint { padding: 7px 14px; background: #141925; border-top: 1px solid #232c3d; font-size: 11.5px; color: #8b97a8; }

/* 演示模式：隐藏所有控制 chrome，画面最大化 */
.lab-shell.present .toolbar,
.lab-shell.present .hint,
.lab-shell.present .legend,
.lab-shell.present .stats,
.lab-shell.present .detail { display: none; }
.present-exit { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 20; display: flex; align-items: center; gap: 12px; background: rgba(20, 25, 37, 0.9); border: 1px solid #2c3850; border-radius: 20px; padding: 5px 8px 5px 16px; font-size: 12px; color: #c4cee0; }
.present-exit.hidden { display: none; }
.present-exit .pe-label { opacity: .8; }
.present-exit .pe-ctrl { display: inline-flex; align-items: center; gap: 6px; }
.present-exit select { background: #1d2536; color: #c4cee0; border: 1px solid #2c3850; border-radius: 6px; padding: 3px 6px; font-size: 12px; cursor: pointer; }
.present-exit .pe-exit { background: #26314a; color: #cdddff; border: 1px solid #3b6ef0; border-radius: 16px; padding: 4px 12px; font-size: 12px; cursor: pointer; }
.present-exit .pe-exit:hover { background: #2f3e5e; }

.stats-badge { margin-top: 6px; padding-top: 6px; border-top: 1px solid #2c3850; font-size: 11px; color: #8b97a8; }
.stats-badge.draft { color: #f4c542; }

/* 文本抽取面板 */
.xpanel { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 9; width: 460px; max-width: 92%; background: #141925; border: 1px solid #2c3850; border-radius: 12px; padding: 16px; box-shadow: 0 24px 60px rgba(0,0,0,.6); }
.xpanel.hidden { display: none; }
.xpanel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.xpanel-head strong { font-size: 15px; }
.xpanel .xrow { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: #c4cee0; margin-bottom: 8px; }
.xpanel textarea { width: 100%; background: #0f141d; color: #e8edf4; border: 1px solid #2c3850; border-radius: 8px; padding: 8px; font-size: 13px; line-height: 1.6; resize: vertical; }
.xpanel select, .xpanel input[type="number"] { background: #1d2536; color: #c4cee0; border: 1px solid #2c3850; padding: 5px 7px; border-radius: 7px; font-size: 12.5px; }
.xpanel .num { width: 56px; }
.xpanel input[type="text"], .xpanel input[type="password"] { flex: 1; min-width: 80px; background: #0f141d; color: #e8edf4; border: 1px solid #2c3850; border-radius: 7px; padding: 6px 8px; font-size: 12.5px; }
.xpanel .xcred { display: flex; gap: 6px; margin-top: 8px; }
.xparams { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin: 10px 0; font-size: 12.5px; color: #c4cee0; }
.xparams label { display: inline-flex; align-items: center; gap: 6px; }
.xactions { display: flex; align-items: center; gap: 12px; }
.xactions button { background: #3b6ef0; color: #fff; border: none; padding: 7px 16px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.xactions .muted { font-size: 11px; color: #6b7686; }

/* AI 洞察面板 */
.insight { position: absolute; top: 14px; right: 14px; z-index: 9; width: 320px; max-height: calc(100% - 28px); overflow: auto; background: #141925; border: 1px solid #2c3850; border-radius: 12px; padding: 14px; box-shadow: 0 18px 44px rgba(0,0,0,.55); }
.insight.hidden { display: none; }
.insight-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.insight-head strong { font-size: 15px; color: #f4c542; }
.ins-sec { margin: 10px 0; }
.ins-sec h4 { margin: 0 0 4px; font-size: 12.5px; color: #9fb0c8; }
.ins-sec p { margin: 0; font-size: 12.5px; line-height: 1.6; color: #e2e8f1; }
.ins-sec ul { margin: 0; padding-left: 18px; font-size: 12.5px; line-height: 1.6; }
.ins-sec li { margin-bottom: 4px; }
.ins-loading { font-size: 12px; color: #8b97a8; margin-top: 8px; }
.ins-note { margin-top: 10px; padding-top: 8px; border-top: 1px solid #2c3850; font-size: 11px; color: #8b97a8; line-height: 1.5; }
.insight .muted { color: #7f8ca0; }

/* 历史案例列表 */
.hist-list { max-height: 360px; overflow: auto; display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.hist-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 11px; background: #0f141d; border: 1px solid #2c3850; border-radius: 8px; }
.hist-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.hist-main strong { font-size: 13.5px; }
.hist-main .muted { font-size: 11px; color: #8b97a8; }
.hist-act { display: flex; gap: 6px; flex-shrink: 0; }
.hist-act button { background: #3b6ef0; color: #fff; border: none; padding: 5px 12px; border-radius: 7px; cursor: pointer; font-size: 12.5px; }
.hist-act button.ghost { background: #1d2536; color: #c4cee0; border: 1px solid #2c3850; }
.hist-act button:hover { filter: brightness(1.1); }

/* 可点选图例（多选高亮类型） */
.legend .lg-item { cursor: pointer; user-select: none; padding: 1px 5px; border-radius: 5px; border: 1px solid transparent; transition: opacity .12s, border-color .12s; }
.legend .lg-item:hover { background: rgba(255,255,255,.06); }
.legend .lg-item.sel { border-color: #3b6ef0; background: rgba(59,110,240,.18); }
.legend .lg-item.off { opacity: .4; }
.legend .lg-clear { cursor: pointer; color: #8b97a8; padding: 2px 6px; border-radius: 6px; }
.legend .lg-clear:hover { color: #e8edf4; background: rgba(255,255,255,.06); }

/* 可视化助手（对话面板，右侧停靠） */
#copilotBtn { border-color: #7c5cf0; color: #ddd3ff; }
.copilot { position: absolute; top: 14px; right: 14px; bottom: 14px; z-index: 12; width: 330px; display: flex; flex-direction: column; background: #141925; border: 1px solid #2c3850; border-radius: 12px; box-shadow: 0 18px 44px rgba(0,0,0,.55); }
.copilot.hidden { display: none; }
.cp-head { display: flex; align-items: baseline; gap: 8px; padding: 12px 14px 10px; border-bottom: 1px solid #232c3d; }
.cp-head strong { font-size: 14.5px; }
.cp-head .cp-sub { flex: 1; font-size: 10.5px; color: #7f8ca0; }
.cp-msgs { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.cp-msg { max-width: 92%; padding: 8px 11px; border-radius: 10px; font-size: 12.5px; line-height: 1.6; word-break: break-word; white-space: pre-wrap; }
.cp-msg.user { align-self: flex-end; background: #2a3b63; color: #e8edf4; }
.cp-msg.bot { align-self: flex-start; background: #1d2536; color: #dbe3f0; }
.cp-msg.act { align-self: flex-start; background: transparent; border: 1px dashed #2c3850; color: #9fb0c8; font-size: 11.5px; padding: 4px 9px; }
.cp-msg.sys { align-self: flex-start; color: #8b97a8; font-size: 11.5px; background: transparent; }
.cp-chips { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 12px 8px; }
.cp-chip { background: #1d2536; color: #aab8d0; border: 1px solid #2c3850; border-radius: 12px; padding: 3px 9px; font-size: 11px; cursor: pointer; }
.cp-chip:hover { background: #26314a; color: #fff; }
.cp-input { display: flex; gap: 7px; padding: 10px 12px 12px; border-top: 1px solid #232c3d; }
.cp-input textarea { flex: 1; background: #0f141d; color: #e8edf4; border: 1px solid #2c3850; border-radius: 8px; padding: 7px 9px; font-size: 12.5px; line-height: 1.5; resize: none; font-family: inherit; }
.cp-input button { align-self: flex-end; background: #7c5cf0; color: #fff; border: none; border-radius: 8px; padding: 7px 14px; font-size: 12.5px; cursor: pointer; }
.cp-input button:disabled { opacity: .5; cursor: wait; }
/* 演示模式下隐藏助手面板（沉浸），Esc 退出后自动恢复 */
.lab-shell.present .copilot { display: none; }

/* 演示条：巡航暂停按钮（中性样式，区别于"退出"） */
.present-exit .pe-btn { background: #1d2536; color: #c4cee0; border: 1px solid #2c3850; border-radius: 16px; padding: 4px 12px; font-size: 12px; cursor: pointer; }
.present-exit .pe-btn:hover { background: #26314a; }
.cp-errdetail { color: #e07a7a; font-size: 10.5px; word-break: break-all; }
