:root {
  color-scheme: dark;
  --bg: #0a0d12;
  --surface: #0f141b;
  --panel: #141a23;
  --panel-2: #1b2430;
  --line: #2b3442;
  --line-strong: #3d4a5d;
  --muted: #96a3b5;
  --text: #edf2f7;
  --accent: #46d1a8;
  --accent-2: #7aa7ff;
  --accent-soft: rgba(70, 209, 168, .12);
  --warn: #e7b95a;
  --danger: #ef5f67;
  --shadow: rgba(0, 0, 0, .26);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(74, 112, 184, .12), transparent 34rem),
    linear-gradient(180deg, #0b0f15 0%, var(--bg) 42%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, #202a38, #18212c);
  color: var(--text);
  min-height: 34px;
  border-radius: 7px;
  padding: 0 10px;
  cursor: pointer;
}

button:hover {
  border-color: color-mix(in srgb, var(--accent-2) 70%, var(--line));
  background: linear-gradient(180deg, #253246, #1b2532);
}

input {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  min-height: 34px;
  border-radius: 7px;
  padding: 0 10px;
  min-width: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #0b1017, #090c11);
  padding: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: block;
  width: 38px;
  height: 38px;
  border: 1px solid color-mix(in srgb, var(--accent-2) 52%, var(--line));
  border-radius: 8px;
  background: #05070a;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .04);
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.node-card small,
.eyebrow,
.metric small {
  color: var(--muted);
}

.nav {
  display: grid;
  gap: 6px;
  margin: 28px 0;
}

.nav-link {
  color: var(--muted);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 7px;
}

.nav-link:hover,
.nav-link.is-active {
  background: #121922;
  color: var(--text);
  box-shadow: inset 3px 0 0 var(--accent-2);
}

.node-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: linear-gradient(180deg, #141b24, #10161d);
  box-shadow: 0 12px 32px var(--shadow);
}

.wallet-card {
  position: relative;
  display: grid;
  gap: 9px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: linear-gradient(180deg, #141b24, #10161d);
  box-shadow: 0 12px 32px var(--shadow);
  overflow: hidden;
}

.wallet-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--warn);
}

.wallet-card.is-connected::before {
  background: var(--accent);
}

.wallet-card.is-missing::before {
  background: var(--danger);
}

.node-card strong,
.node-card small,
.wallet-card strong,
.wallet-card small {
  display: block;
  overflow-wrap: anywhere;
}

.wallet-card button {
  width: 100%;
}

.wallet-card.is-connected #walletConnect {
  display: none;
}

.wallet-meta {
  color: var(--muted);
}

.main {
  padding: 24px;
}

.topbar {
  display: flex;
  gap: 20px;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 22px;
}

.topbar h1 {
  max-width: 740px;
  margin: 4px 0 0;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.05;
}

.eyebrow {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: .08em;
  font-weight: 700;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric,
.panel {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(20, 26, 35, .98), rgba(15, 20, 27, .98));
  border-radius: 8px;
  box-shadow: 0 12px 32px var(--shadow);
}

.metric {
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  opacity: .55;
}

.metric span,
.metric small {
  display: block;
}

.metric strong {
  display: block;
  margin: 8px 0 5px;
  font-size: 29px;
  overflow-wrap: anywhere;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, .75fr);
  gap: 12px;
  margin: 12px 0;
}

.split.is-single {
  grid-template-columns: minmax(0, 1fr);
}

.is-hidden {
  display: none !important;
}

.panel {
  padding: 14px;
  min-width: 0;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-heading h2 {
  margin: 3px 0 0;
  font-size: 16px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

#validators .table-wrap {
  overflow-x: hidden;
}

#validators table {
  width: calc(100% - 1px);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 0;
  table-layout: fixed;
}

#validators table th:nth-child(1),
#validators table td:nth-child(1) {
  width: 34px;
}

#validators table th:nth-child(2),
#validators table td:nth-child(2) {
  width: 132px;
}

#validators table th:nth-child(3),
#validators table td:nth-child(3),
#validators table th:nth-child(4),
#validators table td:nth-child(4) {
  width: 96px;
}

#validators table th:nth-child(5),
#validators table td:nth-child(5) {
  width: 104px;
}

#validators table th:nth-child(6),
#validators table td:nth-child(6) {
  width: 72px;
}

#validators table th:nth-child(7),
#validators table td:nth-child(7) {
  width: auto;
}

#validators table th:nth-child(8),
#validators table td:nth-child(8) {
  width: 88px;
}

#validators table th:nth-child(9),
#validators table td:nth-child(9) {
  width: 58px;
}

#validators table th:nth-child(10),
#validators table td:nth-child(10) {
  width: 70px;
}

#validators table th:nth-child(11),
#validators table td:nth-child(11) {
  width: 76px;
}

#validators table th:nth-child(12),
#validators table td:nth-child(12) {
  width: 64px;
}

.compact-table {
  margin-bottom: 14px;
}

.compact-table table {
  min-width: 640px;
}

th,
td {
  padding: 8px 7px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 12px;
  vertical-align: middle;
}

th {
  color: var(--muted);
  background: #101720;
  font-weight: 700;
}

td {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

tr:last-child td {
  border-bottom: 0;
}

.block-row {
  cursor: pointer;
}

.block-row:hover td {
  background: #101922;
}

.block-detail-title {
  margin: 2px 0 12px;
}

.block-detail-title h3 {
  margin: 3px 0 0;
  font-size: 16px;
}

.power-bar {
  display: grid;
  grid-template-columns: 45px minmax(36px, 1fr);
  gap: 6px;
  align-items: center;
}

.bar {
  height: 8px;
  border-radius: 999px;
  background: #0b1017;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
}

.validator-tools {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 8px;
  align-items: center;
}

.segmented-control {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #0c1219;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .03);
}

.mini-tab {
  min-height: 31px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  padding: 0 11px;
}

#activeTab {
  border-radius: 6px;
}

#registeredTab {
  border-radius: 6px;
}

#validatorSearch {
  width: 180px;
  border-color: var(--line-strong);
}

.mini-tab.is-selected {
  border-color: color-mix(in srgb, var(--accent-2) 62%, var(--line));
  background: linear-gradient(180deg, rgba(122, 167, 255, .18), rgba(70, 209, 168, .11));
  color: var(--text);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-2) 22%, transparent);
}

.addr-cell {
  white-space: nowrap;
}

.validator-name {
  color: var(--text);
  font-family: inherit;
  font-weight: 700;
}

.status-pill,
.server-pill,
.profile-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  font-family: inherit;
  font-size: 11px;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.status-pill.is-active {
  color: var(--accent);
  background: var(--accent-soft);
}

.status-pill.is-registered {
  color: var(--warn);
  background: #241d10;
  font-size: 10px;
  letter-spacing: .02em;
}

.status-pill.is-low {
  color: var(--danger);
  background: rgba(239, 95, 103, .12);
}

.server-pill {
  color: var(--muted);
}

.profile-link {
  color: var(--accent-2);
}

.uptime {
  color: var(--accent);
  font-weight: 700;
}

.uptime.is-low {
  color: var(--danger);
}

.missed,
.missed-label {
  color: var(--muted);
}

.missed-bar {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.missed-track {
  --tick-count: 64;
  position: relative;
  height: 18px;
  width: 100%;
  min-width: 220px;
  overflow: hidden;
  border-radius: 2px;
  background: repeating-linear-gradient(to right, #424242 0 3px, transparent 3px 7px);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--border) 45%, transparent);
}

.missed-track::before,
.missed-track::after {
  content: "";
  position: absolute;
  inset: 2px 0;
  width: 100%;
  background-size: 7px 100%;
  pointer-events: none;
}

.missed-track::before {
  background: repeating-linear-gradient(to right, #22c55e 0 3px, transparent 3px 7px);
  clip-path: inset(0 var(--missed-display, 0%) 0 100%);
  animation: missed-reveal-once 7.2s steps(var(--tick-count), end) forwards;
}

.missed-track::after {
  background: repeating-linear-gradient(to right, #ef4444 0 3px, transparent 3px 7px);
  opacity: 0;
  clip-path: inset(0 0 0 calc(100% - var(--missed-display, 0%)));
}

.missed-track.has-missed::after {
  opacity: 1;
  box-shadow:
    0 0 10px color-mix(in srgb, #ef4444 14%, transparent);
}

.missed-track.is-empty {
  background: repeating-linear-gradient(to right, #424242 0 3px, transparent 3px 7px);
}

.missed-track.is-empty::before,
.missed-track.is-empty::after {
  display: none;
}

.missed-track.is-settled::before,
.missed-track.is-settled::after {
  animation: none;
}

.missed-track.is-settled::before {
  clip-path: inset(0 var(--missed-display, 0%) 0 0);
}

.missed-track.is-settled::after {
  clip-path: inset(0 0 0 calc(100% - var(--missed-display, 0%)));
}

.missed-track.is-settled::after {
  opacity: 1;
}

.missed-label {
  font-size: 13px;
  white-space: nowrap;
  line-height: 1;
  letter-spacing: .02em;
}

.missed-label strong {
  color: #35e0b4;
  font-weight: 800;
}

@keyframes missed-reveal-once {
  to {
    clip-path: inset(0 var(--missed-display, 0%) 0 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .missed-track::before {
    animation: none;
    clip-path: inset(0 var(--missed-display, 0%) 0 0);
  }

  .missed-track::after {
    opacity: 1;
  }
}

.detail-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.detail-list div {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  background: #10161e;
}

.consensus-hero {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.consensus-hero article,
.consensus-cell {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101720;
}

.consensus-hero article {
  padding: 13px;
}

.consensus-hero span,
.consensus-hero small {
  color: var(--muted);
  display: block;
}

.consensus-hero strong {
  display: block;
  margin: 7px 0 4px;
  font-size: 24px;
}

.data-note {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
}

.consensus-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  gap: 8px;
}

.consensus-cell {
  padding: 10px;
}

.consensus-cell.is-proposer {
  border-color: color-mix(in srgb, var(--accent-2) 65%, var(--line));
}

.consensus-state {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.consensus-state strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.consensus-state span {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.consensus-state .is-signed {
  background: var(--accent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 45%, transparent);
}

.consensus-state .is-missed {
  background: var(--danger);
}

.consensus-state .is-pending {
  background: var(--muted);
}

.consensus-cell small,
.consensus-meta {
  color: var(--muted);
  font-size: 11px;
}

.consensus-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}

.proposal-table table {
  min-width: 760px;
}

.proposal-row {
  cursor: pointer;
}

.proposal-row:hover {
  background: rgba(122, 167, 255, .05);
}

.table-action {
  min-height: 26px;
  padding: 0 9px;
  font-size: 11px;
}

.proposal-detail {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101720;
  padding: 14px;
}

.proposal-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.proposal-detail-head h3 {
  margin: 4px 0 0;
  font-size: 18px;
}

.proposal-meta-line,
.proposal-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.proposal-meta-line {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 12px;
}

.proposal-meta-line span,
.proposal-meta-line a {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  color: inherit;
  text-decoration: none;
}

.proposal-meta-line strong {
  color: var(--text);
  font-weight: 700;
}

.proposal-stats {
  margin-bottom: 12px;
}

.proposal-stats article {
  min-width: 130px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface);
}

.proposal-stats span,
.proposal-copy p,
.proposal-raw summary {
  color: var(--muted);
}

.proposal-stats strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

.proposal-copy {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.proposal-copy p {
  margin: 8px 0 0;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.proposal-raw {
  margin-top: 12px;
}

.proposal-raw pre {
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b1017;
  padding: 12px;
  color: var(--muted);
  white-space: pre-wrap;
}

.detail-empty {
  color: var(--muted);
}

dt {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

dd {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}

.badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  font-size: 12px;
}

.peer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}

.peer {
  border: 1px solid var(--line);
  background: #10161e;
  border-radius: 8px;
  padding: 12px;
  min-height: 112px;
}

.peer strong,
.peer small {
  display: block;
  overflow-wrap: anywhere;
}

.peer small {
  color: var(--muted);
  margin-top: 6px;
}

.is-error {
  color: var(--danger);
}

@media (max-width: 940px) {
  .app-shell,
  .split,
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .topbar {
    display: grid;
  }

  .panel-heading {
    display: grid;
    align-items: stretch;
  }

  .validator-tools {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  #validatorSearch {
    width: min(100%, 260px);
  }

}

@media (max-width: 560px) {
  .main,
  .sidebar {
    padding: 14px;
  }

  .topbar h1 {
    font-size: 30px;
  }
}
