:root {
  color-scheme: light dark;
  --fg: #1b1b1b;
  --bg: #fdfdfd;
  --muted: #5c5c5c;
  --line: #d8d8d8;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fg: #e8e8e8;
    --bg: #17171a;
    --muted: #a4a4a4;
    --line: #34343a;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.page {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

h1 {
  font-size: 1.4rem;
  margin: 0 0 1rem;
}

h2 {
  font-size: 1.05rem;
  margin: 1.2rem 0 0.4rem;
}

a {
  color: inherit;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 0.4rem 0.5rem;
  text-align: left;
  vertical-align: top;
}

code,
pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
}

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

.logout {
  display: flex;
  justify-content: flex-end;
  margin: 0;
}

.login {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 20rem;
}

.login input,
.login button {
  font: inherit;
  padding: 0.4rem 0.5rem;
}

.error {
  border-left: 3px solid #b4341c;
  padding: 0.4rem 0.6rem;
  max-width: 32rem;
}

.api-response,
.report {
  border: 1px solid var(--line);
  margin: 0;
  padding: 0.6rem 0.8rem;
  max-width: 48rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.report {
  margin: 0.3rem 0 0.6rem;
}

.crumbs {
  color: var(--muted);
  margin: 0 0 0.6rem;
}

.card {
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  padding: 0.8rem 1rem;
  margin: 0 0 1rem;
}

.facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 48rem);
  gap: 0.3rem 0.8rem;
  margin: 0;
}

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

.facts dd {
  margin: 0;
  word-break: break-word;
}

.warn {
  border-left: 3px solid #b8860b;
  padding: 0.4rem 0.6rem;
  margin: 0.6rem 0 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.ok {
  border-left: 3px solid #2e7d32;
  padding: 0.4rem 0.6rem;
  margin: 0.6rem 0 0;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1rem;
}

.tabs a {
  border: 1px solid var(--line);
  border-radius: 0.3rem;
  padding: 0.3rem 0.7rem;
  text-decoration: none;
}

.tabs a.active {
  border-color: currentColor;
  font-weight: 600;
}

.button {
  border: 1px solid var(--line);
  border-radius: 0.3rem;
  padding: 0.3rem 0.7rem;
  text-decoration: none;
}

.state-ready,
.state-delivered {
  border-color: #2e7d32;
}

.state-checking,
.state-queued,
.state-pending,
.state-running,
.state-integrating {
  border-color: #b8860b;
}

.state-repairing,
.state-failed,
.state-waiting-repair {
  border-color: #b4341c;
}

.state-paused,
.state-cancelled,
.state-skipped,
.state-unknown {
  border-style: dashed;
}

.exit-ok {
  color: #2e7d32;
}

.exit-fail {
  color: #b4341c;
}

.phase {
  border-bottom: 1px dotted currentColor;
}

.counters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.9rem;
  list-style: none;
  padding: 0;
  margin: 0 0 0.8rem;
}

.deps {
  list-style: none;
  padding: 0;
  margin: 0;
}

.deps li.undelivered {
  font-weight: 600;
  border-left: 3px solid #b8860b;
  padding-left: 0.4rem;
}

.fields {
  display: grid;
  grid-template-columns: max-content minmax(0, 32rem);
  gap: 0.3rem 0.8rem;
  margin: 0;
}

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

.fields dd {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  white-space: pre-wrap;
  word-break: break-word;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 72rem;
  margin: 0 auto;
  padding: 0.8rem 1rem 0;
}

.menu {
  display: flex;
  gap: 1rem;
}

.menu a {
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.toolbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 0.8rem;
}

.toolbar p {
  margin: 0;
}

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

.refresh {
  border: 1px solid var(--line);
  padding: 0.2rem 0.6rem;
  text-decoration: none;
  white-space: nowrap;
}

.banner {
  border-left: 3px solid #b07a00;
  background: rgba(176, 122, 0, 0.08);
  padding: 0.4rem 0.6rem;
  margin: 0 0 0.6rem;
}

.badge {
  border: 1px solid currentColor;
  border-radius: 0.6rem;
  padding: 0 0.4rem;
  font-size: 0.85em;
  white-space: nowrap;
}

.state,
.slot {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  padding: 0 0.5rem;
  font-size: 0.9em;
  white-space: nowrap;
}

.state.is-green {
  border-color: #2f7a35;
  color: #2f7a35;
}

.state.is-warn {
  border-color: #b07a00;
}

.state-unknown,
.slot-unknown {
  color: var(--muted);
}

.slot-busy {
  border-color: #b07a00;
}

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

.url {
  word-break: break-all;
}

.projects td,
.settings td {
  font-size: 0.95em;
}

.repositories {
  margin: 0;
  padding-left: 1.2rem;
}

.task-title {
  font-weight: 600;
  margin: 0 0 0.4rem;
}

.description {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0 0 0.8rem;
}

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

.state-unavailable {
  border-style: dashed;
  color: var(--muted);
}

.image,
.cursor code {
  word-break: break-all;
}

.argv {
  margin: 0;
  padding-left: 1.2rem;
}

.argv li {
  word-break: break-all;
}

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

.kind {
  display: inline-block;
  border: 1px solid currentColor;
  border-radius: 0.6rem;
  padding: 0 0.5rem;
  font-size: 0.85em;
  white-space: nowrap;
}

.kind .mark {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.kind-merge {
  border-color: #2f7a35;
  color: #2f7a35;
}

.kind-repair {
  border-color: #1f5fa8;
  color: #1f5fa8;
}

.kind-resume {
  border-style: dashed;
}

.kind-present {
  border-style: dotted;
  color: var(--muted);
}

.checks td:first-child,
.branch-checks td:first-child {
  white-space: nowrap;
}

.checks tr.negative {
  background: rgba(180, 52, 28, 0.06);
}

.checks tr.negative td:first-child {
  border-left: 3px solid #b4341c;
}

td .report {
  max-width: 40rem;
}

.dag-node {
  fill: var(--bg);
  stroke: var(--line);
}

.dag-glyph,
.dag-label {
  fill: currentColor;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.dag-glyph {
  font-size: 13px;
}

.dag-label {
  font-size: 10px;
}

.dag-node.state-ready,
.dag-node.state-delivered {
  stroke: #2e7d32;
}

.dag-node.state-checking,
.dag-node.state-queued,
.dag-node.state-pending,
.dag-node.state-running,
.dag-node.state-integrating {
  stroke: #b8860b;
}

.dag-node.state-repairing,
.dag-node.state-failed,
.dag-node.state-waiting-repair {
  stroke: #b4341c;
}

.dag-node.state-paused,
.dag-node.state-cancelled,
.dag-node.state-skipped,
.dag-node.state-unknown {
  stroke-dasharray: 3 2;
}

.dag-node-planned {
  stroke-dasharray: 4 2;
  fill: transparent;
}

.dag-node-created {
  stroke-width: 2.4;
}

.dag-edge {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.2;
}

.dag-edge-undelivered {
  stroke-dasharray: 5 3;
}

.dag-arrow {
  fill: var(--muted);
}

.dag-scroll {
  overflow-x: auto;
  margin: 0.6rem 0 1rem;
}

.dag {
  display: block;
}

.form,
.retry {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: 40rem;
}

.form p {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0;
}

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

.form input,
.form textarea,
.form select,
.form button,
.retry button {
  font: inherit;
  padding: 0.35rem 0.5rem;
}

.form .hint,
.command .hint {
  color: var(--muted);
  font-size: 0.9em;
}

.form .invalid {
  border: 1px solid #b4341c;
  outline: 1px solid #b4341c;
}

.form fieldset.batch-row {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.2rem 0.6rem 0.6rem;
}

.form fieldset.batch-row legend {
  color: var(--muted);
}

.form p.buttons {
  flex-direction: row;
  gap: 0.6rem;
}

ul.problems {
  margin: 0.2rem 0 0;
}

tr.created td {
  background: rgba(46, 125, 50, 0.07);
}

.mark {
  color: var(--muted);
  font-size: 0.85em;
}

.message {
  margin: 0 0 0.6rem;
}

.failure {
  margin: 0.6rem 0 0.8rem;
}

.command {
  margin: 0;
}

/* The cancellation confirmation (UI-SPEC §8): a <dialog open>, so it is visible with no
   script, both inside the card region and on its own page. */
.confirm {
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  padding: 0.8rem 1rem;
  margin: 0.8rem 0 1rem;
  max-width: 48rem;
}

.confirm h2 {
  margin-top: 0;
}

.cancel {
  margin: 0.8rem 0 0;
}

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