:root {
  color-scheme: light;
  --page: #f8f9fa;
  --surface: #ffffff;
  --surface-muted: #f1f3f5;
  --line: #dce1e5;
  --line-strong: #c7cdd2;
  --ink: #171a1d;
  --muted: #5f6972;
  --faint: #87919a;
  --green: #147a4b;
  --green-soft: #dff3e8;
  --blue: #1769aa;
  --blue-soft: #dbeaf7;
  --amber: #9a5b00;
  --amber-soft: #fff1d6;
  --red: #b63232;
  --red-soft: #f9e1e1;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #111416;
    --surface: #181c1f;
    --surface-muted: #23282c;
    --line: #343b40;
    --line-strong: #485158;
    --ink: #f3f5f6;
    --muted: #adb6bd;
    --faint: #7f8a92;
    --green: #65d59c;
    --green-soft: #1c3b2c;
    --blue: #71b8ef;
    --blue-soft: #17354c;
    --amber: #f0b95d;
    --amber-soft: #493818;
    --red: #ef8585;
    --red-soft: #4a2525;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font:
    14px/1.45 ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  letter-spacing: 0;
}

main {
  width: min(1200px, calc(100% - 40px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 24px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.15;
}

header p,
.section-head p {
  color: var(--muted);
  margin-top: 4px;
}

.freshness {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  color: var(--faint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.health {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--green);
  font-weight: 650;
}

.health.stale {
  color: var(--amber);
}

.health.offline {
  color: var(--red);
}

.status-dot,
.runner-dot {
  display: inline-block;
  flex: none;
  border-radius: 50%;
  background: currentColor;
}

.status-dot {
  width: 8px;
  height: 8px;
}

#error {
  display: none;
  margin-bottom: 20px;
  padding: 11px 13px;
  border: 1px solid var(--red);
  border-radius: 4px;
  background: var(--red-soft);
  color: var(--red);
}

.overview {
  display: grid;
  grid-template-columns: minmax(280px, 1.25fr) minmax(420px, 1fr);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.capacity-summary {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px;
  border-right: 1px solid var(--line);
}

.metric-label,
.metrics dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
}

.capacity-value {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-top: 6px;
}

.capacity-value strong {
  font-size: 30px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.capacity-value span {
  color: var(--muted);
}

.capacity-divider {
  padding: 0 3px;
  color: var(--line-strong);
}

.capacity-track {
  height: 8px;
  margin-top: 19px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--surface-muted);
}

.capacity-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--blue);
  transition: width 180ms ease;
}

.capacity-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
}

.metrics > div {
  min-width: 0;
  padding: 24px 18px;
}

.metrics > div + div {
  border-left: 1px solid var(--line);
}

.metrics dd {
  margin: 8px 0 4px;
  font-size: 26px;
  font-weight: 750;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.historical[hidden] {
  display: none;
}

.metrics > div:nth-child(n + 4) {
  border-top: 1px solid var(--line);
}

.metrics > div:nth-child(4) {
  border-left: 0;
}

.fleet,
.job-usage {
  margin-top: 34px;
}

.job-usage[hidden] {
  display: none;
}

.job-usage-table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.job-usage-table {
  width: 100%;
  min-width: 1160px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.job-usage-table th,
.job-usage-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

.job-usage-table th {
  color: var(--muted);
  background: var(--surface-muted);
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
}

.job-usage-table th:first-child,
.job-usage-table th:nth-child(2),
.job-usage-table td:first-child,
.job-usage-table td:nth-child(2) {
  text-align: left;
}

.job-usage-table tbody tr:last-child td {
  border-bottom: 0;
}

.job-usage-table td:first-child {
  width: 20%;
  color: var(--ink);
  font-weight: 650;
}

.job-usage-table td {
  color: var(--muted);
}

.job-usage-table .resource-cell {
  min-width: 154px;
}

.job-cell strong,
.job-cell span,
.resource-summary strong,
.resource-summary span {
  display: block;
}

.job-cell span,
.resource-summary span {
  margin-top: 2px;
  color: var(--faint);
  font-size: 10px;
  font-weight: 400;
}

.resource-summary {
  text-align: right;
}

.resource-summary strong {
  color: var(--ink);
  font-weight: 650;
}

.resource-value {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 6px;
}

.resource-value strong {
  color: var(--ink);
  font-weight: 650;
}

.resource-value span {
  color: var(--faint);
  font-size: 10px;
}

.resource-track {
  display: block;
  width: 100%;
  height: 3px;
  margin-top: 5px;
  overflow: hidden;
  background: var(--surface-muted);
}

.resource-track i {
  display: block;
  height: 100%;
  background: var(--blue);
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 12px;
}

h2 {
  font-size: 16px;
}

.section-head p {
  font-size: 12px;
}

.hosts {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.host-meta,
.pool-count {
  color: var(--muted);
  font-size: 12px;
}

.legend {
  display: flex;
  gap: 16px;
  color: var(--muted);
  font-size: 11px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.runner-dot {
  width: 8px;
  height: 8px;
}

.running-dot {
  color: var(--blue);
}

.ready-dot {
  color: var(--green);
}

.offline-dot {
  color: var(--faint);
}

.host {
  display: grid;
  grid-template-columns: minmax(190px, 0.75fr) minmax(420px, 1.5fr) 110px;
  align-items: center;
  gap: 28px;
  min-height: 112px;
  padding: 18px 20px;
}

.host + .host {
  border-top: 1px solid var(--line);
}

.host-name {
  font-weight: 750;
}

.host-meta {
  margin-top: 4px;
}

.host-usage {
  display: grid;
  gap: 5px;
  margin-top: 8px;
}

.usage > div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.usage strong {
  color: var(--ink);
  font-weight: 650;
}

.usage-track {
  display: block;
  height: 3px;
  margin-top: 2px;
  overflow: hidden;
  background: var(--surface-muted);
}

.usage-track i {
  display: block;
  height: 100%;
  background: var(--blue);
}

.runner-groups {
  display: grid;
  grid-template-columns: 4fr 1fr 5fr;
  gap: 12px;
}

.pool-label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  text-transform: capitalize;
}

.runner-cells {
  display: grid;
  grid-template-columns: repeat(var(--slots), minmax(13px, 1fr));
  gap: 4px;
}

.runner {
  height: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--surface-muted);
}

.runner.ready {
  border-color: var(--green);
  background: var(--green-soft);
}

.runner.busy {
  border-color: var(--blue);
  background: var(--blue);
}

.runner.focused {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.runner.offline {
  border-color: var(--line-strong);
  background: transparent;
}

.host-state {
  justify-self: end;
  text-align: right;
}

.host-state strong {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--green);
  font-size: 12px;
}

.host-state strong.booting {
  color: var(--amber);
}

.host-state span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.host-jobs {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: -12px;
}

.host-jobs a,
.host-jobs > div {
  display: inline-flex;
  min-width: 0;
  gap: 7px;
  padding: 4px 7px;
  border-left: 2px solid var(--blue);
  background: var(--surface-muted);
  color: var(--ink);
  font-size: 11px;
  text-decoration: none;
  transition:
    background 120ms ease,
    border-color 120ms ease;
}

.host-jobs .focused {
  border-left-color: var(--ink);
  background: var(--blue-soft);
}

.host-jobs span {
  color: var(--muted);
}

.host-jobs small {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.host-jobs strong {
  overflow: hidden;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 800px) {
  main {
    width: min(100% - 24px, 600px);
    padding-top: 20px;
  }

  header {
    align-items: flex-start;
  }

  h1 {
    font-size: 21px;
  }

  .overview {
    grid-template-columns: 1fr;
  }

  .capacity-summary {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .metrics > div {
    padding: 18px 14px;
  }

  .fleet,
  .job-usage {
    margin-top: 28px;
  }

  .fleet .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .legend {
    gap: 12px;
  }

  .host {
    grid-template-columns: 1fr auto;
    gap: 18px 12px;
    padding: 16px;
  }

  .runner-groups {
    grid-column: 1 / -1;
    grid-row: 2;
    gap: 8px;
  }

  .host-state {
    grid-column: 2;
    grid-row: 1;
  }

  .host-jobs {
    grid-row: 3;
    margin-top: -6px;
  }
}

@media (max-width: 430px) {
  main {
    width: calc(100% - 20px);
  }

  header {
    gap: 12px;
  }

  header p {
    display: none;
  }

  .metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .metrics > div {
    padding: 16px 10px;
  }

  .metrics dd {
    font-size: 23px;
  }

  .metrics span {
    font-size: 10px;
  }

  .section-head p {
    max-width: 260px;
  }

  .runner-groups {
    grid-template-columns: 4fr 1fr 5fr;
  }

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

  .pool-count {
    display: none;
  }
}
