:root {
  --bg: #14121a;
  --panel: #1e1b26;
  --panel-2: #272232;
  --line: #383044;
  --text: #ece8f1;
  --muted: #9a91ab;
  --accent: #c2569b;
  --ok: #4ec98a;
  --warn: #e0b341;
  --bad: #e05656;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 1rem;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

h1 { font-size: 1.1rem; margin: 0; letter-spacing: .02em; }

.link { color: var(--muted); font-size: .85rem; text-decoration: none; }
.link:hover { color: var(--text); }

/* Connection state of the browser's own socket. If this is red, nothing on
   screen can be trusted to be current. */
.conn { font-size: .8rem; color: var(--muted); display: flex; align-items: center; gap: .4rem; }
.dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--bad); }
.dot.live { background: var(--ok); }

.stop-all {
  width: 100%;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: .08em;
  color: #fff;
  background: var(--bad);
  border: none;
  border-radius: .75rem;
  cursor: pointer;
}
.stop-all:active { transform: translateY(1px); }

.node {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: .75rem;
  padding: 1rem;
  margin-bottom: 1rem;
}

.node-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .75rem;
}

.node-name { font-weight: 600; font-size: 1.05rem; }
.node-meta { font-size: .8rem; color: var(--muted); }

.offline { opacity: .55; }

.reason {
  display: inline-block;
  font-size: .75rem;
  padding: .1rem .5rem;
  border-radius: 1rem;
  background: var(--panel-2);
  color: var(--muted);
  border: 1px solid var(--line);
}
.reason.wearer { color: var(--warn); border-color: var(--warn); }
.reason.watchdog { color: var(--bad); border-color: var(--bad); }

label { display: block; font-size: .8rem; color: var(--muted); margin: .75rem 0 .25rem; }

.ceiling-expiry { color: var(--warn); margin-left: .5rem; font-size: .75rem; }

input[type="range"] { width: 100%; accent-color: var(--accent); height: 2rem; }
input[type="range"].ceiling { accent-color: var(--warn); }

.readout { float: right; color: var(--text); font-variant-numeric: tabular-nums; }

.node-stop {
  width: 100%;
  margin-top: .75rem;
  padding: .6rem;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: .5rem;
  cursor: pointer;
}

.empty { color: var(--muted); text-align: center; padding: 2rem 1rem; }

/* history graph */
.graph {
  width: 100%;
  height: 60px;
  margin-top: 1rem;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: .4rem;
}
.graph-line { fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.graph-empty { fill: var(--muted); font-size: 10px; }

/* attribution: colour says who moved it */
.mark-operator { fill: var(--accent); }
.mark-wearer   { fill: var(--warn); }
.mark-watchdog { fill: var(--bad); }
.mark-ceiling  { fill: var(--ok); }
.mark-none     { fill: var(--muted); }

#history {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.5rem 0 .5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.purge {
  padding: .4rem .75rem;
  font-size: .8rem;
  color: var(--bad);
  background: transparent;
  border: 1px solid var(--bad);
  border-radius: .4rem;
  cursor: pointer;
}

/* login */
.login { max-width: 22rem; margin: 15vh auto 0; }
.login input {
  width: 100%; padding: .75rem; font-size: 1rem; margin-bottom: .75rem;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: .5rem;
}
.login button {
  width: 100%; padding: .75rem; font-size: 1rem; font-weight: 600;
  background: var(--accent); color: #fff; border: none; border-radius: .5rem; cursor: pointer;
}
.error { color: var(--bad); font-size: .85rem; min-height: 1.2rem; }
