:root {
  --navy: #071426;
  --ink: #172033;
  --muted: #5c667a;
  --line: #d8deea;
  --blue: #1974c8;
  --orange: #ff6b22;
  --green: #1d9e6a;
  --red: #d64545;
  --panel: #f6f8fc;
  --bg: #eef2f7;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}

/* ── Top bar ─────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
  background: var(--navy);
  color: #fff;
  padding: 14px 24px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 38px; height: 38px; border-radius: 9px;
  background: linear-gradient(135deg, var(--blue), #4a9be8);
  display: grid; place-items: center;
  font-weight: 800; font-size: 20px; color: #fff;
}
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: .2px; }
.brand-sub { font-size: 12px; color: #9db4cf; }
.network-strip { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pill {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.16);
  padding: 5px 12px; border-radius: 999px;
  font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.pill.muted { color: #b9c8dd; }
.pill.live { color: #7ee0a8; border-color: #7ee0a8; }
.pill.live.warn { color: #ffd27a; border-color: #ffd27a; }

/* ── Tabs ────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 4px; padding: 0 24px;
  background: #fff; border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.tab {
  border: 0; background: transparent; padding: 13px 16px;
  font-size: 13.5px; font-weight: 600; color: var(--muted);
  cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap;
}
.tab:hover { color: var(--blue); }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); }

/* ── Layout ──────────────────────────────────────────── */
main { padding: 22px 24px 40px; max-width: 1280px; margin: 0 auto; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.card {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 18px; box-shadow: 0 1px 3px rgba(7,20,38,.05);
}
.card h3 { margin: 0 0 12px; font-size: 14px; color: var(--navy); text-transform: uppercase; letter-spacing: .06em; }
.stat .value { font-size: 30px; font-weight: 800; color: var(--navy); font-family: ui-monospace, Menlo, monospace; }
.stat .label { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.stat .hint { font-size: 12px; color: var(--blue); margin-top: 4px; }

h2 { font-size: 20px; color: var(--navy); margin: 4px 0 16px; }
h2 .sub { font-size: 13px; color: var(--muted); font-weight: 500; }

/* ── Tables ──────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--line);
}
td { padding: 9px 10px; border-bottom: 1px solid #edf1f7; vertical-align: top; }
tbody tr:hover td { background: #fafcff; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.hash { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--blue); word-break: break-all; }
.link { color: var(--blue); cursor: pointer; text-decoration: none; }
.link:hover { text-decoration: underline; }
.right { text-align: right; }

/* ── Badges ──────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
}
.badge.green { background: #e3f5ec; color: #147a52; }
.badge.red { background: #fdeaea; color: #b23c3c; }
.badge.gray { background: #eef1f6; color: var(--muted); }
.badge.blue { background: #e3eefb; color: #1560a8; }
.badge.orange { background: #ffefe4; color: #c2531a; }

/* ── Detail rows ─────────────────────────────────────── */
.detail { font-size: 13px; }
.detail .row { display: grid; grid-template-columns: 180px 1fr; gap: 10px; padding: 7px 0; border-bottom: 1px solid #edf1f7; }
.detail .row .k { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding-top: 1px; }
.detail .row .v { word-break: break-all; }

/* ── Buttons & forms ─────────────────────────────────── */
.btn {
  background: var(--blue); color: #fff; border: 0; border-radius: 8px;
  padding: 9px 16px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: #fff; color: var(--blue); border: 1px solid var(--line); }
.btn.warn { background: var(--orange); }
.btn.danger { background: var(--red); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
input, textarea, select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px; font-family: ui-monospace, Menlo, monospace; background: #fff; color: var(--ink);
}
label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin: 10px 0 4px; text-transform: uppercase; letter-spacing: .04em; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.alert { border-radius: 10px; padding: 12px 14px; font-size: 13px; margin: 12px 0; }
.alert.green { background: #e3f5ec; border: 1px solid #bfe6d3; color: #147a52; }
.alert.red { background: #fdeaea; border: 1px solid #f4c4c4; color: #b23c3c; }
.alert.blue { background: #e3eefb; border: 1px solid #c3d9f5; color: #1560a8; }
.alert.orange { background: #ffefe4; border: 1px solid #ffd3b3; color: #c2531a; }
.alert .title { font-weight: 700; margin-bottom: 3px; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
.hidden { display: none; }

/* ── Verify result ───────────────────────────────────── */
.verify-result { border-radius: 12px; padding: 18px; margin-top: 14px; border: 1px solid var(--line); }
.verify-result.verified { background: #f0faf5; border-color: #bfe6d3; }
.verify-result.tampered { background: #fdf0f0; border-color: #f4c4c4; }
.verify-result.notfound { background: #f6f7f9; border-color: var(--line); }
.verify-result .status-label { font-size: 22px; font-weight: 800; }

.loading { color: var(--muted); padding: 30px; text-align: center; font-size: 13px; }
.empty { color: var(--muted); padding: 18px; text-align: center; font-size: 13px; }

/* ── API page ────────────────────────────────────────── */
pre.code {
  background: var(--navy); color: #c9e2ff; padding: 14px 16px; border-radius: 10px;
  font-size: 12.5px; overflow-x: auto; font-family: ui-monospace, Menlo, monospace; line-height: 1.6;
}

.foot {
  text-align: center; color: var(--muted); font-size: 12px;
  padding: 18px 24px 26px; border-top: 1px solid var(--line); background: #fff;
}

/* ── Validators page ─────────────────────────────────── */
.section-title { font-size: 15px; color: var(--navy); margin: 18px 0 10px; font-weight: 700; }
.section-title .sub { font-size: 12.5px; color: var(--muted); font-weight: 500; }

.flow { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; margin: 10px 0 4px; }
.fstep { flex: 1 1 150px; min-width: 150px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 12px; text-align: center; }
.fico { font-size: 28px; line-height: 1; }
.flabel { font-size: 12.5px; color: var(--muted); margin-top: 8px; line-height: 1.4; }
.farrow { align-self: center; color: var(--blue); font-size: 18px; font-weight: 800; padding: 0 2px; }

.legend { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 14px; font-size: 12.5px; color: var(--muted); }
.lg { display: inline-flex; align-items: center; gap: 7px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.dot.green { background: var(--green); }
.dot.gray { background: #9aa4b5; }

.vnode { padding: 18px; transition: transform .15s ease, box-shadow .15s ease; }
.vnode:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(7,20,38,.10); }
.vnode .vhead { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.vnode .avatar { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; font-size: 22px; flex: none; box-shadow: 0 2px 6px rgba(7,20,38,.14); }
.avatar.g0 { background: linear-gradient(135deg, #1974c8, #4a9be8); }
.avatar.g1 { background: linear-gradient(135deg, #1d9e6a, #57c795); }
.avatar.g2 { background: linear-gradient(135deg, #ff6b22, #ff9a5e); }
.avatar.g3 { background: linear-gradient(135deg, #7a5af8, #a78bfa); }
.avatar.g4 { background: linear-gradient(135deg, #0f9ba8, #4fd1d9); }
.vnode .vname { font-weight: 700; font-size: 14.5px; color: var(--navy); line-height: 1.25; }
.vnode .vorg { font-size: 12px; color: var(--muted); margin-top: 2px; }
.vnode .vmeta { display: flex; flex-wrap: wrap; gap: 6px; }
.vnode .vdesc { font-size: 12.5px; color: var(--muted); margin: 12px 0 0; line-height: 1.5; }
.vnode.observer { background: #fafbfd; }
.vnode.observer .avatar { filter: grayscale(.35); }

/* Validator node — richer profile */
.vnode .vwho { font-size: 12.5px; color: var(--navy); font-weight: 600; line-height: 1.5; }
.vnode .vlife { font-size: 12.5px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.vnode .vhow { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.vnode .vchips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.stage-chip { display: inline-block; padding: 3px 8px; border-radius: 20px; background: #eef3fb; color: #1560a8; font-size: 11px; font-weight: 600; border: 1px solid #dbe7f7; white-space: nowrap; }
.vnode .vrbac { margin-top: 10px; color: var(--muted); font-size: 12px; }
.vnode .vrbac b { color: var(--navy); }

/* ── Infra node rack styling (validators) ───────────── */
.inode { padding: 0; overflow: hidden; position: relative; }
.rack {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, #243247 0%, #141d2a 100%);
  color: #dbe6f3;
  padding: 14px 18px 12px;
  display: flex; align-items: center; gap: 14px;
  border-radius: 12px 12px 0 0;
  border-bottom: 2px solid #0b1420;
}
.rack::before, .rack::after { content: ''; position: absolute; top: 0; bottom: 0; width: 6px; background: linear-gradient(90deg, #3b4a5c, #1e2936); }
.rack::before { left: 0; }
.rack::after { right: 0; }
.rack-icon { font-size: 30px; filter: drop-shadow(0 2px 5px rgba(0,0,0,.45)); }
.rack-id { flex: 1; min-width: 0; }
.rack-name { font-weight: 700; font-size: 15px; color: #fff; letter-spacing: .2px; line-height: 1.2; }
.rack-org { font-size: 11.5px; color: #94a8bd; margin-top: 1px; }
.rack-flags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.flag { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 10.5px; font-weight: 700; letter-spacing: .3px; background: rgba(255,255,255,.08); color: #cfe0f0; border: 1px solid rgba(255,255,255,.14); }
.rack-leds { display: flex; flex-direction: column; gap: 7px; margin-left: auto; align-items: flex-end; }
.led { width: 9px; height: 9px; border-radius: 50%; background: #33415a; box-shadow: inset 0 0 3px rgba(0,0,0,.7); flex: none; }
.led.power.on { background: #2fd07c; box-shadow: 0 0 8px #2fd07c; }
.led.ok { background: #34c3ff; box-shadow: 0 0 8px #34c3ff; }
.led.blink { background: #ffd166; box-shadow: 0 0 10px #ffd166; animation: ledBlink 1.1s infinite; }
@keyframes ledBlink { 0%, 100% { opacity: 1; } 50% { opacity: .2; } }
.rack-vent { position: absolute; left: 10px; right: 10px; bottom: 0; height: 5px; background: repeating-linear-gradient(90deg, #0a1119 0 4px, transparent 4px 8px); opacity: .55; }
.rack-eq { display: flex; align-items: flex-end; gap: 3px; height: 16px; margin-left: 12px; opacity: .25; }
.rack-eq span { width: 3px; border-radius: 1px; height: 4px; background: #2fd07c; }
.rack-scan { position: absolute; inset: 0; pointer-events: none; opacity: 0; background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,.10) 50%, transparent 60%); background-size: 250% 100%; }
.rack-flag { display: none; padding: 2px 8px; border-radius: 12px; font-size: 10.5px; font-weight: 700; letter-spacing: .3px; background: rgba(47,208,124,.16); color: #7ff0b0; border: 1px solid rgba(47,208,124,.45); }

/* Active node — the one that last submitted evidence */
.inode.active { border-color: #2fd07c; box-shadow: 0 0 0 1px #2fd07c, 0 12px 34px rgba(47,208,124,.20); }
.inode.active .rack { background: linear-gradient(180deg, #2a4a63 0%, #18293b 100%); }
.inode.active .rack-name { color: #8df2b8; }
.inode.active .rack-eq { opacity: 1; }
.inode.active .rack-eq span { animation: eq 1s ease-in-out infinite; }
.inode.active .rack-eq span:nth-child(1) { animation-delay: 0s; }
.inode.active .rack-eq span:nth-child(2) { animation-delay: .12s; }
.inode.active .rack-eq span:nth-child(3) { animation-delay: .24s; }
.inode.active .rack-eq span:nth-child(4) { animation-delay: .36s; }
.inode.active .rack-eq span:nth-child(5) { animation-delay: .48s; }
.inode.active .rack-flag { display: inline-block; animation: ledBlink 2s infinite; }
.inode.active .rack-scan { opacity: 1; animation: scan 2.4s linear infinite; }
@keyframes eq { 0%, 100% { height: 4px; } 50% { height: 16px; } }
@keyframes scan { 0% { background-position: 200% 0; } 100% { background-position: -50% 0; } }

/* Observer / read-only node — dimmed */
.inode.observer .rack { background: linear-gradient(180deg, #1f2b38 0%, #131b26 100%); }
.inode.observer .rack-icon { filter: grayscale(.4); }
.inode.observer .led.ok { opacity: .5; }

.inode-body { padding: 14px 16px 16px; }
.inode-body .vwho { font-size: 12.5px; color: var(--navy); font-weight: 600; line-height: 1.5; }
.inode-body .vlife { font-size: 12.5px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.inode-body .vhow { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.inode-body .vchips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.inode-body .vrbac { margin-top: 10px; color: var(--muted); font-size: 12px; }
.inode-body .vrbac b { color: var(--navy); }
.last-seal { display: none; margin-top: 10px; color: #34c3ff; font-size: 12px; font-weight: 600; }
.inode.sealed .last-seal { display: block; }

/* Live activity banner */
.live-bar .live-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #2fd07c; box-shadow: 0 0 8px #2fd07c; margin-right: 6px; animation: ledBlink 1.6s infinite; }

/* ── Live chain (Blocks / Dashboard) ─────────────────── */
.chain { display: flex; flex-direction: column; }
.chain-block {
  position: relative; background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; box-shadow: 0 1px 3px rgba(7,20,38,.05); overflow: hidden;
}
.chain-block::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: #c9d3e0; }
.chain-block.has-txs::before { background: linear-gradient(180deg, var(--blue), #4a9be8); }
.chain-block.new { animation: chainDrop .5s cubic-bezier(.22,.9,.35,1) both; }
.chain-block.new::after {
  content: ''; position: absolute; inset: 0; border-radius: 12px; pointer-events: none;
  box-shadow: 0 0 0 0 rgba(47,208,124,.55); animation: pulseRing 1.6s ease-out .3s 2;
}
.chain-block.pulse { animation: chainPulse 1.2s ease-out both; }
@keyframes chainDrop { 0% { opacity: 0; transform: translateY(-14px) scale(.98); } 100% { opacity: 1; transform: none; } }
@keyframes pulseRing { 0% { box-shadow: 0 0 0 0 rgba(47,208,124,.5); } 100% { box-shadow: 0 0 0 14px rgba(47,208,124,0); } }
@keyframes chainPulse { 0% { background: #f0faf5; } 100% { background: #fff; } }
.chain-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chain-num { font-weight: 800; font-size: 15px; color: var(--navy); font-family: ui-monospace, Menlo, monospace; }
.chain-prop { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.chain-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.chain-dot.c0 { background: #1974c8; } .chain-dot.c1 { background: #1d9e6a; }
.chain-dot.c2 { background: #ff6b22; } .chain-dot.c3 { background: #7a5af8; } .chain-dot.c4 { background: #0f9ba8; }
.chain-purpose { margin-left: auto; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.chain-purpose.tx { color: var(--blue); }
.chain-txs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chain-tx {
  display: inline-flex; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 4px 9px; font-size: 12px;
}
.chain-block.new .chain-tx { animation: chipFly .45s ease-out backwards; }
@keyframes chipFly { 0% { opacity: 0; transform: translateX(-8px) scale(.9); } 100% { opacity: 1; transform: none; } }
.chain-meta { margin-top: 8px; font-size: 11.5px; color: var(--muted); }
.chain-link { width: 2px; height: 18px; background: #c9d3e0; margin: 2px 0 2px 20px; transform-origin: top; }
.chain-block.new + .chain-link { animation: linkDraw .4s ease-out .15s both; }
@keyframes linkDraw { 0% { transform: scaleY(0); } 100% { transform: scaleY(1); } }
.chain-block.compact { padding: 10px 12px; }
.chain-block.compact .chain-meta { display: none; }
.chain-block.compact .chain-head { gap: 8px; }

/* ── Toasts (evidence anchor notifications) ──────────── */
.toast-stack { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 1000; max-width: 380px; }
.toast {
  display: flex; align-items: flex-start; gap: 10px; background: var(--navy); color: #e8f1fb;
  border: 1px solid rgba(255,255,255,.14); border-radius: 10px; padding: 11px 14px; font-size: 12.5px;
  box-shadow: 0 8px 24px rgba(7,20,38,.25); animation: toastIn .35s cubic-bezier(.22,.9,.35,1) both;
}
.toast .toast-ico { font-size: 16px; line-height: 1.2; }
.toast .toast-body { line-height: 1.45; }
.toast.out { animation: toastOut .35s ease-in both; }
@keyframes toastIn { 0% { opacity: 0; transform: translateX(24px); } 100% { opacity: 1; transform: none; } }
@keyframes toastOut { 0% { opacity: 1; } 100% { opacity: 0; transform: translateX(24px); } }

/* ── Dashboard cards, tables & pagination ─────────── */
.card-head-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-head-row .link.small { font-weight: 600; text-transform: none; letter-spacing: 0; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table { width: 100%; }
.table-wrap td { word-break: break-word; }
.table-wrap td.subj { word-break: break-all; }

.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 14px; }
.pager .btn { padding: 7px 14px; font-size: 12.5px; }
.pager .btn:disabled { opacity: .45; cursor: not-allowed; }
.pager-info { font-size: 12.5px; color: var(--muted); }

.dash-refresh { margin-left: 10px; padding: 4px 12px; font-size: 12px; vertical-align: middle; }

/* ── Batch lifecycle (Verify tab) ───────────────────── */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip-row .btn { padding: 5px 10px; font-size: 12px; }

.lifecycle { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.lstep { display: flex; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); }
.lstep.done { border-left: 4px solid #2fa96b; }
.lstep.pending { border-left: 4px solid #c9d3e0; opacity: .8; }
.l-ico { font-size: 22px; line-height: 1.3; }
.l-body { flex: 1; min-width: 0; }
.l-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.l-name { font-weight: 700; color: var(--navy); font-size: 13.5px; }
.l-evid { margin-left: auto; color: var(--blue); font-size: 12px; }
.l-desc { margin-top: 3px; }
.l-meta { margin-top: 6px; color: var(--muted); }
.l-hash { margin-top: 3px; color: var(--blue); word-break: break-all; }

.verify-row { padding: 7px 0; border-bottom: 1px solid #edf1f7; font-size: 13px; }
.verify-row.ok { color: #147a52; }
.verify-row.bad { color: #b23c3c; }

details.card summary { cursor: pointer; font-weight: 600; color: var(--navy); }
details.card[open] summary { margin-bottom: 8px; }

@media (max-width: 760px) {
  .form-row { grid-template-columns: 1fr; }
  .detail .row { grid-template-columns: 1fr; gap: 2px; }
  main { padding: 16px; }
}
