:root {
  --bg: #0f1420;
  --panel: #171e2e;
  --panel-2: #1d2639;
  --border: #2a3550;
  --text: #e8edf7;
  --muted: #8c99b5;
  --accent: #5b8cff;
  --good: #3ecf8e;
  --bad: #ff6b6b;
  --warn: #ffb84d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--bad); }
.good { color: var(--good); }

/* Login */
.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
}
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.login-card label {
  display: block;
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.login-card input {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-size: 15px;
}
.login-card button {
  width: 100%;
  margin-top: 20px;
  padding: 11px;
  border-radius: 10px;
  border: 0;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.login-card button:disabled { opacity: 0.6; }

/* Shell */
.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 28px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { font-weight: 700; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 14px;
}
.topbar nav a.active { color: var(--text); background: var(--panel-2); }
.tz-note { font-size: 12px; white-space: nowrap; }
button.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
}

main { padding: 20px 28px 40px; width: 100%; max-width: none; margin: 0; }
h2 { font-size: 18px; margin: 26px 0 12px; }
h2:first-child { margin-top: 4px; }

/* Cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
}
.card .value { font-size: 26px; font-weight: 700; margin-top: 2px; }
.card .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

/* Tables */
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: auto;
}
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td.wrap { white-space: normal; min-width: 240px; }
th { color: var(--muted); font-weight: 600; font-size: 12px; position: sticky; top: 0; background: var(--panel); }
th.sortable {
  cursor: pointer;
  user-select: none;
}
th.sortable:hover { color: var(--text); }
th.sortable.sorted { color: var(--accent); }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--panel-2); }

/* Bar chart */
.chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.chart .col {
  flex: 1;
  min-width: 4px;
  display: flex;
  flex-direction: column;
}
.chart .bar-area {
  height: 120px;
  display: flex;
  align-items: flex-end;
}
.chart .bar {
  width: 100%;
  background: var(--accent);
  border-radius: 3px 3px 0 0;
  position: relative;
}
.chart .bar-label {
  height: 28px;
  margin-top: 6px;
  font-size: 10px;
  line-height: 1.3;
  color: var(--muted);
  text-align: center;
  overflow: hidden;
}
.chart .bar.bad { background: var(--bad); }
.chart .bar:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #000;
  color: #fff;
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 3;
}

.pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--muted);
}
a.link { color: var(--accent); text-decoration: none; }
.back { margin-bottom: 14px; display: inline-block; }
.detail-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 900px) { .detail-grid.two { grid-template-columns: 1fr 1fr; } }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 26px;
}
.section-head h2 { margin: 0; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
.segmented {
  display: inline-flex;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.segmented button {
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 7px 12px;
  cursor: pointer;
  font-size: 13px;
}
.segmented button + button { border-left: 1px solid var(--border); }
.segmented button.active {
  background: var(--panel-2);
  color: var(--text);
  font-weight: 600;
}
button.primary {
  background: var(--accent);
  border: 0;
  color: #fff;
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-weight: 600;
}
button.primary:disabled { opacity: 0.45; cursor: default; }
button.ghost.compact { padding: 4px 10px; font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; }
.copy-status { min-height: 1.2em; margin-top: 8px; }

.version-checks {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0 14px;
}
.version-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
}
.version-row-label {
  min-width: 64px;
  text-align: center;
}
.version-checks .check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.line-chart-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 12px 8px;
}
.line-chart { width: 100%; height: auto; display: block; }
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 8px 4px 2px;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}
