:root {
  --bg: #0d0f14;
  --bg2: #13161e;
  --bg3: #1a1e28;
  --border: #252a38;
  --accent: #7c6af7;
  --accent2: #5de0c0;
  --text: #e2e4eb;
  --muted: #6b7280;
  --danger: #ef4444;
  --success: #22c55e;
  --font: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent2); text-decoration: underline; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* ── Header ── */
header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
header .container {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 700;
  font-size: 18px;
  white-space: nowrap;
  text-decoration: none;
}
.logo:hover { text-decoration: none; color: var(--accent2); }
.logo-icon { width: 28px; height: 28px; color: var(--accent); flex-shrink: 0; }

.search-form {
  display: flex;
  flex: 1;
  gap: 0;
  max-width: 600px;
}
.search-form input {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-right: none;
  color: var(--text);
  padding: 8px 14px;
  font-family: var(--font);
  font-size: 13px;
  border-radius: var(--radius) 0 0 var(--radius);
  outline: none;
  transition: border-color 0.2s;
}
.search-form input:focus { border-color: var(--accent); }
.search-form button {
  background: var(--accent);
  border: none;
  color: #fff;
  padding: 8px 18px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  border-radius: 0 var(--radius) var(--radius) 0;
  transition: background 0.2s;
}
.search-form button:hover { background: var(--accent2); }

/* ── Main ── */
main { flex: 1; padding: 32px 0; }
main .container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* ── Stats bar ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}
.stat-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-family: var(--font); font-size: 18px; font-weight: 700; margin-top: 4px; color: var(--accent2); }
.stat-sub { color: var(--muted); font-size: 11px; margin-top: 2px; font-family: var(--font); }

/* ── Section ── */
.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 700px) { .two-col { grid-template-columns: 1fr; } }

/* ── Table ── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font);
  font-size: 12px;
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg3); }

/* ── Hash / address display ── */
.hash { color: var(--accent); word-break: break-all; }
.hash-short { color: var(--accent); }
.mono { font-family: var(--font); }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font);
}
.badge-blue { background: rgba(124,106,247,0.15); color: var(--accent); }
.badge-green { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-teal { background: rgba(93,224,192,0.15); color: var(--accent2); }

/* ── Detail page ── */
.detail-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}
.detail-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.detail-grid {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px 20px;
}
.detail-label { color: var(--muted); font-size: 12px; padding-top: 2px; }
.detail-value { font-family: var(--font); font-size: 12px; word-break: break-all; }

/* ── Tx IO ── */
.io-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  align-items: start;
}
.io-row:last-child { border-bottom: none; }
.io-amount { color: var(--accent2); white-space: nowrap; font-weight: 600; }
.io-label { color: var(--muted); font-size: 11px; }
.confidential-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(124,106,247,0.2);
  color: var(--accent);
}

/* ── Loading / error ── */
.loading, .error {
  text-align: center;
  padding: 80px 20px;
  color: var(--muted);
}
.error { color: var(--danger); }
.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Pagination ── */
.pagination { display: flex; gap: 8px; justify-content: center; margin-top: 20px; }
.page-btn {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  transition: border-color 0.2s;
}
.page-btn:hover { border-color: var(--accent); color: var(--accent); }
.page-btn:disabled { opacity: 0.3; cursor: default; }

/* ── Footer ── */
footer {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 14px 0;
  font-size: 12px;
  color: var(--muted);
}
footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
footer a { color: var(--muted); }
footer a:hover { color: var(--accent); }

/* ── Auto-refresh badge ── */
.auto-refresh-badge {
  font-size: 10px;
  color: var(--muted);
  font-weight: normal;
  letter-spacing: 0;
  text-transform: none;
  margin-left: 8px;
  opacity: 0.7;
}

/* ── Address page ── */
.balance-display {
  font-family: var(--font);
  font-size: 28px;
  font-weight: 700;
  color: var(--accent2);
  margin: 8px 0;
}
.balance-unit { font-size: 16px; color: var(--muted); margin-left: 4px; }
