/* AIRPA 流程手 —— 内嵌页样式，全面复用客户端设计令牌（--card/--text/--primary/--radius/--glass 系） */

.page.airpa-page.active { height: 100%; display: flex; flex-direction: column; }
.airpa-page { padding: 0; }
.airpa-shell { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: var(--gap-4, 16px) var(--gap-5, 24px); gap: var(--gap-4, 16px); }

/* ── 顶栏英雄区（与开源雷达/议事殿同款 eyebrow+h2+desc）── */
.airpa-hero { display: flex; align-items: center; justify-content: space-between; gap: var(--gap-4, 16px); flex-wrap: wrap; }
.airpa-hero-left { display: flex; align-items: center; gap: var(--gap-4, 16px); min-width: 0; }
.airpa-back svg { width: 15px; height: 15px; }
.airpa-eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .12em; color: var(--primary, #10b981); text-transform: uppercase; }
.airpa-hero-titles h2 { font-size: 19px; font-weight: 700; margin: 2px 0 3px; display: flex; align-items: center; gap: 10px; color: var(--text, #0f172a); }
.airpa-hero-titles p { font-size: 12px; color: var(--sub, #64748b); margin: 0; }
.airpa-hero-actions { display: flex; align-items: center; gap: var(--gap-2, 8px); flex-wrap: wrap; }

.airpa-engine-state { font-size: 11px; font-weight: 500; padding: 3px 10px; border-radius: var(--radius-full, 9999px); background: var(--state-muted-soft, rgba(100,116,139,.08)); color: var(--sub, #64748b); border: 1px solid var(--line, rgba(148,163,184,.2)); }
.airpa-engine-state.on { color: var(--success, #10b981); background: var(--state-success-soft, rgba(16,185,129,.08)); border-color: rgba(16,185,129,.3); }

/* ── 三栏卡片区 ── */
.airpa-body { flex: 1; display: flex; gap: var(--gap-4, 16px); min-height: 0; }
.airpa-card { background: var(--card, #ffffff); border: 1px solid var(--line, rgba(148,163,184,.2)); border-radius: var(--radius-lg, 16px); box-shadow: var(--shadow-sm, 0 2px 8px rgba(15,23,42,.06)); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.airpa-pane-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line, rgba(148,163,184,.2)); flex: none; }
.airpa-pane-title { font-size: 12.5px; font-weight: 600; color: var(--text, #0f172a); }
.airpa-pane-meta { font-size: 11.5px; color: var(--sub, #64748b); }

/* 左栏：工作流清单 */
.airpa-side { width: 210px; flex: none; }
.airpa-wf-list { flex: 1; overflow-y: auto; padding: var(--gap-2, 8px); }
/* 工作流两行卡：图标chip+名 / 小字meta（N步·N参·更新日），active 左立 3px 竖条 */
.awf-item { position: relative; padding: 8px 10px; border-radius: 10px; cursor: pointer; margin-bottom: 3px; border: 1px solid transparent; transition: background .15s, border-color .15s; }
.awf-item:hover { background: var(--primary-gradient-soft, rgba(16,185,129,.06)); }
.awf-item.active { background: var(--primary-gradient-soft, rgba(16,185,129,.08)); border-color: rgba(16,185,129,.22); }
.awf-item.active::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 2px; background: var(--primary, #10b981); }
.awf-top { display: flex; align-items: center; gap: 7px; min-width: 0; }
.awf-ic { flex: none; width: 20px; height: 20px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 10px; background: var(--bg-deep, #e8ebef); color: var(--sub, #64748b); border: 1px solid var(--line, rgba(148,163,184,.25)); }
.awf-item.active .awf-ic { background: var(--primary, #10b981); border-color: var(--primary, #10b981); color: var(--on-primary, #fff); }
.awf-name { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 600; color: var(--text, #0f172a); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.awf-item.active .awf-name { color: var(--primary, #10b981); }
.awf-meta { margin: 4px 0 0 27px; font-size: 10.5px; color: var(--sub, #64748b); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 中栏：步骤卡 + 运行日志 */
.airpa-steps-pane { flex: 1.15; min-width: 0; }
.airpa-steps { flex: 1; overflow-y: auto; padding: var(--gap-3, 12px) var(--gap-4, 16px); }
.airpa-step-card { background: var(--bg, #f0f2f5); border: 1px solid var(--line, rgba(148,163,184,.2)); border-radius: var(--radius-md, 12px); padding: 10px 12px; margin-bottom: var(--gap-3, 12px); cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.airpa-step-card:hover { border-color: var(--primary, #10b981); }
.airpa-step-card.selected { border-color: var(--primary, #10b981); box-shadow: 0 0 0 2px var(--primary-glow, rgba(16,185,129,.25)); }
.airpa-step-card .s-n { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; border-radius: var(--radius-full, 9999px); background: var(--primary-gradient, linear-gradient(135deg,#10b981,#06b6d4)); color: var(--on-primary, #fff); font-size: 11px; font-weight: 700; margin-right: 8px; vertical-align: middle; }
.airpa-step-card .s-intent { font-weight: 600; font-size: 13px; color: var(--text, #0f172a); }
.airpa-step-card .s-status { float: right; font-size: 12px; }
.airpa-step-card .s-status.ok { color: var(--success, #10b981); }
.airpa-step-card .s-status.err { color: var(--danger, #ef4444); }
.airpa-step-card .s-status.run { color: var(--warning, #f59e0b); }
.airpa-step-card .s-code { font-family: Consolas, "JetBrains Mono", monospace; font-size: 11.5px; color: var(--text-secondary, #475569); background: var(--bg-deep, #e8ebef); border: 1px solid var(--line, rgba(148,163,184,.2)); border-radius: var(--radius-sm, 8px); padding: 7px 9px; margin-top: 8px; white-space: pre-wrap; word-break: break-all; max-height: 120px; overflow-y: auto; }
.airpa-step-card .s-shot { display: block; max-width: 240px; max-height: 140px; border: 1px solid var(--line, rgba(148,163,184,.2)); border-radius: var(--radius-sm, 8px); margin-top: 8px; }
.airpa-empty { color: var(--sub, #64748b); padding: 64px 20px; text-align: center; font-size: 13px; }
.airpa-empty::before { content: ""; display: block; width: 56px; height: 56px; margin: 0 auto 16px; border: 2px dashed var(--line-strong, rgba(148,163,184,.35)); border-radius: var(--radius-md, 12px); }

.airpa-runlog-wrap { flex: none; border-top: 1px solid var(--line, rgba(148,163,184,.2)); background: var(--bg-deep, #e8ebef); }
.airpa-runlog-title { padding: 8px 14px 0; font-size: 11.5px; }
.airpa-runlog { height: 108px; overflow-y: auto; padding: 6px 14px 10px; font-family: Consolas, "JetBrains Mono", monospace; font-size: 11.5px; color: var(--text-secondary, #475569); white-space: pre-wrap; }
.airpa-runlog .err { color: var(--danger, #ef4444); }
.airpa-runlog .ok { color: var(--success, #10b981); }

/* 右栏：AI 对话 = 悬浮窗 af 壳内嵌（af-* 皮肤由 council.css 出，这里只做栏内本地化） */
.airpa-chat-pane { flex: 1; min-width: 0; position: relative; }
/* position:fixed 的浮窗壳在栏内落回静态布局——卡面皮肤由 .airpa-card 出 */
.airpa-chat-pane .aide-float-panel.airpa-af {
  position: static; inset: auto; width: 100%; height: 100%; max-height: none;
  border: none; box-shadow: none; border-radius: 0; background: transparent;
  display: flex; flex-direction: column;
}
/* 输入框塌缩双保险之一：页面未激活时量出的瘪 inline 高度不许小过一行 */
.airpa-chat-pane .aide-float-panel.airpa-af .af-composer textarea { min-height: 38px; }



/* ── 议事殿分身：af-head 里的连接态小签（与 af-btn 同档字号）── */
.airpa-aide-tag { font-size: 11px; color: var(--sub, #64748b); flex: none; white-space: nowrap; }
.airpa-aide-tag.on { color: var(--primary, #10b981); }
.airpa-aide-tag.err { color: var(--danger, #ef4444); }

/* ── 左栏：干活动态 feed ── */
.airpa-feed-wrap { flex: none; max-height: 46%; border-top: 1px solid var(--line, rgba(148,163,184,.2)); display: flex; flex-direction: column; }
.airpa-feed-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px 6px; }
.airpa-feed { flex: 1; overflow-y: auto; padding: 0 8px 10px; }
.airpa-feed-empty { color: var(--sub, #64748b); font-size: 11.5px; padding: 12px 8px; }
.airpa-feed-item { display: flex; gap: 8px; align-items: baseline; padding: 6px 8px; border-radius: var(--radius-sm, 8px); font-size: 11.5px; color: var(--text-secondary, #475569); border-left: 2px solid var(--line, rgba(148,163,184,.3)); margin-bottom: 4px; background: var(--bg, #f0f2f5); }
.airpa-feed-item.ok { border-left-color: var(--success, #10b981); }
.airpa-feed-item.err { border-left-color: var(--danger, #ef4444); }
.airpa-feed-item .f-time { color: var(--sub, #64748b); font-family: Consolas, monospace; font-size: 10.5px; flex: none; }
.airpa-feed-item .f-text { word-break: break-all; }

/* ── 中栏：视图 tabs + 流程视图 ── */
.airpa-tabs-head { gap: 10px; }
.airpa-tabs { display: flex; gap: 4px; }
.airpa-tab { border: 1px solid transparent; background: transparent; color: var(--sub, #64748b); font-size: 12.5px; font-weight: 600; padding: 5px 12px; border-radius: var(--radius-full, 9999px); cursor: pointer; transition: all .15s; }
.airpa-tab:hover { color: var(--text, #0f172a); }
.airpa-tab.on { color: var(--primary, #10b981); background: var(--primary-gradient-soft, rgba(16,185,129,.1)); border-color: rgba(16,185,129,.3); }
.airpa-view { flex: 1; min-height: 0; }
.airpa-view.hidden { display: none; }

.airpa-flow { overflow-y: auto; padding: var(--gap-3, 12px); }

/* ── 流程视图：HTML 时间线（aflow-*）。左 22px 轨道=编号圆点+连接竖线+下箭头，右卡=完整 intent+状态字 ── */
.aflow { padding: 4px 0 8px; }
.aflow-row { display: flex; align-items: stretch; gap: 10px; margin-bottom: 14px; }
.aflow-row.last { margin-bottom: 0; }
.aflow-rail { position: relative; flex: none; width: 22px; display: flex; justify-content: center; }
/* 连接竖线：从本圆点底一直画到下一行圆点顶（bottom 负值吃进行间 margin） */
.aflow-rail::before { content: ""; position: absolute; top: 22px; bottom: -14px; left: 50%; width: 2px; transform: translateX(-50%); background: var(--line-strong, rgba(148,163,184,.45)); border-radius: 1px; }
.aflow-rail::after { content: ""; position: absolute; bottom: -14px; left: 50%; transform: translateX(-50%); width: 0; height: 0; border: 4.5px solid transparent; border-top: 6px solid var(--line-strong, rgba(148,163,184,.45)); }
.aflow-row.last .aflow-rail::before, .aflow-row.last .aflow-rail::after { display: none; }
.aflow-rail.ok::before { background: var(--success, #10b981); }
.aflow-rail.ok::after { border-top-color: var(--success, #10b981); }
.aflow-num { position: relative; z-index: 1; flex: none; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; background: var(--card, #fff); border: 1.5px solid var(--line-strong, rgba(148,163,184,.45)); color: var(--sub, #64748b); }
.aflow-rail.ok .aflow-num { background: var(--success, #10b981); border-color: var(--success, #10b981); color: #fff; }
.aflow-rail.err .aflow-num { background: var(--danger, #ef4444); border-color: var(--danger, #ef4444); color: #fff; }
.aflow-rail.run .aflow-num { background: var(--warning, #f59e0b); border-color: var(--warning, #f59e0b); color: #fff; animation: aflow-pulse 1.1s ease-in-out infinite; }
@keyframes aflow-pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
.aflow-card { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: var(--card, #fff); border: 1px solid var(--line, rgba(148,163,184,.2)); border-radius: 10px; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.aflow-card:hover { border-color: var(--primary, #10b981); }
.aflow-card.ok { border-color: rgba(16,185,129,.4); }
.aflow-card.err { border-color: rgba(239,68,68,.4); }
.aflow-card.run { border-color: rgba(245,158,11,.45); }
.aflow-card.selected { border-color: var(--primary, #10b981); box-shadow: 0 0 0 2px var(--primary-glow, rgba(16,185,129,.25)); }
.aflow-intent { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 600; line-height: 1.45; color: var(--text, #0f172a); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-all; }
.aflow-status { flex: none; font-size: 11px; color: var(--sub, #64748b); }
.aflow-card.ok .aflow-status { color: var(--success, #10b981); }
.aflow-card.err .aflow-status { color: var(--danger, #ef4444); }
.aflow-card.run .aflow-status { color: var(--warning, #f59e0b); animation: aflow-pulse 1.1s ease-in-out infinite; }
/* 前缀/后缀分组横带：细分隔线+小字标签，与卡片列左对齐（22px 轨 + 10px 间距） */
.aflow-band { display: flex; align-items: center; gap: 10px; margin: 0 0 12px 32px; }
.aflow-band:first-child { margin-top: 2px; }
.aflow-band::before, .aflow-band::after { content: ""; flex: 1; height: 1px; background: var(--line, rgba(148,163,184,.28)); }
.aflow-band-label { flex: none; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; color: var(--sub, #64748b); padding: 2px 10px; border: 1px solid var(--line, rgba(148,163,184,.28)); border-radius: 999px; background: var(--bg, #f0f2f5); white-space: nowrap; }

/* 运行日志独立成 tab 后吃满高度 */
.airpa-runlog { height: auto; max-height: none; }
.airpa-runlog-wrap { display: none; }

/* ── composer kit（小助同款 cc-chip/cc-pop/cc-kit 皮肤由 council.css 出）── */
/* 窄栏收紧：chips 字号压一档、行高收矮，省出聊天区 */
.airpa-chat-pane .cc-chip { font-size: 11px !important; padding: 2px 9px !important; height: 24px !important; line-height: 18px !important; }
.airpa-chat-pane .cc-chip svg { width: 10px; height: 10px; }
.airpa-chat-pane .cc-pop { min-width: 150px; }

/* ── 聊天空态卡：分身身份+能力清单+快捷开场白── */
.airpa-chat-empty { margin: auto; max-width: 320px; padding: 34px 18px; text-align: center; display: flex; flex-direction: column; align-items: center; }
.ace-badge { width: 46px; height: 46px; border-radius: 13px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; letter-spacing: .8px; color: #fff; background: linear-gradient(135deg, var(--primary, #10b981) 0%, #0ea5e9 100%); box-shadow: 0 6px 18px rgba(16,185,129,.28); margin-bottom: 10px; }
.ace-name { font-size: 14px; font-weight: 650; color: var(--text, #0f172a); }
.ace-sub { font-size: 11.5px; color: var(--sub, #64748b); margin: 5px 0 16px; }
.ace-caps { text-align: left; width: 100%; font-size: 12px; line-height: 1.95; color: var(--text, #0f172a); background: var(--bg, #f0f2f5); border: 1px solid var(--line, rgba(148,163,184,.2)); border-radius: var(--radius-md, 12px); padding: 11px 14px; }
.ace-cap::before { content: "·"; color: var(--primary, #10b981); font-weight: 800; margin-right: 6px; }
.ace-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 14px; }
.ace-chip { font-size: 11.5px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line, rgba(148,163,184,.3)); background: var(--card, #fff); color: var(--text, #0f172a); cursor: pointer; transition: border-color .15s, color .15s; }
.ace-chip:hover { border-color: var(--primary, #10b981); color: var(--primary, #10b981); }

/* ── 工具确认卡（受限档高危调用等用户裁决）── */
.airpa-confirm { margin: 4px 14px; padding: 10px 12px; border: 1px solid rgba(245,158,11,.45); border-radius: 10px; background: rgba(245,158,11,.07); }
.airpa-confirm-txt { font-size: 12px; line-height: 1.6; white-space: pre-wrap; word-break: break-all; color: var(--text, #0f172a); }
.airpa-confirm-btns { display: flex; gap: 8px; margin-top: 8px; }
.airpa-btn-mini { padding: 4px 14px; font-size: 12px; border: 1px solid var(--line, rgba(148,163,184,.35)); border-radius: 7px; background: var(--card, #fff); color: var(--text, #0f172a); cursor: pointer; }
.airpa-btn-mini:hover { border-color: var(--primary, #10b981); }
.airpa-btn-mini.ok { background: var(--primary, #10b981); border-color: var(--primary, #10b981); color: var(--on-primary, #fff); }

/* ── 星系视图：工作流世界树（家族核心+分支卫星）── */
.airpa-map { position: relative; overflow: hidden; display: flex; flex-direction: column; }
.amap-tools { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line, rgba(148,163,184,.2)); }
.amap-search { flex: 1; min-width: 0; height: 28px; padding: 0 10px; font-size: 12px; color: var(--text, #0f172a); background: var(--bg, #f0f2f5); border: 1px solid var(--line, rgba(148,163,184,.3)); border-radius: 8px; outline: none; }
.amap-search:focus { border-color: var(--primary, #10b981); }
.amap-stat { flex: none; font-size: 11px; color: var(--sub, #64748b); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.amap-zoom { flex: none; min-width: 40px; text-align: right; font-size: 11px; color: var(--sub, #64748b); font-variant-numeric: tabular-nums; }
#airpaMapCanvas { flex: 1; min-height: 0; width: 100%; cursor: grab; touch-action: none; }
.amap-tip { position: absolute; z-index: 5; max-width: 260px; padding: 7px 10px; font-size: 11.5px; line-height: 1.55; color: var(--text, #0f172a); background: var(--card, #fff); border: 1px solid var(--line, rgba(148,163,184,.35)); border-radius: 9px; box-shadow: 0 6px 18px rgba(15,23,42,.14); pointer-events: none; opacity: 0; transition: opacity .12s; }
.amap-tip.show { opacity: 1; }
.airpa-wf-search { flex: none; padding: 6px 10px 2px; }
.airpa-wf-search input { width: 100%; height: 28px; padding: 0 10px; font-size: 12px; color: var(--text, #0f172a); background: var(--bg, #f0f2f5); border: 1px solid var(--line, rgba(148,163,184,.3)); border-radius: 8px; outline: none; }
.airpa-wf-search input:focus { border-color: var(--primary, #10b981); }
