/* WAM Network Dashboard
   Copyright (c) 2026 The WAM Coin developers -- MIT

   No frameworks, no web fonts, no external requests. This page is what an
   operator opens when something is wrong; it must render when nothing else does. */

:root {
  --bg: #f5f7f6;
  --panel: #ffffff;
  --line: #e2e6e4;
  --text: #0B2C22;
  --muted: #667771;
  --accent: #0B7C5C;

  --mined: #0B7C5C;
  --vested: #C9962B;
  --locked: #8a6d3b;
  --unmined: #d6dbd9;

  --ok: #0B7C5C;
  --warn: #C9962B;
  --danger: #c0392b;

  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1211;
    --panel: #141c1a;
    --line: #25332e;
    --text: #e4ece9;
    --muted: #8fa39c;
    --accent: #14B88A;

    --mined: #14B88A;
    --vested: #E0B04A;
    --locked: #8a6d3b;
    --unmined: #2a3733;

    --ok: #14B88A;
    --warn: #E0B04A;
    --danger: #e56a5a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------- header */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 15px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 13px; }
.topbar h1 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -0.01em; }
.sub { margin: 0; font-size: 12.5px; color: var(--muted); }

.status {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted);
  padding: 6px 13px; border: 1px solid var(--line); border-radius: 999px;
}
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status.ok .dot { background: var(--ok); }
.status.bad .dot { background: var(--danger); }
.status.bad { color: var(--danger); border-color: var(--danger); }
.status.warn .dot { background: var(--warn); }
.status.warn { color: var(--warn); border-color: var(--warn); }

.banner {
  padding: 12px 24px; font-size: 14px;
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
  border-bottom: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
}
.banner.warn {
  background: color-mix(in srgb, var(--warn) 14%, transparent);
  color: var(--warn);
  border-bottom-color: color-mix(in srgb, var(--warn) 35%, transparent);
}
.hidden { display: none !important; }

/* ----------------------------------------------------------------- layout */

main { max-width: 1200px; margin: 0 auto; padding: 22px; display: grid; gap: 18px; }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px;
}
.card h2 {
  margin: 0 0 13px; font-size: 13px; font-weight: 650;
  letter-spacing: 0.03em; text-transform: uppercase; color: var(--muted);
}
.card h2.mt { margin-top: 22px; }

.split { display: grid; gap: 18px; grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ tiles */

.tiles { display: grid; gap: 13px; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); }
.tile {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
}
.tile .label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.045em;
  color: var(--muted); margin-bottom: 6px;
}
.tile .value {
  font-size: 22px; font-weight: 640; font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.tile .note { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* -------------------------------------------------------------- stack bar */

.stackbar {
  display: flex; height: 28px; border-radius: 6px; overflow: hidden;
  border: 1px solid var(--line); margin-bottom: 14px;
}
.seg { height: 100%; transition: width .45s ease; }
.seg.mined { background: var(--mined); }
.seg.vested { background: var(--vested); }
.seg.locked { background: var(--locked); }
.seg.unmined { background: var(--unmined); }

.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; }
.sw.mined { background: var(--mined); }
.sw.vested { background: var(--vested); }
.sw.locked { background: var(--locked); }
.sw.unmined { background: var(--unmined); }

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

table { border-collapse: collapse; width: 100%; }
.kv td { padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.kv tr:last-child td { border-bottom: none; }
.kv .total td { font-weight: 650; border-top: 1px solid var(--line); }

.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); }
.mono { font-family: var(--mono); font-size: 12px; }
.trunc { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tablewrap { overflow-x: auto; }
.data { font-size: 13px; }
.data.compact { font-size: 12.5px; }
.data th {
  text-align: left; padding: 8px 10px; color: var(--muted);
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.035em;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.data th.num { text-align: right; }
.data td { padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data tr:last-child td { border-bottom: none; }
.data td.empty { text-align: center; color: var(--muted); padding: 22px; font-style: italic; }

.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
}
.badge.ok { background: color-mix(in srgb, var(--ok) 17%, transparent); color: var(--ok); }
.badge.warn { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.badge.bad { background: color-mix(in srgb, var(--danger) 17%, transparent); color: var(--danger); }

/* ----------------------------------------------------------------- forms */

.lookup { display: flex; gap: 9px; flex-wrap: wrap; }
.lookup input {
  flex: 1 1 240px; padding: 9px 12px; font-family: var(--mono); font-size: 12.5px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--text);
}
.lookup input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.lookup button {
  padding: 9px 18px; border: none; border-radius: 8px;
  background: var(--accent); color: #fff; font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.lookup button:hover { filter: brightness(1.08); }

.result { margin-top: 14px; }
.result .err { color: var(--danger); font-size: 13.5px; }
.result pre {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 12px; font-family: var(--mono); font-size: 11.5px;
  overflow-x: auto; max-height: 320px; margin: 10px 0 0;
}

.fine { font-size: 12px; color: var(--muted); margin: 12px 0 0; }
.fine code { font-family: var(--mono); font-size: 11.5px; }

footer {
  max-width: 1200px; margin: 0 auto; padding: 18px 24px 36px;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  color: var(--muted); font-size: 12px; border-top: 1px solid var(--line);
}

/* -------------------------------------------------------------- network
   Three numbers that answer "is this a network or one machine". Built from
   the same tokens as .tile rather than new colours, so the card reads as
   part of the page and not as something bolted on later. */
.netgrid {
  display: grid; gap: 13px; margin-bottom: 18px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.netstat {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
}
.netnum {
  font-size: 26px; font-weight: 640; font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em; line-height: 1.15;
}
.netlabel {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.045em;
  color: var(--muted); margin-top: 4px;
}
.netstat .fine { margin-top: 5px; }

/* The age of the data on the page. See renderFreshness in app.js: a tab that
   has stopped fetching must say so rather than keep showing the last numbers
   as though they were current. */
.freshness { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); }
.freshness.ok   { color: var(--ok); }
.freshness.warn { color: var(--warn); }
.freshness.bad  { color: var(--danger); font-weight: 600; }
