/* Roundhouse — the site's OWN rules. The design system is ds/tokens.css
   + ds/bundle.css, vendored verbatim and loaded first; this sheet loads second
   and only adds what Roundhouse needs. Never restyle a design-system class here
   except to place it. The CSP forbids inline style, so every look a template
   needs has a class in one of the three sheets (TestEveryTemplateClassIsDefined). */

.mono, code, pre { font-family: var(--font-mono); }
code { font-size: 0.85em; background: var(--page); padding: 0.1em 0.35em; border-radius: var(--radius-sm); }
.dispatch-snippet code, pre code { background: none; padding: 0; }
.muted { color: var(--ballast); }
.small { font-size: 0.82rem; }
main a { color: var(--rail-blue); }
main a:hover { color: var(--rail-blue-press); }

/* ---- public pages ---------------------------------------------------- */
.landing-brand { display: inline-flex; align-items: center; gap: 0.6rem; }
.landing-brand .brand-icon { height: 2rem; }
.landing-brand .brand-wordmark { height: 1.3rem; }
.landing-header-link.is-current { color: #fff; }
.landing-hero-inner.hero-grid { max-width: none; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: 3rem; align-items: center; }
.hero-copy { min-width: 0; }
.landing-title, .landing-lede, .landing-h2, .landing-section-sub { margin-top: 0; }
.landing-hero.is-compact { padding: 2.5rem 0 3rem; }
.landing-hero.is-compact .landing-title { font-size: 2.2rem; }
.landing-hero.is-compact .landing-lede { margin-bottom: 0; }
.landing-flow-step code, .landing-trust-point code { font-size: 0.82em; }
.landing-ai-point code { background: rgba(255, 255, 255, 0.08); color: #e2e8f0; }
.landing-ai .landing-flow-tag { color: rgba(255, 255, 255, 0.55); }
.landing-section.is-tight { padding-top: 0; }
.landing-final-sub code { font-size: 0.9em; }

.yard-figure { margin: 0; min-width: 0; background: var(--sleeper); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: var(--radius-lg); padding: 1rem 1rem 0.6rem; }
.yard-figure svg { display: block; width: 100%; height: auto; }
.yard-caption { font-family: var(--font-mono); font-size: 0.72rem; color: rgba(255, 255, 255, 0.55); margin-top: 0.5rem; letter-spacing: 0.02em; }
@keyframes roundhouse-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.yard-signal { animation: roundhouse-pulse 1.5s ease-in-out infinite; }

.install-card { padding: 2rem; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2rem; align-items: start; }
.install-card .landing-h2 { font-size: 1.5rem; }
.install-card .landing-section-sub { margin-bottom: 1rem; }
.eyebrow-on-light { color: var(--signal-green); }
.install-cmd { font-size: 0.82rem; padding: 1rem; }
.install-note { font-family: var(--font-mono); font-size: 0.75rem; color: var(--ballast); margin-top: 0.5rem; }
.install-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 2rem; align-items: start; }
.install-col { display: flex; flex-direction: column; gap: 1.5rem; min-width: 0; }
.install-block { padding: 1.75rem; }
.install-block .section-title { font-size: 1.2rem; margin-bottom: 0.5rem; }
.install-block p { color: var(--ballast); margin-bottom: 1rem; }
.install-block p:last-child { margin-bottom: 0; }
.install-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.install-head .section-title { margin-bottom: 0; }
.release-table { margin-top: 1rem; }
.release-assets { font-family: var(--font-mono); font-size: 0.8rem; line-height: 1.7; }
.release-assets a { display: block; }
.alert.is-flush { margin: 0; }

/* ---- the operator shell ------------------------------------------------ */
.nav-brand { color: var(--surface); display: inline-flex; align-items: center; gap: 0.5rem; flex: none; }

/* ---- brand lockup: the Roundhouse icon, then the ironway roundhouse wordmark */
.brand-icon { display: block; width: auto; height: 1.75rem; flex: none; }
.brand-wordmark { display: block; width: auto; height: 1.1rem; }
.site-footer-wordmark { display: block; width: auto; height: 0.85rem; }
.site-footer-formerly { color: var(--ballast); font-size: 0.8rem; }
.nav-links a.is-current { opacity: 1; font-weight: 600; }
.nav-right { display: flex; align-items: center; gap: 1rem; }
.nav-meta { font-family: var(--font-mono); font-size: 0.72rem; color: rgba(255, 255, 255, 0.6); white-space: nowrap; }
.nav-signout { background: none; border: 1px solid rgba(255, 255, 255, 0.3); color: var(--surface); border-radius: var(--radius); padding: 0.3rem 0.7rem; font: inherit; font-size: 0.8rem; cursor: pointer; }
.nav-signout:hover { background: rgba(255, 255, 255, 0.08); }
.page-main { flex: 1 0 auto; width: 100%; padding-bottom: 2rem; }
.page-sub { color: var(--ballast); font-size: 0.88rem; margin-top: 0.2rem; }
.page-crumbs { font-size: 0.82rem; color: var(--ballast); margin-bottom: 0.35rem; }
.page-header-bar.is-top { align-items: flex-start; }
.page-header h1.build-title { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.page-header-actions { flex-wrap: wrap; }
.page-header-actions form { display: inline; }
.site-footer.is-flush { margin-top: 0; }
.site-footer-inner { flex-wrap: wrap; row-gap: 0.25rem; }
.section-title.is-spaced { margin-top: 2rem; }

.dash-stat-num.is-run { color: var(--rail-blue); }
.dash-stat-num.is-pass { color: var(--signal-green); }
.dash-stat-num.is-fail { color: var(--signal-red); }

.pipeline-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.pipeline-card { display: flex; flex-direction: column; gap: 0.4rem; padding: 1rem 1.25rem; color: var(--steel); }
.pipeline-card:hover { text-decoration: none; box-shadow: var(--shadow-lift-sm); }
.pipeline-card-name { font-weight: 700; color: var(--steel); }
.pipeline-card-repo { font-family: var(--font-mono); font-size: 0.78rem; color: var(--ballast); overflow-wrap: anywhere; }
.pipeline-card-latest { font-size: 0.85rem; color: var(--ballast); display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.data-table tbody tr:hover td { background: var(--coal); }
.data-table td.is-num { font-family: var(--font-mono); font-size: 0.82rem; white-space: nowrap; }
.data-table td.is-when { color: var(--ballast); white-space: nowrap; }
.cell-sub { font-family: var(--font-mono); font-size: 0.78rem; color: var(--ballast); }
.cell-msg { color: var(--steel); }
.cell-tags { max-width: 280px; }
.empty-row { text-align: center; color: var(--ballast); padding: 1.5rem; }
.tag { display: inline-block; font-family: var(--font-mono); font-size: 0.72rem; background: var(--page); color: #475569; border: 1px solid var(--rule); border-radius: var(--radius-sm); padding: 0.05rem 0.4rem; margin: 0.1rem 0.15rem 0.1rem 0; }
.inline-form { display: inline; }
.filters { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.filters input { height: 34px; padding: 0 0.8rem; border: 1px solid var(--border-input); border-radius: var(--radius); font: inherit; font-size: 0.85rem; }
.new-build { margin-bottom: 1.5rem; padding: 1rem 1.25rem; }
.new-build summary { cursor: pointer; font-weight: 600; }
.new-build form { max-width: 480px; margin-top: 1rem; }

/* state badges: one class per state, so colour is never the only signal —
   the word is printed in the badge */
.st-passed, .st-connected { background: var(--pill-ok-bg); color: var(--pill-ok-ink); }
.st-failed, .st-broken, .st-lost { background: var(--pill-bad-bg); color: var(--pill-bad-ink); }
.st-running, .st-assigned, .st-canceling, .st-waiting, .st-busy { background: var(--chip-new-bg); color: var(--chip-new-ink); }
.st-blocked, .st-paused, .st-soft { background: var(--pill-warn-bg); color: var(--pill-warn-ink); }
.st-scheduled, .st-pending, .st-idle { background: var(--pill-muted-bg); color: var(--pill-muted-ink); }
.st-canceled, .st-skipped, .st-disconnected { background: var(--chip-archived-bg); color: var(--chip-archived-ink); }
.st-active { background: var(--pill-ok-bg); color: var(--pill-ok-ink); }
.st-revoked { background: var(--chip-archived-bg); color: var(--chip-archived-ink); }

/* ---- build detail ------------------------------------------------------- */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) var(--detail-rail); gap: 1.5rem; align-items: start; max-width: none; }
.detail-main, .detail-rail { display: flex; flex-direction: column; gap: 1.5rem; min-width: 0; }
.build-msg { color: var(--ballast); font-size: 0.88rem; margin-top: 0.35rem; }
.jobs-card { overflow: hidden; }
.jobs-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.9rem 1rem; border-bottom: 1px solid #e5e7eb; }
.jobs-head .section-title { margin: 0; }
.job { border-bottom: 1px solid var(--border-soft); }
.job:last-child { border-bottom: 0; }
.job[open] { background: var(--accent-soft); }
.job-line { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; padding: 0.8rem 1rem; cursor: pointer; list-style: none; }
.job-line::-webkit-details-marker { display: none; }
.job-label { font-weight: 600; }
.job-group { color: var(--ballast); }
.job-meta { font-family: var(--font-mono); font-size: 0.78rem; color: var(--ballast); }
.job-time { margin-left: auto; font-family: var(--font-mono); font-size: 0.82rem; }
.job-body { padding: 0 1rem 1rem; display: flex; flex-direction: column; gap: 0.6rem; }
.job-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.job-actions form { display: inline; }
.job-reason { color: var(--ballast); font-size: 0.88rem; }
.job-cmd { margin: 0; font-size: 0.78rem; }
.job-tests { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); padding: 0.6rem 0.8rem; }
.job-tests-title { margin: 0 0 0.4rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ballast); }
.job-test-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.25rem; }
.job-test { display: flex; gap: 0.5rem; align-items: baseline; flex-wrap: wrap; font-family: var(--font-mono); font-size: 0.78rem; }
.job-test-pkg { color: var(--ballast); word-break: break-all; }
.job-test-name { font-weight: 600; }
.job-log { margin: 0; background: var(--sleeper); color: #e2e8f0; font-family: var(--font-mono); font-size: 0.78rem; line-height: 1.55; padding: 1rem; border-radius: var(--radius); max-height: 70vh; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.job-log:empty { display: none; }
.job-block { padding: 0.8rem 1rem; display: flex; flex-direction: column; gap: 0.6rem; }
.job-block form { max-width: 480px; }
.wait-line { text-align: center; font-family: var(--font-mono); font-size: 0.72rem; color: var(--ballast); padding: 0.3rem; border-bottom: 1px dashed var(--rule); }
.annotation { padding: 0.8rem 1rem; border-radius: var(--radius); border: 1px solid var(--rule); background: var(--surface); font-size: 0.9rem; }
.annotation p, .annotation ul, .annotation pre, .annotation h3, .annotation h4, .annotation h5, .annotation h6 { margin: 0.3rem 0; }
.annotation ul { padding-left: 1.2rem; }
.a-default { border-color: var(--rule); }
.a-info { background: #f0f9ff; border-color: #bae6fd; }
.a-success { background: #f0fdf4; border-color: #bbf7d0; }
.a-warning { background: var(--accent-amber-soft); border-color: #fde68a; }
.a-error { background: var(--accent-red-soft); border-color: #fecaca; }
.rail-card { padding: 1rem 1.25rem; }
.rail-card .section-title { font-size: 0.95rem; margin-bottom: 0.5rem; }
.rail-card .section-title.is-spaced { margin-top: 1rem; }
.rail-row { display: flex; justify-content: space-between; gap: 1rem; padding: 0.45rem 0; border-bottom: 1px solid var(--border-soft); font-size: 0.85rem; }
.rail-row:last-child { border-bottom: 0; }
.rail-k { color: var(--ballast); flex: none; overflow-wrap: anywhere; }
.rail-v { text-align: right; min-width: 0; overflow-wrap: anywhere; }
.rail-note { font-size: 0.78rem; color: var(--ballast); margin-top: 0.6rem; }

/* ---- agents ------------------------------------------------------------- */
.agents-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.5rem; align-items: start; }
.host-groups { display: grid; gap: 1rem; min-width: 0; }
.host-toolbar { display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.host-toolbar .enroll-note { flex: 1 1 24rem; margin: 0; }
.host-group { padding: 0; overflow: hidden; }
.host-group.is-stopped { border-color: var(--pill-bad-ink); }
.host-head { display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; padding: 0.75rem 1rem; border-bottom: 1px solid var(--line, #e5e7eb); }
.host-head .section-title { margin: 0; }
.host-stop-why { margin-top: 0.25rem; font-size: 0.875rem; color: var(--pill-bad-ink); }
.stop-form { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.stop-reason { min-width: 14rem; padding: 0.35rem 0.5rem; border: 1px solid var(--line, #cbd5e1); border-radius: 4px; font: inherit; }
.st-stopped { background: var(--pill-bad-bg); color: var(--pill-bad-ink); }
.btn-danger { background: var(--pill-bad-ink); color: #fff; border: 1px solid var(--pill-bad-ink); }
.btn-danger:hover { filter: brightness(0.9); text-decoration: none; }
.enroll-card { margin-bottom: 1.5rem; padding: 1.25rem 1.25rem 0.25rem; }
.enroll-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.enroll-head .section-title { margin: 0; }
.enroll-form { display: flex; gap: 0.5rem; align-items: center; }
.enroll-code { height: 34px; width: 11ch; padding: 0 0.6rem; border: 1px solid var(--border-input); border-radius: var(--radius); font-family: var(--font-mono); font-size: 0.85rem; text-transform: uppercase; }
.enroll-note { font-size: 0.85rem; color: var(--ballast); margin: 0.5rem 0 0.75rem; }
.upgrade-version { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.upgrade-version .mono { font-size: 1.1rem; font-weight: 700; }
.rail-card p { font-size: 0.85rem; color: var(--ballast); margin-top: 0.6rem; }

/* ---- sign-in ------------------------------------------------------------ */
.auth-logo { display: inline-flex; align-items: center; gap: 0.75rem; }
.auth-logo .brand-icon { height: 3rem; }
.auth-logo .brand-wordmark { height: 1.9rem; }
.auth-card h2 { margin-top: 0; }
.auth-card .form-group input { font-family: var(--font-mono); }

/* ---- log colours (written by app.js) ------------------------------------ */
.ansi-bold { font-weight: 700; }
.ansi-30 { color: #64748b; } .ansi-31 { color: #f87171; } .ansi-32 { color: #34d399; } .ansi-33 { color: #fbbf24; }
.ansi-34 { color: #60a5fa; } .ansi-35 { color: #c084fc; } .ansi-36 { color: #22d3ee; } .ansi-37 { color: #e2e8f0; }
.ansi-90 { color: #94a3b8; }

@media (max-width: 900px) {
  .landing-hero-inner.hero-grid, .install-grid, .install-card { grid-template-columns: 1fr; }
  .landing-flow, .landing-trust-points { grid-template-columns: repeat(2, 1fr); }
  .landing-ai-inner { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .detail-grid, .agents-grid { grid-template-columns: 1fr; }
  .nav-links { flex-wrap: wrap; }
  .nav-meta { display: none; }
}
@media (max-width: 560px) {
  .landing-flow, .landing-trust-points { grid-template-columns: 1fr; }
  .landing-title { font-size: 2rem; }
  .brand-wordmark, .landing-brand .brand-wordmark { height: 0.9rem; }
  .auth-logo .brand-wordmark { height: 1.4rem; }
  .landing-header-nav { gap: 0.75rem; flex-wrap: wrap; justify-content: flex-end; }
  .data-table th, .data-table td { padding: 0.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  .yard-signal { animation: none; }
}

/* ---- reports ------------------------------------------------------------ */
.report-controls { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.range-tabs { display: inline-flex; border: 1px solid var(--border-input); border-radius: var(--radius); overflow: hidden; }
.range-tab { font-family: var(--font-mono); font-size: 0.8rem; padding: 0.35rem 0.75rem; color: var(--ballast); border-right: 1px solid var(--border-input); }
.range-tab:last-child { border-right: 0; }
.range-tab:hover { background: var(--page); text-decoration: none; }
.range-tab.is-current { background: var(--steel); color: var(--surface); }
.report-select { height: 32px; padding: 0 0.6rem; border: 1px solid var(--border-input); border-radius: var(--radius); font: inherit; font-size: 0.85rem; background: var(--surface); }
.report-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 1rem; }
.chart-card { padding: 1rem 1.25rem; }
.chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.chart-head .section-title { margin-bottom: 0.5rem; }
.chart { width: 100%; overflow-x: auto; }
.chart-svg { display: block; width: 100%; min-width: 440px; height: auto; font-family: var(--font-mono); }
.chart-legend { list-style: none; display: flex; gap: 1rem; margin: 0; padding: 0; font-size: 0.78rem; color: var(--ballast); }
.chart-legend li { display: inline-flex; align-items: center; gap: 0.35rem; }
.legend-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.legend-swatch.is-passed, .ch-passed { fill: var(--signal-green); background: var(--signal-green); }
.legend-swatch.is-failed, .ch-failed { fill: var(--signal-red); background: var(--signal-red); }
.legend-swatch.is-canceled, .ch-canceled { fill: #64748b; background: #64748b; }
.ch-mono { fill: var(--rail-blue); }
.ch-bar:hover { opacity: 0.8; }
.ch-grid { stroke: var(--rule); stroke-width: 1; }
.ch-axis { stroke: #cbd5e1; stroke-width: 1; }
.ch-tick { font-size: 10px; fill: var(--ballast); }
.ch-value { font-size: 10px; font-weight: 700; fill: var(--steel); }
.chart-table { margin-top: 0.75rem; font-size: 0.85rem; }
.chart-table summary { cursor: pointer; color: var(--ballast); font-family: var(--font-mono); font-size: 0.78rem; }
.chart-table .data-table { margin-top: 0.5rem; }
.share-meter { width: 80px; height: 10px; vertical-align: middle; }

/* ---- activity ----------------------------------------------------------- */
.activity-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1.5rem; align-items: start; }
.activity-main, .activity-rail { display: flex; flex-direction: column; gap: 1.5rem; min-width: 0; }
.activity-card { padding: 0; }
.activity-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.9rem 1rem; border-bottom: 1px solid var(--border-soft); }
.activity-head .section-title { margin: 0; }
.activity-count { font-family: var(--font-mono); font-size: 0.78rem; color: var(--ballast); background: var(--page); border-radius: var(--radius-sm); padding: 0.1rem 0.5rem; }
.activity-link { font-size: 0.82rem; }
.live-pill { display: inline-flex; align-items: center; gap: 0.4rem; font-family: var(--font-mono); font-size: 0.75rem; color: var(--ballast); border: 1px solid var(--rule); border-radius: 999px; padding: 0.2rem 0.7rem; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; }
.live-pill[data-state="live"] .live-dot { background: var(--signal-green); animation: roundhouse-pulse 1.5s ease-in-out infinite; }
.live-pill[data-state="polling"] .live-dot { background: var(--signal-amber); }
.live-pill[data-state="reconnecting"] .live-dot { background: var(--signal-amber); }
.feed { list-style: none; margin: 0; padding: 0.25rem 0; max-height: 70vh; overflow: auto; }
.feed-row { display: grid; grid-template-columns: 64px 92px minmax(0, 1fr); gap: 0.5rem; align-items: baseline; padding: 0.45rem 1rem; border-bottom: 1px solid var(--border-soft); font-size: 0.82rem; }
.feed-row:last-child { border-bottom: 0; }
.feed-when { font-family: var(--font-mono); font-size: 0.72rem; color: var(--ballast); white-space: nowrap; }
.feed-kind { font-family: var(--font-mono); font-size: 0.72rem; color: var(--ballast); overflow-wrap: anywhere; }
.feed-what { min-width: 0; overflow-wrap: anywhere; }
.feed-empty { display: block; color: var(--ballast); text-align: center; }
@media (max-width: 900px) {
  .report-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .activity-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .live-pill[data-state="live"] .live-dot { animation: none; }
}

/* the fleet view: one card per host (agents.html), and the agent's own
   status page, which links this sheet from the host (internal/agent/status.html) */
.host-meta { margin-top: 0.25rem; font-size: 0.8rem; color: var(--ballast); }
.host-warn { margin-top: 0.25rem; font-size: 0.875rem; color: var(--pill-warn-ink); }
.host-group.is-down { border-color: var(--pill-warn-ink); }
.host-summary { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; padding: 0.6rem 1rem; border-bottom: 1px solid var(--line, #e5e7eb); background: var(--page); }
.host-stat { display: flex; flex-direction: column; gap: 0.1rem; min-width: 7rem; }
.host-stat-k { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ballast); }
.host-stat-v { font-size: 0.875rem; }
.host-stat-v.is-warn { color: var(--pill-warn-ink); font-weight: 600; }
.st-up { background: var(--pill-ok-bg); color: var(--pill-ok-ink); }
.st-down, .st-warn { background: var(--pill-warn-bg); color: var(--pill-warn-ink); }
.st-registering { background: var(--pill-muted-bg); color: var(--pill-muted-ink); }
.agent-status { background: var(--page); margin: 0; }
.agent-status-main { max-width: 64rem; margin: 0 auto; padding: 1.5rem 1rem; display: grid; gap: 1rem; }
.log-tail { margin: 0; padding: 0.75rem 1rem; font-family: var(--font-mono); font-size: 0.78rem; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 24rem; overflow: auto; background: #0f172a; color: #e2e8f0; }
