/* ─────────────────────────────────────────────────
   Deployer

   Quiet by default: near-black neutrals, hairline
   borders, and colour only where it carries meaning.
   Status has one palette everywhere; each part of
   the pipeline has a muted hue of its own.
   ───────────────────────────────────────────────── */
:root {
  --bg: #161b26;
  --surface: #1c2230;
  --surface-2: #222938;
  --surface-3: #293142;
  --border: #2b3343;
  --border-strong: #3a4458;
  --text: #e9edf4;
  --text-2: #a6b0c2;
  --text-3: #717c91;

  --ok: #4fb286;
  --ok-rgb: 79, 178, 134;
  --run: #79a8ff;
  --run-rgb: 121, 168, 255;
  --bad: #e5626a;
  --bad-rgb: 229, 98, 106;
  --wait: #d6a24e;
  --wait-rgb: 214, 162, 78;
  --idle: #717c91;
  --idle-rgb: 113, 124, 145;

  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  color-scheme: dark;
}

.lane-setup { --hue: #8590a5; }
.lane-build { --hue: #8e9cf2; }
.lane-staging { --hue: #b09ae8; }
.lane-production { --hue: #d9aa6c; }
.lane-florence { --hue: #d993b2; }
.lane-rover { --hue: #6fbfae; }
.lane-dashboard { --hue: #7db6d6; }

.s-queued, .s-waiting { --s: var(--wait); --s-rgb: var(--wait-rgb); }
.s-running { --s: var(--run); --s-rgb: var(--run-rgb); }
.s-succeeded { --s: var(--ok); --s-rgb: var(--ok-rgb); }
.s-failed, .s-interrupted { --s: var(--bad); --s-rgb: var(--bad-rgb); }
.s-skipped, .s-cancelled, .s-superseded { --s: var(--idle); --s-rgb: var(--idle-rgb); }

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  font: 14px/1.5 var(--font-sans);
  font-feature-settings: "cv11", "ss01";
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
main { max-width: 1280px; margin: 0 auto; padding: 4px 32px 80px; }
.mono { font-family: var(--font-mono); font-size: 12px; }

/* ─────────────────────────────────────────────────
   Bar
   ───────────────────────────────────────────────── */
.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 32px;
  background: rgba(22, 27, 38, 0.85);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; letter-spacing: -0.01em; text-decoration: none; }
.brand-mark { width: 22px; height: 22px; color: var(--text); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 10px 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--s, var(--idle)); }
.pill.s-running::before { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

.actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.actions form { margin: 0; }
body:not(.is-paused) [data-pause="on"], body.is-paused [data-pause="off"] { display: none; }

.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 13px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: 500 13px var(--font-sans);
  cursor: pointer;
  list-style: none;
  transition: background 0.15s, border-color 0.15s;
}
.button::-webkit-details-marker { display: none; }
.button:hover { background: var(--surface-3); border-color: #4a5570; }
.button-primary { border-color: var(--text); background: var(--text); color: var(--bg); }
.button-primary:hover { background: #fff; border-color: #fff; }
.button-warn { color: var(--wait); border-color: rgba(var(--wait-rgb), 0.45); }
.button-danger { color: var(--bad); border-color: rgba(var(--bad-rgb), 0.45); }

.menu { position: relative; }
.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  display: grid;
  gap: 8px;
  width: 280px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  box-shadow: 0 16px 40px -12px rgba(5, 8, 15, 0.7);
}
.menu-panel p { margin: 0 0 4px; color: var(--text-2); font-size: 12.5px; }
.menu-panel .button { width: 100%; justify-content: center; }

/* ─────────────────────────────────────────────────
   Hero
   ───────────────────────────────────────────────── */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 24px;
  margin: 18px 0 20px;
  padding: 4px 2px 22px;
  border-bottom: 1px solid var(--border);
}
.hero-eyebrow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; color: var(--text-3); font-size: 12.5px; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px 2px 6px;
  border-radius: 999px;
  background: rgba(var(--s-rgb), 0.12);
  color: var(--s);
  font-size: 12px;
  font-weight: 600;
}
.badge-icon { display: grid; place-items: center; width: 14px; height: 14px; }
.badge-icon svg { width: 12px; height: 12px; }
.s-running .badge-icon svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hero h1 { margin: 0; font-size: clamp(1.35rem, 2.6vw, 1.9rem); line-height: 1.2; font-weight: 600; letter-spacing: -0.025em; overflow-wrap: anywhere; }
.hero h1 a { text-decoration: none; }
.hero h1 a:hover { text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 4px; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 10px; color: var(--text-2); font-size: 13px; }
.meta a { text-decoration: none; }
.meta a:hover { color: var(--text); }
.chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-2);
  font: 500 12px var(--font-mono);
  white-space: nowrap;
}

.clock { text-align: right; }
.clock-value { font: 500 clamp(1.8rem, 4vw, 2.6rem)/1 var(--font-mono); letter-spacing: -0.04em; color: var(--text); font-variant-numeric: tabular-nums; }
.s-running .clock-value { color: var(--run); }
.clock-label { margin-top: 6px; color: var(--text-3); font-size: 12px; }
.hero-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.hero-actions form { margin: 0; }

/* ─────────────────────────────────────────────────
   The map
   ───────────────────────────────────────────────── */
.map-frame {
  position: relative;
  border-radius: 14px;
  border: 1px solid var(--border);
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.055) 1px, transparent 1.2px) 0 0 / 22px 22px,
    var(--surface);
  overflow: hidden;
}
.map-scroll { position: relative; overflow-x: auto; scrollbar-width: thin; }
.map {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 44px;
  width: max-content;
  min-width: 100%;
  padding: 30px 28px;
}
.map-empty { padding: 48px; text-align: center; color: var(--text-3); }
.map-col { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 12px; }
.map-col-setup { gap: 8px; }
.wires { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; overflow: visible; pointer-events: none; }
.wire { fill: none; stroke: var(--border-strong); stroke-width: 1.25; transition: stroke 0.4s, opacity 0.3s; }
.wire.s-succeeded { stroke: rgba(var(--ok-rgb), 0.45); }
.wire.s-running { stroke: rgba(var(--run-rgb), 0.8); stroke-width: 1.5; }
.wire.s-failed { stroke: rgba(var(--bad-rgb), 0.6); }
.wire.s-skipped, .wire.s-cancelled { stroke-dasharray: 3 5; opacity: 0.6; }
.map.focusing .wire:not(.lit) { opacity: 0.2; }
.wire.lit { stroke-width: 2; }
.particle { fill: var(--run); }

.node {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 168px;
  padding: 9px 11px 9px 13px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  text-align: left;
  color: var(--text);
  font: inherit;
  overflow: hidden;
  transition: border-color 0.2s, background 0.2s, opacity 0.3s;
}
.node::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--hue); opacity: 0.85; }
.node:hover { border-color: var(--border-strong); background: var(--surface-3); }
.node.selected { border-color: #56627e; background: var(--surface-3); }
.node-setup { width: 132px; padding: 7px 10px 7px 12px; }
.node-icon {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: var(--s);
  border: 1.5px solid var(--s);
}
.node-icon svg { width: 10px; height: 10px; }
.node-name { font-weight: 500; font-size: 13px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-meta { font: 400 11.5px var(--font-mono); color: var(--text-3); font-variant-numeric: tabular-nums; }
.node.s-waiting .node-icon { border-color: var(--border-strong); color: var(--text-3); }
.node.s-waiting .node-name { color: var(--text-2); }
.node.s-skipped, .node.s-cancelled { opacity: 0.45; }
.node.s-skipped .node-icon, .node.s-cancelled .node-icon { border-color: var(--border-strong); }
.node.s-succeeded .node-icon { background: rgba(var(--ok-rgb), 0.16); border-color: transparent; }
.node.s-failed { border-color: rgba(var(--bad-rgb), 0.55); }
.node.s-failed .node-icon { background: rgba(var(--bad-rgb), 0.16); border-color: transparent; }
.node.s-running { border-color: rgba(var(--run-rgb), 0.6); }
.node.s-running .node-icon { border-color: rgba(var(--run-rgb), 0.25); border-top-color: var(--run); animation: spin 0.9s linear infinite; }
.node.s-running .node-icon svg { display: none; }
.node.s-running .node-meta { color: var(--run); }
.node.s-running::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--run), transparent);
  background-size: 50% 100%;
  background-repeat: no-repeat;
  animation: scan 1.6s ease-in-out infinite;
}
@keyframes scan { from { background-position: -50% 0; } to { background-position: 150% 0; } }

/* ─────────────────────────────────────────────────
   Log
   ───────────────────────────────────────────────── */
.log {
  margin-top: 20px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #121723;
  overflow: hidden;
}
.log-tabs { display: flex; gap: 2px; padding: 8px; overflow-x: auto; border-bottom: 1px solid var(--border); background: var(--surface); scrollbar-width: none; }
.log-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-3);
  font: 500 12.5px var(--font-sans);
  white-space: nowrap;
  cursor: pointer;
}
.log-tab::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--s, var(--idle)); }
.log-tab:hover { color: var(--text-2); background: var(--surface-2); }
.log-tab.selected { color: var(--text); background: var(--surface-3); }
.log-body {
  height: 440px;
  margin: 0;
  padding: 14px 18px 22px;
  overflow: auto;
  font: 12px/1.7 var(--font-mono);
  color: #c7cfdc;
  white-space: pre-wrap;
  word-break: break-word;
}
.log-body .err { color: #f0868c; }
.log-body .good { color: #7cc9a3; }
.log-body .head { color: var(--text); font-weight: 600; }
.log-body:empty::before { content: "Nothing written yet."; color: var(--text-3); }
.cursor { display: inline-block; width: 7px; height: 14px; margin-left: 2px; background: var(--text-3); vertical-align: -2px; animation: pulse 1s steps(2) infinite; }

/* ─────────────────────────────────────────────────
   Queue, rhythm and history
   ───────────────────────────────────────────────── */
.section-title { display: flex; align-items: baseline; gap: 10px; margin: 36px 0 12px; font-size: 13px; font-weight: 600; color: var(--text); }
.section-title small { font-weight: 400; color: var(--text-3); }

.queue { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.queue-card {
  flex: none;
  width: 280px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px dashed var(--border-strong);
  background: var(--surface);
  text-decoration: none;
}
.queue-card:hover { border-color: #4a5570; }
.queue-card strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.queue-card .meta { margin-top: 6px; font-size: 12px; }

.rhythm { display: flex; align-items: flex-end; gap: 5px; height: 72px; padding: 12px 14px 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); }
.rhythm a {
  flex: 1 1 0;
  min-width: 4px;
  max-width: 14px;
  height: calc(8% + var(--h) * 92%);
  border-radius: 2px;
  background: var(--s);
  opacity: 0.55;
  transition: opacity 0.15s;
}
.rhythm a:hover { opacity: 1; }

.history { border-top: 1px solid var(--border); }
.row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 16px;
  padding: 11px 6px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  transition: background 0.15s;
}
.row:hover { background: var(--surface); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--s); }
.row.s-running .dot { animation: pulse 1.4s ease-in-out infinite; }
.row-title { min-width: 0; }
.row-title strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.row-title span { color: var(--text-3); font-size: 12.5px; }
.row-when { color: var(--text-3); font-size: 12.5px; text-align: right; white-space: nowrap; min-width: 72px; }
.row-duration { font: 12px var(--font-mono); color: var(--text-2); min-width: 56px; text-align: right; }

.banner {
  margin: 14px 0 0;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(var(--wait-rgb), 0.35);
  background: rgba(var(--wait-rgb), 0.07);
  color: var(--text-2);
  font-size: 13px;
}
.banner strong { color: var(--wait); font-weight: 600; }

@media (max-width: 760px) {
  main { padding: 4px 16px 60px; }
  .bar { flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
  .actions { width: 100%; margin: 0; overflow-x: auto; }
  .hero { grid-template-columns: 1fr; gap: 14px; }
  .clock { text-align: left; }
  .hero-actions { justify-content: flex-start; }
  .map { gap: 34px; padding: 22px; }
  .row { grid-template-columns: 10px minmax(0, 1fr) auto; }
  .row-chip, .row-duration { display: none; }
  .log-body { height: 320px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

.sign-in { display: grid; justify-items: center; gap: 16px; padding: 96px 0; color: var(--text-2); }
