:root {
  --bg: #090d14;
  --panel: rgba(17, 24, 37, .82);
  --panel-strong: #111827;
  --line: rgba(148, 163, 184, .14);
  --text: #e5edf8;
  --muted: #8b9ab1;
  --accent: #7dd3fc;
  --accent-2: #a78bfa;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #fb7185;
  --radius: 16px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
.bg {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 520px at 12% -10%, rgba(56, 189, 248, .16), transparent 62%),
    radial-gradient(800px 520px at 92% 0%, rgba(167, 139, 250, .13), transparent 65%),
    radial-gradient(700px 500px at 50% 110%, rgba(52, 211, 153, .06), transparent 70%);
}
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 28px;
  background: rgba(9, 13, 20, .8);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.brand { display: flex; align-items: center; gap: 13px; }
.logo {
  width: 44px; height: 44px; border-radius: 14px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 21px; color: #071018;
  background: linear-gradient(145deg, #7dd3fc, #a78bfa);
  box-shadow: 0 0 32px rgba(125, 211, 252, .28);
}
h1 { margin: 0; font-size: 18px; letter-spacing: .2px; }
.sub { margin: 3px 0 0; font-size: 11px; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
main { padding: 22px 28px 60px; max-width: 1500px; margin: 0 auto; }
.card {
  background: linear-gradient(180deg, rgba(20, 29, 45, .9), rgba(13, 19, 30, .88));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .22);
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
h2 { font-size: 14px; margin: 0; font-weight: 650; letter-spacing: .2px; }
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat { padding: 16px; min-height: 106px; display: flex; flex-direction: column; gap: 5px; }
.stat .label { font-size: 11px; color: var(--muted); letter-spacing: .6px; }
.stat strong { font-size: 26px; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.stat .hint { font-size: 11px; color: var(--muted); }
.grid { display: grid; gap: 14px; margin-bottom: 14px; }
.grid.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  border: 1px solid var(--line); background: rgba(148, 163, 184, .08); color: var(--muted);
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; }
.pill.awake { color: var(--green); background: rgba(52, 211, 153, .09); border-color: rgba(52, 211, 153, .25); }
.pill.asleep { color: var(--amber); background: rgba(251, 191, 36, .08); border-color: rgba(251, 191, 36, .25); }
.pill.bad { color: var(--red); background: rgba(251, 113, 133, .08); border-color: rgba(251, 113, 133, .25); }
.muted { color: var(--muted); font-size: 12px; }
.small { font-size: 11px; line-height: 1.5; }
.sysline { display: flex; flex-wrap: wrap; gap: 12px 20px; padding: 10px 0 14px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.sysline b { color: var(--text); font-weight: 600; }
.process-list { display: grid; gap: 7px; margin-top: 14px; }
.process {
  display: grid; grid-template-columns: 12px 1fr auto auto; gap: 10px; align-items: center;
  padding: 9px 10px; border-radius: 10px; background: rgba(148, 163, 184, .04);
  font-size: 12px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.dot.on { background: var(--green); box-shadow: 0 0 8px rgba(52, 211, 153, .6); }
.process .name { font-family: var(--mono); font-size: 11px; }
.process .meta { color: var(--muted); font-family: var(--mono); font-size: 10px; }
.control-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 12px; }
button {
  border: 0; border-radius: 10px; padding: 9px 14px; cursor: pointer;
  font: inherit; font-size: 12px; font-weight: 600;
  background: rgba(148, 163, 184, .12); color: var(--text);
  transition: transform .12s ease, filter .12s ease, background .12s ease;
}
button:hover { filter: brightness(1.12); transform: translateY(-1px); }
button:active { transform: translateY(0); }
button.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
button.primary { background: linear-gradient(135deg, #38bdf8, #818cf8); color: #06101a; }
button.warn { background: rgba(251, 191, 36, .16); color: #fde68a; border: 1px solid rgba(251, 191, 36, .25); }
button.danger { background: rgba(251, 113, 133, .13); color: #fecdd3; border: 1px solid rgba(251, 113, 133, .22); }
button.on { background: rgba(52, 211, 153, .14); color: #a7f3d0; border: 1px solid rgba(52, 211, 153, .28); }
button.off { background: rgba(100, 116, 139, .12); color: var(--muted); border: 1px solid var(--line); }
button:disabled { opacity: .45; cursor: not-allowed; }
.field { display: block; font-size: 11px; color: var(--muted); margin-bottom: 10px; }
select, input {
  width: 100%; margin-top: 6px; padding: 10px 11px;
  border-radius: 10px; border: 1px solid var(--line);
  background: rgba(2, 6, 23, .45); color: var(--text);
  font: inherit; font-size: 12px; outline: none;
}
select:focus, input:focus { border-color: rgba(125, 211, 252, .45); box-shadow: 0 0 0 3px rgba(125, 211, 252, .08); }
select.mini { width: auto; min-width: 130px; margin: 0; padding: 7px 9px; }
.features { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.features button { padding: 7px 11px; font-size: 11px; }
.chart { display: flex; align-items: end; gap: 5px; height: 190px; padding-top: 10px; overflow-x: auto; }
.bar-wrap { flex: 1; min-width: 22px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; }
.bar { width: 100%; max-width: 26px; border-radius: 5px 5px 2px 2px; background: linear-gradient(180deg, #7dd3fc, #6366f1); min-height: 2px; position: relative; }
.bar.replies { background: linear-gradient(180deg, #34d399, #0f766e); }
.bar:hover { filter: brightness(1.2); }
.bar-label { font-size: 9px; color: var(--muted); font-family: var(--mono); }
.chat-list { max-height: 520px; overflow: auto; display: flex; flex-direction: column; gap: 8px; padding-right: 4px; }
.chat-item { padding: 9px 11px; border-radius: 10px; background: rgba(148, 163, 184, .045); border-left: 2px solid transparent; }
.chat-item.master { border-left-color: var(--amber); background: rgba(251, 191, 36, .045); }
.chat-item.bot { border-left-color: var(--accent); background: rgba(125, 211, 252, .045); }
.chat-head { display: flex; justify-content: space-between; gap: 8px; font-size: 10px; color: var(--muted); margin-bottom: 4px; }
.chat-name { color: var(--text); font-weight: 600; }
.chat-content { font-size: 12px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.decision-list { display: flex; flex-direction: column; gap: 6px; max-height: 520px; overflow: auto; padding-right: 4px; }
.decision { display: grid; grid-template-columns: 54px 1fr auto; gap: 8px; padding: 8px 10px; border-radius: 9px; background: rgba(148, 163, 184, .035); font-size: 11px; }
.decision .msg { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.decision .time { color: var(--muted); font-family: var(--mono); font-size: 10px; }
.route { padding: 2px 7px; border-radius: 999px; font-size: 9px; font-weight: 700; letter-spacing: .4px; }
.route.main { color: #bae6fd; background: rgba(56, 189, 248, .13); }
.route.satellite { color: #ddd6fe; background: rgba(167, 139, 250, .13); }
.route.ignore { color: var(--muted); background: rgba(148, 163, 184, .1); }
.route.finance { color: #fde68a; background: rgba(251, 191, 36, .12); }
.route.admin, .route.control { color: #a7f3d0; background: rgba(52, 211, 153, .1); }
.route.sticker_repeat { color: #fecdd3; background: rgba(251, 113, 133, .1); }
.route.person { color: #fde68a; background: rgba(251, 191, 36, .13); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.kb-row, .memory-row, .req-row { padding: 10px 12px; border-radius: 10px; background: rgba(148, 163, 184, .04); font-size: 12px; line-height: 1.55; }
.kb-head, .memory-head { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.tag { font-size: 9px; padding: 2px 6px; border-radius: 999px; background: rgba(125, 211, 252, .1); color: #bae6fd; }
.requirements { display: grid; gap: 8px; }
.req-row { display: flex; gap: 10px; align-items: start; }
.req-id { font-family: var(--mono); color: var(--muted); font-size: 10px; padding-top: 2px; }
.error { color: var(--red); font-size: 11px; min-height: 14px; }
.toast {
  position: fixed; right: 24px; bottom: 24px; z-index: 30;
  padding: 12px 16px; border-radius: 12px; background: #111827;
  border: 1px solid var(--line); font-size: 12px;
  opacity: 0; transform: translateY(8px); transition: .2s ease; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.login {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center;
  background: rgba(2, 6, 23, .72); backdrop-filter: blur(8px);
}
.login.hidden { display: none; }
.login-card { width: min(420px, calc(100vw - 40px)); display: flex; flex-direction: column; gap: 12px; }
.login-card h2 { font-size: 16px; }
code { font-family: var(--mono); color: #bae6fd; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, .2); border-radius: 999px; }
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.two { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  main { padding: 16px 14px 40px; }
  .topbar { padding: 14px 16px; flex-direction: column; align-items: flex-start; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  h1 { font-size: 16px; }
}
.meter { height: 5px; border-radius: 999px; background: rgba(148, 163, 184, .15); overflow: hidden; margin: 3px 0 2px; }
.meter i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #38bdf8, #818cf8); transition: width .35s ease; }
.meter i.warn { background: linear-gradient(90deg, #fbbf24, #fb923c); }
.meter i.over { background: linear-gradient(90deg, #fb7185, #ef4444); }
.decision-main { min-width: 0; }
.decision .msg { max-width: 100%; }
.decision-meta { color: var(--muted); font-size: 9px; margin-top: 3px; font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.workflow { display: flex; flex-direction: column; gap: 9px; }
.flow { border: 1px solid var(--line); border-radius: 12px; background: rgba(148, 163, 184, .03); overflow: hidden; }
.flow summary { list-style: none; display: grid; grid-template-columns: 48px 92px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; cursor: pointer; }
.flow summary::-webkit-details-marker { display: none; }
.flow summary:hover { background: rgba(148, 163, 184, .05); }
.flow-time { font-family: var(--mono); font-size: 10px; color: var(--muted); }
.flow-name { font-size: 11px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow-msg { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow-stages { display: flex; flex-direction: column; gap: 7px; padding: 0 12px 12px; }
.flow-stage { display: grid; grid-template-columns: 112px 1fr; gap: 10px; padding: 8px 10px; border-radius: 9px; background: rgba(2, 6, 23, .3); border-left: 2px solid rgba(148, 163, 184, .25); }
.flow-stage.gate { border-left-color: var(--muted); }
.flow-stage.judge { border-left-color: var(--amber); }
.flow-stage.sub { border-left-color: var(--accent-2); }
.flow-stage.main { border-left-color: var(--accent); }
.flow-stage.satellite { border-left-color: #c084fc; }
.flow-stage.person { border-left-color: var(--amber); }
.flow-stage.task { border-left-color: #fbbf24; }
.flow-stage.tools { border-left-color: var(--green); }
.flow-stage.result { border-left-color: #34d399; }
.flow-title { font-size: 10px; color: var(--muted); font-weight: 600; padding-top: 2px; }
.flow-body { font-size: 11px; line-height: 1.6; min-width: 0; }
.flow-line { margin-bottom: 2px; }
.flow-k { color: var(--muted); font-size: 10px; }
.flow-quote { color: var(--text); background: rgba(125, 211, 252, .06); border-radius: 7px; padding: 5px 8px; margin: 4px 0; white-space: pre-wrap; word-break: break-word; }
.flow-item { margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.chip { font-size: 9px; padding: 2px 6px; border-radius: 999px; background: rgba(148, 163, 184, .1); color: var(--muted); }
.warn-text { color: var(--amber); font-weight: 600; }
.flow pre { margin: 5px 0 0; white-space: pre-wrap; word-break: break-word; font-family: var(--mono); font-size: 10px; color: var(--muted); max-height: 160px; overflow: auto; }
.flow details summary { cursor: pointer; color: var(--muted); font-size: 10px; padding: 2px 0; }
@media (max-width: 680px) {
  .flow summary { grid-template-columns: 40px 1fr auto; }
  .flow-msg { display: none; }
  .flow-stage { grid-template-columns: 1fr; gap: 2px; }
}
.kb-controls { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.kb-controls input, .kb-controls select { margin: 0; width: auto; flex: 1; min-width: 150px; }
.kb-controls select { flex: 0 0 auto; min-width: 110px; }
.kb-controls button { flex: 0 0 auto; }
.kb-list { display: flex; flex-direction: column; gap: 7px; max-height: 560px; overflow: auto; padding-right: 4px; }
.kb-entry { border: 1px solid var(--line); border-radius: 10px; background: rgba(148, 163, 184, .03); overflow: hidden; }
.kb-entry summary { list-style: none; display: grid; grid-template-columns: 42px 1fr; gap: 8px; padding: 9px 11px; cursor: pointer; align-items: center; }
.kb-entry summary::-webkit-details-marker { display: none; }
.kb-entry summary:hover { background: rgba(148, 163, 184, .05); }
.kb-query { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-meta { grid-column: 2; font-size: 9px; color: var(--muted); font-family: var(--mono); }
.tag.ok { color: #a7f3d0; background: rgba(52, 211, 153, .12); }
.tag.stale { color: #fecdd3; background: rgba(251, 113, 133, .12); }
.kb-detail { padding: 0 12px 11px; }
.kb-summary { font-size: 11px; line-height: 1.65; color: var(--muted); white-space: pre-wrap; word-break: break-word; background: rgba(2, 6, 23, .3); border-radius: 8px; padding: 8px 10px; }
.kb-sources { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.kb-source { font-size: 10px; color: #bae6fd; text-decoration: none; background: rgba(125, 211, 252, .08); border-radius: 5px; padding: 3px 6px; }
.kb-source:hover { text-decoration: underline; }
.kb-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; }
.kb-del { padding: 4px 9px; font-size: 10px; background: rgba(251, 113, 133, .12); color: #fecdd3; border: 1px solid rgba(251, 113, 133, .2); }
@media (max-width: 680px) {
  .kb-controls input { flex-basis: 100%; }
  .kb-controls select, .kb-controls button { flex: 1; }
}
.people-add { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.people-add input { margin: 0; width: auto; flex: 1; min-width: 130px; }
.people-add button { flex: 0 0 auto; }
.people-list { display: flex; flex-direction: column; gap: 7px; }
.person-entry { border: 1px solid var(--line); border-radius: 10px; background: rgba(148, 163, 184, .03); overflow: hidden; }
.person-entry summary { list-style: none; display: grid; grid-template-columns: minmax(80px, 1fr) 92px auto auto; gap: 9px; align-items: center; padding: 9px 11px; cursor: pointer; }
.person-entry summary::-webkit-details-marker { display: none; }
.person-name { font-size: 12px; font-weight: 650; }
.person-qq { font-family: var(--mono); font-size: 10px; color: var(--muted); }
.person-meta { font-size: 9px; color: var(--muted); }
.person-del { padding: 3px 8px; font-size: 9px; }
.person-detail { padding: 0 12px 11px; }
.person-impression { font-size: 11px; line-height: 1.65; color: var(--muted); white-space: pre-wrap; background: rgba(2, 6, 23, .3); border-radius: 8px; padding: 8px 10px; }
.person-context { font-size: 10px; line-height: 1.55; padding: 5px 0; border-bottom: 1px dashed rgba(148, 163, 184, .1); }
.person-reply { color: var(--accent); margin-top: 2px; }
@media (max-width: 680px) {
  .person-entry summary { grid-template-columns: 1fr auto; }
  .person-qq, .person-meta { grid-column: 1; }
  .person-del { grid-column: 2; grid-row: 1; }
}
.private-list { display: flex; flex-direction: column; gap: 7px; max-height: 420px; overflow: auto; padding-right: 4px; }
.private-item { border-radius: 9px; background: rgba(148, 163, 184, .035); border-left: 2px solid var(--amber); padding: 8px 10px; }
.private-item.sat { border-left-color: var(--accent-2); }
.private-head { display: flex; justify-content: space-between; gap: 8px; font-size: 9px; color: var(--muted); margin-bottom: 4px; }
.private-text { font-size: 11px; line-height: 1.55; }
.private-reply { font-size: 11px; line-height: 1.55; color: var(--accent); margin-top: 2px; }
.task-list { display: flex; flex-direction: column; gap: 7px; max-height: 420px; overflow: auto; padding-right: 4px; }
.task-item { padding: 8px 10px; border-radius: 9px; background: rgba(148, 163, 184, .035); border-left: 2px solid var(--muted); }
.task-item.queued { border-left-color: var(--amber); }
.task-item.executed { border-left-color: var(--green); }
.task-item.rejected, .task-item.skipped, .task-item.failed, .task-item.cancelled { border-left-color: var(--red); }
.task-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 10px; color: var(--muted); }
.task-text { font-size: 11px; line-height: 1.55; margin-top: 4px; }
.task-meta { font-size: 9px; color: var(--muted); margin-top: 3px; }
.route.task { color: #fde68a; background: rgba(251, 191, 36, .13); }
.sticker-add { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.sticker-add input[type="file"] { flex: 0 0 auto; max-width: 220px; margin: 0; }
.sticker-add input[type="text"], .sticker-add input:not([type]) { margin: 0; width: auto; flex: 1; min-width: 120px; }
.sticker-add button { flex: 0 0 auto; }
.sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.sticker-item { border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: rgba(148, 163, 184, .035); display: flex; flex-direction: column; gap: 5px; }
.sticker-item img { width: 100%; height: 110px; object-fit: contain; border-radius: 7px; background: rgba(2, 6, 23, .35); }
.sticker-name { font-size: 11px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sticker-tags { display: flex; flex-wrap: wrap; gap: 3px; min-height: 16px; }
.sticker-item .kb-del { align-self: flex-start; padding: 3px 7px; font-size: 9px; }
