:root {
  --bg: #f5f6f8; --panel: #ffffff; --text: #1d2330; --muted: #6b7385; --line: #e3e6ec;
  --brand: #1f5eff; --brand-weak: #e8eeff; --ok: #12805c; --ok-weak: #e3f5ee; --warn: #b26a00; --warn-weak: #fdf2e0;
  --bad: #c62828; --bad-weak: #fdecec; --side: #111826; --side-text: #c9d1e0; --side-active: #1f2a40;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f131a; --panel: #171c25; --text: #e6e9ef; --muted: #9099ab; --line: #2a313e;
    --brand: #5b8cff; --brand-weak: #1d2a47; --ok-weak: #11352a; --warn-weak: #3a2c12; --bad-weak: #3d1c1c;
    --side: #0b0f15; --side-active: #1a2333; --shadow: none; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif; }
a { color: var(--brand); text-decoration: none; cursor: pointer; }
h1 { font-size: 20px; margin: 0 0 16px; } h2 { font-size: 16px; margin: 20px 0 10px; } h3 { font-size: 14px; margin: 14px 0 6px; }
.layout { display: flex; min-height: 100vh; }
.side { width: 200px; background: var(--side); color: var(--side-text); flex-shrink: 0; padding: 14px 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .logo { color: #fff; font-weight: 700; font-size: 15px; padding: 4px 18px 14px; }
.side .logo small { display: block; font-weight: 400; color: var(--side-text); font-size: 12px; }
.side a { display: block; color: var(--side-text); padding: 8px 18px; font-size: 13.5px; }
.side a.on, .side a:hover { background: var(--side-active); color: #fff; }
.side .grp { font-size: 11px; color: #6c7790; padding: 12px 18px 4px; letter-spacing: .05em; }
.main { flex: 1; min-width: 0; }
.top { display: flex; align-items: center; gap: 12px; padding: 10px 24px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top .sp { flex: 1; }
.btn.menu-btn { display: none; }
.content { padding: 20px 24px 60px; max-width: 1280px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; }
.grid { display: grid; gap: 14px; } .g2 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat b { display: block; font-size: 24px; } .stat span { color: var(--muted); font-size: 12.5px; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--text);
  padding: 6px 14px; border-radius: 8px; cursor: pointer; font-size: 13.5px; white-space: nowrap; }
.btn:hover { border-color: var(--brand); } .btn.pri { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.danger { color: var(--bad); } .btn.sm { padding: 3px 9px; font-size: 12.5px; } .btn:disabled { opacity: .55; cursor: wait; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
input, select, textarea { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; width: 100%; }
textarea { min-height: 90px; resize: vertical; }
label { display: block; font-size: 12.5px; color: var(--muted); margin: 8px 0 4px; }
.form .row > div { flex: 1; min-width: 160px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; background: var(--bg); position: sticky; top: 0; }
tr:hover td { background: var(--bg); }
.tbl { overflow-x: auto; max-height: 70vh; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; background: var(--brand-weak); color: var(--brand); margin: 1px 2px; }
.tag.ok { background: var(--ok-weak); color: var(--ok); } .tag.warn { background: var(--warn-weak); color: var(--warn); }
.tag.bad { background: var(--bad-weak); color: var(--bad); } .tag.mute { background: var(--bg); color: var(--muted); }
.muted { color: var(--muted); } .small { font-size: 12.5px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs a { padding: 8px 12px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--brand); border-color: var(--brand); }
.frames { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.frames figure { margin: 0; cursor: pointer; } .frames img { width: 100%; border-radius: 6px; display: block; background: #000; aspect-ratio: 9/16; object-fit: cover; }
.frames figcaption { font-size: 12px; color: var(--muted); }
.player { width: 100%; max-height: 60vh; background: #000; border-radius: 8px; }
.tline { padding: 6px 8px; border-radius: 6px; cursor: pointer; display: flex; gap: 10px; }
.tline:hover { background: var(--brand-weak); } .tline .t { color: var(--brand); font-variant-numeric: tabular-nums; min-width: 64px; }
.chat { display: grid; grid-template-columns: 220px 1fr; gap: 14px; height: calc(100vh - 140px); }
.chat .list { overflow-y: auto; } .chat .list a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--text); font-size: 13px; }
.chat .list a.on { background: var(--brand-weak); }
.chat .box { display: flex; flex-direction: column; min-height: 0; }
.msgs { flex: 1; overflow-y: auto; padding: 4px; }
.msg { margin: 10px 0; max-width: 92%; } .msg.user { margin-left: auto; background: var(--brand); color: #fff; padding: 8px 12px; border-radius: 12px 12px 2px 12px; width: fit-content; }
.msg.assistant { background: var(--panel); border: 1px solid var(--line); padding: 10px 14px; border-radius: 12px 12px 12px 2px; }
.msg .tools { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.md table { margin: 8px 0; } .md p { margin: 6px 0; } .md ul, .md ol { padding-left: 20px; margin: 6px 0; }
.md code { background: var(--bg); padding: 1px 5px; border-radius: 4px; } .md pre { background: var(--bg); padding: 10px; border-radius: 8px; overflow-x: auto; }
.prompter { position: fixed; inset: 0; background: #000; color: #fff; z-index: 50; display: flex; flex-direction: column; }
.prompter .txt { flex: 1; overflow: hidden; font-size: 44px; line-height: 1.6; padding: 30vh 8vw; white-space: pre-wrap; }
.prompter .bar { display: flex; gap: 10px; padding: 12px; background: #111; flex-wrap: wrap; }
.prompter .bar .btn { background: #222; color: #fff; border-color: #333; }
.modal { position: fixed; inset: 0; background: rgba(10,14,22,.5); display: flex; align-items: flex-start; justify-content: center; z-index: 40; padding: 6vh 16px; overflow-y: auto; }
.modal.hidden { display: none; } .modal-box { background: var(--panel); border-radius: 12px; padding: 20px; width: 100%; max-width: 640px; }
#toast { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 60; }
#toast div { background: #1d2330; color: #fff; padding: 9px 16px; border-radius: 8px; margin-bottom: 8px; font-size: 13.5px; max-width: 90vw; }
#toast div.err { background: var(--bad); }
.login { max-width: 380px; margin: 12vh auto; }
.bar-chart div { display: flex; align-items: center; gap: 8px; font-size: 12.5px; margin: 3px 0; }
.bar-chart i { display: block; height: 10px; background: var(--brand); border-radius: 3px; }
.steps span { font-size: 12px; margin-right: 6px; white-space: nowrap; display: inline-block; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: 13.5px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; }
.empty { color: var(--muted); padding: 24px; text-align: center; }
.badge { background: var(--bad); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 6px; margin-left: 4px; }
pre.json { white-space: pre-wrap; font-size: 12px; background: var(--bg); padding: 10px; border-radius: 8px; max-height: 400px; overflow: auto; }
@media (max-width: 860px) {
  .side { position: fixed; left: -220px; z-index: 30; transition: left .2s; } .side.open { left: 0; }
  .btn.menu-btn { display: inline-flex; } .content { padding: 14px 14px 60px; } .top { padding: 10px 14px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr 1fr; } .chat { grid-template-columns: 1fr; height: auto; } .chat .list { max-height: 160px; }
  .msgs { min-height: 50vh; } .prompter .txt { font-size: 30px; }
}
@media (max-width: 520px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }
