:root {
  --bg: #0b1220;
  --bg-2: #111b2e;
  --panel: #131f34;
  --line: #22314d;
  --text: #e6edf7;
  --muted: #8ea2c0;
  --accent: #4dd4ac;
  --accent-2: #6aa8ff;
  --warn: #f2b544;
  --danger: #ef6b6b;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 600px at 15% -10%, #16304f 0%, transparent 60%),
              radial-gradient(900px 500px at 100% 0%, #1c2a4a 0%, transparent 55%),
              var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 22px; border-bottom: 1px solid var(--line);
  background: rgba(10, 17, 30, .72); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #2f7fd6);
  color: #04121a; font-weight: 800; letter-spacing: .5px;
}
.brand h1 { font-size: 18px; margin: 0; font-weight: 700; letter-spacing: .3px; }
.brand .tag { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 6px; }
.brand .sub { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.badges { display: flex; gap: 8px; flex-wrap: wrap; }
.badge {
  font-size: 12px; padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--muted);
  font-family: ui-monospace, Consolas, monospace;
}
.badge.live { color: var(--accent); border-color: #2c6b5a; }
.badge.hot { color: var(--warn); border-color: #6b552c; }

/* ---------- 布局 ---------- */
.layout {
  flex: 1; display: grid; grid-template-columns: 268px minmax(0, 1fr) 316px;
  gap: 14px; padding: 14px 18px; align-items: start;
}
.panel {
  background: linear-gradient(180deg, rgba(23, 36, 57, .92), rgba(16, 26, 43, .92));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; min-width: 0;
}
.left, .right { position: sticky; top: 78px; max-height: calc(100vh - 98px); overflow: auto; }
.center { display: flex; flex-direction: column; gap: 14px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-head h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); margin: 0 0 10px; }
.panel-head .meta, .meta { font-size: 11px; color: var(--muted); font-family: ui-monospace, Consolas, monospace; }

/* ---------- 左栏 ---------- */
.task-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.task-item {
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; cursor: pointer;
  background: #101a2c; transition: border-color .15s, transform .15s;
}
.task-item:hover { border-color: #33507d; transform: translateX(2px); }
.task-item.active { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(77, 212, 172, .18); }
.task-item .q { font-size: 12.5px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.task-item .row { display: flex; justify-content: space-between; align-items: center; margin-top: 7px; font-size: 11px; color: var(--muted); }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 5px; background: #4a5a75; }
.dot.queued { background: #64748b; }
.dot.running, .dot.planning, .dot.searching, .dot.analyzing, .dot.writing { background: var(--accent-2); animation: pulse 1.2s infinite; }
.dot.done { background: var(--accent); }
.dot.failed { background: var(--danger); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.panel-foot { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 11px; color: var(--muted); line-height: 1.7; }

/* ---------- 中间：输入区 ---------- */
.composer { display: flex; flex-direction: column; gap: 10px; }
textarea, input, select {
  background: #0d1728; color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; font-size: 13.5px; outline: none;
  font-family: inherit; width: 100%;
}
textarea { resize: vertical; line-height: 1.55; }
textarea:focus, input:focus, select:focus { border-color: #3d63a0; box-shadow: 0 0 0 3px rgba(61, 99, 160, .18); }
.composer-row { display: flex; gap: 8px; flex-wrap: wrap; }
.composer-row select { width: auto; flex: 1; min-width: 130px; }
button { font-family: inherit; font-size: 13px; border-radius: 10px; padding: 10px 16px; border: 1px solid var(--line); background: #16233a; color: var(--text); cursor: pointer; }
button:hover { filter: brightness(1.15); }
button:disabled { opacity: .5; cursor: not-allowed; }
.primary { background: linear-gradient(135deg, #2f9d7f, #2b7fd0); border: none; color: #04121a; font-weight: 700; }
.warn { background: linear-gradient(135deg, #8a5f16, #b3801f); border: none; color: #fff4dd; font-weight: 600; }
.ghost { background: transparent; padding: 2px 8px; border: none; color: var(--muted); }
.hint { margin: 0; font-size: 11.5px; color: var(--muted); }
.hint.err { color: var(--danger); }

/* ---------- 时间线 ---------- */
.timeline-head { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.timeline-head h2 { margin: 0; font-size: 15px; }
.pill { font-size: 11px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-family: ui-monospace, monospace; }
.timeline { display: flex; flex-direction: column; gap: 10px; }
.step {
  border: 1px solid var(--line); border-left: 3px solid #33415c; border-radius: 10px;
  padding: 10px 12px; background: #0e1828;
}
.step.running { border-left-color: var(--accent-2); box-shadow: 0 0 18px rgba(106, 168, 255, .08); }
.step.done { border-left-color: var(--accent); }
.step.failed { border-left-color: var(--danger); }
.step-head { display: flex; align-items: center; gap: 8px; }
.step-idx {
  width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center;
  background: #1b2c47; font-size: 11px; color: var(--muted);
}
.step-name { font-weight: 600; font-size: 13px; }
.step-sub { font-size: 11px; color: var(--muted); margin-left: auto; font-family: ui-monospace, monospace; }
.step-body {
  margin-top: 8px; font-size: 12.5px; color: #c3d2e8; white-space: pre-wrap;
  max-height: 190px; overflow: auto; line-height: 1.6;
  font-family: ui-monospace, Consolas, monospace;
}
.step.collapsed .step-body { max-height: 0; display: none; }
.step-toggle { background: transparent; border: none; color: var(--muted); font-size: 11px; padding: 2px 6px; }

/* ---------- 报告 ---------- */
.report-wrap .panel-head { margin-bottom: 6px; }
.report {
  font-size: 13.5px; line-height: 1.85; max-height: 560px; overflow: auto;
  padding-right: 6px;
}
.report.expanded { max-height: none; }
.report h1 { font-size: 19px; margin: 6px 0 10px; }
.report h2 { font-size: 15px; margin: 18px 0 8px; color: #cfe0f7; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.report h3 { font-size: 13.5px; margin: 14px 0 6px; color: var(--accent); }
.report p { margin: 7px 0; }
.report ul, .report ol { margin: 6px 0 10px; padding-left: 22px; }
.report li { margin: 4px 0; }
.report code { background: #0a1424; padding: 1px 5px; border-radius: 5px; font-size: 12px; color: #9fd6c1; }
.report blockquote { margin: 8px 0; padding: 6px 12px; border-left: 3px solid #2c6b5a; color: var(--muted); background: #0d1a28; }
.report table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 12.5px; }
.report th, .report td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.report th { background: #16233a; }
.report hr { border: none; border-top: 1px dashed var(--line); margin: 14px 0; }
.report a { color: var(--accent-2); }

/* ---------- 追问 ---------- */
.fu-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.fu-item { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #0e1828; font-size: 12.5px; }
.fu-item .q { color: var(--accent-2); margin-bottom: 4px; }
.fu-form { display: flex; gap: 8px; }

/* ---------- 右栏 ---------- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.stat { background: #0e1828; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }
.stat .k { font-size: 10.5px; color: var(--muted); letter-spacing: .4px; }
.stat .v { font-size: 15px; font-weight: 700; font-family: ui-monospace, Consolas, monospace; color: var(--accent); }
.hpa-box { margin-bottom: 12px; }
.hpa-label { font-size: 11px; color: var(--muted); margin-bottom: 5px; font-family: ui-monospace, monospace; }
.bar { height: 8px; border-radius: 999px; background: #0a1424; overflow: hidden; border: 1px solid var(--line); }
.bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--warn)); transition: width .4s; }
h3.mini { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 14px 0 7px; }
table.pods { width: 100%; border-collapse: collapse; font-size: 11px; font-family: ui-monospace, monospace; }
table.pods th { text-align: left; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--line); padding: 4px 3px; }
table.pods td { padding: 5px 3px; border-bottom: 1px dashed #1b2941; color: #b9c8de; }
table.pods td:first-child { max-width: 108px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
tr.self td { color: var(--accent); }
.dist { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 10.5px; padding: 3px 8px; border-radius: 999px; background: #0e1828; border: 1px solid var(--line); color: var(--muted); font-family: ui-monospace, monospace; }
.chip b { color: var(--text); }
.empty { color: #5b6c86; font-size: 12px; padding: 10px 0; }

.footer {
  display: flex; justify-content: space-between; gap: 12px; padding: 10px 22px;
  border-top: 1px solid var(--line); font-size: 11px; color: var(--muted);
}
@media (max-width: 1180px) {
  .layout { grid-template-columns: 220px minmax(0, 1fr); }
  .right { display: none; }
}
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .left { position: static; max-height: none; }
}
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #23324c; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }
