:root {
  color-scheme: light;
  --bg: #e7e4de;
  --panel: #f7f6f3;
  --ink: #1c1b19;
  --muted: #6f6a62;
  --line: #d9d3ca;
  --accent: #1c1b19;
  --paper: #fffdf9;
  --good: #1f6b45;
  --bad: #9d2c2c;
  --warn: #8a5a12;
  --sans: "Segoe UI", "PingFang SC", "Noto Sans SC", sans-serif;
  --mono: "IBM Plex Mono", "Sarasa Mono SC", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: var(--sans); color: var(--ink); background: var(--bg); overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: 0.45; cursor: not-allowed; }

.gate { height: 100%; display: grid; place-items: center; }
.gate form { width: min(380px, calc(100% - 32px)); background: var(--paper); border: 1px solid var(--line); padding: 22px; display: grid; gap: 12px; }
.gate h1 { margin: 0; font-size: 22px; }
.gate p { margin: 0; color: var(--muted); font-size: 13px; }

.bench { height: 100%; display: grid; grid-template-rows: 52px minmax(0, 1fr); }
.toolbar, .rail, .editor, .inspector { background: var(--panel); }
.toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px; border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; letter-spacing: -0.03em; margin-right: 6px; }
.spacer { flex: 1; }
.toolbar select, .field input, .field select {
  height: 32px; border: 1px solid var(--line); background: white; border-radius: 8px; padding: 0 8px;
}
.btn, .btn-line {
  height: 32px; border-radius: 8px; padding: 0 12px; border: 1px solid var(--accent); background: var(--accent); color: white;
}
.btn-line { background: white; color: var(--ink); border-color: var(--line); }
.file-btn { position: relative; overflow: hidden; display: inline-grid; place-items: center; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.bench-body { min-height: 0; display: grid; grid-template-columns: 280px minmax(0, 1fr) 340px; }
.rail, .inspector { min-height: 0; display: flex; flex-direction: column; }
.rail { border-right: 1px solid var(--line); }
.inspector { border-left: 1px solid var(--line); }
.pane-h {
  height: 40px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px;
}
.queue { overflow: auto; padding: 8px; display: grid; align-content: start; gap: 6px; }
.job {
  text-align: left; border: 1px solid transparent; background: transparent; border-radius: 10px; padding: 8px 10px;
}
.job.active { background: white; border-color: var(--line); }
.job b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job span, .meta { color: var(--muted); font-size: 12px; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 99px; background: var(--warn); margin-right: 6px; }
.dot.done { background: var(--good); }
.dot.error { background: var(--bad); }
.editor { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #fbfaf7; }
.editor .pane-h { background: var(--panel); }
.editor textarea, .inspector textarea {
  border: 0; resize: none; outline: none; background: transparent;
  font-family: var(--mono); line-height: 1.7; padding: 16px;
}
.editor textarea { flex: 1; font-size: 15px; }
.inspector textarea { flex: 1; min-height: 0; font-size: 12.5px; padding: 10px 12px; }
.insp-block { min-height: 0; flex: 1; display: flex; flex-direction: column; border-bottom: 1px solid var(--line); }
.insp-block:last-child { border-bottom: 0; }
.insp-block header, .editor .pane-h { gap: 8px; }
.link { border: 0; background: transparent; color: var(--muted); padding: 0; font-size: 12px; }
.blank { flex: 1; display: grid; place-items: center; color: var(--muted); text-align: center; padding: 24px; }
.blank h2 { margin: 0 0 6px; color: var(--ink); font-size: 22px; font-weight: 620; }
.blank.hot { background: #fff7ea; }
.err { color: var(--bad); }

.drawer-back { position: fixed; inset: 0; background: rgba(28, 27, 25, 0.28); display: flex; justify-content: flex-end; }
.drawer { width: min(520px, 100%); height: 100%; background: var(--paper); border-left: 1px solid var(--line); overflow: auto; padding: 18px; display: grid; align-content: start; gap: 14px; }
.drawer h2 { margin: 0; font-size: 20px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { display: grid; gap: 5px; font-size: 12px; color: var(--muted); }
.field input, .field select { width: 100%; }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--ink); color: white; border-radius: 999px; padding: 8px 14px; font-size: 13px; }
.modal-back { position: fixed; inset: 0; background: rgba(28,27,25,.35); display: grid; place-items: center; }
.modal { width: min(360px, calc(100% - 32px)); background: white; border-radius: 12px; padding: 16px; display: grid; gap: 12px; }
.modal h3 { margin: 0; font-size: 16px; }
.actions { display: flex; justify-content: flex-end; gap: 8px; }
.ok { color: var(--good); font-size: 13px; }
@media (max-width: 960px) {
  body { overflow: auto; }
  .bench { height: auto; min-height: 100%; }
  .bench-body { grid-template-columns: 1fr; }
  .rail, .inspector { border: 0; }
  .editor textarea { min-height: 50vh; }
  .queue { max-height: 280px; }
}
