:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #17212b;
  --muted: #66717d;
  --line: #d9dfe5;
  --blue: #1769aa;
  --green: #16865b;
  --red: #b93838;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
}

button, select { font: inherit; letter-spacing: 0; }

.shell {
  width: min(960px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 64px;
}

.topbar, .toolbar, .summary, .node-row, .table-heading {
  display: flex;
  align-items: center;
}

.topbar { justify-content: space-between; margin-bottom: 26px; }
.eyebrow { margin: 0 0 4px; color: var(--blue); font-size: 12px; font-weight: 700; }
h1 { margin: 0; font-size: 28px; letter-spacing: 0; }
h2 { margin: 0; font-size: 16px; letter-spacing: 0; }
h3 { margin: 0 0 3px; font-size: 15px; letter-spacing: 0; }

.status {
  min-width: 112px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.toolbar {
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.toolbar label { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
select, button { min-height: 38px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); }
select { min-width: 180px; padding: 0 34px 0 10px; }
button { padding: 0 14px; cursor: pointer; font-weight: 600; }
button:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); }
button:disabled { cursor: not-allowed; opacity: .45; }

.summary {
  justify-content: space-between;
  gap: 18px;
  margin: 28px 0;
  padding: 18px 20px;
  border-left: 4px solid var(--blue);
  background: var(--surface);
  box-shadow: 0 1px 3px rgb(30 45 60 / 8%);
}
.summary-label { display: block; margin-bottom: 4px; color: var(--muted); font-size: 12px; }
#recommendation { font-size: 19px; }
#open-best { border-color: var(--blue); background: var(--blue); color: white; }

.table-heading { justify-content: space-between; margin: 0 0 10px; }
#progress { color: var(--muted); font-size: 13px; }
.node-list { border-top: 1px solid var(--line); }
.node-row {
  min-height: 82px;
  gap: 20px;
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.node-row.recommended { box-shadow: inset 3px 0 var(--green); }
.node-row.failed { opacity: .64; }
.node-identity { display: flex; align-items: center; gap: 12px; min-width: 240px; flex: 1; }
.node-location { margin: 0; color: var(--muted); font-size: 12px; }
.node-light { width: 9px; height: 9px; border-radius: 50%; background: #aeb6bf; flex: none; }
.node-light.online { background: var(--green); box-shadow: 0 0 0 4px rgb(22 134 91 / 12%); }
.node-light.offline { background: var(--red); }
.metrics { display: grid; grid-template-columns: 100px 120px; gap: 20px; margin: 0; }
.metrics div { min-width: 0; }
.metrics dt { margin-bottom: 4px; color: var(--muted); font-size: 11px; }
.metrics dd { margin: 0; font-size: 14px; font-variant-numeric: tabular-nums; }
.open-node { width: 74px; }

@media (max-width: 680px) {
  .shell { width: min(100% - 20px, 560px); padding-top: 22px; }
  .topbar { align-items: flex-start; }
  .status { min-width: 96px; }
  .toolbar { align-items: flex-end; }
  .toolbar label { display: grid; flex: 1; }
  select { width: 100%; min-width: 0; }
  .summary { align-items: stretch; flex-direction: column; }
  #open-best { width: 100%; }
  .node-row { display: grid; grid-template-columns: 1fr 72px; gap: 12px; }
  .node-identity { min-width: 0; }
  .metrics { grid-column: 1 / -1; grid-row: 2; grid-template-columns: 1fr 1fr; padding-left: 21px; }
  .open-node { grid-column: 2; grid-row: 1; }
}

@media (prefers-color-scheme: dark) {
  :root { color-scheme: dark; --bg: #11161b; --surface: #1a2128; --text: #edf2f5; --muted: #a6b0ba; --line: #34404a; --blue: #5aa7df; --green: #49c48f; }
}
