/* Recent runs: history table, status pills and the empty, loading and error states. */

.runs {
  margin-top: 36px;
  scroll-margin-top: 24px;
}

.runs:focus {
  outline: none;
}

.runs__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.runs__head h2 {
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: -0.015em;
}

#refresh:disabled {
  opacity: 1;
}

#refresh:disabled .icon {
  animation: spin 800ms linear infinite;
}

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

.panel--runs {
  padding: 6px;
  animation-delay: 120ms;
}

.runs__table {
  width: 100%;
  border-collapse: collapse;
}

.runs__table th {
  padding: 12px 16px 10px;
  color: var(--ink-muted);
  font-size: var(--text-xs);
  font-weight: 500;
  text-align: left;
}

.runs__table th:nth-child(2) {
  width: 150px;
}

.runs__table th:nth-child(3) {
  width: 110px;
}

.runs__table th:nth-child(4) {
  width: 150px;
}

.runs__table td {
  padding: 12px 16px;
  border-top: 1px solid var(--hairline);
  vertical-align: middle;
}

.run-row > td:last-child {
  text-align: right;
}

.run-file {
  min-width: 0;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.run-file strong {
  display: block;
  font-weight: 500;
}

.run-file small {
  display: block;
  color: var(--ink-muted);
}

.run-file small + small {
  margin-top: 2px;
}

.run-date {
  color: var(--ink-muted);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 11px 0 8px;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
}

.status[data-tone='ok'] {
  background: var(--ok-tint);
  color: var(--ok-ink);
}

.status[data-tone='bad'] {
  background: var(--bad-tint);
  color: var(--bad-ink);
}

.status[data-tone='warn'] {
  background: var(--warn-tint);
  color: var(--warn-ink);
}

.status[data-tone='busy'] {
  background: var(--busy-tint);
  color: var(--busy-ink);
}

.status__pulse {
  width: 8px;
  height: 8px;
  margin-inline: 3px 2px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.35;
    transform: scale(0.8);
  }
}

.runs__state:empty {
  display: none;
}

.runs__note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--bad-tint);
  color: var(--bad-ink);
  font-size: var(--text-sm);
}

.empty {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
}

.empty__tile {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--glass-well);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.7);
}

.empty h3 {
  margin: 0;
  font-size: var(--text-md);
  font-weight: 600;
}

.empty p {
  color: var(--ink-muted);
  font-size: var(--text-sm);
}

.skeleton-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px 64px 96px;
  align-items: center;
  gap: 24px;
  padding: 20px 16px;
  border-top: 1px solid var(--hairline);
}

.skeleton-row:first-child {
  border-top: 0;
}

@media (max-width: 719px) {
  .runs {
    margin-top: 28px;
  }

  .runs__table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .runs__table,
  .runs__table tbody {
    display: block;
  }

  .run-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 12px;
    align-items: center;
    padding: 12px;
    border-top: 1px solid var(--hairline);
  }

  .run-row:first-child {
    border-top: 0;
  }

  .run-row > td {
    display: block;
    padding: 0;
    border: 0;
  }

  .run-row > td:nth-child(1) {
    grid-column: 1 / -1;
  }

  .run-row > td:nth-child(3) {
    grid-column: 1;
    grid-row: 3;
  }

  .run-row > td:nth-child(4):empty {
    display: none;
  }

  .run-row > td:nth-child(4) {
    grid-column: 2;
    grid-row: 2 / span 2;
  }

  .skeleton-row {
    grid-template-columns: minmax(0, 1fr) 80px;
    gap: 12px;
    padding: 16px 12px;
  }

  .skeleton-row > :nth-child(n + 3) {
    display: none;
  }
}
