/* Minimal stylesheet with system-preference dark mode. The accent
   leans on the Nix logo blue. */
:root {
	color-scheme: light dark;
	--bg: #fcfcfb;
	--fg: #24292e;
	--muted: #6c757d;
	--border: #dde2e8;
	--ok: #2e7d32;
	--bad: #c62828;
	--warn: #e65100;
	--run: #1565c0;
	--queued: #b07d1f;
	--accent: #5277c3;
	--card: #f4f5f7;
	--hover: rgb(130 170 255 / 6%);
	--highlight: rgb(130 170 255 / 15%);
	--ansi-magenta: #ab47bc;
	--mono:
		ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
	:root {
		--bg: #131619;
		--fg: #e8e6e3;
		--muted: #9aa0a6;
		--border: #2d3338;
		--ok: #81c995;
		--bad: #f28b82;
		--warn: #fdd663;
		--run: #8ab4f8;
		--queued: #fdd663;
		--accent: #7ca4e0;
		--card: #1b2025;
		--ansi-magenta: #ce93d8;
	}
}
* {
	box-sizing: border-box;
}
body {
	margin: 0;
	background: var(--bg);
	color: var(--fg);
	font:
		0.9375rem / 1.5 system-ui,
		sans-serif;
}
a {
	color: var(--accent);
	text-decoration: none;
}
a:hover {
	text-decoration: underline;
}
code,
pre,
.lineno {
	font-family: var(--mono);
}
header {
	display: flex;
	gap: 1rem;
	align-items: center;
	padding: 0.55rem 1.25rem;
	border-bottom: 1px solid var(--border);
	background: var(--card);
}
header h1 {
	font-size: 1rem;
	margin: 0;
	font-family: var(--mono);
	letter-spacing: -0.02em;
}
header h1 a::before {
	content: "❅ ";
	color: var(--accent);
}
header h1 a {
	color: var(--fg);
}
header > a {
	color: var(--muted);
	font-size: 0.9rem;
}
main {
	display: flex;
	gap: 2rem;
	padding: 1.25rem;
	max-width: 90rem;
	margin: 0 auto;
}
section.content {
	flex: 1;
	min-width: 0;
}
table {
	border-collapse: collapse;
	width: 100%;
}
th,
td {
	text-align: left;
	padding: 0.35rem 0.6rem;
	border-bottom: 1px solid var(--border);
}
th {
	color: var(--muted);
	font-weight: 600;
}
/* One status-to-color map consumed by dots, pills, sparklines, and
   project cards. Anything without a state falls back per consumer. */
.succeeded {
	--status-color: var(--ok);
}
.failed,
.failed_eval,
.dependency_failed,
.cached_failure {
	--status-color: var(--bad);
}
.evaluating,
.building {
	--status-color: var(--run);
}
.pending {
	--status-color: var(--queued);
}
.cancelled,
.skipped_local {
	--status-color: var(--muted);
}
/* Buildkite-style lists: rounded card, one row per item, status
   dots and pill labels. Shared by attribute and build tables. */
table.attrs,
table.builds,
.summary-strip,
.webhook-panel,
.pipeline {
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: 8px;
}
table.attrs,
table.builds {
	border-collapse: separate;
	border-spacing: 0;
	overflow: hidden;
}
table.attrs td,
table.builds td {
	border-bottom: 1px solid var(--border);
	padding: 0.5rem 0.75rem;
}
table.attrs tr:last-child td,
table.builds tr:last-child td {
	border-bottom: none;
}
table.attrs tr:hover td,
table.builds tr:hover td {
	background: var(--hover);
}
table.builds th {
	padding: 0.5rem 0.75rem;
	border-bottom: 1px solid var(--border);
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}
td.attr-name {
	width: 100%;
}
td.attr-name a {
	color: var(--fg);
}
td.attr-status,
td.attr-duration {
	white-space: nowrap;
}
td.attr-duration {
	text-align: right;
	color: var(--muted);
	font-variant-numeric: tabular-nums;
}
.dot {
	display: inline-block;
	width: 0.6rem;
	height: 0.6rem;
	border-radius: 50%;
	margin-right: 0.5rem;
	background: var(--status-color, var(--muted));
}
/* Radar ping: an expanding ring fades out while the icon stays solid. */
@keyframes ping {
	0% {
		box-shadow: 0 0 0 0 var(--status-color, var(--muted));
	}
	100% {
		box-shadow: 0 0 0 0.45rem transparent;
	}
}
.status {
	font-weight: 600;
	color: var(--status-color, inherit);
}
/* Header bar: one flex row - icon, repo, number, status pill, with
   the prev/next pager pushed to the far edge. */
.build-header h2 {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 0.5rem;
}
.build-header h2 .status-icon {
	margin-right: 0;
}
.build-header h2 .status {
	font-size: 0.95rem;
	padding: 0.1rem 0.65rem;
	border-radius: 1rem;
	background: color-mix(
		in srgb,
		var(--status-color, var(--muted)) 12%,
		transparent
	);
}
.build-header h2 .pager {
	margin-left: auto;
	padding: 0;
	gap: 0.75rem;
	font-size: 1rem;
	font-weight: 400;
}
/* Buildkite-style status icons on the attribute list: shape + color
   carry the state, text stays for screen readers and tooltips. */
.status-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 1.15rem;
	height: 1.15rem;
	margin-right: 0.5rem;
	border: 1.5px solid var(--status-color, var(--muted));
	border-radius: 50%;
	color: var(--status-color, var(--muted));
	font-size: 0.7rem;
	line-height: 1;
	vertical-align: text-bottom;
}
td.attr-status .status-icon {
	margin-right: 0;
}
h2 .status-icon {
	width: 1.3rem;
	height: 1.3rem;
	font-size: 0.8rem;
}
.status-icon.succeeded::before {
	content: "\2713";
}
.status-icon.failed::before,
.status-icon.failed_eval::before,
.status-icon.dependency_failed::before,
.status-icon.cached_failure::before,
.status-icon.cancelled::before {
	content: "\2715";
}
.status-icon.building::before,
.status-icon.evaluating::before,
.status-icon.running::before {
	content: "\25cf";
}
.status-icon.building,
.status-icon.evaluating,
.status-icon.running {
	animation: ping 1.6s cubic-bezier(0, 0, 0.2, 1) infinite;
}
.status-icon.idle {
	animation: none;
}
@media (prefers-reduced-motion: reduce) {
	.status-icon.building,
	.status-icon.evaluating {
		animation: none;
	}
}
.status-icon.cancelled,
.status-icon.skipped_local {
	border-style: dashed;
	opacity: 0.6;
}

/* Pill chrome on the build lists; headings keep plain text. No color
   here: it would outweigh the .status.<state> variants below (higher
   specificity). currentColor keeps the border in sync with the state
   color. */
table.builds .status {
	font-size: 0.75rem;
	padding: 0.1rem 0.55rem;
	border-radius: 999px;
	border: 1px solid currentColor;
	white-space: nowrap;
}
.muted {
	color: var(--muted);
}
time[title] {
	cursor: help;
	border-bottom: 1px dotted var(--muted);
}
pre.error {
	background: var(--card);
	border-left: 4px solid var(--bad);
	padding: 0.5rem 0.8rem;
	white-space: pre-wrap;
	overflow-x: auto;
	font-size: 0.8125rem;
}
pre.warning {
	border-left-color: var(--warn);
}
details summary {
	cursor: pointer;
}
/* Live (deduplicated) eval warnings streamed during evaluation. */
.live-warnings {
	border: 1px solid var(--border);
	border-radius: 6px;
	margin: 0.5rem 0;
	overflow: hidden;
}
.live-warnings .lw-head {
	background: var(--card);
	padding: 0.35rem 0.6rem;
	font-size: 0.85rem;
}
.live-warnings .lw-muted {
	color: var(--muted);
}
.live-warnings .lw-badge {
	background: var(--warn);
	color: var(--bg);
	border-radius: 999px;
	font-size: 0.75rem;
	padding: 0 0.55em;
	font-weight: 600;
}
.live-warnings ul {
	list-style: none;
	margin: 0;
	padding: 0;
	font-family: var(--mono);
	font-size: 0.8125rem;
}
.live-warnings li {
	display: flex;
	gap: 0.7em;
	align-items: baseline;
	padding: 0.25rem 0.6rem;
	border-top: 1px solid var(--border);
}
.live-warnings li .lw-level {
	color: var(--warn);
}
.live-warnings li.error .lw-level {
	color: var(--bad);
}
.live-warnings li .lw-msg {
	flex: 1;
	overflow-wrap: anywhere;
}
.live-warnings li .lw-count {
	font-size: 0.75rem;
	color: var(--bg);
	background: var(--muted);
	border-radius: 999px;
	padding: 0 0.5em;
	white-space: nowrap;
}
.live-warnings li .lw-count.hot {
	background: var(--warn);
}
/* Groups scroll internally: an expanding group must not push the
   summaries below it out of reach (infinite-scroll footer problem). */
.attr-scroll {
	max-height: 70vh;
	/* biome-ignore lint/suspicious/noDuplicateProperties: dvh with vh fallback */
	max-height: 70dvh;
	overflow: auto;
}
details.attr-group {
	margin: 0.75rem 0;
}
details.attr-group summary {
	color: var(--muted);
	font-size: 0.85rem;
}
details.error summary {
	color: var(--bad);
	font-family: var(--mono);
	font-size: 0.8125rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
details.error[open] summary {
	margin-bottom: 0.3rem;
}
details.error pre.error {
	margin: 0;
}
input[type="search"],
input[type="text"],
select,
button {
	background: var(--card);
	color: var(--fg);
	border: 1px solid var(--border);
	border-radius: 4px;
}
input[type="text"],
select {
	padding: 0.3rem 0.5rem;
}
form.filters {
	display: flex;
	gap: 0.5rem;
	margin: 0.8rem 0;
}
button {
	padding: 0.3rem 0.8rem;
	cursor: pointer;
}
button:hover {
	border-color: var(--run);
}
/* Account dropdown: everything but the core nav lives in here so
   the bar stays one row at any width and provider count. */
details.menu {
	position: relative;
}
details.menu summary {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	cursor: pointer;
	list-style: none;
	color: var(--muted);
	padding: 0.2rem 0.4rem;
	border-radius: 6px;
}
details.menu summary::-webkit-details-marker {
	display: none;
}
details.menu summary:hover {
	background: var(--hover);
}
details.menu .menu-label {
	font-size: 0.9rem;
}
.menu-panel {
	position: absolute;
	right: 0;
	top: calc(100% + 0.4rem);
	z-index: 20;
	display: grid;
	gap: 0.6rem;
	min-width: 13rem;
	padding: 0.8rem 1rem;
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: 8px;
	box-shadow: 0 6px 24px rgb(0 0 0 / 18%);
}
.login-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: 6px;
	padding: 0.3rem 0.75rem;
	font-size: 0.85rem;
	color: var(--fg);
	white-space: nowrap;
}
.login-btn:hover {
	border-color: var(--run);
	text-decoration: none;
}
.login-btn svg {
	width: 16px;
	height: 16px;
	fill: currentcolor;
}
.pager {
	display: flex;
	gap: 1rem;
	padding: 0.8rem 0;
}
.build-progress {
	display: flex;
	gap: 0.75rem;
	align-items: center;
}
.spinner {
	flex: none;
	width: 0.9rem;
	height: 0.9rem;
	border: 2px solid var(--border);
	border-top-color: var(--run);
	border-radius: 50%;
	animation: spin 0.9s linear infinite;
}
@keyframes spin {
	to {
		transform: rotate(360deg);
	}
}
@media (prefers-reduced-motion: reduce) {
	/* A frozen ring reads as a rendering glitch; slow, small rotation
	   is acceptable under reduced motion. */
	.spinner {
		animation-duration: 3s;
	}
}
.progress-track {
	flex: 1;
	max-width: 28rem;
	height: 0.6rem;
	display: flex;
	overflow: hidden;
	border-radius: 0.3rem;
	background: var(--border);
}
.progress-track .seg {
	transition: width 0.6s ease;
}
.progress-track .ok {
	background: var(--ok);
}
.progress-track .bad {
	background: var(--bad);
}
.progress-track .off {
	background: var(--muted);
}
.progress-track .run {
	background: var(--run);
	animation: progress-pulse 2s ease-in-out infinite;
}
@keyframes progress-pulse {
	50% {
		opacity: 0.55;
	}
}
@media (prefers-reduced-motion: reduce) {
	.progress-track .run {
		animation: none;
	}
}
/* Fitts: small inline links get a larger hit area. */
.pager a {
	padding: 0.35rem 0.4rem;
	margin: -0.35rem -0.4rem;
}

/* Build page header */
.build-header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 1rem;
	flex-wrap: wrap;
}
.build-header .controls {
	display: flex;
	gap: 0.5rem;
	/* Align with the heading text, not the section top. */
	margin-top: 0.5rem;
}
.build-header .pager {
	display: inline-flex;
	padding: 0;
	margin-left: 0.5rem;
	font-size: 0.85rem;
	font-weight: normal;
}
p.build-meta {
	margin-top: 0;
	color: var(--muted);
}

/* Headings */
h2 {
	font-size: 1.25rem;
	letter-spacing: -0.01em;
}
h2 code {
	font-size: 1.1rem;
}
h2 small {
	color: var(--muted);
	font-weight: normal;
	font-size: 0.85rem;
}
h3,
h2.section {
	color: var(--muted);
	font-size: 0.8rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	margin: 1.5rem 0 0.5rem;
}
.section-row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 1rem;
}

/* Log viewer */
pre.log {
	background: var(--card);
	padding: 0.8rem;
	overflow: auto;
	/* Own scroll pane: tail-following must not scroll the page and
     hide the header. dvh tracks the collapsing mobile URL bar. */
	max-height: calc(100vh - 11rem);
	/* biome-ignore lint/suspicious/noDuplicateProperties: dvh with vh fallback */
	max-height: calc(100dvh - 11rem);
	overscroll-behavior: contain;
	font-size: 0.8125rem;
	line-height: 1.4;
}
.logline {
	display: block;
}
.logline:target {
	background: var(--highlight);
}
.lineno {
	display: inline-block;
	width: 4ch;
	margin-right: 1ch;
	padding: 0.15rem 0.3rem;
	text-align: right;
	color: var(--muted);
	user-select: none;
}
.ansi-red,
.ansi-bright-red {
	color: var(--bad);
}
.ansi-green,
.ansi-bright-green {
	color: var(--ok);
}
.ansi-yellow,
.ansi-bright-yellow {
	color: var(--warn);
}
.ansi-blue,
.ansi-bright-blue,
.ansi-cyan,
.ansi-bright-cyan {
	color: var(--run);
}
.ansi-magenta,
.ansi-bright-magenta {
	color: var(--ansi-magenta);
}
.ansi-bold {
	font-weight: bold;
}

/* Accessibility */
.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}
.skip-link {
	position: absolute;
	left: -100vw;
	top: 0;
	z-index: 10;
	padding: 0.5rem 1rem;
	background: var(--accent);
	color: #fff;
}
.skip-link:focus {
	left: 0;
}
:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
	.dot {
		animation: none;
	}
}

/* Dashboard (homepage) */
.summary-strip {
	display: flex;
	gap: 1.5rem;
	align-items: center;
	margin: 0.5rem 0 1.5rem;
	padding: 0.75rem 1rem;
}
.summary-item {
	display: inline-flex;
	align-items: center;
	font-size: 0.9rem;
}
.pipelines {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
	margin-bottom: 2rem;
}
.pipeline {
	display: flex;
	align-items: center;
	gap: 1rem;
	padding: 0.8rem 1.2rem;
	border-left: 3px solid var(--status-color, var(--border));
	color: var(--fg);
	text-decoration: none;
}
.pipeline:hover {
	border-color: var(--accent);
	border-left-color: var(--status-color, var(--accent));
}
.pipeline-info {
	display: flex;
	flex-direction: column;
	min-width: 0;
	flex: 1;
}
.pipeline-name {
	font-family: var(--mono);
	font-weight: 600;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.pipeline-meta {
	font-size: 0.85rem;
}
/* Last ten builds, oldest to newest; bar height tracks duration. */
.pipeline-spark {
	display: flex;
	align-items: flex-end;
	gap: 3px;
	height: 2.2rem;
	width: 12rem;
}
.spark-bar {
	flex: 1;
	max-width: 1rem;
	border-radius: 2px 2px 0 0;
	background: var(--status-color, var(--muted));
	opacity: 0.85;
}
.spark-bar:hover {
	opacity: 1;
}
.pipeline-metric {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	min-width: 5.5rem;
	font-variant-numeric: tabular-nums;
}
.pipeline-metric span {
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}
@media (max-width: 50rem) {
	.pipeline-spark,
	.pipeline-metric {
		display: none;
	}
}
.pipeline-row {
	position: relative;
}
.pipeline-row > .pipeline {
	min-width: 0;
}
/* Make room for the overlaid toggle button. */
.pipeline-row:has(.toggle-btn) > .pipeline {
	padding-right: 5.5rem;
}
.pipeline-row.disabled .pipeline {
	opacity: 0.55;
	padding: 0.35rem 5.5rem 0.35rem 1.2rem;
}
.pipeline-row form {
	position: absolute;
	top: 50%;
	right: 1rem;
	transform: translateY(-50%);
}
.toggle-btn {
	padding: 0.25rem 0.7rem;
	font-size: 0.8rem;
	color: var(--muted);
	background: transparent;
	border: 1px solid var(--border);
	border-radius: 6px;
}
.toggle-btn:hover {
	color: var(--fg);
	border-color: var(--muted);
}

/* Shared page furniture */
.queue-pos {
	display: inline-block;
	min-width: 1.6rem;
	padding: 0.1rem 0.4rem;
	text-align: center;
	font-family: var(--mono);
	font-size: 0.85rem;
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: 6px;
}
table td.empty-state {
	padding: 1.5rem;
	text-align: center;
	color: var(--muted);
}
.scroll-sentinel {
	padding: 1rem;
	text-align: center;
	font-size: 0.85rem;
}
.header-spacer {
	margin-left: auto;
}
.avatar {
	border-radius: 50%;
	/* Header aligns on baseline, which would push the image up. */
	align-self: center;
}

/* Wide tables scroll sideways inside a wrapper; display: block on
   the table itself would strip its screen-reader role. */
.table-scroll {
	overflow-x: auto;
}

/* Webhook setup card (repo page, admins). */
details.webhook-setup {
	margin: 0.75rem 0;
}
details.webhook-setup summary {
	color: var(--muted);
	cursor: pointer;
}
.webhook-panel {
	margin-top: 0.5rem;
	max-width: 46rem;
	padding: 0.9rem 1.1rem;
}
.webhook-panel p {
	margin-top: 0;
}
.webhook-panel dl {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 0.45rem 1.2rem;
	margin: 0;
	align-items: center;
}
.webhook-panel dt {
	color: var(--muted);
}
.webhook-panel dd {
	margin: 0;
	display: flex;
	align-items: center;
	gap: 0.6rem;
	flex-wrap: wrap;
	min-width: 0;
}
.webhook-panel code {
	overflow-wrap: anywhere;
}
.copy-btn {
	font-size: 0.75rem;
	padding: 0.15rem 0.5rem;
}
