:root {
  --bg: #0d1117; --panel: #151b23; --panel2: #1b222c; --line: #262f3b; --text: #e6edf3; --muted: #8b97a6;
  --accent: #4f8cff; --ok: #3fb950; --warn: #d29922; --bad: #f85149;
  --add-bg: rgba(63,185,80,.14); --del-bg: rgba(248,81,73,.14); --hunk-bg: rgba(79,140,255,.10);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}
:root[data-theme="light"] {
  --bg: #f6f8fa; --panel: #ffffff; --panel2: #f0f3f6; --line: #d8dee4; --text: #1f2328; --muted: #656d76;
  --accent: #0969da; --ok: #1a7f37; --warn: #9a6700; --bad: #cf222e;
  --add-bg: rgba(46,160,67,.15); --del-bg: rgba(255,129,130,.2); --hunk-bg: rgba(84,174,255,.15);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { font-weight: 700; font-size: 16px; letter-spacing: .2px; padding: 4px 10px 14px; display: flex; align-items: center; gap: 8px; }
.brand i { width: 10px; height: 10px; border-radius: 3px; background: var(--accent); display: inline-block; }
.nav a { display: block; padding: 8px 10px; border-radius: 6px; color: var(--muted); }
.nav a:hover { background: var(--panel2); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--panel2); color: var(--text); }
.side .grow { flex: 1; }
.who { padding: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }
.who b { color: var(--text); display: block; }
.who button { margin-top: 6px; }
.main { padding: 24px 28px 60px; max-width: 1400px; width: 100%; }
h1 { font-size: 20px; margin: 0 0 4px; } h2 { font-size: 15px; margin: 0 0 10px; }
.sub { color: var(--muted); margin: 0 0 20px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.grid { display: grid; gap: 14px; } .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); }
.stat .n { font-size: 24px; font-weight: 650; } .stat .l { color: var(--muted); font-size: 12.5px; }
.btn { background: var(--panel2); border: 1px solid var(--line); border-radius: 7px; padding: 7px 12px; cursor: pointer; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.sm { padding: 3px 8px; font-size: 12.5px; }
input[type=text], input[type=password], input[type=number], textarea, select {
  width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; }
input:focus, textarea:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent); border-color: var(--accent); }
label { display: block; font-size: 12.5px; color: var(--muted); margin: 12px 0 4px; }
.row { display: flex; gap: 10px; align-items: center; } .row.wrap { flex-wrap: wrap; }
.spread { justify-content: space-between; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12.5px; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--panel2); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); background: var(--panel2); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.pill.running::before { background: var(--accent); animation: pulse 1.2s infinite; }
.pill.done::before { background: var(--ok); } .pill.failed::before { background: var(--bad); }
.pill.queued::before { background: var(--warn); } .pill.cancelled::before { background: var(--muted); }
@keyframes pulse { 50% { opacity: .3; } }
.muted { color: var(--muted); } .mono { font-family: var(--mono); font-size: 12.5px; }
.bar { height: 6px; background: var(--panel2); border-radius: 4px; overflow: hidden; min-width: 90px; }
.bar > span { display: block; height: 100%; background: var(--accent); } .bar.hot > span { background: var(--bad); }
.err { color: var(--bad); margin-top: 10px; } .okmsg { color: var(--ok); margin-top: 10px; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.login { max-width: 360px; margin: 14vh auto; }
.login .card { padding: 24px; }
/* run view */
.runhead { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-bottom: 14px; }
.runhead .meta { color: var(--muted); font-size: 13px; display: flex; gap: 14px; flex-wrap: wrap; }
.split { display: grid; grid-template-columns: minmax(340px, 5fr) 7fr; gap: 14px; align-items: start; }
.pane { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.pane > .ph { padding: 9px 14px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 13px; }
.timeline { padding: 12px 14px; max-height: calc(100vh - 190px); overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.ev-status { color: var(--muted); font-size: 12.5px; display: flex; gap: 8px; align-items: center; }
.ev-status::before { content: ""; width: 6px; height: 6px; background: var(--line); border-radius: 50%; }
.ev-msg { background: var(--panel2); border-radius: 8px; padding: 9px 12px; white-space: pre-wrap; word-break: break-word; }
.tool { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.tool > summary { list-style: none; cursor: pointer; padding: 7px 10px; display: flex; gap: 8px; align-items: center; font-family: var(--mono); font-size: 12.5px; }
.tool > summary::-webkit-details-marker { display: none; }
.tool .ico { color: var(--muted); width: 14px; text-align: center; }
.tool.fail { border-color: color-mix(in srgb, var(--bad) 55%, var(--line)); }
.tool.run > summary .ico { color: var(--accent); animation: pulse 1s infinite; }
.tool pre { margin: 0; padding: 9px 11px; background: var(--bg); border-top: 1px solid var(--line); max-height: 280px; overflow: auto; font: 12px/1.45 var(--mono); white-space: pre-wrap; word-break: break-all; }
.tool .cmd { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.ev-done, .ev-error { border-radius: 8px; padding: 12px; }
.ev-done { background: color-mix(in srgb, var(--ok) 12%, var(--panel)); border: 1px solid color-mix(in srgb, var(--ok) 40%, var(--line)); }
.ev-error { background: color-mix(in srgb, var(--bad) 12%, var(--panel)); border: 1px solid color-mix(in srgb, var(--bad) 40%, var(--line)); }
.tabs { display: flex; gap: 2px; } .tabs button { background: none; border: 0; padding: 4px 10px; border-radius: 6px; cursor: pointer; color: var(--muted); }
.tabs button.on { background: var(--panel2); color: var(--text); }
.diffwrap { max-height: calc(100vh - 190px); overflow: auto; }
.dfile { border-bottom: 1px solid var(--line); }
.dfile > .dh { position: sticky; top: 0; background: var(--panel2); padding: 7px 12px; font: 12.5px var(--mono); display: flex; justify-content: space-between; gap: 12px; z-index: 1; }
.dh .a { color: var(--ok); } .dh .d { color: var(--bad); }
.dl { display: grid; grid-template-columns: 44px 44px 1fr; font: 12px/1.5 var(--mono); }
.dl span:nth-child(1), .dl span:nth-child(2) { color: var(--muted); text-align: right; padding-right: 8px; user-select: none; opacity: .7; }
.dl span:nth-child(3) { white-space: pre-wrap; word-break: break-all; padding-right: 8px; }
.dl.add { background: var(--add-bg); } .dl.del { background: var(--del-bg); } .dl.hunk { background: var(--hunk-bg); color: var(--muted); }
.sumtext { padding: 14px; white-space: pre-wrap; }
.stack > * + * { margin-top: 14px; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; } .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .side .grow { display: none; } .brand { padding: 4px 8px; } .main { padding: 16px; }
  .split, .g3, .g4 { grid-template-columns: 1fr; } .timeline, .diffwrap { max-height: none; }
  .who { border: 0; padding: 0 8px; }
}
