:root {
  --bg: #0b1020;
  --bg-2: #11182e;
  --panel: #151d36;
  --panel-2: #1b2542;
  --line: #26304f;
  --text: #e6ecff;
  --muted: #93a0c4;
  --accent: #5b8cff;
  --accent-2: #36d399;
  --warn: #f4b740;
  --bad: #ff6b6b;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card {
  width: 340px; max-width: 92vw; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 28px 26px; box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.login-card .brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.login-card h1 { font-size: 20px; margin: 0; }
.login-card .sub { color: var(--muted); margin: 0 0 18px; font-size: 12.5px; }
.login-card label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 6px; }
.login-card input {
  width: 100%; padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 8px; color: var(--text); outline: none;
}
.login-card input:focus { border-color: var(--accent); }
.login-card button#login-btn {
  width: 100%; margin-top: 18px; padding: 11px; border: 0; border-radius: 8px;
  background: var(--accent); color: #fff; font-weight: 600; font-size: 15px;
}
.login-card button#login-btn:disabled { opacity: .6; }
.login-card .err { color: var(--bad); font-size: 12.5px; margin-top: 10px; min-height: 16px; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 12px var(--accent-2); }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 210px; flex: 0 0 210px; background: var(--bg-2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 14px;
}
.sidebar .brand.sm { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 16px; margin-bottom: 22px; }
.nav { display: flex; flex-direction: column; gap: 6px; }
.nav-item {
  text-align: left; padding: 11px 14px; background: transparent; border: 1px solid transparent;
  border-radius: 9px; color: var(--muted); font-size: 14px; transition: .15s;
}
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.active { background: var(--panel-2); color: var(--text); border-color: var(--line); }
.side-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; padding-top: 14px; border-top: 1px solid var(--line); }
.side-foot .who { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main-col { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; border-bottom: 1px solid var(--line); background: var(--bg-2);
}
.view-title { font-size: 16px; font-weight: 700; }
.container { padding: 20px 22px; overflow-y: auto; flex: 1; }

.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); border-radius: 8px; padding: 8px 13px; }
.ghost:hover { color: var(--text); border-color: var(--accent); }
.badge { font-size: 11.5px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 3px 10px; }

/* ---------- 选题视图 ---------- */
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tabs { display: flex; gap: 6px; }
.tab { background: var(--panel); border: 1px solid var(--line); color: var(--muted); border-radius: 8px; padding: 8px 16px; }
.tab.active { background: var(--panel-2); color: var(--text); border-color: var(--accent); }
.add-row { display: flex; gap: 10px; margin: 16px 0 10px; flex-wrap: wrap; }
.add-row select, .add-row input {
  padding: 9px 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; color: var(--text); outline: none;
}
.add-row select { min-width: 120px; }
.add-row input { flex: 1; min-width: 200px; }
.add-row button { background: var(--accent); border: 0; color: #fff; border-radius: 8px; padding: 0 18px; font-weight: 600; }
.hint-bar { font-size: 12.5px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 9px 13px; margin-bottom: 14px; }
.hint-bar b { color: var(--warn); }

.topics-list { display: flex; flex-direction: column; gap: 10px; }
.topic-card {
  display: flex; align-items: center; gap: 14px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 13px 16px; flex-wrap: wrap;
}
.topic-main { flex: 1; min-width: 240px; }
.topic-title { font-size: 15px; font-weight: 600; }
.topic-meta { display: flex; gap: 8px; align-items: center; margin-top: 7px; flex-wrap: wrap; }
.topic-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.topic-actions button { border: 0; border-radius: 8px; padding: 8px 14px; font-weight: 600; font-size: 13px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-ok { background: var(--accent-2); color: #04210f; }
.btn-warn { background: var(--warn); color: #2a1c00; }
.btn-mut { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line) !important; }
.btn-danger { background: transparent; color: var(--bad); border: 1px solid var(--bad) !important; }
.topic-actions button:disabled { opacity: .6; cursor: default; }

.tag { font-size: 11px; color: var(--muted); background: var(--bg-2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; }
.st-pending { color: var(--muted); background: var(--bg-2); border: 1px solid var(--line); }
.st-selected { color: var(--accent); background: rgba(91,140,255,.12); border: 1px solid rgba(91,140,255,.4); }
.st-writing { color: var(--warn); background: rgba(244,183,64,.12); border: 1px solid rgba(244,183,64,.4); }
.st-written { color: var(--accent-2); background: rgba(54,211,153,.12); border: 1px solid rgba(54,211,153,.4); }
.st-generating { color: #c08bff; background: rgba(192,139,255,.12); border: 1px solid rgba(192,139,255,.4); }
.st-dropped { color: var(--muted); background: var(--bg-2); border: 1px dashed var(--line); }
.cmp-ok { color: var(--accent-2); background: rgba(54,211,153,.12); border: 1px solid rgba(54,211,153,.4); }
.cmp-bad { color: var(--bad); background: rgba(255,107,107,.12); border: 1px solid rgba(255,107,107,.4); }
.cmp-mut { color: var(--muted); background: var(--bg-2); border: 1px solid var(--line); }

.empty { color: var(--muted); text-align: center; padding: 30px 10px; font-size: 13px; }

/* ---------- 运行视图 ---------- */
.runs-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.runs-head h2 { font-size: 16px; margin: 0; }
.runs-list { display: flex; flex-direction: column; gap: 10px; }
.run-item { display: flex; align-items: center; gap: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 13px 16px; cursor: pointer; transition: .15s; }
.run-item:hover { border-color: var(--accent); }
.run-main { flex: 1; min-width: 200px; }
.run-title { font-weight: 600; }
.run-sub { display: flex; gap: 10px; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.run-right { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; min-width: 150px; }
.status { font-size: 12px; padding: 3px 10px; border-radius: 20px; }
.progress { width: 140px; height: 6px; background: var(--bg-2); border-radius: 4px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .4s; }

/* ---------- 日志视图 ---------- */
.logs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.card h3 { margin: 0 0 12px; font-size: 14px; }
.hot-card { grid-column: 1 / -1; }
.net-list { display: flex; flex-direction: column; gap: 10px; }
.net-row { display: flex; align-items: center; gap: 10px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; flex-wrap: wrap; }
.net-row .dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px; }
.net-row.on .dot { background: var(--accent-2); box-shadow: 0 0 8px var(--accent-2); }
.net-row.off .dot { background: var(--bad); box-shadow: 0 0 8px var(--bad); }
.net-meta { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.net-meta b { font-size: 13.5px; }
.net-meta small { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.net-state { font-size: 12px; font-weight: 600; }
.net-row.on .net-state { color: var(--accent-2); }
.net-row.off .net-state { color: var(--bad); }
.net-err { flex-basis: 100%; color: var(--bad); font-size: 11px; }
.pipe-list, .hot-list { display: flex; flex-direction: column; gap: 10px; }
.pipe-row { background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 11px 13px; }
.pipe-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pipe-top b { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pipe-step { color: var(--muted); font-size: 12px; margin: 6px 0 8px; }
.hot-row { display: flex; align-items: center; gap: 10px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; flex-wrap: wrap; }
.hot-title { flex: 1; min-width: 200px; font-size: 13.5px; }

/* ---------- 弹层 ---------- */
.modal { position: fixed; inset: 0; background: rgba(3,6,15,.72); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal-card { width: 760px; max-width: 96vw; max-height: 90vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px; position: relative; }
.modal-close { position: absolute; top: 12px; right: 14px; background: transparent; border: 0; color: var(--muted); font-size: 26px; line-height: 1; }
.run-title-lg { margin: 0 0 6px; font-size: 19px; }
.run-sum { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.run-actions { display: flex; gap: 10px; margin-bottom: 14px; }
.run-actions button { border: 0; border-radius: 8px; padding: 9px 18px; font-weight: 600; }
.body-md { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 16px; }
.body-md h2, .body-md h3 { color: var(--accent); margin: 12px 0 6px; }
.body-md p { margin: 6px 0; }
.body-md ul { margin: 6px 0; padding-left: 20px; }
.body-md blockquote { border-left: 3px solid var(--warn); margin: 8px 0; padding: 4px 12px; color: var(--warn); background: rgba(244,183,64,.06); }
.sub-h { color: var(--accent); font-size: 14px; font-weight: 700; margin: 18px 0 8px; }
.body-md.expanded { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(56,189,248,.15); }
.drafts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.draft-row { display: flex; align-items: center; gap: 8px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.draft-title { color: var(--text); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comic { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.panel { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.panel-cap { font-size: 12.5px; padding: 8px 10px; color: var(--muted); border-bottom: 1px solid var(--line); }
.panel-img { width: 100%; display: block; background: #0a0f1e; min-height: 140px; object-fit: cover; }
.panel-dialogues { padding: 10px; display: flex; flex-direction: column; gap: 7px; }
.bubble { border-radius: 10px; padding: 7px 10px; font-size: 12.5px; }
.bubble .who { display: block; font-weight: 700; font-size: 11.5px; margin-bottom: 2px; }
.bubble.officer { background: rgba(91,140,255,.14); }
.bubble.worker { background: rgba(54,211,153,.12); }
.bubble.neutral { background: var(--panel-2); }
.tips { margin-top: 16px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; }
.tips .tt { color: var(--accent-2); font-weight: 600; margin-bottom: 6px; font-size: 13px; }
.tips ul { margin: 0; padding-left: 20px; }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 10px 18px; z-index: 80; box-shadow: 0 10px 30px rgba(0,0,0,.4); }

/* ---------- 响应式 ---------- */
@media (max-width: 820px) {
  .sidebar { width: 64px; flex-basis: 64px; padding: 14px 8px; }
  .sidebar .brand.sm span, .nav-item { font-size: 0; }
  .nav-item::first-letter { font-size: 18px; }
  .side-foot .who { display: none; }
  .logs-grid { grid-template-columns: 1fr; }
  .container { padding: 16px 14px; }
}
