/* Styles for gt's custom elements. Site-wide typography and layout live
   in gt.css; this file only styles what the elements render. */

:root {
  --gt-bg: #ffffff;
  --gt-surface: #f6f7f9;
  --gt-surface-2: #eef0f3;
  --gt-border: #d9dde3;
  --gt-text: #1c2129;
  --gt-muted: #5d6673;
  --gt-accent: #2f5fd0;
  --gt-focus: #2f5fd0;
  --gt-success: #1d7a46;
  --gt-success-bg: #e5f4ea;
  --gt-failure: #b42318;
  --gt-failure-bg: #fdecea;
  --gt-running: #9a6100;
  --gt-running-bg: #fff4dc;
  --gt-pending: #5d6673;
  --gt-pending-bg: #eef0f3;
  --gt-neutral: #6b6f78;
  --gt-neutral-bg: #f1f1f3;
  --gt-present: #44607f;
  --gt-present-bg: #e9eff6;
  --gt-substituted: #3f5f9a;
  --gt-substituted-bg: #e8edf8;
  --gt-approval: #6d3fb5;
  --gt-approval-bg: #f1eafc;
  --gt-info: #1f6feb;
  --gt-info-bg: #e8f0fe;
  --gt-mark: #ffe58a;
  --gt-add-bg: #d8f6df;
  --gt-del-bg: #fde2e0;
  /* The changed words of a changed line: a step stronger, still readable. */
  --gt-add-mark: #a8f8bb;
  --gt-del-mark: #ffbfba;
  --gt-mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  --gt-radius: 6px;
  /* The one gap between related things: builds, a node's parts, a popover
     and its node. */
  --gt-space: 8px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --gt-bg: #12151a;
    --gt-surface: #181c22;
    --gt-surface-2: #1f242c;
    --gt-border: #2d333d;
    --gt-text: #dde2e9;
    --gt-muted: #98a1ae;
    --gt-accent: #7aa2ff;
    --gt-focus: #7aa2ff;
    --gt-success: #5fcf8c;
    --gt-success-bg: #15301f;
    --gt-failure: #ff7b72;
    --gt-failure-bg: #3a1a19;
    --gt-running: #f0b44c;
    --gt-running-bg: #3a2c12;
    --gt-pending: #98a1ae;
    --gt-pending-bg: #232830;
    --gt-neutral: #a0a5ae;
    --gt-neutral-bg: #23262c;
    --gt-present: #93b0d3;
    --gt-present-bg: #1c2633;
    --gt-substituted: #9db4ea;
    --gt-substituted-bg: #1d2538;
    --gt-approval: #c4a2ff;
    --gt-approval-bg: #2b2140;
    --gt-info: #79b8ff;
    --gt-info-bg: #142338;
    --gt-mark: #6b5a12;
    --gt-add-bg: #123d22;
    --gt-del-bg: #4a1a20;
    --gt-add-mark: #0f662d;
    --gt-del-mark: #7e1224;
  }
}

:root[data-theme="dark"] {
  --gt-bg: #12151a;
  --gt-surface: #181c22;
  --gt-surface-2: #1f242c;
  --gt-border: #2d333d;
  --gt-text: #dde2e9;
  --gt-muted: #98a1ae;
  --gt-accent: #7aa2ff;
  --gt-focus: #7aa2ff;
  --gt-success: #5fcf8c;
  --gt-success-bg: #15301f;
  --gt-failure: #ff7b72;
  --gt-failure-bg: #3a1a19;
  --gt-running: #f0b44c;
  --gt-running-bg: #3a2c12;
  --gt-pending: #98a1ae;
  --gt-pending-bg: #232830;
  --gt-neutral: #a0a5ae;
  --gt-neutral-bg: #23262c;
  --gt-present: #93b0d3;
  --gt-present-bg: #1c2633;
  --gt-substituted: #9db4ea;
  --gt-substituted-bg: #1d2538;
  --gt-approval: #c4a2ff;
  --gt-approval-bg: #2b2140;
  --gt-info: #79b8ff;
  --gt-info-bg: #142338;
  --gt-mark: #6b5a12;
  --gt-add-bg: #123d22;
  --gt-del-bg: #4a1a20;
  --gt-add-mark: #0f662d;
  --gt-del-mark: #7e1224;
}

/* ---- shared ------------------------------------------------------------- */

.gt-sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

.gt-hash,
.gt-run code,
.gt-copyable code {
  font-family: var(--gt-mono);
  font-size: 0.9em;
}

.gt-kind {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gt-muted);
}

.tone-success { --tone: var(--gt-success); --tone-bg: var(--gt-success-bg); }
.tone-failure { --tone: var(--gt-failure); --tone-bg: var(--gt-failure-bg); }
.tone-running { --tone: var(--gt-running); --tone-bg: var(--gt-running-bg); }
.tone-pending { --tone: var(--gt-pending); --tone-bg: var(--gt-pending-bg); }
.tone-neutral { --tone: var(--gt-neutral); --tone-bg: var(--gt-neutral-bg); }
.tone-present { --tone: var(--gt-present); --tone-bg: var(--gt-present-bg); }
.tone-substituted { --tone: var(--gt-substituted); --tone-bg: var(--gt-substituted-bg); }
.tone-approval { --tone: var(--gt-approval); --tone-bg: var(--gt-approval-bg); }

.gt-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  /* The icon has whitespace of its own on the left; the right side makes
     up for it so both ends look even. */
  padding: 0.25em 0.7em 0.25em 0.5em;
  border-radius: 999px;
  font-size: 0.8rem;
  line-height: 1.2;
  color: var(--tone, var(--gt-muted));
  background: var(--tone-bg, var(--gt-surface-2));
  white-space: nowrap;
}
.gt-chip.compact {
  justify-content: center;
  width: 1.75em;
  height: 1.75em;
  padding: 0;
}

.gt-chip-icon {
  display: inline-flex;
  flex: none;
  width: 1.05em;
  height: 1.05em;
}
.gt-icon {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.gt-icon .stroke {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.gt-icon .fill {
  fill: currentColor;
}
/* Small icons (in chips) need thicker lines to look the same. */
/* Six lambdas: thinner, or they run together. */
.gt-icon.nix .stroke {
  stroke-width: 1.6;
}
.gt-chip-icon .gt-icon .stroke {
  stroke-width: 2.8;
}

/* Neutral outcomes are grey, never red. "Not built" outcomes are outlined
   so they can't be mistaken for a build that ran. */
.gt-chip.tone-neutral {
  background: transparent;
  border: 1px solid var(--gt-neutral);
}
.gt-chip.tone-present,
.gt-chip.tone-substituted {
  background: transparent;
  border: 1px solid var(--tone);
}

.gt-spinner {
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-right: 0.4em;
  vertical-align: -0.1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: gt-spin 0.9s linear infinite;
}

.tone-running .gt-chip-icon {
  animation: gt-pulse 1.6s ease-in-out infinite;
}
.gt-chip-icon.spin {
  animation: gt-spin 0.9s linear infinite;
}

@keyframes gt-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes gt-pulse {
  50% {
    opacity: 0.35;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gt-spinner,
  .tone-running .gt-chip-icon,
  .gt-chip-icon.spin {
    animation: none;
  }
}

.gt-button,
.gt-log-toolbar button {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.25em 0.75em;
  border: 1px solid var(--gt-border);
  border-radius: var(--gt-radius);
  background: var(--gt-surface);
  color: var(--gt-text);
  cursor: pointer;
}

.gt-button:hover,
.gt-log-toolbar button:hover {
  background: var(--gt-surface-2);
}

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

.gt-button:disabled {
  opacity: 0.6;
  cursor: default;
}

.gt-link-button {
  font: inherit;
  background: none;
  border: 0;
  padding: 0;
  color: var(--gt-accent);
  text-decoration: underline;
  cursor: pointer;
}

gt-run :focus-visible,
gt-log :focus-visible,
gt-search :focus-visible,
gt-theme-toggle :focus-visible,
gt-status :focus-visible {
  outline: 2px solid var(--gt-focus);
  outline-offset: 2px;
}

.gt-error {
  border: 1px solid var(--gt-failure);
  background: var(--gt-failure-bg);
  border-radius: var(--gt-radius);
  padding: 0.6rem 0.8rem;
  margin: 0.5rem 0;
}

.gt-error pre,
.gt-error-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: var(--gt-mono);
  font-size: 0.82rem;
  margin: 0.4rem 0 0;
}

.gt-error-text {
  color: var(--gt-failure);
}

.gt-evaluating {
  color: var(--gt-running);
}

/* ---- status badge --------------------------------------------------------- */

.gt-status {
  display: inline-flex;
  gap: 0.35em;
  text-decoration: none;
  vertical-align: middle;
}

/* ---- run page ------------------------------------------------------------- */

.gt-run {
  display: block;
}

.gt-run-group {
  margin: 1rem 0;
}

.gt-run-group-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.75rem;
  margin-bottom: 0.4rem;
}

.gt-run-group-header h3 {
  margin: 0;
  font-size: 1rem;
}

.gt-chain {
  font-size: 0.85rem;
  color: var(--gt-muted);
}

/* Columns, gaps, padding and node height come from the graph layout
   (dag.ts), so builds line up like the effects' layers. */
.gt-flow {
  display: grid;
}

.gt-flow .gt-node {
  position: relative;
  height: var(--gt-node-h);
}

.gt-dag-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  border: 1px solid var(--gt-border);
  border-radius: var(--gt-radius);
  background: var(--gt-surface);
}

.gt-dag {
  position: relative;
}

.gt-dag-edges {
  position: absolute;
  inset: 0;
  overflow: visible;
}

.gt-dag-edge {
  fill: none;
  stroke: var(--gt-border);
  stroke-width: 1.6;
}

.gt-dag-edge.tone-success,
.gt-dag-edge.tone-approval {
  stroke: var(--tone);
  stroke-opacity: 0.7;
}

.gt-dag-edge.tone-neutral,
.gt-dag-edge.tone-pending {
  stroke-dasharray: 4 4;
}


.gt-node {
  position: absolute;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.35rem 0.6rem;
  text-align: left;
  font: inherit;
  color: var(--gt-text);
  background: var(--gt-bg);
  border: 1px solid var(--gt-border);
  border-radius: var(--gt-radius);
  /* The state colour, as a solid bar inside the left edge. */
  box-shadow: inset 4px 0 0 var(--tone, var(--gt-border));
  padding-left: calc(0.6rem + 4px);
  cursor: pointer;
  overflow: hidden;
}

.gt-node:hover {
  background: var(--gt-surface-2);
}

.gt-node.selected {
  box-shadow:
    inset 4px 0 0 var(--tone, var(--gt-border)),
    0 0 0 2px var(--gt-accent);
}

.gt-node.tone-neutral {
  color: var(--gt-muted);
}

.gt-node.tone-approval.kind-approval {
  background: var(--gt-approval-bg);
}

.gt-node-top,
.gt-node-sub {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.gt-node-top .gt-chip-icon {
  color: var(--tone);
}

.gt-node-name {
  font-family: var(--gt-mono);
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gt-node-state {
  font-size: 0.78rem;
  color: var(--tone);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gt-panel {
  margin: 1rem 0;
  min-width: 0;
}

.gt-panel > div:empty {
  display: none;
}

.gt-panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.7rem;
}

.gt-panel-header h2 {
  margin: 0;
  font-size: 1.1rem;
  font-family: var(--gt-mono);
  overflow-wrap: anywhere;
}

/* A node's facts (and what it used): tiles, a small label over its value,
   as many across as fit; long ones across the whole width. */
.gt-panel-facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
  gap: var(--gt-space);
  margin: 0.6rem 0;
  font-size: 0.9rem;
}

.gt-fact {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  padding: 0.45rem 0.65rem 0.5rem;
  background: var(--gt-surface);
  border: 1px solid var(--gt-border);
  border-radius: var(--gt-radius);
}

.gt-fact.wide {
  grid-column: 1 / -1;
}

.gt-panel-facts .gt-copyable {
  margin-top: 0;
}

.gt-panel-facts dt {
  color: var(--gt-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

/* What it used: tinted apart from the facts above. */
.gt-usage .gt-fact {
  background: var(--gt-info-bg);
  border-color: color-mix(in srgb, var(--gt-info) 25%, transparent);
}

/* How much of a limit: a bar, then the limit and its setting. */
.gt-fact-meter {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-top: 0.1rem;
}
.gt-meter {
  position: relative;
  display: block;
  height: 6px;
  min-width: 3rem;
  overflow: hidden;
  background: color-mix(in srgb, var(--gt-border) 70%, transparent);
  border-radius: 999px;
}
.gt-meter-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--gt-info);
  border-radius: inherit;
  transition: width 400ms ease-out;
}
.near .gt-meter-fill {
  background: var(--gt-running);
}
.over .gt-meter-fill {
  background: var(--gt-failure);
}
.gt-fact-limit {
  color: var(--gt-muted);
  font-size: 0.75rem;
  overflow-wrap: anywhere;
}
.gt-fact-limit code {
  font-size: 0.7rem;
}
@media (prefers-reduced-motion: reduce) {
  .gt-meter-fill {
    transition: none;
  }
}

/* The evaluation's usage, between its head and its log. */
.eval-usage:not(:empty) {
  padding: 0 0.6rem;
}
.eval-usage .gt-panel-facts {
  margin: 0.5rem 0;
}

/* ---- frames: one look for boxes that hold a log, an approval, a status.
   Tinted by the state of what they're about; the content inside (a log,
   Markdown) looks the same whatever the state. ---------------------------- */

.gt-frame,
.gt-panel > [data-part="info"] {
  padding: 12px 14px;
  border: 1px solid var(--gt-border);
  border-radius: 10px;
  background: var(--gt-bg);
  min-width: 0;
}
.gt-frame[class*="tone-"] {
  background: var(--tone-bg, var(--gt-bg));
  border-color: color-mix(in srgb, var(--tone, var(--gt-border)) 45%, transparent);
}

/* A node's parts (facts, approval, logs), one space apart. */
.gt-node-view,
.gt-panel {
  display: grid;
  gap: var(--gt-space);
}
.gt-node-view > [hidden],
.gt-panel > [hidden] {
  display: none;
}

/* The commit head: stacked in the CI status, side by side over a log. */
.gt-commit-head {
  display: grid;
  gap: 0.1rem;
}
.gt-status-details > .gt-commit-head {
  margin-bottom: var(--gt-space);
}
/* Room for the open button in the popover's corner. */
.gt-status-popover .gt-commit-head {
  padding-right: 1.75rem;
}
.gt-approval-result:empty {
  display: none;
}
.gt-log-frame .gt-commit-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.2rem 1rem;
}
.gt-log-frame > .gt-commit-head {
  margin-bottom: var(--gt-space);
}
/* Approvals: what it's about, then (for deciders) an unframed comment that
   grows as you write, and approve/deny. */
.gt-approval-summary + .gt-approval-summary {
  margin-top: var(--gt-space);
  padding-top: var(--gt-space);
  border-top: 1px solid color-mix(in srgb, var(--tone) 30%, transparent);
}
/* Which effect wrote it. */
.gt-approval-summary > h3 {
  margin: 0 0 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gt-muted);
}
.gt-approval-form {
  display: grid;
  gap: var(--gt-space);
  margin-top: var(--gt-space);
}
textarea.gt-comment {
  width: 100%;
  padding: 0;
  font: inherit;
  color: var(--gt-text);
  background: transparent;
  border: 0;
  outline: 0;
  resize: none;
  overflow: hidden;
}
textarea.gt-comment::placeholder {
  color: var(--gt-muted);
}
.gt-approval-actions {
  display: flex;
  gap: var(--gt-space);
}
/* The badge colours turned around: the bright shade behind, the dark one
   for the text. */
.gt-button.approve,
.gt-button.deny {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  font-weight: 600;
}
.gt-button.approve {
  color: var(--gt-success-bg);
  background: var(--gt-success);
  border-color: var(--gt-success);
}
.gt-button.deny {
  color: var(--gt-failure-bg);
  background: var(--gt-failure);
  border-color: var(--gt-failure);
}
.gt-button .gt-icon {
  width: 1em;
  height: 1em;
}
.gt-button .gt-icon .stroke {
  stroke-width: 2.8;
}

.gt-run-published section {
  margin: 1rem 0;
}

.gt-run-published h3 {
  font-size: 1rem;
  margin: 0 0 0.4rem;
}

/* Artifacts and caches: at most --cols per line, fewer when a column
   would get narrower than --min. */
.gt-pub-list {
  --cols: 4;
  --min: 200px;
  --gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(
    auto-fill,
    minmax(max(min(var(--min), 100%), (100% - (var(--cols) - 1) * var(--gap)) / var(--cols)), 1fr)
  );
}

.gt-pub-list > li {
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--gt-border);
  border-radius: var(--gt-radius);
  min-width: 0;
}

.gt-pub-sizes {
  display: flex;
  margin-top: 0.2rem;
  font-size: 0.85rem;
}
.gt-pub-sizes:empty {
  display: none;
}

.gt-pub-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.6rem;
}

.gt-pub {
  font-size: 0.75rem;
  padding: 0 0.45em;
  border-radius: 999px;
  border: 1px solid var(--gt-border);
}

.gt-pub.public {
  color: var(--gt-success);
  border-color: var(--gt-success);
}

.gt-pub.private {
  color: var(--gt-muted);
}

.gt-files {
  list-style: none;
  margin: 0.3rem 0 0;
  padding: 0;
}

/* Icon copy buttons (also inside .copy-field). */
.copy-button {
  display: inline-flex;
  align-items: center;
  padding: 0.3em;
  font: inherit;
  color: var(--gt-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--gt-radius);
  cursor: pointer;
}
.copy-button:hover {
  color: var(--gt-text);
  background: var(--gt-surface-2);
}
.copy-button.copied {
  color: var(--gt-success);
}
.copy-button .gt-icon {
  width: 16px;
  height: 16px;
}
.gt-theme-toggle .gt-icon {
  width: 18px;
  height: 18px;
}
.gt-log-jump .gt-icon,
.job-link .gt-icon {
  width: 1em;
  height: 1em;
  margin-right: 0.25em;
  vertical-align: -0.12em;
}

.gt-copyable {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 100%;
  margin-top: 0.2rem;
}

.gt-copyable code {
  overflow-wrap: anywhere;
  min-width: 0;
}

/* Store paths cut from the left ("…-greeting-1.0": the hash goes first).
   Only the display is cut; the whole path is there to select and copy. */
.gt-copyable code.gt-tail {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  direction: rtl;
  text-align: left;
}
.gt-copyable code.gt-tail > span {
  direction: ltr;
  unicode-bidi: isolate;
}

.gt-copy {
  font-size: 0.75rem;
  padding: 0.05em 0.5em;
  flex: none;
}

/* ---- log viewer ----------------------------------------------------------- */

gt-log {
  display: block;
  min-width: 0;
}

.gt-log-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
  font-size: 0.85rem;
}

.gt-log-status {
  color: var(--gt-muted);
  margin-right: auto;
}

.gt-log-body {
  max-height: 70vh;
  overflow: auto;
  border: 1px solid var(--gt-border);
  border-radius: var(--gt-radius);
  background: var(--gt-surface);
  font-family: var(--gt-mono);
  font-size: 0.8rem;
  line-height: 1.45;
  padding: 0.3rem 0;
}

/* A phase reads like a log line: its start on the left, its name bold and
   coloured, its duration on the right. Folded unless opened. */
.gt-log-section summary {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr) max-content;
  padding: 0 0.6rem;
  cursor: pointer;
  list-style: none;
}
.gt-log-section summary::-webkit-details-marker {
  display: none;
}
.gt-log-section summary:hover {
  background: var(--gt-surface-2);
}
.gt-log-phase-name {
  font-weight: 700;
  color: var(--gt-accent);
}
.gt-log-phase-name .gt-icon {
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-right: 0.25em;
  vertical-align: -0.1em;
  transition: transform 100ms ease-out;
}
.gt-log-phase[open] > summary .gt-log-phase-name .gt-icon {
  transform: rotate(90deg);
}
/* Nothing to unfold. */
.gt-log-phase.empty > summary {
  cursor: default;
}
.gt-log-phase.empty > summary .gt-icon {
  visibility: hidden;
}
.gt-log-phase-count {
  margin-left: 0.8em;
  color: var(--gt-muted);
  font-weight: 400;
}
.gt-log-phase[open] .gt-log-phase-count {
  display: none;
}
.gt-log-phase-dur {
  color: var(--gt-muted);
  font-variant-numeric: tabular-nums;
}

.gt-log-line {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  padding: 0 0.6rem;
}

.gt-log-line:hover {
  background: var(--gt-surface-2);
}

.gt-log-t {
  color: var(--gt-muted);
  user-select: none;
  font-variant-numeric: tabular-nums;
}

.gt-log-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.gt-log-line.s1 .gt-log-text {
  color: var(--gt-failure);
}

.gt-log-line.s2 .gt-log-text {
  color: var(--gt-muted);
  font-style: italic;
}

/* gt's own lines (what it builds and fetches, how it ended). */
.gt-log-line.s4 .gt-log-text {
  color: var(--gt-accent);
}

.gt-log-empty {
  padding: 0.3rem 0.6rem;
  margin: 0;
}

.gt-log-jump {
  position: sticky;
}

/* ---- search ---------------------------------------------------------------- */

gt-search {
  display: block;
}

gt-search form {
  display: flex;
  gap: 0.5rem;
}

gt-search input[type="search"],
gt-search input[name="q"] {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-family: var(--gt-mono);
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--gt-border);
  border-radius: var(--gt-radius);
  background: var(--gt-bg);
  color: var(--gt-text);
}

.gt-search-status {
  margin: 0.5rem 0;
}

.gt-results {
  list-style: none;
  margin: 0.5rem 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

.gt-result {
  border: 1px solid var(--gt-border);
  border-radius: var(--gt-radius);
  overflow: hidden;
  min-width: 0;
}

.gt-result-head,
.gt-result-meta {
  padding: 0.35rem 0.6rem;
  overflow-wrap: anywhere;
}

.gt-result-head {
  background: var(--gt-surface);
}

.gt-result-repo {
  font-weight: 600;
}

.gt-result-path {
  font-family: var(--gt-mono);
}

.gt-result-lines {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--gt-mono);
  font-size: 0.8rem;
}

.gt-result-lines td {
  padding: 0 0.6rem;
  vertical-align: top;
}

.gt-lineno,
.gt-diff-tag {
  color: var(--gt-muted);
  text-align: right;
  user-select: none;
}
.gt-lineno {
  width: 1%;
  white-space: nowrap;
}

.gt-code {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.gt-diff tr.add {
  background: var(--gt-add-bg);
}

.gt-diff tr.del {
  background: var(--gt-del-bg);
}

gt-search mark {
  background: var(--gt-mark);
  color: inherit;
  border-radius: 2px;
}

/* ---- theme toggle ------------------------------------------------------------ */


/* ---- CI status details (landing box, badge popover) --------------------- */

gt-status {
  position: relative;
  display: inline-block;
}
gt-status[detailed] {
  display: block;
}
/* A small heading per group; its chips flow and wrap like words. */
.gt-outcome-group {
  margin: 0 0 0.6rem;
}
.gt-outcome-group h3 {
  margin: 0 0 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gt-muted);
}
.gt-outcomes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.gt-status-error {
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}
/* Popovers: one look (status, a run's node, a time's date). They fade in
   and drop a little; where they sit is up to each kind. */
/* In the top layer (the browser's popovers), placed by their scripts or
   their own rules (which this, without specificity, leaves alone). */
:where(.gt-popover) {
  position: fixed;
  inset: auto;
  margin: 0;
}
/* Closed is hidden, whatever display a popover's own rules give it. */
.gt-popover[popover]:not(:popover-open) {
  display: none;
}
.gt-popover {
  color: var(--gt-text);
  padding: 0.75rem 0.9rem;
  background: var(--gt-bg);
  border: 1px solid var(--gt-border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.25);
  white-space: normal;
  text-align: left;
  opacity: 0;
  transform: translateY(-4px);
  transition:
    opacity 120ms ease-out,
    transform 120ms ease-out;
}
.gt-popover.open {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  .gt-popover {
    transition: none;
  }
}
/* Placed by the script, below its badge. */
.gt-status-popover {
  width: max-content;
  max-width: min(360px, calc(100vw - 32px));
}
/* Relative times: click for the date. */
time.gt-reltime {
  cursor: pointer;
}
.gt-time-popover {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* A commit's author: click for the name and email. */
.gt-author {
  cursor: pointer;
}
.gt-author-popover {
  overflow-wrap: anywhere;
}

/* The selected node's popover on the run page: placed below the node by
   the script, otherwise like the status popover. */
gt-run {
  position: relative;
  display: block;
}
/* The node popover holds the node's whole view, logs included: wide, no
   taller than the room on screen (popover.ts), scrolling inside. */
.gt-node-popover {
  width: min(1100px, calc(100vw - 32px));
}
/* One scroll area: the popover's, not the log's as well. */
.gt-node-popover .gt-log-body {
  max-height: none;
}
/* To the node's own page, in the corner. */
.gt-popover-open {
  position: absolute;
  top: 0.75rem;
  right: 0.9rem;
  z-index: 1;
}
/* Room for it at the end of the header. */
.gt-node-popover .gt-panel-header {
  padding-right: 2.5rem;
}
.gt-node-popover .gt-panel-header h2 {
  font-size: 1rem;
  margin: 0;
}
.gt-reason {
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.gt-node-popover .gt-panel-facts {
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  font-size: 0.85rem;
  margin: 0.5rem 0;
}

/* A trigger's past runs: outcome, when (to that run), who, which commit. */
.gt-history > summary {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  list-style: none;
  cursor: pointer;
}
.gt-history > summary::-webkit-details-marker {
  display: none;
}
.gt-history[open] > summary {
  margin-bottom: var(--gt-space);
}
.gt-history h3 {
  margin: 0;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gt-muted);
}
.gt-history ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
  /* About eight runs (rows are as tall as their small icon button); older
     ones scroll. */
  max-height: calc(8 * 26px + 7 * 0.35rem);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.gt-history li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.875rem;
}
.gt-history .gt-hash {
  margin-left: auto;
}

/* Skeletons: the shape of what's loading. */
.sk {
  display: block;
  height: 1em;
  margin: 0.2em 0;
  border-radius: 4px;
  background: var(--gt-surface-2);
  animation: gt-sk 1.2s ease-in-out infinite alternate;
}
.sk.sk-chip {
  display: inline-block;
  width: 7.5em;
  height: 1.6em;
  margin: 0;
  border-radius: 999px;
}
@keyframes gt-sk {
  from {
    opacity: 0.55;
  }
  to {
    opacity: 1;
  }
}
.sk.sk-long {
  width: 70%;
}
.sk.sk-short {
  width: 45%;
}

/* A search input with its query highlighted (querysyntax.ts): the text in
   colour behind it, the input's own text transparent. */
.query-field {
  position: relative;
  display: flex;
  flex: 1;
  min-width: 0;
}
.query-field > input.query-input {
  flex: 1;
  position: relative;
  background: transparent;
  color: transparent;
  caret-color: var(--gt-text);
}
.query-mirror {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  overflow: hidden;
  pointer-events: none;
  color: var(--gt-text);
}
.query-text {
  white-space: pre;
}
/* Query syntax, also in the hints. */
.q-key,
.q-or,
.q-re-delim,
.q-re-group {
  color: var(--gt-accent);
}
.q-neg {
  color: var(--gt-failure);
}
.q-re-class {
  color: var(--gt-running);
}
.q-re-quant {
  color: var(--gt-approval);
}

/* ---- the live view: the top button, and what runs ----------------------- */

.monitor-button {
  position: relative;
}
.gt-monitor-count {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  color: var(--gt-bg);
  background: var(--gt-running);
  border-radius: 999px;
}
.gt-monitor-count[hidden] {
  display: none;
}
.gt-monitor-popover {
  width: min(560px, calc(100vw - 32px));
  font-size: 0.875rem;
}
.gt-monitor-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}
.gt-monitor-head h2 {
  margin: 0;
  font-size: 1rem;
}
.gt-monitor-conn {
  font-size: 0.75rem;
  color: var(--gt-muted);
}
.gt-monitor-conn::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--gt-pending);
}
.gt-monitor-conn.on::before {
  background: var(--gt-success);
}
.gt-monitor-section {
  margin-top: 0.75rem;
}
.gt-monitor-section h3 {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gt-muted);
}
.gt-monitor-section > p {
  margin: 0;
}
.gt-monitor-n {
  padding: 0 6px;
  font-size: 0.7rem;
  line-height: 1.5;
  letter-spacing: 0;
  color: var(--gt-text);
  background: var(--gt-surface-2);
  border-radius: 999px;
}
.gt-monitor-n.warn {
  color: var(--gt-failure);
  background: var(--gt-failure-bg);
}
.gt-pools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.35rem 0.75rem;
  align-items: center;
}
.gt-pool {
  display: contents;
}
.gt-pool-name {
  overflow-wrap: anywhere;
}
.gt-pool-facts {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.75rem;
  margin: -0.25rem 0 0.15rem;
  font-size: 0.8rem;
}
.gt-pool-waiting {
  color: var(--gt-running);
}
.gt-pool .gt-meter {
  width: 6rem;
}
.gt-slots {
  display: inline-flex;
  gap: 3px;
}
.gt-slots > span {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--gt-surface-2);
  border: 1px solid var(--gt-border);
}
.gt-slots > span.on {
  background: var(--gt-running);
  border-color: var(--gt-running);
}
.gt-tasks {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.gt-task {
  display: grid;
  grid-template-columns: 16px auto minmax(0, 1fr);
  gap: 0.15rem 0.5rem;
  align-items: baseline;
  padding: 0.35rem 0.5rem;
  background: var(--gt-surface);
  border-radius: var(--gt-radius);
}
.gt-task-state .gt-icon {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
}
.gt-task.running .gt-task-state {
  color: var(--gt-running);
}
.gt-task.waiting .gt-task-state {
  color: var(--gt-pending);
}
.gt-task.done .gt-task-state {
  color: var(--gt-success);
}
.gt-task.failed .gt-task-state {
  color: var(--gt-failure);
}
.gt-task-kind {
  font-size: 0.75rem;
  color: var(--gt-muted);
}
.gt-task-what {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.5rem;
  min-width: 0;
  overflow-wrap: anywhere;
}
.gt-task-facts {
  grid-column: 2 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.75rem;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}
/* Someone else's: made-up words, blurred. */
.gt-redacted {
  filter: blur(4px);
  user-select: none;
  color: var(--gt-muted);
  font-family: var(--gt-mono);
  font-size: 0.8rem;
}
.gt-monitor-hits {
  margin-top: 0.75rem;
}
.gt-monitor-hits > summary {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gt-muted);
}
.gt-monitor-hits ul {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0.4rem 0 0;
  padding: 0;
  list-style: none;
}
.gt-monitor-hits li {
  padding: 0.3rem 0.5rem;
  border-left: 3px solid var(--gt-failure);
  background: var(--gt-failure-bg);
  border-radius: 0 var(--gt-radius) var(--gt-radius) 0;
  overflow-wrap: anywhere;
}
.gt-monitor-hits p {
  margin: 0.4rem 0 0;
}
