/* Layout and component styles. Component-specific styles live in their Web Component shadow roots. */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--yr-bg);
  color: var(--yr-text);
  font-family: var(--yr-font-body);
  line-height: 1.5;
}

h1, h2, h3 { font-family: var(--yr-font-display); margin: 0 0 0.5em; }
h1 { font-size: var(--yr-font-size-2xl); font-weight: 700; }
h2 { font-size: var(--yr-font-size-xl); font-weight: 600; font-family: var(--yr-font-body); }
h3 { font-size: var(--yr-font-size-lg); font-weight: 600; font-family: var(--yr-font-body); }
code, .mono { font-family: var(--yr-font-mono); font-size: 0.875em; }

a { color: var(--yr-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Top-level shell: top nav, left sidebar, content. */
.shell { display: grid; grid-template-rows: auto 1fr; min-height: 100vh; }
/* nav.topnav (element+class) intentionally outranks the shared
   ui.css `.yr-nav-shell` rule, which loads after app.css and would
   otherwise win at equal specificity and pin the bar back to 52px. */
nav.topnav {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--yr-space-6);
  padding: 0 var(--yr-space-6);
  height: 3.25rem;
  background: var(--yr-surface);
  border-bottom: 1px solid var(--yr-border);
}

.topnav-divider { width: 1px; height: 20px; background: var(--yr-border); margin: 0 var(--yr-space-1); }


/* Search */
.topnav-search {
  position: relative;
  display: flex;
  align-items: center;
  height: 36px; /* match .topnav-actions, whose .topnav-icon children are 36px */
}
/* Descendant selector (0,2,0) outranks the shared ui.css `.yr-search-input`
   (0,1,0) so the topnav search collapses to the bar height without changing
   the component's default padding used in hero/marketplace search. */
.topnav-search .yr-search-input {
  padding-top: 0;
  padding-bottom: 0;
}
.topnav-search-icon {
  position: absolute;
  left: 0.625rem;
  color: var(--yr-text-subtle);
  pointer-events: none;
}
.topnav-search-input {
  width: 100%;
  max-width: 480px;
  padding: var(--yr-space-2) var(--yr-space-3) var(--yr-space-2) var(--yr-space-8);
  border: 1px solid var(--yr-border);
  border-radius: var(--yr-radius-md);
  background: var(--yr-bg);
  font-size: var(--yr-font-size-sm);
  color: var(--yr-text);
  outline: none;
}
.topnav-search-input::placeholder { color: var(--yr-text-disabled); }
.topnav-search-input:focus { border-color: var(--yr-accent); }

/* Action icons */
.topnav-actions { display: flex; align-items: center; gap: var(--yr-space-1); }
.topnav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--yr-radius-md);
  color: var(--yr-text-subtle);
  text-decoration: none;
  transition: background 0.1s, color 0.1s;
}
.topnav-icon:hover { background: var(--yr-border); color: var(--yr-text); }
.topnav-actions form { display: contents; }
button.topnav-icon { background: none; border: none; font: inherit; cursor: pointer; }

.body { display: grid; grid-template-columns: 240px 1fr; }
.sidebar {
  background: var(--yr-bg);
  padding: var(--yr-space-4);
}
.sidebar .group, .settings-nav .group { margin-top: var(--yr-space-4); }
.sidebar .group:first-child, .settings-nav .group:first-child { margin-top: 0; }
.sidebar .group h3, .settings-nav .group h3 {
  font-size: var(--yr-font-size-xs);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--yr-text-subtle);
  font-family: var(--yr-font-body);
  margin: 0 0 var(--yr-space-2);
}
.sidebar a { display: block; padding: var(--yr-space-2) 0; color: var(--yr-text-muted); }
.sidebar a.active { color: var(--yr-text); font-weight: 500; }

.sidebar-section {
  display: flex;
  flex-direction: column;
  padding-bottom: var(--yr-space-4);
  margin-bottom: var(--yr-space-4);
  border-bottom: 1px solid var(--yr-border);
}
.sidebar-section .sidebar-section-link {
  border-radius: var(--yr-radius-md);
  padding: var(--yr-space-2) var(--yr-space-3);
  font-size: var(--yr-font-size-md);
  font-weight: 500;
  color: var(--yr-text-muted);
  text-decoration: none;
}
.sidebar-section .sidebar-section-link:hover {
  background: var(--yr-surface-muted);
  color: var(--yr-text);
  text-decoration: none;
}
.sidebar-section .sidebar-section-link.active {
  background: var(--yr-surface-muted);
  color: var(--yr-text);
  font-weight: 600;
}
.sidebar-section .sidebar-section-sublink {
  padding: var(--yr-space-2) var(--yr-space-3) var(--yr-space-2) var(--yr-space-8);
  font-size: var(--yr-font-size-sm);
  color: var(--yr-text-muted);
  text-decoration: none;
}
.sidebar-section .sidebar-section-sublink:hover { color: var(--yr-accent); text-decoration: none; }

.sidebar-space { margin: var(--yr-space-2) 0; }
.sidebar-space-header {
  background: var(--yr-surface);
  border: 1px solid var(--yr-border);
  border-radius: var(--yr-radius-md);
  padding: var(--yr-space-2) var(--yr-space-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--yr-space-2);
}
.sidebar-space-header .sidebar-space-link {
  color: var(--yr-text-muted);
  font-weight: 500;
  padding: 0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-space-header .sidebar-space-link:hover { color: var(--yr-text); }
.sidebar-space-toggle {
  cursor: pointer;
  border: none;
  background: none;
  padding: var(--yr-space-1);
  margin: -0.25rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebar-space-toggle::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--yr-text-subtle);
  border-bottom: 1.5px solid var(--yr-text-subtle);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}
.sidebar-space.is-open .sidebar-space-toggle::after { transform: rotate(45deg); }
.sidebar-workflows {
  list-style: none;
  margin: var(--yr-space-2) 0 0 var(--yr-space-3);
  padding: 0;
  display: none;
  flex-direction: column;
  gap: var(--yr-space-2);
}
.sidebar-space.is-open .sidebar-workflows { display: flex; }
.sidebar-workflows li:not(.sidebar-empty) {
  background: var(--yr-surface);
  border: 1px solid var(--yr-border);
  border-radius: var(--yr-radius-md);
  padding: var(--yr-space-2);
  display: flex;
  align-items: center;
  gap: var(--yr-space-2);
}
.sidebar-workflows a { color: var(--yr-text-muted); font-size: var(--yr-font-size-sm); }
.sidebar-workflows a:hover { color: var(--yr-accent); }
.sidebar-workflow-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; background: var(--yr-text-subtle); }
.sidebar-workflow-dot.is-active { background: var(--yr-success); }
.sidebar-workflow-dot.is-pending { background: var(--yr-warning); }
.sidebar-workflow-dot.is-stopped { background: var(--yr-danger); }
.sidebar-loading, .sidebar-empty, .sidebar-error {
  color: var(--yr-text-subtle);
  font-size: var(--yr-font-size-sm);
  padding: var(--yr-space-2) 0;
}

.content { padding: var(--yr-space-6) var(--yr-space-8); }

/* SettingsLayout: the shell shared by /organization/* and /settings — its
   own minimal SettingsTopNav (no search box), then a two-column body: a
   nav rail (.settings-nav) on the left, page content on the right — the
   settings-page equivalent of .shell/.body's topnav+sidebar+content grid.
   .settings-nav copies GitHub's settings-page pattern: flat text links
   grouped under uppercase section labels (reusing .group/.group h3 from
   the workspace sidebar), active/hover states are a plain background
   highlight rather than a border or fill color — no cards. */
.settings-shell { min-height: 100vh; }
.settings-back-link {
  color: var(--yr-text-muted);
  font-size: var(--yr-font-size-sm);
  font-weight: 500;
  text-decoration: none;
}
.settings-back-link:hover { color: var(--yr-text); }

/* The main app's .body/.content stretch edge-to-edge under a full-width
   .shell — GitHub's settings pages don't: the header stays full-width, but
   the two-column nav+content area is inset in a centered, max-width block,
   so the nav column sits well clear of the browser edge and the nav/content
   divide lands around a third of the way across, not hugging the left
   edge. .settings-nav/.settings-body .content own no padding of their own
   — .settings-body's padding is the single source of the inset so both
   columns start flush with each other, vertically and horizontally. */
.settings-body {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: var(--yr-space-12);
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--yr-space-12) var(--yr-space-8);
}
.settings-nav { padding: 0; }
.settings-body .content { padding: 0; }
.settings-nav-link {
  display: flex;
  align-items: center;
  gap: var(--yr-space-2);
  border-radius: var(--yr-radius-md);
  padding: var(--yr-space-2) var(--yr-space-3);
  font-size: var(--yr-font-size-md);
  font-weight: 500;
  color: var(--yr-text-muted);
  text-decoration: none;
}
.settings-nav-link svg { flex-shrink: 0; color: var(--yr-text-subtle); }
.settings-nav-link:hover { background: var(--yr-surface-muted); color: var(--yr-text); text-decoration: none; }
.settings-nav-link:hover svg { color: var(--yr-text-muted); }
.settings-nav-link.active {
  background: var(--yr-surface-muted);
  color: var(--yr-text);
  font-weight: 600;
}
.settings-nav-link.active svg { color: var(--yr-accent); }
.settings-nav-link.disabled { color: var(--yr-text-disabled); cursor: default; }
.settings-nav-link.disabled svg { color: var(--yr-text-disabled); }

/* Settings page-head gets a divider under the title (matching GitHub's
   settings pages) — .settings-nav's roomier row padding above needed a
   matching visual anchor on the content side, or the nav reads heavier
   than the forms next to it. */
.settings-body .page-head {
  border-bottom: 1px solid var(--yr-border);
  padding-bottom: var(--yr-space-6);
}



/* Stat counters at top of dashboard */
.stats { display: flex; gap: var(--yr-space-8); margin-bottom: var(--yr-space-6); color: var(--yr-text-muted); }
.stats .stat strong { color: var(--yr-text); font-weight: 600; }
.stats .stat.error strong { color: var(--yr-danger); }

/* Section heading with count */
.section-head {
  display: flex;
  align-items: baseline;
  gap: var(--yr-space-2);
  margin: var(--yr-space-6) 0 var(--yr-space-3);
}
.section-head .count {
  background: var(--yr-surface-muted);
  color: var(--yr-text-muted);
  padding: 0 var(--yr-space-2);
  border-radius: var(--yr-radius-full);
  font-size: var(--yr-font-size-sm);
}

/* Inbox */
.inbox-summary { color: var(--yr-text-muted); margin-bottom: var(--yr-space-6); }
.inbox-summary strong { color: var(--yr-text); }
details.inbox-space { margin-bottom: var(--yr-space-6); }
details.inbox-space > summary {
  cursor: pointer;
  display: flex;
  align-items: baseline;
  gap: var(--yr-space-2);
  font-family: var(--yr-font-display);
  font-size: var(--yr-font-size-lg);
  font-weight: 600;
  margin-bottom: var(--yr-space-2);
}
details.inbox-agent { margin: var(--yr-space-1) 0 var(--yr-space-3) var(--yr-space-4); }
details.inbox-agent > summary {
  cursor: pointer;
  display: flex;
  align-items: baseline;
  gap: var(--yr-space-2);
  color: var(--yr-text-muted);
  font-weight: 500;
  margin-bottom: var(--yr-space-2);
}

/* ID badge shared by inbox items and session cards */
.id-badge {
  display: inline-block;
  background: var(--yr-surface-muted);
  border-radius: var(--yr-radius-sm);
  padding: 2px var(--yr-space-2);
  font-family: var(--yr-font-mono);
  font-size: var(--yr-font-size-sm);
  color: var(--yr-text-muted);
}

/* Session detail */
.detail-head { margin-bottom: var(--yr-space-4); }
.detail-head h1 { margin-bottom: var(--yr-space-1); }
.detail-meta { display: flex; align-items: center; gap: var(--yr-space-2); color: var(--yr-text-subtle); }
.detail-meta .agent-id { font-family: var(--yr-font-mono); font-size: var(--yr-font-size-sm); }

.status-pill {
  display: inline-block;
  border-radius: var(--yr-radius-full);
  padding: 2px var(--yr-space-3);
  font-size: var(--yr-font-size-sm);
  font-weight: 500;
}
.status-pill.is-running { background: var(--yr-success-subtle); color: var(--yr-success); }
.status-pill.is-waiting { background: var(--yr-accent-subtle); color: var(--yr-accent); }
.status-pill.is-error { background: var(--yr-danger-subtle); color: var(--yr-danger); }
.status-pill.is-idle { background: var(--yr-surface-muted); color: var(--yr-text-subtle); border: 1px solid var(--yr-border); }

/* Organization Users table: a deactivated member keeps their row, greyed out. */
tr.is-deactivated > td { color: var(--yr-text-subtle); }


.respond-panel {
  background: var(--yr-surface);
  border: 1px solid var(--yr-accent);
  border-radius: var(--yr-radius-md);
  padding: var(--yr-space-4) var(--yr-space-6);
  margin-bottom: var(--yr-space-6);
}
.respond-panel .request { margin-bottom: var(--yr-space-3); font-weight: 500; }
.respond-panel form { display: flex; gap: var(--yr-space-2); }
.respond-panel input[type="text"] {
  flex: 1;
  border: 1px solid var(--yr-border);
  border-radius: var(--yr-radius-md);
  padding: var(--yr-space-2) var(--yr-space-3);
  font: inherit;
  background: var(--yr-bg);
  color: var(--yr-text);
}
.respond-panel input[type="text"]:focus { outline: 2px solid var(--yr-accent); outline-offset: -1px; }

.btn-primary {
  background: var(--yr-accent);
  color: var(--yr-surface);
  border: none;
  border-radius: var(--yr-radius-md);
  padding: var(--yr-space-2) var(--yr-space-6);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.btn-primary:hover { filter: brightness(1.15); }
.btn-primary[disabled] { opacity: 0.5; cursor: not-allowed; filter: none; }

/* Activity trail */
.node {
  display: flex;
  gap: var(--yr-space-3);
  background: var(--yr-surface);
  border: 1px solid var(--yr-border);
  border-radius: var(--yr-radius-md);
  padding: var(--yr-space-3) var(--yr-space-4);
  margin-bottom: var(--yr-space-2);
}
.node.offspine { opacity: 0.65; margin-left: var(--yr-space-4); }
.node .role-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: var(--yr-space-2);
}
.role-dot.role-system { background: var(--yr-text-subtle); }
.role-dot.role-user { background: var(--yr-success); }
.role-dot.role-assistant { background: var(--yr-accent); }
.role-dot.role-tool { background: var(--yr-warning); }
.node-body { min-width: 0; flex: 1; }
.node-head { display: flex; align-items: baseline; gap: var(--yr-space-2); }
.role-label { font-family: var(--yr-font-mono); font-size: var(--yr-font-size-sm); font-weight: 600; }
.role-label.role-system { color: var(--yr-text-subtle); }
.role-label.role-user { color: var(--yr-success); }
.role-label.role-assistant { color: var(--yr-accent); }
.role-label.role-tool { color: var(--yr-warning); }
.rewrite-badge {
  border: 1px solid var(--yr-border);
  border-radius: var(--yr-radius-sm);
  padding: 0 var(--yr-space-1);
  font-size: var(--yr-font-size-xs);
  color: var(--yr-text-subtle);
}
.node-model { font-family: var(--yr-font-mono); font-size: var(--yr-font-size-xs); color: var(--yr-text-disabled); }
.node-time { margin-left: auto; font-size: var(--yr-font-size-xs); color: var(--yr-text-disabled); }
.node-content { margin-top: var(--yr-space-1); color: var(--yr-text-muted); font-size: var(--yr-font-size-md); }
.node-content.plain { white-space: pre-wrap; overflow-wrap: anywhere; }
.node-content.prose p { margin: var(--yr-space-1) 0; }
.node-content.prose ul, .node-content.prose ol { margin: var(--yr-space-1) 0; padding-left: var(--yr-space-6); }
.node-content.prose code {
  background: var(--yr-surface-muted);
  border-radius: var(--yr-radius-sm);
  padding: 1px var(--yr-space-1);
  font-size: var(--yr-font-size-sm);
}
.node-content.prose pre {
  background: var(--yr-surface-muted);
  border-radius: var(--yr-radius-md);
  padding: var(--yr-space-2) var(--yr-space-3);
  overflow-x: auto;
}
.node-content.prose strong { color: var(--yr-text); }

/* Page intro line under the h1 */
.page-intro { color: var(--yr-text-muted); margin: -0.25rem 0 var(--yr-space-6); max-width: 60ch; }


/* On/off toggle button */
.toggle {
  border: 1px solid var(--yr-border);
  border-radius: var(--yr-radius-full);
  background: var(--yr-surface-muted);
  color: var(--yr-text-subtle);
  font: inherit;
  font-size: var(--yr-font-size-sm);
  font-weight: 600;
  padding: 2px var(--yr-space-3);
  cursor: pointer;
  min-width: 3rem;
}
.toggle.on {
  background: var(--yr-success-subtle);
  border-color: var(--yr-success);
  color: var(--yr-success);
}

/* Quiet destructive action */
.btn-danger-quiet {
  border: none;
  background: none;
  color: var(--yr-danger);
  font: inherit;
  font-size: var(--yr-font-size-sm);
  cursor: pointer;
  padding: 2px var(--yr-space-2);
  border-radius: var(--yr-radius-sm);
}
.btn-danger-quiet:hover { background: var(--yr-danger-subtle); }

/* Quiet action button matching the .row-edit summary's teal link look */
.btn-link {
  border: none;
  background: none;
  color: var(--yr-accent);
  font: inherit;
  font-size: var(--yr-font-size-sm);
  font-weight: 500;
  cursor: pointer;
  padding: 2px var(--yr-space-2);
  border-radius: var(--yr-radius-sm);
}
.btn-link:hover { background: var(--yr-surface-muted); }
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--yr-border);
  border-radius: var(--yr-radius-md);
  background: var(--yr-surface);
  color: var(--yr-text-muted);
  cursor: pointer;
  padding: 0;
}
.btn-icon:hover { background: var(--yr-surface-muted); color: var(--yr-text); }

/* Test button + its outcome message, grouped so they align on their own
   center regardless of the row's other actions (e.g. the taller Edit
   disclosure sitting flex-start next to it). */
.test-action { display: inline-flex; align-items: center; gap: var(--yr-space-2); }
.test-result { font-size: var(--yr-font-size-sm); }
.test-result--ok { color: var(--yr-success); }
.test-result--error { color: var(--yr-danger); }

/* Page header row: title block on left, action button on right */
.marketplace-link {
  display: inline-flex;
  align-items: center;
  gap: var(--yr-space-2);
  font-size: var(--yr-font-size-sm);
  font-weight: 500;
  color: var(--yr-text);
  background: var(--yr-surface);
  border: 1px solid var(--yr-border);
  border-radius: var(--yr-radius-md);
  padding: var(--yr-space-2) var(--yr-space-3);
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.1s, color 0.1s;
}
.marketplace-link:hover { border-color: var(--yr-accent); color: var(--yr-accent); }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--yr-space-4);
  margin-bottom: var(--yr-space-6);
}
.page-head > div { flex: 1; }
.page-head > .page-head-actions {
  flex: 0 0 auto;
  align-self: center;
  display: flex;
  gap: var(--yr-space-3);
  align-items: center;
}
.page-head h1 { margin-bottom: var(--yr-space-1); }
.workflow-links { display: flex; gap: var(--yr-space-2); margin-top: var(--yr-space-2); }

/* Workflow detail: title + status pill on one row, help line beneath. */
.wf-title-row { display: flex; align-items: center; gap: var(--yr-space-3); }
.wf-title-row h1 { margin-bottom: 0; }

/* Workflow detail body: consistent vertical rhythm between sections. */
.wf-detail section { margin-top: var(--yr-space-8); }
.wf-detail section:first-child { margin-top: var(--yr-space-6); }
.wf-detail h2 { margin: 0 0 var(--yr-space-3); }

/* Activate/pause switch in the workflow detail header. htmx-driven like .toggle,
   but a labelled slider sized to sit beside the primary button. */
.wf-switch {
  display: inline-flex;
  align-items: center;
  gap: var(--yr-space-2);
  border: 1px solid var(--yr-border);
  border-radius: var(--yr-radius-full);
  background: var(--yr-surface);
  color: var(--yr-text-subtle);
  font: inherit;
  font-size: var(--yr-font-size-sm);
  font-weight: 600;
  padding: var(--yr-space-2) var(--yr-space-3);
  cursor: pointer;
}
.wf-switch.on { color: var(--yr-success); border-color: var(--yr-success); }
.wf-switch-track {
  position: relative;
  width: 2rem;
  height: 1rem;
  border-radius: var(--yr-radius-full);
  background: var(--yr-text-disabled);
  transition: background 0.15s ease;
}
.wf-switch.on .wf-switch-track { background: var(--yr-success); }
.wf-switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(1rem - 4px);
  height: calc(1rem - 4px);
  border-radius: 50%;
  background: var(--yr-surface);
  transition: left 0.15s ease;
}
.wf-switch.on .wf-switch-knob { left: calc(100% - 1rem + 2px); }

/* ---- Run detail ---- */

.run-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--yr-space-4);
  margin-bottom: var(--yr-space-2);
}
.run-detail-label {
  font-size: var(--yr-font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--yr-text-muted);
}

.run-status-line,
.run-files-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--yr-space-2);
}

.run-review-item {
  margin-block: var(--yr-space-4);
}

.run-steps-line {
  display: flex;
  flex-wrap: wrap;
  gap: var(--yr-space-4);
  padding: 0;
  list-style: none;
  font-size: var(--yr-font-size-sm);
}
.run-steps-line li[data-state="pending"] { color: var(--yr-text-muted); }
.run-steps-line li[data-state="current"] { font-weight: 600; }
.run-steps-line li[data-state="done"]::before { content: "✓ "; }

.run-timeline {
  position: relative;
  padding-left: var(--yr-space-6);
}
.run-timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--yr-border);
}
.run-event {
  position: relative;
  padding-bottom: var(--yr-space-6);
  display: flex;
  gap: var(--yr-space-3);
}
.run-event:last-child { padding-bottom: 0; }
.run-event-marker {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--yr-border);
  border: 2px solid var(--yr-surface);
  margin-top: var(--yr-space-1);
  position: relative;
  z-index: 1;
}
.run-event--success .run-event-marker { background: var(--yr-success); }
.run-event--error .run-event-marker { background: var(--yr-danger); }
.run-event--log .run-event-marker { background: var(--yr-text-muted); }
.run-event-content {
  flex: 1;
  min-width: 0;
}
.run-event-head {
  display: flex;
  align-items: center;
  gap: var(--yr-space-2);
  flex-wrap: wrap;
}
.run-event-kind {
  font-size: var(--yr-font-size-sm);
  font-weight: 600;
  color: var(--yr-text);
}
.run-event-fn {
  font-size: var(--yr-font-size-sm);
  color: var(--yr-accent);
  background: var(--yr-surface-muted);
  padding: 2px var(--yr-space-2);
  border-radius: var(--yr-radius-sm);
}
.run-event-time {
  font-size: var(--yr-font-size-sm);
  color: var(--yr-text-muted);
  margin-left: auto;
}
.run-event-error {
  margin-top: var(--yr-space-2);
  font-size: var(--yr-font-size-sm);
  color: var(--yr-danger);
}
.run-event-args {
  margin-top: var(--yr-space-2);
  font-size: var(--yr-font-size-sm);
  background: var(--yr-surface-muted);
  padding: var(--yr-space-2) var(--yr-space-3);
  border-radius: var(--yr-radius-md);
  overflow-x: auto;
  max-height: 12rem;
}

/* ---- Organization Users page ---- */

.section-heading {
  font-size: var(--yr-font-size-md);
  font-weight: 600;
  color: var(--yr-text);
  margin: var(--yr-space-8) 0 var(--yr-space-3);
}

.invite-link {
  width: 100%;
  min-width: 16ch;
  font-family: var(--yr-font-mono);
  font-size: var(--yr-font-size-sm);
  padding: var(--yr-space-1) var(--yr-space-2);
  border: 1px solid var(--yr-border);
  border-radius: var(--yr-radius-sm);
  background: var(--yr-surface-muted);
  color: var(--yr-text-muted);
}

.auth-actions {
  display: flex;
  flex-direction: column;
  gap: var(--yr-space-3);
  align-items: center;
}

.auth-actions .btn-primary {
  width: 100%;
  padding: var(--yr-space-3) var(--yr-space-6);
  text-align: center;
}

/* ---- Connectors page ---- */

.connector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--yr-space-3);
}

.connector-card--error { border-color: var(--yr-danger); }
.connector-card--pending { border-color: var(--yr-warning); }
.connector-card--unavailable { opacity: 0.55; }

.connector-icon--dimmed { filter: grayscale(1); }
.connector-name--muted { color: var(--yr-text-subtle); }

/* stylelint-disable-next-line no-duplicate-selectors -- pre-existing conflict
   with the .section-head rule at line 262 (different gap/margin values);
   left as-is rather than guessing which one each caller actually wants,
   needs a real look, not a blind merge. */
.section-head { display: flex; align-items: baseline; gap: var(--yr-space-3); margin-bottom: var(--yr-space-3); }
.section-head h2 { margin: 0; }
/* stylelint-disable-next-line no-duplicate-selectors -- pre-existing conflict
   with the .section-head .count rule at line 268 (different color); same
   follow-up as above. */
.section-head .count { font-size: var(--yr-font-size-sm); color: var(--yr-text-subtle); }
.section-head-hint { font-size: var(--yr-font-size-sm); color: var(--yr-text-subtle); }
.section-head--muted h2 { color: var(--yr-text-subtle); font-size: var(--yr-font-size-lg); }

.badge-unavailable {
  font-size: var(--yr-font-size-sm);
  color: var(--yr-text-disabled);
  background: var(--yr-surface-muted);
  border-radius: var(--yr-radius-sm);
  padding: var(--yr-space-1) var(--yr-space-2);
}

.connector-icon--default       { background: var(--yr-text-muted); }
.connector-icon--logo {
  background: var(--yr-surface);
  border: 1px solid var(--yr-border);
  padding: var(--yr-space-2);
}
.connector-icon--logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.connector-desc { font-size: var(--yr-font-size-sm); color: var(--yr-text-subtle); margin-bottom: var(--yr-space-1); }
.connector-caps { font-size: var(--yr-font-size-sm); color: var(--yr-text-disabled); }
.connector-error { font-size: var(--yr-font-size-sm); color: var(--yr-danger); margin-top: var(--yr-space-1); }

/* ---- Workflows page ---- */

/* ---- Template gallery ---- */

.category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--yr-space-2);
  margin-bottom: var(--yr-space-6);
}


.template-count {
  font-size: var(--yr-font-size-sm);
  color: var(--yr-text-subtle);
  margin-bottom: var(--yr-space-4);
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--yr-space-4);
}



.template-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}



/* Template section labels (persona "For you" / "Other") */
.template-section-label {
  display: flex;
  align-items: center;
  gap: var(--yr-space-2);
  font-size: var(--yr-font-size-md);
  font-weight: 600;
  color: var(--yr-text-muted);
  margin-bottom: var(--yr-space-3);
}
.template-count-inline {
  font-size: var(--yr-font-size-sm);
  font-weight: 400;
  color: var(--yr-text-subtle);
}
.link-quiet {
  font-size: var(--yr-font-size-sm);
  font-weight: 400;
  color: var(--yr-text-subtle);
  text-decoration: none;
}
.link-quiet:hover { color: var(--yr-accent); text-decoration: underline; }


/* Status dot only for non-ready states — absence of dot implies connected */
.connector-icon-pill--available::after {
  content: "";
  position: absolute;
  bottom: -3px;
  right: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 2px solid var(--yr-surface);
  background: #ca8a04;
}
.connector-icon-pill--unavailable { opacity: 0.35; filter: grayscale(1); }

.template-setup { font-size: var(--yr-font-size-sm); color: var(--yr-text-disabled); }


/* Login / signup */
.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--yr-space-3);
  background: var(--yr-bg);
}

/* Setup-flow shell: workspace TopNav on top, the Cappy + card content
   centered in the remaining space (see views.SetupLayout). */
.setup-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--yr-bg);
}
.setup-body {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--yr-space-3);
  padding: var(--yr-space-12) var(--yr-space-4);
}
/* Single X control to cancel the flow, top-right of the setup body — an icon
   in place of the old worded "Cancel setup" link so there's less to parse. */
.setup-cancel {
  position: absolute;
  top: 1rem;
  right: 1rem;
  margin: 0;
}
.setup-cancel-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--yr-text-muted);
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.setup-cancel-btn:hover {
  background: var(--yr-surface-muted);
  color: var(--yr-text);
}
.setup-cancel-btn:focus-visible {
  outline: 2px solid var(--yr-accent);
  outline-offset: 2px;
}
.setup-back {
  position: absolute;
  top: 1rem;
  left: 1rem;
  margin: 0;
}
.setup-back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--yr-text-muted);
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.setup-back-btn:hover {
  background: var(--yr-surface-muted);
  color: var(--yr-text);
}
.setup-back-btn:focus-visible {
  outline: 2px solid var(--yr-accent);
  outline-offset: 2px;
}
.auth-form { display: flex; flex-direction: column; gap: var(--yr-space-4); }
.auth-form label {
  display: flex;
  flex-direction: column;
  gap: var(--yr-space-1);
  font-size: var(--yr-font-size-sm);
  color: var(--yr-text-muted);
}
.auth-form input[type="text"], .auth-form input[type="password"] {
  border: 1px solid var(--yr-border);
  border-radius: var(--yr-radius-md);
  padding: var(--yr-space-2) var(--yr-space-3);
  font: inherit;
  background: var(--yr-bg);
  color: var(--yr-text);
}
.auth-form input[type="text"]:focus, .auth-form input[type="password"]:focus {
  outline: 2px solid var(--yr-accent);
  outline-offset: -1px;
}
.auth-heading { font-family: var(--yr-font-display); font-size: var(--yr-font-size-xl); font-weight: 700; margin: 0 0 var(--yr-space-2); text-align: center; }
.auth-subhead { font-size: var(--yr-font-size-sm); color: var(--yr-text-muted); text-align: center; margin: 0 0 var(--yr-space-6); }

/* ---- Workflow install onboarding ---- */

.onboarding-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: var(--yr-space-6);
  align-items: start;
}
@media (max-width: 860px) {
  .onboarding-layout { grid-template-columns: 1fr; }
}

.onboarding-main { display: flex; flex-direction: column; gap: var(--yr-space-6); }

.onboarding-section-title {
  font-family: var(--yr-font-display);
  font-size: var(--yr-font-size-lg);
  font-weight: 700;
  color: var(--yr-text);
  margin: 0 0 var(--yr-space-4);
}

.onboarding-caps-subhead {
  font-size: var(--yr-font-size-sm);
  font-weight: 600;
  color: var(--yr-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: var(--yr-space-6) 0 var(--yr-space-3);
}
.onboarding-caps-subhead:first-of-type { margin-top: 0; }

.onboarding-no-caps { color: var(--yr-text-subtle); font-size: var(--yr-font-size-md); margin: 0; }

.onboarding-space-list {
  display: flex;
  flex-direction: column;
  gap: var(--yr-space-2);
}
.onboarding-space-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--yr-space-3) var(--yr-space-4);
  border: 1.5px solid var(--yr-border);
  border-radius: var(--yr-radius-md);
  color: var(--yr-text);
  text-decoration: none;
  transition: border-color 0.1s, background 0.1s;
}
.onboarding-space-option:hover { border-color: var(--yr-accent); text-decoration: none; }
.onboarding-space-option.is-selected {
  border-color: var(--yr-accent);
  background: var(--yr-accent-subtle);
  color: var(--yr-accent);
}
.onboarding-space-name { font-weight: 600; }
.onboarding-space-option svg { color: var(--yr-accent); flex-shrink: 0; }

.onboarding-summary { position: sticky; top: 1.5rem; }
.onboarding-summary-copy { font-size: var(--yr-font-size-md); color: var(--yr-text-muted); margin: 0 0 var(--yr-space-4); }
.onboarding-finish-btn { width: 100%; justify-content: center; }
.onboarding-finish-btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.onboarding-connect-pill { cursor: pointer; }
.onboarding-connect-pill:hover { border-color: var(--yr-accent); }

/* ---- Capability checklist (shared shape with depot's Specs tab) ---- */

.capability-checklist {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: var(--yr-space-3);
  margin: 0 0 var(--yr-space-3);
  font-size: var(--yr-font-size-md);
}
.capability-check { display: contents; }
.capability-check-icon { width: 1rem; text-align: center; }
.capability-check--met .capability-check-icon { color: var(--yr-success); }
.capability-check--missing .capability-check-icon { color: var(--yr-danger); }
.capability-check-label { color: var(--yr-text); font-weight: 500; white-space: nowrap; }
.capability-check-connectors {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--yr-space-2);
}

/* Install-workflow guided flow (single-card steps) */
.install-space-options {
  display: flex;
  flex-direction: column;
  gap: var(--yr-space-2);
  margin-bottom: var(--yr-space-2);
}
.install-space-option {
  display: flex;
  align-items: center;
  gap: var(--yr-space-3);
  padding: var(--yr-space-3);
  border: 1px solid var(--yr-surface-muted);
  border-radius: var(--yr-radius-md);
  cursor: pointer;
}
.install-space-option:hover { border-color: var(--yr-accent); }
.install-space-option-name { color: var(--yr-text); font-weight: 500; }
.install-secondary-link {
  margin: var(--yr-space-1) 0 0;
  font-size: var(--yr-font-size-md);
  text-align: center;
}
.install-cancel {
  margin-top: var(--yr-space-4);
  text-align: center;
}
/* Install-flow connections checklist: one flex row per required connector. */
.capability-check-list {
  margin: 0 0 var(--yr-space-3);
  font-size: var(--yr-font-size-md);
}
.capability-check-row {
  display: flex;
  align-items: center;
  gap: var(--yr-space-3);
  padding: var(--yr-space-2) 0;
  border-bottom: 1px solid var(--yr-surface-muted);
}
.capability-check-row:last-child { border-bottom: none; }
.capability-check-row-label {
  flex: 1;
  color: var(--yr-text);
  font-weight: 500;
}
.capability-check-logo { width: 20px; height: 20px; object-fit: contain; flex-shrink: 0; }

/* Connector-setup guided flow */
.connectors-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: var(--yr-space-4);
}
.yr-auth-card--wide { max-width: 34rem; }
.connector-choose-list,
.connector-authmethod-list {
  display: flex;
  flex-direction: column;
  gap: var(--yr-space-2);
  margin-bottom: var(--yr-space-3);
}
.connector-choose-option,
.connector-authmethod-option {
  display: flex;
  align-items: center;
  gap: var(--yr-space-3);
  padding: var(--yr-space-3);
  border: 1px solid var(--yr-surface-muted);
  border-radius: var(--yr-radius-md);
  cursor: pointer;
}
.connector-choose-option:hover,
.connector-authmethod-option:hover { border-color: var(--yr-accent); }
.connector-choose-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex: none;
  border-radius: var(--yr-radius-md);
  background: var(--yr-surface-muted);
  font-size: var(--yr-font-size-sm);
  font-weight: 600;
}
.connector-choose-icon img { width: 1.25rem; height: 1.25rem; object-fit: contain; }
.connector-choose-main,
.connector-authmethod-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.connector-choose-name,
.connector-authmethod-name { color: var(--yr-text); font-weight: 500; }
.connector-choose-desc,
.connector-authmethod-desc { color: var(--yr-text-subtle); font-size: var(--yr-font-size-sm); }
.connector-token-help { margin: 0 0 var(--yr-space-1); font-size: var(--yr-font-size-sm); }

/* Notifications page — in-progress setups */
.setup-expiry { color: var(--yr-text-subtle); font-size: var(--yr-font-size-sm); margin-left: var(--yr-space-2); }


/* External IdP auth affordances (login divider, sign-in link, linked-identity rows) */
.yr-auth-card-divider {
  display: flex;
  align-items: center;
  gap: var(--yr-space-3);
  margin: var(--yr-space-6) 0 var(--yr-space-4);
  font-family: var(--yr-font-body);
  font-size: var(--yr-font-size-sm);
  color: var(--yr-text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.yr-auth-card-divider::before,
.yr-auth-card-divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--yr-border);
}
.yr-btn-external {
  display: flex;
  justify-content: center;
  width: 100%;
  padding: var(--yr-space-2) var(--yr-space-4);
  border: 1px solid var(--yr-border);
  border-radius: var(--yr-radius-md);
  font-family: var(--yr-font-body);
  font-size: var(--yr-font-size-md);
  font-weight: 500;
  color: var(--yr-text);
  background: var(--yr-surface-muted);
  text-decoration: none;
}
.yr-btn-external:hover {
  background: var(--yr-surface);
}
.yr-btn-link {
  display: block;
  text-align: center;
  font-family: var(--yr-font-body);
  font-size: var(--yr-font-size-md);
  color: var(--yr-accent);
  font-weight: 500;
  text-decoration: none;
}
.yr-settings-identity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--yr-space-4);
  padding: var(--yr-space-2) 0;
  font-family: var(--yr-font-body);
  font-size: var(--yr-font-size-md);
  color: var(--yr-text);
}
.status-pill.is-ok { background: var(--yr-success-subtle); color: var(--yr-success); }

/* Cappy the Conductor — guided setup-flow narration.
   .cappy-row/.cappy-speech match the marketing brand-guide reference: image
   beside a rounded bubble with a CSS-triangle tail. Sized down from the
   guide's 160px so Cappy fits inside the narrow auth-card setup pages. */
.cappy-row {
  display: flex;
  align-items: center;
  gap: var(--yr-space-3);
}
.cappy-row img {
  width: 5rem;
  height: 5rem;
  object-fit: contain;
  flex: none;
}
.cappy-speech {
  position: relative;
  background: var(--yr-surface);
  border: 1px solid var(--yr-border);
  border-radius: var(--yr-radius-lg);
  padding: var(--yr-space-3) var(--yr-space-4);
  max-width: 22rem;
}
.cappy-speech::before,
.cappy-speech::after {
  content: "";
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border-style: solid;
}
.cappy-speech::before {
  left: -14px;
  border-width: 12px 14px 12px 0;
  border-color: transparent var(--yr-border) transparent transparent;
}
.cappy-speech::after {
  left: -12px;
  border-width: 11px 13px 11px 0;
  border-color: transparent var(--yr-surface) transparent transparent;
}
.cappy-line {
  margin: 0;
  font-family: var(--yr-font-body);
  font-size: var(--yr-font-size-sm);
  line-height: 1.4;
  color: var(--yr-text);
}
.cappy-steps {
  margin: var(--yr-space-2) 0 0;
  font-size: var(--yr-font-size-xs);
  color: var(--yr-text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.cappy-narrator {
  margin-bottom: 0;
}
.cappy-expired-image {
  display: block;
  height: 5.5rem;
  width: 5.5rem;
  margin: 0 auto var(--yr-space-3);
  object-fit: contain;
}

/* Space a leading yr-alert (info/error banners) from the form or button that
   follows it inside auth/setup cards — the alert element carries no margin of
   its own, and only the capability-check-list path was previously spaced. */
.yr-auth-card > yr-alert {
  margin-bottom: var(--yr-space-3);
}

/* ---- Trigger input modal ---- */

.yr-modal {
  border: 1px solid var(--yr-border);
  border-radius: var(--yr-radius-lg);
  padding: 0;
  max-width: 32rem;
  width: 90vw;
  background: var(--yr-surface);
  color: var(--yr-text);
  font-family: var(--yr-font-body);
}
.yr-modal::backdrop {
  background: rgb(0 0 0 / 35%);
}
.yr-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--yr-space-4) var(--yr-space-6);
  border-bottom: 1px solid var(--yr-border);
}
.yr-modal-header h2 { margin: 0; }
.yr-modal-body {
  padding: var(--yr-space-6);
  display: flex;
  flex-direction: column;
  gap: var(--yr-space-4);
}
.yr-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--yr-space-2);
  padding: var(--yr-space-4) var(--yr-space-6);
  border-top: 1px solid var(--yr-border);
}
.yr-field {
  display: flex;
  flex-direction: column;
  gap: var(--yr-space-1);
  font-size: var(--yr-font-size-md);
  font-weight: 500;
  color: var(--yr-text);
}
.yr-field input[type="text"],
.yr-field input[type="number"] {
  border: 1px solid var(--yr-border);
  border-radius: var(--yr-radius-md);
  padding: var(--yr-space-2) var(--yr-space-3);
  font: inherit;
  background: var(--yr-bg);
  color: var(--yr-text);
}
.yr-field input[type="text"]:focus,
.yr-field input[type="number"]:focus {
  outline: 2px solid var(--yr-accent);
  outline-offset: -1px;
}
.yr-field-desc {
  font-weight: 400;
  font-size: var(--yr-font-size-sm);
  color: var(--yr-text-subtle);
}
.yr-field-optional {
  font-weight: 400;
  font-size: var(--yr-font-size-sm);
  color: var(--yr-text-subtle);
}
.btn-secondary {
  background: var(--yr-surface-muted);
  color: var(--yr-text);
  border: 1px solid var(--yr-border);
  border-radius: var(--yr-radius-md);
  padding: var(--yr-space-2) var(--yr-space-6);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.btn-secondary:hover { background: var(--yr-surface); }
