/* Edge Monitor — instrument-panel aesthetic.
   Mono-forward typography, near-black chassis, single signal accent.
   No external assets: strict CSP allows only same-origin CSS and data: images. */

:root {
  color-scheme: dark;

  --bg: #080b0e;
  --bg-2: #0b0f13;
  --panel: #10161b;
  --panel-2: #161e25;
  --line: #1e2830;
  --line-soft: #182129;
  --ink: #dfe9ef;
  --ink-dim: #a7b6c0;
  --muted: #6d8090;

  --accent: #2dd4bf;
  --accent-2: #7dd3fc;
  --ok: #34d399;
  --warn: #f0b429;
  --bad: #fb7185;

  --radius: 14px;
  --radius-sm: 9px;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", "JetBrains Mono", "IBM Plex Mono", Menlo, Consolas, monospace;

  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 18px 40px -24px rgba(0, 0, 0, 0.9);
  --ease: cubic-bezier(0.22, 0.8, 0.3, 1);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  color: var(--ink);
  font: 14px/1.55 var(--mono);
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(90rem 40rem at 50% -12rem, rgba(45, 212, 191, 0.07), transparent 60%),
    linear-gradient(var(--line-soft) 1px, transparent 1px) 0 0 / 100% 3.5rem,
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px) 0 0 / 3.5rem 100%,
    var(--bg);
  background-attachment: fixed;
}

/* The grid texture is atmosphere, not information — keep it barely there. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(120% 90% at 50% 0%, transparent 20%, var(--bg) 92%);
  opacity: 0.85;
  z-index: 0;
}

body > * { position: relative; z-index: 1; }

h1, h2 { font-weight: 600; letter-spacing: -0.01em; }
.muted { color: var(--muted); }

.icon { width: 1rem; height: 1rem; flex: none; stroke-width: 1.6; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- login ---------- */
.login-body {
  display: grid;
  place-items: center;
  min-height: 100svh;
  padding: 1.5rem;
}
.login-card {
  width: min(23rem, 100%);
  padding: 2rem 1.75rem 1.75rem;
  background: linear-gradient(var(--panel), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  animation: rise 0.5s var(--ease) both;
}
/* Hairline of accent along the top edge — the one bright line on the page. */
.login-card::before {
  content: "";
  display: block;
  height: 1px;
  margin: -2rem -1.75rem 2rem;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.7;
}
.login-mark {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  margin-inline: auto;
  border-radius: 13px;
  color: var(--accent);
  background: radial-gradient(120% 120% at 50% 0%, rgba(45, 212, 191, 0.22), rgba(45, 212, 191, 0.05));
  border: 1px solid rgba(45, 212, 191, 0.3);
  box-shadow: 0 0 0 6px rgba(45, 212, 191, 0.05);
}
.login-mark .icon { width: 1.375rem; height: 1.375rem; }
.login-card h1 {
  margin: 1rem 0 0;
  font-size: 1rem;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}
.login-card > .muted {
  margin: 0.5rem 0 1.75rem;
  font-size: 0.75rem;
  text-align: center;
  letter-spacing: 0.04em;
}
.login-card form { display: grid; gap: 0.375rem; }
label {
  font-size: 0.6875rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.field { position: relative; display: grid; margin-bottom: 0.75rem; }
.field .icon {
  position: absolute;
  inset-inline-start: 0.75rem;
  top: 50%;
  translate: 0 -50%;
  color: var(--muted);
  transition: color 0.2s var(--ease);
}
.field:focus-within .icon { color: var(--accent); }
input {
  width: 100%;
  padding: 0.7rem 0.75rem 0.7rem 2.375rem;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
input::placeholder { color: #4c5c69; }
input:hover { border-color: #26323c; }
input:focus-visible { outline: none; border-color: var(--accent); background: var(--bg-2); box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.12); }

button[type="submit"] {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.375rem;
  padding: 0.7rem 1rem;
  background: linear-gradient(var(--accent), #14b8a6);
  color: #04201d;
  border: 0;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: filter 0.2s var(--ease), translate 0.2s var(--ease);
}
button[type="submit"]:hover { filter: brightness(1.1); translate: 0 -1px; }
button[type="submit"]:active { translate: 0 0; filter: brightness(0.95); }

.login-foot {
  margin: 1.5rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--line-soft);
  font-size: 0.6875rem;
  text-align: center;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.alert {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.625rem 0.75rem;
  background: rgba(251, 113, 133, 0.1);
  border: 1px solid rgba(251, 113, 133, 0.3);
  border-radius: var(--radius-sm);
  color: #ffc2cb;
  font-size: 0.8125rem;
}
.alert .icon { color: var(--bad); }

/* ---------- shell ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 3.5rem;
  padding: 0 1.25rem;
  background: rgba(8, 11, 14, 0.72);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-weight: 600;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 8px;
  color: var(--accent);
  background: rgba(45, 212, 191, 0.1);
  border: 1px solid rgba(45, 212, 191, 0.25);
}
.dot {
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5);
}
.dot.beat { animation: beat 0.8s var(--ease); }
@keyframes beat {
  from { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.55); }
  to { box-shadow: 0 0 0 9px rgba(52, 211, 153, 0); }
}

.topbar-meta { display: flex; align-items: center; gap: 0.625rem; font-size: 0.75rem; }
.topbar-meta form { margin: 0; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.3125rem 0.625rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-dim);
  white-space: nowrap;
}
.chip .icon { width: 0.875rem; height: 0.875rem; color: var(--muted); }
#updated.stale { color: var(--warn); border-color: rgba(240, 180, 41, 0.35); }

.signout {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.3125rem 0.75rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-dim);
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.signout .icon { width: 0.875rem; height: 0.875rem; }
.signout:hover { color: var(--bad); border-color: rgba(251, 113, 133, 0.4); background: rgba(251, 113, 133, 0.08); }

main {
  max-width: 84rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
  display: grid;
  gap: 1rem;
}

/* Staggered reveal on load: one orchestrated moment, then the page stays calm. */
main > * { animation: rise 0.55s var(--ease) both; }
main > *:nth-child(2) { animation-delay: 0.04s; }
main > *:nth-child(3) { animation-delay: 0.09s; }
main > *:nth-child(4) { animation-delay: 0.14s; }
main > *:nth-child(5) { animation-delay: 0.19s; }
@keyframes rise { from { opacity: 0; translate: 0 0.75rem; } to { opacity: 1; translate: 0 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

.card {
  position: relative;
  background: linear-gradient(var(--panel), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.125rem;
  box-shadow: var(--shadow);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.875rem;
}
.card h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-dim);
}
.card h2 .icon { width: 0.875rem; height: 0.875rem; color: var(--muted); }
.card-head .muted { font-size: 0.75rem; }

.grid { display: grid; gap: 1rem; }
.stats { grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.two { grid-template-columns: repeat(auto-fit, minmax(21rem, 1fr)); }

/* ---------- stat tiles ---------- */
.stat { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 1rem; }
.stat .card-head { grid-column: 1 / -1; margin-bottom: 0; }
.stat .figure {
  margin: 0.25rem 0 0;
  font: 600 2.25rem/1 var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
}
.stat .figure small { font-size: 0.9375rem; color: var(--muted); margin-inline-start: 0.1875rem; letter-spacing: 0; }
.stat .sub { margin: 0.5rem 0 0; font-size: 0.6875rem; line-height: 1.45; letter-spacing: 0.02em; }
.stat-wide { grid-column: 1 / -1; }

/* Ring gauge — SVG circle whose dash offset is driven from app.js. */
.gauge { width: 4.5rem; height: 4.5rem; rotate: -90deg; overflow: visible; }
.gauge .track { fill: none; stroke: var(--panel-2); stroke-width: 6; }
.gauge .value {
  fill: none;
  stroke: var(--accent);
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s var(--ease), stroke 0.3s var(--ease);
  filter: drop-shadow(0 0 6px rgba(45, 212, 191, 0.35));
}
.gauge .value.warn { stroke: var(--warn); filter: drop-shadow(0 0 6px rgba(240, 180, 41, 0.35)); }
.gauge .value.bad { stroke: var(--bad); filter: drop-shadow(0 0 6px rgba(251, 113, 133, 0.4)); }

.bar { height: 0.3125rem; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.bar span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  border-radius: 999px;
  transition: width 0.5s var(--ease);
}
.bar span.warn { background: var(--warn); }
.bar span.bad { background: var(--bad); }

.spark { display: flex; align-items: flex-end; gap: 2px; height: 2.75rem; }
.spark i {
  flex: 1;
  min-height: 2px;
  background: linear-gradient(180deg, var(--accent), rgba(45, 212, 191, 0.25));
  border-radius: 2px 2px 1px 1px;
  transition: height 0.5s var(--ease), opacity 0.2s var(--ease);
}
.spark i:hover { opacity: 1; filter: brightness(1.3); }
td .spark { height: 1.75rem; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
th, td { padding: 0.5625rem 0.6875rem; text-align: start; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
th {
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background 0.15s var(--ease); }
tbody tr:hover { background: var(--panel-2); }
td.num, th.num { text-align: end; font-variant-numeric: tabular-nums; }
td.name { font-weight: 500; color: var(--ink); }
.chart-col { width: 8.5rem; }
.mem-col { width: 7.5rem; }
.table-scroll { overflow-x: auto; margin: 0 -1.125rem -1.125rem; padding: 0 1.125rem 0.25rem; }
/* Volume and image names run long; let the name column truncate so the size
   column is never pushed out of sight. */
.two td:first-child { max-width: 16rem; overflow: hidden; text-overflow: ellipsis; }
.empty { color: var(--muted); font-style: italic; }
tbody td.empty { padding-block: 1.5rem; text-align: center; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.125rem 0.5rem 0.125rem 0.4375rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
}
/* Status reads as a colour and a shape, not colour alone. */
.pill::before { content: ""; width: 0.375rem; height: 0.375rem; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--ok); background: rgba(52, 211, 153, 0.1); border-color: rgba(52, 211, 153, 0.28); }
.pill.warn { color: var(--warn); background: rgba(240, 180, 41, 0.1); border-color: rgba(240, 180, 41, 0.28); }
.pill.bad { color: var(--bad); background: rgba(251, 113, 133, 0.1); border-color: rgba(251, 113, 133, 0.28); }
.pill.mute { color: var(--muted); background: var(--panel-2); border-color: var(--line); }

.paths { margin-top: 0.25rem; color: var(--muted); font-size: 0.6875rem; }

@media (max-width: 48rem) {
  .topbar { padding-inline: 0.875rem; gap: 0.5rem; }
  .topbar-meta #hostname { display: none; }
  .signout span { display: none; }
  .signout { padding-inline: 0.5rem; }
  main { padding: 1rem 0.75rem 3rem; }
  .stat .figure { font-size: 1.875rem; }
  .gauge { width: 3.75rem; height: 3.75rem; }
}

/* Inline icon sprite: present in the DOM, absent from layout. */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
