:root {
  /* 中性石墨底；FWD 橙只承担主题强调，操作按钮使用通用蓝色。 */
  --bg: #101216;
  --panel: #181b21;
  --panel-2: #20242c;
  --line: #323843;
  --text: #f3f4f6;
  --muted: #9ca3af;
  --brand: #ed751c;
  --accent: #ed751c;
  --accent-soft: rgba(237, 117, 28, 0.13);
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-soft: rgba(59, 130, 246, 0.14);
  --ok: #34d399;
  --work: #f59e42;
  --alert: #ef6a5b;
  --idle: #596170;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(255, 255, 255, .018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .018) 1px, transparent 1px),
    radial-gradient(900px 420px at 55% -15%, rgba(237, 117, 28, .09), transparent 68%);
  background-size: 32px 32px, 32px 32px, auto;
  color: var(--text);
  font: 15px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
.topbar {
  padding: 16px 28px;
  border-top: 3px solid var(--accent);
  border-bottom: 1px solid var(--line);
  background: rgba(16, 18, 22, .9);
  position: relative;
  backdrop-filter: blur(12px);
}
.brand { font-size: 20px; font-weight: 800; letter-spacing: .5px; display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 7px; display: inline-block;
  background: linear-gradient(135deg, var(--accent), #ffad5c);
  box-shadow: 0 0 14px rgba(237,117,28,.35); position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 6px 5px; border-radius: 2px;
  border-left: 6px solid #101216; border-top: 4px solid transparent; border-bottom: 4px solid transparent;
}
.tag { font-size: 12px; color: var(--muted); border: 1px solid var(--line); padding: 2px 8px; border-radius: 999px; font-weight: 500; }
.subtitle { color: var(--muted); font-size: 13px; margin-top: 4px; }
.topbar-right { position: absolute; top: 16px; right: 28px; display: flex; align-items: center; gap: 10px; }
.lang { font-size: 13px; color: var(--muted); }
#lang-select { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; font: inherit; cursor: pointer; }
.auth-button {
  background: transparent;
  color: var(--accent);
  border: 1px solid rgba(237,117,28,.65);
  border-radius: 8px;
  padding: 5px 11px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.auth-button:hover { background: var(--accent-soft); border-color: var(--accent); }
.auth-button.hidden { display: none; }
.llm-badge { font-size: 11px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); }
.llm-badge.on { color: var(--ok); border-color: var(--ok); }
.llm-badge.off { color: var(--muted); }

.stage {
  display: grid; grid-template-columns: 240px 1fr 260px; gap: 16px;
  padding: 16px 20px; height: calc(100vh - 78px);
}
aside, .chat { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; overflow: auto; }
aside h2, .agents h2 { margin: 0 0 14px; font-size: 15px; color: var(--muted); font-weight: 600; letter-spacing: .04em; }

/* 左栏 journey */
.journey ol { list-style: none; margin: 0; padding: 0; }
.journey li { position: relative; padding: 12px 12px 12px 34px; margin-bottom: 6px; border-radius: 10px; color: var(--muted); transition: .3s; }
.journey li::before {
  content: ""; position: absolute; left: 12px; top: 16px; width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--line); background: transparent; transition: .3s;
}
.journey li.active { background: var(--panel-2); color: var(--text); font-weight: 600; }
.journey li.active::before { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.journey li.passed::before { border-color: var(--ok); background: var(--ok); }

/* 中栏 chat */
.chat { display: flex; flex-direction: column; }
.messages { flex: 1; overflow: auto; padding-right: 6px; }
.msg { margin-bottom: 14px; display: flex; }
.msg .bubble { max-width: 82%; padding: 12px 14px; border-radius: 14px; white-space: pre-wrap; }
.msg.user { justify-content: flex-end; }
.msg.user .bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.msg.bot .bubble { background: var(--panel-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg .who { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.src-badge { font-size: 11px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); margin-left: 6px; white-space: nowrap; cursor: default; }
.src-badge.src-model { color: var(--ok); border-color: var(--ok); }
.src-badge.src-rule { color: var(--muted); }
.src-badge.src-fallback { color: var(--alert); border-color: var(--alert); }
.bubble.guardrail { border-color: var(--alert); }
.bubble.handoff { border-color: var(--work); }

.delegation { display: flex; align-items: center; gap: 10px; padding: 10px 14px; color: var(--work); font-size: 14px; }
.delegation.hidden { display: none; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(245,158,66,.28); border-top-color: var(--work); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.composer { display: flex; gap: 10px; margin-top: 10px; }
.composer textarea { flex: 1; resize: none; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 10px; font: inherit; }
.composer button {
  background: var(--primary); color: #fff; border: 1px solid var(--primary);
  border-radius: 10px; padding: 0 22px; font-weight: 700; cursor: pointer; transition: .2s;
}
.composer button:hover { background: var(--primary-hover); border-color: var(--primary-hover); box-shadow: 0 0 14px rgba(59,130,246,.28); }
.composer button:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; background: var(--primary-soft); color: #93b7f4; border-color: rgba(59,130,246,.35); }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.quick button { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer; }
.quick button:hover { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }

/* 右栏 agents */
.agent { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); margin-bottom: 10px; transition: .3s; background: var(--panel-2); }
.agent .avatar { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 20px; background: var(--bg); border: 1px solid var(--line); }
.agent .info { flex: 1; }
.agent .name { font-weight: 700; font-size: 14px; }
.agent .role { font-size: 12px; color: var(--muted); }
.agent .state { width: 10px; height: 10px; border-radius: 50%; background: var(--idle); }
.agent.working { border-color: var(--work); box-shadow: 0 0 0 3px rgba(245,158,66,.12); }
.agent.working .state { background: var(--work); animation: pulse 1s infinite; }
.agent.done { border-color: var(--ok); }
.agent.done .state { background: var(--ok); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

.legend { margin-top: 14px; font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.legend .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 3px; }
.dot.working { background: var(--work); } .dot.done { background: var(--ok); } .dot.idle { background: var(--idle); }
