:root{
  --bg:#070A10;
  --panel:#0C111B;
  --panel2:#0A0E17;
  --text:#E7ECF6;
  --muted:#9AA7BF;
  --line:#162035;
  --accent:#7C5CFF;
  --ok:#17C964;
  --warn:#F5A524;
  --bad:#F31260;
  --shadow: 0 10px 30px rgba(0,0,0,.45);
  --radius:16px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: "Roboto", ui-sans-serif, system-ui, -apple-system, Segoe UI, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  --body-bg:
    radial-gradient(1200px 700px at 20% -10%, rgba(124,92,255,.25), transparent 55%),
    radial-gradient(900px 600px at 90% 10%, rgba(23,201,100,.12), transparent 55%),
    radial-gradient(900px 700px at 50% 120%, rgba(245,165,36,.08), transparent 55%),
    var(--bg);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family:var(--sans);
  background: var(--body-bg);
  color:var(--text);
}

a{ color:inherit; text-decoration:none; }
a:hover{ text-decoration:underline; }
.mono{ font-family:var(--mono); }

.app{
  display:grid;
  grid-template-columns: 280px 1fr;
  grid-template-rows: 72px 1fr;
  height:100%;
}

.topbar{
  grid-column: 1 / -1;
  display:flex;
  align-items:center;
  gap:16px;
  padding: 12px 16px;
  border-bottom:1px solid var(--line);
  background: rgba(10,14,23,.65);
  backdrop-filter: blur(10px);
}

.brand{ display:flex; align-items:center; gap:12px; min-width: 240px; }
.logo{
  width:40px; height:40px; border-radius:12px;
  display:flex; align-items:center; justify-content:center;
  background: linear-gradient(135deg, rgba(124,92,255,.85), rgba(23,201,100,.15));
  border:1px solid rgba(124,92,255,.35);
  box-shadow: var(--shadow);
  font-weight:700;
}
.brandname{ font-weight:700; letter-spacing:.2px; }
.brandmeta{ font-size:12px; color:var(--muted); margin-top:2px; }

.search{
  flex:1;
  display:flex;
  gap:10px;
  align-items:center;
}
.search input{
  width:100%;
  border:1px solid rgba(22,32,53,.9);
  background: rgba(12,17,27,.75);
  color:var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  outline:none;
}
.search input:focus{ border-color: rgba(124,92,255,.7); }

.btn{
  border:1px solid rgba(22,32,53,.9);
  background: rgba(12,17,27,.75);
  color:var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  cursor:pointer;
}
.btn:hover{ border-color: rgba(124,92,255,.6); }
.btn:active{ transform: translateY(1px); }

.topmeta{ display:flex; gap:10px; align-items:center; flex-wrap:wrap; justify-content:flex-end; }
.pill{
  font-size:12px;
  color:var(--muted);
  border:1px solid rgba(22,32,53,.9);
  background: rgba(12,17,27,.6);
  padding: 8px 10px;
  border-radius: 999px;
}
.themeSwitch{
  display:inline-flex;
  align-items:center;
  gap:2px;
  padding:2px;
  border:1px solid rgba(22,32,53,.9);
  background: rgba(12,17,27,.75);
  border-radius: 999px;
}
.themeBtn{
  border:0;
  background: transparent;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 999px;
  cursor:pointer;
  font-weight: 700;
  font-size:12px;
  line-height:1;
}
.themeBtn:hover{ color: var(--text); }
.themeBtn.active{
  background: rgba(124,92,255,.18);
  color: var(--text);
}

.sidebar{
  grid-row: 2;
  border-right:1px solid var(--line);
  background: rgba(10,14,23,.45);
  backdrop-filter: blur(10px);
  display:flex;
  flex-direction:column;
}
.nav{ padding: 12px; display:flex; flex-direction:column; gap:6px; }
.navitem{
  text-align:left;
  border:1px solid transparent;
  background: transparent;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  cursor:pointer;
  font-weight: 600;
}
.navitem:hover{ background: rgba(12,17,27,.55); border-color: rgba(22,32,53,.9); }
.navitem.active{
  background: linear-gradient(135deg, rgba(124,92,255,.18), rgba(12,17,27,.55));
  border-color: rgba(124,92,255,.35);
}
.navsep{ height:1px; background: var(--line); margin: 10px 6px; opacity:.9; }

.sidebarFooter{
  margin-top:auto;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}
.small{ font-size:12px; }
.dim{ color: var(--muted); margin-top:4px; }

.main{
  grid-row:2;
  overflow:auto;
  padding: 18px;
}

.view{ display:none; }
.view.active{ display:block; }

.grid2{ display:grid; grid-template-columns: 1fr 1fr; gap:14px; }
.grid3{ display:grid; grid-template-columns: 1fr 1fr 1fr; gap:14px; margin-top:14px; }
.overviewGrid{ margin-top:14px; }

.card{
  background: rgba(12,17,27,.72);
  border: 1px solid rgba(22,32,53,.95);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.cardHead{
  padding: 14px 14px 10px 14px;
  border-bottom: 1px solid rgba(22,32,53,.95);
  background: rgba(10,14,23,.35);
}
.cardTitle{ font-weight: 800; letter-spacing:.2px; }
.cardHint{ color: var(--muted); font-size:12px; margin-top:4px; }

.kv{
  display:grid;
  grid-template-columns: 160px 1fr;
  gap:10px 12px;
  padding: 14px;
}
.k{ color: var(--muted); font-size:12px; }
.v{ font-weight:700; }
.break{ word-break: break-all; }
.addrReveal{
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
  margin: 0;
  font: inherit;
  cursor: pointer;
  text-align: left;
  word-break: break-all;
}
.addrReveal:hover{ text-decoration: underline; }
.plainKV .v{ font-weight:400; }
.hr{ height:1px; background: rgba(22,32,53,.95); }
.big{ padding: 14px 14px 0 14px; font-size:22px; font-weight:900; }
.sub{ padding: 0 14px 14px 14px; font-size:12px; color: var(--muted); }

.tableWrap{ overflow:auto; }
.table{
  width:100%;
  border-collapse: collapse;
  min-width: 900px;
}
.table th, .table td{
  padding: 10px 12px;
  border-bottom: 1px solid rgba(22,32,53,.85);
  text-align:left;
  white-space: nowrap;
}
.table th{ font-size:12px; color: var(--muted); font-weight: 800; letter-spacing:.2px; background: rgba(10,14,23,.25); }
.table tbody tr:hover{ background: rgba(124,92,255,.08); cursor:pointer; }
#tokenHoldersTable td.addrFull{
  white-space: normal;
  word-break: break-all;
}
#tokenHoldersTable tbody tr:hover{
  cursor: default;
}
.tokenHoldersCard{
  margin-top: 22px;
}
#nftHoldersTable td.addrFull{
  white-space: normal;
  word-break: break-all;
}
#nftHoldersTable tbody tr:hover{
  cursor: pointer;
}
.nftHoldersCard{
  margin-top: 22px;
}
#holderTokenList{
  white-space: normal;
  overflow: visible;
  overflow-wrap: anywhere;
  word-break: normal;
}
.latestCard{ margin-top:18px; }
.govProposalsCard{ margin-top:22px; }
.overviewLoadingCard{
  position: relative;
}
.overviewLoadingCard.is-loading{
  pointer-events: none;
}
.overviewLoadingCard.is-loading::before{
  content: "";
  position: absolute;
  inset: 0;
  z-index: 6;
  background: rgba(7,10,16,.58);
  backdrop-filter: blur(2px);
  border-radius: var(--radius);
}
.overviewLoadingCard.is-loading::after{
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 28px;
  height: 28px;
  margin-left: -14px;
  margin-top: -14px;
  z-index: 7;
  border-radius: 50%;
  border: 3px solid rgba(154,167,191,.35);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
.eventsCard{
  position: relative;
}
.eventsLoadingOverlay{
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(7,10,16,.58);
  backdrop-filter: blur(2px);
  border-radius: var(--radius);
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s ease;
}
.eventsCard.is-loading .eventsLoadingOverlay{
  opacity: 1;
  pointer-events: auto;
}
.eventsSpinner{
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid rgba(154,167,191,.35);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
.eventsLoadingText{
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .2px;
  color: var(--text);
}
.pager{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding: 12px 14px 14px 14px;
  border-top: 1px solid rgba(22,32,53,.85);
}

.badge{
  display:inline-flex;
  align-items:center;
  padding: 4px 8px;
  border-radius: 999px;
  border:1px solid rgba(22,32,53,.85);
  font-size:12px;
  font-weight:800;
}
.badge.INFO{ color: var(--muted); }
.badge.IMPORTANT{ color: var(--warn); border-color: rgba(245,165,36,.35); background: rgba(245,165,36,.08); }
.badge.CRITICAL{ color: var(--bad); border-color: rgba(243,18,96,.35); background: rgba(243,18,96,.08); }
.statusText{
  display:inline;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 0;
  font-size:12px;
  font-weight:800;
  letter-spacing:.2px;
}
.statusText.INFO{ color: var(--muted); }
.statusText.IMPORTANT{ color: var(--warn); }
.statusText.CRITICAL{ color: var(--bad); }

.filters{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 12px 14px;
  gap: 12px;
  border-bottom: 1px solid rgba(22,32,53,.95);
}
.seg{ display:flex; gap:8px; flex-wrap:wrap; }
.right{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.segBtn{
  border:1px solid rgba(22,32,53,.9);
  background: rgba(12,17,27,.5);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 999px;
  cursor:pointer;
  font-weight: 700;
  font-size: 12px;
}
.segBtn.active{ border-color: rgba(124,92,255,.55); background: rgba(124,92,255,.12); }
.chk{ color: var(--muted); font-size: 12px; user-select:none; }
.chk input{ transform: translateY(1px); }
.sel{
  border:1px solid rgba(22,32,53,.9);
  background: rgba(12,17,27,.75);
  color: var(--text);
  padding: 6px 8px;
  border-radius: 10px;
  margin-left:6px;
}
.sel:focus{ outline:none; border-color: rgba(124,92,255,.6); }

.stepper{ margin:0; padding: 12px 14px 14px 32px; color: var(--muted); }
.stepper li{ margin: 8px 0; }
.dot{
  display:inline-block;
  width:10px; height:10px;
  border-radius:999px;
  background: rgba(124,92,255,.55);
  margin-right:10px;
  border: 1px solid rgba(124,92,255,.85);
  box-shadow: 0 0 0 3px rgba(124,92,255,.08);
  transform: translateY(1px);
}

.bul{ margin:0; padding: 12px 14px 14px 30px; color: var(--muted); }
.bul li{ margin: 8px 0; }

.contracts{
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 12px;
  padding: 14px;
}
.contractCard{
  border:1px solid rgba(22,32,53,.95);
  border-radius: 14px;
  background: rgba(10,14,23,.35);
  padding: 12px;
}
.contractTop{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.contractName{ font-weight: 900; }
.contractStatusDot{
  width:10px;
  height:10px;
  border-radius:999px;
  background:#17c964;
  box-shadow: 0 0 0 2px rgba(23,201,100,.22);
  flex: 0 0 auto;
}
.contractMeta{ margin-top:6px; color: var(--muted); font-size:12px; }
.contractAddr{ margin-top:8px; font-family: var(--mono); font-size:12px; color: var(--text); opacity:.95; }
.contractActions{ margin-top:10px; display:flex; gap:8px; flex-wrap:wrap; }
.smallBtn{
  font-size:12px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(22,32,53,.85);
  background: rgba(12,17,27,.55);
  cursor:pointer;
}
.smallBtn:hover{ border-color: rgba(124,92,255,.6); }
.smallBtn:disabled{ opacity:.45; cursor:not-allowed; }
.iconBtn{
  min-width: 40px;
  color: #ffffff;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.modal{ position:fixed; inset:0; display:none; }
.modal.open{ display:block; }
.modalBackdrop{ position:absolute; inset:0; background: rgba(0,0,0,.55); }
.modalPanel{
  position:absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
  width: min(860px, 92vw);
  max-height: 86vh;
  overflow:auto;
  background: rgba(12,17,27,.95);
  border:1px solid rgba(22,32,53,.95);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.modalHead{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  padding: 14px;
  border-bottom: 1px solid rgba(22,32,53,.95);
  gap: 14px;
}
.modalTitle{ font-weight: 900; }
.modalSub{ color: var(--muted); font-size: 12px; margin-top:4px; }
.modalBody{ padding: 14px; }
.jsonTitle{ font-weight: 900; margin: 12px 0 8px 0; }
.json{
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  background: rgba(10,14,23,.55);
  border:1px solid rgba(22,32,53,.95);
  border-radius: 14px;
  padding: 12px;
  overflow:auto;
}

body[data-theme="light"]{
  --bg:#f8f9fa;
  --panel:#ffffff;
  --panel2:#f8f9fa;
  --text:#212529;
  --muted:#6c757d;
  --line:#e9ecef;
  --accent:#0784c3;
  --ok:#00a186;
  --warn:#ffc107;
  --bad:#dc3545;
  --shadow: 0 0.125rem 0.25rem rgba(8,29,53,.06);
  --radius:12px;
  --body-bg:#f8f9fa;
}
body[data-theme="light"] a{ color:#0784c3; }
body[data-theme="light"] a.btn,
body[data-theme="light"] a.smallBtn{ color:var(--text); }
body[data-theme="light"] .topbar{
  background:#fff;
  border-bottom:1px solid var(--line);
  backdrop-filter:none;
}
body[data-theme="light"] .logo{
  background: linear-gradient(135deg, #0784c3, #2aa5de);
  border-color:#0784c3;
  color:#fff;
  box-shadow:none;
}
body[data-theme="light"] .themeSwitch{
  background:#fff;
  border-color:var(--line);
}
body[data-theme="light"] .themeBtn.active{
  background:#eaf4fb;
  color:#066a9c;
}
body[data-theme="light"] .search input,
body[data-theme="light"] .btn,
body[data-theme="light"] .pill,
body[data-theme="light"] .segBtn,
body[data-theme="light"] .sel,
body[data-theme="light"] .smallBtn{
  background:#fff;
  border-color:var(--line);
  color:var(--text);
}
body[data-theme="light"] .pill{ background:#f8f9fa; color:#6c757d; }
body[data-theme="light"] .search input::placeholder{ color:#9aa7bf; }
body[data-theme="light"] .search input:focus,
body[data-theme="light"] .sel:focus{
  border-color:#9ccee7;
  box-shadow:0 0 0 .15rem rgba(7,132,195,.15);
}
body[data-theme="light"] .btn:hover,
body[data-theme="light"] .smallBtn:hover{
  border-color:#9ccee7;
  background:#f8fbff;
}
body[data-theme="light"] .sidebar{
  background:#fff;
  border-right:1px solid var(--line);
  backdrop-filter:none;
}
body[data-theme="light"] .navitem:hover{
  background:#f8f9fa;
  border-color:var(--line);
}
body[data-theme="light"] .navitem.active{
  background:#eaf4fb;
  border-color:#9ccee7;
  color:#066a9c;
}
body[data-theme="light"] .card{
  background:#fff;
  border-color:var(--line);
  box-shadow:0 .125rem .25rem rgba(8,29,53,.06);
}
body[data-theme="light"] .eventsLoadingOverlay{
  background: rgba(248,249,250,.72);
}
body[data-theme="light"] .overviewLoadingCard.is-loading::before{
  background: rgba(248,249,250,.72);
}
body[data-theme="light"] .cardHead{
  background:#fff;
  border-bottom:1px solid var(--line);
}
body[data-theme="light"] .hr{ background:var(--line); }
body[data-theme="light"] .table th,
body[data-theme="light"] .table td{
  border-bottom:1px solid var(--line);
}
body[data-theme="light"] .table th{
  background:#f8f9fa;
  color:#6c757d;
}
body[data-theme="light"] .table tbody tr:hover{
  background:#f5f9fc;
}
body[data-theme="light"] .filters{
  border-bottom:1px solid var(--line);
}
body[data-theme="light"] .segBtn.active{
  border-color:#9ccee7;
  background:#eaf4fb;
  color:#066a9c;
}
body[data-theme="light"] .contractCard{
  background:#fff;
  border-color:var(--line);
}

@keyframes spin{
  to{ transform: rotate(360deg); }
}
body[data-theme="light"] .contractStatusDot{
  background:#00a186;
  box-shadow: 0 0 0 2px rgba(0,161,134,.2);
}
body[data-theme="light"] .iconBtn{ color:#212529; }
body[data-theme="light"] .modalBackdrop{ background: rgba(8,29,53,.35); }
body[data-theme="light"] .modalPanel{
  background:#fff;
  border-color:var(--line);
}
body[data-theme="light"] .modalHead{ border-bottom:1px solid var(--line); }
body[data-theme="light"] .json{
  background:#f8f9fa;
  border-color:var(--line);
  color:var(--text);
}
body[data-theme="light"] .badge{
  border-color:#e9ecef;
  background:#fff;
}
body[data-theme="light"] .badge.INFO{ color:#6c757d; }
body[data-theme="light"] .badge.IMPORTANT{
  color:#997404;
  border-color:#ffe69c;
  background:#fff3cd;
}
body[data-theme="light"] .badge.CRITICAL{
  color:#b02a37;
  border-color:#f1aeb5;
  background:#f8d7da;
}
body[data-theme="light"] .statusText.INFO{ color:#6c757d; }
body[data-theme="light"] .statusText.IMPORTANT{ color:#997404; }
body[data-theme="light"] .statusText.CRITICAL{ color:#b02a37; }
body[data-theme="light"] .addrReveal{ color:var(--text); }

@media (max-width: 1100px){
  .grid3{ grid-template-columns: 1fr; }
  .grid2{ grid-template-columns: 1fr; }
  .app{ grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; }
  .topbar{ flex-wrap:wrap; }
  .search{ flex: 1 1 100%; order: 3; }
  .topmeta{ width: 100%; justify-content:flex-start; }
  .sidebar{ grid-row:2; border-right:0; border-bottom:1px solid var(--line); }
  .nav{ flex-direction:row; overflow:auto; }
  .navitem{ white-space:nowrap; }
  .main{ grid-row:3; }
  .brand{ min-width:auto; }
}
