/* The whole stylesheet. One page, one file, no framework.
 *
 * Dark because this is looked at next to a terminal, and a white panel in a
 * dark tmux is a flashlight. The type is the system's; nothing is fetched
 * from anywhere else, which is the property ad.key leans on. */

*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg: #14171a;
  --panel: #1c2126;
  --line: #2b3239;
  --fg: #e6edf3;
  --dim: #8b98a5;
  --ok: #3fb950;
  --warn: #d29922;
  --crit: #f85149;
  --run: #58a6ff;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, sans-serif;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

button, input { font: inherit; color: inherit; }

.mono, pre, .output { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.dim { color: var(--dim); }
.num { text-align: right; white-space: nowrap; }
.grow { width: 100%; }

/* --- page ------------------------------------------------------------- */

.page { max-width: 68rem; margin: 0 auto; padding: 1rem; }

.top {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: baseline;
  justify-content: space-between;
  padding: .25rem 0 1rem;
  border-bottom: 1px solid var(--line);
}
.top .name strong { font-size: 1.25rem; }
.state-ok { color: var(--ok); }
.state-bad { color: var(--crit); }

/* Two columns where there is room, one where there is not. A phone in a
 * pocket is the likeliest way this page gets opened in a hurry. */
.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  padding: 1rem 0;
}
@media (min-width: 60rem) {
  .grid { grid-template-columns: 1fr 1fr; }
  .grid > .panel:nth-child(n+4) { grid-column: 1 / -1; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: .5rem;
  padding: .75rem 1rem 1rem;
  min-width: 0;
}
.panel-head {
  display: flex;
  gap: .5rem;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: .5rem;
}
.panel-head h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); margin: 0; }
.note { color: var(--dim); font-size: .85rem; }
.hint { color: var(--dim); font-size: .85rem; }
.trouble { color: var(--warn); font-size: .9rem; margin: .25rem 0 0; }

/* --- bars and facts --------------------------------------------------- */

.bar { background: #0e1114; border-radius: .25rem; height: .6rem; overflow: hidden; min-width: 4rem; }
.bar-fill { height: 100%; background: var(--ok); }
.bar-fill.warn { background: var(--warn); }
.bar-fill.crit { background: var(--crit); }

.facts { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; margin: .75rem 0 0; }
.facts > div { display: flex; gap: .4rem; align-items: baseline; }
.facts dt { color: var(--dim); font-size: .85rem; margin: 0; }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; }

/* --- tables ----------------------------------------------------------- */

.rows { width: 100%; border-collapse: collapse; font-size: .9rem; }
.rows td { padding: .3rem .4rem; border-top: 1px solid var(--line); vertical-align: middle; }
.rows tr:first-child td { border-top: 0; }
.dot-ok { color: var(--ok); }
.dot-bad { color: var(--crit); }
.dot-run { color: var(--run); }

/* --- actions ---------------------------------------------------------- */

.actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.action {
  background: #232a31;
  border: 1px solid var(--line);
  border-radius: .35rem;
  padding: .4rem .7rem;
  cursor: pointer;
}
.action:hover:not(:disabled) { border-color: var(--run); }
.action:disabled { opacity: .45; cursor: default; }
/* An action that changes the box looks like one. */
.action.changes { border-color: #5a4318; background: #2a2114; }
.action.changes:hover:not(:disabled) { border-color: var(--warn); }

.runs { display: flex; flex-direction: column; }
.run-row {
  display: flex;
  gap: .6rem;
  align-items: baseline;
  background: none;
  border: 0;
  border-top: 1px solid var(--line);
  padding: .35rem .2rem;
  text-align: left;
  cursor: pointer;
  font-size: .9rem;
}
.run-row:first-child { border-top: 0; }
.run-row:hover { background: #232a31; }

.output {
  margin: 0;
  max-height: 26rem;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: .82rem;
  background: #0e1114;
  border-radius: .35rem;
  padding: .6rem .7rem;
}

.bottom {
  display: flex;
  gap: .75rem;
  align-items: baseline;
  border-top: 1px solid var(--line);
  padding-top: .6rem;
  font-size: .85rem;
}
.link { background: none; border: 0; color: var(--dim); text-decoration: underline; cursor: pointer; padding: 0; margin-left: auto; }

/* --- the key ---------------------------------------------------------- */

.sheet { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.sheet-inner { width: 100%; max-width: 24rem; }
.sheet-inner h1 { margin: 0 0 .25rem; font-size: 1.5rem; }
.key {
  width: 100%;
  margin: .75rem 0;
  padding: .6rem .7rem;
  background: #0e1114;
  border: 1px solid var(--line);
  border-radius: .35rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.key:focus { outline: none; border-color: var(--run); }
.sheet-buttons { display: flex; justify-content: flex-end; }
.primary {
  background: var(--run);
  color: #0d1117;
  border: 0;
  border-radius: .35rem;
  padding: .45rem 1rem;
  cursor: pointer;
}
.primary:disabled { opacity: .4; cursor: default; }
