:root {
  --bg: #f6f6f7;
  --card: #ffffff;
  --line: #e7e7ea;
  --line-soft: #f0f0f2;
  --text: #16161a;
  --muted: #6e6e78;
  --faint: #a0a0aa;
  --ok: #1f9d55;
  --warn: #c77700;
  --crit: #d92d20;
  --unknown: #a0a0aa;
  --accent: #16161a;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "tnum" 1, "cv11" 1;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* top bar */
header.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
header.top .wrap { display: flex; align-items: center; gap: 16px; height: 56px; }
.brand { font-weight: 600; letter-spacing: -0.01em; }
.brand span { color: var(--muted); font-weight: 400; margin-left: 6px; }
.spacer { flex: 1; }
.meta { color: var(--muted); font-size: 13px; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line); font-size: 13px; font-weight: 500; background: var(--card); }
button.link { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); cursor: pointer; }
button.link:hover { color: var(--text); }

/* sections */
main { padding: 28px 0 64px; }
section { margin-bottom: 32px; }
h2 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
  margin: 0 0 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }

/* status dot */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: var(--unknown); }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.crit { background: var(--crit); box-shadow: 0 0 0 3px rgba(217, 45, 32, 0.14); }
.s-warn { color: var(--warn); }
.s-crit { color: var(--crit); }

/* attention list */
.issues .row { display: grid; grid-template-columns: 14px 150px minmax(0, 1fr) auto; gap: 12px; align-items: baseline;
  padding: 11px 16px; border-top: 1px solid var(--line-soft); }
.issues .row:first-child { border-top: 0; }
.issues .row .dot { align-self: center; }
.issues .prod { color: var(--muted); }
.issues .what b { font-weight: 500; }
.issues .what .val { margin-left: 8px; }
.issues .what .det { display: block; overflow-wrap: anywhere; color: var(--muted); font-size: 13px; margin-top: 2px; }
.issues .when { color: var(--faint); font-size: 13px; white-space: nowrap; }
.allgood { padding: 18px 16px; color: var(--muted); display: flex; align-items: center; gap: 10px; }

/* servers */
.servers { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.server { padding: 16px 18px; }
.server .head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.server .head b { font-weight: 600; }
.server .head .meta { margin-left: auto; }
.gauge { display: grid; grid-template-columns: 92px 1fr 48px 120px; gap: 12px; align-items: center;
  padding: 6px 0; }
.gauge .name { color: var(--muted); font-size: 13px; }
.bar { height: 6px; background: var(--line-soft); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; opacity: 0.75; }
.bar i.warn { background: var(--warn); opacity: 1; }
.bar i.crit { background: var(--crit); opacity: 1; }
.gauge .num { text-align: right; font-size: 13px; }
.spark { width: 120px; height: 24px; color: var(--faint); }
.server .facts { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--line-soft); font-size: 13px; color: var(--muted); }
.server .facts b { color: var(--text); font-weight: 500; }

/* prepaid balances */
.funds { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.fund { padding: 16px 18px; }
.fund .head { display: flex; align-items: center; gap: 10px; }
.fund .head b { font-weight: 600; }
.fund .head .meta { margin-left: auto; }
.fund .big { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; margin: 10px 0 2px; }
.fund .entry { display: flex; gap: 8px; align-items: center; margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--line-soft); }
.fund select, .fund .usd input { height: 32px; border: 1px solid var(--line); border-radius: 7px; background: #fff;
  font: inherit; font-size: 13px; color: var(--text); }
.fund select { padding: 0 8px; }
.fund .usd { position: relative; flex: 1; min-width: 90px; }
.fund .usd i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-style: normal;
  color: var(--faint); font-size: 13px; }
.fund .usd input { width: 100%; padding: 0 10px 0 22px; }
.fund select:focus, .fund .usd input:focus { outline: none; border-color: var(--text); }
.fund button[type=submit] { height: 32px; padding: 0 14px; border: 0; border-radius: 7px; background: var(--text);
  color: #fff; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
.fund .undo { font-size: 13px; white-space: nowrap; }

/* products */
.products .prod-row { border-top: 1px solid var(--line-soft); }
.products .prod-row:first-child { border-top: 0; }
.prod-head { display: grid; grid-template-columns: 14px 150px 1fr auto 14px; gap: 12px; align-items: center;
  padding: 13px 16px; cursor: pointer; user-select: none; }
.prod-head:hover { background: #fafafb; }
.prod-head .name { font-weight: 500; }
.prod-head .sum { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prod-head .count { color: var(--faint); font-size: 13px; }
.chev { width: 14px; height: 14px; color: var(--faint); transition: transform .15s; }
.open .chev { transform: rotate(90deg); }
.prod-body { display: none; padding: 4px 16px 16px 42px; }
.open .prod-body { display: block; }
.group { margin-top: 12px; }
.group h3 { font-size: 12px; font-weight: 600; color: var(--muted); margin: 0 0 4px; }
table.items { width: 100%; border-collapse: collapse; }
table.items td { padding: 6px 8px 6px 0; border-top: 1px solid var(--line-soft); vertical-align: baseline;
  font-size: 13px; }
table.items tr:first-child td { border-top: 0; }
table.items td.d { width: 14px; }
table.items td.d .dot { vertical-align: middle; }
table.items td.n { width: 30%; }
table.items td.v { width: 22%; }
table.items td.x { color: var(--muted); overflow-wrap: anywhere; }
table.items tr.stale td { opacity: 0.5; }

/* history */
.history .row { display: grid; grid-template-columns: 130px 1fr; gap: 12px; padding: 10px 16px;
  border-top: 1px solid var(--line-soft); font-size: 13px; }
.history .row:first-child { border-top: 0; }
.history .t { color: var(--faint); }
.history pre { margin: 0; font: inherit; white-space: pre-wrap; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; }
.login form { width: 320px; padding: 28px; }
.login h1 { font-size: 18px; font-weight: 600; margin: 0 0 4px; }
.login p { color: var(--muted); margin: 0 0 20px; }
.login label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
.login input { width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; background: #fff; }
.login input:focus { outline: none; border-color: var(--text); }
.login button { width: 100%; height: 38px; margin-top: 20px; border: 0; border-radius: 8px; background: var(--text);
  color: #fff; font: inherit; font-weight: 500; cursor: pointer; }
.login .err { color: var(--crit); font-size: 13px; margin-top: 12px; min-height: 18px; }

@media (max-width: 720px) {
  .wrap { padding: 0 14px; }
  .issues .row { grid-template-columns: 14px 1fr; }
  .issues .prod { grid-column: 2; }
  .issues .what, .issues .when { grid-column: 2; }
  .prod-head { grid-template-columns: 14px 1fr auto 14px; }
  .prod-head .sum { display: none; }
  .prod-body { padding-left: 16px; }
  .gauge { grid-template-columns: 80px 1fr 44px; }
  .spark { display: none; }
  table.items td.x { display: none; }
  .meta.hide-sm { display: none; }
}
