:root {
  color-scheme: light dark;
  --background: light-dark(#f4f7fb, #08101d);
  --surface: light-dark(#ffffff, #0d1828);
  --surface-soft: light-dark(#f7f9fc, #091321);
  --ink: light-dark(#122033, #eef5ff);
  --muted: light-dark(#68788d, #9cacc0);
  --line: light-dark(#dce4ee, #23334a);
  --blue: #1768e5;
  --green: #08a777;
  --amber: #e0a52d;
  --red: #dc5e51;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--background); color: var(--ink); font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif; }
button, select { font: inherit; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 24px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; color: white; background: var(--blue); font-weight: 900; }
h1 { margin: 0; font-size: 18px; }
.brand p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 9px; }
.top-actions label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.top-actions select, .top-actions button, .top-actions a { border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; background: var(--surface-soft); color: var(--ink); text-decoration: none; cursor: pointer; }
.top-actions button { color: white; background: var(--blue); border-color: var(--blue); font-weight: 700; }
.connection { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.connection i { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); }
.connection.live { color: var(--green); }
.connection.live i { background: var(--green); box-shadow: 0 0 0 5px #08a77720; animation: pulse 1.4s infinite; }
.connection.failed { color: var(--red); }
.connection.failed i { background: var(--red); }
main { width: min(1500px, calc(100% - 32px)); margin: 22px auto 50px; }
.summary { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 17px; }
.summary > div:first-child { display: flex; align-items: baseline; gap: 10px; }
.summary strong { font-size: clamp(36px, 5vw, 58px); letter-spacing: -.05em; }
.summary span { color: var(--muted); }
.current-rule { text-align: right; max-width: 540px; }
.current-rule b { display: block; margin-bottom: 5px; }
.current-rule span { font-size: 12px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .7fr); gap: 16px; }
.surface, .gate-section, .progress-section { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
.surface-head, .section-title { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 17px; }
.surface-head b, .section-title b { font-size: 14px; }
.surface-head small, .section-title small { color: var(--muted); }
.flow { padding: 0 18px 14px; min-height: 245px; }
.flow-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) 105px; align-items: center; gap: 12px; min-height: 42px; }
.flow-label { font-size: 12px; color: var(--muted); }
.bar-track { height: 18px; background: var(--surface-soft); border-radius: 5px; overflow: hidden; }
.bar-track i { display: block; height: 100%; min-width: 3px; width: 0; background: #7099d1; border-radius: 5px; transition: width .55s ease, background .25s ease; }
.flow-row.done .bar-track i { background: var(--green); }
.flow-row.active .bar-track i { background: var(--blue); box-shadow: 0 0 16px #1768e580; }
.flow-count { text-align: right; font-variant-numeric: tabular-nums; }
.flow-count b { font-size: 13px; }
.flow-count em { display: block; min-height: 13px; color: var(--red); font-size: 10px; font-style: normal; }
.particles-wrap { padding: 14px 17px 17px; border-top: 1px solid var(--line); }
.particles-wrap > div { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; font-size: 11px; color: var(--muted); }
#particles { display: block; width: 100%; height: 145px; border-radius: 10px; background: var(--surface-soft); }
.timeline { padding: 7px; max-height: 455px; overflow: auto; }
.timeline-row { width: 100%; display: grid; grid-template-columns: 24px minmax(0,1fr) auto; gap: 9px; align-items: center; border: 0; border-radius: 9px; padding: 10px; color: var(--ink); background: transparent; text-align: left; cursor: pointer; }
.timeline-row:hover, .timeline-row.active { background: light-dark(#e9f1ff, #132b4d); }
.timeline-row > i { width: 22px; height: 22px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; font-style: normal; font-size: 10px; }
.timeline-row.done > i { color: white; border-color: var(--green); background: var(--green); }
.timeline-row b { display: block; font-size: 12px; }
.timeline-row small { display: block; margin-top: 3px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timeline-row strong { font-size: 13px; }
.gate-section, .progress-section { margin-top: 16px; }
.gates { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 0 16px 16px; }
.gate { border: 1px solid var(--line); border-top-width: 3px; border-radius: 10px; padding: 13px; }
.gate.ok { border-top-color: var(--green); }
.gate.warn { border-top-color: var(--amber); }
.gate.stop { border-top-color: var(--red); }
.gate span, .gate small { display: block; color: var(--muted); font-size: 11px; }
.gate b { display: block; margin: 7px 0 3px; font-size: 21px; }
.progress-list { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 16px; }
.progress-item { padding: 8px 10px; border-radius: 8px; background: var(--surface-soft); font-size: 12px; }
.progress-item b { margin-right: 6px; }
.progress-item span { color: var(--muted); }
.empty { margin: 0; padding: 24px; color: var(--muted); text-align: center; font-size: 12px; }
@keyframes pulse { 50% { opacity: .45; transform: scale(.8); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (max-width: 900px) { .topbar, .summary { align-items: flex-start; flex-direction: column; } .top-actions { flex-wrap: wrap; } .current-rule { text-align: left; } .workspace { grid-template-columns: 1fr; } .gates { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { main { width: min(100% - 16px, 1500px); } .topbar { padding: 14px; } .top-actions label { width: 100%; } .top-actions select { flex: 1; } .flow-row { grid-template-columns: 90px minmax(0, 1fr) 78px; gap: 8px; } .gates { grid-template-columns: 1fr 1fr; } }
