/* ---- Runyard brand system ----
 * Public product name: Runyard
 * Tagline: Self-hosted control plane for agent runs
 * Palette: ink + off-white, signal green/amber/red for run states, one blue accent.
 * Internal package/bin names keep the `smithers-hub` prefix for backwards compatibility.
 */
:root {
  --ink: #15191f;
  --ink-soft: #1f2630;
  --off-white: #f6f5ef;
  --muted: #637083;
  --line: #d9e0ea;
  --panel: #ffffff;
  --soft: #f4f7fb;
  --brand: #1f6f4a;          /* Runyard signal green (primary action) */
  --brand-2: #2563eb;        /* Single blue accent for links/highlights */
  --warn: #b45309;           /* Signal amber */
  --danger: #b91c1c;         /* Signal red */
  --ok: #15803d;             /* Signal green for status pills */
  --brand-tint: #e7f6ef;     /* Soft tint for hover/active states */
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--off-white);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
.button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

button.primary,
.button.primary {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

button.danger {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}

button.warning {
  color: #fff;
  background: var(--warn);
  border-color: var(--warn);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 6px;
  min-height: 38px;
  padding: 8px 10px;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

pre,
code {
  font-family: "SFMono-Regular", Consolas, monospace;
}

.topbar {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-weight: 760;
  letter-spacing: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

/* Runyard brand mark — pure CSS, no image dependency.
 * A rounded ink tile with two signal stripes (green + amber) reading
 * as a stylised "R" without a glyph. Scales with font-size. */
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background:
    linear-gradient(180deg, transparent 0 40%, var(--brand) 40% 58%, transparent 58% 70%, var(--warn) 70% 86%, transparent 86%) center/76% 100% no-repeat,
    var(--ink);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  flex: 0 0 auto;
}

.brand-name {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 18px;
  font-weight: 760;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-transform: lowercase;
  white-space: nowrap;
}

.brand-pill {
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--soft);
  white-space: nowrap;
}

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mobile-primary-nav {
  display: none;
}

.mobile-primary-nav a {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 6px;
  min-height: 44px;
  padding: 8px 12px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.mobile-primary-nav a.active {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-tint);
}

.nav button,
.nav a {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 14px;
}

.admin-label-short,
.mobile-menu-only {
  display: none;
}

.shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: calc(100vh - 58px);
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #eaf1ed;
  padding: 16px;
}

.sidebar button {
  width: 100%;
  justify-content: flex-start;
  margin-bottom: 7px;
}

.sidebar button.active {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-tint);
}

.content {
  padding: 22px;
  min-width: 0;
}

.hero {
  min-height: 92vh;
  display: grid;
  align-items: end;
  background:
    linear-gradient(rgba(10, 20, 28, 0.14), rgba(10, 20, 28, 0.72)),
    url("/public/hub-hero.svg") center/cover no-repeat;
  color: #fff;
  padding: 32px;
}

.hero-inner {
  max-width: 940px;
  padding-bottom: 7vh;
}

.hero h1 {
  font-size: clamp(42px, 7vw, 92px);
  line-height: 0.95;
  margin: 0 0 18px;
  letter-spacing: 0;
}

.hero p {
  font-size: 20px;
  line-height: 1.55;
  max-width: 760px;
  margin: 0 0 24px;
}

.band {
  padding: 52px 32px;
}

.band-inner {
  max-width: 1120px;
  margin: 0 auto;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
}

.item,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.item h3,
.panel h2,
.panel h3 {
  margin: 0 0 8px;
}

.muted {
  color: var(--muted);
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.toolbar h1 {
  margin: 0;
  font-size: 28px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.breadcrumbs {
  margin: -4px 0 12px;
  font-size: 13px;
  min-width: 0;
}

.breadcrumbs ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  max-width: 100%;
  overflow: hidden;
}

.breadcrumbs li {
  display: flex;
  align-items: center;
  min-width: 0;
  color: var(--muted);
}

.breadcrumbs li:first-child {
  flex: 0 0 auto;
}

.breadcrumbs li + li::before {
  content: "/";
  color: var(--muted);
  margin: 0 7px;
  flex: 0 0 auto;
}

.breadcrumbs a,
.breadcrumbs span {
  color: var(--muted);
  display: inline-block;
  max-width: min(30vw, 260px);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
  white-space: nowrap;
}

.breadcrumbs a:hover {
  color: var(--brand);
  text-decoration: underline;
}

.breadcrumbs [aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
  max-width: min(42vw, 420px);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.stat strong {
  display: block;
  font-size: 26px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.table th,
.table td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

.table th {
  background: #eef3f8;
  color: #334155;
}

.status {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  background: #fff;
}

.status.succeeded,
.status.approved,
.status.online {
  color: var(--ok);
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.status.failed,
.status.error,
.status.rejected,
.status.cancelled {
  color: var(--danger);
  border-color: #fecaca;
  background: #fef2f2;
}

.status.running,
.status.queued,
.status.pending,
.status.waiting_approval {
  color: var(--warn);
  border-color: #fed7aa;
  background: #fffbeb;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 16px;
  align-items: start;
}

.timeline {
  display: grid;
  gap: 8px;
}

.event {
  border-left: 3px solid var(--brand-2);
  padding: 8px 10px;
  background: #fff;
  overflow-wrap: anywhere;
}

.event time {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.json {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #101820;
  color: #dbeafe;
  border-radius: 8px;
  padding: 12px;
  max-height: 460px;
  overflow: auto;
}

.form-grid {
  display: grid;
  gap: 10px;
}

.form-grid label {
  display: grid;
  gap: 5px;
  color: #334155;
  font-size: 14px;
}

.login {
  min-height: calc(100vh - 58px);
  display: grid;
  place-items: center;
  padding: 22px;
}

.login .panel {
  width: min(520px, 100%);
}

.hidden {
  display: none !important;
}

/* Toasts */
.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 8px;
  z-index: 100;
}

.toast {
  min-width: 220px;
  max-width: 360px;
  padding: 11px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  box-shadow: 0 6px 20px rgba(15, 25, 35, 0.16);
  font-size: 14px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: var(--ok);
}

.toast.error {
  border-color: #fecaca;
  background: #fef2f2;
  color: var(--danger);
}

/* Empty states */
.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 22px;
  text-align: center;
}

.empty p {
  margin: 0 0 6px;
}

.empty p:last-child {
  margin-bottom: 0;
}

/* Form helpers */
.field-hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.req {
  color: var(--danger);
}

.field-error {
  color: var(--danger);
  font-size: 12px;
  min-height: 0;
}

.field-error:empty {
  display: none;
}

label.inline {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

label.inline input {
  width: auto;
}

.notice {
  border: 1px solid #fed7aa;
  background: #fffbeb;
  color: var(--warn);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 12px;
  font-size: 14px;
}

details.advanced {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--soft);
}

details.advanced summary {
  cursor: pointer;
  font-size: 14px;
  color: #334155;
}

details.advanced[open] summary {
  margin-bottom: 8px;
}

.copy-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.copy-row input {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  flex: 1;
  min-width: 0;
}

/* ---- Inline "copy share link" button (🔗) used across views ---- */
.share-link {
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--muted);
  border-radius: 999px;
  min-height: 24px;
  padding: 0 7px;
  font-size: 13px;
  line-height: 1;
  margin-left: 6px;
  cursor: pointer;
  vertical-align: middle;
}

.share-link:hover {
  color: var(--brand);
  border-color: var(--brand);
  background: var(--brand-tint);
}

.deep-link-hint {
  margin: -6px 0 12px;
  font-size: 13px;
}

/* Briefly highlight an item that was opened via deep link. */
.link-focus {
  outline: 2px solid var(--brand-2);
  outline-offset: 2px;
  transition: outline-color 0.3s ease;
  border-radius: 8px;
}

/* Mono pill for showing the absolute share URL inline. */
.kbd {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 6px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.artifact-dl {
  font-size: 11px;
  text-decoration: underline;
}

/* ---- Top-right Admin dropdown menu ---- */
.admin-menu {
  position: relative;
}

.admin-menu > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.admin-menu > summary::-webkit-details-marker {
  display: none;
}

.admin-menu[open] > summary {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-tint);
}

.admin-menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(15, 25, 35, 0.18);
  padding: 6px;
  display: grid;
  gap: 2px;
  min-width: 180px;
  z-index: 30;
}

.admin-menu-list button,
.admin-menu-list a {
  width: 100%;
  justify-content: flex-start;
  border-color: transparent;
  background: transparent;
  min-height: 34px;
  color: var(--ink);
  text-decoration: none;
  border-radius: 6px;
  padding: 8px 10px;
}

.admin-menu-list button:hover,
.admin-menu-list a:hover {
  background: var(--soft);
  border-color: var(--line);
}

/* ---- Workflow detail: tabs, code viewer, ReactFlow graph host ---- */
.workflow-tabs {
  margin-top: 6px;
}

.workflow-tab-body {
  margin-top: 4px;
}

.subtabs {
  display: inline-flex;
  margin: 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.subtabs .tab {
  min-height: 30px;
  padding: 4px 10px;
  font-size: 13px;
}

.workflow-code-panel,
.workflow-graph-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.workflow-code-header,
.workflow-graph-header,
.workflow-runs-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.workflow-code-actions,
.workflow-graph-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.workflow-code-host {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafafa;
  overflow: hidden;
  max-height: 70vh;
}

.workflow-code {
  margin: 0;
  padding: 16px;
  overflow: auto;
  max-height: 70vh;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
  font-family: "SFMono-Regular", Consolas, monospace;
  white-space: pre;
}

.workflow-code-host code.hljs {
  background: transparent;
  padding: 0;
}

.workflow-graph-host {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  min-height: 460px;
  height: clamp(420px, 60vh, 720px);
  display: grid;
  align-items: stretch;
  justify-items: stretch;
  position: relative;
  overflow: hidden;
}

.workflow-graph-host.workflow-graph-mounted {
  background: #ffffff;
}

.workflow-graph-host .workflow-graph-loading {
  align-self: center;
  justify-self: center;
}

.workflow-graph-canvas {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  min-height: 420px;
}

.workflow-graph-canvas .react-flow {
  min-height: 420px;
}

.workflow-graph-side {
  align-self: stretch;
  min-width: 180px;
  max-width: 220px;
  padding: 14px;
  border-left: 1px solid var(--line);
  background: var(--soft);
  overflow: auto;
  font-size: 13px;
}

.workflow-graph-side ul {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: grid;
  gap: 6px;
}

.graph-side-pill {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 12px;
  width: fit-content;
}

.graph-side-agent { border-color: #c4b5fd; color: #4338ca; }
.graph-side-skill { border-color: #93c5fd; color: #1d4ed8; }
.graph-side-tag { border-color: #fcd34d; color: #92400e; }

.graph-fallback-note {
  margin: 8px 0 0;
}

.workflow-graph-static {
  width: 100%;
  height: auto;
  max-height: 70vh;
  background: #fff;
  border-radius: 8px;
}

.workflow-graph-canvas .react-flow__attribution {
  display: none;
}

/* ---- Tabs (Agents sub-nav, workflow tabs) ---- */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.tabs .tab {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 8px 14px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  min-height: 38px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tabs .tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

.tabs .tab:hover {
  color: var(--ink);
}

.agents-blurb {
  margin: 0 0 14px;
}

/* ---- Section heading (above run grids on home) ---- */
.section-heading {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 20px 0 10px;
  font-weight: 600;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.section-heading .muted {
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

.run-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 14px;
  margin: 0;
}

.home-stats {
  margin-bottom: 6px;
}

/* ---- Run cards (Runs home view) ---- */
.run-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}

.run-grid.live .run-card.active {
  animation: card-rise 0.4s ease-out;
}

.run-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 4px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  display: grid;
  gap: 8px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.run-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(15, 25, 35, 0.08);
}

.run-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.run-card-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.run-card-title {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.run-card-title a {
  text-decoration: none;
}

.run-card-title a:hover {
  color: var(--brand);
}

.run-card-sub,
.run-origin-detail {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.run-origin,
.run-origin-detail strong {
  color: #475569;
}

.run-origin::before {
  content: "from ";
  color: var(--muted);
}

.run-step {
  margin: 0;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.run-card.active {
  border-color: #fed7aa;
  border-top-color: var(--warn);
  background: linear-gradient(180deg, #fffbeb, #ffffff 70%);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.10);
}

.run-card.active.running {
  border-color: #bbf7d0;
  border-top-color: var(--ok);
  background: linear-gradient(180deg, #ecfdf5, #ffffff 70%);
  box-shadow: 0 4px 16px rgba(21, 128, 61, 0.10);
}

.run-card.active.waiting_approval {
  border-color: #fcd34d;
  background: linear-gradient(180deg, #fef3c7, #ffffff 70%);
}

.run-card.done {
  background: var(--panel);
}

.run-card.done.failed,
.run-card.done.error,
.run-card.done.cancelled,
.run-card.done.rejected {
  border-color: #fecaca;
  border-top-color: var(--danger);
  background: linear-gradient(180deg, #fef2f2, #ffffff 64%);
}

.run-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--warn);
  display: inline-block;
  box-shadow: 0 0 0 0 currentColor;
  animation: run-pulse 1.4s ease-out infinite;
}

.run-card.active.running .run-pulse {
  background: var(--ok);
  color: var(--ok);
}

.run-card.active.waiting_approval .run-pulse {
  background: var(--warn);
  color: var(--warn);
}

@keyframes run-pulse {
  0% { transform: scale(0.92); opacity: 1; }
  70% { transform: scale(1.3); opacity: 0.35; }
  100% { transform: scale(0.92); opacity: 1; }
}

@keyframes card-rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.run-folder {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  color: var(--muted);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 8px;
  overflow-wrap: anywhere;
  max-width: 100%;
}

.run-folder-icon {
  font-size: 14px;
}

.run-folder-banner {
  margin: 0 0 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.run-card-foot {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.run-card-foot .button {
  min-height: 30px;
  padding: 4px 10px;
  font-size: 13px;
}

.artifact-list {
  margin: 4px 0 0;
  padding-left: 18px;
  font-size: 13px;
  display: grid;
  gap: 2px;
}

/* ---- Pills (skills/agents/tools) + chips (project/branch/version) ---- */
.pills {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.pills .pill {
  background: var(--brand-tint);
  border: 1px solid #b7e7df;
  color: var(--brand);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  line-height: 1.6;
}

.pills .pill a {
  color: inherit;
  text-decoration: none;
}

.pills .pill a:hover {
  text-decoration: underline;
}

.pills .pill.tag {
  background: var(--soft);
  border-color: var(--line);
  color: var(--ink);
}

.pill-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 0;
  flex-wrap: wrap;
}

.pill-label {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  min-width: 70px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--soft);
  border: 1px solid var(--line);
  color: var(--ink);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip-project {
  background: #ecfeff;
  border-color: #bae6fd;
  color: #0369a1;
}

.chip-branch {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.chip-version {
  background: #f5f3ff;
  border-color: #ddd6fe;
  color: #5b21b6;
}

.chip-runner {
  background: #fef3c7;
  border-color: #fde68a;
  color: #92400e;
}

.chip-queue {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}

.chip-queue.empty {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

/* ---- Runner pool / capacity affordances ---- */
.runner-pool-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px 0;
}

.runner-capacity {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}

.runner-capacity.saturated .runner-capacity-count {
  color: var(--danger);
  font-weight: 600;
}

.runner-slots {
  display: inline-flex;
  gap: 3px;
}

.runner-slot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: #e5e7eb;
  border: 1px solid #d1d5db;
}

.runner-slot.filled {
  background: var(--ok, #16a34a);
  border-color: #15803d;
}

/* ---- Queued run banner on cards / detail ---- */
.run-card.queued {
  border-color: #fed7aa;
  border-top-color: #f59e0b;
  background: linear-gradient(180deg, #fff7ed, #ffffff 70%);
}

.run-queue-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 13px;
}

.run-queue-icon {
  font-size: 16px;
}

.run-queue-text {
  font-weight: 600;
}

.run-queue-detail {
  font-size: 12px;
}

.run-card-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 2px 0 0;
}

.run-card-title a {
  text-decoration: none;
}

.run-card-title a:hover {
  color: var(--brand);
  text-decoration: underline;
}

.run-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  /* 2-line clamp keeps each card compact while giving substance. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.run-meta {
  margin: 0;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

.run-meta .run-step {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1 1 auto;
}

.run-meta .run-timing {
  flex: 0 0 auto;
  color: var(--muted);
  white-space: nowrap;
}

.run-cap-link {
  font-size: 12px;
  color: var(--brand);
  text-decoration: none;
  background: var(--brand-tint);
  border: 1px solid #b7e7df;
  border-radius: 6px;
  padding: 1px 6px;
}

.run-cap-link:hover {
  text-decoration: underline;
}

/* ---- Run detail header sub-row ---- */
.run-detail-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: -8px 0 8px;
  font-size: 13px;
}

.run-detail-desc {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.5;
  /* 2-line clamp for the descriptive paragraph. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.run-detail-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
}

.run-id-mono {
  display: inline-block;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
  color: var(--muted);
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* ---- Workflow card (list) + detail page ---- */
.workflow-card .workflow-desc {
  margin: 0 0 6px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.workflow-card .workflow-meta {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--muted);
}

.workflow-detail-desc {
  font-size: 15px;
  line-height: 1.5;
  margin: -8px 0 6px;
}

.workflow-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 13px;
  align-items: center;
}

.wf-run-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.wf-run-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.wf-run-row .wf-run-title {
  flex: 1 1 60%;
  text-decoration: none;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.wf-run-row .wf-run-title:hover {
  color: var(--brand);
  text-decoration: underline;
}

.wf-run-row .wf-run-when {
  font-size: 12px;
}

/* ---- Agent cards ---- */
.agent-card .agent-desc {
  margin: 0 0 6px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- Approval inbox + detail ---- */
.approval-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.approval-card {
  display: grid;
  gap: 8px;
}

.approval-card h3 {
  margin: 0;
  overflow-wrap: anywhere;
}

.approval-card h3 a {
  text-decoration: none;
}

.approval-card h3 a:hover {
  color: var(--brand);
  text-decoration: underline;
}

.approval-card-head,
.approval-detail-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.approval-card-desc {
  margin: 0;
  line-height: 1.45;
}

.approval-card-meta,
.approval-detail-sub {
  margin: 0;
  font-size: 13px;
}

.approval-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 16px;
  align-items: start;
}

.approval-description {
  margin: 0 0 12px;
  line-height: 1.55;
}

.approval-proposed-change {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.approval-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.approval-facts p {
  margin: 0;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  overflow-wrap: anywhere;
}

.approval-run-id {
  display: inline-block;
  margin-left: 6px;
  overflow-wrap: anywhere;
}

.approval-decision {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.approval-decision label {
  display: grid;
  gap: 5px;
  color: #334155;
  font-size: 14px;
}

.approval-resolved {
  border: 1px solid var(--line);
  background: var(--soft);
  border-radius: 8px;
  padding: 12px;
}

.approval-side .json {
  max-height: 520px;
}

/* ---- Mobile tweaks for the new dense layouts ---- */
@media (max-width: 640px) {
  .breadcrumbs li + li::before {
    margin: 0 5px;
  }

  .breadcrumbs a,
  .breadcrumbs span {
    max-width: 28vw;
  }

  .breadcrumbs [aria-current="page"] {
    max-width: 38vw;
  }

  .pill-label {
    min-width: 56px;
  }

  .run-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .wf-run-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .wf-run-row .wf-run-title {
    white-space: normal;
  }
}

/* ---- Tablet / phone: stack the console and move primary nav into the topbar ---- */
@media (max-width: 850px) {
  .shell,
  .split,
  .approval-detail-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .content {
    padding: 16px;
  }

  /* Topbar may need to breathe; let it grow rather than clip. */
  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    height: auto;
    min-height: 58px;
    padding: 8px 16px;
    gap: 8px 10px;
  }

  .brand {
    min-width: 0;
  }

  .nav {
    justify-self: end;
    flex-wrap: nowrap;
    gap: 6px;
  }

  .nav .support-link {
    display: none;
  }

  .admin-label-full {
    display: none;
  }

  .admin-label-short,
  .mobile-menu-only {
    display: inline-flex;
  }

  .mobile-primary-nav {
    display: flex;
    grid-column: 1 / -1;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }

  .mobile-primary-nav a {
    flex: 1 0 auto;
    min-width: 96px;
  }

  /* Touch-friendly targets. */
  button,
  .button,
  .nav button,
  .nav a,
  .mobile-primary-nav a,
  input,
  select {
    min-height: 44px;
  }

  .toolbar h1 {
    font-size: 22px;
    overflow-wrap: anywhere;
    min-width: 0;
  }

  .toolbar-actions {
    width: 100%;
  }

  /* Landing: dial the marketing hero down to phone scale. */
  .hero {
    min-height: 78vh;
    padding: 20px;
  }

  .hero h1 {
    font-size: clamp(34px, 11vw, 64px);
  }

  .hero p {
    font-size: 16px;
  }

  .band {
    padding: 28px 16px;
  }

  /* Toasts span the bottom of the viewport instead of a fixed 360px card. */
  .toasts {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  .toast {
    max-width: none;
  }

  /* Admin dropdown: keep it inside the viewport, full-width on tiny screens. */
  .admin-menu-list {
    right: 0;
    left: auto;
    max-width: calc(100vw - 32px);
  }

  /* Run grid: single column on phones so cards keep readable width. */
  .run-grid {
    grid-template-columns: 1fr;
  }

  /* Workflow detail tabs: stack the visual graph side rail under the canvas. */
  .workflow-graph-canvas {
    grid-template-columns: minmax(0, 1fr);
  }

  .workflow-graph-side {
    border-left: 0;
    border-top: 1px solid var(--line);
    max-width: none;
  }

  .workflow-code-host,
  .workflow-code {
    max-height: 60vh;
  }
}

/* ---- Phone: data tables become stacked, labeled cards (no horizontal overflow) ---- */
@media (max-width: 640px) {
  .table {
    border: 0;
    background: transparent;
  }

  .table thead {
    display: none;
  }

  .table,
  .table tbody {
    display: block;
    width: 100%;
  }

  .table tr {
    display: block;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    margin-bottom: 10px;
    padding: 4px 0;
  }

  .table td {
    display: block;
    border: 0;
    padding: 6px 12px;
    overflow-wrap: anywhere;
  }

  .table td:empty {
    display: none;
  }

  .table td::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
  }

  /* Cells with no label (action buttons) shouldn't reserve an empty label line. */
  .table td:not([data-label])::before {
    content: none;
  }
}

/* ---- Failure / cancellation diagnostics ---------------------------------- */
.run-reason-hint {
  margin: 6px 0 4px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--danger);
  font-size: 13px;
  display: flex;
  gap: 6px;
  align-items: flex-start;
  overflow-wrap: anywhere;
}

.run-reason-hint span {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.run-card.active.waiting_approval .run-reason-hint {
  background: #fffbeb;
  border-color: #fed7aa;
  color: var(--warn);
}

.diagnostics-panel {
  border-left: 4px solid var(--danger);
  background: linear-gradient(180deg, #fef2f2, #ffffff 70%);
  margin-bottom: 16px;
}

.diagnostics-panel.diagnostics-waiting_approval {
  border-left-color: var(--warn);
  background: linear-gradient(180deg, #fffbeb, #ffffff 70%);
}

.diagnostics-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.diagnostics-head h2 {
  margin: 0;
}

.diagnostics-intro {
  margin: 4px 0 8px;
}

.diagnostics-headline {
  font-weight: 600;
  font-size: 15px;
  margin: 0 0 12px;
  overflow-wrap: anywhere;
}

.diagnostics-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 12px;
  margin: 0 0 12px;
  font-size: 13px;
}

.diagnostics-facts dt {
  color: var(--muted);
  font-weight: 500;
}

.diagnostics-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.diagnostics-reason,
.diagnostics-logs,
.diagnostics-timeline,
.diagnostics-approval-quote,
.diagnostics-artifacts {
  margin-top: 12px;
}

.diagnostics-reason > summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 4px;
}

.diagnostics-pre {
  background: #0f172a;
  color: #f8fafc;
  border-radius: 8px;
  padding: 10px 12px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 6px 0;
}

.diagnostics-approval-quote blockquote {
  margin: 6px 0;
  padding: 8px 12px;
  border-left: 3px solid var(--warn);
  background: #fffbeb;
  border-radius: 0 8px 8px 0;
  font-size: 13px;
}

.diagnostics-event-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.diagnostics-event-list li {
  display: grid;
  grid-template-columns: 150px 180px 1fr;
  gap: 8px;
  font-size: 12.5px;
  padding: 4px 6px;
  border-radius: 6px;
}

.diagnostics-event-list li:nth-child(odd) {
  background: rgba(15, 23, 42, 0.03);
}

.diagnostics-event-list time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.diagnostics-event-type {
  color: var(--brand);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.diagnostics-event-msg {
  overflow-wrap: anywhere;
}

.diagnostics-logs-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.diagnostics-logs-head h4,
.diagnostics-timeline h4,
.diagnostics-approval-quote h4,
.diagnostics-artifacts h4 {
  margin: 0;
  font-size: 14px;
}

.diagnostics-panel .copy-btn {
  font-size: 12px;
  padding: 2px 8px;
  min-height: 0;
}

@media (max-width: 720px) {
  .diagnostics-event-list li {
    grid-template-columns: 1fr;
  }
}

/* --- Structured run log view ---------------------------------------------- */
.run-log-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin: 12px 0 8px;
}

.run-log-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 0;
}

.run-log-total dt {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.run-log-total dd {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.run-log-total-error dd {
  color: #b91c1c;
}

.run-log-total-warn dd {
  color: #b45309;
}

.run-log-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.run-log-filters {
  display: grid;
  gap: 8px;
  margin: 0 0 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.run-log-search {
  display: flex;
  align-items: center;
  gap: 8px;
}

.run-log-search input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
}

.run-log-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.run-log-chip-label {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.run-log-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  cursor: pointer;
}

.run-log-chip[aria-pressed="true"] {
  background: var(--brand-2);
  color: #fff;
  border-color: var(--brand-2);
}

.run-log-chip-count {
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: inherit;
  opacity: 0.7;
}

.run-log-clear {
  justify-self: end;
  align-self: end;
}

.run-log-noisy-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin: 6px 0;
}

.run-log-section h3 {
  margin: 14px 0 6px;
  font-size: 14px;
}

.run-log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.run-log-list li.run-log-event {
  display: grid;
  grid-template-columns: 170px 200px auto 1fr;
  gap: 8px;
  align-items: baseline;
  padding: 6px 10px;
  border-left: 3px solid var(--line);
  background: #fff;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.run-log-list li.run-log-event time {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.run-log-type {
  font-size: 12px;
  color: #334155;
  background: #eef2ff;
  padding: 1px 6px;
  border-radius: 4px;
  width: max-content;
}

.run-log-node-chip {
  font-size: 11px;
  color: #1e293b;
  background: #fef3c7;
  padding: 1px 6px;
  border-radius: 4px;
  width: max-content;
}

.run-log-msg {
  color: #0f172a;
  white-space: pre-wrap;
}

.run-log-sev-error {
  border-left-color: #dc2626;
}

.run-log-sev-warn {
  border-left-color: #d97706;
}

.run-log-cat-run {
  background: #f0fdf4;
}

.run-log-cat-node {
  background: #f8fafc;
}

.run-log-cat-approval {
  background: #fef3c7;
}

.run-log-cat-agent {
  background: #eff6ff;
}

.run-log-cat-noise {
  opacity: 0.85;
}

.run-log-hidden {
  display: none !important;
}

.run-log-full {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  background: #fff;
}

.run-log-full > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  padding: 4px 0;
}

.run-log-full-list {
  margin-top: 10px;
}

.run-log-event.run-log-noisy {
  background: #f1f5f9;
}

@media (max-width: 720px) {
  .run-log-list li.run-log-event {
    grid-template-columns: 1fr;
  }
}

/* ---- Public landing & docs: Runyard brand surface ---------------------- */
.hero-eyebrow {
  display: inline-block;
  margin: 0 0 18px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.28);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #f1f5f9;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 18px;
}

.hero-foot {
  margin: 0;
  color: #cbd5e1;
  font-size: 13px;
}

.hero-foot code {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  padding: 1px 6px;
  color: #f8fafc;
}

.band-setup {
  background: var(--off-white);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.band-foot {
  padding-top: 28px;
  padding-bottom: 36px;
}

.setup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.setup-step {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  display: grid;
  gap: 8px;
}

.setup-step h3 {
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
}

.setup-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.setup-step pre.json {
  margin: 0;
  max-height: none;
}

.status-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
  background: var(--muted);
}

.status-dot-ok { background: var(--ok); }
.status-dot-warn { background: var(--warn); }
.status-dot-danger { background: var(--danger); }
.status-dot-info { background: var(--brand-2); }

.band-docs h1 {
  margin-top: 28px;
}

.band-docs h1:first-of-type {
  margin-top: 8px;
}

.band-docs h2 {
  margin-top: 28px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.band-docs ul,
.band-docs ol {
  padding-left: 22px;
  line-height: 1.55;
}

.band-docs li + li {
  margin-top: 4px;
}

.docs-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  margin: 0 0 24px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
  font-size: 13px;
}

.docs-toc strong {
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 11px;
}

.docs-toc a {
  color: var(--brand-2);
  text-decoration: none;
  padding: 2px 6px;
  border-radius: 6px;
}

.docs-toc a:hover {
  background: var(--brand-tint);
  color: var(--brand);
}

@media (max-width: 640px) {
  .hero-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-actions .button {
    width: 100%;
    justify-content: center;
  }

  .band-docs h2 {
    padding-top: 14px;
  }
}
