/* One stylesheet, no JavaScript anywhere. The graphs are server-rendered
   SVG; every colour they use lives here, so this file is the whole visual
   surface. */

:root {
  --bg: #101418;
  --panel: #161c22;
  --line: #2a343e;
  --fg: #d6dde4;
  --dim: #77828d;
  --accent: #4cc38a;
  --accent-b: #58a6ff;
  --warn: #e5c07b;
  --bad: #e06c75;
}

* { box-sizing: border-box; }

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

header {
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  padding: 0.7rem 1.2rem;
  border-bottom: 1px solid var(--line);
}
.brand {
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent);
  text-decoration: none;
}
header nav {
  display: flex;
  gap: 1.2rem;
  align-items: baseline;
  margin-left: auto;
}
header nav a { color: var(--dim); text-decoration: none; }
header nav a:hover { color: var(--fg); }
.linkish {
  background: none;
  border: none;
  padding: 0;
  color: var(--dim);
  font: inherit;
  cursor: pointer;
}
.linkish:hover { color: var(--fg); }

main {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.2rem;
}

h1 { font-size: 1.35rem; margin: 0.4rem 0 0.8rem; }
h2 { font-size: 1.05rem; margin: 1.6rem 0 0.5rem; color: var(--dim); }
a { color: var(--accent-b); }

.flash {
  border: 1px solid var(--bad);
  border-radius: 4px;
  padding: 0.5rem 0.8rem;
  color: var(--bad);
}

.meta { color: var(--dim); margin-top: -0.4rem; }
.dim { color: var(--dim); }
.warn { color: var(--warn); }

/* Forms */
.stack { display: grid; gap: 0.8rem; max-width: 22rem; }
.stack label { display: grid; gap: 0.25rem; color: var(--dim); }
input {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.45rem 0.6rem;
  color: var(--fg);
  font: inherit;
}
input:focus { outline: 1px solid var(--accent-b); }
button {
  background: var(--accent);
  border: none;
  border-radius: 4px;
  padding: 0.5rem 1rem;
  color: #08130d;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  justify-self: start;
}

/* Tables */
table { border-collapse: collapse; width: 100%; margin: 0.4rem 0 1rem; }
th, td { text-align: left; padding: 0.35rem 0.7rem; border-bottom: 1px solid var(--line); }
th { color: var(--dim); font-weight: 500; font-size: 0.85rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
td a { text-decoration: none; }
.cmd { font-family: ui-monospace, monospace; font-size: 0.85rem; }

/* The three host states. Never-reported and stale rows dim their figures;
   the chip is the label that makes each state unmistakable. */
.chip {
  display: inline-block;
  border-radius: 3px;
  padding: 0.05rem 0.5rem;
  font-size: 0.8rem;
  vertical-align: middle;
}
.chip.ok { background: #12301f; color: var(--accent); }
.chip.stale { background: #33270f; color: var(--warn); }
.chip.never { background: #22262b; color: var(--dim); }
.chip.pending { background: #1c2740; color: var(--accent-b); }
.chip.bad { background: #3a1720; color: var(--bad); }
tr.stale td, tr.never td { color: var(--dim); }
tr.stale td:first-child a { color: var(--warn); }

/* Range links */
.ranges { display: flex; gap: 0.9rem; margin: 0.8rem 0; }
.ranges a { text-decoration: none; color: var(--dim); }
.ranges a:hover { color: var(--fg); }
.ranges .active { color: var(--accent); font-weight: 600; }
/* The device toggle is a different kind of control from the spans beside it,
   so it sits at the other end of the row rather than at the end of the list. */
.ranges .devices { margin-left: auto; }

/* Graphs */
.graphs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(24rem, 1fr));
  gap: 1rem;
}
.graph {
  margin: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.6rem 0.6rem 0.3rem;
}
.graph figcaption { color: var(--dim); font-size: 0.85rem; margin-bottom: 0.3rem; }
.graph svg { display: block; width: 100%; height: auto; }
.graph .grid { stroke: var(--line); stroke-width: 1; }
.graph .label { fill: var(--dim); font-size: 9px; }
.graph .note { fill: var(--dim); font-size: 12px; }
.graph .band { fill: var(--accent); opacity: 0.18; stroke: none; }
.graph .line { fill: none; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.graph .line.a { stroke: var(--accent); }
.graph .line.b { stroke: var(--accent-b); }
.graph .dot.a { fill: var(--accent); }
.graph .dot.b { fill: var(--accent-b); }

/* Filesystem usage bars */
.bar-col { width: 7rem; }
.bar { width: 100%; height: 6px; display: block; }
.bar-bg { fill: var(--line); }
.bar-fill { fill: var(--accent); }

/* Secrets shown once */
.token, .secret {
  font-family: ui-monospace, monospace;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.6rem 0.8rem;
  overflow-wrap: anywhere;
}
pre {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.6rem 0.8rem;
  overflow-x: auto;
}
.qr { background: #fff; padding: 8px; border-radius: 4px; }

/* Agent management */
.agent-form {
  display: flex;
  gap: 1rem;
  align-items: end;
  flex-wrap: wrap;
  margin: 0.6rem 0 0.2rem;
}
.agent-form label { display: grid; gap: 0.25rem; color: var(--dim); font-size: 0.9rem; }
.agent-form input[type="number"] { width: 7rem; }
select {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.45rem 0.6rem;
  color: var(--fg);
  font: inherit;
}
.declined {
  border: 1px solid var(--bad);
  border-radius: 4px;
  padding: 0.5rem 0.8rem;
  color: var(--bad);
}
