/* Stagehand — a rack patch-panel look: slate panels, silkscreen ink,
   jacks whose rings light in their state colour. Lanes are cables;
   staging is the bus they patch into. */
:root {
  --rack: #0f131b;
  --panel: #151a24;
  --panel-2: #1c2230;
  --panel-3: #252c3b;
  --well: #10141c;
  --edge: #2c3445;
  --edge-hi: #3a4356;
  --ink: #e9e5d9;
  --ink-2: #a9afbc;
  --ink-3: #747c8c;
  --red: #ff6461;
  --amber: #ffb547;
  --green: #4bdc93;
  --blue: #7493ff;
  --grey: #5f6777;
  --display: "Chakra Petch", "Segoe UI", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", "Cascadia Code", Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}
* { box-sizing: border-box; }
html { background: var(--rack); }
body {
  margin: 0; min-height: 100vh; color: var(--ink); font: 400 15px/1.5 var(--body);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(116, 147, 255, 0.07), transparent 60%),
    radial-gradient(900px 400px at 100% 0%, rgba(75, 220, 147, 0.05), transparent 60%),
    var(--rack);
}
body.busy { cursor: progress; }
body.busy button { pointer-events: none; opacity: 0.6; }
code { font: 500 0.88em var(--mono); color: var(--ink-2); }
h1, h2 { font-family: var(--display); font-weight: 600; letter-spacing: 0.02em; margin: 0; }
h2 { font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3); }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------------------------------------------------------------- top */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 1000px; margin: 0 auto; padding: 18px 20px 6px; }
.brand { display: flex; align-items: center; gap: 10px; font: 700 15px var(--display); letter-spacing: 0.22em; text-transform: uppercase; }
.brand .mark { width: 16px; height: 16px; border-radius: 50%; border: 4px solid var(--green); box-shadow: 0 0 12px rgba(75, 220, 147, 0.5); }
.brand .repo { font: 500 12px var(--mono); letter-spacing: 0; text-transform: none; color: var(--ink-3); padding-left: 10px; border-left: 1px solid var(--edge); }
.who { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.who img { border-radius: 50%; border: 1px solid var(--edge-hi); }
main { max-width: 1000px; margin: 0 auto; padding: 10px 20px 80px; display: grid; gap: 18px; }
.loading { color: var(--ink-3); }

/* ---------------------------------------------------------------- signal path */
.path { display: grid; grid-template-columns: 1fr 48px 1.35fr; align-items: stretch; margin-top: 8px; }
.bus { position: relative; padding: 16px 18px; border-radius: 14px; background: var(--panel); border: 1px solid var(--edge); }
.bus::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; border-radius: 14px 0 0 14px; background: var(--c); }
.bus.prod { --c: var(--blue); }
.bus.stage { --c: var(--green); }
.bus-label { display: flex; align-items: center; gap: 8px; font: 700 12px var(--display); letter-spacing: 0.18em; text-transform: uppercase; color: var(--c); margin-bottom: 8px; }
.bus-label code { margin-left: auto; font-size: 11.5px; letter-spacing: 0; text-transform: none; color: var(--ink-3); }
.led { width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); }
.bus-commit { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.bus-commit em { color: var(--ink-3); font-style: normal; }
.bus-meta { margin-top: 6px; font-size: 12.5px; color: var(--ink-3); }
.plug { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 7px; border-radius: 99px; background: rgba(75, 220, 147, 0.1); border: 1px solid rgba(75, 220, 147, 0.35); font: 600 12.5px var(--display); letter-spacing: 0.03em; color: var(--green); }
.plug::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.feed { position: relative; }
.feed span { position: absolute; top: 50%; left: -2px; right: -2px; height: 3px; transform: translateY(-50%); border-radius: 3px; background: linear-gradient(90deg, var(--blue), var(--green)); }
.feed span::after { content: ""; position: absolute; right: -1px; top: 50%; width: 9px; height: 9px; border-radius: 50%; transform: translate(0, -50%); background: var(--green); box-shadow: 0 0 10px var(--green); }

.subj { color: var(--ink); }
.meta { display: block; width: 100%; font-size: 12.5px; color: var(--ink-3); }
.bus .meta { width: auto; }
.bus-commit .subj { width: 100%; }

/* ---------------------------------------------------------------- notices + cards */
.notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 14px; border-radius: 10px; font-size: 14px; }
.bus .notice { margin-top: 12px; }
.notice.amber { background: rgba(255, 181, 71, 0.1); border: 1px solid rgba(255, 181, 71, 0.35); color: #ffd79a; }
.notice.blue { background: rgba(116, 147, 255, 0.1); border: 1px solid rgba(116, 147, 255, 0.35); color: #c8d4ff; }
.card { padding: 16px 18px; border-radius: 14px; background: var(--panel); border: 1px solid var(--edge); }
.card.warn { border-color: rgba(255, 181, 71, 0.45); background: linear-gradient(180deg, rgba(255, 181, 71, 0.07), transparent 70%), var(--panel); }
.card.warn h2 { color: var(--amber); font-size: 15px; letter-spacing: 0.03em; text-transform: none; }
.card.error { color: var(--red); }
.card p { margin: 8px 0 12px; color: var(--ink-2); }
.hand { margin: 10px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.hand li { padding: 8px 10px; border-radius: 8px; background: var(--well); }

/* ---------------------------------------------------------------- buttons + inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--edge-hi); background: var(--panel-2); font: 600 13.5px var(--display); letter-spacing: 0.03em; color: var(--ink); text-decoration: none; cursor: pointer; white-space: nowrap; transition: background 0.15s var(--ease), border-color 0.15s var(--ease); }
.btn:hover { background: var(--panel-3); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #11151d; }
.btn.primary:hover { background: #fff; }
.btn.go { background: rgba(75, 220, 147, 0.14); border-color: rgba(75, 220, 147, 0.5); color: var(--green); }
.btn.go:hover { background: rgba(75, 220, 147, 0.22); }
.btn.quiet { background: transparent; border-color: transparent; color: var(--ink-3); }
.btn.quiet:hover { color: var(--ink); background: var(--panel-2); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.link { padding: 0; border: 0; background: none; color: var(--ink-3); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font-size: 13px; }
.link:hover { color: var(--ink); }
select { min-height: 36px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--edge-hi); background: var(--well); color: var(--ink); font: 600 13.5px var(--display); }
input { min-height: 36px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--edge-hi); background: var(--well); color: var(--ink); min-width: 0; }
input::placeholder { color: var(--ink-3); }
input:focus { outline: none; border-color: var(--ink-3); }
.inline { display: flex; gap: 8px; flex-wrap: wrap; }
.inline input { flex: 1 1 220px; }
.inline select { flex: 0 1 260px; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- lanes */
.bay { display: grid; gap: 12px; }
.bay-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.bay-head .inline { flex: 0 1 430px; }
.lanes { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.lane { --c: var(--grey); display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 12px; background: var(--panel); border: 1px solid var(--edge); }
.lane.on { --c: var(--green); border-color: rgba(75, 220, 147, 0.3); }
.lane.prod { --c: var(--blue); }
.jack { position: relative; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #0b0e14; box-shadow: inset 0 0 0 2px var(--edge-hi); }
.jack span { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--c); }
.lane.on .jack span { box-shadow: 0 0 10px rgba(75, 220, 147, 0.55); background: radial-gradient(circle, #0b0e14 35%, transparent 36%); }
.lane-main { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; }
.lane-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lane-name b { font: 600 16px var(--display); letter-spacing: 0.02em; overflow-wrap: anywhere; }
.lane-commit { display: flex; flex-wrap: wrap; gap: 0 8px; }
.lane-commit .subj { flex: 1 1 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; color: var(--ink-2); }
.branch { justify-self: start; padding: 0; border: 0; background: none; cursor: copy; }
.branch code { font-size: 12px; color: var(--ink-3); }
.branch:hover code { color: var(--ink-2); }
.lane-acts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.tag { padding: 1px 7px; border-radius: 5px; font: 600 10.5px/1.6 var(--display); letter-spacing: 0.1em; text-transform: uppercase; background: var(--panel-3); color: var(--ink-3); }
.tag.green { background: rgba(75, 220, 147, 0.13); color: var(--green); }
.tag.blue { background: rgba(116, 147, 255, 0.14); color: var(--blue); }
.tag.amber { background: rgba(255, 181, 71, 0.14); color: var(--amber); }
.empty { color: var(--ink-3); }

/* ---------------------------------------------------------------- activity */
.log ul { margin: 10px 0 0; padding: 0; list-style: none; }
.log li { display: grid; grid-template-columns: 14px 1fr auto; gap: 10px; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--edge); font-size: 14px; color: var(--ink-2); }
.log li b { color: var(--ink); font-weight: 700; }
.log time { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.h-promote .dot { background: var(--blue); }
.h-hand .dot { background: var(--amber); }

/* ---------------------------------------------------------------- toast, dialog, sign-in */
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); max-width: min(620px, calc(100vw - 32px)); padding: 11px 16px; border-radius: 10px; background: var(--panel-3); border: 1px solid var(--edge-hi); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5); font-size: 14px; z-index: 10; }
.toast.good { border-color: rgba(75, 220, 147, 0.5); }
.toast.bad { border-color: rgba(255, 100, 97, 0.6); color: #ffc9c8; }
dialog.confirm { width: min(480px, calc(100vw - 32px)); padding: 0; border-radius: 16px; border: 1px solid var(--edge-hi); background: var(--panel-2); color: var(--ink); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6); }
dialog.confirm::backdrop { background: rgba(5, 7, 11, 0.7); }
dialog.confirm form { display: grid; gap: 12px; padding: 20px 22px; }
dialog.confirm h2 { font-size: 18px; letter-spacing: 0.02em; text-transform: none; color: var(--ink); }
dialog.confirm p { margin: 0; color: var(--ink-2); }
dialog.confirm label { display: grid; gap: 6px; font-size: 13px; color: var(--ink-3); }
dialog.confirm .row { display: flex; justify-content: flex-end; gap: 8px; }
.gate { display: grid; justify-items: center; gap: 14px; max-width: 440px; margin: 12vh auto 0; text-align: center; }
.gate h1 { font-size: 30px; letter-spacing: 0.18em; text-transform: uppercase; }
.gate p { margin: 0; color: var(--ink-2); }
.gate .fine { font-size: 13px; color: var(--ink-3); }
.jack.big { width: 64px; height: 64px; }
.jack.big span { --c: var(--green); width: 38px; height: 38px; border-width: 6px; box-shadow: 0 0 22px rgba(75, 220, 147, 0.5); }

/* ---------------------------------------------------------------- phone */
@media (max-width: 720px) {
  .top { padding: 14px 16px 4px; }
  .brand .repo { display: none; }
  .who span { display: none; }
  main { padding: 8px 16px 80px; }
  .path { grid-template-columns: 1fr; }
  .feed { height: 22px; }
  .feed span { top: -2px; bottom: -2px; left: 28px; right: auto; width: 3px; height: auto; transform: none; background: linear-gradient(180deg, var(--blue), var(--green)); }
  .feed span::after { right: auto; top: auto; bottom: -1px; left: 50%; transform: translate(-50%, 0); }
  .lane { grid-template-columns: 30px minmax(0, 1fr); }
  .lane-acts { grid-column: 1 / -1; justify-content: flex-start; }
  .lane-acts .btn { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------------------------------------------------------------- builds */
.side { padding: 1px 6px; border-radius: 99px; border: 1px solid var(--edge-hi); font: 500 11px/1.5 var(--mono); color: var(--ink-3); }
.side.code { border-color: rgba(178, 140, 255, 0.45); color: #c9b2ff; }
.notice.building-now { display: grid; gap: 6px; background: rgba(178, 140, 255, 0.09); border: 1px solid rgba(178, 140, 255, 0.4); color: #ddd0ff; }
.notice.building-now > span { display: flex; align-items: center; gap: 8px; }
.notice.building-now { grid-template-columns: 1fr auto; }
.notice.red { background: rgba(255, 100, 97, 0.09); border: 1px solid rgba(255, 100, 97, 0.45); color: #ffc9c8; }
.spinner { width: 12px; height: 12px; flex: none; border-radius: 50%; border: 2px solid rgba(201, 178, 255, 0.3); border-top-color: #c9b2ff; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
body.building .lane-acts .btn, body.building [data-act="rebuild"] { opacity: 0.45; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
