:root {
  color-scheme: dark;
  --bg: #0b0d0f;
  --sidebar: #101417;
  --panel: #151a1e;
  --panel-hover: #1b2227;
  --line: #2a3035;
  --text: #e8edf1;
  --muted: #8d969e;
  --blue: #70a9f6;
  --green: #39c983;
  --yellow: #e7bd37;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  padding: 0 0 56px 248px;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 Inter, system-ui, sans-serif;
}
button, input { font: inherit; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--text); }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  width: 248px;
  padding: 18px 14px 12px;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px;
  border-radius: 8px; background: linear-gradient(140deg, #f3cf54, #d19b27);
  color: #141414; font-size: 20px; font-weight: 900;
}
.brand > span:last-child { display: flex; flex-direction: column; line-height: 1.25; }
.brand strong { font-size: 14px; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.side-section-label {
  padding: 13px 10px 6px; color: #78838b;
  font: 600 10px/1.4 var(--mono); letter-spacing: .12em;
}
.side-section-label-spaced { margin-top: 16px; }
.network {
  display: flex; align-items: center; gap: 9px; width: 100%; min-height: 42px;
  padding: 0 10px; border: 1px solid var(--line); border-radius: 7px;
  background: #171d21; color: var(--text); text-align: left; cursor: pointer;
}
.network img { width: 24px; height: 24px; border-radius: 50%; }
.network span { flex: 1; font-weight: 650; }
.network b { color: var(--muted); font-size: 16px; }
.side-nav { display: flex; flex-direction: column; margin-top: 8px; }
.side-link {
  display: flex; align-items: center; gap: 11px; min-height: 39px;
  padding: 0 11px; border-left: 2px solid transparent; border-radius: 4px;
  color: #a4adb4; font-size: 13px;
}
.side-link > span { width: 18px; color: #9aa5ae; text-align: center; font-size: 16px; }
.side-link:hover { background: #171d21; }
.side-link.active { border-left-color: var(--yellow); background: #191f23; color: #f1f3f5; }
.side-link.active > span { color: #f1f3f5; }
.sidebar-bottom {
  display: flex; align-items: center; gap: 7px; margin-top: auto;
  padding: 12px 9px 5px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 11px;
}
.sidebar-bottom strong { margin-left: auto; color: var(--green); font-weight: 600; }
.online-dot { display: inline-block; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }

.topbar {
  position: sticky; top: 0; z-index: 15;
  display: flex; align-items: center; gap: 12px;
  min-height: 58px; padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(15,19,22,.96); backdrop-filter: blur(12px);
}
.top-network {
  display: none; align-items: center; gap: 7px; min-height: 36px;
  padding: 4px 8px; border: 1px solid var(--line); border-radius: 7px;
  background: #171d21; color: var(--text); cursor: pointer;
}
.top-network img { width: 23px; height: 23px; border-radius: 50%; }
.top-network b { color: var(--muted); }
.top-status {
  display: flex; align-items: center; gap: 7px; min-height: 34px;
  padding: 0 10px; border: 1px solid var(--line); border-radius: 6px;
  color: #b7c0c6; font-size: 12px; white-space: nowrap;
}
.search { position: relative; }
.search > span { position: absolute; top: 6px; left: 10px; color: var(--muted); font-size: 18px; }
.search input {
  width: clamp(180px, 23vw, 290px); height: 34px; padding: 0 10px 0 33px;
  border: 1px solid var(--line); border-radius: 6px; outline: 0;
  background: #111619; color: var(--text); font-size: 12px;
}
.top-tool {
  display: inline-flex; align-items: center; gap: 7px; min-height: 34px;
  padding: 0 10px; border: 1px solid var(--line); border-radius: 6px;
  color: #b2bbc2; font-size: 11px; white-space: nowrap;
}
.top-tool b { color: var(--green); font-weight: 700; }
.top-tool span { color: var(--green); }
.top-tool:hover { border-color: #46515a; background: var(--panel-hover); }
.icon {
  display: grid; place-items: center; width: 34px; height: 34px; margin-left: auto;
  border: 1px solid var(--line); border-radius: 6px; background: #171d21;
  color: var(--text); cursor: pointer;
}

.network-menu {
  position: fixed; z-index: 60; top: 58px; left: 248px;
  width: min(650px, calc(100vw - 270px)); padding: 8px;
  border: 1px solid var(--line); border-radius: 8px;
  background: #11171b; box-shadow: 0 16px 40px rgba(0,0,0,.5);
}
.network-menu[hidden] { display: none; }
.network-menu [hidden], .network-group[hidden] { display: none; }
.network-search {
  display: flex; align-items: center; gap: 8px; height: 40px; margin-bottom: 8px;
  padding: 0 10px; border: 1px solid var(--yellow); border-radius: 4px; color: var(--muted);
}
.network-search input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); }
.network-columns { display: grid; grid-template-columns: 1fr 1fr; }
.network-group { min-width: 0; padding: 0 8px; }
.network-group + .network-group { border-left: 1px solid var(--line); }
.network-group h2 {
  display: flex; justify-content: space-between; align-items: center;
  margin: 0; padding: 7px 4px; color: var(--muted);
  font: 600 11px/1.4 var(--mono); text-transform: lowercase;
}
.network-group h2 small { min-width: 22px; border-radius: 3px; background: var(--panel-hover); text-align: center; color: var(--text); }
.network-menu button {
  display: flex; align-items: center; gap: 9px; width: 100%; min-height: 56px;
  padding: 7px 9px; border: 0; border-radius: 5px; background: transparent;
  color: var(--text); text-align: left; cursor: pointer;
}
.network-menu button:hover, .network-menu button[aria-checked="true"] { background: rgba(255,255,255,.045); }
.network-menu img { width: 28px; height: 28px; border-radius: 50%; }
.network-menu button > span { display: flex; flex-direction: column; }
.network-menu small { color: var(--muted); font-size: 10px; }
.network-menu i { margin-left: auto; color: var(--yellow); font-style: normal; }

main { width: 100%; padding: 20px 22px 35px; }
.title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; }
.eyebrow { margin: 0 0 2px; color: var(--blue); font: 600 10px/1.4 var(--mono); letter-spacing: .14em; }
h1 { margin: 0; font: 700 clamp(23px, 2vw, 30px)/1.2 var(--mono); letter-spacing: -.04em; }
.chain-badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 999px;
  color: #bdc5ca; font: 11px var(--mono);
}

.network-state {
  width: 100%; margin: 0 0 16px; padding: 14px 17px 13px;
  border: 1px solid #30383e; border-radius: 8px;
  background: linear-gradient(120deg, #151a1e, #14191d);
}
.network-state > h2 {
  display: flex; justify-content: space-between; align-items: center;
  margin: 0 0 7px; color: var(--blue);
  font: 700 11px/1.5 var(--mono); letter-spacing: .09em;
}
.live-label { display: flex; align-items: center; gap: 6px; color: var(--green); font-size: 9px; }
.live-label i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px #39c98388; }
.state-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.state-grid dl { display: flex; flex-direction: column; gap: 3px; margin: 0; min-width: 0; }
.state-grid dl > div {
  display: grid; grid-template-columns: minmax(105px, 25%) minmax(0,1fr);
  align-items: baseline; gap: 10px; min-height: 18px;
}
.state-grid dt { color: #8c969e; font: 11px/1.5 var(--mono); }
.state-grid dd {
  overflow: hidden; margin: 0; color: #d3d9de;
  font: 11px/1.5 var(--mono); text-overflow: ellipsis; white-space: nowrap;
}
.state-grid dd.hash { font-size: 9px; }
#state-consensus { background: #1d2c3d; color: #d9e8fb; }
#state-votes { color: #f1a4ac; }
#state-active-vals, #state-active-vp { color: #c3ced7; }

.list-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 48px; margin-bottom: 8px;
}
.tabs {
  display: flex; align-items: center; gap: 4px; padding: 3px;
  border: 1px solid var(--line); border-radius: 7px; background: #111619;
}
.tab {
  display: inline-flex; align-items: center; gap: 8px; min-height: 31px;
  padding: 0 13px; border: 0; border-radius: 5px;
  background: transparent; color: #9ba5ac; font-size: 12px; cursor: pointer;
}
.tab b { min-width: 19px; padding: 1px 5px; border-radius: 10px; background: #293138; font-size: 10px; font-weight: 500; text-align: center; }
.tab.active { background: var(--blue); color: #0d1824; font-weight: 700; }
.tab.active b { background: rgba(7,25,48,.15); }
.list-note { color: var(--muted); font-size: 11px; }

.table-wrap {
  width: 100%; overflow: auto; border: 1px solid #2a3035; border-radius: 7px;
  background: #111416;
}
table { width: 100%; min-width: 1040px; border-collapse: collapse; }
thead { background: #1a1d1e; }
th {
  height: 39px; color: #7f898f; font-size: 10px; font-weight: 650;
  letter-spacing: .06em; text-align: left; text-transform: uppercase; white-space: nowrap;
}
th, td { padding: 9px 12px; border-bottom: 1px solid #292d30; }
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: #191d20; }
tbody tr:last-child td { border-bottom: 0; }
td { color: #c0c7cc; font-size: 11px; white-space: nowrap; }
.rank { width: 50px; color: #7b858b; font: 10px var(--mono); }
.validator-name { color: #eff2f4; font-size: 12px; font-weight: 700; }
.address { color: #8a949a; font: 10px var(--mono); }
.power { color: #e0e5e9; font-weight: 700; }
.status {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px;
  border: 1px solid #333a3e; border-radius: 999px; color: #9aa4aa;
  font: 700 9px var(--mono); text-transform: uppercase;
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #737d83; }
.status.is-active { border-color: #205842; background: #123025; color: var(--green); }
.status.is-active::before { background: var(--green); box-shadow: 0 0 6px #39c98388; }
.priority { display: inline-block; min-width: 39px; padding: 3px 7px; border: 1px solid #293d51; border-radius: 999px; background: #172635; color: #92c3fa; font: 10px var(--mono); text-align: center; }
.uptime { display: flex; align-items: center; gap: 8px; }
.uptime-percent { min-width: 42px; color: #58d99b; font: 700 10px var(--mono); }
.uptime-blocks { display: flex; align-items: center; gap: 2px; min-width: 120px; }
.uptime-blocks i { display: block; width: 3px; height: 15px; border-radius: 1px; background: #31c47c; }
.uptime-blocks i.missed { background: #a74d58; }
.uptime.na, .muted { color: var(--muted); }
.missed-count { color: #909aa1; font: 10px var(--mono); }
.missed-count strong { color: #e5a56e; font-weight: 600; }
.loading { height: 100px; color: var(--muted); text-align: center; }

.mobile-nav { display: none; }
footer {
  position: fixed; right: 0; bottom: 0; left: 248px; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  height: 42px; padding: 0 22px; border-top: 1px solid var(--line);
  background: #101417; color: #758087; font-size: 10px;
}
footer code { color: #8fa9c1; font: 10px var(--mono); }

body.light {
  color-scheme: light;
  --bg: #edf1f4; --sidebar: #f7f9fa; --panel: #fff; --panel-hover: #e9eef2;
  --line: #d1d8dd; --text: #1d2931; --muted: #64727c;
  background: var(--bg); color: var(--text);
}
body.light .topbar, body.light footer { background: rgba(247,249,250,.96); }
body.light .network-state, body.light .table-wrap, body.light .tabs, body.light .top-status { background: #fff; }
body.light .network-state dd, body.light .validator-name, body.light .power { color: #1d2931; }
body.light .network-state { border-color: var(--line); }

@media (max-width: 1100px) {
  .top-tool { padding-inline: 8px; }
  .top-tool:nth-of-type(3) { display: none; }
}
@media (max-width: 900px) {
  body { padding-left: 0; }
  .sidebar { display: none; }
  .topbar { min-height: 56px; padding: 0 12px; }
  .top-network { display: flex; }
  .top-status, .top-tool { display: none; }
  .search { flex: 1; }
  .search input { width: 100%; }
  main { padding: 16px 12px 82px; }
  .network-menu { top: 59px; left: 12px; width: min(650px, calc(100vw - 24px)); }
  .list-note { display: none; }
  footer { display: none; }
  .mobile-nav {
    position: fixed; right: 0; bottom: 0; left: 0; z-index: 30;
    display: grid; grid-template-columns: repeat(4,1fr); height: 61px;
    border-top: 1px solid var(--line); background: var(--sidebar);
  }
  .mobile-nav a {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; color: var(--muted); font-size: 17px;
  }
  .mobile-nav a span { font-size: 10px; }
  .mobile-nav a.active { color: var(--blue); }
}
@media (max-width: 600px) {
  .network-columns { grid-template-columns: 1fr; }
  .network-group + .network-group { border-top: 1px solid var(--line); border-left: 0; }
  .top-network strong { display: none; }
  .icon { display: none; }
  .chain-badge { font-size: 9px; }
  .state-grid { grid-template-columns: 1fr; gap: 4px; }
  .state-grid dl + dl { padding-top: 4px; border-top: 1px solid var(--line); }
  .state-grid dl > div { grid-template-columns: 105px minmax(0,1fr); }
  .list-toolbar { justify-content: flex-start; }
  .uptime-blocks { min-width: 75px; gap: 1px; }
  .uptime-blocks i { width: 2px; height: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}
