:root {
  --bg: #0e1116; --panel: #161b22; --panel2: #1c232d; --line: #2a323d;
  --ink: #e6edf3; --muted: #9aa7b4; --accent: #4cc2ff; --good: #3fb950;
  --warn: #d29922; --hot: #f85149; --shadow: 0 6px 22px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.45 -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; letter-spacing: .2px; display: flex; align-items: center; gap: 9px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.topctl { display: flex; align-items: center; gap: 12px; }
.topctl label, .row label { color: var(--muted); display: flex; gap: 6px; align-items: center; }
select, textarea, input[type=range] {
  background: var(--panel2); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 9px; font: inherit;
}
textarea { width: 100%; resize: vertical; }
button { cursor: pointer; border-radius: 8px; padding: 8px 14px; font: inherit; border: 1px solid var(--line); }
button.primary { background: var(--accent); color: #06121b; border-color: var(--accent); font-weight: 600; }
button.ghost { background: var(--panel2); color: var(--ink); }
button:active { transform: translateY(1px); }
.status { color: var(--muted); font-size: 12px; min-width: 80px; }

.layout { display: grid; grid-template-columns: 300px 1fr 280px; gap: 0; height: calc(100vh - 53px); }
.left, .right { background: var(--panel); padding: 16px; overflow: auto; border-right: 1px solid var(--line); }
.right { border-right: none; border-left: 1px solid var(--line); }
.left h2, .right h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 18px 0 8px; }
.left h2:first-child { margin-top: 0; }
.row { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
#timeline { width: 100%; }
.clock { font-variant-numeric: tabular-nums; color: var(--muted); margin-top: 4px; }
.hint { color: var(--muted); font-size: 11.5px; margin: 8px 0 4px; }

.canvasWrap { position: relative; background: radial-gradient(1200px 600px at 50% 30%, #131a23, #0c0f14); }
#stage { width: 100%; height: 100%; display: block; }
.legend { position: absolute; left: 14px; bottom: 14px; display: flex; flex-wrap: wrap; gap: 8px;
  background: rgba(13,17,23,.7); padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kpi { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.kpi .v { font-size: 19px; font-weight: 700; }
.kpi .ci { font-size: 11px; color: var(--accent); font-variant-numeric: tabular-nums; margin-top: 1px; }
.kpi .l { font-size: 11px; color: var(--muted); }
.bottleneck { background: var(--panel2); border: 1px solid var(--line); border-left: 3px solid var(--hot);
  border-radius: 10px; padding: 10px 12px; font-weight: 600; }
.conf { color: var(--muted); font-size: 12px; }

.bc-inputs { display: flex; gap: 8px; margin-bottom: 8px; }
.bc-inputs label { flex: 1; font-size: 11px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.bc-inputs input { background: var(--panel2); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 5px 7px; font: inherit; }
.bcase { min-height: 40px; }
.bc-empty { color: var(--muted); font-size: 12px; }
.bc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.bc-cell { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; }
.bc-cell .bc-v { font-size: 16px; font-weight: 700; }
.bc-cell .bc-l { font-size: 10.5px; color: var(--muted); }
.bc-verdict { margin-top: 8px; padding: 6px 9px; border-radius: 8px; font-size: 12px; font-weight: 600; text-align: center; }
.bc-verdict.good { background: rgba(63,185,80,.16); color: var(--good); border: 1px solid rgba(63,185,80,.4); }
.bc-verdict.mid { background: rgba(210,153,34,.16); color: var(--warn); border: 1px solid rgba(210,153,34,.4); }
.bc-verdict.bad { background: rgba(248,81,73,.14); color: var(--hot); border: 1px solid rgba(248,81,73,.4); }

.controls { display: flex; flex-direction: column; gap: 5px; margin-top: 4px; }
.ctl-row { display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: 6px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; }
.ctl-name { font-size: 12px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctl-name.hot { color: var(--hot); font-weight: 600; }
.ctl-btn { width: 24px; height: 24px; padding: 0; line-height: 1; background: var(--panel);
  color: var(--ink); border: 1px solid var(--line); border-radius: 6px; font-size: 15px; }
.ctl-btn:hover { background: var(--accent); color: #06121b; border-color: var(--accent); }
.ctl-val { min-width: 22px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }
button.primary.pulse { box-shadow: 0 0 0 0 rgba(76,194,255,.7); animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(76,194,255,.6); } 70% { box-shadow: 0 0 0 8px rgba(76,194,255,0); } 100% { box-shadow: 0 0 0 0 rgba(76,194,255,0); } }
