:root {
  color-scheme: light dark;
  --page: #f6f6f5;
  --surface: #ffffff;
  --text: #191919;
  --muted: #666666;
  --line: #e2e2df;
  --accent: #1f66b8;
  /* Status colours always travel with a symbol and a label. */
  --good: #0aac23;
  --warning: #fbb315;
  --critical: #dc3c3d;
  --info: #257de0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #101010;
    --surface: #191919;
    --text: #efefef;
    --muted: #9c9c9c;
    --line: #333333;
    --accent: #6cb0f5;
  }
}

* { box-sizing: border-box; }

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

header, main { max-width: 68rem; margin: 0 auto; padding: 0 1rem; }

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 3.5rem;
}

a { color: var(--accent); }
.brand { color: var(--text); font-weight: 600; text-decoration: none; }
h1 { font-size: 1.35rem; margin: 0.5rem 0; overflow-wrap: anywhere; }
h2 { font-size: 1.05rem; margin: 0 0 0.5rem; }
.muted, small { color: var(--muted); }
small { display: block; font-size: 0.82rem; font-weight: 400; }

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

.narrow { max-width: 30rem; }
main > .card.narrow:only-child { margin: 3rem auto; }
.scroll { overflow-x: auto; }

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: 0.75rem;
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 1rem;
}

.tiles li { margin: 0; }
.tiles strong { display: block; font-size: 2rem; line-height: 1.2; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.toolbar h1 { margin-right: auto; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.5rem 0.75rem 0.5rem 0; vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 0.85rem; }
tbody tr { border-top: 1px solid var(--line); }
td { font-variant-numeric: tabular-nums; }
tr.down td:nth-child(2), tr.fail td:nth-child(2), tr.notify_error td:nth-child(2) { font-weight: 600; }

.badge { display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap; }

.dot {
  display: inline-grid;
  place-items: center;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  border: 2px solid var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
}

.badge.up .dot { background: var(--good); border-color: var(--good); color: #ffffff; }
.badge.late .dot { background: var(--warning); border-color: var(--warning); color: #191919; }
.badge.down .dot { background: var(--critical); border-color: var(--critical); color: #ffffff; }
.badge.running .dot { border-color: var(--info); color: var(--info); }

form { display: flex; flex-direction: column; align-items: flex-start; gap: 0.75rem; }
header form, .toolbar form { margin: 0; }
section form { margin-bottom: 1rem; }
label { display: flex; flex-direction: column; gap: 0.25rem; width: 100%; font-weight: 500; }
label.inline { flex-direction: row; align-items: center; gap: 0.5rem; font-weight: 400; }

input[type="text"], input[type="password"] {
  font: inherit;
  padding: 0.5rem;
  width: 100%;
  color: var(--text);
  background: var(--page);
  border: 1px solid var(--line);
  border-radius: 6px;
}

button, .button {
  font: inherit;
  cursor: pointer;
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  border: 1px solid #1f66b8;
  background: #1f66b8;
  color: #ffffff;
  text-decoration: none;
}

button.quiet { background: transparent; border-color: var(--line); color: var(--text); }
button.danger { background: #b52b2c; border-color: #b52b2c; }

.notice { border-left: 4px solid var(--warning); padding: 0.5rem 0.75rem; background: var(--surface); }

code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; }
code { overflow-wrap: anywhere; }
pre {
  background: var(--page);
  border-radius: 6px;
  padding: 0.75rem;
  overflow: auto;
  max-height: 20rem;
  max-width: 100%;
}
details pre { max-width: 36rem; white-space: pre-wrap; overflow-wrap: anywhere; }

dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1rem; }
dt { color: var(--muted); }
dd { margin: 0; }
