:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --ink: #1f2329;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #2f6fed;
  --brand-soft: #eaf1ff;
  --ai-bubble: #ffffff;
  --user-bubble: #2f6fed;
  --ok: #1a9d5a;
  --fail: #d8453a;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--brand); color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center; letter-spacing: 1px;
}
.title { font-weight: 700; font-size: 15px; }
.subtitle { font-size: 12px; color: var(--muted); margin-top: 2px; }

.badge {
  font-size: 12px; padding: 4px 10px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand); font-weight: 600;
}
.badge.ok { background: #e6f6ed; color: var(--ok); }
.badge.fail { background: #fdecea; color: var(--fail); }
.hidden { display: none !important; }

.chat {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: 14px; max-width: 860px; width: 100%; margin: 0 auto;
}
.hint {
  margin: auto; text-align: center; color: var(--muted);
  background: var(--panel); border: 1px dashed var(--line);
  padding: 24px; border-radius: 14px; max-width: 520px; line-height: 1.7;
}

.bubble {
  max-width: 78%; padding: 12px 14px; border-radius: 14px; line-height: 1.65;
  white-space: pre-wrap; word-break: break-word; font-size: 14px;
}
.bubble.ai {
  align-self: flex-start; background: var(--ai-bubble);
  border: 1px solid var(--line); border-bottom-left-radius: 4px;
}
.bubble.user {
  align-self: flex-end; background: var(--user-bubble); color: #fff;
  border-bottom-right-radius: 4px;
}

.dossier-panel {
  max-width: 860px; width: 100%; margin: 0 auto 12px; padding: 16px 20px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
}
.dossier-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.dossier-head h2 { font-size: 16px; margin: 0; }
.dossier-text {
  background: #0f172a; color: #e2e8f0; padding: 16px; border-radius: 10px;
  max-height: 320px; overflow: auto; font-size: 12.5px; line-height: 1.6;
  white-space: pre-wrap; margin: 0;
}
.dossier-actions { display: flex; gap: 10px; margin: 12px 0 6px; flex-wrap: wrap; }
.handoff { font-size: 12px; color: var(--muted); line-height: 1.7; margin: 6px 0 0; }

.composer {
  display: flex; gap: 10px; padding: 14px 20px; background: var(--panel);
  border-top: 1px solid var(--line); max-width: 100%; margin: 0 auto; width: 100%;
}
.composer input {
  flex: 1; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 16px; outline: none; -webkit-appearance: none;
}
.composer input:focus { border-color: var(--brand); }

.btn {
  padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); font-size: 14px; cursor: pointer;
  font-weight: 600;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { background: #2560d8; color: #fff; }
.btn.ghost { background: transparent; }
