:root {
  --bg: #f5f6f8; --panel: #ffffff; --line: #e4e7ec; --text: #1f2329;
  --muted: #646a73; --primary: #3370ff; --danger: #d54941; --ok: #00b42a;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }

.login-view { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { background: var(--panel); padding: 32px; border-radius: 12px; width: 320px; box-shadow: 0 8px 30px rgba(0,0,0,.08); display: flex; flex-direction: column; gap: 12px; }
.login-card h1 { margin: 0; font-size: 22px; }
input, select, textarea { padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; width: 100%; }
button { padding: 8px 14px; border: none; border-radius: 6px; background: var(--primary); color: #fff; cursor: pointer; font-size: 14px; }
button.ghost { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
button.danger { background: var(--danger); }
button.small { padding: 4px 10px; font-size: 12px; }
button:disabled { opacity: .5; cursor: not-allowed; }
.error { color: var(--danger); font-size: 13px; }

.app { display: flex; min-height: 100vh; }
.sidebar { width: 200px; background: #1f2329; color: #fff; padding: 16px 0; flex-shrink: 0; }
.brand { padding: 0 20px 20px; font-weight: 600; font-size: 16px; }
#menu a { display: block; padding: 10px 20px; color: #c9cdd4; text-decoration: none; cursor: pointer; }
#menu a:hover { background: #2b3038; }
#menu a.active { background: var(--primary); color: #fff; }
.content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 24px; background: var(--panel); border-bottom: 1px solid var(--line); }
.topbar .spacer { flex: 1; }
#section-title { font-size: 16px; font-weight: 600; }
#section-content { padding: 24px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin-bottom: 16px; }
.panel h3 { margin: 0 0 12px; font-size: 15px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.stat .num { font-size: 26px; font-weight: 700; }
.stat .label { color: var(--muted); font-size: 13px; }
table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: 10px; overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: top; }
th { background: #fafbfc; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: none; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot.on { background: var(--ok); } .dot.off { background: #c9cdd4; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; background: #eef1f5; color: var(--muted); }
.tag.running { background: #e8f3ff; color: var(--primary); }
.tag.done { background: #e8ffea; color: var(--ok); }
.tag.failed { background: #ffece8; color: var(--danger); }
.tag.cancelled { background: #f2f3f5; color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.form-row { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.form-row > * { flex: 1 1 140px; }
pre.log { background: #1f2329; color: #d0d7de; padding: 12px; border-radius: 8px; overflow: auto; font-size: 12px; max-height: 300px; }
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: #1f2329; color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 100; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 90; }
.modal-card { background: var(--panel); border-radius: 12px; padding: 20px; width: min(640px, 92vw); max-height: 80vh; overflow: auto; }
.modal-title { font-weight: 600; margin-bottom: 12px; }
.modal-actions { margin-top: 14px; text-align: right; }
.help pre { background: #f2f3f5; padding: 10px; border-radius: 6px; overflow: auto; }

/* 会话详情消息 */
.msg { margin-bottom: 12px; }
.msg-head { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.msg-body {
  margin: 0;
  padding: 10px;
  background: #f6f8fa;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow: auto;
}
.msg details summary { cursor: pointer; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
