:root {
  --bg: #0d0d0d; --surface: #1a1a19; --surface2: #232321; --line: #2c2c2a; --line2: #383835;
  --ink: #f0efec; --ink2: #c3c2b7; --muted: #898781;
  --accent: #3987e5; --good: #0ca30c; --warn: #fab219; --bad: #d03b3b; --serious: #ec835a;
  --mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
header { display: flex; align-items: center; gap: 18px; padding: 10px 16px;
  border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.brand { font-size: 16px; letter-spacing: .02em; color: var(--ink2); }
.brand b { color: var(--ink); }
nav { display: flex; gap: 2px; flex-wrap: wrap; }
nav button { background: none; border: 0; color: var(--ink2); padding: 7px 12px; border-radius: 6px; cursor: pointer; font: inherit; }
nav button:hover { background: var(--surface2); }
nav button.on { background: var(--surface2); color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
#pills { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.pill { font-size: 12px; padding: 3px 9px; border-radius: 99px; background: var(--surface2); color: var(--ink2); border: 1px solid var(--line2); white-space: nowrap; }
.pill.good::before, .pill.bad::before, .pill.warn::before { content: "●"; margin-right: 5px; }
.pill.good::before { color: var(--good); } .pill.bad::before { color: var(--bad); } .pill.warn::before { color: var(--warn); }
main { padding: 16px; max-width: 1600px; margin: 0 auto; }
.tab { display: none; } .tab.on { display: block; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; min-width: 0; }
h2 { font-size: 15px; margin: 0 0 10px; font-weight: 600; }
h3 { font-size: 13px; margin: 14px 0 6px; color: var(--ink2); font-weight: 600; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 12px; }
.split { display: grid; grid-template-columns: 320px 1fr; gap: 14px; align-items: start; }
@media (max-width: 1000px) { .grid2, .split { grid-template-columns: 1fr; } .grid3 { grid-template-columns: 1fr 1fr; } }
.row { display: flex; align-items: center; } .gap { gap: 8px; } .wrap { flex-wrap: wrap; } .grow { flex: 1; }
.toolbar { margin-bottom: 12px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .hidden { display: none !important; }
label { display: block; color: var(--ink2); font-size: 12.5px; margin-bottom: 8px; }
label.chk { display: flex; gap: 7px; align-items: flex-start; font-size: 13px; color: var(--ink); margin: 5px 0; }
label.chk input { margin-top: 3px; }
input, select, textarea { width: 100%; background: var(--bg); color: var(--ink); border: 1px solid var(--line2);
  border-radius: 6px; padding: 6px 8px; font: inherit; margin-top: 3px; }
input[type=checkbox] { width: auto; margin: 0; accent-color: var(--accent); }
textarea { font-family: var(--mono); font-size: 12.5px; resize: vertical; }
textarea.code { min-height: 420px; white-space: pre; tab-size: 2; }
button { background: var(--surface2); color: var(--ink); border: 1px solid var(--line2); border-radius: 6px;
  padding: 6px 11px; font: inherit; cursor: pointer; white-space: nowrap; }
button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { color: #ff9a9a; border-color: #5a2a2a; }
button.big { padding: 9px 18px; font-size: 15px; }
button.sm { padding: 2px 7px; font-size: 12px; }
button:disabled { opacity: .45; cursor: default; }
.seg { display: flex; border: 1px solid var(--line2); border-radius: 7px; overflow: hidden; margin: 6px 0 4px; }
.seg button { flex: 1; border: 0; border-radius: 0; background: var(--bg); color: var(--ink2); }
.seg button.on { background: var(--surface2); color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.checks { max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; }
.checks label.chk { margin: 3px 0; }
.checks .cat { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; margin: 8px 0 2px; }
.tag { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 4px; background: var(--surface2); color: var(--ink2); border: 1px solid var(--line2); margin-right: 3px; }
.tag.good { color: #7fdc7f; border-color: #235c23; } .tag.bad { color: #ff9a9a; border-color: #5a2a2a; }
.tag.warn { color: #ffd479; border-color: #5c4a1a; } .tag.acc { color: #9cc6f5; border-color: #24496f; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--line2); padding: 6px 8px; white-space: nowrap; position: sticky; top: 0; background: var(--surface); }
.tbl td { border-bottom: 1px solid var(--line); padding: 6px 8px; vertical-align: top; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12.5px; }
.tbl tr:hover td { background: #1f1f1d; }
.tbl-wrap { overflow: auto; max-height: 560px; }
.gpus { display: grid; gap: 10px; }
.gpu { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.gpu .top { display: flex; justify-content: space-between; font-size: 13px; }
.bar { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; margin: 6px 0 4px; border: 1px solid var(--line); }
.bar > div { height: 100%; background: var(--accent); border-radius: 4px; }
.log { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px; height: 260px; overflow: auto;
  font-family: var(--mono); font-size: 12px; white-space: pre-wrap; color: var(--ink2); margin: 8px 0; }
.banner { background: #2e2610; color: #ffd479; border-bottom: 1px solid #5c4a1a; padding: 8px 16px; display: flex; gap: 12px; align-items: center; }
.estimate { margin: 12px 0; padding: 8px 10px; background: var(--bg); border-radius: 6px; border: 1px solid var(--line); font-size: 13px; color: var(--ink2); }
.run-item { padding: 8px; border-radius: 6px; cursor: pointer; border: 1px solid transparent; }
.run-item:hover { background: var(--surface2); } .run-item.on { border-color: var(--accent); background: var(--surface2); }
.run-item .nm { font-weight: 500; } .run-item .meta { font-size: 12px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0; }
.chip { font-size: 12px; padding: 3px 9px; border-radius: 99px; border: 1px solid var(--line2); cursor: pointer; color: var(--ink2); user-select: none; }
.chip.on { background: #17324f; border-color: var(--accent); color: var(--ink); }
.charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 12px; }
.chart-card { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--surface); }
.chart-card .t { font-size: 13px; font-weight: 500; } .chart-card .u { font-size: 11.5px; color: var(--muted); }
.chart-wrap { position: relative; height: 240px; } .chart-wrap.tall { height: 420px; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.65); z-index: 20; display: flex; align-items: flex-start; justify-content: center; padding: 30px 16px; overflow: auto; }
.modal-box { background: var(--surface); border: 1px solid var(--line2); border-radius: 10px; width: min(1100px, 100%); padding: 14px 16px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.err { color: #ff9a9a; white-space: pre-wrap; font-family: var(--mono); font-size: 12px; }
.ok { color: #7fdc7f; }
details > summary { cursor: pointer; color: var(--ink2); }
pre.out { white-space: pre-wrap; background: var(--bg); padding: 8px; border-radius: 6px; border: 1px solid var(--line); max-height: 300px; overflow: auto; font-size: 12px; font-family: var(--mono); }
.prog { height: 10px; background: var(--bg); border-radius: 5px; border: 1px solid var(--line); overflow: hidden; margin: 6px 0; }
.prog > div { height: 100%; background: var(--accent); transition: width .5s; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 3px 12px; font-size: 13px; }
.kv div:nth-child(odd) { color: var(--muted); }
.hf-res { max-height: 300px; overflow: auto; }
.hf-res .run-item { display: flex; justify-content: space-between; }

/* ---- v2 additions ---- */
.banner.bad { background: #2e1414; color: #ff9a9a; border-color: #5a2a2a; }
#restart-bar { background: #14263a; color: #9cc6f5; border-bottom: 1px solid #24496f; }
#me { margin-left: 4px; }
a.pill { text-decoration: none; }
.right { text-align: right; } .nowrap { white-space: nowrap; }
.tbl.clickable tr:not(:first-child) { cursor: pointer; }
.help { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--line2); color: var(--muted); font-size: 10px; cursor: help; position: relative; vertical-align: 1px; margin-left: 2px; }
.help:hover::after, .help:focus::after { content: attr(data-tip); position: absolute; left: 50%; top: 20px; transform: translateX(-50%); width: max-content; max-width: 320px; white-space: normal; background: #000; color: var(--ink); border: 1px solid var(--line2); border-radius: 6px; padding: 7px 9px; font-size: 12px; line-height: 1.4; z-index: 30; text-align: left; font-weight: 400; }
pre.diff { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px; font-family: var(--mono); font-size: 12px; max-height: 55vh; overflow: auto; white-space: pre; }
pre.diff .da { color: #7fdc7f; background: #0f2a10; display: inline-block; min-width: 100%; }
pre.diff .dd { color: #ff9a9a; background: #2a1010; display: inline-block; min-width: 100%; }
pre.diff .dh { color: var(--muted); }
.alert { background: #2e2610; border: 1px solid #5c4a1a; color: #ffd479; border-radius: 6px; padding: 8px 10px; margin: 8px 0; font-size: 13px; }
.alert.bad { background: #2e1414; border-color: #5a2a2a; color: #ff9a9a; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px 12px; }
@media (max-width: 1200px) { .grid4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid4, .grid3 { grid-template-columns: 1fr; } }
.modal-box.wide { width: min(1300px, 100%); }
.stepper { display: flex; gap: 6px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 7px; padding: 6px 12px 6px 6px; border-radius: 99px; background: var(--bg); color: var(--muted); font-size: 13px; }
.step span { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--surface2); font-size: 12px; }
.step.on { color: var(--ink); background: #14263a; } .step.on span { background: var(--accent); color: #fff; }
.step.done { color: var(--ink2); } .step.done span { background: #0f2a10; color: #7fdc7f; }
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.preset { text-align: left; display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; white-space: normal; background: var(--bg); }
.preset b { font-weight: 600; } .preset span { font-size: 12px; color: var(--muted); }
.preset:hover { border-color: var(--accent); }
.groups-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; }
.group-card .toggles { margin: 8px 0; }
.toggles .chk { margin: 4px 0; }
.story { font-size: 12.5px; color: var(--ink2); background: var(--bg); border-radius: 6px; padding: 7px 9px; border: 1px solid var(--line); }
.group-card.default { border-style: dashed; }
.members { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.members .chip { cursor: default; display: inline-flex; align-items: center; gap: 4px; }
.members .chip a { color: var(--ink); text-decoration: none; }
.chip .x { background: none; border: 0; color: var(--muted); padding: 0 2px; font-size: 11px; }
.chip .x:hover { color: #ff9a9a; }
.checklist > div { padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.checklist .mark { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; margin-right: 8px; font-size: 11px; }
.checklist .ok .mark { background: #0f2a10; color: #7fdc7f; } .checklist .todo .mark { background: #2e2610; color: #ffd479; }
.health .hl { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.health .lv { font-size: 11px; text-transform: uppercase; width: 44px; flex: none; }
.health .error .lv { color: #ff9a9a; } .health .warn .lv { color: #ffd479; } .health .info .lv { color: var(--muted); }
details.card > summary { cursor: pointer; list-style-position: outside; }
.savebar { position: sticky; bottom: 0; background: var(--surface); border: 1px solid var(--line2); border-radius: 10px; padding: 10px 14px; display: flex; gap: 8px; box-shadow: 0 -6px 20px rgba(0,0,0,.4); }
.subnav { display: flex; flex-direction: column; gap: 2px; }
.subnav a { padding: 7px 10px; border-radius: 6px; color: var(--ink2); text-decoration: none; }
.subnav a:hover { background: var(--surface2); } .subnav a.on { background: var(--surface2); color: var(--ink); box-shadow: inset 2px 0 0 var(--accent); }
.macro-row { display: grid; grid-template-columns: 200px 1fr auto; gap: 8px; align-items: start; margin-bottom: 8px; }
.small-code { min-height: 70px; font-size: 12px; }
textarea.code.small-code { min-height: 70px; }
.small-seg { width: max-content; margin-bottom: 10px; } .small-seg button { padding: 4px 14px; font-size: 13px; }
.add-flag { margin-top: 8px; } .add-flag input { margin: 0; }
.gpu-pick { margin-bottom: 6px; }
.gpu.sel { border-color: var(--accent); }
.prog.big { height: 16px; }
.reco { background: #101b27; border-color: #24496f; }
.reco-item { padding: 8px 0; border-top: 1px solid #24496f; }
.reco-item button { margin-top: 6px; }
.cat { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; margin: 10px 0 2px; }
.prow { padding: 3px 0; border-bottom: 1px solid var(--line); }
ol.steps li { margin: 10px 0; } ol.steps li button { margin-left: 6px; }
a.run-item { display: block; color: inherit; text-decoration: none; }
.hf-res .run-item { align-items: center; }
.runs-col { position: sticky; top: 70px; }

/* ---- locks, selectors, config file ---- */
.lock { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 400; color: #ffd479; background: #2e2610; border: 1px solid #5c4a1a; border-radius: 4px; padding: 0 6px; white-space: nowrap; vertical-align: 1px; }
.lock.sm { padding: 0 4px; font-size: 11px; }
.lockbtn { padding: 1px 6px; } .lockbtn.on { border-color: #5c4a1a; background: #2e2610; color: #ffd479; }
tr.locked td { background: #1f1b0e; }
.group-card.is-locked { border-color: #5c4a1a; }
.cfg-layout { display: grid; grid-template-columns: 1fr 360px; gap: 14px; align-items: start; }
@media (max-width: 1100px) { .cfg-layout { grid-template-columns: 1fr; } }
.cfg-editor { display: flex; height: 72vh; border: 1px solid var(--line2); border-radius: 6px; background: var(--bg); overflow: hidden; margin: 8px 0; font: 12.5px/18px var(--mono); }
.cfg-editor pre, .cfg-editor textarea { font: inherit; line-height: 18px; margin: 0; tab-size: 2; }
.gutter { width: 52px; flex: none; text-align: right; padding: 8px 8px 8px 0; color: var(--muted); overflow: hidden; user-select: none; border-right: 1px solid var(--line); }
.gutter span.lk { color: #ffd479; }
.cfg-wrap { position: relative; flex: 1; min-width: 0; }
.cfg-back, .cfg-wrap textarea { position: absolute; inset: 0; padding: 8px 10px; white-space: pre; overflow: hidden; border: 0; border-radius: 0; }
.cfg-back { color: transparent; pointer-events: none; }
.cfg-back span.lk { background: #2a2310; }
.cfg-back span.mk { background: #3b2f0f; }
.cfg-wrap textarea { background: transparent; color: var(--ink); resize: none; overflow: auto; outline: none; caret-color: var(--ink); width: 100%; height: 100%; }
.cfg-side .card { margin-bottom: 14px; }
tr.clickable { cursor: pointer; }
.marker-help td.mono { white-space: pre; color: #ffd479; vertical-align: top; }
