/* The shell the dashboard fills in. Mobile first, because the glance the console exists
   for happens on a phone. */

:root {
  --ink: #1c1d1f;
  --paper: #f7f7f5;
  --edge: #d8d8d3;
  --quiet: #6a6b6e;
  --good: #2f6b3f;
  --warn: #8a5a12;
  --wrong: #a8321f;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e8e8e4;
    --paper: #17181a;
    --edge: #34363a;
    --quiet: #9a9ba0;
    --good: #74c48b;
    --warn: #d9a441;
    --wrong: #e2765f;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0 1rem 3rem;
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.5 system-ui, sans-serif;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--edge);
}

.mark {
  font-weight: 600;
}

main {
  max-width: 46rem;
  margin: 0 auto;
}

h1 {
  font-size: 1.4rem;
  margin: 1.5rem 0 1rem;
}

.jobs,
.runs,
.secrets,
.upcoming {
  list-style: none;
  margin: 0;
  padding: 0;
}

.jobs li,
.runs > li,
.secrets li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  align-items: baseline;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--edge);
}

.key,
.empty {
  color: var(--quiet);
  font-size: 0.85rem;
}

.key {
  font-family: ui-monospace, monospace;
}

.refused {
  color: var(--wrong);
}

.reason code {
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0;
}

label {
  width: 100%;
}

input,
button {
  font: inherit;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--edge);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
}

button {
  cursor: pointer;
  font-weight: 600;
}

/* The dashboard: banded, so what needs attention is above what does not, and badged, so
   an outcome is a shape and a colour before it is a word. */

.scheduler {
  margin: 0 0 1rem;
  color: var(--quiet);
  font-size: 0.9rem;
}

.scheduler.halted {
  color: var(--wrong);
  font-weight: 600;
}

.jobs li.band-0 {
  border-left: 3px solid var(--wrong);
  padding-left: 0.6rem;
}

.jobs li.band-2 .name {
  color: var(--quiet);
}

.name {
  font-weight: 600;
}

.when,
.due,
.label {
  color: var(--quiet);
  font-size: 0.85rem;
}

.badge {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
  padding: 0.1rem 0.5rem;
  border: 1px solid currentcolor;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.badge.ok {
  color: var(--good);
}

.badge.failed,
.badge.missed {
  color: var(--wrong);
}

.badge.aborted {
  color: var(--warn);
}

.badge.skipped,
.badge.never,
.badge.disabled {
  color: var(--quiet);
}

/* One attempt: the summary as its own line, then what it did and what it printed. */

.summary {
  display: flex;
  align-items: baseline;
  padding: 0.5rem 0.9rem;
  font-size: 1rem;
  white-space: normal;
}

.guard {
  color: var(--warn);
}

h2 {
  font-size: 1.1rem;
  margin: 2rem 0 0.5rem;
}

h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--quiet);
  margin: 1rem 0 0.25rem;
}

.facts {
  display: grid;
  grid-template-columns: minmax(6rem, auto) 1fr;
  gap: 0.25rem 1rem;
  margin: 0;
}

.facts dt {
  color: var(--quiet);
  font-size: 0.85rem;
}

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

.detail dd {
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
}

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

.artefacts li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  align-items: baseline;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--edge);
}

.captured {
  margin: 0;
  padding: 0.75rem;
  border: 1px solid var(--edge);
  border-radius: 4px;
  font-size: 0.8rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* A bounded capture must never read as the whole of it */
.elided {
  display: block;
  margin: 0.5rem 0;
  color: var(--warn);
  font-weight: 600;
}

/* A job on its own: what it runs, when it is next due, and what it has produced. */

nav {
  display: flex;
  gap: 1rem;
  margin-right: auto;
}

.upcoming li {
  padding: 0.15rem 0;
}

.knobs .own {
  color: var(--ink);
}

/* Run history: a run is one row, and the attempts before the last are indented under it
   so three retries read as one run rather than as three entries. */

.summary-line {
  flex-basis: 100%;
  color: var(--quiet);
  font-size: 0.85rem;
}

.earlier {
  flex-basis: 100%;
  list-style: none;
  margin: 0.25rem 0 0;
  padding: 0 0 0 1rem;
  border-left: 2px solid var(--edge);
}

.earlier li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  align-items: baseline;
  padding: 0.25rem 0;
}

.filter {
  margin: 0 0 1rem;
}

select {
  font: inherit;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--edge);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
}

.pager {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  margin: 1rem 0;
}

/* Controls: a run, a job taken out of service, and the confirmation that stands between
   the first of those and a congregation. */

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin: 1rem 0;
}

button.danger {
  border-color: var(--wrong);
  color: var(--wrong);
}

/* Settings: one control per setting, laid out from the schema rather than by hand. */

.settings {
  display: block;
  margin: 1rem 0;
}

.field {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  align-items: baseline;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--edge);
}

.field label {
  width: 12rem;
  color: var(--quiet);
  font-size: 0.85rem;
}

.field input[type="checkbox"] {
  width: auto;
}

textarea {
  font: inherit;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--edge);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  min-width: 16rem;
}

.actions {
  display: flex;
  gap: 0.75rem;
  margin: 1rem 0;
}

.problems {
  list-style: none;
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--wrong);
  border-radius: 4px;
}
