:root {
  --bg: #15171c; --panel: #1d2026; --panel2: #262a31; --line: #343943; --text: #dde1e7; --muted: #8b919c;
  --accent: #f2c14e; --left: #4680eb; --right: #e85642; --warn: #ff8a5c;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 13px/1.4 system-ui, -apple-system, Segoe UI, sans-serif; }
header { display: flex; align-items: center; gap: 16px; height: 42px; padding: 0 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
h1 { font-size: 15px; margin: 0; font-weight: 600; }
h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 8px; font-weight: 600; display: flex; gap: 8px; align-items: center; }
h3 { font-size: 12px; margin: 10px 0 4px; color: var(--muted); font-weight: 600; }
nav { display: flex; gap: 4px; }
button, .button, select, input { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 5px; padding: 4px 8px; }
button, .button { cursor: pointer; white-space: nowrap; }
button:hover, .button:hover { border-color: #59606d; }
button.tab.active, button.toggle.active { background: #3a3220; border-color: var(--accent); color: var(--accent); }
input[type=number] { width: 64px; }
input[type=checkbox] { padding: 0; }
textarea { width: 100%; min-height: 90px; font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 5px; padding: 6px; resize: vertical; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 12px; margin: 4px 0 8px; }
.warn { color: var(--warn); font-size: 12px; min-height: 1em; }
.hidden { display: none !important; }
.sep { width: 1px; align-self: stretch; background: var(--line); margin: 0 4px; }
.row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.row input:not([type=checkbox]), .row select { min-width: 0; flex: 1; }
.row label { display: flex; gap: 4px; align-items: center; flex: 1; }

.page { display: none; height: calc(100% - 42px); }
.page.active { display: grid; grid-template-columns: 230px 1fr 290px; }
#runs.page.active { grid-template-columns: 340px 1fr; }
.side { background: var(--panel); border-right: 1px solid var(--line); overflow: auto; padding: 10px; }
.side.right { border-right: 0; border-left: 1px solid var(--line); }
.side section { margin-bottom: 18px; }
.center { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.toolbar, .transport { display: flex; gap: 6px; align-items: center; padding: 6px 8px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.transport { border-top: 1px solid var(--line); border-bottom: 0; }
.viewport { flex: 1; min-height: 200px; position: relative; overflow: hidden; }
.viewport canvas { display: block; }
.timeline { height: 72px; width: 100%; display: block; cursor: ew-resize; }

.bones { list-style: none; margin: 0; padding: 0; }
.bones li { padding: 2px 6px; border-radius: 4px; cursor: pointer; display: flex; justify-content: space-between; gap: 6px; }
.bones li:hover { background: var(--panel2); }
.bones li.sel { background: #3a3220; color: var(--accent); }
.bones li .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.bones li .k { color: var(--accent); font-size: 11px; }
.slider { display: grid; grid-template-columns: 14px 1fr 62px; gap: 6px; align-items: center; margin-bottom: 4px; }
.slider span { font-weight: 600; }
.slider.out span, .slider.out input[type=number] { color: var(--warn); }
.slider input[type=range] { width: 100%; padding: 0; }
.slider small { grid-column: 2 / 4; color: var(--muted); margin-top: -4px; font-size: 11px; }
.model-img { width: 100%; background: #fff; border-radius: 4px; min-height: 40px; cursor: zoom-in; }

.runs { list-style: none; margin: 0; padding: 0; }
.runs li { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 6px; cursor: pointer; }
.runs li:hover { border-color: #59606d; }
.runs li.sel { border-color: var(--accent); }
.runs li .t { font-weight: 600; }
.runs li .m { color: var(--muted); font-size: 12px; }
.badge { display: inline-block; padding: 0 6px; border-radius: 8px; font-size: 11px; background: var(--panel2); border: 1px solid var(--line); }
.badge.running { color: #7fd1ff; border-color: #2d5a73; }
.badge.finished { color: #8fe08a; border-color: #335e31; }
.badge.abandoned { color: var(--muted); }

.run-detail { overflow: auto; padding: 12px; gap: 12px; }
.run-detail .empty { margin: 40px auto; }
.run-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.run-head h2 { font-size: 14px; color: var(--text); text-transform: none; letter-spacing: 0; }
.run-grid { display: grid; grid-template-columns: minmax(320px, 1fr) minmax(280px, 380px); gap: 12px; }
.run-view { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; height: 460px; }
.run-view .viewport { min-height: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 10px; }
.log { list-style: none; margin: 0; padding: 0; }
.log li { border-top: 1px solid var(--line); padding: 8px 0; }
.log .tool { font-weight: 600; color: var(--accent); }
.log .err .tool { color: var(--warn); }
.log pre { white-space: pre-wrap; word-break: break-word; margin: 4px 0; font: 12px/1.35 ui-monospace, Consolas, monospace; color: #c3c8d0; max-height: 160px; overflow: auto; background: var(--panel2); padding: 6px; border-radius: 4px; }
.log img { max-width: 360px; width: 100%; border-radius: 4px; cursor: zoom-in; background: #fff; }
.prompt { white-space: pre-wrap; font: 12px/1.4 ui-monospace, Consolas, monospace; max-height: 220px; overflow: auto; }
code.cmd { display: block; white-space: pre-wrap; word-break: break-all; background: var(--panel2); padding: 6px; border-radius: 4px; font-size: 12px; }
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 8px; max-width: 95vw; max-height: 95vh; }
dialog img { max-width: 90vw; max-height: 82vh; display: block; background: #fff; }
dialog form { text-align: right; margin-top: 8px; }
.checks { border-collapse: collapse; width: 100%; }
.checks td { padding: 3px 8px 3px 0; vertical-align: top; border-top: 1px solid var(--line); }
.checks td:first-child { width: 110px; }
