:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #005fd1;
  --accent-text: #ffffff;
  --accent-soft: #e0edff;
  --link: #005fd1;
  --good: #047857;
  --good-bg: #d1fae5;
  --wait: #92400e;
  --wait-bg: #fef3c7;
  --bad: #b91c1c;
  --bad-bg: #fee2e2;
  --neutral-bg: #f3f4f6;
  --radius: 14px;
  /* The dashboard's status colours (apps/dashboard/src/app/(payload)/custom.scss). */
  --tone-good: #0ca30c;
  --tone-warning: #fab219;
  --tone-serious: #ec835a;
  --tone-critical: #d03b3b;
  --tone-neutral: #8a8985;
  --cell-none: #e5e7eb;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0f14;
    --surface: #181921;
    --text: #f3f4f6;
    --muted: #9ca3af;
    --border: #2a2c38;
    --accent: #1f6fe0;
    --accent-text: #ffffff;
    --accent-soft: #14284a;
    --link: #6aa9ff;
    --good: #6ee7b7;
    --good-bg: #0f2e25;
    --wait: #fcd34d;
    --wait-bg: #33270b;
    --bad: #fca5a5;
    --bad-bg: #3a1414;
    --neutral-bg: #23252f;
    --cell-none: #2a2c38;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.page {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right))
    calc(24px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
}

.top {
  margin-bottom: 16px;
}

.title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 32px;
}

h1 {
  margin: 0;
  font-size: 1.6rem;
}

h2 {
  margin: 28px 0 10px;
  font-size: 1.05rem;
}

h3 {
  margin: 18px 0 8px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.top p {
  margin: 2px 0 0;
}

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

.small {
  font-size: 0.875rem;
}

a {
  color: var(--link);
}

.badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--wait-bg);
  color: var(--wait);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.notice {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--accent-soft);
}

.notice[data-tone="good"] {
  background: var(--good-bg);
  color: var(--good);
}

.notice[data-tone="wait"],
.notice.warn {
  background: var(--wait-bg);
  color: var(--wait);
}

.notice[data-tone="bad"] {
  background: var(--bad-bg);
  color: var(--bad);
}

button,
.button {
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.primary {
  display: block;
  width: 100%;
  min-height: 52px;
  margin: 12px 0;
  padding: 12px 16px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}

.primary:disabled {
  opacity: 0.5;
}

.primary.secondary {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--link);
}

.link {
  margin-top: 8px;
  padding: 8px 0;
  border: 0;
  background: none;
  color: var(--muted);
  text-decoration: underline;
}

.refresh {
  min-height: 32px;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--link);
  font-size: 0.875rem;
  font-weight: 600;
}

.refresh:disabled {
  opacity: 0.5;
}

/* The headline at the top: one tone for the worst state of any active check. */
.summary {
  --tone: var(--tone-neutral);
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--tone) 45%, var(--surface));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--tone) 14%, var(--surface));
}

.summary[data-tone="good"] { --tone: var(--tone-good); }
.summary[data-tone="warning"] { --tone: var(--tone-warning); }
.summary[data-tone="critical"] { --tone: var(--tone-critical); }

.summary__headline {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
}

.summary__icon {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--tone);
  color: #fff;
  font-size: 0.95rem;
}

.summary[data-tone="warning"] .summary__icon {
  color: #0b0b0b;
}

.summary__detail {
  margin: 6px 0 0 38px;
}

.run-result {
  margin: 0 0 8px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.run-result[data-tone="bad"] {
  background: var(--bad-bg);
  color: var(--bad);
}

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

.list > li {
  margin-bottom: 8px;
}

.item {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.row > strong {
  overflow-wrap: anywhere;
}

.meta {
  margin-top: 2px;
}

.detail {
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.external {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.875rem;
}

.empty {
  padding: 4px 0;
}

.call {
  flex: none;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
}

.pill {
  --tone: var(--tone-neutral);
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 5px;
  padding: 1px 9px 1px 7px;
  border: 1px solid color-mix(in srgb, var(--tone) 45%, var(--surface));
  border-radius: 999px;
  background: color-mix(in srgb, var(--tone) 18%, var(--surface));
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}

.pill__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--tone);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
}

.pill--good { --tone: var(--tone-good); }
.pill--warning { --tone: var(--tone-warning); }
.pill--serious { --tone: var(--tone-serious); }
.pill--critical { --tone: var(--tone-critical); }
.pill--neutral { --tone: var(--tone-neutral); }

.pill--warning .pill__icon {
  color: #0b0b0b;
}

/* One cell per block of time, oldest on the left. */
.strip {
  display: flex;
  gap: 1px;
  height: 18px;
  margin: 10px 0 6px;
  padding: 0;
  list-style: none;
}

.cell {
  flex: 1;
  min-width: 2px;
  border-radius: 2px;
  background: var(--cell-none);
}

.cell--up { background: var(--tone-good); }
.cell--degraded { background: var(--tone-warning); }
.cell--down { background: var(--tone-critical); }

.who {
  margin-top: 28px;
  margin-bottom: 0;
}

.steps li {
  margin: 8px 0;
}

.hint {
  margin-top: 28px;
}
