:root {
  --bg: #0e1116;
  --panel: #161b22;
  --panel-2: #1c232c;
  --line: #2a323d;
  --fg: #e6edf3;
  --muted: #9aa7b4;
  --ok: #3fb950;
  --warn: #d29922;
  --err: #f85149;
  --accent: #58a6ff;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
}

.topbar {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

h1 { font-size: 1.15rem; margin: 0 0 .25rem; }
h2 { font-size: 1rem; margin: 0 0 .5rem; }
.sub { margin: 0; color: var(--muted); font-size: .85rem; max-width: 46rem; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: .78rem; }
.mono, code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

main { padding: 1.25rem 1.5rem 3rem; display: grid; gap: 1rem; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem 1.1rem;
}

.row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.row-actions { display: flex; gap: .6rem; align-items: center; }

button {
  background: var(--panel-2);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: .42rem .8rem;
  font: inherit;
  cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.danger { border-color: var(--err); color: #ffd9d5; }

.banner {
  margin: 1rem 1.5rem;
  padding: .7rem .9rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
}
.banner-error { border-color: var(--err); }

.grid { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fill, minmax(23rem, 1fr)); }

.card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .85rem .95rem;
  display: grid;
  gap: .6rem;
}
.card.state-unreachable, .card.state-error { border-color: var(--err); }
.card.state-stale { border-color: var(--warn); }

.card-head { display: flex; justify-content: space-between; gap: .6rem; align-items: baseline; flex-wrap: wrap; }
.card-title { font-weight: 600; }
.pubkey { color: var(--muted); font-size: .74rem; word-break: break-all; }

.badge {
  font-size: .72rem;
  padding: .12rem .5rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  white-space: nowrap;
}
.badge.live { border-color: var(--ok); color: var(--ok); }
.badge.stale { border-color: var(--warn); color: var(--warn); }
.badge.unreachable, .badge.error { border-color: var(--err); color: var(--err); }
.badge.loading { color: var(--muted); }

.facts { display: grid; gap: .3rem; margin: 0; }
.facts div { display: flex; gap: .5rem; justify-content: space-between; border-bottom: 1px dashed var(--line); padding-bottom: .2rem; }
.facts dt { color: var(--muted); font-size: .78rem; }
.facts dd { margin: 0; font-size: .82rem; text-align: right; }

.error-text { color: var(--err); font-size: .8rem; }
.output { background: #0b0f14; border: 1px solid var(--line); border-radius: 7px; padding: .6rem; overflow: auto; max-height: 16rem; font-size: .78rem; }

.actions { display: flex; flex-wrap: wrap; gap: .5rem; }

dialog {
  background: var(--panel);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 10px;
  max-width: 34rem;
}
dialog::backdrop { background: rgba(0, 0, 0, .6); }
dialog dl { display: grid; grid-template-columns: 6rem 1fr; gap: .3rem .6rem; }
dialog dt { color: var(--muted); font-size: .8rem; }
dialog dd { margin: 0; font-size: .82rem; word-break: break-all; }
dialog pre { margin: 0; white-space: pre-wrap; }
dialog menu { display: flex; gap: .6rem; justify-content: flex-end; padding: 0; margin: 1rem 0 0; }

footer { padding: 1rem 1.5rem 2rem; color: var(--muted); font-size: .76rem; border-top: 1px solid var(--line); }
footer p { margin: .2rem 0; max-width: 60rem; }
