/* The monitor's dashboard, in the website's colours (apps/web/src/app/globals.css): dark,
   or light when the device asks for it. */
:root {
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --bg: #0f1115;
  --surface: #171a21;
  --text: #e8eaee;
  --muted: #9aa3b2;
  --border: #2a2f3a;
  --accent: #a48eff;
  --button: #6e4ff5;
  --button-hover: #5f3fdd;
  --danger: #ff7b72;
  --danger-bg: #2d1416;
  --warn: #f0b429;
  --warn-bg: #2b2210;
  --ok: #56d364;
  --ok-bg: #12261a;
  --none: #262b35;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --text: #16181d;
    --muted: #5b6270;
    --border: #dde1e7;
    --accent: #6e4ff5;
    --button: #6e4ff5;
    --button-hover: #5f3fdd;
    --danger: #c62828;
    --danger-bg: #fdecea;
    --warn: #9a6700;
    --warn-bg: #fff4d6;
    --ok: #1b7f3b;
    --ok-bg: #e7f6ec;
    --none: #e6e9ee;
    color-scheme: light;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
a { color: var(--accent); }
code { font-family: var(--mono); font-size: 0.9em; overflow-wrap: anywhere; }
h1 { font-size: 1.5rem; margin: 0.2rem 0 0.4rem; }
h2 { font-size: 1.05rem; margin: 0 0 0.75rem; }
h3 { font-size: 0.95rem; margin: 1.2rem 0 0.5rem; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }
.nowrap { white-space: nowrap; }

.top { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); background: var(--surface); }
.brand { display: flex; align-items: center; gap: 0.55rem; color: var(--text); text-decoration: none; font-weight: 700; }
.brand img { display: block; }
.top nav { display: flex; gap: 1rem; }
.top nav a { color: var(--text); text-decoration: none; }
.top nav a:hover { color: var(--accent); }
.who { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }
button { font: inherit; border: 0; border-radius: 8px; padding: 0.55rem 1rem; background: var(--button); color: #fff; cursor: pointer; }
button:hover { background: var(--button-hover); }
button.link { background: none; color: var(--accent); padding: 0; }
button.link:hover { text-decoration: underline; background: none; }

main { max-width: 1180px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; margin: 0 0 1rem; }
.card.narrow { max-width: 420px; margin: 3rem auto; }
.crumbs { margin: 0; font-size: 0.9rem; color: var(--muted); }
.crumbs a { color: var(--muted); }

.notice { border-radius: 8px; padding: 0.7rem 0.9rem; margin: 0 0 1rem; border: 1px solid var(--border); }
.notice.error { background: var(--danger-bg); border-color: var(--danger); }
.notice.warn { background: var(--warn-bg); border-color: var(--warn); }
.notice.ok { background: var(--ok-bg); border-color: var(--ok); }
.notice ul { margin: 0.35rem 0 0; }
ul.plain { list-style: none; padding: 0; }
ul.plain li { padding: 0.15rem 0; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th, .table td { text-align: left; padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
/* The same columns in every group, so they line up down the page. */
.checks { table-layout: fixed; }
.checks th:nth-child(1) { width: 9.5rem; }
.checks th:nth-child(2) { width: 18%; }
.checks th:nth-child(4), .checks th:nth-child(5), .checks th:nth-child(6) { width: 4.6rem; }
.checks th:nth-child(7) { width: 24%; }
.checks td { overflow-wrap: anywhere; }

.dot { display: inline-block; width: 0.65rem; height: 0.65rem; border-radius: 50%; margin-right: 0.45rem; vertical-align: 0.05em; background: var(--none); }
.dot.s-up { background: var(--ok); }
.dot.s-degraded { background: var(--warn); }
.dot.s-down { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }
.t-up { color: var(--ok); }
.t-degraded { color: var(--warn); }
.t-down { color: var(--danger); }

.strip { display: block; width: 100%; height: 20px; }
.strip.large { height: 34px; }
.strip rect { fill: var(--none); }
.strip rect.b-up { fill: var(--ok); }
.strip rect.b-degraded { fill: var(--warn); }
.strip rect.b-down { fill: var(--danger); }

.chart { display: block; width: 100%; height: auto; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linejoin: round; }
.chart .grid { stroke: var(--border); stroke-dasharray: 3 4; }
.chart .axis { stroke: var(--border); }
.chart .tick { fill: var(--muted); font: 11px var(--font); }

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

form.stack { display: grid; gap: 0.85rem; margin-top: 1rem; }
form.stack label { display: grid; gap: 0.3rem; font-weight: 600; font-size: 0.92rem; }
input { font: inherit; padding: 0.55rem 0.7rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); width: 100%; }
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* On a phone, each check is a block: its status and name, what it found, then its last
   24 hours and uptime. */
@media (max-width: 720px) {
  main { padding: 1rem 0.75rem 2rem; }
  .card { padding: 0.85rem; }
  .who { margin-left: 0; width: 100%; justify-content: space-between; }
  .checks thead { display: none; }
  .checks, .checks tbody { display: block; }
  .checks tr { display: grid; grid-template-columns: max-content 1fr max-content; gap: 0.25rem 0.75rem; align-items: center; padding: 0.65rem 0; border-bottom: 1px solid var(--border); }
  .checks tr:last-child { border-bottom: 0; }
  .checks td { display: block; padding: 0; border: 0; }
  .checks td:nth-child(1) { grid-column: 1; grid-row: 1; }
  .checks td:nth-child(2) { grid-column: 2 / 4; grid-row: 1; }
  .checks td:nth-child(3) { grid-column: 1 / 4; grid-row: 2; }
  .checks td:nth-child(7) { grid-column: 1 / 3; grid-row: 3; }
  .checks td:nth-child(4) { grid-column: 3; grid-row: 3; }
  .checks td:nth-child(5), .checks td:nth-child(6) { display: none; }
  .checks td.num::before { content: attr(data-label) " "; color: var(--muted); }
}
