/* ai2ai 页面样式 —— 浅色、信息分层清晰 */
:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --line: #e3e8f0;
  --ink: #1a2332;
  --ink-2: #5b6572;
  --ink-3: #94a0af;
  --a: #4f46e5; --a-bg: #eeeffd; --a-ink: #3730a3;
  --b: #059669; --b-bg: #e7f7f0; --b-ink: #065f46;
  --gate: #b45309; --gate-bg: #fdf3e3;
  --sys: #7b8794;
  --danger: #dc2626;
  --radius: 12px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px;
}
button { font-family: inherit; cursor: pointer; }
button:disabled { opacity: .5; cursor: not-allowed; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cdd5e0; border-radius: 8px; }

/* ── 顶栏 ─────────────────────────────── */
header {
  background: var(--panel); border-bottom: 1px solid var(--line);
  padding: 10px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.logo { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.logo .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--a); box-shadow: 0 0 0 3px var(--a-bg); }
.title-sub { color: var(--ink-2); font-size: 12px; }
.mode-badge { font-size: 11px; padding: 2px 8px; border-radius: 20px; background: var(--gate-bg); color: var(--gate); font-weight: 600; }
.mode-badge.llm { background: #e6f7ef; color: var(--b); }
.ctrl { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { border-color: #c3ccd9; }
.btn.primary { background: var(--a); border-color: var(--a); color: #fff; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.warn { background: var(--gate-bg); border-color: #ecd6ab; color: var(--gate); }
select.btn { padding: 5px 8px; }
.status-chip { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 20px; background: #eceff4; color: var(--ink-2); }
.status-chip.running { background: #e6f7ef; color: var(--b); animation: pulse 1.6s infinite; }
.status-chip.paused { background: var(--gate-bg); color: var(--gate); }
.status-chip.done { background: #e8edff; color: var(--a); }
@keyframes pulse { 50% { opacity: .55; } }

/* ── 主区三栏 ─────────────────────────── */
.layout { display: grid; grid-template-columns: 300px 1fr; gap: 12px; padding: 12px; height: calc(100vh - 53px); }
.col { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.col-head {
  padding: 9px 12px; font-weight: 600; font-size: 13px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; background: #fbfcfe;
}
.col-body { flex: 1; overflow-y: auto; padding: 10px 12px; }
.pane-ctrl { font-size: 12px; color: var(--a); cursor: pointer; }

/* 资料卡片 */
.pcard { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
.pcard .phead { padding: 8px 10px; font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.pcard .pbody { padding: 8px 12px 12px; }
.pcard .org { color: var(--ink-2); font-weight: 500; font-size: 12px; }
.av { width: 22px; height: 22px; border-radius: 50%; color: #fff; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.av.a { background: var(--a); } .av.b { background: var(--b); } .av.g { background: var(--gate); font-size: 11px; }
.doc-item { font-size: 12.5px; line-height: 1.6; color: var(--ink-2); padding: 6px 0; border-top: 1px dashed var(--line); }
.doc-item:first-child { border-top: none; }
.sec-label { font-size: 11px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .4px; margin: 10px 0 4px; }
.red-item { font-size: 12px; color: var(--danger); padding: 3px 0 3px 16px; position: relative; line-height: 1.5; }
.red-item::before { content: "✕"; position: absolute; left: 0; font-weight: 700; }
.topic-item { font-size: 12px; color: var(--gate); padding: 3px 0 3px 18px; position: relative; line-height: 1.5; }
.topic-item::before { content: "✓"; position: absolute; left: 0; font-weight: 700; }

/* 达成结论 */
.result-box { border: 1px solid #c7d2fe; background: #f5f7ff; border-radius: 10px; padding: 10px 12px; margin-top: 4px; display: none; white-space: pre-wrap; }
.result-box.on { display: block; }
.result-box .rhead { font-weight: 700; color: var(--a); margin-bottom: 6px; font-size: 13px; }
.result-box pre { font-family: inherit; white-space: pre-wrap; font-size: 12.5px; line-height: 1.7; color: var(--ink); }

/* 审计 */
.audit-item { font-size: 11.5px; padding: 5px 6px; border-radius: 6px; margin-bottom: 4px; line-height: 1.5; background: #f7f8fb; }
.audit-item .who { font-weight: 600; }
.audit-item.pass { border-left: 3px solid var(--b); }
.audit-item.block { border-left: 3px solid var(--danger); background: #fdf4f4; }
.audit-item.human { border-left: 3px solid var(--sys); }
.audit-item .reason { color: var(--danger); }
.audit-item .time { color: var(--ink-3); font-size: 10.5px; float: right; }

/* ── 中央对话流 ───────────────────────── */
.feed { padding: 16px 18px 8px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; flex: 1; min-height: 0; }
.row { display: flex; gap: 8px; align-items: flex-end; }
.row.ga { flex-direction: row; }
.row.gb { flex-direction: row-reverse; }
.row.center { justify-content: center; }
.bubble {
  max-width: 72%; padding: 9px 12px; border-radius: 12px; font-size: 13.5px; line-height: 1.7;
  white-space: pre-wrap; word-break: break-word; position: relative; box-shadow: 0 1px 1px rgba(20,30,50,.04);
}
.ga .bubble { background: var(--a-bg); color: var(--a-ink); border-top-left-radius: 3px; }
.gb .bubble { background: var(--b-bg); color: var(--b-ink); border-top-right-radius: 3px; }
.row.human .bubble { outline: 1.5px dashed var(--ink-3); }
.gate-row { justify-content: center; }
.gate-bubble {
  background: var(--gate-bg); color: var(--gate); font-size: 12px; padding: 6px 12px; border-radius: 10px;
  display: flex; align-items: center; gap: 6px; max-width: 88%;
}
.sys-row { justify-content: center; }
.sys-bubble { color: var(--ink-3); font-size: 12px; text-align: center; }
.role-tag { font-size: 11px; color: var(--ink-3); margin: 0 2px; min-width: 52px; }
.ga .role-tag { text-align: right; }
.meta { font-size: 10.5px; color: var(--ink-3); margin-top: 3px; display: flex; gap: 8px; align-items: center; }
.gate-pass { color: var(--b); }
.gate-block { color: var(--danger); }
.typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,80%,100%{opacity:.25} 40%{opacity:1} }

/* ── 底部代说条 ───────────────────────── */
.compose { border-top: 1px solid var(--line); padding: 10px 12px; display: flex; gap: 8px; align-items: center; background: var(--panel); }
.compose .sel { flex: none; }
.compose input {
  flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-size: 13px; outline: none;
}
.compose input:focus { border-color: var(--a); }
.legend { font-size: 11px; color: var(--ink-3); display: flex; gap: 14px; align-items: center; padding: 6px 12px; background: #fbfcfe; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.legend span i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }

.desc { font-size: 12.5px; color: var(--ink-2); line-height: 1.7; padding: 2px 0; }

/* ── 建房 / 房间标识 ───────────────────── */
.room-chip {
  font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 6px;
  background: #eef0f6; color: var(--ink-2); border: 1px dashed #c6cdd9; cursor: pointer;
}
.room-chip:hover { background: #e6e9f2; color: var(--ink); }

/* ── AI 接入 / 席位面板 ────────────────── */
.seat-hint { font-size: 11px; color: var(--ink-3); line-height: 1.6; margin-bottom: 6px; }
.seat-hint b { color: var(--ink-2); }
.seat-row { display: flex; align-items: center; gap: 6px; margin: 5px 0; flex-wrap: wrap; }
.seat-side { font-size: 12px; font-weight: 600; min-width: 64px; }
.seat-chip { font-size: 10.5px; padding: 1px 7px; border-radius: 20px; background: #eceff4; color: var(--ink-2); font-weight: 600; }
.seat-chip.ext { background: #e6f7ef; color: var(--b); }
.seat-url {
  flex: 1; min-width: 130px; border: 1px solid var(--line); border-radius: 6px;
  padding: 4px 8px; font-size: 12px; outline: none; font-family: var(--mono);
}
.seat-url:focus { border-color: var(--a); }
.seat-url:disabled { background: #f3f5f9; color: var(--ink-3); cursor: not-allowed; }
.btn.mini { padding: 3px 9px; font-size: 12px; border-radius: 6px; }
.btn.ghost { opacity: .75; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.lock-note { font-size: 11px; color: var(--gate); background: var(--gate-bg); border-radius: 8px; padding: 6px 9px; margin-top: 4px; line-height: 1.7; }

/* ── 复制 toast ────────────────────────── */
#toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(16px);
  background: #1a2332; color: #fff; font-size: 12.5px; padding: 7px 16px; border-radius: 20px;
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 99; box-shadow: 0 4px 14px rgba(0,0,0,.2);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (max-width: 980px) { .layout { grid-template-columns: 1fr; } .col-side { display: none; } }
